diff --git a/CONTRIBUTING-CN.md b/CONTRIBUTING-CN.md index efaa2077fe..887cff0978 100644 --- a/CONTRIBUTING-CN.md +++ b/CONTRIBUTING-CN.md @@ -18,7 +18,7 @@ 注意:修改文档的分支要以`docs/`为开头,以免进行不必要的测试。 4. 创建pull request,将自己的分支合并到开发分支`3.0`,我们开发团队将尽快审核。 -如遇任何问题,请添加官方微信TDengineECO。我们的团队会帮忙解决。 +如遇任何问题,请添加官方微信 tdengine1。我们的团队会帮忙解决。 ## 给贡献者的礼品 @@ -48,4 +48,4 @@ TDengine 社区致力于让更多的开发者理解和使用它。 ## 联系我们 -如果您有什么问题需要解决,或者有什么问题需要解答,可以添加微信:TDengineECO +如果您有什么问题需要解决,或者有什么问题需要解答,可以添加微信:tdengine1。 diff --git a/README-CN.md b/README-CN.md index a6dfefc47a..81d64941af 100644 --- a/README-CN.md +++ b/README-CN.md @@ -52,7 +52,7 @@ TDengine 还提供一组辅助工具软件 taosTools,目前它包含 taosBench ### Ubuntu 18.04 及以上版本 & Debian: ```bash -sudo apt-get install -y gcc cmake build-essential git libssl-dev libgflags2.2 libgflags-dev +sudo apt-get install -y gcc cmake build-essential git libssl-dev libgflags2.2 libgflags-dev libgeos-dev ``` #### 为 taos-tools 安装编译需要的软件 @@ -68,14 +68,14 @@ sudo apt install build-essential libjansson-dev libsnappy-dev liblzma-dev libz-d ```bash sudo yum install epel-release sudo yum update -sudo yum install -y gcc gcc-c++ make cmake3 git openssl-devel +sudo yum install -y gcc gcc-c++ make cmake3 git openssl-devel geos geos-devel sudo ln -sf /usr/bin/cmake3 /usr/bin/cmake ``` -### CentOS 8 & Fedora +### CentOS 8/Fedora/Rocky Linux ```bash -sudo dnf install -y gcc gcc-c++ make cmake epel-release git openssl-devel +sudo dnf install -y gcc gcc-c++ make cmake epel-release git openssl-devel geos geos-devel ``` #### 在 CentOS 上构建 taosTools 安装依赖软件 @@ -88,7 +88,7 @@ sudo dnf install -y gcc gcc-c++ make cmake epel-release git openssl-devel sudo yum install -y zlib-devel zlib-static xz-devel snappy-devel jansson jansson-devel pkgconfig libatomic libatomic-static libstdc++-static openssl-devel ``` -#### CentOS 8/Rocky Linux +#### CentOS 8/Fedora/Rocky Linux ``` sudo yum install -y epel-release @@ -101,7 +101,7 @@ sudo yum install -y zlib-devel zlib-static xz-devel snappy-devel jansson jansson 若 powertools 安装失败,可以尝试改用: ``` -sudo yum config-manager --set-enabled Powertools +sudo yum config-manager --set-enabled powertools ``` #### CentOS + devtoolset @@ -117,7 +117,7 @@ scl enable devtoolset-9 -- bash ### macOS ``` -brew install argp-standalone pkgconfig +brew install argp-standalone pkgconfig geos ``` ### 设置 golang 开发环境 diff --git a/README.md b/README.md index a088404c85..c81e2d309d 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ To build TDengine, use [CMake](https://cmake.org/) 3.0.2 or higher versions in t ### Ubuntu 18.04 and above or Debian ```bash -sudo apt-get install -y gcc cmake build-essential git libssl-dev libgflags2.2 libgflags-dev +sudo apt-get install -y gcc cmake build-essential git libssl-dev libgflags2.2 libgflags-dev libgeos-dev ``` #### Install build dependencies for taosTools @@ -76,14 +76,14 @@ sudo apt install build-essential libjansson-dev libsnappy-dev liblzma-dev libz-d ```bash sudo yum install epel-release sudo yum update -sudo yum install -y gcc gcc-c++ make cmake3 git openssl-devel +sudo yum install -y gcc gcc-c++ make cmake3 git openssl-devel geos geos-devel sudo ln -sf /usr/bin/cmake3 /usr/bin/cmake ``` -### CentOS 8 & Fedora +### CentOS 8/Fedora/Rocky Linux ```bash -sudo dnf install -y gcc gcc-c++ make cmake epel-release git openssl-devel +sudo dnf install -y gcc gcc-c++ make cmake epel-release git openssl-devel geos geos-devel ``` #### Install build dependencies for taosTools on CentOS @@ -94,7 +94,7 @@ sudo dnf install -y gcc gcc-c++ make cmake epel-release git openssl-devel sudo yum install -y zlib-devel zlib-static xz-devel snappy-devel jansson jansson-devel pkgconfig libatomic libatomic-static libstdc++-static openssl-devel ``` -#### CentOS 8/Rocky Linux +#### CentOS 8/Fedora/Rocky Linux ``` sudo yum install -y epel-release @@ -124,7 +124,7 @@ scl enable devtoolset-9 -- bash ### macOS ``` -brew install argp-standalone pkgconfig +brew install argp-standalone pkgconfig geos ``` ### Setup golang environment diff --git a/cmake/cmake.options b/cmake/cmake.options index a7e62350df..3bc5e202a5 100644 --- a/cmake/cmake.options +++ b/cmake/cmake.options @@ -64,6 +64,13 @@ IF(${TD_WINDOWS}) ON ) + MESSAGE("build geos Win32") + option( + BUILD_GEOS + "If build geos on Windows" + ON + ) + ELSEIF (TD_DARWIN_64) IF(${BUILD_TEST}) add_definitions(-DCOMPILER_SUPPORTS_CXX13) diff --git a/cmake/cmake.platform b/cmake/cmake.platform index ba747c6134..cb09bf2085 100644 --- a/cmake/cmake.platform +++ b/cmake/cmake.platform @@ -57,6 +57,8 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin SET(TD_DARWIN TRUE) SET(OSTYPE "macOS") ADD_DEFINITIONS("-DDARWIN -Wno-tautological-pointer-compare") + INCLUDE_DIRECTORIES(/usr/local/include) + LINK_DIRECTORIES(/usr/local/lib) IF (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64") MESSAGE("Current system arch is arm64") diff --git a/cmake/cmake.version b/cmake/cmake.version index 3166a0695c..6d893c0627 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.4.1") + SET(TD_VER_NUMBER "3.0.4.3") ENDIF () IF (DEFINED VERCOMPATIBLE) diff --git a/cmake/geos_CMakeLists.txt.in b/cmake/geos_CMakeLists.txt.in new file mode 100644 index 0000000000..44b3ec027c --- /dev/null +++ b/cmake/geos_CMakeLists.txt.in @@ -0,0 +1,12 @@ + +# geos +ExternalProject_Add(geos + GIT_REPOSITORY https://github.com/libgeos/geos.git + GIT_TAG 3.11.2 + SOURCE_DIR "${TD_CONTRIB_DIR}/geos" + BINARY_DIR "" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "" + ) \ No newline at end of file diff --git a/cmake/stub_CMakeLists.txt.in b/cmake/stub_CMakeLists.txt.in index cf175aab42..96cc924d81 100644 --- a/cmake/stub_CMakeLists.txt.in +++ b/cmake/stub_CMakeLists.txt.in @@ -2,6 +2,7 @@ # stub ExternalProject_Add(stub GIT_REPOSITORY https://github.com/coolxv/cpp-stub.git + GIT_TAG 5e903b8e GIT_SUBMODULES "src" SOURCE_DIR "${TD_CONTRIB_DIR}/cpp-stub" BINARY_DIR "${TD_CONTRIB_DIR}/cpp-stub/src" diff --git a/cmake/taosadapter_CMakeLists.txt.in b/cmake/taosadapter_CMakeLists.txt.in index c67918351d..ef6ed4af1d 100644 --- a/cmake/taosadapter_CMakeLists.txt.in +++ b/cmake/taosadapter_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taosadapter ExternalProject_Add(taosadapter GIT_REPOSITORY https://github.com/taosdata/taosadapter.git - GIT_TAG 565ca21 + GIT_TAG 3.0 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter" BINARY_DIR "" #BUILD_IN_SOURCE TRUE diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index 536d4eae8e..b3333dee99 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -134,6 +134,11 @@ if(${BUILD_ADDR2LINE}) endif(NOT ${TD_WINDOWS}) endif(${BUILD_ADDR2LINE}) +# geos +if(${BUILD_GEOS}) + cat("${TD_SUPPORT_DIR}/geos_CMakeLists.txt.in" ${CONTRIB_TMP_FILE}) +endif() + # download dependencies configure_file(${CONTRIB_TMP_FILE} "${TD_CONTRIB_DIR}/deps-download/CMakeLists.txt") execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" . @@ -470,6 +475,15 @@ if(${BUILD_ADDR2LINE}) endif(NOT ${TD_WINDOWS}) endif(${BUILD_ADDR2LINE}) +# geos +if(${BUILD_GEOS}) + option(BUILD_SHARED_LIBS "Build GEOS with shared libraries" OFF) + add_subdirectory(geos EXCLUDE_FROM_ALL) + target_include_directories( + geos_c + PUBLIC $ + ) +endif(${BUILD_GEOS}) # ================================================================================================ # Build test diff --git a/docs/doxgen/CMakeLists.txt b/docs/doxgen/CMakeLists.txt index da76b2c3fd..9100137bb8 100644 --- a/docs/doxgen/CMakeLists.txt +++ b/docs/doxgen/CMakeLists.txt @@ -4,7 +4,7 @@ if(${BUILD_DOCS}) find_package(Doxygen) if (DOXYGEN_FOUND) # Build the doc - set(DOXYGEN_IN ${TD_SOURCE_DIR}/docs/Doxyfile.in) + set(DOXYGEN_IN ${TD_SOURCE_DIR}/docs/doxgen/Doxyfile.in) set(DOXYGEN_OUT ${CMAKE_BINARY_DIR}/Doxyfile) configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) diff --git a/docs/en/07-develop/01-connect/index.md b/docs/en/07-develop/01-connect/index.md index 76c26bae23..8714be3c89 100644 --- a/docs/en/07-develop/01-connect/index.md +++ b/docs/en/07-develop/01-connect/index.md @@ -83,7 +83,7 @@ If `maven` is used to manage the projects, what needs to be done is only adding com.taosdata.jdbc taos-jdbcdriver - 3.0.0 + 3.2.1 ``` diff --git a/docs/en/07-develop/07-tmq.mdx b/docs/en/07-develop/07-tmq.mdx index a4eb41bd7e..d951923de5 100644 --- a/docs/en/07-develop/07-tmq.mdx +++ b/docs/en/07-develop/07-tmq.mdx @@ -285,10 +285,10 @@ You configure the following parameters when creating a consumer: | Parameter | Type | Description | Remarks | | :----------------------------: | :-----: | -------------------------------------------------------- | ------------------------------------------- | -| `td.connect.ip` | string | Used in establishing a connection; same as `taos_connect` | Only valid for establishing native connection | -| `td.connect.user` | string | Used in establishing a connection; same as `taos_connect` | Only valid for establishing native connection | -| `td.connect.pass` | string | Used in establishing a connection; same as `taos_connect` | Only valid for establishing native connection | -| `td.connect.port` | string | Used in establishing a connection; same as `taos_connect` | Only valid for establishing native connection | +| `td.connect.ip` | string | IP address of the server side | | +| `td.connect.user` | string | User Name | | +| `td.connect.pass` | string | Password | | +| `td.connect.port` | string | Port of the server side | | | `group.id` | string | Consumer group ID; consumers with the same ID are in the same group | **Required**. Maximum length: 192. | | `client.id` | string | Client ID | Maximum length: 192. | | `auto.offset.reset` | enum | Initial offset for the consumer group | Specify `earliest`, `latest`, or `none`(default) | @@ -325,6 +325,7 @@ Java programs use the following parameters: | Parameter | Type | Description | Remarks | | ----------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------- | +| `td.connect.type` | string | connection type: "jni" means native connection, "ws" means websocket connection, the default is "jni" | | `bootstrap.servers` | string |Connection address, such as `localhost:6030` | | `value.deserializer` | string | Value deserializer; to use this method, implement the `com.taosdata.jdbc.tmq.Deserializer` interface or inherit the `com.taosdata.jdbc.tmq.ReferenceDeserializer` type | | `value.deserializer.encoding` | string | Specify the encoding for string deserialization | | @@ -399,22 +400,6 @@ from taos.tmq import Consumer consumer = Consumer({"group.id": "local", "td.connect.ip": "127.0.0.1"}) ``` -Python programs use the following parameters: - -| Parameter | Type | Description | Remarks | -|:---------:|:----:|:-----------:|:-------:| -| `td.connect.ip` | string | Used in establishing a connection|| -| `td.connect.user` | string | Used in establishing a connection|| -| `td.connect.pass` | string | Used in establishing a connection|| -| `td.connect.port` | string | Used in establishing a connection|| -| `group.id` | string | Consumer group ID; consumers with the same ID are in the same group | **Required**. Maximum length: 192 | -| `client.id` | string | Client ID | Maximum length: 192 | -| `msg.with.table.name` | string | Specify whether to deserialize table names from messages | pecify `true` or `false` | -| `enable.auto.commit` | string | Commit automatically | pecify `true` or `false` | -| `auto.commit.interval.ms` | string | Interval for automatic commits, in milliseconds | | -| `auto.offset.reset` | string | Initial offset for the consumer group | Specify `earliest`, `latest`, or `none`(default) | -| `enable.heartbeat.background` | string | Backend heartbeat; if enabled, the consumer does not go offline even if it has not polled for a long time | Specify `true` or `false` | - diff --git a/docs/en/07-develop/09-udf.md b/docs/en/07-develop/09-udf.md index f107512e9c..b0124b9c3f 100644 --- a/docs/en/07-develop/09-udf.md +++ b/docs/en/07-develop/09-udf.md @@ -377,7 +377,7 @@ The `pybitand` function implements bitwise addition for multiple columns. If the #### Aggregate Function [pyl2norm](https://github.com/taosdata/TDengine/blob/3.0/tests/script/sh/pyl2norm.py) -The `pyl2norm` function finds the second-order norm for all data in the input column. This squares the values, takes a cumulative sum, and finds the square root. +The `pyl2norm` function finds the second-order norm for all data in the input columns. This squares the values, takes a cumulative sum, and finds the square root.
pyl2norm.py @@ -387,5 +387,16 @@ The `pyl2norm` function finds the second-order norm for all data in the input co
+#### Aggregate Function [pycumsum](https://github.com/taosdata/TDengine/blob/3.0/tests/script/sh/pycumsum.py) + +The `pycumsum` function finds the cumulative sum for all data in the input columns. +
+pycumsum.py + +```c +{{#include tests/script/sh/pycumsum.py}} +``` + +
## Manage and Use UDF You need to add UDF to TDengine before using it in SQL queries. For more information about how to manage UDF and how to invoke UDF, please see [Manage and Use UDF](../12-taos-sql/26-udf.md). diff --git a/docs/en/12-taos-sql/01-data-type.md b/docs/en/12-taos-sql/01-data-type.md index cca256139d..70bea97dba 100644 --- a/docs/en/12-taos-sql/01-data-type.md +++ b/docs/en/12-taos-sql/01-data-type.md @@ -42,7 +42,6 @@ In TDengine, the data types below can be used when specifying a column or tag. | 14 | NCHAR | User Defined | Multi-byte string that can include multi byte characters like Chinese characters. Each character of NCHAR type consumes 4 bytes storage. The string value should be quoted with single quotes. Literal single quote inside the string must be preceded with backslash, like `\'`. The length must be specified when defining a column or tag of NCHAR type, for example nchar(10) means it can store at most 10 characters of nchar type and will consume fixed storage of 40 bytes. An error will be reported if the string value exceeds the length defined. | | 15 | JSON | | JSON type can only be used on tags. A tag of json type is excluded with any other tags of any other type. | | 16 | VARCHAR | User-defined | Alias of BINARY | - :::note - Only ASCII visible characters are suggested to be used in a column or tag of BINARY type. Multi-byte characters must be stored in NCHAR type. diff --git a/docs/en/12-taos-sql/10-function.md b/docs/en/12-taos-sql/10-function.md index 7e45ffa1df..a204415d65 100644 --- a/docs/en/12-taos-sql/10-function.md +++ b/docs/en/12-taos-sql/10-function.md @@ -867,10 +867,16 @@ FIRST(expr) ### INTERP ```sql -INTERP(expr) +INTERP(expr [, ignore_null_values]) + +ignore_null_values: { + 0 + | 1 +} ``` -**Description**: The value that matches the specified timestamp range is returned, if existing; or an interpolation value is returned. +**Description**: The value that matches the specified timestamp range is returned, if existing; or an interpolation value is returned. The value of `ignore_null_values` can be 0 or 1, 1 means null values are ignored. The default value of this parameter is 0. + **Return value type**: Same as the column being operated upon diff --git a/docs/en/12-taos-sql/26-udf.md b/docs/en/12-taos-sql/26-udf.md index c4d6d4fca4..b533b98b3d 100644 --- a/docs/en/12-taos-sql/26-udf.md +++ b/docs/en/12-taos-sql/26-udf.md @@ -17,7 +17,7 @@ CREATE [OR REPLACE] FUNCTION function_name AS library_path OUTPUTTYPE output_typ ``` - OR REPLACE: if the UDF exists, the UDF properties are modified - function_name: The scalar function name to be used in the SQL statement - - LANGUAGE 'C|Python': the programming language of UDF. Now C or Python is supported. If this clause is omitted, C is assumed as the programming language. + - LANGUAGE 'C|Python': the programming language of UDF. Now C or Python (v3.7+) is supported. If this clause is omitted, C is assumed as the programming language. - library_path: For C programming language, The absolute path of the DLL file including the name of the shared object file (.so). For Python programming language, the absolute path of the Python UDF script. The path must be quoted with single or double quotes. - output_type: The data type of the results of the UDF. diff --git a/docs/en/13-operation/10-monitor.md b/docs/en/13-operation/10-monitor.md index 80c33dd475..197dda20ee 100644 --- a/docs/en/13-operation/10-monitor.md +++ b/docs/en/13-operation/10-monitor.md @@ -36,7 +36,7 @@ You can use below command to setup Grafana alert notification. An existing Grafana Notification Channel can be specified with parameter `-E`, the notifier uid of the channel can be obtained by `curl -u admin:admin localhost:3000/api/alert-notifications |jq` ```bash - sudo ./TDinsight.sh -a http://localhost:6041 -u root -p taosdata -E + ./TDinsight.sh -a http://localhost:6041 -u root -p taosdata -E ``` Launch `TDinsight.sh` with the command above and restart Grafana, then open Dashboard `http://localhost:3000/d/tdinsight`. @@ -274,7 +274,7 @@ The data of tdinsight dashboard is stored in `log` database (default. You can ch |field|type|is\_tag|comment| |:----|:---|:-----|:------| |\_ts|TIMESTAMP||timestamp| -|guage|DOUBLE||metric value| +|gauge|DOUBLE||metric value| |client\_ip|NCHAR|TAG|client ip| |endpoint|NCHAR|TAG|taosadpater endpoint| |request\_method|NCHAR|TAG|request method| @@ -288,7 +288,7 @@ The data of tdinsight dashboard is stored in `log` database (default. You can ch |field|type|is\_tag|comment| |:----|:---|:-----|:------| |\_ts|TIMESTAMP||timestamp| -|guage|DOUBLE||metric value| +|gauge|DOUBLE||metric value| |client\_ip|NCHAR|TAG|client ip| |endpoint|NCHAR|TAG|taosadpater endpoint| |request\_method|NCHAR|TAG|request method| @@ -302,7 +302,7 @@ The data of tdinsight dashboard is stored in `log` database (default. You can ch |field|type|is\_tag|comment| |:----|:---|:-----|:------| |\_ts|TIMESTAMP||timestamp| -|guage|DOUBLE||metric value| +|gauge|DOUBLE||metric value| |endpoint|NCHAR|TAG|taosadpater endpoint| ### taosadapter\_restful\_http\_request\_summary\_milliseconds table @@ -330,7 +330,7 @@ The data of tdinsight dashboard is stored in `log` database (default. You can ch |field|type|is\_tag|comment| |:----|:---|:-----|:------| |\_ts|TIMESTAMP||timestamp| -|guage|DOUBLE||metric value| +|gauge|DOUBLE||metric value| |endpoint|NCHAR|TAG|taosadpater endpoint| ### taosadapter\_system\_cpu\_percent table @@ -340,6 +340,6 @@ The data of tdinsight dashboard is stored in `log` database (default. You can ch |field|type|is\_tag|comment| |:----|:---|:-----|:------| |\_ts|TIMESTAMP||timestamp| -|guage|DOUBLE||mertic value| +|gauge|DOUBLE||mertic value| |endpoint|NCHAR|TAG|taosadpater endpoint| diff --git a/docs/en/14-reference/03-connector/04-java.mdx b/docs/en/14-reference/03-connector/04-java.mdx index 260b38b24f..114026eca0 100644 --- a/docs/en/14-reference/03-connector/04-java.mdx +++ b/docs/en/14-reference/03-connector/04-java.mdx @@ -959,6 +959,7 @@ The preceding example uses the SQL statement `select ts, speed from speed_table` ```java Properties config = new Properties(); +config.setProperty("bootstrap.servers", "localhost:6030"); config.setProperty("enable.auto.commit", "true"); config.setProperty("group.id", "group1"); config.setProperty("value.deserializer", "com.taosdata.jdbc.tmq.ConsumerTest.ResultDeserializer"); @@ -966,12 +967,14 @@ config.setProperty("value.deserializer", "com.taosdata.jdbc.tmq.ConsumerTest.Res TaosConsumer consumer = new TaosConsumer<>(config); ``` +- bootstrap.servers: `ip:port` where the TDengine server is located, or `ip:port` where the taosAdapter is located if WebSocket connection is used. - enable.auto.commit: Specifies whether to commit automatically. - group.id: consumer: Specifies the group that the consumer is in. - value.deserializer: To deserialize the results, you can inherit `com.taosdata.jdbc.tmq.ReferenceDeserializer` and specify the result set bean. You can also inherit `com.taosdata.jdbc.tmq.Deserializer` and perform custom deserialization based on the SQL result set. - td.connect.type: Specifies the type connect with TDengine, `jni` or `WebSocket`. default is `jni` - httpConnectTimeout: WebSocket connection timeout in milliseconds, the default value is 5000 ms. It only takes effect when using WebSocket type. - messageWaitTimeout: socket timeout in milliseconds, the default value is 10000 ms. It only takes effect when using WebSocket type. +- httpPoolSize: Maximum number of concurrent requests on the a connection。It only takes effect when using WebSocket type. - For more information, see [Consumer Parameters](../../../develop/tmq). #### Subscribe to consume data @@ -1015,10 +1018,20 @@ public abstract class ConsumerLoop { public ConsumerLoop() throws SQLException { Properties config = new Properties(); + config.setProperty("td.connect.type", "jni"); + config.setProperty("bootstrap.servers", "localhost:6030"); + config.setProperty("td.connect.user", "root"); + config.setProperty("td.connect.pass", "taosdata"); + config.setProperty("auto.offset.reset", "earliest"); config.setProperty("msg.with.table.name", "true"); config.setProperty("enable.auto.commit", "true"); + config.setProperty("auto.commit.interval.ms", "1000"); config.setProperty("group.id", "group1"); + config.setProperty("client.id", "1"); config.setProperty("value.deserializer", "com.taosdata.jdbc.tmq.ConsumerTest.ConsumerLoop$ResultDeserializer"); + config.setProperty("value.deserializer.encoding", "UTF-8"); + config.setProperty("experimental.snapshot.enable", "true"); + this.consumer = new TaosConsumer<>(config); this.topics = Collections.singletonList("topic_speed"); @@ -1090,12 +1103,19 @@ public abstract class ConsumerLoop { public ConsumerLoop() throws SQLException { Properties config = new Properties(); - config.setProperty("bootstrap.servers", "localhost:6041"); config.setProperty("td.connect.type", "ws"); + config.setProperty("bootstrap.servers", "localhost:6041"); + config.setProperty("td.connect.user", "root"); + config.setProperty("td.connect.pass", "taosdata"); + config.setProperty("auto.offset.reset", "earliest"); config.setProperty("msg.with.table.name", "true"); config.setProperty("enable.auto.commit", "true"); + config.setProperty("auto.commit.interval.ms", "1000"); config.setProperty("group.id", "group2"); + config.setProperty("client.id", "1"); config.setProperty("value.deserializer", "com.taosdata.jdbc.tmq.ConsumerTest.ConsumerLoop$ResultDeserializer"); + config.setProperty("value.deserializer.encoding", "UTF-8"); + config.setProperty("experimental.snapshot.enable", "true"); this.consumer = new TaosConsumer<>(config); this.topics = Collections.singletonList("topic_speed"); diff --git a/docs/en/14-reference/03-connector/index.mdx b/docs/en/14-reference/03-connector/index.mdx index 28b7b83b58..a35d5bc2d1 100644 --- a/docs/en/14-reference/03-connector/index.mdx +++ b/docs/en/14-reference/03-connector/index.mdx @@ -62,7 +62,7 @@ The different database framework specifications for various programming language | **Regular Query** | Support | Support | Support | Support | Support | Support | | **Parameter Binding** | Not Supported | Not Supported | Support | Support | Not Supported | Support | | **Subscription (TMQ) ** | Supported | Support | Support | Not Supported | Not Supported | Support | -| **Schemaless** | Supported | Not Supported | Not Supported | Not Supported | Not Supported | Not Supported | +| **Schemaless** | Not Supported | Not Supported | Not Supported | Not Supported | Not Supported | Not Supported | | **Bulk Pulling (based on WebSocket) ** | Support | Support | Support | Support | Support | Support | | **DataFrame** | Not Supported | Support | Not Supported | Not Supported | Not Supported | Not Supported | diff --git a/docs/en/14-reference/07-tdinsight/index.md b/docs/en/14-reference/07-tdinsight/index.md index 965a38168a..d6d1cd4f1a 100644 --- a/docs/en/14-reference/07-tdinsight/index.md +++ b/docs/en/14-reference/07-tdinsight/index.md @@ -149,7 +149,7 @@ curl --no-progress-meter -u admin:admin http://localhost:3000/api/alert-notifica Use the `uid` value obtained above as `-E` input. ```bash -sudo ./TDinsight.sh -a http://tdengine:6041 -u root1 -p pass5ord -E existing-notifier +./TDinsight.sh -a http://tdengine:6041 -u root1 -p pass5ord -E existing-notifier ``` If you want to monitor multiple TDengine clusters, you need to set up numerous TDinsight dashboards. Setting up non-default TDinsight requires some changes: the `-n` `-i` `-t` options need to be changed to non-default names, and `-N` and `-L` should also be changed if using the built-in SMS alerting feature. diff --git a/docs/en/14-reference/12-config/index.md b/docs/en/14-reference/12-config/index.md index c3d28fa48e..3ce63fb6cc 100644 --- a/docs/en/14-reference/12-config/index.md +++ b/docs/en/14-reference/12-config/index.md @@ -45,19 +45,19 @@ The parameters described in this document by the effect that they have on the sy ### firstEp -| Attribute | Description | -| -------- | -------------------------------------------------------------- | -| Applicable | Server and Client | -| Meaning | The end point of the first dnode in the cluster to be connected to when `taosd` or `taos` is started | -| Default | localhost:6030 | +| Attribute | Description | +| ---------- | ---------------------------------------------------------------------------------------------------- | +| Applicable | Server and Client | +| Meaning | The end point of the first dnode in the cluster to be connected to when `taosd` or `taos` is started | +| Default | localhost:6030 | ### secondEp -| Attribute | Description | -| -------- | ------------------------------------------------------------------------------------- | -| Applicable | Server and Client | -| Meaning | The end point of the second dnode to be connected to if the firstEp is not available when `taosd` or `taos` is started | -| Default | None | +| Attribute | Description | +| ---------- | ---------------------------------------------------------------------------------------------------------------------- | +| Applicable | Server and Client | +| Meaning | The end point of the second dnode to be connected to if the firstEp is not available when `taosd` or `taos` is started | +| Default | None | ### fqdn @@ -65,28 +65,28 @@ The parameters described in this document by the effect that they have on the sy | ------------- | ------------------------------------------------------------------------ | | Applicable | Server Only | | Meaning | The FQDN of the host where `taosd` will be started. It can be IP address | -| Default Value | The first hostname configured for the host | -| Note | It should be within 96 bytes | | +| Default Value | The first hostname configured for the host | +| Note | It should be within 96 bytes | | ### serverPort -| Attribute | Description | -| -------- | ----------------------------------------------------------------------------------------------------------------------- | -| Applicable | Server Only | -| Meaning | The port for external access after `taosd` is started | -| Default Value | 6030 | +| Attribute | Description | +| ------------- | ----------------------------------------------------- | +| Applicable | Server Only | +| Meaning | The port for external access after `taosd` is started | +| Default Value | 6030 | :::note - Ensure that your firewall rules do not block TCP port 6042 on any host in the cluster. Below table describes the ports used by TDengine in details. ::: -| Protocol | Default Port | Description | How to configure | -| :------- | :----------- | :----------------------------------------------- | :--------------------------------------------------------------------------------------------- | -| TCP | 6030 | Communication between client and server. In a multi-node cluster, communication between nodes. serverPort | -| TCP | 6041 | REST connection between client and server | Prior to 2.4.0.0: serverPort+11; After 2.4.0.0 refer to [taosAdapter](/reference/taosadapter/) | -| TCP | 6043 | Service Port of taosKeeper | The parameter of taosKeeper | -| TCP | 6044 | Data access port for StatsD | Configurable through taosAdapter parameters. -| UDP | 6045 | Data access for statsd | Configurable through taosAdapter parameters. -| TCP | 6060 | Port of Monitoring Service in Enterprise version | | +| Protocol | Default Port | Description | How to configure | +| :------- | :----------- | :-------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------- | +| TCP | 6030 | Communication between client and server. In a multi-node cluster, communication between nodes. serverPort | +| TCP | 6041 | REST connection between client and server | Prior to 2.4.0.0: serverPort+11; After 2.4.0.0 refer to [taosAdapter](/reference/taosadapter/) | +| TCP | 6043 | Service Port of taosKeeper | The parameter of taosKeeper | +| TCP | 6044 | Data access port for StatsD | Configurable through taosAdapter parameters. | +| UDP | 6045 | Data access for statsd | Configurable through taosAdapter parameters. | +| TCP | 6060 | Port of Monitoring Service in Enterprise version | | ### maxShellConns @@ -97,6 +97,24 @@ The parameters described in this document by the effect that they have on the sy | Value Range | 10-50000000 | | Default Value | 5000 | +### numOfRpcSessions + +| Attribute | Description | +| ------------- | ------------------------------------------ | +| Applicable | Client/Server | +| Meaning | The maximum number of connection to create | +| Value Range | 100-100000 | +| Default Value | 10000 | + +### timeToGetAvailableConn + +| Attribute | Description | +| ------------- | ---------------------------------------------- | +| Applicable | Client/Server | +| Meaning | The maximum waiting time to get avaliable conn | +| Value Range | 10-50000000(ms) | +| Default Value | 500000 | + ## Monitoring Parameters :::note @@ -104,114 +122,114 @@ Please note the `taoskeeper` needs to be installed and running to create the `lo ### monitor -| Attribute | Description | -| -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Applicable | Server only | -| Meaning | The switch for monitoring inside server. The main object of monitoring is to collect information about load on physical nodes, including CPU usage, memory usage, disk usage, and network bandwidth. Monitoring information is sent over HTTP to the taosKeeper service specified by `monitorFqdn` and `monitorProt`. -| Value Range | 0: monitoring disabled, 1: monitoring enabled | -| Default | 0 | +| Attribute | Description | +| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Applicable | Server only | +| Meaning | The switch for monitoring inside server. The main object of monitoring is to collect information about load on physical nodes, including CPU usage, memory usage, disk usage, and network bandwidth. Monitoring information is sent over HTTP to the taosKeeper service specified by `monitorFqdn` and `monitorProt`. | +| Value Range | 0: monitoring disabled, 1: monitoring enabled | +| Default | 0 | ### monitorFqdn -| Attribute | Description | -| -------- | -------------------------- | -| Applicable | Server Only | -| Meaning | FQDN of taosKeeper monitoring service | -| Default | None | +| Attribute | Description | +| ---------- | ------------------------------------- | +| Applicable | Server Only | +| Meaning | FQDN of taosKeeper monitoring service | +| Default | None | ### monitorPort -| Attribute | Description | -| -------- | --------------------------- | -| Applicable | Server Only | -| Meaning | Port of taosKeeper monitoring service | -| Default Value | 6043 | +| Attribute | Description | +| ------------- | ------------------------------------- | +| Applicable | Server Only | +| Meaning | Port of taosKeeper monitoring service | +| Default Value | 6043 | ### monitorInterval -| Attribute | Description | -| -------- | -------------------------------------------- | -| Applicable | Server Only | +| Attribute | Description | +| ------------- | ------------------------------------------ | +| Applicable | Server Only | | Meaning | The interval of collecting system workload | | Unit | second | -| Value Range | 1-200000 | -| Default Value | 30 | +| Value Range | 1-200000 | +| Default Value | 30 | ### telemetryReporting -| Attribute | Description | -| -------- | ---------------------------------------- | -| Applicable | Server Only | +| Attribute | Description | +| ------------- | ---------------------------------------------------------------------------- | +| Applicable | Server Only | | Meaning | Switch for allowing TDengine to collect and report service usage information | | Value Range | 0: Not allowed; 1: Allowed | -| Default Value | 1 | +| Default Value | 1 | ### crashReporting -| Attribute | Description | -| -------- | -------------------------------------------- | -| Applicable | Server Only | -| Meaning |Switch for allowing TDengine to collect and report crash related information | -| Value Range | 0,1 0: Not allowed; 1: allowed | -| Default Value | 1 | +| Attribute | Description | +| ------------- | ---------------------------------------------------------------------------- | +| Applicable | Server Only | +| Meaning | Switch for allowing TDengine to collect and report crash related information | +| Value Range | 0,1 0: Not allowed; 1: allowed | +| Default Value | 1 | ## Query Parameters ### queryPolicy -| Attribute | Description | -| -------- | ----------------------------- | -| Applicable | Client only | -| Meaning | Execution policy for query statements | -| Unit | None | -| Default | 1 | +| Attribute | Description | +| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Applicable | Client only | +| Meaning | Execution policy for query statements | +| Unit | None | +| Default | 1 | | Value Range | 1: Run queries on vnodes and not on qnodes; 2: Run subtasks without scan operators on qnodes and subtasks with scan operators on vnodes; 3: Only run scan operators on vnodes, and run all other operators on qnodes. | ### querySmaOptimize -| Attribute | Description | -| -------- | -------------------- | -| Applicable | Client only | -| Meaning | SMA index optimization policy | -| Unit | None | -| Default Value | 0 | -| Notes |0: Disable SMA indexing and perform all queries on non-indexed data; 1: Enable SMA indexing and perform queries from suitable statements on precomputation results.| +| Attribute | Description | +| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Applicable | Client only | +| Meaning | SMA index optimization policy | +| Unit | None | +| Default Value | 0 | +| Notes | 0: Disable SMA indexing and perform all queries on non-indexed data; 1: Enable SMA indexing and perform queries from suitable statements on precomputation results. | ### countAlwaysReturnValue -| Attribute | Description | -| -------- | -------------------------------- | -| Applicable | Server only | -| Meaning | count()/hyperloglog() return value or not if the input data is empty or NULL | -| Vlue Range | 0: Return empty line, 1: Return 0 | -| Default | 1 | -| Notes | When this parameter is setting to 1, for queries containing GROUP BY, PARTITION BY and INTERVAL clause, and input data in certain groups or windows is empty or NULL, the corresponding groups or windows have no return values | +| Attribute | Description | +| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Applicable | Server only | +| Meaning | count()/hyperloglog() return value or not if the input data is empty or NULL | +| Vlue Range | 0: Return empty line, 1: Return 0 | +| Default | 1 | +| Notes | When this parameter is setting to 1, for queries containing GROUP BY, PARTITION BY and INTERVAL clause, and input data in certain groups or windows is empty or NULL, the corresponding groups or windows have no return values | ### maxNumOfDistinctRes -| Attribute | Description | -| -------- | -------------------------------- | -| Applicable | Server Only | +| 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 | +| 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 -| Attribute | Description | -| -------- | ------------------------------ | -| Applicable | Server and Client | +| Attribute | Description | +| ------------- | ------------------------------- | +| Applicable | Server and Client | | Meaning | TimeZone | | Default Value | TimeZone configured in the host | @@ -314,49 +332,49 @@ The charset that takes effect is UTF-8. ### dataDir -| Attribute | Description | -| -------- | ------------------------------------------ | -| Applicable | Server Only | -| Meaning | All data files are stored in this directory | -| Default Value | /var/lib/taos | +| Attribute | Description | +| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Applicable | Server Only | +| Meaning | All data files are stored in this directory | +| Default Value | /var/lib/taos | | Note | The [Tiered Storage](https://docs.tdengine.com/tdinternal/arch/#tiered-storage) function needs to be used in conjunction with the [KEEP](https://docs.tdengine.com/taos-sql/database/#parameters) parameter | ### tempDir -| Attribute | Description | -| -------- | ------------------------------------------ | -| Applicable | Server only | -| Meaning | The directory where to put all the temporary files generated during system running | -| Default | /tmp | +| Attribute | Description | +| ---------- | ---------------------------------------------------------------------------------- | +| Applicable | Server only | +| Meaning | The directory where to put all the temporary files generated during system running | +| Default | /tmp | ### minimalTmpDirGB -| Attribute | Description | -| -------- | ------------------------------------------------ | -| Applicable | Server and Client | +| Attribute | Description | +| ------------- | ----------------------------------------------------------------------------------------------- | +| Applicable | Server and Client | | Meaning | When the available disk space in tmpDir is below this threshold, writing to tmpDir is suspended | -| Unit | GB | -| Default Value | 1.0 | +| Unit | GB | +| Default Value | 1.0 | ### minimalDataDirGB -| Attribute | Description | -| -------- | ------------------------------------------------ | -| Applicable | Server Only | +| Attribute | Description | +| ------------- | ------------------------------------------------------------------------------------------------- | +| Applicable | Server Only | | Meaning | When the available disk space in dataDir is below this threshold, writing to dataDir is suspended | -| Unit | GB | -| Default Value | 2.0 | +| Unit | GB | +| Default Value | 2.0 | ## Cluster Parameters ### supportVnodes -| Attribute | Description | -| -------- | --------------------------- | -| Applicable | Server Only | -| Meaning | Maximum number of vnodes per dnode | -| Value Range | 0-4096 | -| Default Value | 2x the CPU cores | +| Attribute | Description | +| ------------- | ---------------------------------- | +| Applicable | Server Only | +| Meaning | Maximum number of vnodes per dnode | +| Value Range | 0-4096 | +| Default Value | 2x the CPU cores | ## Performance Tuning @@ -373,345 +391,345 @@ The charset that takes effect is UTF-8. ### logDir -| Attribute | Description | -| -------- | -------------------------------------------------- | -| Applicable | Server and Client | +| Attribute | Description | +| ------------- | ----------------------------------- | +| Applicable | Server and Client | | Meaning | The directory for writing log files | | Default Value | /var/log/taos | ### minimalLogDirGB -| Attribute | Description | -| -------- | -------------------------------------------- | -| Applicable | Server and Client | +| Attribute | Description | +| ------------- | -------------------------------------------------------------------------------------------------- | +| Applicable | Server and Client | | Meaning | When the available disk space in logDir is below this threshold, writing to log files is suspended | -| Unit | GB | -| Default Value | 1.0 | +| Unit | GB | +| Default Value | 1.0 | ### numOfLogLines -| Attribute | Description | -| -------- | ---------------------------- | -| Applicable | Server and Client | +| Attribute | Description | +| ------------- | ------------------------------------------ | +| Applicable | Server and Client | | Meaning | Maximum number of lines in single log file | -| Default Value | 10000000 | +| Default Value | 10000000 | ### asyncLog -| Attribute | Description | -| -------- | -------------------- | -| Applicable | Server and Client | +| Attribute | Description | +| ------------- | ---------------------------- | +| Applicable | Server and Client | | Meaning | The mode of writing log file | | Value Range | 0: sync way; 1: async way | -| Default Value | 1 | +| Default Value | 1 | ### logKeepDays -| Attribute | Description | -| -------- | ----------------------------------------------------------------------------------- | -| Applicable | Server and Client | +| Attribute | Description | +| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | +| Applicable | Server and Client | | Meaning | The number of days for log files to be kept | -| Unit | day | -| Default Value | 0 | +| Unit | day | +| Default Value | 0 | | Note | When it's bigger than 0, the log file would be renamed to "taosdlog.xxx" in which "xxx" is the timestamp when the file is changed last time | ### debugFlag -| Attribute | Description | -| -------- | ------------------------------------------------------------------------------------------------- | -| Applicable | Server and Client | +| Attribute | Description | +| ------------- | --------------------------------------------------------- | +| Applicable | Server and Client | | Meaning | Log level | | Value Range | 131: INFO/WARNING/ERROR; 135: plus DEBUG; 143: plus TRACE | | Default Value | 131 or 135, depending on the module | ### tmrDebugFlag -| Attribute | Description | -| -------- | -------------------- | +| Attribute | Description | +| ------------- | ------------------------- | | Applicable | Server and Client | | Meaning | Log level of timer module | -| Value Range | same as debugFlag | -| Default Value | | +| Value Range | same as debugFlag | +| Default Value | | ### uDebugFlag -| Attribute | Description | -| -------- | ---------------------- | -| Applicable | Server and Client | +| Attribute | Description | +| ------------- | -------------------------- | +| Applicable | Server and Client | | Meaning | Log level of common module | -| Value Range | same as debugFlag | -| Default Value | | +| Value Range | same as debugFlag | +| Default Value | | ### rpcDebugFlag -| Attribute | Description | -| -------- | -------------------- | -| Applicable | Server and Client | +| Attribute | Description | +| ------------- | ----------------------- | +| Applicable | Server and Client | | Meaning | Log level of rpc module | -| Value Range | same as debugFlag | -| Default Value | | +| Value Range | same as debugFlag | +| Default Value | | ### jniDebugFlag -| Attribute | Description | -| -------- | ------------------ | -| Applicable | Client Only | +| Attribute | Description | +| ------------- | ----------------------- | +| Applicable | Client Only | | Meaning | Log level of jni module | -| Value Range | same as debugFlag | -| Default Value | | +| Value Range | same as debugFlag | +| Default Value | | ### qDebugFlag -| Attribute | Description | -| -------- | -------------------- | +| Attribute | Description | +| ------------- | ------------------------- | | Applicable | Server and Client | -| Meaning | Log level of query module | -| Value Range | same as debugFlag | -| Default Value | | +| Meaning | Log level of query module | +| Value Range | same as debugFlag | +| Default Value | | ### cDebugFlag -| Attribute | Description | -| -------- | --------------------- | +| Attribute | Description | +| ------------- | ------------------- | | Applicable | Client Only | | Meaning | Log level of Client | -| Value Range | same as debugFlag | -| Default Value | | +| Value Range | same as debugFlag | +| Default Value | | ### dDebugFlag -| Attribute | Description | -| -------- | -------------------- | -| Applicable | Server Only | +| Attribute | Description | +| ------------- | ------------------ | +| Applicable | Server Only | | Meaning | Log level of dnode | | Value Range | same as debugFlag | -| Default Value | 135 | +| Default Value | 135 | ### vDebugFlag -| Attribute | Description | -| -------- | -------------------- | -| Applicable | Server Only | +| Attribute | Description | +| ------------- | ------------------ | +| Applicable | Server Only | | Meaning | Log level of vnode | | Value Range | same as debugFlag | -| Default Value | | +| Default Value | | ### mDebugFlag -| Attribute | Description | -| -------- | -------------------- | -| Applicable | Server Only | -| Meaning | Log level of mnode module | -| Value Range | same as debugFlag | -| Default Value | 135 | +| Attribute | Description | +| ------------- | ------------------------- | +| Applicable | Server Only | +| Meaning | Log level of mnode module | +| Value Range | same as debugFlag | +| Default Value | 135 | ### wDebugFlag -| Attribute | Description | -| -------- | ------------------ | -| Applicable | Server Only | -| Meaning | Log level of WAL module | -| Value Range | same as debugFlag | -| Default Value | 135 | +| Attribute | Description | +| ------------- | ----------------------- | +| Applicable | Server Only | +| Meaning | Log level of WAL module | +| Value Range | same as debugFlag | +| Default Value | 135 | ### sDebugFlag -| Attribute | Description | -| -------- | -------------------- | -| Applicable | Server and Client | +| Attribute | Description | +| ------------- | ------------------------ | +| Applicable | Server and Client | | Meaning | Log level of sync module | -| Value Range | same as debugFlag | -| Default Value | 135 | +| Value Range | same as debugFlag | +| Default Value | 135 | ### tsdbDebugFlag -| Attribute | Description | -| -------- | ------------------- | -| Applicable | Server Only | -| Meaning | Log level of TSDB module | -| Value Range | same as debugFlag | -| Default Value | | +| Attribute | Description | +| ------------- | ------------------------ | +| Applicable | Server Only | +| Meaning | Log level of TSDB module | +| Value Range | same as debugFlag | +| Default Value | | ### tqDebugFlag -| Attribute | Description | -| -------- | ----------------- | -| Applicable | Server only | -| Meaning | Log level of TQ module | -| Value Range | same as debugFlag | -| Default Value | | +| Attribute | Description | +| ------------- | ---------------------- | +| Applicable | Server only | +| Meaning | Log level of TQ module | +| Value Range | same as debugFlag | +| Default Value | | ### fsDebugFlag -| Attribute | Description | -| -------- | ----------------- | -| Applicable | Server only | -| Meaning | Log level of FS module | -| Value Range | same as debugFlag | -| Default Value | | +| Attribute | Description | +| ------------- | ---------------------- | +| Applicable | Server only | +| Meaning | Log level of FS module | +| Value Range | same as debugFlag | +| Default Value | | ### udfDebugFlag -| Attribute | Description | -| -------- | ------------------ | -| Applicable | Server Only | +| Attribute | Description | +| ------------- | ----------------------- | +| Applicable | Server Only | | Meaning | Log level of UDF module | -| Value Range | same as debugFlag | -| Default Value | | +| Value Range | same as debugFlag | +| Default Value | | ### smaDebugFlag -| Attribute | Description | -| -------- | ------------------ | -| Applicable | Server Only | -| Meaning | Log level of SMA module | -| Value Range | same as debugFlag | -| Default Value | | +| Attribute | Description | +| ------------- | ----------------------- | +| Applicable | Server Only | +| Meaning | Log level of SMA module | +| Value Range | same as debugFlag | +| Default Value | | ### idxDebugFlag -| Attribute | Description | -| -------- | -------------------- | -| Applicable | Server Only | -| Meaning | Log level of index module | -| Value Range | same as debugFlag | -| Default Value | | +| Attribute | Description | +| ------------- | ------------------------- | +| Applicable | Server Only | +| Meaning | Log level of index module | +| Value Range | same as debugFlag | +| Default Value | | ### tdbDebugFlag -| Attribute | Description | -| -------- | ------------------ | -| Applicable | Server Only | -| Meaning | Log level of TDB module | -| Value Range | same as debugFlag | -| Default Value | | +| Attribute | Description | +| ------------- | ----------------------- | +| Applicable | Server Only | +| Meaning | Log level of TDB module | +| Value Range | same as debugFlag | +| Default Value | | ## Schemaless Parameters ### smlChildTableName -| Attribute | Description | -| -------- | ------------------------- | -| Applicable | Client only | -| Meaning | Custom subtable name for schemaless writes | -| Type | String | -| Default Value | None | +| Attribute | Description | +| ------------- | ------------------------------------------ | +| Applicable | Client only | +| Meaning | Custom subtable name for schemaless writes | +| Type | String | +| Default Value | None | ### smlTagName -| Attribute | Description | -| -------- | ------------------------------------ | -| Applicable | Client only | -| Meaning | Default tag for schemaless writes without tag value specified | -| Type | String | -| Default Value | _tag_null | +| Attribute | Description | +| ------------- | ------------------------------------------------------------- | +| Applicable | Client only | +| Meaning | Default tag for schemaless writes without tag value specified | +| Type | String | +| Default Value | _tag_null | ### smlDataFormat -| Attribute | Description | -| -------- | ----------------------------- | -| Applicable | Client only | -| Meaning | Whether schemaless columns are consistently ordered, depat, discarded since 3.0.3.0| -| Value Range | 0: not consistent; 1: consistent. | -| Default | 0 | +| Attribute | Description | +| ----------- | ----------------------------------------------------------------------------------- | +| Applicable | Client only | +| Meaning | Whether schemaless columns are consistently ordered, depat, discarded since 3.0.3.0 | +| Value Range | 0: not consistent; 1: consistent. | +| Default | 0 | ## Compress Parameters ### compressMsgSize -| Attribute | Description | -| -------- | ----------------------------- | -| Applicable | Both Client and Server side | -| Meaning | Whether RPC message is compressed | -| Value Range | -1: none message is compressed; 0: all messages are compressed; N (N>0): messages exceeding N bytes are compressed | -| Default | -1 | +| Attribute | Description | +| ----------- | ------------------------------------------------------------------------------------------------------------------ | +| Applicable | Both Client and Server side | +| Meaning | Whether RPC message is compressed | +| Value Range | -1: none message is compressed; 0: all messages are compressed; N (N>0): messages exceeding N bytes are compressed | +| Default | -1 | ## Other Parameters ### enableCoreFile -| Attribute | Description | -| -------- | ------------------------------------------------------------------------------------------------------------------------------------------ | -| Applicable | Server and Client | -| Meaning | Whether to generate core file when server crashes | -| Value Range | 0: false, 1: true | -| Default Value | 1 | +| Attribute | Description | +| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| Applicable | Server and Client | +| Meaning | Whether to generate core file when server crashes | +| Value Range | 0: false, 1: true | +| Default Value | 1 | | Note | The core file is generated under root directory `systemctl start taosd`/`launchctl start com.tdengine.taosd` is used to start, or under the working directory if `taosd` is started directly on Linux/macOS Shell. | ### enableScience -| Attribute | Description | -| -------- | ------------------------------------------------------------------------------------------------------------------------------------------ | -| Applicable | Only taos-CLI client | -| Meaning | Whether to show float and double with the scientific notation | -| Value Range | 0: false, 1: true | -| Default Value | 0 | +| Attribute | Description | +| ------------- | ------------------------------------------------------------- | +| Applicable | Only taos-CLI client | +| Meaning | Whether to show float and double with the scientific notation | +| Value Range | 0: false, 1: true | +| Default Value | 0 | ### udf -| Attribute | Description | -| -------- | ------------------ | -| Applicable | Server Only | -| Meaning | Whether the UDF service is enabled | -| Value Range | 0: disable UDF; 1: enabled UDF | -| Default Value | 1 | +| Attribute | Description | +| ------------- | ---------------------------------- | +| Applicable | Server Only | +| Meaning | Whether the UDF service is enabled | +| Value Range | 0: disable UDF; 1: enabled UDF | +| Default Value | 1 | ## 3.0 Parameters -| # | **Parameter** | **Applicable to 2.x ** | **Applicable to 3.0 ** | Current behavior in 3.0 | -| --- | :---------------------: | --------------- | --------------- | ------------------------------------------------- | -| 1 | firstEp | Yes | Yes | | -| 2 | secondEp | Yes | Yes | | -| 3 | fqdn | Yes | Yes | | -| 4 | serverPort | Yes | Yes | | -| 5 | maxShellConns | Yes | Yes | | -| 6 | monitor | Yes | Yes | | -| 7 | monitorFqdn | No | Yes | | -| 8 | monitorPort | No | Yes | | -| 9 | monitorInterval | Yes | Yes | | -| 10 | queryPolicy | No | Yes | | -| 11 | querySmaOptimize | No | Yes | | -| 12 | maxNumOfDistinctRes | Yes | Yes | | -| 15 | countAlwaysReturnValue | Yes | Yes | | -| 16 | dataDir | Yes | Yes | | -| 17 | minimalDataDirGB | Yes | Yes | | -| 18 | supportVnodes | No | Yes | | -| 19 | tempDir | Yes | Yes | | -| 20 | minimalTmpDirGB | Yes | Yes | | -| 21 | smlChildTableName | Yes | Yes | | -| 22 | smlTagName | Yes | Yes | | -| 23 | smlDataFormat | No | Yes(discarded since 3.0.3.0) | | -| 24 | statusInterval | Yes | Yes | | -| 25 | logDir | Yes | Yes | | -| 26 | minimalLogDirGB | Yes | Yes | | -| 27 | numOfLogLines | Yes | Yes | | -| 28 | asyncLog | Yes | Yes | | -| 29 | logKeepDays | Yes | Yes | | -| 30 | debugFlag | Yes | Yes | | -| 31 | tmrDebugFlag | Yes | Yes | | -| 32 | uDebugFlag | Yes | Yes | | -| 33 | rpcDebugFlag | Yes | Yes | | -| 34 | jniDebugFlag | Yes | Yes | | -| 35 | qDebugFlag | Yes | Yes | | -| 36 | cDebugFlag | Yes | Yes | | -| 37 | dDebugFlag | Yes | Yes | | -| 38 | vDebugFlag | Yes | Yes | | -| 39 | mDebugFlag | Yes | Yes | | -| 40 | wDebugFlag | Yes | Yes | | -| 41 | sDebugFlag | Yes | Yes | | -| 42 | tsdbDebugFlag | Yes | Yes | | -| 43 | tqDebugFlag | No | Yes | | -| 44 | fsDebugFlag | Yes | Yes | | -| 45 | udfDebugFlag | No | Yes | | -| 46 | smaDebugFlag | No | Yes | | -| 47 | idxDebugFlag | No | Yes | | -| 48 | tdbDebugFlag | No | Yes | | -| 49 | metaDebugFlag | No | Yes | | -| 50 | timezone | Yes | Yes | | -| 51 | locale | Yes | Yes | | -| 52 | charset | Yes | Yes | | -| 53 | udf | Yes | Yes | | -| 54 | enableCoreFile | Yes | Yes | | +| # | **Parameter** | **Applicable to 2.x ** | **Applicable to 3.0 ** | Current behavior in 3.0 | +| --- | :--------------------: | ---------------------- | ---------------------------- | ----------------------- | +| 1 | firstEp | Yes | Yes | | +| 2 | secondEp | Yes | Yes | | +| 3 | fqdn | Yes | Yes | | +| 4 | serverPort | Yes | Yes | | +| 5 | maxShellConns | Yes | Yes | | +| 6 | monitor | Yes | Yes | | +| 7 | monitorFqdn | No | Yes | | +| 8 | monitorPort | No | Yes | | +| 9 | monitorInterval | Yes | Yes | | +| 10 | queryPolicy | No | Yes | | +| 11 | querySmaOptimize | No | Yes | | +| 12 | maxNumOfDistinctRes | Yes | Yes | | +| 15 | countAlwaysReturnValue | Yes | Yes | | +| 16 | dataDir | Yes | Yes | | +| 17 | minimalDataDirGB | Yes | Yes | | +| 18 | supportVnodes | No | Yes | | +| 19 | tempDir | Yes | Yes | | +| 20 | minimalTmpDirGB | Yes | Yes | | +| 21 | smlChildTableName | Yes | Yes | | +| 22 | smlTagName | Yes | Yes | | +| 23 | smlDataFormat | No | Yes(discarded since 3.0.3.0) | | +| 24 | statusInterval | Yes | Yes | | +| 25 | logDir | Yes | Yes | | +| 26 | minimalLogDirGB | Yes | Yes | | +| 27 | numOfLogLines | Yes | Yes | | +| 28 | asyncLog | Yes | Yes | | +| 29 | logKeepDays | Yes | Yes | | +| 30 | debugFlag | Yes | Yes | | +| 31 | tmrDebugFlag | Yes | Yes | | +| 32 | uDebugFlag | Yes | Yes | | +| 33 | rpcDebugFlag | Yes | Yes | | +| 34 | jniDebugFlag | Yes | Yes | | +| 35 | qDebugFlag | Yes | Yes | | +| 36 | cDebugFlag | Yes | Yes | | +| 37 | dDebugFlag | Yes | Yes | | +| 38 | vDebugFlag | Yes | Yes | | +| 39 | mDebugFlag | Yes | Yes | | +| 40 | wDebugFlag | Yes | Yes | | +| 41 | sDebugFlag | Yes | Yes | | +| 42 | tsdbDebugFlag | Yes | Yes | | +| 43 | tqDebugFlag | No | Yes | | +| 44 | fsDebugFlag | Yes | Yes | | +| 45 | udfDebugFlag | No | Yes | | +| 46 | smaDebugFlag | No | Yes | | +| 47 | idxDebugFlag | No | Yes | | +| 48 | tdbDebugFlag | No | Yes | | +| 49 | metaDebugFlag | No | Yes | | +| 50 | timezone | Yes | Yes | | +| 51 | locale | Yes | Yes | | +| 52 | charset | Yes | Yes | | +| 53 | udf | Yes | Yes | | +| 54 | enableCoreFile | Yes | Yes | | diff --git a/docs/en/20-third-party/11-kafka.md b/docs/en/20-third-party/11-kafka.md index 3b0de6c349..f09ebb274c 100644 --- a/docs/en/20-third-party/11-kafka.md +++ b/docs/en/20-third-party/11-kafka.md @@ -314,7 +314,6 @@ connection.backoff.ms=5000 topic.prefix=tdengine-source- poll.interval.ms=1000 fetch.max.rows=100 -out.format=line key.converter=org.apache.kafka.connect.storage.StringConverter value.converter=org.apache.kafka.connect.storage.StringConverter ``` @@ -353,7 +352,7 @@ confluent local services connect connector load TDengineSourceConnector --config ### View topic data -Use the kafka-console-consumer command-line tool to monitor data in the topic tdengine-source-test. In the beginning, all historical data will be output. After inserting two new data into TDengine, kafka-console-consumer immediately outputs the two new data. +Use the kafka-console-consumer command-line tool to monitor data in the topic tdengine-source-test. In the beginning, all historical data will be output. After inserting two new data into TDengine, kafka-console-consumer immediately outputs the two new data. The output is in InfluxDB line protocol format. ```` kafka-console-consumer --bootstrap-server localhost:9092 --from-beginning --topic tdengine-source-test @@ -424,11 +423,13 @@ The following configuration items apply to TDengine Sink Connector and TDengine ### TDengine Source Connector specific configuration 1. `connection.database`: source database name, no default value. -2. `topic.prefix`: topic name prefix after data is imported into kafka. Use `topic.prefix` + `connection.database` name as the full topic name. Defaults to the empty string "". -3. `timestamp.initial`: Data synchronization start time. The format is 'yyyy-MM-dd HH:mm:ss'. Default "1970-01-01 00:00:00". -4. `poll.interval.ms`: Pull data interval, the unit is ms. Default is 1000. -5. `fetch.max.rows`: The maximum number of rows retrieved when retrieving the database. Default is 100. -6. `out.format`: The data format. The value could be line or json. The line represents the InfluxDB Line protocol format, and json represents the OpenTSDB JSON format. Default is `line`. +2. `topic.prefix`: topic name prefix used when importing data into kafka. Its defaults value is empty string "". +3. `timestamp.initial`: Data synchronization start time. The format is 'yyyy-MM-dd HH:mm:ss'. If it is not set, the data importing to Kafka will be started from the first/oldest row in the database. +4. `poll.interval.ms`: The time interval for checking newly created tables or removed tables, default value is 1000. +5. `fetch.max.rows`: The maximum number of rows retrieved when retrieving the database, default is 100. +6. `query.interval.ms`: The time range of reading data from TDengine each time, its unit is millisecond. It should be adjusted according to the data flow in rate, the default value is 1000. +7. `topic.per.stable`: If it's set to true, it means one super table in TDengine corresponds to a topic in Kafka, the topic naming rule is `--`; if it's set to false, it means the whole DB corresponds to a topic in Kafka, the topic naming rule is `-`. + ## Other notes diff --git a/docs/en/28-releases/01-tdengine.md b/docs/en/28-releases/01-tdengine.md index fb31ad67c0..c7836d1298 100644 --- a/docs/en/28-releases/01-tdengine.md +++ b/docs/en/28-releases/01-tdengine.md @@ -10,6 +10,10 @@ For TDengine 2.x installation packages by version, please visit [here](https://w import Release from "/components/ReleaseV3"; +## 3.0.4.2 + + + ## 3.0.4.1 diff --git a/docs/examples/c/async_query_example.c b/docs/examples/c/async_query_example.c index 3807c4bfd7..0618c09f36 100644 --- a/docs/examples/c/async_query_example.c +++ b/docs/examples/c/async_query_example.c @@ -78,7 +78,8 @@ int printRow(char *str, TAOS_ROW row, TAOS_FIELD *fields, int numFields) { } break; case TSDB_DATA_TYPE_BINARY: - case TSDB_DATA_TYPE_NCHAR: { + case TSDB_DATA_TYPE_NCHAR: + case TSDB_DATA_TYPE_GEOMETRY: { int32_t charLen = varDataLen((char *)row[i] - VARSTR_HEADER_SIZE); memcpy(str + len, row[i], charLen); len += charLen; diff --git a/docs/examples/c/query_example.c b/docs/examples/c/query_example.c index c7d52115b5..88c031abc6 100644 --- a/docs/examples/c/query_example.c +++ b/docs/examples/c/query_example.c @@ -76,7 +76,8 @@ int printRow(char *str, TAOS_ROW row, TAOS_FIELD *fields, int numFields) { } break; case TSDB_DATA_TYPE_BINARY: - case TSDB_DATA_TYPE_NCHAR: { + case TSDB_DATA_TYPE_NCHAR: + case TSDB_DATA_TYPE_GEOMETRY: { int32_t charLen = varDataLen((char *)row[i] - VARSTR_HEADER_SIZE); memcpy(str + len, row[i], charLen); len += charLen; diff --git a/docs/examples/java/src/main/java/com/taos/example/StmtInsertExample.java b/docs/examples/java/src/main/java/com/taos/example/StmtInsertExample.java index bbcc92b22f..72d4ecc725 100644 --- a/docs/examples/java/src/main/java/com/taos/example/StmtInsertExample.java +++ b/docs/examples/java/src/main/java/com/taos/example/StmtInsertExample.java @@ -6,39 +6,32 @@ import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; +import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; import java.util.ArrayList; -import java.util.Arrays; +import java.util.Comparator; import java.util.List; +import java.util.Random; +import java.util.stream.Collectors; public class StmtInsertExample { - private static ArrayList tsToLongArray(String ts) { - ArrayList result = new ArrayList<>(); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"); - LocalDateTime localDateTime = LocalDateTime.parse(ts, formatter); - result.add(localDateTime.toInstant(ZoneOffset.of("+8")).toEpochMilli()); - return result; - } + private static String datePattern = "yyyy-MM-dd HH:mm:ss.SSS"; + private static DateTimeFormatter formatter = DateTimeFormatter.ofPattern(datePattern); - private static ArrayList toArray(T v) { - ArrayList result = new ArrayList<>(); - result.add(v); - return result; - } - - private static List getRawData() { - return Arrays.asList( - "d1001,2018-10-03 14:38:05.000,10.30000,219,0.31000,California.SanFrancisco,2", - "d1001,2018-10-03 14:38:15.000,12.60000,218,0.33000,California.SanFrancisco,2", - "d1001,2018-10-03 14:38:16.800,12.30000,221,0.31000,California.SanFrancisco,2", - "d1002,2018-10-03 14:38:16.650,10.30000,218,0.25000,California.SanFrancisco,3", - "d1003,2018-10-03 14:38:05.500,11.80000,221,0.28000,California.LosAngeles,2", - "d1003,2018-10-03 14:38:16.600,13.40000,223,0.29000,California.LosAngeles,2", - "d1004,2018-10-03 14:38:05.000,10.80000,223,0.29000,California.LosAngeles,3", - "d1004,2018-10-03 14:38:06.500,11.50000,221,0.35000,California.LosAngeles,3" - ); + private static List getRawData(int size) { + SimpleDateFormat format = new SimpleDateFormat(datePattern); + List result = new ArrayList<>(); + long current = System.currentTimeMillis(); + Random random = new Random(); + for (int i = 0; i < size; i++) { + String time = format.format(current + i); + int id = random.nextInt(10); + result.add("d" + id + "," + time + ",10.30000,219,0.31000,California.SanFrancisco,2"); + } + return result.stream() + .sorted(Comparator.comparing(s -> s.split(",")[0])).collect(Collectors.toList()); } private static Connection getConnection() throws SQLException { @@ -48,9 +41,9 @@ public class StmtInsertExample { private static void createTable(Connection conn) throws SQLException { try (Statement stmt = conn.createStatement()) { - stmt.execute("CREATE DATABASE power KEEP 3650"); - stmt.executeUpdate("USE power"); - stmt.execute("CREATE STABLE meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) " + + stmt.execute("CREATE DATABASE if not exists power KEEP 3650"); + stmt.executeUpdate("use power"); + stmt.execute("CREATE STABLE if not exists meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) " + "TAGS (location BINARY(64), groupId INT)"); } } @@ -58,21 +51,54 @@ public class StmtInsertExample { private static void insertData() throws SQLException { try (Connection conn = getConnection()) { createTable(conn); - String psql = "INSERT INTO ? USING meters TAGS(?, ?) VALUES(?, ?, ?, ?)"; + String psql = "INSERT INTO ? USING power.meters TAGS(?, ?) VALUES(?, ?, ?, ?)"; try (TSDBPreparedStatement pst = (TSDBPreparedStatement) conn.prepareStatement(psql)) { - for (String line : getRawData()) { + String tableName = null; + ArrayList ts = new ArrayList<>(); + ArrayList current = new ArrayList<>(); + ArrayList voltage = new ArrayList<>(); + ArrayList phase = new ArrayList<>(); + for (String line : getRawData(100000)) { String[] ps = line.split(","); - // bind table name and tags - pst.setTableName(ps[0]); - pst.setTagString(0, ps[5]); - pst.setTagInt(1, Integer.valueOf(ps[6])); + if (tableName == null) { + // bind table name and tags + tableName = "power." + ps[0]; + pst.setTableName(ps[0]); + pst.setTagString(0, ps[5]); + pst.setTagInt(1, Integer.valueOf(ps[6])); + } else { + if (!tableName.equals(ps[0])) { + pst.setTimestamp(0, ts); + pst.setFloat(1, current); + pst.setInt(2, voltage); + pst.setFloat(3, phase); + pst.columnDataAddBatch(); + pst.columnDataExecuteBatch(); + + // bind table name and tags + tableName = ps[0]; + pst.setTableName(ps[0]); + pst.setTagString(0, ps[5]); + pst.setTagInt(1, Integer.valueOf(ps[6])); + ts.clear(); + current.clear(); + voltage.clear(); + phase.clear(); + } + } // bind values - pst.setTimestamp(0, tsToLongArray(ps[1])); //ps[1] looks like: 2018-10-03 14:38:05.000 - pst.setFloat(1, toArray(Float.valueOf(ps[2]))); - pst.setInt(2, toArray(Integer.valueOf(ps[3]))); - pst.setFloat(3, toArray(Float.valueOf(ps[4]))); - pst.columnDataAddBatch(); + // ps[1] looks like: 2018-10-03 14:38:05.000 + LocalDateTime localDateTime = LocalDateTime.parse(ps[1], formatter); + ts.add(localDateTime.toInstant(ZoneOffset.of("+8")).toEpochMilli()); + current.add(Float.valueOf(ps[2])); + voltage.add(Integer.valueOf(ps[3])); + phase.add(Float.valueOf(ps[4])); } + pst.setTimestamp(0, ts); + pst.setFloat(1, current); + pst.setInt(2, voltage); + pst.setFloat(3, phase); + pst.columnDataAddBatch(); pst.columnDataExecuteBatch(); } } diff --git a/docs/examples/java/src/main/java/com/taos/example/SubscribeDemo.java b/docs/examples/java/src/main/java/com/taos/example/SubscribeDemo.java index b5cdedc34f..3c5d2867e2 100644 --- a/docs/examples/java/src/main/java/com/taos/example/SubscribeDemo.java +++ b/docs/examples/java/src/main/java/com/taos/example/SubscribeDemo.java @@ -53,20 +53,28 @@ public class SubscribeDemo { // create consumer Properties properties = new Properties(); + properties.getProperty(TMQConstants.CONNECT_TYPE, "jni"); properties.setProperty(TMQConstants.BOOTSTRAP_SERVERS, "127.0.0.1:6030"); + properties.setProperty(TMQConstants.CONNECT_USER, "root"); + properties.setProperty(TMQConstants.CONNECT_PASS, "taosdata"); properties.setProperty(TMQConstants.MSG_WITH_TABLE_NAME, "true"); properties.setProperty(TMQConstants.ENABLE_AUTO_COMMIT, "true"); - properties.setProperty(TMQConstants.GROUP_ID, "test"); + properties.setProperty(TMQConstants.AUTO_COMMIT_INTERVAL, "1000"); + properties.setProperty(TMQConstants.GROUP_ID, "test1"); + properties.setProperty(TMQConstants.CLIENT_ID, "1"); + properties.setProperty(TMQConstants.AUTO_OFFSET_RESET, "earliest"); properties.setProperty(TMQConstants.VALUE_DESERIALIZER, "com.taos.example.MetersDeserializer"); + properties.setProperty(TMQConstants.VALUE_DESERIALIZER_ENCODING, "UTF-8"); + properties.setProperty(TMQConstants.EXPERIMENTAL_SNAPSHOT_ENABLE, "true"); // poll data try (TaosConsumer consumer = new TaosConsumer<>(properties)) { consumer.subscribe(Collections.singletonList(TOPIC)); while (!shutdown.get()) { ConsumerRecords meters = consumer.poll(Duration.ofMillis(100)); - for (ConsumerRecord recode : meters) { - Meters meter = recode.value(); + for (ConsumerRecord r : meters) { + Meters meter = r.value(); System.out.println(meter); } } diff --git a/docs/examples/java/src/main/java/com/taos/example/WebsocketSubscribeDemo.java b/docs/examples/java/src/main/java/com/taos/example/WebsocketSubscribeDemo.java index 83cb04f552..03f7e3a11e 100644 --- a/docs/examples/java/src/main/java/com/taos/example/WebsocketSubscribeDemo.java +++ b/docs/examples/java/src/main/java/com/taos/example/WebsocketSubscribeDemo.java @@ -1,5 +1,6 @@ package com.taos.example; +import com.taosdata.jdbc.tmq.ConsumerRecord; import com.taosdata.jdbc.tmq.ConsumerRecords; import com.taosdata.jdbc.tmq.TMQConstants; import com.taosdata.jdbc.tmq.TaosConsumer; @@ -54,18 +55,26 @@ public class WebsocketSubscribeDemo { Properties properties = new Properties(); properties.setProperty(TMQConstants.BOOTSTRAP_SERVERS, "127.0.0.1:6041"); properties.setProperty(TMQConstants.CONNECT_TYPE, "ws"); + properties.setProperty(TMQConstants.CONNECT_USER, "root"); + properties.setProperty(TMQConstants.CONNECT_PASS, "taosdata"); + properties.setProperty(TMQConstants.AUTO_OFFSET_RESET, "earliest"); properties.setProperty(TMQConstants.MSG_WITH_TABLE_NAME, "true"); properties.setProperty(TMQConstants.ENABLE_AUTO_COMMIT, "true"); - properties.setProperty(TMQConstants.GROUP_ID, "test"); + properties.setProperty(TMQConstants.AUTO_COMMIT_INTERVAL, "1000"); + properties.setProperty(TMQConstants.GROUP_ID, "test2"); + properties.setProperty(TMQConstants.CLIENT_ID, "1"); properties.setProperty(TMQConstants.VALUE_DESERIALIZER, "com.taos.example.MetersDeserializer"); + properties.setProperty(TMQConstants.VALUE_DESERIALIZER_ENCODING, "UTF-8"); + properties.setProperty(TMQConstants.EXPERIMENTAL_SNAPSHOT_ENABLE, "true"); // poll data try (TaosConsumer consumer = new TaosConsumer<>(properties)) { consumer.subscribe(Collections.singletonList(TOPIC)); while (!shutdown.get()) { ConsumerRecords meters = consumer.poll(Duration.ofMillis(100)); - for (Meters meter : meters) { + for (ConsumerRecord r : meters) { + Meters meter = (Meters) r.value(); System.out.println(meter); } } diff --git a/docs/zh/02-intro.md b/docs/zh/02-intro.md index 525c8aa5c9..888f779966 100644 --- a/docs/zh/02-intro.md +++ b/docs/zh/02-intro.md @@ -92,7 +92,7 @@ TDengine 的主要功能如下: ## 典型适用场景 -作为一个高性能、分布式、支持 SQL 的时序数据库(Database),TDengine 的典型适用场景包括但不限于 IoT、工业互联网、车联网、IT 运维、能源、金融证券等领域。需要指出的是,TDengine 是针对时序数据场景设计的专用数据库和专用大数据处理工具,因其充分利用了时序大数据的特点,它无法用来处理网络爬虫、微博、微信、电商、ERP、CRM 等通用型数据。下面本文将对适用场景做更多详细的分析。 +作为一个高性能、分布式、支持 SQL 的时序数据库(Time-series Database),TDengine 的典型适用场景包括但不限于 IoT、工业互联网、车联网、IT 运维、能源、金融证券等领域。需要指出的是,TDengine 是针对时序数据场景设计的专用数据库和专用大数据处理工具,因其充分利用了时序大数据的特点,它无法用来处理网络爬虫、微博、微信、电商、ERP、CRM 等通用型数据。下面本文将对适用场景做更多详细的分析。 ### 数据源特点和需求 diff --git a/docs/zh/07-develop/01-connect/index.md b/docs/zh/07-develop/01-connect/index.md index da31dec4c1..dff21b6870 100644 --- a/docs/zh/07-develop/01-connect/index.md +++ b/docs/zh/07-develop/01-connect/index.md @@ -82,7 +82,7 @@ TDengine 提供了丰富的应用程序开发接口,为了便于用户快速 com.taosdata.jdbc taos-jdbcdriver - 3.0.0 + 3.2.1 ``` diff --git a/docs/zh/07-develop/07-tmq.mdx b/docs/zh/07-develop/07-tmq.mdx index 11aef1f7e8..bfea926f53 100644 --- a/docs/zh/07-develop/07-tmq.mdx +++ b/docs/zh/07-develop/07-tmq.mdx @@ -285,10 +285,10 @@ CREATE TOPIC topic_name AS DATABASE db_name; | 参数名称 | 类型 | 参数说明 | 备注 | | :----------------------------: | :-----: | -------------------------------------------------------- | ------------------------------------------- | -| `td.connect.ip` | string | 用于创建连接,同 `taos_connect` | 仅用于建立原生连接 | -| `td.connect.user` | string | 用于创建连接,同 `taos_connect` | 仅用于建立原生连接 | -| `td.connect.pass` | string | 用于创建连接,同 `taos_connect` | 仅用于建立原生连接 | -| `td.connect.port` | integer | 用于创建连接,同 `taos_connect` | 仅用于建立原生连接 | +| `td.connect.ip` | string | 服务端的 IP 地址 | | +| `td.connect.user` | string | 用户名 | | +| `td.connect.pass` | string | 密码 | | +| `td.connect.port` | integer | 服务端的端口号 | | | `group.id` | string | 消费组 ID,同一消费组共享消费进度 | **必填项**。最大长度:192。 | | `client.id` | string | 客户端 ID | 最大长度:192。 | | `auto.offset.reset` | enum | 消费组订阅的初始位置 |
`earliest`: default;从头开始订阅;
`latest`: 仅从最新数据开始订阅;
`none`: 没有提交的 offset 无法订阅 | @@ -321,10 +321,11 @@ tmq_conf_destroy(conf);
-对于 Java 程序,使用如下配置项: +对于 Java 程序,还可以使用如下配置项: | 参数名称 | 类型 | 参数说明 | | ----------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------- | +| `td.connect.type` | string | 连接类型,"jni" 指原生连接,"ws" 指 websocket 连接,默认值为 "jni" | | `bootstrap.servers` | string | 连接地址,如 `localhost:6030` | | `value.deserializer` | string | 值解析方法,使用此方法应实现 `com.taosdata.jdbc.tmq.Deserializer` 接口或继承 `com.taosdata.jdbc.tmq.ReferenceDeserializer` 类 | | `value.deserializer.encoding` | string | 指定字符串解析的字符集 | | @@ -401,21 +402,6 @@ from taos.tmq import Consumer consumer = Consumer({"group.id": "local", "td.connect.ip": "127.0.0.1"}) ``` -其中,`configs` 为 dict 类型,传递创建 Consumer 的参数。可以配置的参数有: - -| 参数名称 | 类型 | 参数说明 | 备注 | -|:------:|:----:|:-------:|:---:| -| `td.connect.ip` | string | 用于创建连接|| -| `td.connect.user` | string | 用于创建连接|| -| `td.connect.pass` | string | 用于创建连接|| -| `td.connect.port` | string | 用于创建连接|| -| `group.id` | string | 消费组 ID,同一消费组共享消费进度 | **必填项**。最大长度:192 | -| `client.id` | string | 客户端 ID | 最大长度:192 | -| `msg.with.table.name` | string | 是否允许从消息中解析表名,不适用于列订阅 | 合法值:`true`, `false` | -| `enable.auto.commit` | string | 启用自动提交 | 合法值:`true`, `false` | -| `auto.commit.interval.ms` | string | 以毫秒为单位的自动提交时间间隔 | 默认值:5000 ms | -| `auto.offset.reset` | string | 消费组订阅的初始位置 | 可选:`earliest`(default), `latest`, `none` | - diff --git a/docs/zh/07-develop/09-udf.md b/docs/zh/07-develop/09-udf.md index 99ecd903b4..92f5d2a857 100644 --- a/docs/zh/07-develop/09-udf.md +++ b/docs/zh/07-develop/09-udf.md @@ -335,7 +335,7 @@ def init() def destroy() ``` -其中 init 完成初始化工作。 destroy 完成清理工作。如果没有初始化工作,无需定义 init 函数。如果没有清理工作,无需定义 destroy 函数。 +其中 init 完成初始化工作。 destroy 完成清理工作。 ### Python 和 TDengine之间的数据类型映射 @@ -386,6 +386,17 @@ pyl2norm 实现了输入列的所有数据的二阶范数,即对每个数据 +### 聚合函数示例 [pycumsum](https://github.com/taosdata/TDengine/blob/3.0/tests/script/sh/pycumsum.py) + +pycumsum 使用 numpy 计算输入列所有数据的累积和。 +
+pycumsum.py + +```c +{{#include tests/script/sh/pycumsum.py}} +``` + +
## 管理和使用 UDF 在使用 UDF 之前需要先将其加入到 TDengine 系统中。关于如何管理和使用 UDF,请参考[管理和使用 UDF](../12-taos-sql/26-udf.md) diff --git a/docs/zh/08-connector/14-java.mdx b/docs/zh/08-connector/14-java.mdx index 35332a9602..e4cf4a83e7 100644 --- a/docs/zh/08-connector/14-java.mdx +++ b/docs/zh/08-connector/14-java.mdx @@ -962,6 +962,7 @@ statement.executeUpdate("create topic if not exists topic_speed as select ts, sp ```java Properties config = new Properties(); +config.setProperty("bootstrap.servers", "localhost:6030"); config.setProperty("enable.auto.commit", "true"); config.setProperty("group.id", "group1"); config.setProperty("value.deserializer", "com.taosdata.jdbc.tmq.ConsumerTest.ResultDeserializer"); @@ -969,12 +970,14 @@ config.setProperty("value.deserializer", "com.taosdata.jdbc.tmq.ConsumerTest.Res TaosConsumer consumer = new TaosConsumer<>(config); ``` +- bootstrap.servers: TDengine 服务端所在的`ip:port`,如果使用 WebSocket 连接,则为 taosAdapter 所在的`ip:port`。 - enable.auto.commit: 是否允许自动提交。 - group.id: consumer: 所在的 group。 - value.deserializer: 结果集反序列化方法,可以继承 `com.taosdata.jdbc.tmq.ReferenceDeserializer`,并指定结果集 bean,实现反序列化。也可以继承 `com.taosdata.jdbc.tmq.Deserializer`,根据 SQL 的 resultSet 自定义反序列化方式。 - td.connect.type: 连接方式。jni:表示使用动态库连接的方式,ws/WebSocket:表示使用 WebSocket 进行数据通信。默认为 jni 方式。 -- httpConnectTimeout:创建连接超时参数,单位 ms,默认为 5000 ms。仅在 WebSocket 连接下有效。 -- messageWaitTimeout:数据传输超时参数,单位 ms,默认为 10000 ms。仅在 WebSocket 连接下有效。 +- httpConnectTimeout: 创建连接超时参数,单位 ms,默认为 5000 ms。仅在 WebSocket 连接下有效。 +- messageWaitTimeout: 数据传输超时参数,单位 ms,默认为 10000 ms。仅在 WebSocket 连接下有效。 +- httpPoolSize: 同一个连接下最大并行请求数。仅在 WebSocket 连接下有效。 其他参数请参考:[Consumer 参数列表](../../../develop/tmq#创建-consumer-以及consumer-group) #### 订阅消费数据 @@ -1016,10 +1019,19 @@ public abstract class ConsumerLoop { public ConsumerLoop() throws SQLException { Properties config = new Properties(); + config.setProperty("td.connect.type", "jni"); + config.setProperty("bootstrap.servers", "localhost:6030"); + config.setProperty("td.connect.user", "root"); + config.setProperty("td.connect.pass", "taosdata"); + config.setProperty("auto.offset.reset", "earliest"); config.setProperty("msg.with.table.name", "true"); config.setProperty("enable.auto.commit", "true"); + config.setProperty("auto.commit.interval.ms", "1000"); config.setProperty("group.id", "group1"); + config.setProperty("client.id", "1"); config.setProperty("value.deserializer", "com.taosdata.jdbc.tmq.ConsumerTest.ConsumerLoop$ResultDeserializer"); + config.setProperty("value.deserializer.encoding", "UTF-8"); + config.setProperty("experimental.snapshot.enable", "true"); this.consumer = new TaosConsumer<>(config); this.topics = Collections.singletonList("topic_speed"); @@ -1093,12 +1105,19 @@ public abstract class ConsumerLoop { public ConsumerLoop() throws SQLException { Properties config = new Properties(); - config.setProperty("bootstrap.servers", "localhost:6041"); config.setProperty("td.connect.type", "ws"); + config.setProperty("bootstrap.servers", "localhost:6041"); + config.setProperty("td.connect.user", "root"); + config.setProperty("td.connect.pass", "taosdata"); + config.setProperty("auto.offset.reset", "earliest"); config.setProperty("msg.with.table.name", "true"); config.setProperty("enable.auto.commit", "true"); + config.setProperty("auto.commit.interval.ms", "1000"); config.setProperty("group.id", "group2"); + config.setProperty("client.id", "1"); config.setProperty("value.deserializer", "com.taosdata.jdbc.tmq.ConsumerTest.ConsumerLoop$ResultDeserializer"); + config.setProperty("value.deserializer.encoding", "UTF-8"); + config.setProperty("experimental.snapshot.enable", "true"); this.consumer = new TaosConsumer<>(config); this.topics = Collections.singletonList("topic_speed"); diff --git a/docs/zh/08-connector/index.md b/docs/zh/08-connector/index.md index bb8c95a15a..d9c1a07d3c 100644 --- a/docs/zh/08-connector/index.md +++ b/docs/zh/08-connector/index.md @@ -45,7 +45,7 @@ TDengine 版本更新往往会增加新的功能特性,列表中的连接器 | **连接管理** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | | **普通查询** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | | **参数绑定** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | -| **数据订阅(TMQ)** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | +| **数据订阅(TMQ)** | 暂不支持 | 支持 | 支持 | 支持 | 支持 | 支持 | | **Schemaless** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | | **DataFrame** | 不支持 | 支持 | 不支持 | 不支持 | 不支持 | 不支持 | diff --git a/docs/zh/12-taos-sql/10-function.md b/docs/zh/12-taos-sql/10-function.md index 458fc9c7a2..248554f931 100644 --- a/docs/zh/12-taos-sql/10-function.md +++ b/docs/zh/12-taos-sql/10-function.md @@ -869,10 +869,15 @@ FIRST(expr) ### INTERP ```sql -INTERP(expr) +INTERP(expr [, ignore_null_values]) + +ignore_null_values: { + 0 + | 1 +} ``` -**功能说明**:返回指定时间截面指定列的记录值或插值。 +**功能说明**:返回指定时间截面指定列的记录值或插值。ignore_null_values 参数的值可以是 0 或 1,为 1 时表示忽略 NULL 值, 缺省值为0。 **返回数据类型**:同字段类型。 diff --git a/docs/zh/12-taos-sql/26-udf.md b/docs/zh/12-taos-sql/26-udf.md index c1d2761d7d..307831ce80 100644 --- a/docs/zh/12-taos-sql/26-udf.md +++ b/docs/zh/12-taos-sql/26-udf.md @@ -38,7 +38,7 @@ CREATE [OR REPLACE] AGGREGATE FUNCTION function_name AS library_path OUTPUTTYPE ``` - OR REPLACE: 如果函数已经存在,会修改已有的函数属性。 - function_name:聚合函数未来在 SQL 中被调用时的函数名,必须与函数实现中 udfNormalFunc 的实际名称一致; - - LANGUAGE 'C|Python':函数编程语言,目前支持C语言和Python语言。 + - LANGUAGE 'C|Python':函数编程语言,目前支持C语言和Python语言(v3.7+)。 - library_path:如果编程语言是C,路径是包含 UDF 函数实现的动态链接库的库文件绝对路径(指的是库文件在当前客户端所在主机上的保存路径,通常是指向一个 .so 文件)。如果编程语言是Python,路径是包含 UDF 函数实现的Python文件路径。这个路径需要用英文单引号或英文双引号括起来;; - output_type:此函数计算结果的数据类型名称; - buffer_size:中间计算结果的缓冲区大小,单位是字节。如果不使用可以不设置。 diff --git a/docs/zh/14-reference/07-tdinsight/index.mdx b/docs/zh/14-reference/07-tdinsight/index.mdx index b4eda61ebd..83e2a72b60 100644 --- a/docs/zh/14-reference/07-tdinsight/index.mdx +++ b/docs/zh/14-reference/07-tdinsight/index.mdx @@ -177,7 +177,7 @@ Install and configure TDinsight dashboard in Grafana on Ubuntu 18.04/20.04 syste 假设您在主机 `tdengine` 上启动 TDengine 数据库,HTTP API 端口为 `6041`,用户为 `root1`,密码为 `pass5ord`。执行脚本: ```bash -sudo ./TDinsight.sh -a http://tdengine:6041 -u root1 -p pass5ord +./TDinsight.sh -a http://tdengine:6041 -u root1 -p pass5ord ``` 我们提供了一个“-E”选项,用于从命令行配置 TDinsight 使用现有的通知通道(Notification Channel)。假设你的 Grafana 用户和密码是 `admin:admin`,使用以下命令获取已有的通知通道的`uid`: @@ -189,7 +189,7 @@ curl --no-progress-meter -u admin:admin http://localhost:3000/api/alert-notifica 使用上面获取的 `uid` 值作为 `-E` 输入。 ```bash -sudo ./TDinsight.sh -a http://tdengine:6041 -u root1 -p pass5ord -E existing-notifier +./TDinsight.sh -a http://tdengine:6041 -u root1 -p pass5ord -E existing-notifier ``` 如果要监控多个 TDengine 集群,则需要设置多个 TDinsight 仪表盘。设置非默认 TDinsight 需要进行一些更改: `-n` `-i` `-t` 选项需要更改为非默认名称,如果使用 内置短信告警功能,`-N` 和 `-L` 也应该改变。 diff --git a/docs/zh/14-reference/12-config/index.md b/docs/zh/14-reference/12-config/index.md index 2694086f59..3ede85f86d 100644 --- a/docs/zh/14-reference/12-config/index.md +++ b/docs/zh/14-reference/12-config/index.md @@ -79,14 +79,14 @@ taos --dump-config :::note 确保集群中所有主机在端口 6030 上的 TCP 协议能够互通。(详细的端口情况请参见下表) ::: -| 协议 | 默认端口 | 用途说明 | 修改方法 | -| :--- | :-------- | :---------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------- | -| TCP | 6030 | 客户端与服务端之间通讯,多节点集群的节点间通讯。 | 由配置文件设置 serverPort 决定。 | -| TCP | 6041 | 客户端与服务端之间的 RESTful 通讯。 | 随 serverPort 端口变化。注意 taosAdapter 配置或有不同,请参考相应[文档](/reference/taosadapter/)。 | -| TCP | 6043 | taosKeeper 监控服务端口。 | 随 taosKeeper 启动参数设置变化。 | -| TCP | 6044 | 支持 StatsD 的数据接入端口。 | 随 taosAdapter 启动参数设置变化| -| UDP | 6045 | 支持 collectd 数据接入端口。 | 随 taosAdapter 启动参数设置变化 | -| TCP | 6060 | 企业版内 Monitor 服务的网络端口。 | | +| 协议 | 默认端口 | 用途说明 | 修改方法 | +| :--- | :------- | :----------------------------------------------- | :------------------------------------------------------------------------------------------------- | +| TCP | 6030 | 客户端与服务端之间通讯,多节点集群的节点间通讯。 | 由配置文件设置 serverPort 决定。 | +| TCP | 6041 | 客户端与服务端之间的 RESTful 通讯。 | 随 serverPort 端口变化。注意 taosAdapter 配置或有不同,请参考相应[文档](/reference/taosadapter/)。 | +| TCP | 6043 | taosKeeper 监控服务端口。 | 随 taosKeeper 启动参数设置变化。 | +| TCP | 6044 | 支持 StatsD 的数据接入端口。 | 随 taosAdapter 启动参数设置变化 | +| UDP | 6045 | 支持 collectd 数据接入端口。 | 随 taosAdapter 启动参数设置变化 | +| TCP | 6060 | 企业版内 Monitor 服务的网络端口。 | | ### maxShellConns @@ -97,6 +97,24 @@ taos --dump-config | 取值范围 | 10-50000000 | | 缺省值 | 5000 | +### numOfRpcSessions + +| 属性 | 说明 | +| -------- | ---------------------------- | +| 适用范围 | 客户端和服务端都适用 | +| 含义 | 一个客户端能创建的最大连接数 | +| 取值范围 | 100-100000 | +| 缺省值 | 10000 | + +### timeToGetAvailableConn + +| 属性 | 说明 | +| -------- | -------------------------- | +| 适用范围 | 客户端和服务端都适用 | +| 含义 | 获得可用连接的最长等待时间 | +| 取值范围 | 10-50000000(单位为毫秒) | +| 缺省值 | 500000 | + ## 监控相关 :::note @@ -139,43 +157,43 @@ taos --dump-config ### telemetryReporting -| 属性 | 说明 | -| -------- | -------------------------------------------- | -| 适用范围 | 仅服务端适用 | -| 含义 |是否上传 telemetry | -| 取值范围 | 0,1 0: 不上传;1:上传 | -| 缺省值 | 1 | +| 属性 | 说明 | +| -------- | ------------------------ | +| 适用范围 | 仅服务端适用 | +| 含义 | 是否上传 telemetry | +| 取值范围 | 0,1 0: 不上传;1:上传 | +| 缺省值 | 1 | ### crashReporting -| 属性 | 说明 | -| -------- | -------------------------------------------- | -| 适用范围 | 仅服务端适用 | -| 含义 |是否上传 crash 信息 | -| 取值范围 | 0,1 0: 不上传;1:上传 | -| 缺省值 | 1 | +| 属性 | 说明 | +| -------- | ------------------------ | +| 适用范围 | 仅服务端适用 | +| 含义 | 是否上传 crash 信息 | +| 取值范围 | 0,1 0: 不上传;1:上传 | +| 缺省值 | 1 | ## 查询相关 ### queryPolicy -| 属性 | 说明 | -| -------- | ----------------------------- | -| 适用范围 | 仅客户端适用 | -| 含义 | 查询语句的执行策略 | -| 单位 | 无 | -| 缺省值 | 1 | +| 属性 | 说明 | +| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | +| 适用范围 | 仅客户端适用 | +| 含义 | 查询语句的执行策略 | +| 单位 | 无 | +| 缺省值 | 1 | | 补充说明 | 1: 只使用 vnode,不使用 qnode; 2: 没有扫描算子的子任务在 qnode 执行,带扫描算子的子任务在 vnode 执行; 3: vnode 只运行扫描算子,其余算子均在 qnode 执行 | ### querySmaOptimize -| 属性 | 说明 | -| -------- | -------------------- | -| 适用范围 | 仅客户端适用 | -| 含义 | sma index 的优化策略 | -| 单位 | 无 | -| 缺省值 | 0 | -| 补充说明 |0: 表示不使用 sma index,永远从原始数据进行查询; 1: 表示使用 sma index,对符合的语句,直接从预计算的结果进行查询 | +| 属性 | 说明 | +| -------- | ---------------------------------------------------------------------------------------------------------------- | +| 适用范围 | 仅客户端适用 | +| 含义 | sma index 的优化策略 | +| 单位 | 无 | +| 缺省值 | 0 | +| 补充说明 | 0: 表示不使用 sma index,永远从原始数据进行查询; 1: 表示使用 sma index,对符合的语句,直接从预计算的结果进行查询 | ### maxNumOfDistinctRes @@ -188,21 +206,21 @@ taos --dump-config ### keepColumnName -| 属性 | 说明 | -| -------- | -------------------------------- | -| 适用范围 | 仅客户端适用 | +| 属性 | 说明 | +| -------- | ----------------------------------------------------------- | +| 适用范围 | 仅客户端适用 | | 含义 | Last、First、LastRow 函数查询时,返回的列名是否包含函数名。 | -| 取值范围 | 0 表示包含函数名,1 表示不包含函数名。 | -| 缺省值 | 0 | +| 取值范围 | 0 表示包含函数名,1 表示不包含函数名。 | +| 缺省值 | 0 | ### countAlwaysReturnValue -| 属性 | 说明 | -| -------- | -------------------------------- | -| 适用范围 | 仅服务端适用 | -| 含义 | count/hyperloglog函数在输入数据为空或者NULL的情况下是否返回值 | -| 取值范围 | 0:返回空行,1:返回 0 | -| 缺省值 | 1 | +| 属性 | 说明 | +| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| 适用范围 | 仅服务端适用 | +| 含义 | count/hyperloglog函数在输入数据为空或者NULL的情况下是否返回值 | +| 取值范围 | 0:返回空行,1:返回 0 | +| 缺省值 | 1 | | 补充说明 | 该参数设置为 1 时,如果查询中含有 GROUP BY,PARTITION BY 以及 INTERVAL 子句且相应的组或窗口内数据为空或者NULL, 对应的组或窗口将不返回查询结果 | ## 区域相关 @@ -314,20 +332,20 @@ charset 的有效值是 UTF-8。 ### dataDir -| 属性 | 说明 | -| -------- | ------------------------------------------ | -| 适用范围 | 仅服务端适用 | -| 含义 | 数据文件目录,所有的数据文件都将写入该目录 | -| 缺省值 | /var/lib/taos | +| 属性 | 说明 | +| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 适用范围 | 仅服务端适用 | +| 含义 | 数据文件目录,所有的数据文件都将写入该目录 | +| 缺省值 | /var/lib/taos | | 补充说明 | [多级存储](https://docs.taosdata.com/tdinternal/arch/#%E5%A4%9A%E7%BA%A7%E5%AD%98%E5%82%A8) 功能需要与 [KEEP](https://docs.taosdata.com/taos-sql/database/#%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E) 参数配合使用 | ### tempDir -| 属性 | 说明 | -| -------- | ------------------------------------------ | -| 适用范围 | 仅服务端适用 | +| 属性 | 说明 | +| -------- | ------------------------------------------------ | +| 适用范围 | 仅服务端适用 | | 含义 | 该参数指定所有系统运行过程中的临时文件生成的目录 | -| 缺省值 | /tmp | +| 缺省值 | /tmp | ### minimalTmpDirGB @@ -340,12 +358,12 @@ charset 的有效值是 UTF-8。 ### minimalDataDirGB -| 属性 | 说明 | -| -------- | ------------------------------------------------ | -| 适用范围 | 仅服务端适用 | +| 属性 | 说明 | +| -------- | ---------------------------------------------- | +| 适用范围 | 仅服务端适用 | | 含义 | dataDir 指定的时序数据存储目录所需要保留的最小 | -| 单位 | GB | -| 缺省值 | 2.0 | +| 单位 | GB | +| 缺省值 | 2.0 | ## 集群相关 @@ -381,12 +399,12 @@ charset 的有效值是 UTF-8。 ### minimalLogDirGB -| 属性 | 说明 | -| -------- | -------------------------------------------- | -| 适用范围 | 服务端和客户端均适用 | +| 属性 | 说明 | +| -------- | ------------------------------------------------------ | +| 适用范围 | 服务端和客户端均适用 | | 含义 | 当日志文件夹所在磁盘可用空间大小小于该值时,停止写日志 | -| 单位 | GB | -| 缺省值 | 1.0 | +| 单位 | GB | +| 缺省值 | 1.0 | ### numOfLogLines @@ -590,12 +608,12 @@ charset 的有效值是 UTF-8。 ### smlChildTableName -| 属性 | 说明 | -| -------- | ------------------------- | -| 适用范围 | 仅客户端适用 | -| 含义 | schemaless 自定义的子表名的 key | -| 类型 | 字符串 | -| 缺省值 | 无 | +| 属性 | 说明 | +| -------- | ------------------------------- | +| 适用范围 | 仅客户端适用 | +| 含义 | schemaless 自定义的子表名的 key | +| 类型 | 字符串 | +| 缺省值 | 无 | ### smlTagName @@ -608,12 +626,12 @@ charset 的有效值是 UTF-8。 ### smlDataFormat -| 属性 | 说明 | -| -------- | ----------------------------- | -| 适用范围 | 仅客户端适用 | +| 属性 | 说明 | +| -------- | -------------------------------------------------------- | +| 适用范围 | 仅客户端适用 | | 含义 | schemaless 列数据是否顺序一致,从3.0.3.0开始,该配置废弃 | -| 值域 | 0:不一致;1: 一致 | -| 缺省值 | 0 | +| 值域 | 0:不一致;1: 一致 | +| 缺省值 | 0 | ## 其他 @@ -629,12 +647,12 @@ charset 的有效值是 UTF-8。 ### enableScience -| 属性 | 说明 | -| -------- | ------------------------------------------------------------------------------------------------------------------------------------------ | -| 适用范围 | 仅客户端 TAOS-CLI 适用 | -| 含义 | 是否开启科学计数法显示浮点数 | -| 取值范围 | 0:否,1:是 | -| 缺省值 | 0 | +| 属性 | 说明 | +| -------- | ---------------------------- | +| 适用范围 | 仅客户端 TAOS-CLI 适用 | +| 含义 | 是否开启科学计数法显示浮点数 | +| 取值范围 | 0:否,1:是 | +| 缺省值 | 0 | ### udf @@ -649,153 +667,153 @@ charset 的有效值是 UTF-8。 ### compressMsgSize -| 属性 | 说明 | -| -------- | ----------------------------- | -| 适用于 | 服务端和客户端均适用 | -| 含义 | 是否对 RPC 消息进行压缩 | -| 取值范围 | -1: 所有消息都不压缩; 0: 所有消息都压缩; N (N>0): 只有大于 N 个字节的消息才压缩 | -| 缺省值 | -1 | +| 属性 | 说明 | +| -------- | ------------------------------------------------------------------------------- | +| 适用于 | 服务端和客户端均适用 | +| 含义 | 是否对 RPC 消息进行压缩 | +| 取值范围 | -1: 所有消息都不压缩; 0: 所有消息都压缩; N (N>0): 只有大于 N 个字节的消息才压缩 | +| 缺省值 | -1 | ## 3.0 中有效的配置参数列表 -| # | **参数** | **适用于 2.X ** | **适用于 3.0 ** | 3.0 版本的当前行为 | -| --- | :---------------------: | --------------- | --------------- | ------------------------------------------------- | -| 1 | firstEp | 是 | 是 | | -| 2 | secondEp | 是 | 是 | | -| 3 | fqdn | 是 | 是 | | -| 4 | serverPort | 是 | 是 | | -| 5 | maxShellConns | 是 | 是 | | -| 6 | monitor | 是 | 是 | | -| 7 | monitorFqdn | 否 | 是 | | -| 8 | monitorPort | 否 | 是 | | -| 9 | monitorInterval | 是 | 是 | | -| 10 | queryPolicy | 否 | 是 | | -| 11 | querySmaOptimize | 否 | 是 | | -| 12 | maxNumOfDistinctRes | 是 | 是 | | -| 15 | countAlwaysReturnValue | 是 | 是 | | -| 16 | dataDir | 是 | 是 | | -| 17 | minimalDataDirGB | 是 | 是 | | -| 18 | supportVnodes | 否 | 是 | | -| 19 | tempDir | 是 | 是 | | -| 20 | minimalTmpDirGB | 是 | 是 | | -| 21 | smlChildTableName | 是 | 是 | | -| 22 | smlTagName | 是 | 是 | | -| 23 | smlDataFormat | 否 | 是(从3.0.3.0开始,该配置废弃) | | -| 24 | statusInterval | 是 | 是 | | -| 25 | logDir | 是 | 是 | | -| 26 | minimalLogDirGB | 是 | 是 | | -| 27 | numOfLogLines | 是 | 是 | | -| 28 | asyncLog | 是 | 是 | | -| 29 | logKeepDays | 是 | 是 | | -| 30 | debugFlag | 是 | 是 | | -| 31 | tmrDebugFlag | 是 | 是 | | -| 32 | uDebugFlag | 是 | 是 | | -| 33 | rpcDebugFlag | 是 | 是 | | -| 34 | jniDebugFlag | 是 | 是 | | -| 35 | qDebugFlag | 是 | 是 | | -| 36 | cDebugFlag | 是 | 是 | | -| 37 | dDebugFlag | 是 | 是 | | -| 38 | vDebugFlag | 是 | 是 | | -| 39 | mDebugFlag | 是 | 是 | | -| 40 | wDebugFlag | 是 | 是 | | -| 41 | sDebugFlag | 是 | 是 | | -| 42 | tsdbDebugFlag | 是 | 是 | | -| 43 | tqDebugFlag | 否 | 是 | | -| 44 | fsDebugFlag | 是 | 是 | | -| 45 | udfDebugFlag | 否 | 是 | | -| 46 | smaDebugFlag | 否 | 是 | | -| 47 | idxDebugFlag | 否 | 是 | | -| 48 | tdbDebugFlag | 否 | 是 | | -| 49 | metaDebugFlag | 否 | 是 | | -| 50 | timezone | 是 | 是 | | -| 51 | locale | 是 | 是 | | -| 52 | charset | 是 | 是 | | -| 53 | udf | 是 | 是 | | -| 54 | enableCoreFile | 是 | 是 | | +| # | **参数** | **适用于 2.X ** | **适用于 3.0 ** | 3.0 版本的当前行为 | +| --- | :--------------------: | --------------- | ------------------------------- | ------------------ | +| 1 | firstEp | 是 | 是 | | +| 2 | secondEp | 是 | 是 | | +| 3 | fqdn | 是 | 是 | | +| 4 | serverPort | 是 | 是 | | +| 5 | maxShellConns | 是 | 是 | | +| 6 | monitor | 是 | 是 | | +| 7 | monitorFqdn | 否 | 是 | | +| 8 | monitorPort | 否 | 是 | | +| 9 | monitorInterval | 是 | 是 | | +| 10 | queryPolicy | 否 | 是 | | +| 11 | querySmaOptimize | 否 | 是 | | +| 12 | maxNumOfDistinctRes | 是 | 是 | | +| 15 | countAlwaysReturnValue | 是 | 是 | | +| 16 | dataDir | 是 | 是 | | +| 17 | minimalDataDirGB | 是 | 是 | | +| 18 | supportVnodes | 否 | 是 | | +| 19 | tempDir | 是 | 是 | | +| 20 | minimalTmpDirGB | 是 | 是 | | +| 21 | smlChildTableName | 是 | 是 | | +| 22 | smlTagName | 是 | 是 | | +| 23 | smlDataFormat | 否 | 是(从3.0.3.0开始,该配置废弃) | | +| 24 | statusInterval | 是 | 是 | | +| 25 | logDir | 是 | 是 | | +| 26 | minimalLogDirGB | 是 | 是 | | +| 27 | numOfLogLines | 是 | 是 | | +| 28 | asyncLog | 是 | 是 | | +| 29 | logKeepDays | 是 | 是 | | +| 30 | debugFlag | 是 | 是 | | +| 31 | tmrDebugFlag | 是 | 是 | | +| 32 | uDebugFlag | 是 | 是 | | +| 33 | rpcDebugFlag | 是 | 是 | | +| 34 | jniDebugFlag | 是 | 是 | | +| 35 | qDebugFlag | 是 | 是 | | +| 36 | cDebugFlag | 是 | 是 | | +| 37 | dDebugFlag | 是 | 是 | | +| 38 | vDebugFlag | 是 | 是 | | +| 39 | mDebugFlag | 是 | 是 | | +| 40 | wDebugFlag | 是 | 是 | | +| 41 | sDebugFlag | 是 | 是 | | +| 42 | tsdbDebugFlag | 是 | 是 | | +| 43 | tqDebugFlag | 否 | 是 | | +| 44 | fsDebugFlag | 是 | 是 | | +| 45 | udfDebugFlag | 否 | 是 | | +| 46 | smaDebugFlag | 否 | 是 | | +| 47 | idxDebugFlag | 否 | 是 | | +| 48 | tdbDebugFlag | 否 | 是 | | +| 49 | metaDebugFlag | 否 | 是 | | +| 50 | timezone | 是 | 是 | | +| 51 | locale | 是 | 是 | | +| 52 | charset | 是 | 是 | | +| 53 | udf | 是 | 是 | | +| 54 | enableCoreFile | 是 | 是 | | ## 2.x->3.0 的废弃参数 -| # | **参数** | **适用于 2.X ** | **适用于 3.0 ** | 3.0 版本的当前行为 | -| --- | :---------------------: | --------------- | --------------- | ------------------------------------------------- | -| 1 | arbitrator | 是 | 否 | 通过 RAFT 协议选主 | -| 2 | numOfThreadsPerCore | 是 | 否 | 有其它参数设置多种线程池的大小 | -| 3 | numOfMnodes | 是 | 否 | 通过 create mnode 命令动态创建 mnode | -| 4 | vnodeBak | 是 | 否 | 3.0 行为未知 | -| 5 | balance | 是 | 否 | 负载均衡功能由 split/merge vgroups 实现 (暂不支持) | -| 6 | balanceInterval | 是 | 否 | 随着 balance 参数失效 | -| 7 | offlineThreshold | 是 | 否 | 3.0 行为未知 | -| 8 | role | 是 | 否 | 由 supportVnode 决定是否能够创建 | -| 9 | dnodeNopLoop | 是 | 否 | 2.6 文档中未找到此参数 | -| 10 | keepTimeOffset | 是 | 否 | 2.6 文档中未找到此参数 | -| 11 | rpcTimer | 是 | 否 | 3.0 行为未知 | -| 12 | rpcMaxTime | 是 | 否 | 3.0 行为未知 | -| 13 | rpcForceTcp | 是 | 否 | 默认为 TCP | -| 14 | tcpConnTimeout | 是 | 否 | 3.0 行为未知 | -| 15 | syncCheckInterval | 是 | 否 | 3.0 行为未知 | -| 16 | maxTmrCtrl | 是 | 否 | 3.0 行为未知 | -| 17 | monitorReplica | 是 | 否 | 由 RAFT 协议管理多副本 | -| 18 | smlTagNullName | 是 | 否 | 3.0 行为未知 | -| 20 | ratioOfQueryCores | 是 | 否 | 由 线程池 相关配置参数决定 | -| 21 | maxStreamCompDelay | 是 | 否 | 3.0 行为未知 | -| 22 | maxFirstStreamCompDelay | 是 | 否 | 3.0 行为未知 | -| 23 | retryStreamCompDelay | 是 | 否 | 3.0 行为未知 | -| 24 | streamCompDelayRatio | 是 | 否 | 3.0 行为未知 | -| 25 | maxVgroupsPerDb | 是 | 否 | 由 create db 的参数 vgroups 指定实际 vgroups 数量 | -| 26 | maxTablesPerVnode | 是 | 否 | DB 中的所有表近似平均分配到各个 vgroup | -| 27 | minTablesPerVnode | 是 | 否 | DB 中的所有表近似平均分配到各个 vgroup | -| 28 | tableIncStepPerVnode | 是 | 否 | DB 中的所有表近似平均分配到各个 vgroup | -| 29 | cache | 是 | 否 | 由 buffer 代替 cache\*blocks | -| 30 | blocks | 是 | 否 | 由 buffer 代替 cache\*blocks | -| 31 | days | 是 | 否 | 由 create db 的参数 duration 取代 | -| 32 | keep | 是 | 否 | 由 create db 的参数 keep 取代 | -| 33 | minRows | 是 | 否 | 由 create db 的参数 minRows 取代 | -| 34 | maxRows | 是 | 否 | 由 create db 的参数 maxRows 取代 | -| 35 | quorum | 是 | 否 | 由 RAFT 协议决定 | -| 36 | comp | 是 | 否 | 由 create db 的参数 comp 取代 | -| 37 | walLevel | 是 | 否 | 由 create db 的参数 wal_level 取代 | -| 38 | fsync | 是 | 否 | 由 create db 的参数 wal_fsync_period 取代 | -| 39 | replica | 是 | 否 | 由 create db 的参数 replica 取代 | -| 40 | partitions | 是 | 否 | 3.0 行为未知 | -| 41 | update | 是 | 否 | 允许更新部分列 | -| 42 | cachelast | 是 | 否 | 由 create db 的参数 cacheModel 取代 | -| 43 | maxSQLLength | 是 | 否 | SQL 上限为 1MB,无需参数控制 | -| 44 | maxWildCardsLength | 是 | 否 | 3.0 行为未知 | -| 45 | maxRegexStringLen | 是 | 否 | 3.0 行为未知 | -| 46 | maxNumOfOrderedRes | 是 | 否 | 3.0 行为未知 | -| 47 | maxConnections | 是 | 否 | 取决于系统配置和系统处理能力,详见后面的 Note | -| 48 | mnodeEqualVnodeNum | 是 | 否 | 3.0 行为未知 | -| 49 | http | 是 | 否 | http 服务由 taosAdapter 提供 | -| 50 | httpEnableRecordSql | 是 | 否 | taosd 不提供 http 服务 | -| 51 | httpMaxThreads | 是 | 否 | taosd 不提供 http 服务 | -| 52 | restfulRowLimit | 是 | 否 | taosd 不提供 http 服务 | -| 53 | httpDbNameMandatory | 是 | 否 | taosd 不提供 http 服务 | -| 54 | httpKeepAlive | 是 | 否 | taosd 不提供 http 服务 | -| 55 | enableRecordSql | 是 | 否 | 3.0 行为未知 | -| 56 | maxBinaryDisplayWidth | 是 | 否 | 3.0 行为未知 | -| 57 | stream | 是 | 否 | 默认启用连续查询 | -| 58 | retrieveBlockingModel | 是 | 否 | 3.0 行为未知 | -| 59 | tsdbMetaCompactRatio | 是 | 否 | 3.0 行为未知 | -| 60 | defaultJSONStrType | 是 | 否 | 3.0 行为未知 | -| 61 | walFlushSize | 是 | 否 | 3.0 行为未知 | -| 62 | keepTimeOffset | 是 | 否 | 3.0 行为未知 | -| 63 | flowctrl | 是 | 否 | 3.0 行为未知 | -| 64 | slaveQuery | 是 | 否 | 3.0 行为未知: slave vnode 是否能够处理查询? | -| 65 | adjustMaster | 是 | 否 | 3.0 行为未知 | -| 66 | topicBinaryLen | 是 | 否 | 3.0 行为未知 | -| 67 | telegrafUseFieldNum | 是 | 否 | 3.0 行为未知 | -| 68 | deadLockKillQuery | 是 | 否 | 3.0 行为未知 | -| 69 | clientMerge | 是 | 否 | 3.0 行为未知 | -| 70 | sdbDebugFlag | 是 | 否 | 参考 3.0 的 DebugFlag 系列参数 | -| 71 | odbcDebugFlag | 是 | 否 | 参考 3.0 的 DebugFlag 系列参数 | -| 72 | httpDebugFlag | 是 | 否 | 参考 3.0 的 DebugFlag 系列参数 | -| 73 | monDebugFlag | 是 | 否 | 参考 3.0 的 DebugFlag 系列参数 | -| 74 | cqDebugFlag | 是 | 否 | 参考 3.0 的 DebugFlag 系列参数 | -| 75 | shortcutFlag | 是 | 否 | 参考 3.0 的 DebugFlag 系列参数 | -| 76 | probeSeconds | 是 | 否 | 3.0 行为未知 | -| 77 | probeKillSeconds | 是 | 否 | 3.0 行为未知 | -| 78 | probeInterval | 是 | 否 | 3.0 行为未知 | -| 79 | lossyColumns | 是 | 否 | 3.0 行为未知 | -| 80 | fPrecision | 是 | 否 | 3.0 行为未知 | -| 81 | dPrecision | 是 | 否 | 3.0 行为未知 | -| 82 | maxRange | 是 | 否 | 3.0 行为未知 | -| 83 | range | 是 | 否 | 3.0 行为未知 | +| # | **参数** | **适用于 2.X ** | **适用于 3.0 ** | 3.0 版本的当前行为 | +| --- | :---------------------: | --------------- | --------------- | ---------------------------------------------------- | +| 1 | arbitrator | 是 | 否 | 通过 RAFT 协议选主 | +| 2 | numOfThreadsPerCore | 是 | 否 | 有其它参数设置多种线程池的大小 | +| 3 | numOfMnodes | 是 | 否 | 通过 create mnode 命令动态创建 mnode | +| 4 | vnodeBak | 是 | 否 | 3.0 行为未知 | +| 5 | balance | 是 | 否 | 负载均衡功能由 split/merge vgroups 实现 (暂不支持) | +| 6 | balanceInterval | 是 | 否 | 随着 balance 参数失效 | +| 7 | offlineThreshold | 是 | 否 | 3.0 行为未知 | +| 8 | role | 是 | 否 | 由 supportVnode 决定是否能够创建 | +| 9 | dnodeNopLoop | 是 | 否 | 2.6 文档中未找到此参数 | +| 10 | keepTimeOffset | 是 | 否 | 2.6 文档中未找到此参数 | +| 11 | rpcTimer | 是 | 否 | 3.0 行为未知 | +| 12 | rpcMaxTime | 是 | 否 | 3.0 行为未知 | +| 13 | rpcForceTcp | 是 | 否 | 默认为 TCP | +| 14 | tcpConnTimeout | 是 | 否 | 3.0 行为未知 | +| 15 | syncCheckInterval | 是 | 否 | 3.0 行为未知 | +| 16 | maxTmrCtrl | 是 | 否 | 3.0 行为未知 | +| 17 | monitorReplica | 是 | 否 | 由 RAFT 协议管理多副本 | +| 18 | smlTagNullName | 是 | 否 | 3.0 行为未知 | +| 20 | ratioOfQueryCores | 是 | 否 | 由 线程池 相关配置参数决定 | +| 21 | maxStreamCompDelay | 是 | 否 | 3.0 行为未知 | +| 22 | maxFirstStreamCompDelay | 是 | 否 | 3.0 行为未知 | +| 23 | retryStreamCompDelay | 是 | 否 | 3.0 行为未知 | +| 24 | streamCompDelayRatio | 是 | 否 | 3.0 行为未知 | +| 25 | maxVgroupsPerDb | 是 | 否 | 由 create db 的参数 vgroups 指定实际 vgroups 数量 | +| 26 | maxTablesPerVnode | 是 | 否 | DB 中的所有表近似平均分配到各个 vgroup | +| 27 | minTablesPerVnode | 是 | 否 | DB 中的所有表近似平均分配到各个 vgroup | +| 28 | tableIncStepPerVnode | 是 | 否 | DB 中的所有表近似平均分配到各个 vgroup | +| 29 | cache | 是 | 否 | 由 buffer 代替 cache\*blocks | +| 30 | blocks | 是 | 否 | 由 buffer 代替 cache\*blocks | +| 31 | days | 是 | 否 | 由 create db 的参数 duration 取代 | +| 32 | keep | 是 | 否 | 由 create db 的参数 keep 取代 | +| 33 | minRows | 是 | 否 | 由 create db 的参数 minRows 取代 | +| 34 | maxRows | 是 | 否 | 由 create db 的参数 maxRows 取代 | +| 35 | quorum | 是 | 否 | 由 RAFT 协议决定 | +| 36 | comp | 是 | 否 | 由 create db 的参数 comp 取代 | +| 37 | walLevel | 是 | 否 | 由 create db 的参数 wal_level 取代 | +| 38 | fsync | 是 | 否 | 由 create db 的参数 wal_fsync_period 取代 | +| 39 | replica | 是 | 否 | 由 create db 的参数 replica 取代 | +| 40 | partitions | 是 | 否 | 3.0 行为未知 | +| 41 | update | 是 | 否 | 允许更新部分列 | +| 42 | cachelast | 是 | 否 | 由 create db 的参数 cacheModel 取代 | +| 43 | maxSQLLength | 是 | 否 | SQL 上限为 1MB,无需参数控制 | +| 44 | maxWildCardsLength | 是 | 否 | 3.0 行为未知 | +| 45 | maxRegexStringLen | 是 | 否 | 3.0 行为未知 | +| 46 | maxNumOfOrderedRes | 是 | 否 | 3.0 行为未知 | +| 47 | maxConnections | 是 | 否 | 取决于系统配置和系统处理能力,详见后面的 Note | +| 48 | mnodeEqualVnodeNum | 是 | 否 | 3.0 行为未知 | +| 49 | http | 是 | 否 | http 服务由 taosAdapter 提供 | +| 50 | httpEnableRecordSql | 是 | 否 | taosd 不提供 http 服务 | +| 51 | httpMaxThreads | 是 | 否 | taosd 不提供 http 服务 | +| 52 | restfulRowLimit | 是 | 否 | taosd 不提供 http 服务 | +| 53 | httpDbNameMandatory | 是 | 否 | taosd 不提供 http 服务 | +| 54 | httpKeepAlive | 是 | 否 | taosd 不提供 http 服务 | +| 55 | enableRecordSql | 是 | 否 | 3.0 行为未知 | +| 56 | maxBinaryDisplayWidth | 是 | 否 | 3.0 行为未知 | +| 57 | stream | 是 | 否 | 默认启用连续查询 | +| 58 | retrieveBlockingModel | 是 | 否 | 3.0 行为未知 | +| 59 | tsdbMetaCompactRatio | 是 | 否 | 3.0 行为未知 | +| 60 | defaultJSONStrType | 是 | 否 | 3.0 行为未知 | +| 61 | walFlushSize | 是 | 否 | 3.0 行为未知 | +| 62 | keepTimeOffset | 是 | 否 | 3.0 行为未知 | +| 63 | flowctrl | 是 | 否 | 3.0 行为未知 | +| 64 | slaveQuery | 是 | 否 | 3.0 行为未知: slave vnode 是否能够处理查询? | +| 65 | adjustMaster | 是 | 否 | 3.0 行为未知 | +| 66 | topicBinaryLen | 是 | 否 | 3.0 行为未知 | +| 67 | telegrafUseFieldNum | 是 | 否 | 3.0 行为未知 | +| 68 | deadLockKillQuery | 是 | 否 | 3.0 行为未知 | +| 69 | clientMerge | 是 | 否 | 3.0 行为未知 | +| 70 | sdbDebugFlag | 是 | 否 | 参考 3.0 的 DebugFlag 系列参数 | +| 71 | odbcDebugFlag | 是 | 否 | 参考 3.0 的 DebugFlag 系列参数 | +| 72 | httpDebugFlag | 是 | 否 | 参考 3.0 的 DebugFlag 系列参数 | +| 73 | monDebugFlag | 是 | 否 | 参考 3.0 的 DebugFlag 系列参数 | +| 74 | cqDebugFlag | 是 | 否 | 参考 3.0 的 DebugFlag 系列参数 | +| 75 | shortcutFlag | 是 | 否 | 参考 3.0 的 DebugFlag 系列参数 | +| 76 | probeSeconds | 是 | 否 | 3.0 行为未知 | +| 77 | probeKillSeconds | 是 | 否 | 3.0 行为未知 | +| 78 | probeInterval | 是 | 否 | 3.0 行为未知 | +| 79 | lossyColumns | 是 | 否 | 3.0 行为未知 | +| 80 | fPrecision | 是 | 否 | 3.0 行为未知 | +| 81 | dPrecision | 是 | 否 | 3.0 行为未知 | +| 82 | maxRange | 是 | 否 | 3.0 行为未知 | +| 83 | range | 是 | 否 | 3.0 行为未知 | diff --git a/docs/zh/17-operation/10-monitor.md b/docs/zh/17-operation/10-monitor.md index 7def90916c..50da505808 100644 --- a/docs/zh/17-operation/10-monitor.md +++ b/docs/zh/17-operation/10-monitor.md @@ -32,7 +32,7 @@ chmod +x TDinsight.sh - 使用已经存在的 Grafana Notification Channel `uid`,参数 `-E`。该参数可以使用 `curl -u admin:admin localhost:3000/api/alert-notifications |jq` 来获取。 ```bash - sudo ./TDinsight.sh -a http://localhost:6041 -u root -p taosdata -E + ./TDinsight.sh -a http://localhost:6041 -u root -p taosdata -E ``` 运行程序并重启 Grafana 服务,打开面板:`http://localhost:3000/d/tdinsight`。 @@ -270,7 +270,7 @@ TDinsight dashboard 数据来源于 log 库(存放监控数据的默认db, |field|type|is\_tag|comment| |:----|:---|:-----|:------| |\_ts|TIMESTAMP||timestamp| -|guage|DOUBLE||监控指标值| +|gauge|DOUBLE||监控指标值| |client\_ip|NCHAR|TAG|client ip| |endpoint|NCHAR|TAG|taosadpater endpoint| |request\_method|NCHAR|TAG|request method| @@ -284,7 +284,7 @@ TDinsight dashboard 数据来源于 log 库(存放监控数据的默认db, |field|type|is\_tag|comment| |:----|:---|:-----|:------| |\_ts|TIMESTAMP||timestamp| -|guage|DOUBLE||监控指标值| +|gauge|DOUBLE||监控指标值| |client\_ip|NCHAR|TAG|client ip| |endpoint|NCHAR|TAG|taosadpater endpoint| |request\_method|NCHAR|TAG|request method| @@ -298,7 +298,7 @@ TDinsight dashboard 数据来源于 log 库(存放监控数据的默认db, |field|type|is\_tag|comment| |:----|:---|:-----|:------| |\_ts|TIMESTAMP||timestamp| -|guage|DOUBLE||监控指标值| +|gauge|DOUBLE||监控指标值| |endpoint|NCHAR|TAG|taosadpater endpoint| ### taosadapter\_restful\_http\_request\_summary\_milliseconds 表 @@ -326,7 +326,7 @@ TDinsight dashboard 数据来源于 log 库(存放监控数据的默认db, |field|type|is\_tag|comment| |:----|:---|:-----|:------| |\_ts|TIMESTAMP||timestamp| -|guage|DOUBLE||监控指标值| +|gauge|DOUBLE||监控指标值| |endpoint|NCHAR|TAG|taosadpater endpoint| ### taosadapter\_system\_cpu\_percent 表 @@ -336,5 +336,5 @@ TDinsight dashboard 数据来源于 log 库(存放监控数据的默认db, |field|type|is\_tag|comment| |:----|:---|:-----|:------| |\_ts|TIMESTAMP||timestamp| -|guage|DOUBLE||监控指标值| +|gauge|DOUBLE||监控指标值| |endpoint|NCHAR|TAG|taosadpater endpoint| diff --git a/docs/zh/20-third-party/11-kafka.md b/docs/zh/20-third-party/11-kafka.md index 75d8deebb1..97e78c2fde 100644 --- a/docs/zh/20-third-party/11-kafka.md +++ b/docs/zh/20-third-party/11-kafka.md @@ -318,7 +318,6 @@ connection.backoff.ms=5000 topic.prefix=tdengine-source- poll.interval.ms=1000 fetch.max.rows=100 -out.format=line key.converter=org.apache.kafka.connect.storage.StringConverter value.converter=org.apache.kafka.connect.storage.StringConverter ``` @@ -357,7 +356,7 @@ confluent local services connect connector load TDengineSourceConnector --config ### 查看 topic 数据 -使用 kafka-console-consumer 命令行工具监控主题 tdengine-source-test 中的数据。一开始会输出所有历史数据, 往 TDengine 插入两条新的数据之后,kafka-console-consumer 也立即输出了新增的两条数据。 +使用 kafka-console-consumer 命令行工具监控主题 tdengine-source-test 中的数据。一开始会输出所有历史数据, 往 TDengine 插入两条新的数据之后,kafka-console-consumer 也立即输出了新增的两条数据。 输出数据 InfluxDB line protocol 的格式。 ``` kafka-console-consumer --bootstrap-server localhost:9092 --from-beginning --topic tdengine-source-test @@ -434,11 +433,12 @@ confluent local services connect connector unload TDengineSourceConnector ### TDengine Source Connector 特有的配置 1. `connection.database`: 源数据库名称,无缺省值。 -2. `topic.prefix`: 数据导入 kafka 后 topic 名称前缀。 使用 `topic.prefix` + `connection.database` 名称作为完整 topic 名。默认为空字符串 ""。 -3. `timestamp.initial`: 数据同步起始时间。格式为'yyyy-MM-dd HH:mm:ss'。默认为 "1970-01-01 00:00:00"。 -4. `poll.interval.ms`: 拉取数据间隔,单位为 ms。默认为 1000。 +2. `topic.prefix`: 数据导入 kafka 时使用的 topic 名称的前缀。默认为空字符串 ""。 +3. `timestamp.initial`: 数据同步起始时间。格式为'yyyy-MM-dd HH:mm:ss',若未指定则从指定 DB 中最早的一条记录开始。 +4. `poll.interval.ms`: 检查是否有新建或删除的表的时间间隔,单位为 ms。默认为 1000。 5. `fetch.max.rows` : 检索数据库时最大检索条数。 默认为 100。 -6. `out.format`: 数据格式。取值 line 或 json。line 表示 InfluxDB Line 协议格式, json 表示 OpenTSDB JSON 格式。默认为 line。 +6. `query.interval.ms`: 从 TDengine 一次读取数据的时间跨度,需要根据表中的数据特征合理配置,避免一次查询的数据量过大或过小;在具体的环境中建议通过测试设置一个较优值,默认值为 1000. +7. `topic.per.stable`: 如果设置为true,表示一个超级表对应一个 Kafka topic,topic的命名规则 `--`;如果设置为 false,则指定的 DB 中的所有数据进入一个 Kafka topic,topic 的命名规则为 `-` ## 其他说明 diff --git a/docs/zh/27-train-faq/01-faq.md b/docs/zh/27-train-faq/01-faq.md index 9e82ea0af0..bf46f3ca1f 100644 --- a/docs/zh/27-train-faq/01-faq.md +++ b/docs/zh/27-train-faq/01-faq.md @@ -247,4 +247,10 @@ launchctl limit maxfiles 该提示是创建 db 的 vnode 数量不够了,需要的 vnode 不能超过了 dnode 中 vnode 的上限。因为系统默认是一个 dnode 中有 CPU 核数两倍的 vnode,也可以通过配置文件中的参数 supportVnodes 控制。 正常调大 taos.cfg 中 supportVnodes 参数即可。 +### 21 【查询】在服务器上的使用 tao-CLI 能查到指定时间段的数据,但在客户端机器上查不到? +这种情况是因为客户端与服务器上设置的时区不一致导致的,调整客户端与服务器的时区一致即可解决。 + +### 22 【表名】表名确认是存在的,但写入或查询时报表不存在错误,非常奇怪,什么原因? +TDengine 中的所有名称,包括数据库名、表名等都是区分大小写的,如果这些名称在程序或 taos-CLI 中没有使用反引号(`)括起来使用,即使你输入的是大写的,引擎也会转化成小写来使用,如果名称前后加上了反引号,引擎就不会再转化成小写,会保持原样来使用。 + diff --git a/docs/zh/28-releases/01-tdengine.md b/docs/zh/28-releases/01-tdengine.md index bea0adfa82..2b28bae745 100644 --- a/docs/zh/28-releases/01-tdengine.md +++ b/docs/zh/28-releases/01-tdengine.md @@ -10,6 +10,10 @@ TDengine 2.x 各版本安装包请访问[这里](https://www.taosdata.com/all-do import Release from "/components/ReleaseV3"; +## 3.0.4.2 + + + ## 3.0.4.1 diff --git a/docs/zh/28-releases/02-tools.md b/docs/zh/28-releases/02-tools.md index e13ec68c2e..7f93483ed4 100644 --- a/docs/zh/28-releases/02-tools.md +++ b/docs/zh/28-releases/02-tools.md @@ -14,10 +14,6 @@ import Release from "/components/ReleaseV3"; -## 2.5.0 - - - ## 2.4.12 diff --git a/examples/c/tmq.c b/examples/c/tmq.c index 94545dfaad..e1133c109e 100644 --- a/examples/c/tmq.c +++ b/examples/c/tmq.c @@ -73,7 +73,7 @@ static int32_t init_env() { taos_free_result(pRes); // create database - pRes = taos_query(pConn, "create database tmqdb precision 'ns'"); + pRes = taos_query(pConn, "create database tmqdb precision 'ns' WAL_RETENTION_PERIOD 3600"); if (taos_errno(pRes) != 0) { printf("error in create tmqdb, reason:%s\n", taos_errstr(pRes)); goto END; @@ -289,7 +289,7 @@ void consume_repeatly(tmq_t* tmq) { } } - free(pAssign); + tmq_free_assignment(pAssign); // let's do it again basic_consume_loop(tmq); diff --git a/examples/lua/lua51/lua_connector51.c b/examples/lua/lua51/lua_connector51.c index c5ef9126a6..a8f051a790 100644 --- a/examples/lua/lua51/lua_connector51.c +++ b/examples/lua/lua51/lua_connector51.c @@ -162,6 +162,7 @@ static int l_query(lua_State *L){ case TSDB_DATA_TYPE_JSON: case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: + case TSDB_DATA_TYPE_GEOMETRY: //printf("type:%d, max len:%d, current len:%d\n",fields[i].type, fields[i].bytes, length[i]); lua_pushlstring(L,(char *)row[i], length[i]); break; diff --git a/examples/lua/lua_connector.c b/examples/lua/lua_connector.c index 5d8226f262..1422d1eb03 100644 --- a/examples/lua/lua_connector.c +++ b/examples/lua/lua_connector.c @@ -161,6 +161,7 @@ static int l_query(lua_State *L){ case TSDB_DATA_TYPE_JSON: case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: + case TSDB_DATA_TYPE_GEOMETRY: //printf("type:%d, max len:%d, current len:%d\n",fields[i].type, fields[i].bytes, length[i]); lua_pushlstring(L,(char *)row[i], length[i]); break; diff --git a/include/client/taos.h b/include/client/taos.h index 8811c4ab64..7bdf16ed38 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -51,7 +51,8 @@ typedef void TAOS_SUB; #define TSDB_DATA_TYPE_BLOB 18 // binary #define TSDB_DATA_TYPE_MEDIUMBLOB 19 #define TSDB_DATA_TYPE_BINARY TSDB_DATA_TYPE_VARCHAR // string -#define TSDB_DATA_TYPE_MAX 20 +#define TSDB_DATA_TYPE_GEOMETRY 20 // geometry +#define TSDB_DATA_TYPE_MAX 21 typedef enum { TSDB_OPTION_LOCALE, @@ -288,6 +289,7 @@ DLL_EXPORT int32_t tmq_commit_sync(tmq_t *tmq, const TAOS_RES *msg); DLL_EXPORT void tmq_commit_async(tmq_t *tmq, const TAOS_RES *msg, tmq_commit_cb *cb, void *param); DLL_EXPORT int32_t tmq_get_topic_assignment(tmq_t *tmq, const char *pTopicName, tmq_topic_assignment **assignment, int32_t *numOfAssignment); +DLL_EXPORT void tmq_free_assignment(tmq_topic_assignment* pAssignment); DLL_EXPORT int32_t tmq_offset_seek(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset); /* ----------------------TMQ CONFIGURATION INTERFACE---------------------- */ diff --git a/include/common/tdatablock.h b/include/common/tdatablock.h index 99fffa2cf1..33c571fc1b 100644 --- a/include/common/tdatablock.h +++ b/include/common/tdatablock.h @@ -215,7 +215,7 @@ void colInfoDataCleanup(SColumnInfoData* pColumn, uint32_t numOfRows); void blockDataCleanup(SSDataBlock* pDataBlock); void blockDataEmpty(SSDataBlock* pDataBlock); -size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize); +size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize, int32_t extraSize); int32_t blockDataTrimFirstRows(SSDataBlock* pBlock, size_t n); int32_t blockDataKeepFirstNRows(SSDataBlock* pBlock, size_t n); diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 8509d39793..abee37d122 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -124,6 +124,7 @@ extern int32_t tsRedirectFactor; extern int32_t tsRedirectMaxPeriod; extern int32_t tsMaxRetryWaitTime; extern bool tsUseAdapter; +extern int32_t tsMetaCacheMaxSize; extern int32_t tsSlowLogThreshold; extern int32_t tsSlowLogScope; @@ -193,7 +194,7 @@ struct SConfig *taosGetCfg(); void taosSetAllDebugFlag(int32_t flag, bool rewrite); void taosSetDebugFlag(int32_t *pFlagPtr, const char *flagName, int32_t flagVal, bool rewrite); -int32_t taosSetCfg(SConfig *pCfg, char *name); +int32_t taosApplyLocalCfg(SConfig *pCfg, char *name); void taosLocalCfgForbiddenToChange(char *name, bool *forbidden); #ifdef __cplusplus diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 0c08cb2650..f4502030fd 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1642,6 +1642,7 @@ typedef struct { char fqdn[TSDB_FQDN_LEN]; int32_t port; int8_t force; + int8_t unsafe; } SDropDnodeReq; int32_t tSerializeSDropDnodeReq(void* buf, int32_t bufLen, SDropDnodeReq* pReq); @@ -3190,7 +3191,8 @@ typedef struct { char dbFName[TSDB_DB_FNAME_LEN]; uint64_t suid; int32_t version; - SArray* pIndex; + int32_t indexSize; + SArray* pIndex; // STableIndexInfo } STableIndexRsp; int32_t tSerializeSTableIndexRsp(void* buf, int32_t bufLen, const STableIndexRsp* pRsp); diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 79e8cc1bf1..8e6c014be9 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -70,286 +70,288 @@ #define TK_RESTORE 52 #define TK_NK_IPTOKEN 53 #define TK_FORCE 54 -#define TK_LOCAL 55 -#define TK_QNODE 56 -#define TK_BNODE 57 -#define TK_SNODE 58 -#define TK_MNODE 59 -#define TK_VNODE 60 -#define TK_DATABASE 61 -#define TK_USE 62 -#define TK_FLUSH 63 -#define TK_TRIM 64 -#define TK_COMPACT 65 -#define TK_IF 66 -#define TK_NOT 67 -#define TK_EXISTS 68 -#define TK_BUFFER 69 -#define TK_CACHEMODEL 70 -#define TK_CACHESIZE 71 -#define TK_COMP 72 -#define TK_DURATION 73 -#define TK_NK_VARIABLE 74 -#define TK_MAXROWS 75 -#define TK_MINROWS 76 -#define TK_KEEP 77 -#define TK_PAGES 78 -#define TK_PAGESIZE 79 -#define TK_TSDB_PAGESIZE 80 -#define TK_PRECISION 81 -#define TK_REPLICA 82 -#define TK_VGROUPS 83 -#define TK_SINGLE_STABLE 84 -#define TK_RETENTIONS 85 -#define TK_SCHEMALESS 86 -#define TK_WAL_LEVEL 87 -#define TK_WAL_FSYNC_PERIOD 88 -#define TK_WAL_RETENTION_PERIOD 89 -#define TK_WAL_RETENTION_SIZE 90 -#define TK_WAL_ROLL_PERIOD 91 -#define TK_WAL_SEGMENT_SIZE 92 -#define TK_STT_TRIGGER 93 -#define TK_TABLE_PREFIX 94 -#define TK_TABLE_SUFFIX 95 -#define TK_NK_COLON 96 -#define TK_MAX_SPEED 97 -#define TK_START 98 -#define TK_TIMESTAMP 99 -#define TK_END 100 -#define TK_TABLE 101 -#define TK_NK_LP 102 -#define TK_NK_RP 103 -#define TK_STABLE 104 -#define TK_ADD 105 -#define TK_COLUMN 106 -#define TK_MODIFY 107 -#define TK_RENAME 108 -#define TK_TAG 109 -#define TK_SET 110 -#define TK_NK_EQ 111 -#define TK_USING 112 -#define TK_TAGS 113 -#define TK_BOOL 114 -#define TK_TINYINT 115 -#define TK_SMALLINT 116 -#define TK_INT 117 -#define TK_INTEGER 118 -#define TK_BIGINT 119 -#define TK_FLOAT 120 -#define TK_DOUBLE 121 -#define TK_BINARY 122 -#define TK_NCHAR 123 -#define TK_UNSIGNED 124 -#define TK_JSON 125 -#define TK_VARCHAR 126 -#define TK_MEDIUMBLOB 127 -#define TK_BLOB 128 -#define TK_VARBINARY 129 -#define TK_DECIMAL 130 -#define TK_COMMENT 131 -#define TK_MAX_DELAY 132 -#define TK_WATERMARK 133 -#define TK_ROLLUP 134 -#define TK_TTL 135 -#define TK_SMA 136 -#define TK_DELETE_MARK 137 -#define TK_FIRST 138 -#define TK_LAST 139 -#define TK_SHOW 140 -#define TK_PRIVILEGES 141 -#define TK_DATABASES 142 -#define TK_TABLES 143 -#define TK_STABLES 144 -#define TK_MNODES 145 -#define TK_QNODES 146 -#define TK_FUNCTIONS 147 -#define TK_INDEXES 148 -#define TK_ACCOUNTS 149 -#define TK_APPS 150 -#define TK_CONNECTIONS 151 -#define TK_LICENCES 152 -#define TK_GRANTS 153 -#define TK_QUERIES 154 -#define TK_SCORES 155 -#define TK_TOPICS 156 -#define TK_VARIABLES 157 -#define TK_CLUSTER 158 -#define TK_BNODES 159 -#define TK_SNODES 160 -#define TK_TRANSACTIONS 161 -#define TK_DISTRIBUTED 162 -#define TK_CONSUMERS 163 -#define TK_SUBSCRIPTIONS 164 -#define TK_VNODES 165 -#define TK_ALIVE 166 -#define TK_LIKE 167 -#define TK_TBNAME 168 -#define TK_QTAGS 169 -#define TK_AS 170 -#define TK_INDEX 171 -#define TK_FUNCTION 172 -#define TK_INTERVAL 173 -#define TK_COUNT 174 -#define TK_LAST_ROW 175 -#define TK_TOPIC 176 -#define TK_META 177 -#define TK_CONSUMER 178 -#define TK_GROUP 179 -#define TK_DESC 180 -#define TK_DESCRIBE 181 -#define TK_RESET 182 -#define TK_QUERY 183 -#define TK_CACHE 184 -#define TK_EXPLAIN 185 -#define TK_ANALYZE 186 -#define TK_VERBOSE 187 -#define TK_NK_BOOL 188 -#define TK_RATIO 189 -#define TK_NK_FLOAT 190 -#define TK_OUTPUTTYPE 191 -#define TK_AGGREGATE 192 -#define TK_BUFSIZE 193 -#define TK_LANGUAGE 194 -#define TK_REPLACE 195 -#define TK_STREAM 196 -#define TK_INTO 197 -#define TK_PAUSE 198 -#define TK_RESUME 199 -#define TK_TRIGGER 200 -#define TK_AT_ONCE 201 -#define TK_WINDOW_CLOSE 202 -#define TK_IGNORE 203 -#define TK_EXPIRED 204 -#define TK_FILL_HISTORY 205 -#define TK_UPDATE 206 -#define TK_SUBTABLE 207 -#define TK_UNTREATED 208 -#define TK_KILL 209 -#define TK_CONNECTION 210 -#define TK_TRANSACTION 211 -#define TK_BALANCE 212 -#define TK_VGROUP 213 -#define TK_LEADER 214 -#define TK_MERGE 215 -#define TK_REDISTRIBUTE 216 -#define TK_SPLIT 217 -#define TK_DELETE 218 -#define TK_INSERT 219 -#define TK_NULL 220 -#define TK_NK_QUESTION 221 -#define TK_NK_ARROW 222 -#define TK_ROWTS 223 -#define TK_QSTART 224 -#define TK_QEND 225 -#define TK_QDURATION 226 -#define TK_WSTART 227 -#define TK_WEND 228 -#define TK_WDURATION 229 -#define TK_IROWTS 230 -#define TK_ISFILLED 231 -#define TK_CAST 232 -#define TK_NOW 233 -#define TK_TODAY 234 -#define TK_TIMEZONE 235 -#define TK_CLIENT_VERSION 236 -#define TK_SERVER_VERSION 237 -#define TK_SERVER_STATUS 238 -#define TK_CURRENT_USER 239 -#define TK_CASE 240 -#define TK_WHEN 241 -#define TK_THEN 242 -#define TK_ELSE 243 -#define TK_BETWEEN 244 -#define TK_IS 245 -#define TK_NK_LT 246 -#define TK_NK_GT 247 -#define TK_NK_LE 248 -#define TK_NK_GE 249 -#define TK_NK_NE 250 -#define TK_MATCH 251 -#define TK_NMATCH 252 -#define TK_CONTAINS 253 -#define TK_IN 254 -#define TK_JOIN 255 -#define TK_INNER 256 -#define TK_SELECT 257 -#define TK_DISTINCT 258 -#define TK_WHERE 259 -#define TK_PARTITION 260 -#define TK_BY 261 -#define TK_SESSION 262 -#define TK_STATE_WINDOW 263 -#define TK_EVENT_WINDOW 264 -#define TK_SLIDING 265 -#define TK_FILL 266 -#define TK_VALUE 267 -#define TK_VALUE_F 268 -#define TK_NONE 269 -#define TK_PREV 270 -#define TK_NULL_F 271 -#define TK_LINEAR 272 -#define TK_NEXT 273 -#define TK_HAVING 274 -#define TK_RANGE 275 -#define TK_EVERY 276 -#define TK_ORDER 277 -#define TK_SLIMIT 278 -#define TK_SOFFSET 279 -#define TK_LIMIT 280 -#define TK_OFFSET 281 -#define TK_ASC 282 -#define TK_NULLS 283 -#define TK_ABORT 284 -#define TK_AFTER 285 -#define TK_ATTACH 286 -#define TK_BEFORE 287 -#define TK_BEGIN 288 -#define TK_BITAND 289 -#define TK_BITNOT 290 -#define TK_BITOR 291 -#define TK_BLOCKS 292 -#define TK_CHANGE 293 -#define TK_COMMA 294 -#define TK_CONCAT 295 -#define TK_CONFLICT 296 -#define TK_COPY 297 -#define TK_DEFERRED 298 -#define TK_DELIMITERS 299 -#define TK_DETACH 300 -#define TK_DIVIDE 301 -#define TK_DOT 302 -#define TK_EACH 303 -#define TK_FAIL 304 -#define TK_FILE 305 -#define TK_FOR 306 -#define TK_GLOB 307 -#define TK_ID 308 -#define TK_IMMEDIATE 309 -#define TK_IMPORT 310 -#define TK_INITIALLY 311 -#define TK_INSTEAD 312 -#define TK_ISNULL 313 -#define TK_KEY 314 -#define TK_MODULES 315 -#define TK_NK_BITNOT 316 -#define TK_NK_SEMI 317 -#define TK_NOTNULL 318 -#define TK_OF 319 -#define TK_PLUS 320 -#define TK_PRIVILEGE 321 -#define TK_RAISE 322 -#define TK_RESTRICT 323 -#define TK_ROW 324 -#define TK_SEMI 325 -#define TK_STAR 326 -#define TK_STATEMENT 327 -#define TK_STRICT 328 -#define TK_STRING 329 -#define TK_TIMES 330 -#define TK_VALUES 331 -#define TK_VARIABLE 332 -#define TK_VIEW 333 -#define TK_WAL 334 +#define TK_UNSAFE 55 +#define TK_LOCAL 56 +#define TK_QNODE 57 +#define TK_BNODE 58 +#define TK_SNODE 59 +#define TK_MNODE 60 +#define TK_VNODE 61 +#define TK_DATABASE 62 +#define TK_USE 63 +#define TK_FLUSH 64 +#define TK_TRIM 65 +#define TK_COMPACT 66 +#define TK_IF 67 +#define TK_NOT 68 +#define TK_EXISTS 69 +#define TK_BUFFER 70 +#define TK_CACHEMODEL 71 +#define TK_CACHESIZE 72 +#define TK_COMP 73 +#define TK_DURATION 74 +#define TK_NK_VARIABLE 75 +#define TK_MAXROWS 76 +#define TK_MINROWS 77 +#define TK_KEEP 78 +#define TK_PAGES 79 +#define TK_PAGESIZE 80 +#define TK_TSDB_PAGESIZE 81 +#define TK_PRECISION 82 +#define TK_REPLICA 83 +#define TK_VGROUPS 84 +#define TK_SINGLE_STABLE 85 +#define TK_RETENTIONS 86 +#define TK_SCHEMALESS 87 +#define TK_WAL_LEVEL 88 +#define TK_WAL_FSYNC_PERIOD 89 +#define TK_WAL_RETENTION_PERIOD 90 +#define TK_WAL_RETENTION_SIZE 91 +#define TK_WAL_ROLL_PERIOD 92 +#define TK_WAL_SEGMENT_SIZE 93 +#define TK_STT_TRIGGER 94 +#define TK_TABLE_PREFIX 95 +#define TK_TABLE_SUFFIX 96 +#define TK_NK_COLON 97 +#define TK_MAX_SPEED 98 +#define TK_START 99 +#define TK_TIMESTAMP 100 +#define TK_END 101 +#define TK_TABLE 102 +#define TK_NK_LP 103 +#define TK_NK_RP 104 +#define TK_STABLE 105 +#define TK_ADD 106 +#define TK_COLUMN 107 +#define TK_MODIFY 108 +#define TK_RENAME 109 +#define TK_TAG 110 +#define TK_SET 111 +#define TK_NK_EQ 112 +#define TK_USING 113 +#define TK_TAGS 114 +#define TK_BOOL 115 +#define TK_TINYINT 116 +#define TK_SMALLINT 117 +#define TK_INT 118 +#define TK_INTEGER 119 +#define TK_BIGINT 120 +#define TK_FLOAT 121 +#define TK_DOUBLE 122 +#define TK_BINARY 123 +#define TK_NCHAR 124 +#define TK_UNSIGNED 125 +#define TK_JSON 126 +#define TK_VARCHAR 127 +#define TK_MEDIUMBLOB 128 +#define TK_BLOB 129 +#define TK_VARBINARY 130 +#define TK_GEOMETRY 131 +#define TK_DECIMAL 132 +#define TK_COMMENT 133 +#define TK_MAX_DELAY 134 +#define TK_WATERMARK 135 +#define TK_ROLLUP 136 +#define TK_TTL 137 +#define TK_SMA 138 +#define TK_DELETE_MARK 139 +#define TK_FIRST 140 +#define TK_LAST 141 +#define TK_SHOW 142 +#define TK_PRIVILEGES 143 +#define TK_DATABASES 144 +#define TK_TABLES 145 +#define TK_STABLES 146 +#define TK_MNODES 147 +#define TK_QNODES 148 +#define TK_FUNCTIONS 149 +#define TK_INDEXES 150 +#define TK_ACCOUNTS 151 +#define TK_APPS 152 +#define TK_CONNECTIONS 153 +#define TK_LICENCES 154 +#define TK_GRANTS 155 +#define TK_QUERIES 156 +#define TK_SCORES 157 +#define TK_TOPICS 158 +#define TK_VARIABLES 159 +#define TK_CLUSTER 160 +#define TK_BNODES 161 +#define TK_SNODES 162 +#define TK_TRANSACTIONS 163 +#define TK_DISTRIBUTED 164 +#define TK_CONSUMERS 165 +#define TK_SUBSCRIPTIONS 166 +#define TK_VNODES 167 +#define TK_ALIVE 168 +#define TK_LIKE 169 +#define TK_TBNAME 170 +#define TK_QTAGS 171 +#define TK_AS 172 +#define TK_INDEX 173 +#define TK_FUNCTION 174 +#define TK_INTERVAL 175 +#define TK_COUNT 176 +#define TK_LAST_ROW 177 +#define TK_TOPIC 178 +#define TK_META 179 +#define TK_CONSUMER 180 +#define TK_GROUP 181 +#define TK_DESC 182 +#define TK_DESCRIBE 183 +#define TK_RESET 184 +#define TK_QUERY 185 +#define TK_CACHE 186 +#define TK_EXPLAIN 187 +#define TK_ANALYZE 188 +#define TK_VERBOSE 189 +#define TK_NK_BOOL 190 +#define TK_RATIO 191 +#define TK_NK_FLOAT 192 +#define TK_OUTPUTTYPE 193 +#define TK_AGGREGATE 194 +#define TK_BUFSIZE 195 +#define TK_LANGUAGE 196 +#define TK_REPLACE 197 +#define TK_STREAM 198 +#define TK_INTO 199 +#define TK_PAUSE 200 +#define TK_RESUME 201 +#define TK_TRIGGER 202 +#define TK_AT_ONCE 203 +#define TK_WINDOW_CLOSE 204 +#define TK_IGNORE 205 +#define TK_EXPIRED 206 +#define TK_FILL_HISTORY 207 +#define TK_UPDATE 208 +#define TK_SUBTABLE 209 +#define TK_UNTREATED 210 +#define TK_KILL 211 +#define TK_CONNECTION 212 +#define TK_TRANSACTION 213 +#define TK_BALANCE 214 +#define TK_VGROUP 215 +#define TK_LEADER 216 +#define TK_MERGE 217 +#define TK_REDISTRIBUTE 218 +#define TK_SPLIT 219 +#define TK_DELETE 220 +#define TK_INSERT 221 +#define TK_NULL 222 +#define TK_NK_QUESTION 223 +#define TK_NK_ARROW 224 +#define TK_ROWTS 225 +#define TK_QSTART 226 +#define TK_QEND 227 +#define TK_QDURATION 228 +#define TK_WSTART 229 +#define TK_WEND 230 +#define TK_WDURATION 231 +#define TK_IROWTS 232 +#define TK_ISFILLED 233 +#define TK_CAST 234 +#define TK_NOW 235 +#define TK_TODAY 236 +#define TK_TIMEZONE 237 +#define TK_CLIENT_VERSION 238 +#define TK_SERVER_VERSION 239 +#define TK_SERVER_STATUS 240 +#define TK_CURRENT_USER 241 +#define TK_CASE 242 +#define TK_WHEN 243 +#define TK_THEN 244 +#define TK_ELSE 245 +#define TK_BETWEEN 246 +#define TK_IS 247 +#define TK_NK_LT 248 +#define TK_NK_GT 249 +#define TK_NK_LE 250 +#define TK_NK_GE 251 +#define TK_NK_NE 252 +#define TK_MATCH 253 +#define TK_NMATCH 254 +#define TK_CONTAINS 255 +#define TK_IN 256 +#define TK_JOIN 257 +#define TK_INNER 258 +#define TK_SELECT 259 +#define TK_DISTINCT 260 +#define TK_WHERE 261 +#define TK_PARTITION 262 +#define TK_BY 263 +#define TK_SESSION 264 +#define TK_STATE_WINDOW 265 +#define TK_EVENT_WINDOW 266 +#define TK_SLIDING 267 +#define TK_FILL 268 +#define TK_VALUE 269 +#define TK_VALUE_F 270 +#define TK_NONE 271 +#define TK_PREV 272 +#define TK_NULL_F 273 +#define TK_LINEAR 274 +#define TK_NEXT 275 +#define TK_HAVING 276 +#define TK_RANGE 277 +#define TK_EVERY 278 +#define TK_ORDER 279 +#define TK_SLIMIT 280 +#define TK_SOFFSET 281 +#define TK_LIMIT 282 +#define TK_OFFSET 283 +#define TK_ASC 284 +#define TK_NULLS 285 +#define TK_ABORT 286 +#define TK_AFTER 287 +#define TK_ATTACH 288 +#define TK_BEFORE 289 +#define TK_BEGIN 290 +#define TK_BITAND 291 +#define TK_BITNOT 292 +#define TK_BITOR 293 +#define TK_BLOCKS 294 +#define TK_CHANGE 295 +#define TK_COMMA 296 +#define TK_CONCAT 297 +#define TK_CONFLICT 298 +#define TK_COPY 299 +#define TK_DEFERRED 300 +#define TK_DELIMITERS 301 +#define TK_DETACH 302 +#define TK_DIVIDE 303 +#define TK_DOT 304 +#define TK_EACH 305 +#define TK_FAIL 306 +#define TK_FILE 307 +#define TK_FOR 308 +#define TK_GLOB 309 +#define TK_ID 310 +#define TK_IMMEDIATE 311 +#define TK_IMPORT 312 +#define TK_INITIALLY 313 +#define TK_INSTEAD 314 +#define TK_ISNULL 315 +#define TK_KEY 316 +#define TK_MODULES 317 +#define TK_NK_BITNOT 318 +#define TK_NK_SEMI 319 +#define TK_NOTNULL 320 +#define TK_OF 321 +#define TK_PLUS 322 +#define TK_PRIVILEGE 323 +#define TK_RAISE 324 +#define TK_RESTRICT 325 +#define TK_ROW 326 +#define TK_SEMI 327 +#define TK_STAR 328 +#define TK_STATEMENT 329 +#define TK_STRICT 330 +#define TK_STRING 331 +#define TK_TIMES 332 +#define TK_VALUES 333 +#define TK_VARIABLE 334 +#define TK_VIEW 335 +#define TK_WAL 336 #define TK_NK_SPACE 600 diff --git a/include/common/ttypes.h b/include/common/ttypes.h index f8a85ee1b0..dd8033eb43 100644 --- a/include/common/ttypes.h +++ b/include/common/ttypes.h @@ -269,7 +269,7 @@ typedef struct { (IS_NUMERIC_TYPE(_t) || (_t) == (TSDB_DATA_TYPE_BOOL) || (_t) == (TSDB_DATA_TYPE_TIMESTAMP)) #define IS_VAR_DATA_TYPE(t) \ - (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR) || ((t) == TSDB_DATA_TYPE_JSON)) + (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR) || ((t) == TSDB_DATA_TYPE_JSON) || ((t) == TSDB_DATA_TYPE_GEOMETRY)) #define IS_STR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR)) #define IS_VALID_TINYINT(_t) ((_t) >= INT8_MIN && (_t) <= INT8_MAX) @@ -316,6 +316,8 @@ static FORCE_INLINE bool isNull(const void *val, int32_t type) { return *(uint32_t *)val == TSDB_DATA_UINT_NULL; case TSDB_DATA_TYPE_UBIGINT: return *(uint64_t *)val == TSDB_DATA_UBIGINT_NULL; + case TSDB_DATA_TYPE_GEOMETRY: + return varDataLen(val) == sizeof(int8_t) && *(uint8_t *)varDataVal(val) == TSDB_DATA_GEOMETRY_NULL; default: return false; diff --git a/include/libs/catalog/catalog.h b/include/libs/catalog/catalog.h index 9250bda592..9300deeb9a 100644 --- a/include/libs/catalog/catalog.h +++ b/include/libs/catalog/catalog.h @@ -214,7 +214,7 @@ int32_t catalogGetSTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, const int32_t catalogUpdateTableMeta(SCatalog* pCatalog, STableMetaRsp* rspMsg); -int32_t catalogUpdateTableMeta(SCatalog* pCatalog, STableMetaRsp* rspMsg); +int32_t catalogAsyncUpdateTableMeta(SCatalog* pCtg, STableMetaRsp* pMsg); int32_t catalogGetCachedTableMeta(SCatalog* pCtg, const SName* pTableName, STableMeta** pTableMeta); diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index f097a2b2df..f0c9cffd0f 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -158,6 +158,17 @@ typedef enum EFunctionType { FUNCTION_TYPE_STDDEV_PARTIAL, FUNCTION_TYPE_STDDEV_MERGE, + // geometry functions + FUNCTION_TYPE_GEOM_FROM_TEXT = 4250, + FUNCTION_TYPE_AS_TEXT, + FUNCTION_TYPE_MAKE_POINT, + FUNCTION_TYPE_INTERSECTS, + FUNCTION_TYPE_EQUALS, + FUNCTION_TYPE_TOUCHES, + FUNCTION_TYPE_COVERS, + FUNCTION_TYPE_CONTAINS, + FUNCTION_TYPE_CONTAINS_PROPERLY, + // user defined funcion FUNCTION_TYPE_UDF = 10000 } EFunctionType; diff --git a/include/libs/function/taosudf.h b/include/libs/function/taosudf.h index c825574fa6..995198bc9e 100644 --- a/include/libs/function/taosudf.h +++ b/include/libs/function/taosudf.h @@ -109,7 +109,7 @@ typedef uint16_t VarDataLenT; // maxVarDataLen: 65535 #define varDataLenByData(v) (*(VarDataLenT *)(((char *)(v)) - VARSTR_HEADER_SIZE)) #define varDataSetLen(v, _len) (((VarDataLenT *)(v))[0] = (VarDataLenT)(_len)) #define IS_VAR_DATA_TYPE(t) \ - (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR) || ((t) == TSDB_DATA_TYPE_JSON)) + (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR) || ((t) == TSDB_DATA_TYPE_JSON) || ((t) == TSDB_DATA_TYPE_GEOMETRY)) #define IS_STR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR)) static FORCE_INLINE char *udfColDataGetData(const SUdfColumn *pColumn, int32_t row) { diff --git a/include/libs/geometry/geomFunc.h b/include/libs/geometry/geomFunc.h new file mode 100644 index 0000000000..05627e71f5 --- /dev/null +++ b/include/libs/geometry/geomFunc.h @@ -0,0 +1,41 @@ +/* + * 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 . + */ + +#ifndef TDENGINE_GEOM_FUNC_H +#define TDENGINE_GEOM_FUNC_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "function.h" + +int32_t makePointFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); + +int32_t geomFromTextFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); +int32_t asTextFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); + +int32_t intersectsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); +int32_t equalsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); +int32_t touchesFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); +int32_t coversFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); +int32_t containsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); +int32_t containsProperlyFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); + +#ifdef __cplusplus +} +#endif + +#endif // TDENGINE_GEOM_FUNC_H diff --git a/include/libs/geometry/geosWrapper.h b/include/libs/geometry/geosWrapper.h new file mode 100644 index 0000000000..a5bc0cec17 --- /dev/null +++ b/include/libs/geometry/geosWrapper.h @@ -0,0 +1,60 @@ +/* + * 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 . + */ + +#ifndef TDENGINE_GEOS_WRAPPER_H +#define TDENGINE_GEOS_WRAPPER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include "os.h" + +#include "tgeosctx.h" + +void geosFreeBuffer(void *buffer); + +int32_t initCtxMakePoint(); +int32_t doMakePoint(double x, double y, unsigned char **outputGeom, size_t *size); + +int32_t initCtxGeomFromText(); +int32_t doGeomFromText(const char *inputWKT, unsigned char **outputGeom, size_t *size); + +int32_t initCtxAsText(); +int32_t doAsText(const unsigned char *inputGeom, size_t size, char **outputWKT); + +int32_t initCtxRelationFunc(); +int32_t doIntersects(const GEOSGeometry *geom1, const GEOSPreparedGeometry *preparedGeom1, const GEOSGeometry *geom2, + bool swapped, char *res); +int32_t doEquals(const GEOSGeometry *geom1, const GEOSPreparedGeometry *preparedGeom1, const GEOSGeometry *geom2, + bool swapped, char *res); +int32_t doTouches(const GEOSGeometry *geom1, const GEOSPreparedGeometry *preparedGeom1, const GEOSGeometry *geom2, + bool swapped, char *res); +int32_t doCovers(const GEOSGeometry *geom1, const GEOSPreparedGeometry *preparedGeom1, const GEOSGeometry *geom2, + bool swapped, char *res); +int32_t doContains(const GEOSGeometry *geom1, const GEOSPreparedGeometry *preparedGeom1, const GEOSGeometry *geom2, + bool swapped, char *res); +int32_t doContainsProperly(const GEOSGeometry *geom1, const GEOSPreparedGeometry *preparedGeom1, const GEOSGeometry *geom2, + bool swapped, char *res); + +int32_t readGeometry(const unsigned char *input, GEOSGeometry **outputGeom, const GEOSPreparedGeometry **outputPreparedGeom); +void destroyGeometry(GEOSGeometry **geom, const GEOSPreparedGeometry **preparedGeom); + +#ifdef __cplusplus +} +#endif + +#endif /*TDENGINE_GEOS_WRAPPER_H*/ diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index d899307d74..9e0cac066d 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -249,6 +249,7 @@ typedef struct SDropDnodeStmt { char fqdn[TSDB_FQDN_LEN]; int32_t port; bool force; + bool unsafe; } SDropDnodeStmt; typedef struct SAlterDnodeStmt { diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index 69aa315ec2..e4282c3f34 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -90,28 +90,23 @@ typedef struct STbVerInfo { int32_t tversion; } STbVerInfo; -/* - * ASSERT(sizeof(SCTableMeta) == 24) - * ASSERT(tableType == TSDB_CHILD_TABLE) - * The cached child table meta info. For each child table, 24 bytes are required to keep the essential table info. - */ +#pragma pack(push, 1) typedef struct SCTableMeta { - int32_t vgId : 24; - int8_t tableType; uint64_t uid; uint64_t suid; + int32_t vgId; + int8_t tableType; } SCTableMeta; +#pragma pack(pop) -/* - * Note that the first 24 bytes of STableMeta are identical to SCTableMeta, it is safe to cast a STableMeta to be a - * SCTableMeta. - */ + +#pragma pack(push, 1) typedef struct STableMeta { // BEGIN: KEEP THIS PART SAME WITH SCTableMeta - int32_t vgId : 24; - int8_t tableType; uint64_t uid; uint64_t suid; + int32_t vgId; + int8_t tableType; // END: KEEP THIS PART SAME WITH SCTableMeta // if the table is TSDB_CHILD_TABLE, the following information is acquired from the corresponding super table meta @@ -121,6 +116,7 @@ typedef struct STableMeta { STableComInfo tableInfo; SSchema schema[]; } STableMeta; +#pragma pack(pop) typedef struct SDBVgInfo { int32_t vgVersion; @@ -130,7 +126,7 @@ typedef struct SDBVgInfo { int32_t numOfTable; // DB's table num, unit is TSDB_TABLE_NUM_UNIT int64_t stateTs; SHashObj* vgHash; // key:vgId, value:SVgroupInfo - SArray* vgArray; + SArray* vgArray; // SVgroupInfo } SDBVgInfo; typedef struct SUseDbOutput { diff --git a/include/util/taoserror.h b/include/util/taoserror.h index a2cf0d0cac..636a5e63a7 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -446,6 +446,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_VND_NOT_CATCH_UP TAOS_DEF_ERROR_CODE(0, 0x0532) // internal #define TSDB_CODE_VND_ALREADY_IS_VOTER TAOS_DEF_ERROR_CODE(0, 0x0533) // internal #define TSDB_CODE_VND_DIR_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0534) +#define TSDB_CODE_VND_META_DATA_UNSAFE_DELETE TAOS_DEF_ERROR_CODE(0, 0x0535) // tsdb #define TSDB_CODE_TDB_INVALID_TABLE_ID TAOS_DEF_ERROR_CODE(0, 0x0600) diff --git a/include/util/tdef.h b/include/util/tdef.h index 427a49fd4e..0b0569e2d1 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -32,7 +32,7 @@ extern "C" { #define TD_VER_MAX UINT64_MAX // TODO: use the real max version from query handle // Bytes for each type. -extern const int32_t TYPE_BYTES[16]; +extern const int32_t TYPE_BYTES[17]; // TODO: replace and remove code below #define CHAR_BYTES sizeof(char) @@ -53,10 +53,11 @@ extern const int32_t TYPE_BYTES[16]; #define TSDB_DATA_BIGINT_NULL 0x8000000000000000LL #define TSDB_DATA_TIMESTAMP_NULL TSDB_DATA_BIGINT_NULL -#define TSDB_DATA_FLOAT_NULL 0x7FF00000 // it is an NAN -#define TSDB_DATA_DOUBLE_NULL 0x7FFFFF0000000000LL // an NAN -#define TSDB_DATA_NCHAR_NULL 0xFFFFFFFF -#define TSDB_DATA_BINARY_NULL 0xFF +#define TSDB_DATA_FLOAT_NULL 0x7FF00000 // it is an NAN +#define TSDB_DATA_DOUBLE_NULL 0x7FFFFF0000000000LL // an NAN +#define TSDB_DATA_NCHAR_NULL 0xFFFFFFFF +#define TSDB_DATA_BINARY_NULL 0xFF +#define TSDB_DATA_GEOMETRY_NULL 0xFF #define TSDB_DATA_UTINYINT_NULL 0xFF #define TSDB_DATA_USMALLINT_NULL 0xFFFF @@ -253,6 +254,7 @@ typedef enum ELogicConditionType { #define TSDB_IPv4ADDR_LEN 16 #define TSDB_FILENAME_LEN 128 #define TSDB_SHOW_SQL_LEN 2048 +#define TSDB_SHOW_SCHEMA_JSON_LEN TSDB_MAX_COLUMNS * 256 #define TSDB_SLOW_QUERY_SQL_LEN 512 #define TSDB_SHOW_SUBQUERY_LEN 1000 @@ -267,8 +269,8 @@ typedef enum ELogicConditionType { #define TSDB_DNODE_CONFIG_LEN 128 #define TSDB_DNODE_VALUE_LEN 256 -#define TSDB_ACTIVE_KEY_LEN 109 // history 109:? -#define TSDB_CONN_ACTIVE_KEY_LEN 257 // history 257:? +#define TSDB_ACTIVE_KEY_LEN 109 +#define TSDB_CONN_ACTIVE_KEY_LEN 255 #define TSDB_DEFAULT_PKT_SIZE 65480 // same as RPC_MAX_UDP_SIZE @@ -410,6 +412,8 @@ typedef enum ELogicConditionType { #define TSDB_MAX_FIELD_LEN 65519 // 16384:65519 #define TSDB_MAX_BINARY_LEN TSDB_MAX_FIELD_LEN // 16384-8:65519 #define TSDB_MAX_NCHAR_LEN TSDB_MAX_FIELD_LEN // 16384-8:65519 +#define TSDB_MAX_GEOMETRY_LEN TSDB_MAX_FIELD_LEN // 16384-8:65519 + #define PRIMARYKEY_TIMESTAMP_COL_ID 1 #define COL_REACH_END(colId, maxColId) ((colId) > (maxColId)) diff --git a/include/util/tgeosctx.h b/include/util/tgeosctx.h new file mode 100644 index 0000000000..b5ac5a9333 --- /dev/null +++ b/include/util/tgeosctx.h @@ -0,0 +1,44 @@ +/* + * 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 . + */ + +#ifndef _TD_UTIL_GEOS_CTX_H_ +#define _TD_UTIL_GEOS_CTX_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +typedef struct SGeosContext { + GEOSContextHandle_t handle; + + GEOSWKTReader *WKTReader; + GEOSWKTWriter *WKTWriter; + + GEOSWKBReader *WKBReader; + GEOSWKBWriter *WKBWriter; + + char errMsg[512]; +} SGeosContext; + +SGeosContext* getThreadLocalGeosCtx(); +void destroyThreadLocalGeosCtx(); + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_UTIL_GEOS_CTX_H_*/ diff --git a/packaging/docker/dockerbuild.sh b/packaging/docker/dockerbuild.sh index 4b6fc8576b..ee09854176 100755 --- a/packaging/docker/dockerbuild.sh +++ b/packaging/docker/dockerbuild.sh @@ -123,6 +123,16 @@ else echo "Unknown cpuType: ${cpuType}" exit 1 fi +# check the tdengine cloud base image existed or not +if [ "$cloudBuild" == "y" ]; then + CloudBase=$(docker images | grep tdengine/tdengine-cloud-base ||:) + if [[ "$CloudBase" == "" ]]; then + echo "Rebuild tdengine cloud base image..." + docker build --rm -f "${communityDir}/packaging/docker/DockerfileCloud.base" -t tdengine/tdengine-cloud-base "." --build-arg cpuType=${cpuTypeAlias} + else + echo "Already found tdengine cloud base image" + fi +fi docker build --rm -f "${Dockerfile}" --network=host -t tdengine/tdengine-${dockername}:${version} "." --build-arg pkgFile=${pkgFile} --build-arg dirName=${dirName} --build-arg cpuType=${cpuTypeAlias} if [ "$cloudBuild" != "y" ]; then diff --git a/packaging/tools/makeclient.sh b/packaging/tools/makeclient.sh index 28dc770755..c4b074f903 100755 --- a/packaging/tools/makeclient.sh +++ b/packaging/tools/makeclient.sh @@ -175,7 +175,7 @@ if [ "$pagMode" == "lite" ]; then fi chmod a+x ${install_dir}/install_client.sh -if [[ $productName == "TDengine" ]]; then +if [[ $productName == "TDengine" ]] && [ "$verMode" != "cloud" ]; then # Copy example code mkdir -p ${install_dir}/examples examples_dir="${top_dir}/examples" @@ -191,7 +191,7 @@ if [[ $productName == "TDengine" ]]; then mkdir -p ${install_dir}/examples/taosbenchmark-json && cp ${examples_dir}/../tools/taos-tools/example/* ${install_dir}/examples/taosbenchmark-json fi - if [ "$verMode" == "cluster" ] || [ "$verMode" == "cloud" ]; then + if [ "$verMode" == "cluster" ]; then # Copy connector connector_dir="${code_dir}/connector" mkdir -p ${install_dir}/connector diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index 3da005c405..2f1e803689 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -69,25 +69,30 @@ if [ "$pagMode" == "lite" ]; then bin_files="${build_dir}/bin/${serverName} ${build_dir}/bin/${clientName} ${script_dir}/remove.sh ${script_dir}/startPre.sh ${build_dir}/bin/taosBenchmark " taostools_bin_files="" else - - wget https://github.com/taosdata/grafanaplugin/releases/latest/download/TDinsight.sh -O ${build_dir}/bin/TDinsight.sh \ + if [ "$verMode" == "cloud" ]; then + taostools_bin_files=" ${build_dir}/bin/taosdump \ + ${build_dir}/bin/taosBenchmark" + else + wget https://github.com/taosdata/grafanaplugin/releases/latest/download/TDinsight.sh -O ${build_dir}/bin/TDinsight.sh \ && echo "TDinsight.sh downloaded!" \ || echo "failed to download TDinsight.sh" - # download TDinsight caches - orig_pwd=$(pwd) - tdinsight_caches="" - cd ${build_dir}/bin/ && \ - chmod +x TDinsight.sh - ./TDinsight.sh --download-only ||: -# tdinsight_caches=$(./TDinsight.sh --download-only | xargs -I printf "${build_dir}/bin/{} ") - cd $orig_pwd - echo "TDinsight caches: $tdinsight_caches" + # download TDinsight caches + orig_pwd=$(pwd) + tdinsight_caches="" + cd ${build_dir}/bin/ && \ + chmod +x TDinsight.sh + ./TDinsight.sh --download-only ||: + # tdinsight_caches=$(./TDinsight.sh --download-only | xargs -I printf "${build_dir}/bin/{} ") + cd $orig_pwd + echo "TDinsight caches: $tdinsight_caches" - taostools_bin_files=" ${build_dir}/bin/taosdump \ + taostools_bin_files=" ${build_dir}/bin/taosdump \ ${build_dir}/bin/taosBenchmark \ ${build_dir}/bin/TDinsight.sh \ ${build_dir}/bin/tdengine-datasource.zip \ ${build_dir}/bin/tdengine-datasource.zip.md5sum" + fi + [ -f ${build_dir}/bin/taosx ] && taosx_bin="${build_dir}/bin/taosx" explorer_bin_files=$(find ${build_dir}/bin/ -name '*-explorer') @@ -334,14 +339,14 @@ mkdir -p ${install_dir}/driver && cp ${lib_files} ${install_dir}/driver && echo [ -f ${wslib_files} ] && cp ${wslib_files} ${install_dir}/driver || : # Copy connector -if [ "$verMode" == "cluster" ] || [ "$verMode" == "cloud" ]; then +if [ "$verMode" == "cluster" ]; then connector_dir="${code_dir}/connector" mkdir -p ${install_dir}/connector if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then tmp_pwd=`pwd` cd ${install_dir}/connector if [ ! -d taos-connector-jdbc ];then - git clone -b 3.1.0 --depth=1 https://github.com/taosdata/taos-connector-jdbc.git ||: + git clone -b 3.2.1 --depth=1 https://github.com/taosdata/taos-connector-jdbc.git ||: fi cd taos-connector-jdbc mvn clean package -Dmaven.test.skip=true @@ -424,7 +429,7 @@ if [ "$exitcode" != "0" ]; then exit $exitcode fi -if [ -n "${taostools_bin_files}" ]; then +if [ -n "${taostools_bin_files}" ] && [ "$verMode" != "cloud" ]; then wget https://github.com/taosdata/grafanaplugin/releases/latest/download/TDinsight.sh -O ${taostools_install_dir}/bin/TDinsight.sh && echo "TDinsight.sh downloaded!"|| echo "failed to download TDinsight.sh" if [ "$osType" != "Darwin" ]; then tar -zcv -f "$(basename ${taostools_pkg_name}).tar.gz" "$(basename ${taostools_install_dir})" --remove-files || : diff --git a/source/client/inc/clientSml.h b/source/client/inc/clientSml.h index b20fc6f57a..f9cbffa748 100644 --- a/source/client/inc/clientSml.h +++ b/source/client/inc/clientSml.h @@ -232,9 +232,9 @@ int smlJsonParseObjFirst(char **start, SSmlLineInfo *element, int8_t * int smlJsonParseObj(char **start, SSmlLineInfo *element, int8_t *offset); //SArray *smlJsonParseTags(char *start, char *end); bool smlParseNumberOld(SSmlKv *kvVal, SSmlMsgBuf *msg); -void* nodeListGet(NodeList* list, const void *key, int32_t len, _equal_fn_sml fn); -int nodeListSet(NodeList** list, const void *key, int32_t len, void* value, _equal_fn_sml fn); -int nodeListSize(NodeList* list); +//void* nodeListGet(NodeList* list, const void *key, int32_t len, _equal_fn_sml fn); +//int nodeListSet(NodeList** list, const void *key, int32_t len, void* value, _equal_fn_sml fn); +//int nodeListSize(NodeList* list); bool smlDoubleToInt64OverFlow(double num); int32_t smlBuildInvalidDataMsg(SSmlMsgBuf *pBuf, const char *msg1, const char *msg2); bool smlParseNumber(SSmlKv *kvVal, SSmlMsgBuf *msg); diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 30a41afb65..045642c2c2 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -656,7 +656,7 @@ int taos_options_imp(TSDB_OPTION option, const char *str) { } else { tscInfo("set cfg:%s to %s", pItem->name, str); if (TSDB_OPTION_SHELL_ACTIVITY_TIMER == option || TSDB_OPTION_USE_ADAPTER == option) { - code = taosSetCfg(pCfg, pItem->name); + code = taosApplyLocalCfg(pCfg, pItem->name); } } diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index c96ea77a3f..2dddfec2bd 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -224,7 +224,7 @@ static int32_t hbProcessStbInfoRsp(void *value, int32_t valueLen, struct SCatalo return TSDB_CODE_TSC_INVALID_VALUE; } - catalogUpdateTableMeta(pCatalog, rsp); + catalogAsyncUpdateTableMeta(pCatalog, rsp); } } diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index f8eade1d7c..82177302c7 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -491,7 +491,8 @@ void setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t pResInfo->userFields[i].bytes = pSchema[i].bytes; pResInfo->userFields[i].type = pSchema[i].type; - if (pSchema[i].type == TSDB_DATA_TYPE_VARCHAR) { + if (pSchema[i].type == TSDB_DATA_TYPE_VARCHAR || + pSchema[i].type == TSDB_DATA_TYPE_GEOMETRY) { pResInfo->userFields[i].bytes -= VARSTR_HEADER_SIZE; } else if (pSchema[i].type == TSDB_DATA_TYPE_NCHAR || pSchema[i].type == TSDB_DATA_TYPE_JSON) { pResInfo->userFields[i].bytes = (pResInfo->userFields[i].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE; @@ -815,7 +816,7 @@ int32_t handleAlterTbExecRes(void* res, SCatalog* pCatalog) { } int32_t handleCreateTbExecRes(void* res, SCatalog* pCatalog) { - return catalogUpdateTableMeta(pCatalog, (STableMetaRsp*)res); + return catalogAsyncUpdateTableMeta(pCatalog, (STableMetaRsp*)res); } int32_t handleQueryExecRsp(SRequestObj* pRequest) { diff --git a/source/client/src/clientJniConnector.c b/source/client/src/clientJniConnector.c index b613354751..4ad2d4d51f 100644 --- a/source/client/src/clientJniConnector.c +++ b/source/client/src/clientJniConnector.c @@ -579,7 +579,8 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchRowImp(JNIEn dv = GET_DOUBLE_VAL(row[i]); (*env)->CallVoidMethod(env, rowobj, g_rowdataSetDoubleFp, i, (jdouble)dv); } break; - case TSDB_DATA_TYPE_BINARY: { + case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_GEOMETRY: { memcpy(tmp, row[i], length[i]); // handle the case that terminated does not exist (*env)->CallVoidMethod(env, rowobj, g_rowdataSetStringFp, i, (*env)->NewStringUTF(env, tmp)); diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 55337d4a0b..63a4e5d2e5 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -393,9 +393,10 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) } break; case TSDB_DATA_TYPE_BINARY: - case TSDB_DATA_TYPE_NCHAR: { + case TSDB_DATA_TYPE_NCHAR: + case TSDB_DATA_TYPE_GEOMETRY: { int32_t charLen = varDataLen((char *)row[i] - VARSTR_HEADER_SIZE); - if (fields[i].type == TSDB_DATA_TYPE_BINARY) { + if (fields[i].type == TSDB_DATA_TYPE_BINARY || fields[i].type == TSDB_DATA_TYPE_GEOMETRY) { if (ASSERT(charLen <= fields[i].bytes && charLen >= 0)) { tscError("taos_print_row error binary. charLen:%d, fields[i].bytes:%d", charLen, fields[i].bytes); } @@ -475,6 +476,8 @@ const char *taos_data_type(int type) { return "TSDB_DATA_TYPE_NCHAR"; case TSDB_DATA_TYPE_JSON: return "TSDB_DATA_TYPE_JSON"; + case TSDB_DATA_TYPE_GEOMETRY: + return "TSDB_DATA_TYPE_GEOMETRY"; case TSDB_DATA_TYPE_UTINYINT: return "TSDB_DATA_TYPE_UTINYINT"; case TSDB_DATA_TYPE_USMALLINT: diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 32f28e4563..cfc8ae9186 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -56,7 +56,7 @@ static char* buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* sch cJSON_AddItemToObject(column, "name", cname); cJSON* ctype = cJSON_CreateNumber(s->type); cJSON_AddItemToObject(column, "type", ctype); - if (s->type == TSDB_DATA_TYPE_BINARY) { + if (s->type == TSDB_DATA_TYPE_BINARY || s->type == TSDB_DATA_TYPE_GEOMETRY) { int32_t length = s->bytes - VARSTR_HEADER_SIZE; cJSON* cbytes = cJSON_CreateNumber(length); cJSON_AddItemToObject(column, "length", cbytes); @@ -77,7 +77,7 @@ static char* buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* sch cJSON_AddItemToObject(tag, "name", tname); cJSON* ttype = cJSON_CreateNumber(s->type); cJSON_AddItemToObject(tag, "type", ttype); - if (s->type == TSDB_DATA_TYPE_BINARY) { + if (s->type == TSDB_DATA_TYPE_BINARY || s->type == TSDB_DATA_TYPE_GEOMETRY) { int32_t length = s->bytes - VARSTR_HEADER_SIZE; cJSON* cbytes = cJSON_CreateNumber(length); cJSON_AddItemToObject(tag, "length", cbytes); @@ -130,7 +130,7 @@ static char* buildAlterSTableJson(void* alterData, int32_t alterDataLen) { cJSON* colType = cJSON_CreateNumber(field->type); cJSON_AddItemToObject(json, "colType", colType); - if (field->type == TSDB_DATA_TYPE_BINARY) { + if (field->type == TSDB_DATA_TYPE_BINARY || field->type == TSDB_DATA_TYPE_GEOMETRY) { int32_t length = field->bytes - VARSTR_HEADER_SIZE; cJSON* cbytes = cJSON_CreateNumber(length); cJSON_AddItemToObject(json, "colLength", cbytes); @@ -155,7 +155,7 @@ static char* buildAlterSTableJson(void* alterData, int32_t alterDataLen) { cJSON_AddItemToObject(json, "colName", colName); cJSON* colType = cJSON_CreateNumber(field->type); cJSON_AddItemToObject(json, "colType", colType); - if (field->type == TSDB_DATA_TYPE_BINARY) { + if (field->type == TSDB_DATA_TYPE_BINARY || field->type == TSDB_DATA_TYPE_GEOMETRY) { int32_t length = field->bytes - VARSTR_HEADER_SIZE; cJSON* cbytes = cJSON_CreateNumber(length); cJSON_AddItemToObject(json, "colLength", cbytes); @@ -457,7 +457,7 @@ static char* processAlterTable(SMqMetaRsp* metaRsp) { cJSON* colType = cJSON_CreateNumber(vAlterTbReq.type); cJSON_AddItemToObject(json, "colType", colType); - if (vAlterTbReq.type == TSDB_DATA_TYPE_BINARY) { + if (vAlterTbReq.type == TSDB_DATA_TYPE_BINARY || vAlterTbReq.type == TSDB_DATA_TYPE_GEOMETRY) { int32_t length = vAlterTbReq.bytes - VARSTR_HEADER_SIZE; cJSON* cbytes = cJSON_CreateNumber(length); cJSON_AddItemToObject(json, "colLength", cbytes); @@ -478,7 +478,7 @@ static char* processAlterTable(SMqMetaRsp* metaRsp) { cJSON_AddItemToObject(json, "colName", colName); cJSON* colType = cJSON_CreateNumber(vAlterTbReq.colModType); cJSON_AddItemToObject(json, "colType", colType); - if (vAlterTbReq.colModType == TSDB_DATA_TYPE_BINARY) { + if (vAlterTbReq.colModType == TSDB_DATA_TYPE_BINARY || vAlterTbReq.colModType == TSDB_DATA_TYPE_GEOMETRY) { int32_t length = vAlterTbReq.colModBytes - VARSTR_HEADER_SIZE; cJSON* cbytes = cJSON_CreateNumber(length); cJSON_AddItemToObject(json, "colLength", cbytes); diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 6170b0a056..97f72ce872 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -24,72 +24,91 @@ int64_t smlToMilli[3] = {3600000LL, 60000LL, 1000LL}; int64_t smlFactorNS[3] = {NANOSECOND_PER_MSEC, NANOSECOND_PER_USEC, 1}; int64_t smlFactorS[3] = {1000LL, 1000000LL, 1000000000LL}; -void *nodeListGet(NodeList *list, const void *key, int32_t len, _equal_fn_sml fn) { - NodeList *tmp = list; - while (tmp) { - if (fn == NULL) { - if (tmp->data.used && tmp->data.keyLen == len && memcmp(tmp->data.key, key, len) == 0) { - return tmp->data.value; - } - } else { - if (tmp->data.used && fn(tmp->data.key, key) == 0) { - return tmp->data.value; - } - } +//void *nodeListGet(NodeList *list, const void *key, int32_t len, _equal_fn_sml fn) { +// NodeList *tmp = list; +// while (tmp) { +// if (fn == NULL) { +// if (tmp->data.used && tmp->data.keyLen == len && memcmp(tmp->data.key, key, len) == 0) { +// return tmp->data.value; +// } +// } else { +// if (tmp->data.used && fn(tmp->data.key, key) == 0) { +// return tmp->data.value; +// } +// } +// +// tmp = tmp->next; +// } +// return NULL; +//} +// +//int nodeListSet(NodeList **list, const void *key, int32_t len, void *value, _equal_fn_sml fn) { +// NodeList *tmp = *list; +// while (tmp) { +// if (!tmp->data.used) break; +// if (fn == NULL) { +// if (tmp->data.keyLen == len && memcmp(tmp->data.key, key, len) == 0) { +// return -1; +// } +// } else { +// if (tmp->data.keyLen == len && fn(tmp->data.key, key) == 0) { +// return -1; +// } +// } +// +// tmp = tmp->next; +// } +// if (tmp) { +// tmp->data.key = key; +// tmp->data.keyLen = len; +// tmp->data.value = value; +// tmp->data.used = true; +// } else { +// NodeList *newNode = (NodeList *)taosMemoryCalloc(1, sizeof(NodeList)); +// if (newNode == NULL) { +// return -1; +// } +// newNode->data.key = key; +// newNode->data.keyLen = len; +// newNode->data.value = value; +// newNode->data.used = true; +// newNode->next = *list; +// *list = newNode; +// } +// return 0; +//} +// +//int nodeListSize(NodeList *list) { +// int cnt = 0; +// while (list) { +// if (list->data.used) +// cnt++; +// else +// break; +// list = list->next; +// } +// return cnt; +//} - tmp = tmp->next; - } - return NULL; -} - -int nodeListSet(NodeList **list, const void *key, int32_t len, void *value, _equal_fn_sml fn) { - NodeList *tmp = *list; - while (tmp) { - if (!tmp->data.used) break; - if (fn == NULL) { - if (tmp->data.keyLen == len && memcmp(tmp->data.key, key, len) == 0) { - return -1; - } - } else { - if (tmp->data.keyLen == len && fn(tmp->data.key, key) == 0) { - return -1; - } - } - - tmp = tmp->next; - } - if (tmp) { - tmp->data.key = key; - tmp->data.keyLen = len; - tmp->data.value = value; - tmp->data.used = true; +static int32_t smlCheckAuth(SSmlHandle *info, SRequestConnInfo* conn, const char* pTabName, AUTH_TYPE type){ + SUserAuthInfo pAuth = {0}; + snprintf(pAuth.user, sizeof(pAuth.user), "%s", info->taos->user); + if (NULL == pTabName) { + tNameSetDbName(&pAuth.tbName, info->taos->acctId, info->pRequest->pDb, strlen(info->pRequest->pDb)); } else { - NodeList *newNode = (NodeList *)taosMemoryCalloc(1, sizeof(NodeList)); - if (newNode == NULL) { - return -1; - } - newNode->data.key = key; - newNode->data.keyLen = len; - newNode->data.value = value; - newNode->data.used = true; - newNode->next = *list; - *list = newNode; + toName(info->taos->acctId, info->pRequest->pDb, pTabName, &pAuth.tbName); } - return 0; -} + pAuth.type = type; -int nodeListSize(NodeList *list) { - int cnt = 0; - while (list) { - if (list->data.used) - cnt++; - else - break; - list = list->next; - } - return cnt; -} + int32_t code = TSDB_CODE_SUCCESS; + SUserAuthRes authRes = {0}; + code = catalogChkAuth(info->pCatalog, conn, &pAuth, &authRes); + + + return (code == TSDB_CODE_SUCCESS) ? (authRes.pass ? TSDB_CODE_SUCCESS : TSDB_CODE_PAR_PERMISSION_DENIED) : code; + +} inline bool smlDoubleToInt64OverFlow(double num) { if (num >= (double)INT64_MAX || num <= (double)INT64_MIN) return true; return false; @@ -555,7 +574,7 @@ static int32_t smlGenerateSchemaAction(SSchema *colField, SHashObj *colHash, SSm return TSDB_CODE_SML_INVALID_DATA; } - if ((colField[*index].type == TSDB_DATA_TYPE_VARCHAR && + if (((colField[*index].type == TSDB_DATA_TYPE_VARCHAR || colField[*index].type == TSDB_DATA_TYPE_GEOMETRY) && (colField[*index].bytes - VARSTR_HEADER_SIZE) < kv->length) || (colField[*index].type == TSDB_DATA_TYPE_NCHAR && ((colField[*index].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE < kv->length))) { @@ -586,7 +605,7 @@ static int32_t smlFindNearestPowerOf2(int32_t length, uint8_t type) { } } - if (type == TSDB_DATA_TYPE_BINARY && result > TSDB_MAX_BINARY_LEN - VARSTR_HEADER_SIZE) { + if ((type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_GEOMETRY) && result > TSDB_MAX_BINARY_LEN - VARSTR_HEADER_SIZE) { result = TSDB_MAX_BINARY_LEN - VARSTR_HEADER_SIZE; } else if (type == TSDB_DATA_TYPE_NCHAR && result > (TSDB_MAX_NCHAR_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) { result = (TSDB_MAX_NCHAR_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE; @@ -594,7 +613,7 @@ static int32_t smlFindNearestPowerOf2(int32_t length, uint8_t type) { if (type == TSDB_DATA_TYPE_NCHAR) { result = result * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE; - } else if (type == TSDB_DATA_TYPE_BINARY) { + } else if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_GEOMETRY) { result = result + VARSTR_HEADER_SIZE; } return result; @@ -638,7 +657,7 @@ static int32_t smlCheckMeta(SSchema *schema, int32_t length, SArray *cols, bool } static int32_t getBytes(uint8_t type, int32_t length) { - if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR) { + if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_GEOMETRY) { return smlFindNearestPowerOf2(length, type); } else { return tDataTypes[type].bytes; @@ -813,6 +832,10 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { code = catalogGetSTableMeta(info->pCatalog, &conn, &pName, &pTableMeta); if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST || code == TSDB_CODE_MND_STB_NOT_EXIST) { + code = smlCheckAuth(info, &conn, NULL, AUTH_TYPE_WRITE); + if(code != TSDB_CODE_SUCCESS){ + goto end; + } uDebug("SML:0x%" PRIx64 " smlModifyDBSchemas create table:%s", info->id, pName.tname); SArray *pColumns = taosArrayInit(taosArrayGetSize(sTableData->cols), sizeof(SField)); SArray *pTags = taosArrayInit(taosArrayGetSize(sTableData->tags), sizeof(SField)); @@ -857,6 +880,10 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { goto end; } if (action != SCHEMA_ACTION_NULL) { + code = smlCheckAuth(info, &conn, pName.tname, AUTH_TYPE_WRITE); + if(code != TSDB_CODE_SUCCESS){ + goto end; + } uDebug("SML:0x%" PRIx64 " smlModifyDBSchemas change table tag, table:%s, action:%d", info->id, pName.tname, action); SArray *pColumns = @@ -927,6 +954,10 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { goto end; } if (action != SCHEMA_ACTION_NULL) { + code = smlCheckAuth(info, &conn, pName.tname, AUTH_TYPE_WRITE); + if(code != TSDB_CODE_SUCCESS){ + goto end; + } uDebug("SML:0x%" PRIx64 " smlModifyDBSchemas change table col, table:%s, action:%d", info->id, pName.tname, action); SArray *pColumns = @@ -1367,6 +1398,11 @@ static int32_t smlInsertData(SSmlHandle *info) { conn.requestObjRefId = info->pRequest->self; conn.mgmtEps = getEpSet_s(&info->taos->pAppInfo->mgmtEp); + code = smlCheckAuth(info, &conn, pName.tname, AUTH_TYPE_WRITE); + if(code != TSDB_CODE_SUCCESS){ + return code; + } + SVgroupInfo vg; code = catalogGetTableHashVgroup(info->pCatalog, &conn, &pName, &vg); if (code != TSDB_CODE_SUCCESS) { @@ -1586,9 +1622,7 @@ static int smlProcess(SSmlHandle *info, char *lines[], char *rawLine, char *rawL do { code = smlModifyDBSchemas(info); - if (code == 0 || code == TSDB_CODE_SML_INVALID_DATA || code == TSDB_CODE_PAR_TOO_MANY_COLUMNS - || code == TSDB_CODE_PAR_INVALID_TAGS_NUM || code == TSDB_CODE_PAR_INVALID_TAGS_LENGTH - || code == TSDB_CODE_PAR_INVALID_ROW_LENGTH || code == TSDB_CODE_MND_FIELD_VALUE_OVERFLOW) { + if (code != TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER && code != TSDB_CODE_SDB_OBJ_CREATING && code != TSDB_CODE_MND_TRANS_CONFLICT) { break; } taosMsleep(100); diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index c38e206a9b..aff5846092 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -2584,6 +2584,14 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a } } +void tmq_free_assignment(tmq_topic_assignment* pAssignment) { + if (pAssignment == NULL) { + return; + } + + taosMemoryFree(pAssignment); +} + int32_t tmq_offset_seek(tmq_t* tmq, const char* pTopicName, int32_t vgId, int64_t offset) { if (tmq == NULL) { tscError("invalid tmq handle, null"); diff --git a/source/common/src/systable.c b/source/common/src/systable.c index 062bae68c8..db0cc78de6 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -280,7 +280,9 @@ static const SSysDbTableSchema topicSchema[] = { {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false}, {.name = "sql", .bytes = TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false}, - // TODO config + {.name = "schema", .bytes = TSDB_SHOW_SCHEMA_JSON_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false}, + {.name = "meta", .bytes = 4 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false}, + {.name = "type", .bytes = 8 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY, .sysInfo = false}, }; diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index ff583baaa6..311c79381c 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -445,12 +445,11 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd size_t headerSize = sizeof(int32_t); size_t colHeaderSize = sizeof(int32_t) * numOfCols; - size_t payloadSize = pageSize - (headerSize + colHeaderSize); // TODO speedup by checking if the whole page can fit in firstly. if (!hasVarCol) { size_t rowSize = blockDataGetRowSize(pBlock); - int32_t capacity = payloadSize / (rowSize + numOfCols * bitmapChar / 8.0); + int32_t capacity = blockDataGetCapacityInRow(pBlock, pageSize, headerSize + colHeaderSize); if (capacity <= 0) { return TSDB_CODE_FAILED; } @@ -1532,10 +1531,10 @@ SColumnInfoData* bdGetColumnInfoData(const SSDataBlock* pBlock, int32_t index) { return taosArrayGet(pBlock->pDataBlock, index); } -size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize) { +size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize, int32_t extraSize) { size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); - int32_t payloadSize = pageSize - blockDataGetSerialMetaSize(numOfCols); + int32_t payloadSize = pageSize - extraSize; int32_t rowSize = pBlock->info.rowSize; int32_t nRows = payloadSize / rowSize; ASSERT(nRows >= 1); @@ -1928,7 +1927,8 @@ void blockDebugShowDataBlocks(const SArray* dataBlocks, const char* flag) { case TSDB_DATA_TYPE_DOUBLE: printf(" %15lf |", *(double*)var); break; - case TSDB_DATA_TYPE_VARCHAR: { + case TSDB_DATA_TYPE_VARCHAR: + case TSDB_DATA_TYPE_GEOMETRY: { char* pData = colDataGetVarData(pColInfoData, j); int32_t dataSize = TMIN(sizeof(pBuf) - 1, varDataLen(pData)); memset(pBuf, 0, dataSize + 1); @@ -1970,7 +1970,7 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf) if (len >= size - 1) return dumpBuf; for (int32_t j = 0; j < rows; j++) { - len += snprintf(dumpBuf + len, size - len, "%s %d|", flag, j); + len += snprintf(dumpBuf + len, size - len, "%s|", flag); if (len >= size - 1) return dumpBuf; for (int32_t k = 0; k < colNum; k++) { @@ -2033,7 +2033,8 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf) len += snprintf(dumpBuf + len, size - len, " %15d |", *(bool*)var); if (len >= size - 1) return dumpBuf; break; - case TSDB_DATA_TYPE_VARCHAR: { + case TSDB_DATA_TYPE_VARCHAR: + case TSDB_DATA_TYPE_GEOMETRY: { memset(pBuf, 0, sizeof(pBuf)); char* pData = colDataGetVarData(pColInfoData, j); int32_t dataSize = TMIN(sizeof(pBuf), varDataLen(pData)); @@ -2052,7 +2053,7 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf) } break; } } - len += snprintf(dumpBuf + len, size - len, "\n"); + len += snprintf(dumpBuf + len, size - len, "%d\n", j); if (len >= size - 1) return dumpBuf; } len += snprintf(dumpBuf + len, size - len, "%s |end\n", flag); @@ -2139,7 +2140,8 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SSDataBlock* pDataB } break; case TSDB_DATA_TYPE_NCHAR: - case TSDB_DATA_TYPE_VARCHAR: { // TSDB_DATA_TYPE_BINARY + case TSDB_DATA_TYPE_VARCHAR: // TSDB_DATA_TYPE_BINARY + case TSDB_DATA_TYPE_GEOMETRY: { if (colDataIsNull_s(pColInfoData, j)) { tdAppendColValToRow(&rb, PRIMARYKEY_TIMESTAMP_COL_ID + k, pColInfoData->info.type, TD_VTYPE_NULL, NULL, false, offset, k); diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 846ca44b83..f30557e4ef 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -1148,7 +1148,8 @@ static void debugPrintTagVal(int8_t type, const void *val, int32_t vlen, const c switch (type) { case TSDB_DATA_TYPE_JSON: case TSDB_DATA_TYPE_VARCHAR: - case TSDB_DATA_TYPE_NCHAR: { + case TSDB_DATA_TYPE_NCHAR: + case TSDB_DATA_TYPE_GEOMETRY: { char tmpVal[32] = {0}; strncpy(tmpVal, val, vlen > 31 ? 31 : vlen); printf("%s:%d type:%d vlen:%d, val:\"%s\"\n", tag, ln, (int32_t)type, vlen, tmpVal); @@ -3542,5 +3543,6 @@ void (*tColDataCalcSMA[])(SColData *pColData, int64_t *sum, int64_t *max, int64_ NULL, // TSDB_DATA_TYPE_VARBINARY NULL, // TSDB_DATA_TYPE_DECIMAL NULL, // TSDB_DATA_TYPE_BLOB - NULL // TSDB_DATA_TYPE_MEDIUMBLOB + NULL, // TSDB_DATA_TYPE_MEDIUMBLOB + NULL // TSDB_DATA_TYPE_GEOMETRY }; diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 237a52efe5..9ff297c5b4 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -117,12 +117,10 @@ int32_t tsRedirectFactor = 2; int32_t tsRedirectMaxPeriod = 1000; int32_t tsMaxRetryWaitTime = 10000; bool tsUseAdapter = false; +int32_t tsMetaCacheMaxSize = -1; // MB int32_t tsSlowLogThreshold = 3; // seconds int32_t tsSlowLogScope = SLOW_LOG_TYPE_ALL; - - - /* * denote if the server needs to compress response message at the application layer to client, including query rsp, * metricmeta rsp, and multi-meter query rsp message body. The client compress the submit message to server. @@ -351,6 +349,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) { if (cfgAddBool(pCfg, "useAdapter", tsUseAdapter, true) != 0) return -1; if (cfgAddBool(pCfg, "crashReporting", tsEnableCrashReport, true) != 0) return -1; if (cfgAddInt64(pCfg, "queryMaxConcurrentTables", tsQueryMaxConcurrentTables, INT64_MIN, INT64_MAX, 1) != 0) return -1; + if (cfgAddInt32(pCfg, "metaCacheMaxSize", tsMetaCacheMaxSize, -1, INT32_MAX, 1) != 0) return -1; if (cfgAddInt32(pCfg, "slowLogThreshold", tsSlowLogThreshold, 0, INT32_MAX, true) != 0) return -1; if (cfgAddString(pCfg, "slowLogScope", "", true) != 0) return -1; @@ -788,6 +787,7 @@ static int32_t taosSetClientCfg(SConfig *pCfg) { tsUseAdapter = cfgGetItem(pCfg, "useAdapter")->bval; tsEnableCrashReport = cfgGetItem(pCfg, "crashReporting")->bval; tsQueryMaxConcurrentTables = cfgGetItem(pCfg, "queryMaxConcurrentTables")->i64; + tsMetaCacheMaxSize = cfgGetItem(pCfg, "metaCacheMaxSize")->i32; tsSlowLogThreshold = cfgGetItem(pCfg, "slowLogThreshold")->i32; if (taosSetSlowLogScope(cfgGetItem(pCfg, "slowLogScope")->str)) { return -1; @@ -916,7 +916,7 @@ void taosLocalCfgForbiddenToChange(char *name, bool *forbidden) { *forbidden = false; } -int32_t taosSetCfg(SConfig *pCfg, char *name) { +int32_t taosApplyLocalCfg(SConfig *pCfg, char *name) { int32_t len = strlen(name); char lowcaseName[CFG_NAME_MAX_LEN + 1] = {0}; strntolower(lowcaseName, name, TMIN(CFG_NAME_MAX_LEN, len)); @@ -1051,6 +1051,12 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) { } break; } + case 'e': { + if (strcasecmp("metaCacheMaxSize", name) == 0) { + atomic_store_32(&tsMetaCacheMaxSize, cfgGetItem(pCfg, "metaCacheMaxSize")->i32); + } + break; + } case 'i': { if (strcasecmp("minimalTmpDirGB", name) == 0) { tsTempSpace.reserved = (int64_t)(((double)cfgGetItem(pCfg, "minimalTmpDirGB")->fval) * 1024 * 1024 * 1024); diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 22536590be..d7d393becc 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -1566,21 +1566,21 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs char db[TSDB_DB_FNAME_LEN] = {0}; if (tDecodeCStrTo(pDecoder, db) < 0) return -1; int32_t len = strlen(db); - taosHashPut(pRsp->createdDbs, db, len, db, len); + taosHashPut(pRsp->createdDbs, db, len, db, len + 1); } for (int32_t i = 0; i < numOfReadDbs; ++i) { char db[TSDB_DB_FNAME_LEN] = {0}; if (tDecodeCStrTo(pDecoder, db) < 0) return -1; int32_t len = strlen(db); - taosHashPut(pRsp->readDbs, db, len, db, len); + taosHashPut(pRsp->readDbs, db, len, db, len + 1); } for (int32_t i = 0; i < numOfWriteDbs; ++i) { char db[TSDB_DB_FNAME_LEN] = {0}; if (tDecodeCStrTo(pDecoder, db) < 0) return -1; int32_t len = strlen(db); - taosHashPut(pRsp->writeDbs, db, len, db, len); + taosHashPut(pRsp->writeDbs, db, len, db, len + 1); } if (!tDecodeIsEnd(pDecoder)) { @@ -1701,6 +1701,7 @@ int32_t tSerializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq) if (tEncodeCStr(&encoder, pReq->fqdn) < 0) return -1; if (tEncodeI32(&encoder, pReq->port) < 0) return -1; if (tEncodeI8(&encoder, pReq->force) < 0) return -1; + if (tEncodeI8(&encoder, pReq->unsafe) < 0) return -1; tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -1717,6 +1718,12 @@ int32_t tDeserializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq if (tDecodeCStrTo(&decoder, pReq->fqdn) < 0) return -1; if (tDecodeI32(&decoder, &pReq->port) < 0) return -1; if (tDecodeI8(&decoder, &pReq->force) < 0) return -1; + if (!tDecodeIsEnd(&decoder)) { + if (tDecodeI8(&decoder, &pReq->unsafe) < 0) return -1; + } else { + pReq->unsafe = false; + } + tEndDecode(&decoder); tDecoderClear(&decoder); @@ -3409,6 +3416,7 @@ int32_t tSerializeSTableIndexRsp(void *buf, int32_t bufLen, const STableIndexRsp if (tEncodeCStr(&encoder, pRsp->dbFName) < 0) return -1; if (tEncodeU64(&encoder, pRsp->suid) < 0) return -1; if (tEncodeI32(&encoder, pRsp->version) < 0) return -1; + if (tEncodeI32(&encoder, pRsp->indexSize) < 0) return -1; int32_t num = taosArrayGetSize(pRsp->pIndex); if (tEncodeI32(&encoder, num) < 0) return -1; if (num > 0) { @@ -3454,6 +3462,7 @@ int32_t tDeserializeSTableIndexRsp(void *buf, int32_t bufLen, STableIndexRsp *pR if (tDecodeCStrTo(&decoder, pRsp->dbFName) < 0) return -1; if (tDecodeU64(&decoder, &pRsp->suid) < 0) return -1; if (tDecodeI32(&decoder, &pRsp->version) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->indexSize) < 0) return -1; int32_t num = 0; if (tDecodeI32(&decoder, &num) < 0) return -1; if (num > 0) { @@ -3728,6 +3737,7 @@ int32_t tSerializeSSTbHbRsp(void *buf, int32_t bufLen, SSTbHbRsp *pRsp) { if (tEncodeCStr(&encoder, pIndexRsp->dbFName) < 0) return -1; if (tEncodeU64(&encoder, pIndexRsp->suid) < 0) return -1; if (tEncodeI32(&encoder, pIndexRsp->version) < 0) return -1; + if (tEncodeI32(&encoder, pIndexRsp->indexSize) < 0) return -1; int32_t num = taosArrayGetSize(pIndexRsp->pIndex); if (tEncodeI32(&encoder, num) < 0) return -1; for (int32_t i = 0; i < num; ++i) { @@ -3790,6 +3800,7 @@ int32_t tDeserializeSSTbHbRsp(void *buf, int32_t bufLen, SSTbHbRsp *pRsp) { if (tDecodeCStrTo(&decoder, tableIndexRsp.dbFName) < 0) return -1; if (tDecodeU64(&decoder, &tableIndexRsp.suid) < 0) return -1; if (tDecodeI32(&decoder, &tableIndexRsp.version) < 0) return -1; + if (tDecodeI32(&decoder, &tableIndexRsp.indexSize) < 0) return -1; int32_t num = 0; if (tDecodeI32(&decoder, &num) < 0) return -1; if (num > 0) { diff --git a/source/common/src/trow.c b/source/common/src/trow.c index 9d381ce15f..8ae77bcd0a 100644 --- a/source/common/src/trow.c +++ b/source/common/src/trow.c @@ -126,6 +126,9 @@ void tdSCellValPrint(SCellVal *pVal, int8_t colType) { case TSDB_DATA_TYPE_JSON: printf("JSON "); break; + case TSDB_DATA_TYPE_GEOMETRY: + printf("GEOMETRY "); + break; case TSDB_DATA_TYPE_VARBINARY: printf("VARBIN "); break; @@ -353,7 +356,7 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow) { } } else { varDataLen += sizeof(VarDataLenT); - if (pTColumn->type == TSDB_DATA_TYPE_VARCHAR) { + if (pTColumn->type == TSDB_DATA_TYPE_VARCHAR || pTColumn->type == TSDB_DATA_TYPE_GEOMETRY) { varDataLen += CHAR_BYTES; if (maxVarDataLen < CHAR_BYTES + sizeof(VarDataLenT)) { maxVarDataLen = CHAR_BYTES + sizeof(VarDataLenT); diff --git a/source/common/src/ttszip.c b/source/common/src/ttszip.c index f415bd20cd..aabbff6f04 100644 --- a/source/common/src/ttszip.c +++ b/source/common/src/ttszip.c @@ -296,7 +296,7 @@ static void writeDataToDisk(STSBuf* pTSBuf) { metaLen += (int32_t)taosWriteFile(pTSBuf->pFile, &pBlock->tag.nType, sizeof(pBlock->tag.nType)); int32_t trueLen = pBlock->tag.nLen; - if (pBlock->tag.nType == TSDB_DATA_TYPE_BINARY || pBlock->tag.nType == TSDB_DATA_TYPE_NCHAR) { + if (pBlock->tag.nType == TSDB_DATA_TYPE_BINARY || pBlock->tag.nType == TSDB_DATA_TYPE_NCHAR || pBlock->tag.nType == TSDB_DATA_TYPE_GEOMETRY) { metaLen += (int32_t)taosWriteFile(pTSBuf->pFile, &pBlock->tag.nLen, sizeof(pBlock->tag.nLen)); metaLen += (int32_t)taosWriteFile(pTSBuf->pFile, pBlock->tag.pz, (size_t)pBlock->tag.nLen); } else if (pBlock->tag.nType == TSDB_DATA_TYPE_FLOAT) { @@ -378,7 +378,7 @@ STSBlock* readDataFromDisk(STSBuf* pTSBuf, int32_t order, bool decomp) { // NOTE: mix types tags are not supported size_t sz = 0; - if (pBlock->tag.nType == TSDB_DATA_TYPE_BINARY || pBlock->tag.nType == TSDB_DATA_TYPE_NCHAR) { + if (pBlock->tag.nType == TSDB_DATA_TYPE_BINARY || pBlock->tag.nType == TSDB_DATA_TYPE_NCHAR || pBlock->tag.nType == TSDB_DATA_TYPE_GEOMETRY) { char* tp = taosMemoryRealloc(pBlock->tag.pz, pBlock->tag.nLen + 1); ASSERT(tp != NULL); diff --git a/source/common/src/ttypes.c b/source/common/src/ttypes.c index c83bdc0e32..33b972594e 100644 --- a/source/common/src/ttypes.c +++ b/source/common/src/ttypes.c @@ -17,7 +17,7 @@ #include "ttypes.h" #include "tcompression.h" -const int32_t TYPE_BYTES[16] = { +const int32_t TYPE_BYTES[17] = { -1, // TSDB_DATA_TYPE_NULL CHAR_BYTES, // TSDB_DATA_TYPE_BOOL CHAR_BYTES, // TSDB_DATA_TYPE_TINYINT @@ -34,6 +34,7 @@ const int32_t TYPE_BYTES[16] = { INT_BYTES, // TSDB_DATA_TYPE_UINT sizeof(uint64_t), // TSDB_DATA_TYPE_UBIGINT TSDB_MAX_JSON_TAG_LEN, // TSDB_DATA_TYPE_JSON + sizeof(VarDataOffsetT), // TSDB_DATA_TYPE_GEOMETRY }; tDataTypeDescriptor tDataTypes[TSDB_DATA_TYPE_MAX] = { @@ -56,6 +57,7 @@ tDataTypeDescriptor tDataTypes[TSDB_DATA_TYPE_MAX] = { {TSDB_DATA_TYPE_UINT, 12, INT_BYTES, "INT UNSIGNED", 0, UINT32_MAX, tsCompressInt, tsDecompressInt}, {TSDB_DATA_TYPE_UBIGINT, 15, LONG_BYTES, "BIGINT UNSIGNED", 0, UINT64_MAX, tsCompressBigint, tsDecompressBigint}, {TSDB_DATA_TYPE_JSON, 4, TSDB_MAX_JSON_TAG_LEN, "JSON", 0, 0, tsCompressString, tsDecompressString}, + {TSDB_DATA_TYPE_GEOMETRY, 8, 1, "GEOMETRY", 0, 0, tsCompressString, tsDecompressString}, }; static float floatMin = -FLT_MAX, floatMax = FLT_MAX; @@ -125,6 +127,7 @@ void assignVal(char *val, const char *src, int32_t len, int32_t type) { *((int64_t *)val) = GET_INT64_VAL(src); break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_GEOMETRY: varDataCopy(val, src); break; case TSDB_DATA_TYPE_NCHAR: diff --git a/source/common/src/tvariant.c b/source/common/src/tvariant.c index db69fe9d48..cb4a42eb10 100644 --- a/source/common/src/tvariant.c +++ b/source/common/src/tvariant.c @@ -121,7 +121,8 @@ void taosVariantCreateFromBinary(SVariant *pVar, const char *pz, size_t len, uin break; } - case TSDB_DATA_TYPE_BINARY: { // todo refactor, extract a method + case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_GEOMETRY: { // todo refactor, extract a method pVar->pz = taosMemoryCalloc(len + 1, sizeof(char)); memcpy(pVar->pz, pz, len); pVar->nLen = (int32_t)len; @@ -140,7 +141,7 @@ void taosVariantDestroy(SVariant *pVar) { if (pVar == NULL) return; if (pVar->nType == TSDB_DATA_TYPE_BINARY || pVar->nType == TSDB_DATA_TYPE_NCHAR || - pVar->nType == TSDB_DATA_TYPE_JSON) { + pVar->nType == TSDB_DATA_TYPE_JSON || pVar->nType == TSDB_DATA_TYPE_GEOMETRY) { taosMemoryFreeClear(pVar->pz); pVar->nLen = 0; } @@ -152,7 +153,7 @@ void taosVariantAssign(SVariant *pDst, const SVariant *pSrc) { pDst->nType = pSrc->nType; if (pSrc->nType == TSDB_DATA_TYPE_BINARY || pSrc->nType == TSDB_DATA_TYPE_NCHAR || - pSrc->nType == TSDB_DATA_TYPE_JSON) { + pSrc->nType == TSDB_DATA_TYPE_JSON || pSrc->nType == TSDB_DATA_TYPE_GEOMETRY) { int32_t len = pSrc->nLen + TSDB_NCHAR_SIZE; char *p = taosMemoryRealloc(pDst->pz, len); ASSERT(p); @@ -184,7 +185,7 @@ int32_t taosVariantCompare(const SVariant *p1, const SVariant *p2) { return 1; } - if (p1->nType == TSDB_DATA_TYPE_BINARY || p1->nType == TSDB_DATA_TYPE_NCHAR) { + if (p1->nType == TSDB_DATA_TYPE_BINARY || p1->nType == TSDB_DATA_TYPE_NCHAR || p1->nType == TSDB_DATA_TYPE_GEOMETRY) { if (p1->nLen == p2->nLen) { return memcmp(p1->pz, p2->pz, p1->nLen); } else { @@ -237,6 +238,7 @@ char *taosVariantGet(SVariant *pVar, int32_t type) { return (char *)&pVar->f; case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_JSON: + case TSDB_DATA_TYPE_GEOMETRY: return (char *)pVar->pz; case TSDB_DATA_TYPE_NCHAR: return (char *)pVar->ucs4; diff --git a/source/common/test/dataformatTest.cpp b/source/common/test/dataformatTest.cpp index 4f8652d02c..b1083e4590 100644 --- a/source/common/test/dataformatTest.cpp +++ b/source/common/test/dataformatTest.cpp @@ -235,7 +235,8 @@ int32_t debugPrintSColVal(SColVal *cv, int8_t type) { case TSDB_DATA_TYPE_DOUBLE: printf("%lf ", cv->value.d); break; - case TSDB_DATA_TYPE_VARCHAR: { + case TSDB_DATA_TYPE_VARCHAR: + case TSDB_DATA_TYPE_GEOMETRY: { char tv[15] = {0}; snprintf(tv, 15, "%s", cv->value.pData); printf("%s ", tv); @@ -337,7 +338,8 @@ static int32_t checkSColVal(const char *rawVal, SColVal *cv, int8_t type) { sscanf(rawVal, "%lf", &rawSVal.d); EXPECT_DOUBLE_EQ(cv->value.d, rawSVal.d); } break; - case TSDB_DATA_TYPE_VARCHAR: { + case TSDB_DATA_TYPE_VARCHAR: + case TSDB_DATA_TYPE_GEOMETRY: { EXPECT_STRCASEEQ(rawVal, (const char *)cv->value.pData); } break; case TSDB_DATA_TYPE_TIMESTAMP: { diff --git a/source/dnode/mnode/impl/inc/mndDb.h b/source/dnode/mnode/impl/inc/mndDb.h index 60d35ebe1d..5569a6ec9f 100644 --- a/source/dnode/mnode/impl/inc/mndDb.h +++ b/source/dnode/mnode/impl/inc/mndDb.h @@ -32,6 +32,7 @@ bool mndIsDbReady(SMnode *pMnode, SDbObj *pDb); SSdbRaw *mndDbActionEncode(SDbObj *pDb); const char *mndGetDbStr(const char *src); +const char *mndGetStableStr(const char *src); int32_t mndProcessCompactDbReq(SRpcMsg *pReq); diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index b14f7a9023..7d707f4cba 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -521,6 +521,7 @@ typedef struct { char* physicalPlan; SSchemaWrapper schema; int64_t stbUid; + char stbName[TSDB_TABLE_FNAME_LEN]; // forbid condition int64_t ntbUid; SArray* ntbColIds; diff --git a/source/dnode/mnode/impl/inc/mndStb.h b/source/dnode/mnode/impl/inc/mndStb.h index 66d0ed1d12..99af413539 100644 --- a/source/dnode/mnode/impl/inc/mndStb.h +++ b/source/dnode/mnode/impl/inc/mndStb.h @@ -47,6 +47,7 @@ int32_t mndAllocStbSchemas(const SStbObj *pOld, SStbObj *pNew); int32_t mndCheckColAndTagModifiable(SMnode *pMnode, const char *stbFullName, int64_t suid, col_id_t colId); void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb, int32_t *pContLen, void *alterOriData, int32_t alterOriDataLen); +int32_t mndSetForceDropCreateStbRedoActions(SMnode *pMnode, STrans *pTrans, SVgObj *pVgroup, SStbObj *pStb); #ifdef __cplusplus } diff --git a/source/dnode/mnode/impl/inc/mndVgroup.h b/source/dnode/mnode/impl/inc/mndVgroup.h index 2ece0da5eb..0cd1228f25 100644 --- a/source/dnode/mnode/impl/inc/mndVgroup.h +++ b/source/dnode/mnode/impl/inc/mndVgroup.h @@ -40,7 +40,7 @@ int32_t mndAddCreateVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *p int32_t mndAddAlterVnodeConfirmAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup); int32_t mndAddAlterVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, tmsg_t msgType); int32_t mndAddDropVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, SVnodeGid *pVgid, bool isRedo); -int32_t mndSetMoveVgroupsInfoToTrans(SMnode *, STrans *pTrans, int32_t dropDnodeId, bool force); +int32_t mndSetMoveVgroupsInfoToTrans(SMnode *, STrans *pTrans, int32_t dropDnodeId, bool force, bool unsafe); int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb, SDbObj *pNewDb, SVgObj *pVgroup, SArray *pArray); int32_t mndBuildCompactVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs, diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index e93b06fdea..a451ae9df5 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -1543,6 +1543,13 @@ const char *mndGetDbStr(const char *src) { return pos; } +const char *mndGetStableStr(const char *src) { + char *pos = strstr(src, TS_PATH_DELIMITER); + if (pos != NULL) ++pos; + if (pos == NULL) return src; + return mndGetDbStr(pos); +} + static int64_t getValOfDiffPrecision(int8_t unit, int64_t val) { int64_t v = 0; switch (unit) { diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index d4cbcaaacd..cee3b3c61d 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -44,6 +44,11 @@ static const char *offlineReason[] = { "unknown", }; +enum { + DND_ACTIVE_CODE, + DND_CONN_ACTIVE_CODE, +}; + static int32_t mndCreateDefaultDnode(SMnode *pMnode); static SSdbRaw *mndDnodeActionEncode(SDnodeObj *pDnode); static SSdbRow *mndDnodeActionDecode(SSdbRaw *pRaw); @@ -227,6 +232,14 @@ static int32_t mndDnodeActionDelete(SSdb *pSdb, SDnodeObj *pDnode) { static int32_t mndDnodeActionUpdate(SSdb *pSdb, SDnodeObj *pOld, SDnodeObj *pNew) { mTrace("dnode:%d, perform update action, old row:%p new row:%p", pOld->id, pOld, pNew); pOld->updateTime = pNew->updateTime; +#ifdef TD_ENTERPRISE + if (strncmp(pOld->active, pNew->active, TSDB_ACTIVE_KEY_LEN) != 0) { + strncpy(pOld->active, pNew->active, TSDB_ACTIVE_KEY_LEN); + } + if (strncmp(pOld->connActive, pNew->connActive, TSDB_CONN_ACTIVE_KEY_LEN) != 0) { + strncpy(pOld->connActive, pNew->connActive, TSDB_CONN_ACTIVE_KEY_LEN); + } +#endif return 0; } @@ -635,6 +648,69 @@ _OVER: return code; } +static int32_t mndConfigDnode(SMnode *pMnode, SRpcMsg *pReq, SMCfgDnodeReq *pCfgReq, int8_t action) { + SSdbRaw *pRaw = NULL; + STrans *pTrans = NULL; + SDnodeObj *pDnode = NULL; + bool cfgAll = pCfgReq->dnodeId == -1; + + SSdb *pSdb = pMnode->pSdb; + void *pIter = NULL; + while (1) { + if (cfgAll) { + pIter = sdbFetch(pSdb, SDB_DNODE, pIter, (void **)&pDnode); + if (pIter == NULL) break; + } else if(!(pDnode = mndAcquireDnode(pMnode, pCfgReq->dnodeId))) { + goto _OVER; + } + + if (!pTrans) { + pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "config-dnode"); + if (!pTrans) goto _OVER; + if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER; + } + + SDnodeObj tmpDnode = *pDnode; + if (action == DND_ACTIVE_CODE) { + strncpy(tmpDnode.active, pCfgReq->value, TSDB_ACTIVE_KEY_LEN); + } else if (action == DND_CONN_ACTIVE_CODE) { + strncpy(tmpDnode.connActive, pCfgReq->value, TSDB_CONN_ACTIVE_KEY_LEN); + } else { + terrno = TSDB_CODE_INVALID_CFG; + goto _OVER; + } + + pRaw = mndDnodeActionEncode(&tmpDnode); + if (pRaw == NULL || mndTransAppendCommitlog(pTrans, pRaw) != 0) goto _OVER; + (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY); + pRaw = NULL; + + mInfo("dnode:%d, config dnode, cfg:%d, app:%p config:%s value:%s", pDnode->id, pCfgReq->dnodeId, pReq->info.ahandle, + pCfgReq->config, pCfgReq->value); + + if (cfgAll) { + sdbRelease(pSdb, pDnode); + pDnode = NULL; + } else { + break; + } + } + + if (pTrans && mndTransPrepare(pMnode, pTrans) != 0) goto _OVER; + + terrno = 0; + +_OVER: + if (cfgAll) { + sdbRelease(pSdb, pDnode); + } else { + mndReleaseDnode(pMnode, pDnode); + } + mndTransDrop(pTrans); + sdbFreeRaw(pRaw); + return terrno; +} + static int32_t mndProcessDnodeListReq(SRpcMsg *pReq) { SMnode *pMnode = pReq->info.node; SSdb *pSdb = pMnode->pSdb; @@ -804,7 +880,7 @@ int32_t mndProcessRestoreDnodeReqImpl(SRpcMsg *pReq){ #endif static int32_t mndDropDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SMnodeObj *pMObj, SQnodeObj *pQObj, - SSnodeObj *pSObj, int32_t numOfVnodes, bool force) { + SSnodeObj *pSObj, int32_t numOfVnodes, bool force, bool unsafe) { int32_t code = -1; SSdbRaw *pRaw = NULL; STrans *pTrans = NULL; @@ -844,7 +920,7 @@ static int32_t mndDropDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SM if (numOfVnodes > 0) { mInfo("trans:%d, %d vnodes on dnode:%d will be dropped", pTrans->id, numOfVnodes, pDnode->id); - if (mndSetMoveVgroupsInfoToTrans(pMnode, pTrans, pDnode->id, force) != 0) goto _OVER; + if (mndSetMoveVgroupsInfoToTrans(pMnode, pTrans, pDnode->id, force, unsafe) != 0) goto _OVER; } if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER; @@ -871,11 +947,18 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) { goto _OVER; } - mInfo("dnode:%d, start to drop, ep:%s:%d", dropReq.dnodeId, dropReq.fqdn, dropReq.port); + mInfo("dnode:%d, start to drop, ep:%s:%d, force:%s, unsafe:%s", + dropReq.dnodeId, dropReq.fqdn, dropReq.port, dropReq.force?"true":"false", dropReq.unsafe?"true":"false"); if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_DROP_MNODE) != 0) { goto _OVER; } + bool force = dropReq.force; + if(dropReq.unsafe) + { + force = true; + } + pDnode = mndAcquireDnode(pMnode, dropReq.dnodeId); if (pDnode == NULL) { int32_t err = terrno; @@ -903,7 +986,7 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) { } int32_t numOfVnodes = mndGetVnodesNum(pMnode, pDnode->id); - if ((numOfVnodes > 0 || pMObj != NULL || pSObj != NULL || pQObj != NULL) && !dropReq.force) { + if ((numOfVnodes > 0 || pMObj != NULL || pSObj != NULL || pQObj != NULL) && !force) { if (!mndIsDnodeOnline(pDnode, taosGetTimestampMs())) { terrno = TSDB_CODE_DNODE_OFFLINE; mError("dnode:%d, failed to drop since %s, vnodes:%d mnode:%d qnode:%d snode:%d", pDnode->id, terrstr(), @@ -912,7 +995,7 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) { } } - code = mndDropDnode(pMnode, pReq, pDnode, pMObj, pQObj, pSObj, numOfVnodes, dropReq.force); + code = mndDropDnode(pMnode, pReq, pDnode, pMObj, pQObj, pSObj, numOfVnodes, force, dropReq.unsafe); if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; _OVER: @@ -970,6 +1053,34 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) { strcpy(dcfgReq.config, "monitor"); snprintf(dcfgReq.value, TSDB_DNODE_VALUE_LEN, "%d", flag); +#ifdef TD_ENTERPRISE + } else if (strncasecmp(cfgReq.config, "activeCode", 10) == 0 || strncasecmp(cfgReq.config, "cActiveCode", 11) == 0) { + int8_t opt = strncasecmp(cfgReq.config, "a", 1) == 0 ? DND_ACTIVE_CODE : DND_CONN_ACTIVE_CODE; + int8_t index = opt == DND_ACTIVE_CODE ? 10 : 11; + if (' ' != cfgReq.config[index] && 0 != cfgReq.config[index]) { + mError("dnode:%d, failed to config activeCode since invalid conf:%s", cfgReq.dnodeId, cfgReq.config); + terrno = TSDB_CODE_INVALID_CFG; + return -1; + } + int32_t vlen = strlen(cfgReq.value); + if (vlen > 0 && ((opt == DND_ACTIVE_CODE && vlen != (TSDB_ACTIVE_KEY_LEN - 1)) || + (opt == DND_CONN_ACTIVE_CODE && + (vlen > (TSDB_CONN_ACTIVE_KEY_LEN - 1) || vlen < (TSDB_ACTIVE_KEY_LEN - 1))))) { + mError("dnode:%d, failed to config activeCode since invalid vlen:%d. conf:%s, val:%s", cfgReq.dnodeId, vlen, + cfgReq.config, cfgReq.value); + terrno = TSDB_CODE_INVALID_OPTION; + return -1; + } + + strcpy(dcfgReq.config, opt == DND_ACTIVE_CODE ? "activeCode" : "cActiveCode"); + snprintf(dcfgReq.value, TSDB_DNODE_VALUE_LEN, "%s", cfgReq.value); + + if (mndConfigDnode(pMnode, pReq, &cfgReq, opt) != 0) { + mError("dnode:%d, failed to config activeCode since %s", cfgReq.dnodeId, terrstr()); + return -1; + } + return 0; +#endif } else { bool findOpt = false; for (int32_t d = 0; d < optionSize; ++d) { @@ -1023,7 +1134,7 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) { tSerializeSDCfgDnodeReq(pBuf, bufLen, &dcfgReq); mInfo("dnode:%d, send config req to dnode, app:%p config:%s value:%s", cfgReq.dnodeId, pReq->info.ahandle, dcfgReq.config, dcfgReq.value); - SRpcMsg rpcMsg = {.msgType = TDMT_DND_CONFIG_DNODE, .pCont = pBuf, .contLen = bufLen, .info = pReq->info}; + SRpcMsg rpcMsg = {.msgType = TDMT_DND_CONFIG_DNODE, .pCont = pBuf, .contLen = bufLen}; tmsgSendReq(&epSet, &rpcMsg); code = 0; } diff --git a/source/dnode/mnode/impl/src/mndDump.c b/source/dnode/mnode/impl/src/mndDump.c index a991bddda8..d57053bb5b 100644 --- a/source/dnode/mnode/impl/src/mndDump.c +++ b/source/dnode/mnode/impl/src/mndDump.c @@ -285,6 +285,7 @@ void dumpTopic(SSdb *pSdb, SJson *json) { tjsonAddStringToObject(item, "subType", i642str(pObj->subType)); tjsonAddStringToObject(item, "withMeta", i642str(pObj->withMeta)); tjsonAddStringToObject(item, "stbUid", i642str(pObj->stbUid)); + tjsonAddStringToObject(item, "stbName", mndGetStableStr(pObj->stbName)); tjsonAddStringToObject(item, "sqlLen", i642str(pObj->sqlLen)); tjsonAddStringToObject(item, "astLen", i642str(pObj->astLen)); tjsonAddStringToObject(item, "sqlLen", i642str(pObj->sqlLen)); diff --git a/source/dnode/mnode/impl/src/mndFunc.c b/source/dnode/mnode/impl/src/mndFunc.c index af9bedd220..4ffc7a20c2 100644 --- a/source/dnode/mnode/impl/src/mndFunc.c +++ b/source/dnode/mnode/impl/src/mndFunc.c @@ -562,7 +562,7 @@ static void *mnodeGenTypeStr(char *buf, int32_t buflen, uint8_t type, int32_t le return msg; } - if (type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_BINARY) { + if (type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_GEOMETRY) { int32_t bytes = len > 0 ? (int32_t)(len - VARSTR_HEADER_SIZE) : len; snprintf(buf, buflen - 1, "%s(%d)", tDataTypes[type].name, type == TSDB_DATA_TYPE_NCHAR ? bytes / 4 : bytes); diff --git a/source/dnode/mnode/impl/src/mndMnode.c b/source/dnode/mnode/impl/src/mndMnode.c index 19c3d59167..d0b10a5768 100644 --- a/source/dnode/mnode/impl/src/mndMnode.c +++ b/source/dnode/mnode/impl/src/mndMnode.c @@ -695,7 +695,7 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode if (totalMnodes == 2) { if (force) { mError("cant't force drop dnode, since a mnode on it and replica is 2"); - terrno = TSDB_CODE_DNODE_OFFLINE; + terrno = TSDB_CODE_MNODE_ONLY_TWO_MNODE; return -1; } mInfo("vgId:1, has %d mnodes, exec redo log first", totalMnodes); diff --git a/source/dnode/mnode/impl/src/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c index 3d654a23d8..42ad9e24d5 100644 --- a/source/dnode/mnode/impl/src/mndSma.c +++ b/source/dnode/mnode/impl/src/mndSma.c @@ -1114,6 +1114,7 @@ int32_t mndGetTableSma(SMnode *pMnode, char *tbFName, STableIndexRsp *rsp, bool return code; } + rsp->indexSize += sizeof(info) + pSma->exprLen + 1; *exist = true; sdbRelease(pSdb, pSma); diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index dff0ef261f..03616aaace 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -687,6 +687,31 @@ static int32_t mndSetCreateStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj return 0; } +int32_t mndSetForceDropCreateStbRedoActions(SMnode *pMnode, STrans *pTrans, SVgObj *pVgroup, SStbObj *pStb) { + SSdb *pSdb = pMnode->pSdb; + int32_t contLen; + + void *pReq = mndBuildVCreateStbReq(pMnode, pVgroup, pStb, &contLen, NULL, 0); + if (pReq == NULL) { + return -1; + } + + STransAction action = {0}; + action.mTraceId = pTrans->mTraceId; + action.epSet = mndGetVgroupEpset(pMnode, pVgroup); + action.pCont = pReq; + action.contLen = contLen; + action.msgType = TDMT_VND_CREATE_STB; + action.acceptableCode = TSDB_CODE_TDB_STB_ALREADY_EXIST; + action.retryCode = TSDB_CODE_TDB_STB_NOT_EXIST; + if (mndTransAppendRedoAction(pTrans, &action) != 0) { + taosMemoryFree(pReq); + return -1; + } + + return 0; +} + static int32_t mndSetCreateStbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb) { SSdb *pSdb = pMnode->pSdb; SVgObj *pVgroup = NULL; @@ -1448,7 +1473,7 @@ static int32_t mndAlterStbTagBytes(SMnode *pMnode, const SStbObj *pOld, SStbObj SSchema *pTag = pNew->pTags + tag; - if (!(pTag->type == TSDB_DATA_TYPE_BINARY || pTag->type == TSDB_DATA_TYPE_NCHAR)) { + if (!(pTag->type == TSDB_DATA_TYPE_BINARY || pTag->type == TSDB_DATA_TYPE_NCHAR || pTag->type == TSDB_DATA_TYPE_GEOMETRY)) { terrno = TSDB_CODE_MND_INVALID_STB_OPTION; return -1; } @@ -1568,7 +1593,7 @@ static int32_t mndAlterStbColumnBytes(SMnode *pMnode, const SStbObj *pOld, SStbO } SSchema *pCol = pNew->pColumns + col; - if (!(pCol->type == TSDB_DATA_TYPE_BINARY || pCol->type == TSDB_DATA_TYPE_NCHAR)) { + if (!(pCol->type == TSDB_DATA_TYPE_BINARY || pCol->type == TSDB_DATA_TYPE_NCHAR || pCol->type == TSDB_DATA_TYPE_GEOMETRY)) { terrno = TSDB_CODE_MND_INVALID_STB_OPTION; return -1; } diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c index f6da370916..95524c0323 100644 --- a/source/dnode/mnode/impl/src/mndTopic.c +++ b/source/dnode/mnode/impl/src/mndTopic.c @@ -109,6 +109,7 @@ SSdbRaw *mndTopicActionEncode(SMqTopicObj *pTopic) { SDB_SET_INT8(pRaw, dataPos, pTopic->withMeta, TOPIC_ENCODE_OVER); SDB_SET_INT64(pRaw, dataPos, pTopic->stbUid, TOPIC_ENCODE_OVER); + SDB_SET_BINARY(pRaw, dataPos, pTopic->stbName, TSDB_TABLE_FNAME_LEN, TOPIC_ENCODE_OVER); SDB_SET_INT32(pRaw, dataPos, pTopic->sqlLen, TOPIC_ENCODE_OVER); SDB_SET_BINARY(pRaw, dataPos, pTopic->sql, pTopic->sqlLen, TOPIC_ENCODE_OVER); SDB_SET_INT32(pRaw, dataPos, pTopic->astLen, TOPIC_ENCODE_OVER); @@ -196,6 +197,7 @@ SSdbRow *mndTopicActionDecode(SSdbRaw *pRaw) { SDB_GET_INT8(pRaw, dataPos, &pTopic->withMeta, TOPIC_DECODE_OVER); SDB_GET_INT64(pRaw, dataPos, &pTopic->stbUid, TOPIC_DECODE_OVER); + SDB_GET_BINARY(pRaw, dataPos, pTopic->stbName, TSDB_TABLE_FNAME_LEN, TOPIC_DECODE_OVER); SDB_GET_INT32(pRaw, dataPos, &pTopic->sqlLen, TOPIC_DECODE_OVER); pTopic->sql = taosMemoryCalloc(pTopic->sqlLen, sizeof(char)); if (pTopic->sql == NULL) { @@ -460,6 +462,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq * return -1; } + strcpy(topicObj.stbName, pCreate->subStbName); topicObj.stbUid = pStb->uid; mndReleaseStb(pMnode, pStb); } @@ -830,6 +833,43 @@ int32_t mndGetNumOfTopics(SMnode *pMnode, char *dbName, int32_t *pNumOfTopics) { return 0; } +static void schemaToJson(SSchema *schema, int32_t nCols, char *schemaJson){ + char* string = NULL; + cJSON* columns = cJSON_CreateArray(); + if (columns == NULL) { + return; + } + for (int i = 0; i < nCols; i++) { + cJSON* column = cJSON_CreateObject(); + SSchema* s = schema + i; + cJSON* cname = cJSON_CreateString(s->name); + cJSON_AddItemToObject(column, "name", cname); + cJSON* ctype = cJSON_CreateString(tDataTypes[s->type].name); + cJSON_AddItemToObject(column, "type", ctype); + int32_t length = 0; + if (s->type == TSDB_DATA_TYPE_BINARY) { + length = s->bytes - VARSTR_HEADER_SIZE; + } else if (s->type == TSDB_DATA_TYPE_NCHAR || s->type == TSDB_DATA_TYPE_JSON) { + length = (s->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE; + } else{ + length = s->bytes; + } + cJSON* cbytes = cJSON_CreateNumber(length); + cJSON_AddItemToObject(column, "length", cbytes); + cJSON_AddItemToArray(columns, column); + } + string = cJSON_PrintUnformatted(columns); + cJSON_Delete(columns); + + size_t len = strlen(string); + if(string && len <= TSDB_SHOW_SCHEMA_JSON_LEN){ + STR_TO_VARSTR(schemaJson, string); + }else{ + mError("mndRetrieveTopic build schema error json:%p, json len:%zu", string, len); + } + taosMemoryFree(string); +} + static int32_t mndRetrieveTopic(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rowsCapacity) { SMnode *pMnode = pReq->info.node; SSdb *pSdb = pMnode->pSdb; @@ -868,6 +908,49 @@ static int32_t mndRetrieveTopic(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)sql, false); + char *schemaJson = taosMemoryMalloc(TSDB_SHOW_SCHEMA_JSON_LEN + VARSTR_HEADER_SIZE); + if(pTopic->subType == TOPIC_SUB_TYPE__COLUMN){ + schemaToJson(pTopic->schema.pSchema, pTopic->schema.nCols, schemaJson); + }else if(pTopic->subType == TOPIC_SUB_TYPE__TABLE){ + SStbObj *pStb = mndAcquireStb(pMnode, pTopic->stbName); + if (pStb == NULL) { + terrno = TSDB_CODE_MND_STB_NOT_EXIST; + taosMemoryFree(schemaJson); + return -1; + } + schemaToJson(pStb->pColumns, pStb->numOfColumns, schemaJson); + + mndReleaseStb(pMnode, pStb); + }else{ + STR_TO_VARSTR(schemaJson, "NULL"); + } + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)schemaJson, false); + taosMemoryFree(schemaJson); + + char mete[4 + VARSTR_HEADER_SIZE] = {0}; + if(pTopic->withMeta){ + STR_TO_VARSTR(mete, "yes"); + }else{ + STR_TO_VARSTR(mete, "no"); + } + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)mete, false); + + char type[8 + VARSTR_HEADER_SIZE] = {0}; + if(pTopic->subType == TOPIC_SUB_TYPE__COLUMN){ + STR_TO_VARSTR(type, "column"); + }else if(pTopic->subType == TOPIC_SUB_TYPE__TABLE){ + STR_TO_VARSTR(type, "stable"); + }else{ + STR_TO_VARSTR(type, "db"); + } + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)type, false); + numOfRows++; sdbRelease(pSdb, pTopic); } diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index a8e9db28e9..b7a6378bd8 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -23,6 +23,7 @@ #include "mndTrans.h" #include "mndUser.h" #include "tmisce.h" +#include "mndStb.h" #define VGROUP_VER_NUMBER 1 #define VGROUP_RESERVE_SIZE 64 @@ -1378,7 +1379,7 @@ int32_t mndAddDropVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgOb } int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int32_t vnIndex, - SArray *pArray, bool force) { + SArray *pArray, bool force, bool unsafe) { SVgObj newVg = {0}; memcpy(&newVg, pVgroup, sizeof(SVgObj)); @@ -1455,7 +1456,7 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, mInfo("vgId:%d, will add 1 vnode and force remove 1 vnode", pVgroup->vgId); if (mndAddVnodeToVgroup(pMnode, pTrans, &newVg, pArray) != 0) return -1; newVg.replica--; - SVnodeGid del = newVg.vnodeGid[vnIndex]; + //SVnodeGid del = newVg.vnodeGid[vnIndex]; newVg.vnodeGid[vnIndex] = newVg.vnodeGid[newVg.replica]; memset(&newVg.vnodeGid[newVg.replica], 0, sizeof(SVnodeGid)); { @@ -1476,7 +1477,31 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, &newVg, &newVg.vnodeGid[vnIndex]) != 0) return -1; if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg) != 0) return -1; - if (newVg.replica == 1) { + if(newVg.replica == 1){ + if(force && !unsafe){ + terrno = TSDB_CODE_VND_META_DATA_UNSAFE_DELETE; + return -1; + } + + SSdb *pSdb = pMnode->pSdb; + void *pIter = NULL; + + while (1) { + SStbObj *pStb = NULL; + pIter = sdbFetch(pSdb, SDB_STB, pIter, (void **)&pStb); + if (pIter == NULL) break; + + if (strcmp(pStb->db, pDb->name) == 0) { + if (mndSetForceDropCreateStbRedoActions(pMnode, pTrans, &newVg, pStb) != 0) { + sdbCancelFetch(pSdb, pIter); + sdbRelease(pSdb, pStb); + return -1; + } + } + + sdbRelease(pSdb, pStb); + } + mInfo("vgId:%d, all data is dropped since replica=1", pVgroup->vgId); } } @@ -1498,7 +1523,7 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, return 0; } -int32_t mndSetMoveVgroupsInfoToTrans(SMnode *pMnode, STrans *pTrans, int32_t delDnodeId, bool force) { +int32_t mndSetMoveVgroupsInfoToTrans(SMnode *pMnode, STrans *pTrans, int32_t delDnodeId, bool force, bool unsafe) { int32_t code = 0; SArray *pArray = mndBuildDnodesArray(pMnode, delDnodeId); if (pArray == NULL) return -1; @@ -1521,7 +1546,7 @@ int32_t mndSetMoveVgroupsInfoToTrans(SMnode *pMnode, STrans *pTrans, int32_t del if (vnIndex != -1) { mInfo("vgId:%d, vnode:%d will be removed from dnode:%d, force:%d", pVgroup->vgId, vnIndex, delDnodeId, force); SDbObj *pDb = mndAcquireDb(pMnode, pVgroup->dbName); - code = mndSetMoveVgroupInfoToTrans(pMnode, pTrans, pDb, pVgroup, vnIndex, pArray, force); + code = mndSetMoveVgroupInfoToTrans(pMnode, pTrans, pDb, pVgroup, vnIndex, pArray, force, unsafe); mndReleaseDb(pMnode, pDb); } @@ -2092,27 +2117,32 @@ int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb mInfo("db:%s, vgId:%d, will add 2 vnodes, vn:0 dnode:%d", pVgroup->dbName, pVgroup->vgId, pVgroup->vnodeGid[0].dnodeId); - //add first + //add second if (mndAddVnodeToVgroup(pMnode, pTrans, &newVgroup, pArray) != 0) return -1; + //learner stage newVgroup.vnodeGid[0].nodeRole = TAOS_SYNC_ROLE_VOTER; newVgroup.vnodeGid[1].nodeRole = TAOS_SYNC_ROLE_LEARNER; if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pNewDb, &newVgroup, newVgroup.vnodeGid[0].dnodeId) != 0) return -1; if (mndAddCreateVnodeAction(pMnode, pTrans, pNewDb, &newVgroup, &newVgroup.vnodeGid[1]) != 0) return -1; + + //follower stage newVgroup.vnodeGid[1].nodeRole = TAOS_SYNC_ROLE_VOTER; if (mndAddAlterVnodeTypeAction(pMnode, pTrans, pNewDb, &newVgroup, newVgroup.vnodeGid[1].dnodeId) != 0) return -1; + if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pNewDb, &newVgroup, newVgroup.vnodeGid[0].dnodeId) != 0) + return -1; if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pNewDb, &newVgroup) != 0) return -1; - //add second + //add third if (mndAddVnodeToVgroup(pMnode, pTrans, &newVgroup, pArray) != 0) return -1; + newVgroup.vnodeGid[0].nodeRole = TAOS_SYNC_ROLE_VOTER; newVgroup.vnodeGid[1].nodeRole = TAOS_SYNC_ROLE_VOTER; newVgroup.vnodeGid[2].nodeRole = TAOS_SYNC_ROLE_VOTER; - if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pNewDb, &newVgroup, newVgroup.vnodeGid[0].dnodeId) != 0) return -1; if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pNewDb, &newVgroup, newVgroup.vnodeGid[1].dnodeId) != 0) diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index 4bd16cf14f..faf550ab75 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -305,10 +305,6 @@ void tsdbUntakeReadSnap(STsdbReader *pReader, STsdbReadSnap *pSnap, bool proa // tsdbMerge.c ============================================================================================== int32_t tsdbMerge(STsdb *pTsdb); -#define TSDB_CACHE_NO(c) ((c).cacheLast == 0) -#define TSDB_CACHE_LAST_ROW(c) (((c).cacheLast & 1) > 0) -#define TSDB_CACHE_LAST(c) (((c).cacheLast & 2) > 0) - // tsdbDiskData ============================================================================================== int32_t tDiskDataBuilderCreate(SDiskDataBuilder **ppBuilder); void *tDiskDataBuilderDestroy(SDiskDataBuilder *pBuilder); @@ -346,13 +342,18 @@ struct STsdbFS { }; typedef struct { - rocksdb_t *db; - rocksdb_options_t *options; - rocksdb_flushoptions_t *flushoptions; - rocksdb_writeoptions_t *writeoptions; - rocksdb_readoptions_t *readoptions; - rocksdb_writebatch_t *writebatch; - TdThreadMutex rMutex; + rocksdb_t *db; + rocksdb_comparator_t *my_comparator; + rocksdb_cache_t *blockcache; + rocksdb_block_based_table_options_t *tableoptions; + rocksdb_options_t *options; + rocksdb_flushoptions_t *flushoptions; + rocksdb_writeoptions_t *writeoptions; + rocksdb_readoptions_t *readoptions; + rocksdb_writebatch_t *writebatch; + rocksdb_writebatch_t *rwritebatch; + TdThreadMutex rMutex; + STSchema *pTSchema; } SRocksCache; struct STsdb { @@ -782,7 +783,7 @@ typedef struct SLDataIter { #define tMergeTreeGetRow(_t) (&((_t)->pIter->rInfo.row)) int32_t tMergeTreeOpen(SMergeTree *pMTree, int8_t backward, SDataFReader *pFReader, uint64_t suid, uint64_t uid, STimeWindow *pTimeWindow, SVersionRange *pVerRange, SSttBlockLoadInfo *pBlockLoadInfo, - bool destroyLoadInfo, const char *idStr, bool strictTimeRange, SLDataIter* pLDataIter); + bool destroyLoadInfo, const char *idStr, bool strictTimeRange, SLDataIter *pLDataIter); void tMergeTreeAddIter(SMergeTree *pMTree, SLDataIter *pIter); bool tMergeTreeNext(SMergeTree *pMTree); bool tMergeTreeIgnoreEarlierTs(SMergeTree *pMTree); @@ -822,13 +823,15 @@ typedef struct SCacheRowsReader { typedef struct { TSKEY ts; + int8_t dirty; SColVal colVal; } SLastCol; int32_t tsdbOpenCache(STsdb *pTsdb); void tsdbCloseCache(STsdb *pTsdb); int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *row); -int32_t tsdbCacheGet(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCacheRowsReader *pr, int32_t ltype); +int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCacheRowsReader *pr, int8_t ltype); +int32_t tsdbCacheGet(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCacheRowsReader *pr, int8_t ltype); int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKEY eKey); int32_t tsdbCacheInsertLast(SLRUCache *pCache, tb_uid_t uid, TSDBROW *row, STsdb *pTsdb); diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index 735ff1700c..3f79fe5fd1 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -199,7 +199,7 @@ void tqClose(STQ*); int tqPushMsg(STQ*, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver); int tqRegisterPushHandle(STQ* pTq, void* handle, SRpcMsg* pMsg); int tqUnregisterPushHandle(STQ* pTq, void* pHandle); -int tqStartStreamTasks(STQ* pTq); // restore all stream tasks after vnode launching completed. +int tqStartStreamTasks(STQ* pTq); // restore all stream tasks after vnode launching completed. int tqCommit(STQ*); int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd); @@ -405,6 +405,10 @@ struct SVnode { #define VND_IS_RSMA(v) ((v)->config.isRsma == 1) #define VND_IS_TSMA(v) ((v)->config.isTsma == 1) +#define TSDB_CACHE_NO(c) ((c).cacheLast == 0) +#define TSDB_CACHE_LAST_ROW(c) (((c).cacheLast & 1) > 0) +#define TSDB_CACHE_LAST(c) (((c).cacheLast & 2) > 0) + struct STbUidStore { tb_uid_t suid; SArray* tbUids; diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index d98fbab192..9025c16612 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -1226,6 +1226,9 @@ int32_t tqProcessTaskRunReq(STQ* pTq, SRpcMsg* pMsg) { pTask->id.idStr, pTask->chkInfo.version); streamProcessRunReq(pTask); } else { + if (streamTaskShouldPause(&pTask->status)) { + atomic_val_compare_exchange_8(&pTask->status.schedStatus, TASK_SCHED_STATUS__WAITING, TASK_SCHED_STATUS__INACTIVE); + } tqDebug("vgId:%d s-task:%s ignore run req since not in ready state", vgId, pTask->id.idStr); } @@ -1300,22 +1303,22 @@ int32_t tqProcessTaskResumeReq(STQ* pTq, int64_t sversion, char* msg, int32_t ms atomic_store_8(&pTask->status.taskStatus, pTask->status.keepTaskStatus); // no lock needs to secure the access of the version - if (pReq->igUntreated) { // discard all the data when the stream task is suspended. + if (pReq->igUntreated && pTask->taskLevel == TASK_LEVEL__SOURCE) { // discard all the data when the stream task is suspended. pTask->chkInfo.currentVer = sversion; walReaderSeekVer(pTask->exec.pWalReader, sversion); - tqDebug("vgId:%d s-task:%s resume to normal from the latest version:%" PRId64 ", vnode ver:%" PRId64, pTq->pStreamMeta->vgId, - pTask->id.idStr, pTask->chkInfo.currentVer, sversion); + tqDebug("vgId:%d s-task:%s resume to normal from the latest version:%" PRId64 ", vnode ver:%" PRId64 ", schedStatus:%d", pTq->pStreamMeta->vgId, + pTask->id.idStr, pTask->chkInfo.currentVer, sversion, pTask->status.schedStatus); } else { // from the previous paused version and go on - tqDebug("vgId:%d s-task:%s resume to normal from paused ver:%" PRId64 ", vnode ver:%" PRId64, pTq->pStreamMeta->vgId, - pTask->id.idStr, pTask->chkInfo.currentVer, sversion); + tqDebug("vgId:%d s-task:%s resume to normal from paused ver:%" PRId64 ", vnode ver:%" PRId64 ", schedStatus:%d", pTq->pStreamMeta->vgId, + pTask->id.idStr, pTask->chkInfo.currentVer, sversion, pTask->status.schedStatus); } - streamMetaReleaseTask(pTq->pStreamMeta, pTask); - if (pTask->taskLevel == TASK_LEVEL__SOURCE) { + if (pTask->taskLevel == TASK_LEVEL__SOURCE && taosQueueItemSize(pTask->inputQueue->queue) == 0) { tqStartStreamTasks(pTq); } else { streamSchedExec(pTask); } + streamMetaReleaseTask(pTq->pStreamMeta, pTask); } return 0; diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 2d8b7f9ecf..e50ffa571b 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -46,7 +46,13 @@ static void tsdbCloseBICache(STsdb *pTsdb) { } } -#define ROCKS_KEY_LEN 64 +#define ROCKS_KEY_LEN (sizeof(tb_uid_t) + sizeof(int16_t) + sizeof(int8_t)) + +typedef struct { + tb_uid_t uid; + int16_t cid; + int8_t ltype; +} SLastKey; static void tsdbGetRocksPath(STsdb *pTsdb, char *path) { SVnode *pVnode = pTsdb->pVnode; @@ -62,9 +68,56 @@ static void tsdbGetRocksPath(STsdb *pTsdb, char *path) { } } +static const char *myCmpName(void *state) { + (void)state; + return "myCmp"; +} + +static void myCmpDestroy(void *state) { (void)state; } + +static int myCmp(void *state, const char *a, size_t alen, const char *b, size_t blen) { + (void)state; + (void)alen; + (void)blen; + SLastKey *lhs = (SLastKey *)a; + SLastKey *rhs = (SLastKey *)b; + + if (lhs->uid < rhs->uid) { + return -1; + } else if (lhs->uid > rhs->uid) { + return 1; + } + + if (lhs->cid < rhs->cid) { + return -1; + } else if (lhs->cid > rhs->cid) { + return 1; + } + + if (lhs->ltype < rhs->ltype) { + return -1; + } else if (lhs->ltype > rhs->ltype) { + return 1; + } + + return 0; +} + static int32_t tsdbOpenRocksCache(STsdb *pTsdb) { int32_t code = 0; + rocksdb_comparator_t *cmp = rocksdb_comparator_create(NULL, myCmpDestroy, myCmp, myCmpName); + if (NULL == cmp) { + code = TSDB_CODE_OUT_OF_MEMORY; + return code; + } + + rocksdb_cache_t *cache = rocksdb_cache_create_lru(5 * 1024 * 1024); + pTsdb->rCache.blockcache = cache; + + rocksdb_block_based_table_options_t *tableoptions = rocksdb_block_based_options_create(); + pTsdb->rCache.tableoptions = tableoptions; + rocksdb_options_t *options = rocksdb_options_create(); if (NULL == options) { code = TSDB_CODE_OUT_OF_MEMORY; @@ -72,6 +125,9 @@ static int32_t tsdbOpenRocksCache(STsdb *pTsdb) { } rocksdb_options_set_create_if_missing(options, 1); + rocksdb_options_set_comparator(options, cmp); + rocksdb_block_based_options_set_block_cache(tableoptions, cache); + rocksdb_options_set_block_based_table_factory(options, tableoptions); // rocksdb_options_set_inplace_update_support(options, 1); // rocksdb_options_set_allow_concurrent_memtable_write(options, 0); @@ -80,12 +136,12 @@ static int32_t tsdbOpenRocksCache(STsdb *pTsdb) { code = TSDB_CODE_OUT_OF_MEMORY; goto _err2; } - // rocksdb_writeoptions_disable_WAL(writeoptions, 1); + rocksdb_writeoptions_disable_WAL(writeoptions, 1); rocksdb_readoptions_t *readoptions = rocksdb_readoptions_create(); if (NULL == readoptions) { code = TSDB_CODE_OUT_OF_MEMORY; - goto _err2; + goto _err3; } char *err = NULL; @@ -94,19 +150,25 @@ static int32_t tsdbOpenRocksCache(STsdb *pTsdb) { rocksdb_t *db = rocksdb_open(options, cachePath, &err); if (NULL == db) { - code = -1; - goto _err3; + tsdbError("vgId:%d, %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, err); + rocksdb_free(err); + + code = TSDB_CODE_OUT_OF_MEMORY; + goto _err4; } rocksdb_flushoptions_t *flushoptions = rocksdb_flushoptions_create(); if (NULL == flushoptions) { code = TSDB_CODE_OUT_OF_MEMORY; - goto _err4; + goto _err5; } rocksdb_writebatch_t *writebatch = rocksdb_writebatch_create(); + rocksdb_writebatch_t *rwritebatch = rocksdb_writebatch_create(); pTsdb->rCache.writebatch = writebatch; + pTsdb->rCache.rwritebatch = rwritebatch; + pTsdb->rCache.my_comparator = cmp; pTsdb->rCache.options = options; pTsdb->rCache.writeoptions = writeoptions; pTsdb->rCache.readoptions = readoptions; @@ -115,15 +177,22 @@ static int32_t tsdbOpenRocksCache(STsdb *pTsdb) { taosThreadMutexInit(&pTsdb->rCache.rMutex, NULL); + pTsdb->rCache.pTSchema = NULL; + return code; +_err5: + rocksdb_close(pTsdb->rCache.db); _err4: rocksdb_readoptions_destroy(readoptions); _err3: rocksdb_writeoptions_destroy(writeoptions); _err2: rocksdb_options_destroy(options); + rocksdb_block_based_options_destroy(tableoptions); + rocksdb_cache_destroy(cache); _err: + rocksdb_comparator_destroy(cmp); return code; } @@ -131,16 +200,55 @@ static void tsdbCloseRocksCache(STsdb *pTsdb) { rocksdb_close(pTsdb->rCache.db); rocksdb_flushoptions_destroy(pTsdb->rCache.flushoptions); rocksdb_writebatch_destroy(pTsdb->rCache.writebatch); + rocksdb_writebatch_destroy(pTsdb->rCache.rwritebatch); rocksdb_readoptions_destroy(pTsdb->rCache.readoptions); rocksdb_writeoptions_destroy(pTsdb->rCache.writeoptions); rocksdb_options_destroy(pTsdb->rCache.options); + rocksdb_block_based_options_destroy(pTsdb->rCache.tableoptions); + rocksdb_cache_destroy(pTsdb->rCache.blockcache); + rocksdb_comparator_destroy(pTsdb->rCache.my_comparator); taosThreadMutexDestroy(&pTsdb->rCache.rMutex); + taosMemoryFree(pTsdb->rCache.pTSchema); +} + +static void rocksMayWrite(STsdb *pTsdb, bool force, bool read, bool lock) { + rocksdb_writebatch_t *wb = NULL; + if (read) { + if (lock) { + taosThreadMutexLock(&pTsdb->lruMutex); + } + wb = pTsdb->rCache.rwritebatch; + } else { + if (lock) { + taosThreadMutexLock(&pTsdb->rCache.rMutex); + } + wb = pTsdb->rCache.writebatch; + } + int count = rocksdb_writebatch_count(wb); + if ((force && count > 0) || count >= 1024) { + char *err = NULL; + rocksdb_write(pTsdb->rCache.db, pTsdb->rCache.writeoptions, wb, &err); + if (NULL != err) { + tsdbError("vgId:%d, %s failed at line %d, count: %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, count, + err); + rocksdb_free(err); + } + + rocksdb_writebatch_clear(wb); + } + if (read) { + if (lock) taosThreadMutexUnlock(&pTsdb->lruMutex); + } else { + if (lock) taosThreadMutexUnlock(&pTsdb->rCache.rMutex); + } } int32_t tsdbCacheCommit(STsdb *pTsdb) { int32_t code = 0; char *err = NULL; + rocksMayWrite(pTsdb, true, false, true); + rocksMayWrite(pTsdb, true, true, true); rocksdb_flush(pTsdb->rCache.db, pTsdb->rCache.flushoptions, &err); if (NULL != err) { tsdbError("vgId:%d, %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, err); @@ -191,15 +299,15 @@ void tsdbCacheSerialize(SLastCol *pLastCol, char **value, size_t *size) { *size = length; } -static SLastCol *tsdbCacheLookup(STsdb *pTsdb, tb_uid_t uid, int16_t cid, char const *lstring) { +static SLastCol *tsdbCacheLookup(STsdb *pTsdb, tb_uid_t uid, int16_t cid, int8_t ltype) { SLastCol *pLastCol = NULL; - char *err = NULL; - size_t vlen = 0; - char key[ROCKS_KEY_LEN]; - size_t klen = snprintf(key, ROCKS_KEY_LEN, "%" PRIi64 ":%" PRIi16 ":%s", uid, cid, lstring); - char *value = NULL; - value = rocksdb_get(pTsdb->rCache.db, pTsdb->rCache.readoptions, key, klen, &vlen, &err); + char *err = NULL; + size_t vlen = 0; + SLastKey *key = &(SLastKey){.ltype = ltype, .uid = uid, .cid = cid}; + size_t klen = ROCKS_KEY_LEN; + char *value = NULL; + value = rocksdb_get(pTsdb->rCache.db, pTsdb->rCache.readoptions, (char *)key, klen, &vlen, &err); if (NULL != err) { tsdbError("vgId:%d, %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, err); rocksdb_free(err); @@ -210,12 +318,38 @@ static SLastCol *tsdbCacheLookup(STsdb *pTsdb, tb_uid_t uid, int16_t cid, char c return pLastCol; } +static void reallocVarData(SColVal *pColVal) { + if (IS_VAR_DATA_TYPE(pColVal->type)) { + uint8_t *pVal = pColVal->value.pData; + pColVal->value.pData = taosMemoryMalloc(pColVal->value.nData); + if (pColVal->value.nData) { + memcpy(pColVal->value.pData, pVal, pColVal->value.nData); + } + } +} + +static void tsdbCacheDeleter(const void *key, size_t keyLen, void *value) { + SLastCol *pLastCol = (SLastCol *)value; + + // TODO: add dirty flag to SLastCol + if (pLastCol->dirty) { + // TODO: queue into dirty list, free it after save to backstore + } else { + if (IS_VAR_DATA_TYPE(pLastCol->colVal.type) /* && pLastCol->colVal.value.nData > 0*/) { + taosMemoryFree(pLastCol->colVal.value.pData); + } + + taosMemoryFree(value); + } +} + int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow) { int32_t code = 0; // 1, fetch schema STSchema *pTSchema = NULL; int32_t sver = TSDBROW_SVERSION(pRow); + code = metaGetTbTSchemaEx(pTsdb->pVnode->pMeta, suid, uid, sver, &pTSchema); if (code != TSDB_CODE_SUCCESS) { terrno = code; @@ -229,22 +363,6 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow tsdbRowIterOpen(&iter, pRow, pTSchema); for (SColVal *pColVal = tsdbRowIterNext(&iter); pColVal; pColVal = tsdbRowIterNext(&iter)) { - /* - if (IS_VAR_DATA_TYPE(pColVal->type)) { - uint8_t *pVal = pColVal->value.pData; - - pColVal->value.pData = NULL; - code = tRealloc(&pColVal->value.pData, pColVal->value.nData); - if (code) { - code = TSDB_CODE_OUT_OF_MEMORY; - goto _exit; - } - - if (pColVal->value.nData) { - memcpy(pColVal->value.pData, pVal, pColVal->value.nData); - } - } - */ taosArrayPush(aColVal, pColVal); } @@ -254,23 +372,18 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow int num_keys = TARRAY_SIZE(aColVal); char **keys_list = taosMemoryCalloc(num_keys * 2, sizeof(char *)); size_t *keys_list_sizes = taosMemoryCalloc(num_keys * 2, sizeof(size_t)); + char *key_list = taosMemoryMalloc(num_keys * ROCKS_KEY_LEN * 2); for (int i = 0; i < num_keys; ++i) { SColVal *pColVal = (SColVal *)taosArrayGet(aColVal, i); int16_t cid = pColVal->cid; - char *keys = taosMemoryCalloc(2, ROCKS_KEY_LEN); - int last_key_len = snprintf(keys, ROCKS_KEY_LEN, "%" PRIi64 ":%" PRIi16 ":last", uid, cid); - if (last_key_len >= ROCKS_KEY_LEN) { - tsdbError("vgId:%d, %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, tstrerror(code)); - } - int lr_key_len = snprintf(keys + ROCKS_KEY_LEN, ROCKS_KEY_LEN, "%" PRIi64 ":%" PRIi16 ":last_row", uid, cid); - if (lr_key_len >= ROCKS_KEY_LEN) { - tsdbError("vgId:%d, %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, tstrerror(code)); - } - keys_list[i] = keys; - keys_list[num_keys + i] = keys + ROCKS_KEY_LEN; - keys_list_sizes[i] = last_key_len; - keys_list_sizes[num_keys + i] = lr_key_len; + memcpy(key_list + i * ROCKS_KEY_LEN, &(SLastKey){.ltype = 1, .uid = uid, .cid = cid}, ROCKS_KEY_LEN); + memcpy(key_list + i * ROCKS_KEY_LEN + num_keys * ROCKS_KEY_LEN, &(SLastKey){.ltype = 0, .uid = uid, .cid = cid}, + ROCKS_KEY_LEN); + keys_list[i] = key_list + i * ROCKS_KEY_LEN; + keys_list[num_keys + i] = key_list + i * ROCKS_KEY_LEN + num_keys * ROCKS_KEY_LEN; + keys_list_sizes[i] = ROCKS_KEY_LEN; + keys_list_sizes[num_keys + i] = ROCKS_KEY_LEN; } char **values_list = taosMemoryCalloc(num_keys * 2, sizeof(char *)); size_t *values_list_sizes = taosMemoryCalloc(num_keys * 2, sizeof(size_t)); @@ -278,12 +391,10 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow taosThreadMutexLock(&pTsdb->rCache.rMutex); rocksdb_multi_get(pTsdb->rCache.db, pTsdb->rCache.readoptions, num_keys * 2, (const char *const *)keys_list, keys_list_sizes, values_list, values_list_sizes, errs); - for (int i = 0; i < num_keys; ++i) { - taosMemoryFree(keys_list[i]); - } for (int i = 0; i < num_keys * 2; ++i) { rocksdb_free(errs[i]); } + taosMemoryFree(key_list); taosMemoryFree(keys_list); taosMemoryFree(keys_list_sizes); taosMemoryFree(errs); @@ -292,6 +403,38 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow rocksdb_writebatch_t *wb = pTsdb->rCache.writebatch; for (int i = 0; i < num_keys; ++i) { SColVal *pColVal = (SColVal *)taosArrayGet(aColVal, i); + + // if (!COL_VAL_IS_NONE(pColVal)) { + SLastCol *pLastCol = tsdbCacheDeserialize(values_list[i + num_keys]); + + if (NULL == pLastCol || pLastCol->ts <= keyTs) { + char *value = NULL; + size_t vlen = 0; + tsdbCacheSerialize(&(SLastCol){.ts = keyTs, .colVal = *pColVal}, &value, &vlen); + SLastKey key = (SLastKey){.ltype = 0, .uid = uid, .cid = pColVal->cid}; + size_t klen = ROCKS_KEY_LEN; + rocksdb_writebatch_put(wb, (char *)&key, klen, value, vlen); + + pLastCol = (SLastCol *)value; + SLastCol *pTmpLastCol = taosMemoryCalloc(1, sizeof(SLastCol)); + *pTmpLastCol = *pLastCol; + pLastCol = pTmpLastCol; + + reallocVarData(&pLastCol->colVal); + size_t charge = sizeof(*pLastCol); + if (IS_VAR_DATA_TYPE(pLastCol->colVal.type)) { + charge += pLastCol->colVal.value.nData; + } + + LRUStatus status = taosLRUCacheInsert(pTsdb->lruCache, &key, ROCKS_KEY_LEN, pLastCol, charge, tsdbCacheDeleter, + NULL, TAOS_LRU_PRIORITY_LOW); + if (status != TAOS_LRU_STATUS_OK) { + code = -1; + } + + taosMemoryFree(value); + } + if (COL_VAL_IS_VALUE(pColVal)) { SLastCol *pLastCol = tsdbCacheDeserialize(values_list[i]); @@ -299,26 +442,31 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow char *value = NULL; size_t vlen = 0; tsdbCacheSerialize(&(SLastCol){.ts = keyTs, .colVal = *pColVal}, &value, &vlen); - char key[ROCKS_KEY_LEN]; - size_t klen = snprintf(key, ROCKS_KEY_LEN, "%" PRIi64 ":%" PRIi16 ":last", uid, pColVal->cid); - rocksdb_writebatch_put(wb, key, klen, value, vlen); - taosMemoryFree(value); - } - } - - if (!COL_VAL_IS_NONE(pColVal)) { - SLastCol *pLastCol = tsdbCacheDeserialize(values_list[i + num_keys]); - - if (NULL == pLastCol || pLastCol->ts <= keyTs) { - char *value = NULL; - size_t vlen = 0; - tsdbCacheSerialize(&(SLastCol){.ts = keyTs, .colVal = *pColVal}, &value, &vlen); - char key[ROCKS_KEY_LEN]; - size_t klen = snprintf(key, ROCKS_KEY_LEN, "%" PRIi64 ":%" PRIi16 ":last_row", uid, pColVal->cid); - rocksdb_writebatch_put(wb, key, klen, value, vlen); + SLastKey key = (SLastKey){.ltype = 1, .uid = uid, .cid = pColVal->cid}; + + rocksdb_writebatch_put(wb, (char *)&key, ROCKS_KEY_LEN, value, vlen); + + pLastCol = (SLastCol *)value; + SLastCol *pTmpLastCol = taosMemoryCalloc(1, sizeof(SLastCol)); + *pTmpLastCol = *pLastCol; + pLastCol = pTmpLastCol; + + reallocVarData(&pLastCol->colVal); + size_t charge = sizeof(*pLastCol); + if (IS_VAR_DATA_TYPE(pLastCol->colVal.type)) { + charge += pLastCol->colVal.value.nData; + } + + LRUStatus status = taosLRUCacheInsert(pTsdb->lruCache, &key, ROCKS_KEY_LEN, pLastCol, charge, tsdbCacheDeleter, + NULL, TAOS_LRU_PRIORITY_LOW); + if (status != TAOS_LRU_STATUS_OK) { + code = -1; + } + taosMemoryFree(value); } } + //} rocksdb_free(values_list[i]); rocksdb_free(values_list[i + num_keys]); @@ -326,14 +474,8 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow taosMemoryFree(values_list); taosMemoryFree(values_list_sizes); - char *err = NULL; - rocksdb_write(pTsdb->rCache.db, pTsdb->rCache.writeoptions, wb, &err); - if (NULL != err) { - tsdbError("vgId:%d, %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, err); - rocksdb_free(err); - } + rocksMayWrite(pTsdb, true, false, false); taosThreadMutexUnlock(&pTsdb->rCache.rMutex); - rocksdb_writebatch_clear(wb); _exit: taosArrayDestroy(aColVal); @@ -341,53 +483,41 @@ _exit: return code; } -static void reallocVarData(SColVal *pColVal) { - if (IS_VAR_DATA_TYPE(pColVal->type)) { - uint8_t *pVal = pColVal->value.pData; - pColVal->value.pData = taosMemoryMalloc(pColVal->value.nData); - if (pColVal->value.nData) { - memcpy(pColVal->value.pData, pVal, pColVal->value.nData); - } - } -} - static int32_t mergeLastCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCacheRowsReader *pr, int16_t *aCols, int nCols, int16_t *slotIds); static int32_t mergeLastRowCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCacheRowsReader *pr, int16_t *aCols, int nCols, int16_t *slotIds); - -int32_t tsdbCacheGet(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCacheRowsReader *pr, int32_t ltype) { - static char const *alstring[2] = {"last_row", "last"}; - char const *lstring = alstring[ltype]; +#if 1 +int32_t tsdbCacheGetSlow(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCacheRowsReader *pr, int8_t ltype) { rocksdb_writebatch_t *wb = NULL; int32_t code = 0; SArray *pCidList = pr->pCidList; int num_keys = TARRAY_SIZE(pCidList); - char **keys_list = taosMemoryCalloc(num_keys, sizeof(char *)); - size_t *keys_list_sizes = taosMemoryCalloc(num_keys, sizeof(size_t)); + + char **keys_list = taosMemoryMalloc(num_keys * sizeof(char *)); + size_t *keys_list_sizes = taosMemoryMalloc(num_keys * sizeof(size_t)); + char *key_list = taosMemoryMalloc(num_keys * ROCKS_KEY_LEN); for (int i = 0; i < num_keys; ++i) { int16_t cid = *(int16_t *)taosArrayGet(pCidList, i); - char *keys = taosMemoryCalloc(2, ROCKS_KEY_LEN); - int last_key_len = snprintf(keys, ROCKS_KEY_LEN, "%" PRIi64 ":%" PRIi16 ":%s", uid, cid, lstring); - if (last_key_len >= ROCKS_KEY_LEN) { - tsdbError("vgId:%d, %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, tstrerror(code)); - } - - keys_list[i] = keys; - keys_list_sizes[i] = last_key_len; + memcpy(key_list + i * ROCKS_KEY_LEN, &(SLastKey){.ltype = ltype, .uid = uid, .cid = cid}, ROCKS_KEY_LEN); + keys_list[i] = key_list + i * ROCKS_KEY_LEN; + keys_list_sizes[i] = ROCKS_KEY_LEN; } + char **values_list = taosMemoryCalloc(num_keys, sizeof(char *)); size_t *values_list_sizes = taosMemoryCalloc(num_keys, sizeof(size_t)); - char **errs = taosMemoryCalloc(num_keys, sizeof(char *)); + char **errs = taosMemoryMalloc(num_keys * sizeof(char *)); rocksdb_multi_get(pTsdb->rCache.db, pTsdb->rCache.readoptions, num_keys, (const char *const *)keys_list, keys_list_sizes, values_list, values_list_sizes, errs); for (int i = 0; i < num_keys; ++i) { - taosMemoryFree(keys_list[i]); - rocksdb_free(errs[i]); + if (errs[i]) { + rocksdb_free(errs[i]); + } } + taosMemoryFree(key_list); taosMemoryFree(keys_list); taosMemoryFree(keys_list_sizes); taosMemoryFree(errs); @@ -403,7 +533,7 @@ int32_t tsdbCacheGet(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCacheRowsR } else { taosThreadMutexLock(&pTsdb->rCache.rMutex); - pLastCol = tsdbCacheLookup(pTsdb, uid, cid, lstring); + pLastCol = tsdbCacheLookup(pTsdb, uid, cid, ltype); if (!pLastCol) { // recalc: load from tsdb int16_t aCols[1] = {cid}; @@ -428,13 +558,14 @@ int32_t tsdbCacheGet(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCacheRowsR } // store result back to rocks cache - wb = pTsdb->rCache.writebatch; + wb = pTsdb->rCache.rwritebatch; char *value = NULL; size_t vlen = 0; tsdbCacheSerialize(pLastCol, &value, &vlen); - char key[ROCKS_KEY_LEN]; - size_t klen = snprintf(key, ROCKS_KEY_LEN, "%" PRIi64 ":%" PRIi16 ":%s", uid, pLastCol->colVal.cid, lstring); - rocksdb_writebatch_put(wb, key, klen, value, vlen); + + SLastKey *key = &(SLastKey){.ltype = ltype, .uid = uid, .cid = pLastCol->colVal.cid}; + size_t klen = ROCKS_KEY_LEN; + rocksdb_writebatch_put(wb, (char *)key, klen, value, vlen); taosMemoryFree(value); } else { @@ -442,21 +573,13 @@ int32_t tsdbCacheGet(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCacheRowsR } if (wb) { - char *err = NULL; - rocksdb_write(pTsdb->rCache.db, pTsdb->rCache.writeoptions, wb, &err); - if (NULL != err) { - tsdbError("vgId:%d, %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, err); - rocksdb_free(err); - } - - rocksdb_writebatch_clear(wb); + rocksMayWrite(pTsdb, false, true, false); } taosThreadMutexUnlock(&pTsdb->rCache.rMutex); } taosArrayPush(pLastArray, pLastCol); - taosArrayDestroy(pTmpColArray); if (freeCol) { taosMemoryFree(pLastCol); @@ -467,43 +590,374 @@ int32_t tsdbCacheGet(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCacheRowsR return code; } +#endif + +static SLastCol *tsdbCacheLoadCol(STsdb *pTsdb, SCacheRowsReader *pr, int16_t slotid, tb_uid_t uid, int16_t cid, + int8_t ltype) { + SLastCol *pLastCol = tsdbCacheLookup(pTsdb, uid, cid, ltype); + if (!pLastCol) { + rocksdb_writebatch_t *wb = NULL; + + taosThreadMutexLock(&pTsdb->rCache.rMutex); + pLastCol = tsdbCacheLookup(pTsdb, uid, cid, ltype); + if (!pLastCol) { + // recalc: load from tsdb + int16_t aCols[1] = {cid}; + int16_t slotIds[1] = {slotid}; + SArray *pTmpColArray = NULL; + + if (ltype) { + mergeLastCid(uid, pTsdb, &pTmpColArray, pr, aCols, 1, slotIds); + } else { + mergeLastRowCid(uid, pTsdb, &pTmpColArray, pr, aCols, 1, slotIds); + } + + if (pTmpColArray && TARRAY_SIZE(pTmpColArray) >= 1) { + pLastCol = taosArrayGet(pTmpColArray, 0); + } + + // still null, then make up a none col value + SLastCol noneCol = {.ts = TSKEY_MIN, .colVal = COL_VAL_NONE(cid, pr->pSchema->columns[slotid].type)}; + if (!pLastCol) { + pLastCol = &noneCol; + } + + // store result back to rocks cache + wb = pTsdb->rCache.rwritebatch; + char *value = NULL; + size_t vlen = 0; + tsdbCacheSerialize(pLastCol, &value, &vlen); + + SLastKey *key = &(SLastKey){.ltype = ltype, .uid = uid, .cid = pLastCol->colVal.cid}; + size_t klen = ROCKS_KEY_LEN; + rocksdb_writebatch_put(wb, (char *)key, klen, value, vlen); + taosMemoryFree(value); + + SLastCol *pTmpLastCol = taosMemoryCalloc(1, sizeof(SLastCol)); + *pTmpLastCol = *pLastCol; + pLastCol = pTmpLastCol; + + taosArrayDestroy(pTmpColArray); + } + + if (wb) { + rocksMayWrite(pTsdb, false, true, false); + } + + taosThreadMutexUnlock(&pTsdb->rCache.rMutex); + } + + return pLastCol; +} + +typedef struct { + int idx; + SLastKey key; +} SIdxKey; + +static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SArray *remainCols, + SCacheRowsReader *pr, int8_t ltype) { + int32_t code = 0; + rocksdb_writebatch_t *wb = NULL; + SArray *pTmpColArray = NULL; + int num_keys = TARRAY_SIZE(remainCols); + int16_t *aCols = taosMemoryMalloc(num_keys * sizeof(int16_t)); + int16_t *slotIds = taosMemoryMalloc(num_keys * sizeof(int16_t)); + + for (int i = 0; i < num_keys; ++i) { + SIdxKey *idxKey = taosArrayGet(remainCols, i); + aCols[i] = idxKey->key.cid; + slotIds[i] = pr->pSlotIds[idxKey->idx]; + } + + if (ltype) { + mergeLastCid(uid, pTsdb, &pTmpColArray, pr, aCols, num_keys, slotIds); + } else { + mergeLastRowCid(uid, pTsdb, &pTmpColArray, pr, aCols, num_keys, slotIds); + } + + SLRUCache *pCache = pTsdb->lruCache; + for (int i = 0; i < num_keys; ++i) { + SIdxKey *idxKey = taosArrayGet(remainCols, i); + SLastCol *pLastCol = NULL; + + if (pTmpColArray && TARRAY_SIZE(pTmpColArray) >= i + 1) { + pLastCol = taosArrayGet(pTmpColArray, i); + } + + // still null, then make up a none col value + SLastCol noneCol = {.ts = TSKEY_MIN, + .colVal = COL_VAL_NONE(idxKey->key.cid, pr->pSchema->columns[slotIds[i]].type)}; + if (!pLastCol) { + pLastCol = &noneCol; + } + + taosArraySet(pLastArray, idxKey->idx, pLastCol); + // taosArrayRemove(remainCols, i); + + if (!pTmpColArray) { + continue; + } + + SLastCol *pTmpLastCol = taosMemoryCalloc(1, sizeof(SLastCol)); + *pTmpLastCol = *pLastCol; + pLastCol = pTmpLastCol; + + size_t charge = sizeof(*pLastCol); + if (IS_VAR_DATA_TYPE(pLastCol->colVal.type)) { + charge += pLastCol->colVal.value.nData; + } + + LRUStatus status = taosLRUCacheInsert(pCache, &idxKey->key, ROCKS_KEY_LEN, pLastCol, charge, tsdbCacheDeleter, NULL, + TAOS_LRU_PRIORITY_LOW); + if (status != TAOS_LRU_STATUS_OK) { + code = -1; + } + + // store result back to rocks cache + wb = pTsdb->rCache.rwritebatch; + char *value = NULL; + size_t vlen = 0; + tsdbCacheSerialize(pLastCol, &value, &vlen); + + SLastKey *key = &idxKey->key; + size_t klen = ROCKS_KEY_LEN; + rocksdb_writebatch_put(wb, (char *)key, klen, value, vlen); + taosMemoryFree(value); + } + + if (wb) { + rocksMayWrite(pTsdb, false, true, false); + } + + taosArrayDestroy(pTmpColArray); + + taosMemoryFree(aCols); + taosMemoryFree(slotIds); + + return code; +} + +static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SArray *remainCols, + SCacheRowsReader *pr, int8_t ltype) { + int32_t code = 0; + int num_keys = TARRAY_SIZE(remainCols); + char **keys_list = taosMemoryMalloc(num_keys * sizeof(char *)); + size_t *keys_list_sizes = taosMemoryMalloc(num_keys * sizeof(size_t)); + char *key_list = taosMemoryMalloc(num_keys * ROCKS_KEY_LEN); + for (int i = 0; i < num_keys; ++i) { + int16_t cid = *(int16_t *)taosArrayGet(remainCols, i); + + memcpy(key_list + i * ROCKS_KEY_LEN, &((SIdxKey *)taosArrayGet(remainCols, i))->key, ROCKS_KEY_LEN); + keys_list[i] = key_list + i * ROCKS_KEY_LEN; + keys_list_sizes[i] = ROCKS_KEY_LEN; + } + + char **values_list = taosMemoryCalloc(num_keys, sizeof(char *)); + size_t *values_list_sizes = taosMemoryCalloc(num_keys, sizeof(size_t)); + char **errs = taosMemoryMalloc(num_keys * sizeof(char *)); + rocksdb_multi_get(pTsdb->rCache.db, pTsdb->rCache.readoptions, num_keys, (const char *const *)keys_list, + keys_list_sizes, values_list, values_list_sizes, errs); + for (int i = 0; i < num_keys; ++i) { + if (errs[i]) { + rocksdb_free(errs[i]); + } + } + taosMemoryFree(key_list); + taosMemoryFree(keys_list); + taosMemoryFree(keys_list_sizes); + taosMemoryFree(errs); + + SLRUCache *pCache = pTsdb->lruCache; + for (int i = 0, j = 0; i < num_keys && j < TARRAY_SIZE(remainCols); ++i) { + SLastCol *pLastCol = tsdbCacheDeserialize(values_list[i]); + SIdxKey *idxKey = &((SIdxKey *)TARRAY_DATA(remainCols))[j]; + if (pLastCol) { + SLastCol *pTmpLastCol = taosMemoryCalloc(1, sizeof(SLastCol)); + *pTmpLastCol = *pLastCol; + pLastCol = pTmpLastCol; + + reallocVarData(&pLastCol->colVal); + size_t charge = sizeof(*pLastCol); + if (IS_VAR_DATA_TYPE(pLastCol->colVal.type)) { + charge += pLastCol->colVal.value.nData; + } + + LRUStatus status = taosLRUCacheInsert(pCache, &idxKey->key, ROCKS_KEY_LEN, pLastCol, charge, tsdbCacheDeleter, + NULL, TAOS_LRU_PRIORITY_LOW); + if (status != TAOS_LRU_STATUS_OK) { + code = -1; + } + + taosArraySet(pLastArray, idxKey->idx, pLastCol); + taosArrayRemove(remainCols, j); + + taosMemoryFree(values_list[i]); + } else { + ++j; + } + } + + taosMemoryFree(values_list); + taosMemoryFree(values_list_sizes); + + if (TARRAY_SIZE(remainCols) > 0) { + code = tsdbCacheLoadFromRaw(pTsdb, uid, pLastArray, remainCols, pr, ltype); + } + + return code; +} + +int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCacheRowsReader *pr, int8_t ltype) { + int32_t code = 0; + SArray *remainCols = NULL; + SLRUCache *pCache = pTsdb->lruCache; + SArray *pCidList = pr->pCidList; + int num_keys = TARRAY_SIZE(pCidList); + + for (int i = 0; i < num_keys; ++i) { + int16_t cid = ((int16_t *)TARRAY_DATA(pCidList))[i]; + + SLastKey *key = &(SLastKey){.ltype = ltype, .uid = uid, .cid = cid}; + + LRUHandle *h = taosLRUCacheLookup(pCache, key, ROCKS_KEY_LEN); + if (h) { + SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pCache, h); + + SLastCol lastCol = *pLastCol; + // reallocVarData(&lastCol.colVal); + taosArrayPush(pLastArray, &lastCol); + + if (h) { + taosLRUCacheRelease(pCache, h, false); + } + } else { + SLastCol noneCol = {.ts = TSKEY_MIN, .colVal = COL_VAL_NONE(cid, pr->pSchema->columns[pr->pSlotIds[i]].type)}; + + taosArrayPush(pLastArray, &noneCol); + + if (!remainCols) { + remainCols = taosArrayInit(num_keys, sizeof(SIdxKey)); + } + taosArrayPush(remainCols, &(SIdxKey){i, *key}); + } + } + + if (remainCols && TARRAY_SIZE(remainCols) > 0) { + taosThreadMutexLock(&pTsdb->lruMutex); + for (int i = 0; i < TARRAY_SIZE(remainCols);) { + SIdxKey *idxKey = &((SIdxKey *)TARRAY_DATA(remainCols))[i]; + LRUHandle *h = taosLRUCacheLookup(pCache, &idxKey->key, ROCKS_KEY_LEN); + if (h) { + SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pCache, h); + + SLastCol lastCol = *pLastCol; + reallocVarData(&lastCol.colVal); + + taosArraySet(pLastArray, idxKey->idx, &lastCol); + if (h) { + taosLRUCacheRelease(pCache, h, false); + } + + taosArrayRemove(remainCols, i); + } else { + ++i; + } + } + + code = tsdbCacheLoadFromRocks(pTsdb, uid, pLastArray, remainCols, pr, ltype); + + taosThreadMutexUnlock(&pTsdb->lruMutex); + } + + if (remainCols) { + taosArrayDestroy(remainCols); + } + + return code; +} + +int32_t tsdbCacheGet(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCacheRowsReader *pr, int8_t ltype) { + int32_t code = 0; + SLRUCache *pCache = pTsdb->lruCache; + SArray *pCidList = pr->pCidList; + int num_keys = TARRAY_SIZE(pCidList); + + for (int i = 0; i < num_keys; ++i) { + SLastCol *pLastCol = NULL; + int16_t cid = *(int16_t *)taosArrayGet(pCidList, i); + + SLastKey *key = &(SLastKey){.ltype = ltype, .uid = uid, .cid = cid}; + LRUHandle *h = taosLRUCacheLookup(pCache, key, ROCKS_KEY_LEN); + if (!h) { + taosThreadMutexLock(&pTsdb->lruMutex); + h = taosLRUCacheLookup(pCache, key, ROCKS_KEY_LEN); + if (!h) { + pLastCol = tsdbCacheLoadCol(pTsdb, pr, pr->pSlotIds[i], uid, cid, ltype); + + size_t charge = sizeof(*pLastCol); + if (IS_VAR_DATA_TYPE(pLastCol->colVal.type)) { + charge += pLastCol->colVal.value.nData; + } + + LRUStatus status = taosLRUCacheInsert(pCache, key, ROCKS_KEY_LEN, pLastCol, charge, tsdbCacheDeleter, &h, + TAOS_LRU_PRIORITY_LOW); + if (status != TAOS_LRU_STATUS_OK) { + code = -1; + } + } + + taosThreadMutexUnlock(&pTsdb->lruMutex); + } + + pLastCol = (SLastCol *)taosLRUCacheValue(pCache, h); + + SLastCol lastCol = *pLastCol; + reallocVarData(&lastCol.colVal); + + if (h) { + taosLRUCacheRelease(pCache, h, false); + } + + taosArrayPush(pLastArray, &lastCol); + } + + return code; +} int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKEY eKey) { int32_t code = 0; - // 1, fetch schema + // fetch schema STSchema *pTSchema = NULL; - int32_t sver = -1; + int sver = -1; code = metaGetTbTSchemaEx(pTsdb->pVnode->pMeta, suid, uid, sver, &pTSchema); if (code != TSDB_CODE_SUCCESS) { terrno = code; return -1; } - // 3, build keys & multi get from rocks + // build keys & multi get from rocks int num_keys = pTSchema->numOfCols; char **keys_list = taosMemoryCalloc(num_keys * 2, sizeof(char *)); size_t *keys_list_sizes = taosMemoryCalloc(num_keys * 2, sizeof(size_t)); for (int i = 0; i < num_keys; ++i) { int16_t cid = pTSchema->columns[i].colId; - char *keys = taosMemoryCalloc(2, ROCKS_KEY_LEN); - int last_key_len = snprintf(keys, ROCKS_KEY_LEN, "%" PRIi64 ":%" PRIi16 ":last", uid, cid); - if (last_key_len >= ROCKS_KEY_LEN) { - tsdbError("vgId:%d, %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, tstrerror(code)); - } - int lr_key_len = snprintf(keys + ROCKS_KEY_LEN, ROCKS_KEY_LEN, "%" PRIi64 ":%" PRIi16 ":last_row", uid, cid); - if (lr_key_len >= ROCKS_KEY_LEN) { - tsdbError("vgId:%d, %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, tstrerror(code)); - } + size_t klen = ROCKS_KEY_LEN; + char *keys = taosMemoryCalloc(2, sizeof(SLastKey)); + ((SLastKey *)keys)[0] = (SLastKey){.ltype = 1, .uid = uid, .cid = cid}; + ((SLastKey *)keys)[1] = (SLastKey){.ltype = 0, .uid = uid, .cid = cid}; + keys_list[i] = keys; - keys_list[num_keys + i] = keys + ROCKS_KEY_LEN; - keys_list_sizes[i] = last_key_len; - keys_list_sizes[num_keys + i] = lr_key_len; + keys_list[num_keys + i] = keys + sizeof(SLastKey); + keys_list_sizes[i] = klen; + keys_list_sizes[num_keys + i] = klen; } char **values_list = taosMemoryCalloc(num_keys * 2, sizeof(char *)); size_t *values_list_sizes = taosMemoryCalloc(num_keys * 2, sizeof(size_t)); char **errs = taosMemoryCalloc(num_keys * 2, sizeof(char *)); taosThreadMutexLock(&pTsdb->rCache.rMutex); + rocksMayWrite(pTsdb, true, false, false); rocksdb_multi_get(pTsdb->rCache.db, pTsdb->rCache.readoptions, num_keys * 2, (const char *const *)keys_list, keys_list_sizes, values_list, values_list_sizes, errs); for (int i = 0; i < num_keys; ++i) { @@ -520,16 +974,20 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE for (int i = 0; i < num_keys; ++i) { SLastCol *pLastCol = tsdbCacheDeserialize(values_list[i]); if (NULL != pLastCol && (pLastCol->ts <= eKey && pLastCol->ts >= sKey)) { - char key[ROCKS_KEY_LEN]; - size_t klen = snprintf(key, ROCKS_KEY_LEN, "%" PRIi64 ":%" PRIi16 ":last", uid, pLastCol->colVal.cid); - rocksdb_writebatch_delete(wb, key, klen); + SLastKey *key = &(SLastKey){.ltype = 1, .uid = uid, .cid = pLastCol->colVal.cid}; + size_t klen = ROCKS_KEY_LEN; + + rocksdb_writebatch_delete(wb, (char *)key, klen); + taosLRUCacheErase(pTsdb->lruCache, key, klen); } pLastCol = tsdbCacheDeserialize(values_list[i + num_keys]); if (NULL != pLastCol && (pLastCol->ts <= eKey && pLastCol->ts >= sKey)) { - char key[ROCKS_KEY_LEN]; - size_t klen = snprintf(key, ROCKS_KEY_LEN, "%" PRIi64 ":%" PRIi16 ":last_row", uid, pLastCol->colVal.cid); - rocksdb_writebatch_delete(wb, key, klen); + SLastKey *key = &(SLastKey){.ltype = 0, .uid = uid, .cid = pLastCol->colVal.cid}; + size_t klen = ROCKS_KEY_LEN; + + rocksdb_writebatch_delete(wb, (char *)key, klen); + taosLRUCacheErase(pTsdb->lruCache, key, klen); } rocksdb_free(values_list[i]); @@ -538,14 +996,8 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE taosMemoryFree(values_list); taosMemoryFree(values_list_sizes); - char *err = NULL; - rocksdb_write(pTsdb->rCache.db, pTsdb->rCache.writeoptions, wb, &err); - if (NULL != err) { - tsdbError("vgId:%d, %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, err); - rocksdb_free(err); - } + rocksMayWrite(pTsdb, true, false, false); taosThreadMutexUnlock(&pTsdb->rCache.rMutex); - rocksdb_writebatch_clear(wb); _exit: taosMemoryFree(pTSchema); @@ -1111,7 +1563,7 @@ typedef struct { SMergeTree mergeTree; SMergeTree *pMergeTree; SSttBlockLoadInfo *pLoadInfo; - SLDataIter* pDataIter; + SLDataIter *pDataIter; int64_t lastTs; } SFSLastNextRowIter; @@ -1152,14 +1604,21 @@ static int32_t getNextRowFromFSLast(void *iter, TSDBROW **ppRow, bool *pIgnoreEa if (code) goto _err; } + int nTmpCols = nCols; + bool hasTs = false; + if (aCols[0] == PRIMARYKEY_TIMESTAMP_COL_ID) { + --nTmpCols; + hasTs = true; + } for (int i = 0; i < state->pLoadInfo->numOfStt; ++i) { - state->pLoadInfo[i].colIds = aCols; - state->pLoadInfo[i].numOfCols = nCols; + state->pLoadInfo[i].colIds = hasTs ? aCols + 1 : aCols; + state->pLoadInfo[i].numOfCols = nTmpCols; state->pLoadInfo[i].isLast = isLast; } tMergeTreeOpen(&state->mergeTree, 1, *state->pDataFReader, state->suid, state->uid, &(STimeWindow){.skey = state->lastTs, .ekey = TSKEY_MAX}, - &(SVersionRange){.minVer = 0, .maxVer = UINT64_MAX}, state->pLoadInfo, false, NULL, true, state->pDataIter); + &(SVersionRange){.minVer = 0, .maxVer = UINT64_MAX}, state->pLoadInfo, false, NULL, true, + state->pDataIter); state->pMergeTree = &state->mergeTree; state->state = SFSLASTNEXTROW_BLOCKROW; } @@ -1394,11 +1853,13 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie tBlockDataReset(state->pBlockData); TABLEID tid = {.suid = state->suid, .uid = state->uid}; int nTmpCols = nCols; - if (aCols[0] == PRIMARYKEY_TIMESTAMP_COL_ID && nCols == 1) { - nTmpCols = 0; + bool hasTs = false; + if (aCols[0] == PRIMARYKEY_TIMESTAMP_COL_ID) { + --nTmpCols; skipBlock = false; + hasTs = true; } - code = tBlockDataInit(state->pBlockData, &tid, state->pTSchema, aCols, nTmpCols); + code = tBlockDataInit(state->pBlockData, &tid, state->pTSchema, hasTs ? aCols + 1 : aCols, nTmpCols); if (code) goto _err; code = tsdbReadDataBlock(*state->pDataFReader, &block, state->pBlockData); @@ -1730,8 +2191,8 @@ typedef struct { } CacheNextRowIter; static int32_t nextRowIterOpen(CacheNextRowIter *pIter, tb_uid_t uid, STsdb *pTsdb, STSchema *pTSchema, tb_uid_t suid, - SSttBlockLoadInfo *pLoadInfo, SLDataIter* pLDataIter, STsdbReadSnap *pReadSnap, SDataFReader **pDataFReader, - SDataFReader **pDataFReaderLast, int64_t lastTs) { + SSttBlockLoadInfo *pLoadInfo, SLDataIter *pLDataIter, STsdbReadSnap *pReadSnap, + SDataFReader **pDataFReader, SDataFReader **pDataFReaderLast, int64_t lastTs) { int code = 0; STbData *pMem = NULL; @@ -2549,17 +3010,17 @@ static int32_t mergeLastRowCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, memcpy(pCol->colVal.value.pData, pColVal->value.pData, pColVal->value.nData); } - if (COL_VAL_IS_NONE(pColVal)) { + /*if (COL_VAL_IS_NONE(pColVal)) { if (!setNoneCol) { noneCol = iCol; setNoneCol = true; } - } else { - int32_t aColIndex = taosArraySearchIdx(aColArray, &pColVal->cid, compareInt16Val, TD_EQ); - if (aColIndex >= 0) { - taosArrayRemove(aColArray, aColIndex); - } + } else {*/ + int32_t aColIndex = taosArraySearchIdx(aColArray, &pColVal->cid, compareInt16Val, TD_EQ); + if (aColIndex >= 0) { + taosArrayRemove(aColArray, aColIndex); } + //} } if (!setNoneCol) { // done, goto return pColArray diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c index 61c0317e11..0e0b7a2ffa 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c @@ -63,9 +63,6 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, i); SColVal* pVal = &pColVal->colVal; - if (COL_VAL_IS_NONE(&pColVal->colVal)) { - continue; - } allNullRow = false; if (IS_VAR_DATA_TYPE(pColVal->colVal.type)) { if (!COL_VAL_IS_VALUE(&pColVal->colVal)) { @@ -180,8 +177,7 @@ int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList, } SVnodeCfg* pCfg = &((SVnode*)pVnode)->config; - - int32_t numOfStt = pCfg->sttTrigger; + int32_t numOfStt = pCfg->sttTrigger; p->pLoadInfo = tCreateLastBlockLoadInfo(p->pSchema, NULL, 0, numOfStt); if (p->pLoadInfo == NULL) { tsdbCacherowsReaderClose(p); @@ -215,7 +211,7 @@ void* tsdbCacherowsReaderClose(void* pReader) { taosMemoryFree(p->pSchema); } - taosMemoryFreeClear(p->pDataIter); + taosMemoryFree(p->pDataIter); taosMemoryFree(p->pCurrSchema); destroyLastBlockLoadInfo(p->pLoadInfo); @@ -306,23 +302,27 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 pr->pDataFReader = NULL; pr->pDataFReaderLast = NULL; - int32_t ltype = (pr->type & CACHESCAN_RETRIEVE_LAST) >> 3; + int8_t ltype = (pr->type & CACHESCAN_RETRIEVE_LAST) >> 3; // retrieve the only one last row of all tables in the uid list. if (HASTYPE(pr->type, CACHESCAN_RETRIEVE_TYPE_SINGLE)) { int64_t st = taosGetTimestampUs(); int64_t totalLastTs = INT64_MAX; + for (int32_t i = 0; i < pr->numOfTables; ++i) { STableKeyInfo* pKeyInfo = &pr->pTableList[i]; - tsdbCacheGet(pr->pTsdb, pKeyInfo->uid, pRow, pr, ltype); + tsdbCacheGetBatch(pr->pTsdb, pKeyInfo->uid, pRow, pr, ltype); + // tsdbCacheGet(pr->pTsdb, pKeyInfo->uid, pRow, pr, ltype); if (TARRAY_SIZE(pRow) <= 0) { - taosArrayClearEx(pRow, freeItem); + // taosArrayClearEx(pRow, freeItem); + taosArrayClear(pRow); continue; } - SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, 0); + SLastCol* pColVal = taosArrayGet(pRow, 0); if (COL_VAL_IS_NONE(&pColVal->colVal)) { - taosArrayClearEx(pRow, freeItem); + // taosArrayClearEx(pRow, freeItem); + taosArrayClear(pRow); continue; } @@ -343,6 +343,14 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 hasRes = true; p->ts = pColVal->ts; + if (k == 0) { + if (TARRAY_SIZE(pTableUidList) == 0) { + taosArrayPush(pTableUidList, &pKeyInfo->uid); + } else { + taosArraySet(pTableUidList, 0, &pKeyInfo->uid); + } + } + if (pColVal->ts < singleTableLastTs && HASTYPE(pr->type, CACHESCAN_RETRIEVE_LAST)) { singleTableLastTs = pColVal->ts; } @@ -373,13 +381,8 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 } } - if (taosArrayGetSize(pTableUidList) == 0) { - taosArrayPush(pTableUidList, &pKeyInfo->uid); - } else { - taosArraySet(pTableUidList, 0, &pKeyInfo->uid); - } - - taosArrayClearEx(pRow, freeItem); + // taosArrayClearEx(pRow, freeItem); + taosArrayClear(pRow); } if (hasRes) { @@ -387,25 +390,28 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 } } else if (HASTYPE(pr->type, CACHESCAN_RETRIEVE_TYPE_ALL)) { for (int32_t i = pr->tableIndex; i < pr->numOfTables; ++i) { - STableKeyInfo* pKeyInfo = &pr->pTableList[i]; + tb_uid_t uid = pr->pTableList[i].uid; - tsdbCacheGet(pr->pTsdb, pKeyInfo->uid, pRow, pr, ltype); + tsdbCacheGetBatch(pr->pTsdb, uid, pRow, pr, ltype); if (TARRAY_SIZE(pRow) <= 0) { - taosArrayClearEx(pRow, freeItem); + // taosArrayClearEx(pRow, freeItem); + taosArrayClear(pRow); continue; } SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, 0); if (COL_VAL_IS_NONE(&pColVal->colVal)) { - taosArrayClearEx(pRow, freeItem); + // taosArrayClearEx(pRow, freeItem); + taosArrayClear(pRow); continue; } saveOneRow(pRow, pResBlock, pr, slotIds, dstSlotIds, pRes, pr->idstr); - taosArrayClearEx(pRow, freeItem); + // taosArrayClearEx(pRow, freeItem); + taosArrayClear(pRow); - taosArrayPush(pTableUidList, &pKeyInfo->uid); + taosArrayPush(pTableUidList, &uid); - pr->tableIndex += 1; + ++pr->tableIndex; if (pResBlock->info.rows >= pResBlock->info.capacity) { goto _end; } @@ -429,7 +435,9 @@ _end: } taosMemoryFree(pRes); - taosArrayDestroyEx(pRow, freeItem); + // taosArrayDestroyEx(pRow, freeItem); + taosArrayDestroy(pRow); taosArrayDestroyEx(pLastCols, freeItem); + return code; } diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c index 97b648201c..80967a906f 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c +++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c @@ -302,12 +302,12 @@ int64_t tsdbCountTbDataRows(STbData *pTbData) { return rowsNum; } -void tsdbMemTableCountRows(SMemTable *pMemTable, SSHashObj* pTableMap, int64_t *rowsNum) { +void tsdbMemTableCountRows(SMemTable *pMemTable, SSHashObj *pTableMap, int64_t *rowsNum) { taosRLockLatch(&pMemTable->latch); for (int32_t i = 0; i < pMemTable->nBucket; ++i) { STbData *pTbData = pMemTable->aBucket[i]; while (pTbData) { - void* p = tSimpleHashGet(pTableMap, &pTbData->uid, sizeof(pTbData->uid)); + void *p = tSimpleHashGet(pTableMap, &pTbData->uid, sizeof(pTbData->uid)); if (p == NULL) { pTbData = pTbData->next; continue; @@ -673,7 +673,10 @@ static int32_t tsdbInsertColDataToTable(SMemTable *pMemTable, STbData *pTbData, if (key.ts >= pTbData->maxKey) { pTbData->maxKey = key.ts; } - tsdbCacheUpdate(pMemTable->pTsdb, pTbData->suid, pTbData->uid, &lRow); + + if (!TSDB_CACHE_NO(pMemTable->pTsdb->pVnode->config)) { + tsdbCacheUpdate(pMemTable->pTsdb, pTbData->suid, pTbData->uid, &lRow); + } // SMemTable pMemTable->minKey = TMIN(pMemTable->minKey, pTbData->minKey); @@ -734,7 +737,9 @@ static int32_t tsdbInsertRowDataToTable(SMemTable *pMemTable, STbData *pTbData, if (key.ts >= pTbData->maxKey) { pTbData->maxKey = key.ts; } - tsdbCacheUpdate(pMemTable->pTsdb, pTbData->suid, pTbData->uid, &lRow); + if (!TSDB_CACHE_NO(pMemTable->pTsdb->pVnode->config)) { + tsdbCacheUpdate(pMemTable->pTsdb, pTbData->suid, pTbData->uid, &lRow); + } // SMemTable pMemTable->minKey = TMIN(pMemTable->minKey, pTbData->minKey); diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index ea84910d17..eece9bf937 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -810,7 +810,7 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd if (pReader->suppInfo.colId[0] != PRIMARYKEY_TIMESTAMP_COL_ID) { tsdbError("the first column isn't primary timestamp, %d, %s", pReader->suppInfo.colId[0], pReader->idStr); - terrno = TSDB_CODE_INVALID_PARA; + code = TSDB_CODE_INVALID_PARA; goto _end; } @@ -819,7 +819,7 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd if (type != TSDB_DATA_TYPE_TIMESTAMP) { tsdbError("the first column isn't primary timestamp in result block, actual: %s, %s", tDataTypes[type].name, pReader->idStr); - terrno = TSDB_CODE_INVALID_PARA; + code = TSDB_CODE_INVALID_PARA; goto _end; } @@ -1767,6 +1767,9 @@ static bool overlapWithDelSkyline(STableBlockScanInfo* pBlockScanInfo, const SDa if (p->ts > pBlock->minKey.ts && index > 0) { index -= 1; } else { // find the first point that is smaller than the minKey.ts of dataBlock. + if (p->ts == pBlock->minKey.ts && p->version < pBlock->maxVer && index > 0) { + index -= 1; + } break; } } @@ -3112,6 +3115,10 @@ static int32_t doLoadLastBlockSequentially(STsdbReader* pReader) { // load the last data block of current table STableBlockScanInfo* pScanInfo = *(STableBlockScanInfo**)pStatus->pTableIter; if (pReader->pIgnoreTables && taosHashGet(*pReader->pIgnoreTables, &pScanInfo->uid, sizeof(pScanInfo->uid))) { + // reset the index in last block when handing a new file + doCleanupTableScanInfo(pScanInfo); + pStatus->mapDataCleaned = true; + bool hasNexTable = moveToNextTable(pUidList, pStatus); if (!hasNexTable) { return TSDB_CODE_SUCCESS; @@ -4507,7 +4514,7 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableL _err: tsdbError("failed to create data reader, code:%s %s", tstrerror(code), idstr); - tsdbReaderClose(pReader); + tsdbReaderClose(*ppReader); *ppReader = NULL; // reset the pointer value. return code; } diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c index 74168591d2..77453fd894 100644 --- a/source/dnode/vnode/src/vnd/vnodeCommit.c +++ b/source/dnode/vnode/src/vnd/vnodeCommit.c @@ -439,8 +439,10 @@ static int vnodeCommitImpl(SCommitInfo *pInfo) { code = tsdbCommit(pVnode->pTsdb, pInfo); TSDB_CHECK_CODE(code, lino, _exit); - code = tsdbCacheCommit(pVnode->pTsdb); - TSDB_CHECK_CODE(code, lino, _exit); + if (!TSDB_CACHE_NO(pVnode->config)) { + code = tsdbCacheCommit(pVnode->pTsdb); + TSDB_CHECK_CODE(code, lino, _exit); + } if (VND_IS_RSMA(pVnode)) { code = smaCommit(pVnode->pSma, pInfo); diff --git a/source/libs/CMakeLists.txt b/source/libs/CMakeLists.txt index e18be94ace..4a95629d59 100644 --- a/source/libs/CMakeLists.txt +++ b/source/libs/CMakeLists.txt @@ -17,4 +17,5 @@ add_subdirectory(executor) add_subdirectory(stream) add_subdirectory(planner) add_subdirectory(qworker) +add_subdirectory(geometry) add_subdirectory(command) \ No newline at end of file diff --git a/source/libs/catalog/CMakeLists.txt b/source/libs/catalog/CMakeLists.txt index bc56ff4c7f..6f09af8a8f 100644 --- a/source/libs/catalog/CMakeLists.txt +++ b/source/libs/catalog/CMakeLists.txt @@ -11,6 +11,6 @@ target_link_libraries( PRIVATE os util transport qcom nodes ) -if(${BUILD_TEST}) - ADD_SUBDIRECTORY(test) -endif(${BUILD_TEST}) +# if(${BUILD_TEST}) +# ADD_SUBDIRECTORY(test) +# endif(${BUILD_TEST}) diff --git a/source/libs/catalog/inc/catalogInt.h b/source/libs/catalog/inc/catalogInt.h index 0293584487..695bd4eb38 100644 --- a/source/libs/catalog/inc/catalogInt.h +++ b/source/libs/catalog/inc/catalogInt.h @@ -23,6 +23,8 @@ extern "C" { #include "catalog.h" #include "query.h" #include "tcommon.h" +#include "ttimer.h" +#include "tglobal.h" #define CTG_DEFAULT_CACHE_CLUSTER_NUMBER 6 #define CTG_DEFAULT_CACHE_VGROUP_NUMBER 100 @@ -34,6 +36,8 @@ extern "C" { #define CTG_DEFAULT_BATCH_NUM 64 #define CTG_DEFAULT_FETCH_NUM 8 #define CTG_MAX_COMMAND_LEN 512 +#define CTG_DEFAULT_CACHE_MON_MSEC 5000 +#define CTG_CLEAR_CACHE_ROUND_TB_NUM 3000 #define CTG_RENT_SLOT_SECOND 1.5 @@ -131,6 +135,7 @@ typedef struct SCtgDebug { typedef struct SCtgCacheStat { uint64_t cacheNum[CTG_CI_MAX_VALUE]; + uint64_t cacheSize[CTG_CI_MAX_VALUE]; uint64_t cacheHit[CTG_CI_MAX_VALUE]; uint64_t cacheNHit[CTG_CI_MAX_VALUE]; } SCtgCacheStat; @@ -239,8 +244,8 @@ typedef STableIndexRsp STableIndex; typedef struct SCtgTbCache { SRWLatch metaLock; - STableMeta* pMeta; SRWLatch indexLock; + STableMeta* pMeta; STableIndex* pIndex; } SCtgTbCache; @@ -263,6 +268,7 @@ typedef struct SCtgDBCache { SHashObj* tbCache; // key:tbname, value:SCtgTbCache SHashObj* stbCache; // key:suid, value:char* uint64_t dbCacheNum[CTG_CI_MAX_VALUE]; + uint64_t dbCacheSize; } SCtgDBCache; typedef struct SCtgRentSlot { @@ -276,12 +282,15 @@ typedef struct SCtgRentMgmt { uint16_t slotNum; uint16_t slotRIdx; int64_t lastReadMsec; + uint64_t rentCacheSize; + int32_t metaSize; SCtgRentSlot* slots; } SCtgRentMgmt; typedef struct SCtgUserAuth { SRWLatch lock; SGetUserAuthRsp userAuth; + uint64_t userCacheSize; } SCtgUserAuth; typedef struct SCatalog { @@ -412,6 +421,7 @@ typedef struct SCtgRuntimeStat { uint64_t numOfOpAbort; uint64_t numOfOpEnqueue; uint64_t numOfOpDequeue; + uint64_t numOfOpClearMeta; uint64_t numOfOpClearCache; } SCtgRuntimeStat; @@ -488,6 +498,7 @@ typedef struct SCtgDropTbIndexMsg { typedef struct SCtgClearCacheMsg { SCatalog* pCtg; + bool clearMeta; bool freeCtg; } SCtgClearCacheMsg; @@ -526,6 +537,8 @@ typedef struct SCatalogMgmt { int32_t jobPool; SRWLatch lock; SCtgQueue queue; + void *timer; + tmr_h cacheTimer; TdThread updateThread; SHashObj* pCluster; // key: clusterId, value: SCatalog* SCatalogStat statInfo; @@ -542,8 +555,8 @@ typedef struct SCtgOperation { } SCtgOperation; typedef struct SCtgCacheItemInfo { - char* name; - int32_t flag; + char* name; + int32_t flag; } SCtgCacheItemInfo; #define CTG_AUTH_READ(_t) ((_t) == AUTH_TYPE_READ || (_t) == AUTH_TYPE_READ_OR_WRITE) @@ -556,11 +569,6 @@ typedef struct SCtgCacheItemInfo { #define CTG_STAT_DEC(_item, _n) atomic_sub_fetch_64(&(_item), _n) #define CTG_STAT_GET(_item) atomic_load_64(&(_item)) -#define CTG_DB_NUM_INC(_item) dbCache->dbCacheNum[_item] += 1 -#define CTG_DB_NUM_DEC(_item) dbCache->dbCacheNum[_item] -= 1 -#define CTG_DB_NUM_SET(_item) dbCache->dbCacheNum[_item] = 1 -#define CTG_DB_NUM_RESET(_item) dbCache->dbCacheNum[_item] = 0 - #define CTG_STAT_API_INC(item, n) (CTG_STAT_INC(gCtgMgmt.statInfo.api.item, n)) #define CTG_STAT_RT_INC(item, n) (CTG_STAT_INC(gCtgMgmt.statInfo.runtime.item, n)) #define CTG_STAT_NUM_INC(item, n) (CTG_STAT_INC(gCtgMgmt.statInfo.cache.cacheNum[item], n)) @@ -575,6 +583,11 @@ typedef struct SCtgCacheItemInfo { #define CTG_CACHE_HIT_INC(item, n) (CTG_STAT_INC(pCtg->cacheStat.cacheHit[item], n)) #define CTG_CACHE_NHIT_INC(item, n) (CTG_STAT_INC(pCtg->cacheStat.cacheNHit[item], n)) +#define CTG_DB_NUM_INC(_item) dbCache->dbCacheNum[_item] += 1 +#define CTG_DB_NUM_DEC(_item) dbCache->dbCacheNum[_item] -= 1 +#define CTG_DB_NUM_SET(_item) dbCache->dbCacheNum[_item] = 1 +#define CTG_DB_NUM_RESET(_item) dbCache->dbCacheNum[_item] = 0 + #define CTG_META_NUM_INC(type) \ do { \ switch (type) { \ @@ -685,6 +698,10 @@ typedef struct SCtgCacheItemInfo { #define CTG_DB_NOT_EXIST(code) \ (code == TSDB_CODE_MND_DB_NOT_EXIST || code == TSDB_CODE_MND_DB_IN_CREATING || code == TSDB_CODE_MND_DB_IN_DROPPING) +#define CTG_CACHE_OVERFLOW(_csize, _maxsize) ((_maxsize >= 0) ? ((_csize) >= (_maxsize) * 1048576L * 0.9) : false) +#define CTG_CACHE_LOW(_csize, _maxsize) ((_maxsize >= 0) ? ((_csize) <= (_maxsize) * 1048576L * 0.75) : true) + + #define ctgFatal(param, ...) qFatal("CTG:%p " param, pCtg, __VA_ARGS__) #define ctgError(param, ...) qError("CTG:%p " param, pCtg, __VA_ARGS__) #define ctgWarn(param, ...) qWarn("CTG:%p " param, pCtg, __VA_ARGS__) @@ -787,6 +804,12 @@ typedef struct SCtgCacheItemInfo { CTG_RET(__code); \ } while (0) +#define CTG_API_NLEAVE() \ + do { \ + CTG_UNLOCK(CTG_READ, &gCtgMgmt.lock); \ + CTG_API_DEBUG("CTG API leave %s", __FUNCTION__); \ + } while (0) + #define CTG_API_ENTER() \ do { \ CTG_API_DEBUG("CTG API enter %s", __FUNCTION__); \ @@ -796,6 +819,15 @@ typedef struct SCtgCacheItemInfo { } \ } while (0) +#define CTG_API_NENTER() \ + do { \ + CTG_API_DEBUG("CTG API enter %s", __FUNCTION__); \ + CTG_LOCK(CTG_READ, &gCtgMgmt.lock); \ + if (atomic_load_8((int8_t*)&gCtgMgmt.exit)) { \ + CTG_API_NLEAVE(); \ + } \ + } while (0) + #define CTG_API_JENTER() \ do { \ CTG_API_DEBUG("CTG API enter %s", __FUNCTION__); \ @@ -859,8 +891,8 @@ int32_t ctgUpdateTbMetaEnqueue(SCatalog* pCtg, STableMetaOutput* output, bool sy int32_t ctgUpdateUserEnqueue(SCatalog* pCtg, SGetUserAuthRsp* pAuth, bool syncReq); int32_t ctgUpdateVgEpsetEnqueue(SCatalog* pCtg, char* dbFName, int32_t vgId, SEpSet* pEpSet); int32_t ctgUpdateTbIndexEnqueue(SCatalog* pCtg, STableIndex** pIndex, bool syncOp); -int32_t ctgClearCacheEnqueue(SCatalog* pCtg, bool freeCtg, bool stopQueue, bool syncOp); -int32_t ctgMetaRentInit(SCtgRentMgmt* mgmt, uint32_t rentSec, int8_t type); +int32_t ctgClearCacheEnqueue(SCatalog* pCtg, bool clearMeta, bool freeCtg, bool stopQueue, bool syncOp); +int32_t ctgMetaRentInit(SCtgRentMgmt* mgmt, uint32_t rentSec, int8_t type, int32_t size); int32_t ctgMetaRentAdd(SCtgRentMgmt* mgmt, void* meta, int64_t id, int32_t size); int32_t ctgMetaRentGet(SCtgRentMgmt* mgmt, void** res, uint32_t* num, int32_t size); int32_t ctgUpdateTbMetaToCache(SCatalog* pCtg, STableMetaOutput* pOut, bool syncReq); @@ -941,7 +973,7 @@ void ctgFreeSTableIndex(void* info); void ctgClearSubTaskRes(SCtgSubRes* pRes); void ctgFreeQNode(SCtgQNode* node); void ctgClearHandle(SCatalog* pCtg); -void ctgFreeTbCacheImpl(SCtgTbCache* pCache); +void ctgFreeTbCacheImpl(SCtgTbCache* pCache, bool lock); int32_t ctgRemoveTbMeta(SCatalog* pCtg, SName* pTableName); int32_t ctgGetTbHashVgroup(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName, SVgroupInfo* pVgroup, bool* exists); @@ -960,6 +992,16 @@ void ctgReleaseVgMetaToCache(SCatalog* pCtg, SCtgDBCache* dbCache, SCtgTbCach void ctgReleaseTbMetaToCache(SCatalog* pCtg, SCtgDBCache* dbCache, SCtgTbCache* pCache); void ctgGetGlobalCacheStat(SCtgCacheStat* pStat); int32_t ctgChkSetAuthRes(SCatalog* pCtg, SCtgAuthReq* req, SCtgAuthRsp* res); +void ctgGetGlobalCacheSize(uint64_t *pSize); +uint64_t ctgGetTbIndexCacheSize(STableIndex *pIndex); +uint64_t ctgGetTbMetaCacheSize(STableMeta *pMeta); +uint64_t ctgGetDbVgroupCacheSize(SDBVgInfo *pVg); +uint64_t ctgGetUserCacheSize(SGetUserAuthRsp *pAuth); +uint64_t ctgGetClusterCacheSize(SCatalog *pCtg); +void ctgClearHandleMeta(SCatalog* pCtg, int64_t *pClearedSize, int64_t *pCleardNum, bool *roundDone); +void ctgClearAllHandleMeta(int64_t *clearedSize, int64_t *clearedNum, bool *roundDone); +void ctgProcessTimerEvent(void *param, void *tmrId); + int32_t ctgGetTbMeta(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgTbMetaCtx* ctx, STableMeta** pTableMeta); int32_t ctgGetCachedStbNameFromSuid(SCatalog* pCtg, char* dbFName, uint64_t suid, char **stbName); int32_t ctgGetTbTagCb(SCtgTask* pTask); diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index 0deeafda9f..03df240929 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -668,6 +668,36 @@ _return: CTG_RET(code); } +void ctgProcessTimerEvent(void *param, void *tmrId) { + CTG_API_NENTER(); + + int32_t cacheMaxSize = atomic_load_32(&tsMetaCacheMaxSize); + if (cacheMaxSize >= 0) { + uint64_t cacheSize = 0; + ctgGetGlobalCacheSize(&cacheSize); + bool overflow = CTG_CACHE_OVERFLOW(cacheSize, cacheMaxSize); + + qDebug("catalog cache size: %" PRIu64"B, maxCaseSize:%dMB, %s", cacheSize, cacheMaxSize, overflow ? "overflow" : "NO overflow"); + + if (overflow) { + int32_t code = ctgClearCacheEnqueue(NULL, true, false, false, false); + if (code) { + qError("clear cache enqueue failed, error:%s", tstrerror(code)); + taosTmrReset(ctgProcessTimerEvent, CTG_DEFAULT_CACHE_MON_MSEC, NULL, gCtgMgmt.timer, &gCtgMgmt.cacheTimer); + } + + goto _return; + } + } + + qTrace("reset catalog timer"); + taosTmrReset(ctgProcessTimerEvent, CTG_DEFAULT_CACHE_MON_MSEC, NULL, gCtgMgmt.timer, &gCtgMgmt.cacheTimer); + +_return: + + CTG_API_NLEAVE(); +} + int32_t ctgGetDBCfg(SCatalog* pCtg, SRequestConnInfo* pConn, const char* dbFName, SDbCfgInfo* pDbCfg) { CTG_ERR_RET(ctgReadDBCfgFromCache(pCtg, dbFName, pDbCfg)); @@ -686,6 +716,7 @@ int32_t ctgGetDBCfg(SCatalog* pCtg, SRequestConnInfo* pConn, const char* dbFName int32_t catalogInit(SCatalogCfg* cfg) { + qDebug("catalogInit start"); if (gCtgMgmt.pCluster) { qError("catalog already initialized"); CTG_ERR_RET(TSDB_CODE_CTG_INVALID_INPUT); @@ -743,6 +774,18 @@ int32_t catalogInit(SCatalogCfg* cfg) { CTG_ERR_RET(terrno); } + gCtgMgmt.timer = taosTmrInit(0, 0, 0, "catalog"); + if (NULL == gCtgMgmt.timer) { + qError("init timer failed, error:%s", tstrerror(terrno)); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + + gCtgMgmt.cacheTimer = taosTmrStart(ctgProcessTimerEvent, CTG_DEFAULT_CACHE_MON_MSEC, NULL, gCtgMgmt.timer); + if (NULL == gCtgMgmt.cacheTimer) { + qError("start cache timer failed"); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + CTG_ERR_RET(ctgStartUpdateThread()); qDebug("catalog initialized, maxDb:%u, maxTbl:%u, dbRentSec:%u, stbRentSec:%u", gCtgMgmt.cfg.maxDBCacheNum, @@ -786,8 +829,8 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) { clusterCtg->clusterId = clusterId; - CTG_ERR_JRET(ctgMetaRentInit(&clusterCtg->dbRent, gCtgMgmt.cfg.dbRentSec, CTG_RENT_DB)); - CTG_ERR_JRET(ctgMetaRentInit(&clusterCtg->stbRent, gCtgMgmt.cfg.stbRentSec, CTG_RENT_STABLE)); + CTG_ERR_JRET(ctgMetaRentInit(&clusterCtg->dbRent, gCtgMgmt.cfg.dbRentSec, CTG_RENT_DB, sizeof(SDbCacheInfo))); + CTG_ERR_JRET(ctgMetaRentInit(&clusterCtg->stbRent, gCtgMgmt.cfg.stbRentSec, CTG_RENT_STABLE, sizeof(SSTableVersion))); clusterCtg->dbCache = taosHashInit(gCtgMgmt.cfg.maxDBCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK); @@ -1139,6 +1182,22 @@ _return: CTG_API_LEAVE(code); } +int32_t catalogAsyncUpdateTableMeta(SCatalog* pCtg, STableMetaRsp* pMsg) { + CTG_API_ENTER(); + + if (NULL == pCtg || NULL == pMsg) { + CTG_API_LEAVE(TSDB_CODE_CTG_INVALID_INPUT); + } + + int32_t code = 0; + CTG_ERR_JRET(ctgUpdateTbMeta(pCtg, pMsg, false)); + +_return: + + CTG_API_LEAVE(code); +} + + int32_t catalogChkTbMetaVersion(SCatalog* pCtg, SRequestConnInfo* pConn, SArray* pTables) { CTG_API_ENTER(); @@ -1600,11 +1659,11 @@ int32_t catalogClearCache(void) { qInfo("start to clear catalog cache"); - if (NULL == gCtgMgmt.pCluster || atomic_load_8((int8_t*)&gCtgMgmt.exit)) { + if (NULL == gCtgMgmt.pCluster) { CTG_API_LEAVE_NOLOCK(TSDB_CODE_SUCCESS); } - int32_t code = ctgClearCacheEnqueue(NULL, false, false, true); + int32_t code = ctgClearCacheEnqueue(NULL, false, false, false, true); qInfo("clear catalog cache end, code: %s", tstrerror(code)); @@ -1618,10 +1677,17 @@ void catalogDestroy(void) { return; } + if (gCtgMgmt.cacheTimer) { + taosTmrStop(gCtgMgmt.cacheTimer); + gCtgMgmt.cacheTimer = NULL; + taosTmrCleanUp(gCtgMgmt.timer); + gCtgMgmt.timer = NULL; + } + atomic_store_8((int8_t*)&gCtgMgmt.exit, true); if (!taosCheckCurrentInDll()) { - ctgClearCacheEnqueue(NULL, true, true, true); + ctgClearCacheEnqueue(NULL, false, true, true, true); taosThreadJoin(gCtgMgmt.updateThread, NULL); } diff --git a/source/libs/catalog/src/ctgCache.c b/source/libs/catalog/src/ctgCache.c index debd5f567c..ef4040e22b 100644 --- a/source/libs/catalog/src/ctgCache.c +++ b/source/libs/catalog/src/ctgCache.c @@ -33,24 +33,25 @@ SCtgOperation gCtgCacheOperation[CTG_OP_MAX] = {{CTG_OP_UPDATE_VGROUP, "update v {CTG_OP_CLEAR_CACHE, "clear cache", ctgOpClearCache}}; SCtgCacheItemInfo gCtgStatItem[CTG_CI_MAX_VALUE] = { - {"Cluster ", CTG_CI_FLAG_LEVEL_GLOBAL}, // CTG_CI_CLUSTER - {"Dnode ", CTG_CI_FLAG_LEVEL_CLUSTER}, // CTG_CI_DNODE, - {"Qnode ", CTG_CI_FLAG_LEVEL_CLUSTER}, // CTG_CI_QNODE, - {"DB ", CTG_CI_FLAG_LEVEL_CLUSTER}, // CTG_CI_DB, - {"DbVgroup ", CTG_CI_FLAG_LEVEL_DB}, // CTG_CI_DB_VGROUP, - {"DbCfg ", CTG_CI_FLAG_LEVEL_DB}, // CTG_CI_DB_CFG, - {"DbInfo ", CTG_CI_FLAG_LEVEL_DB}, // CTG_CI_DB_INFO, - {"StbMeta ", CTG_CI_FLAG_LEVEL_DB}, // CTG_CI_STABLE_META, - {"NtbMeta ", CTG_CI_FLAG_LEVEL_DB}, // CTG_CI_NTABLE_META, - {"CtbMeta ", CTG_CI_FLAG_LEVEL_DB}, // CTG_CI_CTABLE_META, - {"SysTblMeta", CTG_CI_FLAG_LEVEL_DB}, // CTG_CI_SYSTABLE_META, - {"OthTblMeta", CTG_CI_FLAG_LEVEL_DB}, // CTG_CI_OTHERTABLE_META, - {"TblSMA ", CTG_CI_FLAG_LEVEL_DB}, // CTG_CI_TBL_SMA, - {"TblCfg ", CTG_CI_FLAG_LEVEL_DB}, // CTG_CI_TBL_CFG, - {"IndexInfo ", CTG_CI_FLAG_LEVEL_DB}, // CTG_CI_INDEX_INFO, - {"User ", CTG_CI_FLAG_LEVEL_CLUSTER}, // CTG_CI_USER, - {"UDF ", CTG_CI_FLAG_LEVEL_CLUSTER}, // CTG_CI_UDF, - {"SvrVer ", CTG_CI_FLAG_LEVEL_CLUSTER} // CTG_CI_SVR_VER, + {"Cluster ", CTG_CI_FLAG_LEVEL_GLOBAL}, //CTG_CI_CLUSTER + {"Dnode ", CTG_CI_FLAG_LEVEL_CLUSTER}, //CTG_CI_DNODE, + {"Qnode ", CTG_CI_FLAG_LEVEL_CLUSTER}, //CTG_CI_QNODE, + {"DB ", CTG_CI_FLAG_LEVEL_CLUSTER}, //CTG_CI_DB, + {"DbVgroup ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_DB_VGROUP, + {"DbCfg ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_DB_CFG, + {"DbInfo ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_DB_INFO, + {"StbMeta ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_STABLE_META, + {"NtbMeta ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_NTABLE_META, + {"CtbMeta ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_CTABLE_META, + {"SysTblMeta", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_SYSTABLE_META, + {"OthTblMeta", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_OTHERTABLE_META, + {"TblSMA ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_TBL_SMA, + {"TblCfg ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_TBL_CFG, + {"TblTag ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_TBL_TAG, + {"IndexInfo ", CTG_CI_FLAG_LEVEL_DB}, //CTG_CI_INDEX_INFO, + {"User ", CTG_CI_FLAG_LEVEL_CLUSTER}, //CTG_CI_USER, + {"UDF ", CTG_CI_FLAG_LEVEL_CLUSTER}, //CTG_CI_UDF, + {"SvrVer ", CTG_CI_FLAG_LEVEL_CLUSTER} //CTG_CI_SVR_VER, }; int32_t ctgRLockVgInfo(SCatalog *pCtg, SCtgDBCache *dbCache, bool *inCache) { @@ -860,7 +861,7 @@ int32_t ctgEnqueue(SCatalog *pCtg, SCtgCacheOperation *operation) { CTG_UNLOCK(CTG_WRITE, &gCtgMgmt.queue.qlock); - ctgDebug("action [%s] added into queue", opName); + ctgDebug("%sync action [%s] added into queue", syncOp ? "S": "As", opName); CTG_QUEUE_INC(); CTG_STAT_RT_INC(numOfOpEnqueue, 1); @@ -1242,7 +1243,7 @@ _return: CTG_RET(code); } -int32_t ctgClearCacheEnqueue(SCatalog *pCtg, bool freeCtg, bool stopQueue, bool syncOp) { +int32_t ctgClearCacheEnqueue(SCatalog *pCtg, bool clearMeta, bool freeCtg, bool stopQueue, bool syncOp) { int32_t code = 0; SCtgCacheOperation *op = taosMemoryCalloc(1, sizeof(SCtgCacheOperation)); op->opId = CTG_OP_CLEAR_CACHE; @@ -1258,6 +1259,7 @@ int32_t ctgClearCacheEnqueue(SCatalog *pCtg, bool freeCtg, bool stopQueue, bool } msg->pCtg = pCtg; + msg->clearMeta = clearMeta; msg->freeCtg = freeCtg; op->data = msg; @@ -1270,10 +1272,11 @@ _return: CTG_RET(code); } -int32_t ctgMetaRentInit(SCtgRentMgmt *mgmt, uint32_t rentSec, int8_t type) { +int32_t ctgMetaRentInit(SCtgRentMgmt *mgmt, uint32_t rentSec, int8_t type, int32_t size) { mgmt->slotRIdx = 0; mgmt->slotNum = rentSec / CTG_RENT_SLOT_SECOND; mgmt->type = type; + mgmt->metaSize = size; size_t msgSize = sizeof(SCtgRentSlot) * mgmt->slotNum; @@ -1283,6 +1286,8 @@ int32_t ctgMetaRentInit(SCtgRentMgmt *mgmt, uint32_t rentSec, int8_t type) { CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } + mgmt->rentCacheSize = msgSize; + qDebug("meta rent initialized, type:%d, slotNum:%d", type, mgmt->slotNum); return TSDB_CODE_SUCCESS; @@ -1309,6 +1314,7 @@ int32_t ctgMetaRentAdd(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t size) CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); } + mgmt->rentCacheSize += size; slot->needSort = true; qDebug("add meta to rent, id:0x%" PRIx64 ", slot idx:%d, type:%d", id, widx, mgmt->type); @@ -1389,6 +1395,7 @@ int32_t ctgMetaRentRemove(SCtgRentMgmt *mgmt, int64_t id, __compar_fn_t sortComp } taosArrayRemove(slot->meta, idx); + mgmt->rentCacheSize -= mgmt->metaSize; qDebug("meta in rent removed, id:0x%" PRIx64 ", slot idx:%d, type:%d", id, widx, mgmt->type); @@ -1656,10 +1663,15 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam } if (origType == TSDB_SUPER_TABLE) { - if (taosHashRemove(dbCache->stbCache, &orig->suid, sizeof(orig->suid))) { - ctgError("stb not exist in stbCache, dbFName:%s, stb:%s, suid:0x%" PRIx64, dbFName, tbName, orig->suid); - } else { - ctgDebug("stb removed from stbCache, dbFName:%s, stb:%s, suid:0x%" PRIx64, dbFName, tbName, orig->suid); + char *stbName = taosHashGet(dbCache->stbCache, &orig->suid, sizeof(orig->suid)); + if (stbName) { + uint64_t metaSize = strlen(stbName) + 1 + sizeof(orig->suid); + if (taosHashRemove(dbCache->stbCache, &orig->suid, sizeof(orig->suid))) { + ctgError("stb not exist in stbCache, dbFName:%s, stb:%s, suid:0x%" PRIx64, dbFName, tbName, orig->suid); + } else { + ctgDebug("stb removed from stbCache, dbFName:%s, stb:%s, suid:0x%" PRIx64, dbFName, tbName, orig->suid); + atomic_sub_fetch_64(&dbCache->dbCacheSize, metaSize); + } } } } @@ -1673,14 +1685,20 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } + atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(tbName) + sizeof(SCtgTbCache) + ctgGetTbMetaCacheSize(meta)); + pCache = taosHashGet(dbCache->tbCache, tbName, strlen(tbName)); } else { CTG_LOCK(CTG_WRITE, &pCache->metaLock); if (orig) { CTG_META_NUM_DEC(origType); } + + atomic_add_fetch_64(&dbCache->dbCacheSize, ctgGetTbMetaCacheSize(meta) - ctgGetTbMetaCacheSize(pCache->pMeta)); + taosMemoryFree(pCache->pMeta); pCache->pMeta = meta; + CTG_UNLOCK(CTG_WRITE, &pCache->metaLock); } @@ -1698,6 +1716,8 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } + atomic_add_fetch_64(&dbCache->dbCacheSize, sizeof(meta->suid) + strlen(tbName) + 1); + ctgDebug("stb 0x%" PRIx64 " updated to cache, dbFName:%s, tbName:%s, tbType:%d", meta->suid, dbFName, tbName, meta->tableType); @@ -1730,6 +1750,8 @@ int32_t ctgWriteTbIndexToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNa CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } + atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(tbName) + sizeof(SCtgTbCache) + ctgGetTbIndexCacheSize(pIndex)); + CTG_DB_NUM_INC(CTG_CI_TBL_SMA); *index = NULL; @@ -1746,6 +1768,7 @@ int32_t ctgWriteTbIndexToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNa CTG_LOCK(CTG_WRITE, &pCache->indexLock); if (pCache->pIndex) { + atomic_sub_fetch_64(&dbCache->dbCacheSize, ctgGetTbIndexCacheSize(pCache->pIndex)); if (0 == suid) { suid = pCache->pIndex->suid; } @@ -1756,6 +1779,8 @@ int32_t ctgWriteTbIndexToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNa pCache->pIndex = pIndex; CTG_UNLOCK(CTG_WRITE, &pCache->indexLock); + atomic_add_fetch_64(&dbCache->dbCacheSize, ctgGetTbIndexCacheSize(pIndex)); + *index = NULL; ctgDebug("table %s index updated to cache, ver:%d, num:%d", tbName, pIndex->version, @@ -1785,7 +1810,7 @@ _return: CTG_RET(code); } -void ctgClearAllInstance(void) { +void ctgClearAllHandles(void) { SCatalog *pCtg = NULL; void *pIter = taosHashIterate(gCtgMgmt.pCluster, NULL); @@ -1800,7 +1825,7 @@ void ctgClearAllInstance(void) { } } -void ctgFreeAllInstance(void) { +void ctgFreeAllHandles(void) { SCatalog *pCtg = NULL; void *pIter = taosHashIterate(gCtgMgmt.pCluster, NULL); @@ -1841,7 +1866,7 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) { goto _return; } - if (dbInfo->vgVersion < 0 || taosHashGetSize(dbInfo->vgHash) <= 0) { + if (dbInfo->vgVersion < 0 || (taosHashGetSize(dbInfo->vgHash) <= 0 && !IS_SYS_DBNAME(dbFName))) { ctgDebug("invalid db vgInfo, dbFName:%s, vgHash:%p, vgVersion:%d, vgHashSize:%d", dbFName, dbInfo->vgHash, dbInfo->vgVersion, taosHashGetSize(dbInfo->vgHash)); CTG_ERR_JRET(TSDB_CODE_APP_ERROR); @@ -1859,6 +1884,7 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) { } SCtgVgCache *vgCache = &dbCache->vgCache; + CTG_ERR_JRET(ctgWLockVgInfo(msg->pCtg, dbCache)); if (vgCache->vgInfo) { @@ -1881,6 +1907,11 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) { goto _return; } + uint64_t groupCacheSize = ctgGetDbVgroupCacheSize(vgCache->vgInfo); + ctgDebug("sub dbGroupCacheSize %" PRIu64 " from db, dbFName:%s", groupCacheSize, dbFName); + + atomic_sub_fetch_64(&dbCache->dbCacheSize, groupCacheSize); + freeVgInfo(vgInfo); CTG_DB_NUM_RESET(CTG_CI_DB_VGROUP); } @@ -1898,6 +1929,10 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) { ctgWUnlockVgInfo(dbCache); + uint64_t groupCacheSize = ctgGetDbVgroupCacheSize(vgCache->vgInfo); + atomic_add_fetch_64(&dbCache->dbCacheSize, groupCacheSize); + ctgDebug("add dbGroupCacheSize %" PRIu64 " from db, dbFName:%s", groupCacheSize, dbFName); + dbCache = NULL; // if (!IS_SYS_DBNAME(dbFName)) { @@ -2022,6 +2057,8 @@ int32_t ctgOpDropDbVgroup(SCtgCacheOperation *operation) { CTG_ERR_JRET(ctgWLockVgInfo(pCtg, dbCache)); + atomic_sub_fetch_64(&dbCache->dbCacheSize, ctgGetDbVgroupCacheSize(dbCache->vgCache.vgInfo)); + freeVgInfo(dbCache->vgCache.vgInfo); dbCache->vgCache.vgInfo = NULL; @@ -2113,26 +2150,32 @@ int32_t ctgOpDropStbMeta(SCtgCacheOperation *operation) { goto _return; } - if (taosHashRemove(dbCache->stbCache, &msg->suid, sizeof(msg->suid))) { - ctgDebug("stb not exist in stbCache, may be removed, dbFName:%s, stb:%s, suid:0x%" PRIx64, msg->dbFName, - msg->stbName, msg->suid); + char *stbName = taosHashGet(dbCache->stbCache, &msg->suid, sizeof(msg->suid)); + if (stbName) { + uint64_t metaSize = strlen(stbName) + 1 + sizeof(msg->suid); + if (taosHashRemove(dbCache->stbCache, &msg->suid, sizeof(msg->suid))) { + ctgDebug("stb not exist in stbCache, may be removed, dbFName:%s, stb:%s, suid:0x%" PRIx64, msg->dbFName, + msg->stbName, msg->suid); + } else { + atomic_sub_fetch_64(&dbCache->dbCacheSize, metaSize); + } } - + SCtgTbCache *pTbCache = taosHashGet(dbCache->tbCache, msg->stbName, strlen(msg->stbName)); if (NULL == pTbCache) { ctgDebug("stb %s already not in cache", msg->stbName); goto _return; } - CTG_LOCK(CTG_WRITE, &pTbCache->metaLock); tblType = pTbCache->pMeta->tableType; - ctgFreeTbCacheImpl(pTbCache); - CTG_UNLOCK(CTG_WRITE, &pTbCache->metaLock); + atomic_sub_fetch_64(&dbCache->dbCacheSize, ctgGetTbMetaCacheSize(pTbCache->pMeta) + ctgGetTbIndexCacheSize(pTbCache->pIndex)); + ctgFreeTbCacheImpl(pTbCache, true); if (taosHashRemove(dbCache->tbCache, msg->stbName, strlen(msg->stbName))) { ctgError("stb not exist in cache, dbFName:%s, stb:%s, suid:0x%" PRIx64, msg->dbFName, msg->stbName, msg->suid); } else { CTG_META_NUM_DEC(tblType); + atomic_sub_fetch_64(&dbCache->dbCacheSize, sizeof(*pTbCache) + strlen(msg->stbName)); } ctgInfo("stb removed from cache, dbFName:%s, stbName:%s, suid:0x%" PRIx64, msg->dbFName, msg->stbName, msg->suid); @@ -2176,15 +2219,15 @@ int32_t ctgOpDropTbMeta(SCtgCacheOperation *operation) { goto _return; } - CTG_LOCK(CTG_WRITE, &pTbCache->metaLock); tblType = pTbCache->pMeta->tableType; - ctgFreeTbCacheImpl(pTbCache); - CTG_UNLOCK(CTG_WRITE, &pTbCache->metaLock); + atomic_sub_fetch_64(&dbCache->dbCacheSize, ctgGetTbMetaCacheSize(pTbCache->pMeta) + ctgGetTbIndexCacheSize(pTbCache->pIndex)); + ctgFreeTbCacheImpl(pTbCache, true); if (taosHashRemove(dbCache->tbCache, msg->tbName, strlen(msg->tbName))) { ctgError("tb %s not exist in cache, dbFName:%s", msg->tbName, msg->dbFName); CTG_ERR_JRET(TSDB_CODE_CTG_INTERNAL_ERROR); } else { + atomic_sub_fetch_64(&dbCache->dbCacheSize, sizeof(*pTbCache) + strlen(msg->tbName)); CTG_META_NUM_DEC(tblType); } @@ -2211,7 +2254,8 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) { SCtgUserAuth userAuth = {0}; memcpy(&userAuth.userAuth, &msg->userAuth, sizeof(msg->userAuth)); - + userAuth.userCacheSize = ctgGetUserCacheSize(&userAuth.userAuth); + if (taosHashPut(pCtg->userCache, msg->userAuth.user, strlen(msg->userAuth.user), &userAuth, sizeof(userAuth))) { ctgError("taosHashPut user %s to cache failed", msg->userAuth.user); CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); @@ -2243,6 +2287,8 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) { msg->userAuth.useDbs = NULL; CTG_UNLOCK(CTG_WRITE, &pUser->lock); + + atomic_store_64(&pUser->userCacheSize, ctgGetUserCacheSize(&pUser->userAuth)); _return: @@ -2378,33 +2424,78 @@ _return: CTG_RET(code); } -int32_t ctgOpClearCache(SCtgCacheOperation *operation) { - int32_t code = 0; +void ctgClearFreeCache(SCtgCacheOperation *operation) { SCtgClearCacheMsg *msg = operation->data; SCatalog *pCtg = msg->pCtg; CTG_LOCK(CTG_WRITE, &gCtgMgmt.lock); - + if (pCtg) { if (msg->freeCtg) { ctgFreeHandle(pCtg); } else { ctgClearHandle(pCtg); } + } else if (msg->freeCtg) { + ctgFreeAllHandles(); + } else { + ctgClearAllHandles(); + } + + CTG_UNLOCK(CTG_WRITE, &gCtgMgmt.lock); +} - goto _return; +void ctgClearMetaCache(SCtgCacheOperation *operation) { + SCtgClearCacheMsg *msg = operation->data; + SCatalog *pCtg = msg->pCtg; + int64_t clearedSize = 0; + int64_t clearedNum = 0; + int64_t remainSize = 0; + bool roundDone = false; + + if (pCtg) { + ctgClearHandleMeta(pCtg, &clearedSize, &clearedNum, &roundDone); + } else { + ctgClearAllHandleMeta(&clearedSize, &clearedNum, &roundDone); } - if (msg->freeCtg) { - ctgFreeAllInstance(); + qDebug("catalog finish one round meta clear, clearedSize:%" PRId64 ", clearedNum:%" PRId64 ", done:%d", clearedSize, clearedNum, roundDone); + + ctgGetGlobalCacheSize(&remainSize); + int32_t cacheMaxSize = atomic_load_32(&tsMetaCacheMaxSize); + + if (CTG_CACHE_LOW(remainSize, cacheMaxSize)) { + qDebug("catalog finish meta clear, remainSize:%" PRId64 ", cacheMaxSize:%dMB", remainSize, cacheMaxSize); + taosTmrReset(ctgProcessTimerEvent, CTG_DEFAULT_CACHE_MON_MSEC, NULL, gCtgMgmt.timer, &gCtgMgmt.cacheTimer); + return; + } + + if (!roundDone) { + qDebug("catalog all meta cleared, remainSize:%" PRId64 ", cacheMaxSize:%dMB, to clear handle", remainSize, cacheMaxSize); + ctgClearFreeCache(operation); + taosTmrReset(ctgProcessTimerEvent, CTG_DEFAULT_CACHE_MON_MSEC, NULL, gCtgMgmt.timer, &gCtgMgmt.cacheTimer); + return; + } + + int32_t code = ctgClearCacheEnqueue(NULL, true, false, false, false); + if (code) { + qError("clear cache enqueue failed, error:%s", tstrerror(code)); + taosTmrReset(ctgProcessTimerEvent, CTG_DEFAULT_CACHE_MON_MSEC, NULL, gCtgMgmt.timer, &gCtgMgmt.cacheTimer); + } +} + +int32_t ctgOpClearCache(SCtgCacheOperation *operation) { + int32_t code = 0; + SCtgClearCacheMsg *msg = operation->data; + + if (msg->clearMeta) { + ctgClearMetaCache(operation); } else { - ctgClearAllInstance(); + ctgClearFreeCache(operation); } _return: - CTG_UNLOCK(CTG_WRITE, &gCtgMgmt.lock); - taosMemoryFreeClear(msg); CTG_RET(code); diff --git a/source/libs/catalog/src/ctgDbg.c b/source/libs/catalog/src/ctgDbg.c index 8924e8c27c..b90e51f1bc 100644 --- a/source/libs/catalog/src/ctgDbg.c +++ b/source/libs/catalog/src/ctgDbg.c @@ -19,7 +19,7 @@ #include "trpc.h" extern SCatalogMgmt gCtgMgmt; -SCtgDebug gCTGDebug = {0}; +SCtgDebug gCTGDebug = {.statEnable = true}; #if 0 @@ -547,7 +547,10 @@ int32_t ctgdShowStatInfo(void) { CTG_API_ENTER(); SCtgCacheStat cache; + uint64_t cacheSize = 0; + ctgGetGlobalCacheStat(&cache); + ctgGetGlobalCacheSize(&cacheSize); qDebug("## Global Stat Info %s ##", "begin"); qDebug("## \t%s \t%s \t%s ##", "Num", "Hit", "Nhit"); @@ -555,6 +558,7 @@ int32_t ctgdShowStatInfo(void) { qDebug("# %s \t%" PRIu64 " \t%" PRIu64 " \t%" PRIu64 " #", gCtgStatItem[i].name, cache.cacheNum[i], cache.cacheHit[i], cache.cacheNHit[i]); } qDebug("## Global Stat Info %s ##", "end"); + qDebug("## Global Cache Size: %" PRIu64, cacheSize); CTG_API_LEAVE(TSDB_CODE_SUCCESS); } diff --git a/source/libs/catalog/src/ctgUtil.c b/source/libs/catalog/src/ctgUtil.c index ae8fe0cca4..cf864e8643 100644 --- a/source/libs/catalog/src/ctgUtil.c +++ b/source/libs/catalog/src/ctgUtil.c @@ -199,6 +199,7 @@ void ctgFreeMetaRent(SCtgRentMgmt* mgmt) { } taosMemoryFreeClear(mgmt->slots); + mgmt->rentCacheSize = 0; } void ctgFreeStbMetaCache(SCtgDBCache* dbCache) { @@ -211,12 +212,26 @@ void ctgFreeStbMetaCache(SCtgDBCache* dbCache) { dbCache->stbCache = NULL; } -void ctgFreeTbCacheImpl(SCtgTbCache* pCache) { - qDebug("tbMeta freed, p:%p", pCache->pMeta); - taosMemoryFreeClear(pCache->pMeta); +void ctgFreeTbCacheImpl(SCtgTbCache* pCache, bool lock) { + if (pCache->pMeta) { + if (lock) { + CTG_LOCK(CTG_WRITE, &pCache->metaLock); + } + taosMemoryFreeClear(pCache->pMeta); + if (lock) { + CTG_UNLOCK(CTG_WRITE, &pCache->metaLock); + } + } + if (pCache->pIndex) { + if (lock) { + CTG_LOCK(CTG_WRITE, &pCache->indexLock); + } taosArrayDestroyEx(pCache->pIndex->pIndex, tFreeSTableIndexInfo); taosMemoryFreeClear(pCache->pIndex); + if (lock) { + CTG_UNLOCK(CTG_WRITE, &pCache->indexLock); + } } } @@ -228,7 +243,7 @@ void ctgFreeTbCache(SCtgDBCache* dbCache) { int32_t tblNum = taosHashGetSize(dbCache->tbCache); SCtgTbCache* pCache = taosHashIterate(dbCache->tbCache, NULL); while (NULL != pCache) { - ctgFreeTbCacheImpl(pCache); + ctgFreeTbCacheImpl(pCache, false); pCache = taosHashIterate(dbCache->tbCache, pCache); } taosHashCleanup(dbCache->tbCache); @@ -316,21 +331,86 @@ void ctgFreeHandle(SCatalog* pCtg) { ctgInfo("handle freed, clusterId:0x%" PRIx64, clusterId); } +void ctgClearHandleMeta(SCatalog* pCtg, int64_t *pClearedSize, int64_t *pCleardNum, bool *roundDone) { + int64_t cacheSize = 0; + void* pIter = taosHashIterate(pCtg->dbCache, NULL); + while (pIter) { + SCtgDBCache* dbCache = pIter; + + SCtgTbCache* pCache = taosHashIterate(dbCache->tbCache, NULL); + while (NULL != pCache) { + size_t len = 0; + void* key = taosHashGetKey(pCache, &len); + + if (pCache->pMeta && TSDB_SUPER_TABLE == pCache->pMeta->tableType) { + pCache = taosHashIterate(dbCache->tbCache, pCache); + continue; + } + + taosHashRemove(dbCache->tbCache, key, len); + cacheSize = len + sizeof(SCtgTbCache) + ctgGetTbMetaCacheSize(pCache->pMeta) + ctgGetTbIndexCacheSize(pCache->pIndex); + atomic_sub_fetch_64(&dbCache->dbCacheSize, cacheSize); + *pClearedSize += cacheSize; + (*pCleardNum)++; + + if (pCache->pMeta) { + CTG_META_NUM_DEC(pCache->pMeta->tableType); + } + + ctgFreeTbCacheImpl(pCache, true); + + if (*pCleardNum >= CTG_CLEAR_CACHE_ROUND_TB_NUM) { + taosHashCancelIterate(dbCache->tbCache, pCache); + goto _return; + } + + pCache = taosHashIterate(dbCache->tbCache, pCache); + } + + pIter = taosHashIterate(pCtg->dbCache, pIter); + } + +_return: + + if (*pCleardNum >= CTG_CLEAR_CACHE_ROUND_TB_NUM) { + *roundDone = true; + } +} + +void ctgClearAllHandleMeta(int64_t *clearedSize, int64_t *clearedNum, bool *roundDone) { + SCatalog *pCtg = NULL; + + void *pIter = taosHashIterate(gCtgMgmt.pCluster, NULL); + while (pIter) { + pCtg = *(SCatalog **)pIter; + + if (pCtg) { + ctgClearHandleMeta(pCtg, clearedSize, clearedNum, roundDone); + if (*roundDone) { + taosHashCancelIterate(gCtgMgmt.pCluster, pIter); + break; + } + } + + pIter = taosHashIterate(gCtgMgmt.pCluster, pIter); + } +} + void ctgClearHandle(SCatalog* pCtg) { if (NULL == pCtg) { return; } uint64_t clusterId = pCtg->clusterId; - + ctgFreeMetaRent(&pCtg->dbRent); ctgFreeMetaRent(&pCtg->stbRent); ctgFreeInstDbCache(pCtg->dbCache); ctgFreeInstUserCache(pCtg->userCache); - ctgMetaRentInit(&pCtg->dbRent, gCtgMgmt.cfg.dbRentSec, CTG_RENT_DB); - ctgMetaRentInit(&pCtg->stbRent, gCtgMgmt.cfg.stbRentSec, CTG_RENT_STABLE); + ctgMetaRentInit(&pCtg->dbRent, gCtgMgmt.cfg.dbRentSec, CTG_RENT_DB, sizeof(SDbCacheInfo)); + ctgMetaRentInit(&pCtg->stbRent, gCtgMgmt.cfg.stbRentSec, CTG_RENT_STABLE, sizeof(SSTableVersion)); pCtg->dbCache = taosHashInit(gCtgMgmt.cfg.maxDBCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK); @@ -1624,6 +1704,130 @@ void catalogFreeMetaData(SMetaData* pData) { } #endif +uint64_t ctgGetTbIndexCacheSize(STableIndex *pIndex) { + if (NULL == pIndex) { + return 0; + } + + return sizeof(*pIndex) + pIndex->indexSize; +} + +FORCE_INLINE uint64_t ctgGetTbMetaCacheSize(STableMeta *pMeta) { + if (NULL == pMeta) { + return 0; + } + + switch (pMeta->tableType) { + case TSDB_SUPER_TABLE: + return sizeof(*pMeta) + (pMeta->tableInfo.numOfColumns + pMeta->tableInfo.numOfTags) * sizeof(SSchema); + case TSDB_CHILD_TABLE: + return sizeof(SCTableMeta); + default: + return sizeof(*pMeta) + pMeta->tableInfo.numOfColumns * sizeof(SSchema); + } + + return 0; +} + +uint64_t ctgGetDbVgroupCacheSize(SDBVgInfo *pVg) { + if (NULL == pVg) { + return 0; + } + + return sizeof(*pVg) + taosHashGetSize(pVg->vgHash) * (sizeof(SVgroupInfo) + sizeof(int32_t)) + + taosArrayGetSize(pVg->vgArray) * sizeof(SVgroupInfo); +} + +uint64_t ctgGetUserCacheSize(SGetUserAuthRsp *pAuth) { + if (NULL == pAuth) { + return 0; + } + + uint64_t cacheSize = 0; + char* p = taosHashIterate(pAuth->createdDbs, NULL); + while (p != NULL) { + size_t len = 0; + void* key = taosHashGetKey(p, &len); + cacheSize += len + strlen(p); + + p = taosHashIterate(pAuth->createdDbs, p); + } + + p = taosHashIterate(pAuth->readDbs, NULL); + while (p != NULL) { + size_t len = 0; + void* key = taosHashGetKey(p, &len); + cacheSize += len + strlen(p); + + p = taosHashIterate(pAuth->readDbs, p); + } + + p = taosHashIterate(pAuth->writeDbs, NULL); + while (p != NULL) { + size_t len = 0; + void* key = taosHashGetKey(p, &len); + cacheSize += len + strlen(p); + + p = taosHashIterate(pAuth->writeDbs, p); + } + + p = taosHashIterate(pAuth->readTbs, NULL); + while (p != NULL) { + size_t len = 0; + void* key = taosHashGetKey(p, &len); + cacheSize += len + strlen(p); + + p = taosHashIterate(pAuth->readTbs, p); + } + + p = taosHashIterate(pAuth->writeTbs, NULL); + while (p != NULL) { + size_t len = 0; + void* key = taosHashGetKey(p, &len); + cacheSize += len + strlen(p); + + p = taosHashIterate(pAuth->writeTbs, p); + } + + int32_t *ref = taosHashIterate(pAuth->useDbs, NULL); + while (ref != NULL) { + size_t len = 0; + void* key = taosHashGetKey(ref, &len); + cacheSize += len + sizeof(*ref); + + ref = taosHashIterate(pAuth->useDbs, ref); + } + + return cacheSize; +} + +uint64_t ctgGetClusterCacheSize(SCatalog *pCtg) { + uint64_t cacheSize = sizeof(SCatalog); + + SCtgUserAuth* pAuth = taosHashIterate(pCtg->userCache, NULL); + while (pAuth != NULL) { + size_t len = 0; + void* key = taosHashGetKey(pAuth, &len); + cacheSize += len + sizeof(SCtgUserAuth) + atomic_load_64(&pAuth->userCacheSize); + + pAuth = taosHashIterate(pCtg->userCache, pAuth); + } + + SCtgDBCache* pDb = taosHashIterate(pCtg->dbCache, NULL); + while (pDb != NULL) { + size_t len = 0; + void* key = taosHashGetKey(pDb, &len); + cacheSize += len + sizeof(SCtgDBCache) + atomic_load_64(&pDb->dbCacheSize); + + pDb = taosHashIterate(pCtg->dbCache, pDb); + } + + cacheSize += pCtg->dbRent.rentCacheSize; + cacheSize += pCtg->stbRent.rentCacheSize; + + return cacheSize; +} + void ctgGetClusterCacheStat(SCatalog* pCtg) { for (int32_t i = 0; i < CTG_CI_MAX_VALUE; ++i) { if (0 == (gCtgStatItem[i].flag & CTG_CI_FLAG_LEVEL_DB)) { @@ -1688,3 +1892,23 @@ void ctgGetGlobalCacheStat(SCtgCacheStat* pStat) { memcpy(pStat, &gCtgMgmt.statInfo.cache, sizeof(gCtgMgmt.statInfo.cache)); } + +void ctgGetGlobalCacheSize(uint64_t *pSize) { + *pSize = 0; + + SCatalog* pCtg = NULL; + void* pIter = taosHashIterate(gCtgMgmt.pCluster, NULL); + while (pIter) { + size_t len = 0; + void* key = taosHashGetKey(pIter, &len); + *pSize += len + POINTER_BYTES; + + pCtg = *(SCatalog**)pIter; + if (pCtg) { + *pSize += ctgGetClusterCacheSize(pCtg); + } + + pIter = taosHashIterate(gCtgMgmt.pCluster, pIter); + } +} + diff --git a/source/libs/catalog/test/catalogTests.cpp b/source/libs/catalog/test/catalogTests.cpp index 66d2de083b..e0e456402b 100644 --- a/source/libs/catalog/test/catalogTests.cpp +++ b/source/libs/catalog/test/catalogTests.cpp @@ -37,6 +37,7 @@ #include "tglobal.h" #include "trpc.h" #include "tvariant.h" +#include "ttimer.h" namespace { @@ -150,6 +151,7 @@ void ctgTestInitLogFile() { tsAsyncLog = 0; qDebugFlag = 159; + tmrDebugFlag = 159; strcpy(tsLogDir, TD_LOG_DIR_PATH); ctgdEnableDebug("api", true); @@ -1746,6 +1748,8 @@ TEST(tableMeta, updateStbMeta) { code = catalogUpdateTableMeta(pCtg, &rsp); ASSERT_EQ(code, 0); + code = catalogAsyncUpdateTableMeta(pCtg, &rsp); + ASSERT_EQ(code, 0); taosMemoryFreeClear(rsp.pSchemas); while (true) { diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index 6efdd8d8eb..f59653700b 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -48,6 +48,7 @@ static int32_t buildRetrieveTableRsp(SSDataBlock* pBlock, int32_t numOfCols, SRe static int32_t getSchemaBytes(const SSchema* pSchema) { switch (pSchema->type) { case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_GEOMETRY: return (pSchema->bytes - VARSTR_HEADER_SIZE); case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_JSON: @@ -448,7 +449,7 @@ void appendColumnFields(char* buf, int32_t* len, STableCfg* pCfg) { SSchema* pSchema = pCfg->pSchemas + i; char type[32]; sprintf(type, "%s", tDataTypes[pSchema->type].name); - if (TSDB_DATA_TYPE_VARCHAR == pSchema->type) { + if (TSDB_DATA_TYPE_VARCHAR == pSchema->type || TSDB_DATA_TYPE_GEOMETRY == pSchema->type) { sprintf(type + strlen(type), "(%d)", (int32_t)(pSchema->bytes - VARSTR_HEADER_SIZE)); } else if (TSDB_DATA_TYPE_NCHAR == pSchema->type) { sprintf(type + strlen(type), "(%d)", (int32_t)((pSchema->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE)); @@ -463,7 +464,7 @@ void appendTagFields(char* buf, int32_t* len, STableCfg* pCfg) { SSchema* pSchema = pCfg->pSchemas + pCfg->numOfColumns + i; char type[32]; sprintf(type, "%s", tDataTypes[pSchema->type].name); - if (TSDB_DATA_TYPE_VARCHAR == pSchema->type) { + if (TSDB_DATA_TYPE_VARCHAR == pSchema->type || TSDB_DATA_TYPE_GEOMETRY == pSchema->type) { sprintf(type + strlen(type), "(%d)", (int32_t)(pSchema->bytes - VARSTR_HEADER_SIZE)); } else if (TSDB_DATA_TYPE_NCHAR == pSchema->type) { sprintf(type + strlen(type), "(%d)", (int32_t)((pSchema->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE)); @@ -539,7 +540,7 @@ int32_t appendTagValues(char* buf, int32_t* len, STableCfg* pCfg) { } /* - if (type == TSDB_DATA_TYPE_BINARY) { + if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_GEOMETRY) { if (pTagVal->nData > 0) { if (num) { *len += sprintf(buf + VARSTR_HEADER_SIZE + *len, ", "); @@ -748,7 +749,7 @@ static int32_t execAlterLocal(SAlterLocalStmt* pStmt) { return terrno; } - if (taosSetCfg(tsCfg, pStmt->config)) { + if (taosApplyLocalCfg(tsCfg, pStmt->config)) { return terrno; } diff --git a/source/libs/executor/src/executorInt.c b/source/libs/executor/src/executorInt.c index 5e0e7b0d6a..521b9284a8 100644 --- a/source/libs/executor/src/executorInt.c +++ b/source/libs/executor/src/executorInt.c @@ -275,7 +275,7 @@ static int32_t doCreateConstantValColumnInfo(SInputColumnInfoData* pInput, SFunc for (int32_t i = 0; i < numOfRows; ++i) { colDataSetDouble(pColInfo, i, &v); } - } else if (type == TSDB_DATA_TYPE_VARCHAR) { + } else if (type == TSDB_DATA_TYPE_VARCHAR || type == TSDB_DATA_TYPE_GEOMETRY) { char* tmp = taosMemoryMalloc(pFuncParam->param.nLen + VARSTR_HEADER_SIZE); STR_WITH_SIZE_TO_VARSTR(tmp, pFuncParam->param.pz, pFuncParam->param.nLen); for (int32_t i = 0; i < numOfRows; ++i) { diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index 859fad3803..7aac639027 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -885,7 +885,8 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition goto _error; } - pInfo->rowCapacity = blockDataGetCapacityInRow(pInfo->binfo.pRes, getBufPageSize(pInfo->pBuf)); + pInfo->rowCapacity = blockDataGetCapacityInRow(pInfo->binfo.pRes, getBufPageSize(pInfo->pBuf), + blockDataGetSerialMetaSize(taosArrayGetSize(pInfo->binfo.pRes->pDataBlock))); pInfo->columnOffset = setupColumnOffset(pInfo->binfo.pRes, pInfo->rowCapacity); code = initGroupOptrInfo(&pInfo->pGroupColVals, &pInfo->groupKeyLen, &pInfo->keyBuf, pInfo->pGroupCols); if (code != TSDB_CODE_SUCCESS) { diff --git a/source/libs/executor/src/timesliceoperator.c b/source/libs/executor/src/timesliceoperator.c index 6ed247a76d..3e4055876d 100644 --- a/source/libs/executor/src/timesliceoperator.c +++ b/source/libs/executor/src/timesliceoperator.c @@ -210,6 +210,45 @@ static bool isGroupKeyFunc(SExprInfo* pExprInfo) { return (functionType == FUNCTION_TYPE_GROUP_KEY); } +static bool getIgoreNullRes(SExprSupp* pExprSup) { + for (int32_t i = 0; i < pExprSup->numOfExprs; ++i) { + SExprInfo* pExprInfo = &pExprSup->pExprInfo[i]; + + if (isInterpFunc(pExprInfo)) { + for (int32_t j = 0; j < pExprInfo->base.numOfParams; ++j) { + SFunctParam *pFuncParam = &pExprInfo->base.pParam[j]; + if (pFuncParam->type == FUNC_PARAM_TYPE_VALUE) { + return pFuncParam->param.i ? true : false; + } + } + } + } + + return false; +} + +static bool checkNullRow(SExprSupp* pExprSup, SSDataBlock* pSrcBlock, int32_t index, bool ignoreNull) { + if (!ignoreNull) { + return false; + } + + for (int32_t j = 0; j < pExprSup->numOfExprs; ++j) { + SExprInfo* pExprInfo = &pExprSup->pExprInfo[j]; + + if (isInterpFunc(pExprInfo)) { + int32_t srcSlot = pExprInfo->base.pParam[0].pCol->slotId; + SColumnInfoData* pSrc = taosArrayGet(pSrcBlock->pDataBlock, srcSlot); + + if (colDataIsNull_s(pSrc, index)) { + return true; + } + } + } + + return false; +} + + static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp* pExprSup, SSDataBlock* pResBlock, SSDataBlock* pSrcBlock, int32_t index, bool beforeTs) { int32_t rows = pResBlock->info.rows; @@ -272,15 +311,27 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp if (pDst->info.type == TSDB_DATA_TYPE_FLOAT) { float v = 0; - GET_TYPED_DATA(v, float, pVar->nType, &pVar->i); + if (!IS_VAR_DATA_TYPE(pVar->nType)) { + GET_TYPED_DATA(v, float, pVar->nType, &pVar->i); + } else { + v = taosStr2Float(varDataVal(pVar->pz), NULL); + } colDataSetVal(pDst, rows, (char*)&v, false); } else if (pDst->info.type == TSDB_DATA_TYPE_DOUBLE) { double v = 0; - GET_TYPED_DATA(v, double, pVar->nType, &pVar->i); + if (!IS_VAR_DATA_TYPE(pVar->nType)) { + GET_TYPED_DATA(v, double, pVar->nType, &pVar->i); + } else { + v = taosStr2Double(varDataVal(pVar->pz), NULL); + } colDataSetVal(pDst, rows, (char*)&v, false); } else if (IS_SIGNED_NUMERIC_TYPE(pDst->info.type)) { int64_t v = 0; - GET_TYPED_DATA(v, int64_t, pVar->nType, &pVar->i); + if (!IS_VAR_DATA_TYPE(pVar->nType)) { + GET_TYPED_DATA(v, int64_t, pVar->nType, &pVar->i); + } else { + v = taosStr2int64(varDataVal(pVar->pz)); + } colDataSetVal(pDst, rows, (char*)&v, false); } else if (IS_BOOLEAN_TYPE(pDst->info.type)) { bool v = false; @@ -591,7 +642,7 @@ static int32_t resetKeeperInfo(STimeSliceOperatorInfo* pInfo) { } static void doTimesliceImpl(SOperatorInfo* pOperator, STimeSliceOperatorInfo* pSliceInfo, SSDataBlock* pBlock, - SExecTaskInfo* pTaskInfo) { + SExecTaskInfo* pTaskInfo, bool ignoreNull) { SSDataBlock* pResBlock = pSliceInfo->pRes; SInterval* pInterval = &pSliceInfo->interval; @@ -604,6 +655,10 @@ static void doTimesliceImpl(SOperatorInfo* pOperator, STimeSliceOperatorInfo* pS T_LONG_JMP(pTaskInfo->env, TSDB_CODE_FUNC_DUP_TIMESTAMP); } + if (checkNullRow(&pOperator->exprSupp, pBlock, i, ignoreNull)) { + continue; + } + if (pSliceInfo->current > pSliceInfo->win.ekey) { break; } @@ -733,6 +788,7 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { STimeSliceOperatorInfo* pSliceInfo = pOperator->info; SSDataBlock* pResBlock = pSliceInfo->pRes; SExprSupp* pSup = &pOperator->exprSupp; + bool ignoreNull = getIgoreNullRes(pSup); int32_t order = TSDB_ORDER_ASC; SInterval* pInterval = &pSliceInfo->interval; @@ -743,7 +799,7 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { while (1) { if (pSliceInfo->pNextGroupRes != NULL) { setInputDataBlock(pSup, pSliceInfo->pNextGroupRes, order, MAIN_SCAN, true); - doTimesliceImpl(pOperator, pSliceInfo, pSliceInfo->pNextGroupRes, pTaskInfo); + doTimesliceImpl(pOperator, pSliceInfo, pSliceInfo->pNextGroupRes, pTaskInfo, ignoreNull); copyPrevGroupKey(&pOperator->exprSupp, pSliceInfo->pPrevGroupKey, pSliceInfo->pNextGroupRes); pSliceInfo->pNextGroupRes = NULL; } @@ -777,7 +833,7 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) { // the pDataBlock are always the same one, no need to call this again setInputDataBlock(pSup, pBlock, order, MAIN_SCAN, true); - doTimesliceImpl(pOperator, pSliceInfo, pBlock, pTaskInfo); + doTimesliceImpl(pOperator, pSliceInfo, pBlock, pTaskInfo, ignoreNull); copyPrevGroupKey(&pOperator->exprSupp, pSliceInfo->pPrevGroupKey, pBlock); } diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 1adc171c5b..aa0aa9799b 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -343,7 +343,8 @@ void doTimeWindowInterpolation(SArray* pPrevValues, SArray* pDataBlock, TSKEY pr pCtx[k].end.key = curTs; pCtx[k].end.val = v2; - if (pColInfo->info.type == TSDB_DATA_TYPE_BINARY || pColInfo->info.type == TSDB_DATA_TYPE_NCHAR) { + if (pColInfo->info.type == TSDB_DATA_TYPE_BINARY || pColInfo->info.type == TSDB_DATA_TYPE_NCHAR || + pColInfo->info.type == TSDB_DATA_TYPE_GEOMETRY) { if (prevRowIndex == -1) { // pCtx[k].start.ptr = (char*)pRuntimeEnv->prevRow[index]; } else { @@ -447,15 +448,17 @@ static bool setTimeWindowInterpolationEndTs(SIntervalAggOperatorInfo* pInfo, SEx return true; } -bool inCalSlidingWindow(SInterval* pInterval, STimeWindow* pWin, TSKEY calStart, TSKEY calEnd) { - if (pInterval->interval != pInterval->sliding && (pWin->ekey < calStart || pWin->skey > calEnd)) { +bool inCalSlidingWindow(SInterval* pInterval, STimeWindow* pWin, TSKEY calStart, TSKEY calEnd, EStreamType blockType) { + if (pInterval->interval != pInterval->sliding && + ((pWin->ekey < calStart || pWin->skey > calEnd) || (blockType == STREAM_PULL_DATA && pWin->skey < calStart) )) { return false; } + return true; } bool inSlidingWindow(SInterval* pInterval, STimeWindow* pWin, SDataBlockInfo* pBlockInfo) { - return inCalSlidingWindow(pInterval, pWin, pBlockInfo->calWin.skey, pBlockInfo->calWin.ekey); + return inCalSlidingWindow(pInterval, pWin, pBlockInfo->calWin.skey, pBlockInfo->calWin.ekey, pBlockInfo->type); } static int32_t getNextQualifiedWindow(SInterval* pInterval, STimeWindow* pNext, SDataBlockInfo* pDataBlockInfo, @@ -1366,7 +1369,7 @@ static void doDeleteWindows(SOperatorInfo* pOperator, SInterval* pInterval, SSDa } do { - if (!inCalSlidingWindow(pInterval, &win, calStTsCols[i], calEnTsCols[i])) { + if (!inCalSlidingWindow(pInterval, &win, calStTsCols[i], calEnTsCols[i], pBlock->info.type)) { getNextTimeWindow(pInterval, pInterval->precision, TSDB_ORDER_ASC, &win); continue; } diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c index 211f78b981..783597df67 100644 --- a/source/libs/executor/src/tsort.c +++ b/source/libs/executor/src/tsort.c @@ -533,7 +533,8 @@ static int32_t doInternalMergeSort(SSortHandle* pHandle) { pHandle->numOfPages); } - int32_t numOfRows = blockDataGetCapacityInRow(pHandle->pDataBlock, pHandle->pageSize); + int32_t numOfRows = blockDataGetCapacityInRow(pHandle->pDataBlock, pHandle->pageSize, + blockDataGetSerialMetaSize(taosArrayGetSize(pHandle->pDataBlock->pDataBlock))); blockDataEnsureCapacity(pHandle->pDataBlock, numOfRows); // the initial pass + sortPass + final mergePass diff --git a/source/libs/executor/test/sortTests.cpp b/source/libs/executor/test/sortTests.cpp index 8122d7d6a9..b4d1884597 100644 --- a/source/libs/executor/test/sortTests.cpp +++ b/source/libs/executor/test/sortTests.cpp @@ -66,7 +66,7 @@ SSDataBlock* getSingleColDummyBlock(void* param) { colInfo.info.type = pInfo->type; if (pInfo->type == TSDB_DATA_TYPE_NCHAR) { colInfo.info.bytes = TSDB_NCHAR_SIZE * VARCOUNT + VARSTR_HEADER_SIZE; - } else if (pInfo->type == TSDB_DATA_TYPE_BINARY) { + } else if (pInfo->type == TSDB_DATA_TYPE_BINARY || pInfo->type == TSDB_DATA_TYPE_GEOMETRY) { colInfo.info.bytes = VARCOUNT + VARSTR_HEADER_SIZE; } else { colInfo.info.bytes = tDataTypes[pInfo->type].bytes; @@ -94,7 +94,7 @@ SSDataBlock* getSingleColDummyBlock(void* param) { colDataSetVal(pColInfo, i, reinterpret_cast(str), false); pBlock->info.hasVarCol = true; printf("nchar: %s\n", strOri); - } else if (pInfo->type == TSDB_DATA_TYPE_BINARY) { + } else if (pInfo->type == TSDB_DATA_TYPE_BINARY || pInfo->type == TSDB_DATA_TYPE_GEOMETRY) { int32_t size = taosRand() % VARCOUNT; char str[64] = {0}; taosRandStr(varDataVal(str), size); @@ -317,7 +317,7 @@ TEST(testCase, external_mem_sort_Test) { char buf[128] = {0}; int32_t len = taosUcs4ToMbs((TdUcs4 *)varDataVal(v), varDataLen(v), buf); printf("%d: %s\n", row++, buf); - }else if(pInfo[i].type == TSDB_DATA_TYPE_BINARY){ + }else if(pInfo[i].type == TSDB_DATA_TYPE_BINARY || pInfo[i]->type == TSDB_DATA_TYPE_GEOMETRY){ char buf[128] = {0}; memcpy(buf, varDataVal(v), varDataLen(v)); printf("%d: %s\n", row++, buf); diff --git a/source/libs/function/CMakeLists.txt b/source/libs/function/CMakeLists.txt index 39ebee4fb1..3a68648d49 100644 --- a/source/libs/function/CMakeLists.txt +++ b/source/libs/function/CMakeLists.txt @@ -32,6 +32,7 @@ target_link_libraries( PRIVATE nodes PRIVATE qcom PRIVATE scalar + PRIVATE geometry PRIVATE transport PUBLIC uv_a ) diff --git a/source/libs/function/inc/functionMgtInt.h b/source/libs/function/inc/functionMgtInt.h index a07038384e..2a8f60d4d2 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_INTERP_PC_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(23) +#define FUNC_MGT_GEOMETRY_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 fe98a1dd53..657b02c205 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -18,6 +18,7 @@ #include "cJSON.h" #include "querynodes.h" #include "scalar.h" +#include "geomFunc.h" #include "taoserror.h" #include "ttime.h" @@ -1568,17 +1569,32 @@ static int32_t translateInterp(SFunctionNode* pFunc, char* pErrBuf, int32_t len) int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); uint8_t dbPrec = pFunc->node.resType.precision; - // if (1 != numOfParams && 3 != numOfParams && 4 != numOfParams) { - if (1 != numOfParams) { + if (2 < numOfParams) { return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); } uint8_t nodeType = nodeType(nodesListGetNode(pFunc->pParameterList, 0)); uint8_t paraType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type; - if ((!IS_NUMERIC_TYPE(paraType) && !IS_BOOLEAN_TYPE(paraType))|| QUERY_NODE_VALUE == nodeType) { + if ((!IS_NUMERIC_TYPE(paraType) && !IS_BOOLEAN_TYPE(paraType)) || QUERY_NODE_VALUE == nodeType) { return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); } + if (2 == numOfParams) { + nodeType = nodeType(nodesListGetNode(pFunc->pParameterList, 1)); + paraType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 1))->resType.type; + if (!IS_INTEGER_TYPE(paraType) || QUERY_NODE_VALUE != nodeType) { + return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); + } + + SValueNode* pValue = (SValueNode*)nodesListGetNode(pFunc->pParameterList, 1); + if (pValue->datum.i != 0 && pValue->datum.i != 1) { + return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, + "INTERP function second parameter should be 0/1"); + } + + pValue->notReserved = true; + } + #if 0 if (3 <= numOfParams) { int64_t timeVal[2] = {0}; @@ -1624,6 +1640,15 @@ static int32_t translateInterp(SFunctionNode* pFunc, char* pErrBuf, int32_t len) return TSDB_CODE_SUCCESS; } +static EFuncReturnRows interpEstReturnRows(SFunctionNode* pFunc) { + int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); + if (1 < numOfParams && 1 == ((SValueNode*)nodesListGetNode(pFunc->pParameterList, 1))->datum.i) { + return FUNC_RETURN_ROWS_INDEFINITE; + } else { + return FUNC_RETURN_ROWS_N; + } +} + static int32_t translateFirstLast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { // forbid null as first/last input, since first(c0, null, 1) may have different number of input int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); @@ -2083,6 +2108,70 @@ static int32_t translateToJson(SFunctionNode* pFunc, char* pErrBuf, int32_t len) return TSDB_CODE_SUCCESS; } +static int32_t translateInStrOutGeom(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + if (1 != LIST_LENGTH(pFunc->pParameterList)) { + return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); + } + + uint8_t para1Type = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type; + if (!IS_STR_DATA_TYPE(para1Type) && !IS_NULL_TYPE(para1Type)) { + return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); + } + + pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_GEOMETRY].bytes, .type = TSDB_DATA_TYPE_GEOMETRY}; + + return TSDB_CODE_SUCCESS; +} + +static int32_t translateInGeomOutStr(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + if (1 != LIST_LENGTH(pFunc->pParameterList)) { + return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); + } + + uint8_t para1Type = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type; + if (para1Type != TSDB_DATA_TYPE_GEOMETRY && !IS_NULL_TYPE(para1Type)) { + return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); + } + + pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_VARCHAR].bytes, .type = TSDB_DATA_TYPE_VARCHAR}; + + return TSDB_CODE_SUCCESS; +} + +static int32_t translateIn2NumOutGeom(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + if (2 != LIST_LENGTH(pFunc->pParameterList)) { + return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); + } + + uint8_t para1Type = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type; + uint8_t para2Type = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 1))->resType.type; + if ((!IS_NUMERIC_TYPE(para1Type) && !IS_NULL_TYPE(para1Type)) || + (!IS_NUMERIC_TYPE(para2Type) && !IS_NULL_TYPE(para2Type))) { + return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); + } + + pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_GEOMETRY].bytes, .type = TSDB_DATA_TYPE_GEOMETRY}; + + return TSDB_CODE_SUCCESS; +} + +static int32_t translateIn2GeomOutBool(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + if (2 != LIST_LENGTH(pFunc->pParameterList)) { + return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); + } + + uint8_t para1Type = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type; + uint8_t para2Type = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 1))->resType.type; + if ((para1Type != TSDB_DATA_TYPE_GEOMETRY && !IS_NULL_TYPE(para1Type)) || + (para2Type != TSDB_DATA_TYPE_GEOMETRY && !IS_NULL_TYPE(para2Type))) { + return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); + } + + pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes, .type = TSDB_DATA_TYPE_BOOL}; + + return TSDB_CODE_SUCCESS; +} + static int32_t translateSelectValue(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { pFunc->node.resType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType; return TSDB_CODE_SUCCESS; @@ -2484,7 +2573,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .getEnvFunc = getSelectivityFuncEnv, .initFunc = functionSetup, .processFunc = NULL, - .finalizeFunc = NULL + .finalizeFunc = NULL, + .estimateReturnRowsFunc = interpEstReturnRows }, { .name = "derivative", @@ -3337,6 +3427,96 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .sprocessFunc = NULL, .finalizeFunc = NULL }, + { + .name = "st_geomfromtext", + .type = FUNCTION_TYPE_GEOM_FROM_TEXT, + .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_GEOMETRY_FUNC, + .translateFunc = translateInStrOutGeom, + .getEnvFunc = NULL, + .initFunc = NULL, + .sprocessFunc = geomFromTextFunction, + .finalizeFunc = NULL + }, + { + .name = "st_astext", + .type = FUNCTION_TYPE_AS_TEXT, + .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_GEOMETRY_FUNC, + .translateFunc = translateInGeomOutStr, + .getEnvFunc = NULL, + .initFunc = NULL, + .sprocessFunc = asTextFunction, + .finalizeFunc = NULL + }, + { + .name = "st_makepoint", + .type = FUNCTION_TYPE_MAKE_POINT, + .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_GEOMETRY_FUNC, + .translateFunc = translateIn2NumOutGeom, + .getEnvFunc = NULL, + .initFunc = NULL, + .sprocessFunc = makePointFunction, + .finalizeFunc = NULL + }, + { + .name = "st_intersects", + .type = FUNCTION_TYPE_INTERSECTS, + .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_GEOMETRY_FUNC, + .translateFunc = translateIn2GeomOutBool, + .getEnvFunc = NULL, + .initFunc = NULL, + .sprocessFunc = intersectsFunction, + .finalizeFunc = NULL + }, + { + .name = "st_equals", + .type = FUNCTION_TYPE_EQUALS, + .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_GEOMETRY_FUNC, + .translateFunc = translateIn2GeomOutBool, + .getEnvFunc = NULL, + .initFunc = NULL, + .sprocessFunc = equalsFunction, + .finalizeFunc = NULL + }, + { + .name = "st_touches", + .type = FUNCTION_TYPE_TOUCHES, + .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_GEOMETRY_FUNC, + .translateFunc = translateIn2GeomOutBool, + .getEnvFunc = NULL, + .initFunc = NULL, + .sprocessFunc = touchesFunction, + .finalizeFunc = NULL + }, + { + .name = "st_covers", + .type = FUNCTION_TYPE_COVERS, + .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_GEOMETRY_FUNC, + .translateFunc = translateIn2GeomOutBool, + .getEnvFunc = NULL, + .initFunc = NULL, + .sprocessFunc = coversFunction, + .finalizeFunc = NULL + }, + { + .name = "st_contains", + .type = FUNCTION_TYPE_CONTAINS, + .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_GEOMETRY_FUNC, + .translateFunc = translateIn2GeomOutBool, + .getEnvFunc = NULL, + .initFunc = NULL, + .sprocessFunc = containsFunction, + .finalizeFunc = NULL + }, + { + .name = "st_containsproperly", + .type = FUNCTION_TYPE_CONTAINS_PROPERLY, + .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_GEOMETRY_FUNC, + .translateFunc = translateIn2GeomOutBool, + .getEnvFunc = NULL, + .initFunc = NULL, + .sprocessFunc = containsProperlyFunction, + .finalizeFunc = NULL + }, }; // clang-format on diff --git a/source/libs/geometry/CMakeLists.txt b/source/libs/geometry/CMakeLists.txt new file mode 100644 index 0000000000..679c73f508 --- /dev/null +++ b/source/libs/geometry/CMakeLists.txt @@ -0,0 +1,17 @@ +aux_source_directory(src GEOMETRY_SRC) + +add_library(geometry STATIC ${GEOMETRY_SRC}) +target_include_directories( + geometry + PUBLIC "${TD_SOURCE_DIR}/include/libs/geometry" + PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../scalar/inc" +) + +target_link_libraries( + geometry + PRIVATE os util nodes function scalar qcom +) + +if(${BUILD_TEST}) + ADD_SUBDIRECTORY(test) +endif(${BUILD_TEST}) diff --git a/source/libs/geometry/src/geomFunc.c b/source/libs/geometry/src/geomFunc.c new file mode 100644 index 0000000000..0e2bac584d --- /dev/null +++ b/source/libs/geometry/src/geomFunc.c @@ -0,0 +1,444 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include +#include "geosWrapper.h" +#include "geomFunc.h" +#include "querynodes.h" +#include "tdatablock.h" +#include "sclInt.h" +#include "sclvector.h" + +typedef int32_t (*_geomDoRelationFunc_t)(const GEOSGeometry *geom1, const GEOSPreparedGeometry *preparedGeom1, const GEOSGeometry *geom2, + bool swapped, char *res); + +typedef int32_t (*_geomInitCtxFunc_t)(); +typedef int32_t (*_geomExecuteOneParamFunc_t)(SColumnInfoData *pInputData, int32_t i, SColumnInfoData *pOutputData); +typedef int32_t (*_geomExecuteTwoParamsFunc_t)(SColumnInfoData *pInputData[], int32_t iLeft, int32_t iRight, + SColumnInfoData *pOutputData); + +// output is with VARSTR format +// need to call taosMemoryFree(*output) later +int32_t doMakePointFunc(double x, double y, unsigned char **output) { + int32_t code = TSDB_CODE_FAILED; + + unsigned char *outputGeom = NULL; + size_t size = 0; + code = doMakePoint(x, y, &outputGeom, &size); + if (code != TSDB_CODE_SUCCESS) { + goto _exit; + } + + *output = taosMemoryCalloc(1, size + VARSTR_HEADER_SIZE); + if (*output == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _exit; + } + + memcpy(varDataVal(*output), outputGeom, size); + varDataSetLen(*output, size); + code = TSDB_CODE_SUCCESS; + +_exit: + geosFreeBuffer(outputGeom); + + return code; +} + +// both input and output are with VARSTR format +// need to call taosMemoryFree(*output) later +int32_t doGeomFromTextFunc(const char *input, unsigned char **output) { + int32_t code = TSDB_CODE_FAILED; + + if ((varDataLen(input)) == 0) { //empty value + *output = NULL; + return TSDB_CODE_SUCCESS; + } + + // make input as a zero ending string + char *end = varDataVal(input) + varDataLen(input); + char endValue = *end; + *end = 0; + + unsigned char *outputGeom = NULL; + size_t size = 0; + + code = doGeomFromText(varDataVal(input), &outputGeom, &size); + if (code != TSDB_CODE_SUCCESS) { + goto _exit; + } + + *output = taosMemoryCalloc(1, size + VARSTR_HEADER_SIZE); + if (*output == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _exit; + } + + memcpy(varDataVal(*output), outputGeom, size); + varDataSetLen(*output, size); + code = TSDB_CODE_SUCCESS; + +_exit: + geosFreeBuffer(outputGeom); + + *end = endValue; //recover the input string + + return code; +} + +// both input and output are with VARSTR format +// need to call taosMemoryFree(*output) later +int32_t doAsTextFunc(unsigned char *input, char **output) { + int32_t code = TSDB_CODE_FAILED; + + if ((varDataLen(input)) == 0) { //empty value + *output = NULL; + return TSDB_CODE_SUCCESS; + } + + char *outputWKT = NULL; + code = doAsText(varDataVal(input), varDataLen(input), &outputWKT); + if (code != TSDB_CODE_SUCCESS) { + goto _exit; + } + + size_t size = strlen(outputWKT); + *output = taosMemoryCalloc(1, size + VARSTR_HEADER_SIZE); + if (*output == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _exit; + } + + memcpy(varDataVal(*output), outputWKT, size); + varDataSetLen(*output, size); + code = TSDB_CODE_SUCCESS; + +_exit: + geosFreeBuffer(outputWKT); + + return code; +} + +int32_t executeMakePointFunc(SColumnInfoData *pInputData[], int32_t iLeft, int32_t iRight, + SColumnInfoData *pOutputData) { + int32_t code = TSDB_CODE_FAILED; + + _getDoubleValue_fn_t getDoubleValueFn[2]; + getDoubleValueFn[0]= getVectorDoubleValueFn(pInputData[0]->info.type); + getDoubleValueFn[1]= getVectorDoubleValueFn(pInputData[1]->info.type); + + unsigned char *output = NULL; + code = doMakePointFunc(getDoubleValueFn[0](pInputData[0]->pData, iLeft), getDoubleValueFn[1](pInputData[1]->pData, iRight), &output); + if (code != TSDB_CODE_SUCCESS) { + goto _exit; + } + + colDataAppend(pOutputData, TMAX(iLeft, iRight), output, (output == NULL)); + +_exit: + if (output) { + taosMemoryFree(output); + } + + return code; +} + +int32_t executeGeomFromTextFunc(SColumnInfoData *pInputData, int32_t i, SColumnInfoData *pOutputData) { + int32_t code = TSDB_CODE_FAILED; + + char *input = colDataGetData(pInputData, i); + unsigned char *output = NULL; + code = doGeomFromTextFunc(input, &output); + if (code != TSDB_CODE_SUCCESS) { + goto _exit; + } + + colDataAppend(pOutputData, i, output, (output == NULL)); + +_exit: + if (output) { + taosMemoryFree(output); + } + + return code; +} + +int32_t executeAsTextFunc(SColumnInfoData *pInputData, int32_t i, SColumnInfoData *pOutputData) { + int32_t code = TSDB_CODE_FAILED; + + unsigned char *input = colDataGetData(pInputData, i); + char *output = NULL; + code = doAsTextFunc(input, &output); + if (code != TSDB_CODE_SUCCESS) { + goto _exit; + } + + colDataAppend(pOutputData, i, output, (output == NULL)); + +_exit: + if (output) { + taosMemoryFree(output); + } + + return code; +} + +int32_t executeRelationFunc(const GEOSGeometry *geom1, const GEOSPreparedGeometry *preparedGeom1, + const GEOSGeometry *geom2, int32_t i, + bool swapped, SColumnInfoData *pOutputData, + _geomDoRelationFunc_t doRelationFn) { + int32_t code = TSDB_CODE_FAILED; + char res = 0; + + if (!geom1 || !geom2) { //if empty input value + res = -1; + code = TSDB_CODE_SUCCESS; + } + else { + code = doRelationFn(geom1, preparedGeom1, geom2, swapped, &res); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + } + + colDataAppend(pOutputData, i, &res, (res==-1)); + + return code; +} + +int32_t geomOneParamFunction(SScalarParam *pInput, SScalarParam *pOutput, + _geomInitCtxFunc_t initCtxFn, _geomExecuteOneParamFunc_t executeOneParamFn) { + int32_t code = TSDB_CODE_FAILED; + + code = initCtxFn(); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + SColumnInfoData *pInputData = pInput->columnData; + SColumnInfoData *pOutputData = pOutput->columnData; + pOutput->numOfRows = pInput->numOfRows; + + if (IS_NULL_TYPE(GET_PARAM_TYPE(pInput))) { + colDataSetNNULL(pOutputData, 0, pInput->numOfRows); + code = TSDB_CODE_SUCCESS; + } + else { + for (int32_t i = 0; i < pInput->numOfRows; ++i) { + if (colDataIsNull_s(pInputData, i)) { + colDataSetNULL(pOutputData, i); + code = TSDB_CODE_SUCCESS; + continue; + } + + code = executeOneParamFn(pInputData, i, pOutputData); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + } + } + + return code; +} + +int32_t geomTwoParamsFunction(SScalarParam *pInput, SScalarParam *pOutput, + _geomInitCtxFunc_t initCtxFn, _geomExecuteTwoParamsFunc_t executeTwoParamsFn) { + int32_t code = TSDB_CODE_FAILED; + + code = initCtxFn(); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + SColumnInfoData *pInputData[2]; + SColumnInfoData *pOutputData = pOutput->columnData; + pInputData[0] = pInput[0].columnData; + pInputData[1] = pInput[1].columnData; + + bool hasNullType = (IS_NULL_TYPE(GET_PARAM_TYPE(&pInput[0])) || + IS_NULL_TYPE(GET_PARAM_TYPE(&pInput[1]))); + bool isConstantLeft = (pInput[0].numOfRows == 1); + bool isConstantRight = (pInput[1].numOfRows == 1); + int32_t numOfRows = TMAX(pInput[0].numOfRows, pInput[1].numOfRows); + pOutput->numOfRows = numOfRows; + + if (hasNullType || // one of operant is NULL type + (isConstantLeft && colDataIsNull_s(pInputData[0], 0)) || // left operand is constant NULL + (isConstantRight && colDataIsNull_s(pInputData[1], 0))) { // right operand is constant NULL + colDataSetNNULL(pOutputData, 0, numOfRows); + code = TSDB_CODE_SUCCESS; + } + else { + int32_t iLeft = 0; + int32_t iRight = 0; + for (int32_t i = 0; i < numOfRows; ++i) { + iLeft = isConstantLeft ? 0 : i; + iRight = isConstantRight ? 0 : i; + + if ((!isConstantLeft && colDataIsNull_s(pInputData[0], iLeft)) || + (!isConstantRight && colDataIsNull_s(pInputData[1], iRight))) { + colDataSetNULL(pOutputData, i); + code = TSDB_CODE_SUCCESS; + continue; + } + + code = executeTwoParamsFn(pInputData, iLeft, iRight, pOutputData); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + } + } + + return code; +} + +int32_t geomRelationFunction(SScalarParam *pInput, SScalarParam *pOutput, + bool swapAllowed, _geomDoRelationFunc_t doRelationFn) { + int32_t code = TSDB_CODE_FAILED; + + code = initCtxRelationFunc(); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + // handle with all NULL output + bool hasNullType = (IS_NULL_TYPE(GET_PARAM_TYPE(&pInput[0])) || + IS_NULL_TYPE(GET_PARAM_TYPE(&pInput[1]))); + bool isConstant1 = (pInput[0].numOfRows == 1); + bool isConstant2 = (pInput[1].numOfRows == 1); + int32_t numOfRows = TMAX(pInput[0].numOfRows, pInput[1].numOfRows); + pOutput->numOfRows = numOfRows; + SColumnInfoData *pOutputData = pOutput->columnData; + + if (hasNullType || // at least one of operant is NULL type + (isConstant1 && colDataIsNull_s(pInput[0].columnData, 0)) || // left operand is constant NULL + (isConstant2 && colDataIsNull_s(pInput[1].columnData, 0))) { // right operand is constant NULL + colDataSetNNULL(pOutputData, 0, numOfRows); + code = TSDB_CODE_SUCCESS; + return code; + } + + bool swapped = false; + SColumnInfoData *pInputData[2]; + + // swap two input data to make sure input data 0 is constant if swapAllowed and only isConstant2 is true + if (swapAllowed && + !isConstant1 && isConstant2) { + pInputData[0] = pInput[1].columnData; + pInputData[1] = pInput[0].columnData; + + isConstant1 = true; + isConstant2 = false; + swapped = true; + } + else { + pInputData[0] = pInput[0].columnData; + pInputData[1] = pInput[1].columnData; + } + + GEOSGeometry *geom1 = NULL; + GEOSGeometry *geom2 = NULL; + const GEOSPreparedGeometry *preparedGeom1 = NULL; + + // if there is constant, make PreparedGeometry from pInputData 0 + if (isConstant1) { + code = readGeometry(colDataGetData(pInputData[0], 0), &geom1, &preparedGeom1); + if (code != TSDB_CODE_SUCCESS) { + goto _exit; + } + } + if (isConstant2) { + code = readGeometry(colDataGetData(pInputData[1], 0), &geom2, NULL); + if (code != TSDB_CODE_SUCCESS) { + goto _exit; + } + } + + for (int32_t i = 0; i < numOfRows; ++i) { + if ((!isConstant1 && colDataIsNull_s(pInputData[0], i)) || + (!isConstant2 && colDataIsNull_s(pInputData[1], i))) { + colDataSetNULL(pOutputData, i); + code = TSDB_CODE_SUCCESS; + continue; + } + + if (!isConstant1) { + code = readGeometry(colDataGetData(pInputData[0], i), &geom1, &preparedGeom1); + if (code != TSDB_CODE_SUCCESS) { + goto _exit; + } + } + if (!isConstant2) { + code = readGeometry(colDataGetData(pInputData[1], i), &geom2, NULL); + if (code != TSDB_CODE_SUCCESS) { + goto _exit; + } + } + + code = executeRelationFunc(geom1, preparedGeom1, geom2, i, swapped, pOutputData, doRelationFn); + if (code != TSDB_CODE_SUCCESS) { + goto _exit; + } + + if (!isConstant1) { + destroyGeometry(&geom1, &preparedGeom1); + } + if (!isConstant2) { + destroyGeometry(&geom2, NULL); + } + } + +_exit: + destroyGeometry(&geom1, &preparedGeom1); + destroyGeometry(&geom2, NULL); + + return code; +} + +int32_t makePointFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { + return geomTwoParamsFunction(pInput, pOutput, initCtxMakePoint, executeMakePointFunc); +} + +int32_t geomFromTextFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { + return geomOneParamFunction(pInput, pOutput, initCtxGeomFromText, executeGeomFromTextFunc); +} + +int32_t asTextFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { + return geomOneParamFunction(pInput, pOutput, initCtxAsText, executeAsTextFunc); +} + +int32_t intersectsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { + return geomRelationFunction(pInput, pOutput, true, doIntersects); +} + +int32_t equalsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { + return geomRelationFunction(pInput, pOutput, true, doEquals); +} + +int32_t touchesFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { + return geomRelationFunction(pInput, pOutput, true, doTouches); +} + +int32_t coversFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { + return geomRelationFunction(pInput, pOutput, true, doCovers); +} + +int32_t containsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { + return geomRelationFunction(pInput, pOutput, true, doContains); +} + +int32_t containsProperlyFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { + return geomRelationFunction(pInput, pOutput, false, doContainsProperly); +} diff --git a/source/libs/geometry/src/geosWrapper.c b/source/libs/geometry/src/geosWrapper.c new file mode 100644 index 0000000000..dd83083ec9 --- /dev/null +++ b/source/libs/geometry/src/geosWrapper.c @@ -0,0 +1,352 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "geosWrapper.h" +#include "tdef.h" +#include "types.h" + +typedef char (*_geosRelationFunc_t)(GEOSContextHandle_t handle, const GEOSGeometry *g1, const GEOSGeometry *g2); +typedef char (*_geosPreparedRelationFunc_t)(GEOSContextHandle_t handle, const GEOSPreparedGeometry *pg1, const GEOSGeometry *g2); + +void geosFreeBuffer(void *buffer) { + if (buffer) { + GEOSFree_r(getThreadLocalGeosCtx()->handle, buffer); + } +} + +void geosErrMsgeHandler(const char *errMsg, void *userData) { + char* targetErrMsg = userData; + snprintf(targetErrMsg, 512, "%s", errMsg); +} + +int32_t initCtxMakePoint() { + int32_t code = TSDB_CODE_FAILED; + SGeosContext* geosCtx = getThreadLocalGeosCtx(); + + if (geosCtx->handle == NULL) { + geosCtx->handle = GEOS_init_r(); + if (geosCtx->handle == NULL) { + return code; + } + + GEOSContext_setErrorMessageHandler_r(geosCtx->handle, geosErrMsgeHandler, geosCtx->errMsg); + } + + if (geosCtx->WKBWriter == NULL) { + geosCtx->WKBWriter = GEOSWKBWriter_create_r(geosCtx->handle); + if (geosCtx->WKBWriter == NULL) { + return code; + } + } + + return TSDB_CODE_SUCCESS; +} + +// outputWKT is a zero ending string +// need to call geosFreeBuffer(*outputGeom) later +int32_t doMakePoint(double x, double y, unsigned char **outputGeom, size_t *size) { + int32_t code = TSDB_CODE_FAILED; + SGeosContext* geosCtx = getThreadLocalGeosCtx(); + + GEOSGeometry *geom = NULL; + unsigned char *wkb = NULL; + + geom = GEOSGeom_createPointFromXY_r(geosCtx->handle, x, y); + if (geom == NULL) { + code = TSDB_CODE_FUNC_FUNTION_PARA_VALUE; + goto _exit; + } + + wkb = GEOSWKBWriter_write_r(geosCtx->handle, geosCtx->WKBWriter, geom, size); + if (wkb == NULL) { + goto _exit; + } + *outputGeom = wkb; + + code = TSDB_CODE_SUCCESS; + +_exit: + if (geom) { + GEOSGeom_destroy_r(geosCtx->handle, geom); + geom = NULL; + } + + return code; +} + +int32_t initCtxGeomFromText() { + int32_t code = TSDB_CODE_FAILED; + SGeosContext* geosCtx = getThreadLocalGeosCtx(); + + if (geosCtx->handle == NULL) { + geosCtx->handle = GEOS_init_r(); + if (geosCtx->handle == NULL) { + return code; + } + + GEOSContext_setErrorMessageHandler_r(geosCtx->handle, geosErrMsgeHandler, geosCtx->errMsg); + } + + if (geosCtx->WKTReader == NULL) { + geosCtx->WKTReader = GEOSWKTReader_create_r(geosCtx->handle); + if (geosCtx->WKTReader == NULL) { + return code; + } + } + + if (geosCtx->WKBWriter == NULL) { + geosCtx->WKBWriter = GEOSWKBWriter_create_r(geosCtx->handle); + if (geosCtx->WKBWriter == NULL) { + return code; + } + } + + return TSDB_CODE_SUCCESS; +} + +// inputWKT is a zero ending string +// need to call geosFreeBuffer(*outputGeom) later +int32_t doGeomFromText(const char *inputWKT, unsigned char **outputGeom, size_t *size) { + int32_t code = TSDB_CODE_FAILED; + SGeosContext* geosCtx = getThreadLocalGeosCtx(); + + GEOSGeometry *geom = NULL; + unsigned char *wkb = NULL; + + geom = GEOSWKTReader_read_r(geosCtx->handle, geosCtx->WKTReader, inputWKT); + if (geom == NULL) { + code = TSDB_CODE_FUNC_FUNTION_PARA_VALUE; + goto _exit; + } + + wkb = GEOSWKBWriter_write_r(geosCtx->handle, geosCtx->WKBWriter, geom, size); + if (wkb == NULL) { + goto _exit; + } + *outputGeom = wkb; + + code = TSDB_CODE_SUCCESS; + +_exit: + if (geom) { + GEOSGeom_destroy_r(geosCtx->handle, geom); + geom = NULL; + } + + return code; +} + +int32_t initCtxAsText() { + int32_t code = TSDB_CODE_FAILED; + SGeosContext* geosCtx = getThreadLocalGeosCtx(); + + if (geosCtx->handle == NULL) { + geosCtx->handle = GEOS_init_r(); + if (geosCtx->handle == NULL) { + return code; + } + + GEOSContext_setErrorMessageHandler_r(geosCtx->handle, geosErrMsgeHandler, geosCtx->errMsg); + } + + if (geosCtx->WKBReader == NULL) { + geosCtx->WKBReader = GEOSWKBReader_create_r(geosCtx->handle); + if (geosCtx->WKBReader == NULL) { + return code; + } + } + + if (geosCtx->WKTWriter == NULL) { + geosCtx->WKTWriter = GEOSWKTWriter_create_r(geosCtx->handle); + + if (geosCtx->WKTWriter) { + GEOSWKTWriter_setRoundingPrecision_r(geosCtx->handle, geosCtx->WKTWriter, 6); + } else { + return code; + } + } + + return TSDB_CODE_SUCCESS; +} + +// outputWKT is a zero ending string +// need to call geosFreeBuffer(*outputWKT) later +int32_t doAsText(const unsigned char *inputGeom, size_t size, char **outputWKT) { + int32_t code = TSDB_CODE_FAILED; + SGeosContext* geosCtx = getThreadLocalGeosCtx(); + + GEOSGeometry *geom = NULL; + unsigned char *wkt = NULL; + + geom = GEOSWKBReader_read_r(geosCtx->handle, geosCtx->WKBReader, inputGeom, size); + if (geom == NULL) { + code = TSDB_CODE_FUNC_FUNTION_PARA_VALUE; + goto _exit; + } + + wkt = GEOSWKTWriter_write_r(geosCtx->handle, geosCtx->WKTWriter, geom); + if (wkt == NULL) { + goto _exit; + } + *outputWKT = wkt; + + code = TSDB_CODE_SUCCESS; + +_exit: + if (geom) { + GEOSGeom_destroy_r(geosCtx->handle, geom); + geom = NULL; + } + + return code; +} + +int32_t initCtxRelationFunc() { + int32_t code = TSDB_CODE_FAILED; + SGeosContext* geosCtx = getThreadLocalGeosCtx(); + + if (geosCtx->handle == NULL) { + geosCtx->handle = GEOS_init_r(); + if (geosCtx->handle == NULL) { + return code; + } + + GEOSContext_setErrorMessageHandler_r(geosCtx->handle, geosErrMsgeHandler, geosCtx->errMsg); + } + + if (geosCtx->WKBReader == NULL) { + geosCtx->WKBReader = GEOSWKBReader_create_r(geosCtx->handle); + if (geosCtx->WKBReader == NULL) { + return code; + } + } + + return TSDB_CODE_SUCCESS; +} + +int32_t doGeosRelation(const GEOSGeometry *geom1, const GEOSPreparedGeometry *preparedGeom1, const GEOSGeometry *geom2, + bool swapped, char *res, + _geosRelationFunc_t relationFn, + _geosRelationFunc_t swappedRelationFn, + _geosPreparedRelationFunc_t preparedRelationFn, + _geosPreparedRelationFunc_t swappedPreparedRelationFn) { + int32_t code = TSDB_CODE_FAILED; + SGeosContext* geosCtx = getThreadLocalGeosCtx(); + + if (!preparedGeom1) { + if (!swapped) { + ASSERT(relationFn); + *res = relationFn(geosCtx->handle, geom1, geom2); + } + else { + ASSERT(swappedRelationFn); + *res = swappedRelationFn(geosCtx->handle, geom1, geom2); + } + } + else { + if (!swapped) { + ASSERT(preparedRelationFn); + *res = preparedRelationFn(geosCtx->handle, preparedGeom1, geom2); + } + else { + ASSERT(swappedPreparedRelationFn); + *res = swappedPreparedRelationFn(geosCtx->handle, preparedGeom1, geom2); + } + } + + code = TSDB_CODE_SUCCESS; + return code; +} + +int32_t doIntersects(const GEOSGeometry *geom1, const GEOSPreparedGeometry *preparedGeom1, const GEOSGeometry *geom2, + bool swapped, char *res) { + return doGeosRelation(geom1, preparedGeom1, geom2, swapped, res, + GEOSIntersects_r, GEOSIntersects_r, GEOSPreparedIntersects_r, GEOSPreparedIntersects_r); +} + +int32_t doEquals(const GEOSGeometry *geom1, const GEOSPreparedGeometry *preparedGeom1, const GEOSGeometry *geom2, + bool swapped, char *res) { + return doGeosRelation(geom1, NULL, geom2, swapped, res, + GEOSEquals_r, GEOSEquals_r, NULL, NULL); // no prepared version for eguals() +} + +int32_t doTouches(const GEOSGeometry *geom1, const GEOSPreparedGeometry *preparedGeom1, const GEOSGeometry *geom2, + bool swapped, char *res) { + return doGeosRelation(geom1, preparedGeom1, geom2, swapped, res, + GEOSTouches_r, GEOSTouches_r, GEOSPreparedTouches_r, GEOSPreparedTouches_r); +} + +int32_t doCovers(const GEOSGeometry *geom1, const GEOSPreparedGeometry *preparedGeom1, const GEOSGeometry *geom2, + bool swapped, char *res) { + return doGeosRelation(geom1, preparedGeom1, geom2, swapped, res, + GEOSCovers_r, GEOSCoveredBy_r, GEOSPreparedCovers_r, GEOSPreparedCoveredBy_r); +} + +int32_t doContains(const GEOSGeometry *geom1, const GEOSPreparedGeometry *preparedGeom1, const GEOSGeometry *geom2, + bool swapped, char *res) { + return doGeosRelation(geom1, preparedGeom1, geom2, swapped, res, + GEOSContains_r, GEOSWithin_r, GEOSPreparedContains_r, GEOSPreparedWithin_r); +} + +int32_t doContainsProperly(const GEOSGeometry *geom1, const GEOSPreparedGeometry *preparedGeom1, const GEOSGeometry *geom2, + bool swapped, char *res) { + return doGeosRelation(geom1, preparedGeom1, geom2, swapped, res, + NULL, NULL, GEOSPreparedContainsProperly_r, NULL); +} + +// input is with VARSTR format +// need to call destroyGeometry(outputGeom, outputPreparedGeom) later +int32_t readGeometry(const unsigned char *input, GEOSGeometry **outputGeom, const GEOSPreparedGeometry **outputPreparedGeom) { + SGeosContext* geosCtx = getThreadLocalGeosCtx(); + + ASSERT(outputGeom); //it is not allowed if outputGeom is NULL + *outputGeom = NULL; + + if (outputPreparedGeom) { //it means not to generate PreparedGeometry if outputPreparedGeom is NULL + *outputPreparedGeom = NULL; + } + + if (varDataLen(input) == 0) { //empty value + return TSDB_CODE_SUCCESS; + } + + *outputGeom = GEOSWKBReader_read_r(geosCtx->handle, geosCtx->WKBReader, varDataVal(input), varDataLen(input)); + if (*outputGeom == NULL) { + return TSDB_CODE_FUNC_FUNTION_PARA_VALUE; + } + + if (outputPreparedGeom) { + *outputPreparedGeom = GEOSPrepare_r(geosCtx->handle, *outputGeom); + if (*outputPreparedGeom == NULL) { + return TSDB_CODE_FAILED; + } + } + + return TSDB_CODE_SUCCESS; +} + +void destroyGeometry(GEOSGeometry **geom, const GEOSPreparedGeometry **preparedGeom) { + SGeosContext* geosCtx = getThreadLocalGeosCtx(); + + if (preparedGeom && *preparedGeom) { + GEOSPreparedGeom_destroy_r(geosCtx->handle, *preparedGeom); + *preparedGeom = NULL; + } + + if (geom && *geom) { + GEOSGeom_destroy_r(geosCtx->handle, *geom); + *geom = NULL; + } +} diff --git a/source/libs/geometry/test/CMakeLists.txt b/source/libs/geometry/test/CMakeLists.txt new file mode 100644 index 0000000000..ba849a9dc8 --- /dev/null +++ b/source/libs/geometry/test/CMakeLists.txt @@ -0,0 +1,19 @@ +MESSAGE(STATUS "build geometry unit test") + +IF(NOT TD_DARWIN) + # GoogleTest requires at least C++11 + SET(CMAKE_CXX_STANDARD 11) + + AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST) + ADD_EXECUTABLE(geomTest ${SOURCE_LIST}) + + TARGET_LINK_LIBRARIES( + geomTest + PUBLIC os util gtest qcom nodes geometry scalar function scalar + ) + + add_test( + NAME geomTest + COMMAND geomTest + ) +ENDIF() diff --git a/source/libs/geometry/test/geomFuncTest.cpp b/source/libs/geometry/test/geomFuncTest.cpp new file mode 100644 index 0000000000..459c7499cc --- /dev/null +++ b/source/libs/geometry/test/geomFuncTest.cpp @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include + +#include "os.h" + +int main(int argc, char **argv) { + taosSeedRand(taosGetTimestampSec()); + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/source/libs/geometry/test/geomFuncTestUtil.cpp b/source/libs/geometry/test/geomFuncTestUtil.cpp new file mode 100644 index 0000000000..cb59ea098f --- /dev/null +++ b/source/libs/geometry/test/geomFuncTestUtil.cpp @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "geomFuncTestUtil.h" + +void setColumnInfo(SColumnInfo *info, int32_t colId, int32_t type, int32_t bytes) { + memset(info, 0, sizeof(SColumnInfo)); + info->colId = colId; + info->type = type; + info->bytes = bytes; +} + +void setScalarParam(SScalarParam *sclParam, int32_t type, void *valueArray, TDRowValT valTypeArray[], int32_t rowNum) { + int32_t bytes = 0; + switch (type) { + case TSDB_DATA_TYPE_NULL: { + bytes = -1; + break; + } + case TSDB_DATA_TYPE_BOOL: { + bytes = sizeof(int8_t); + break; + } + case TSDB_DATA_TYPE_TINYINT: { + bytes = sizeof(int8_t); + break; + } + case TSDB_DATA_TYPE_SMALLINT: { + bytes = sizeof(int16_t); + break; + } + case TSDB_DATA_TYPE_INT: { + bytes = sizeof(int32_t); + break; + } + case TSDB_DATA_TYPE_BIGINT: { + bytes = sizeof(int64_t); + break; + } + case TSDB_DATA_TYPE_FLOAT: { + bytes = sizeof(float); + break; + } + case TSDB_DATA_TYPE_DOUBLE: { + bytes = sizeof(double); + break; + } + case TSDB_DATA_TYPE_VARCHAR: { + bytes = TSDB_MAX_BINARY_LEN; + break; + } + case TSDB_DATA_TYPE_GEOMETRY: { + bytes = TSDB_MAX_GEOMETRY_LEN; + break; + } + default: { + ASSERT(0); + break; + } + } + + sclParam->columnData = (SColumnInfoData *)taosMemoryCalloc(1, sizeof(SColumnInfoData)); + sclParam->numOfRows = rowNum; + + setColumnInfo(&sclParam->columnData->info, 0, type, bytes); + colInfoDataEnsureCapacity(sclParam->columnData, rowNum, false); + + if (type != TSDB_DATA_TYPE_NULL && valueArray) { + for (int32_t i = 0; i < rowNum; ++i) { + if (tdValTypeIsNull(valTypeArray[i])) { + colDataSetNULL(sclParam->columnData, i); + } + else { + const char *val = (const char *)valueArray + (i * bytes); + colDataAppend(sclParam->columnData, i, val, false); + } + } + } +} + +void destroyScalarParam(SScalarParam *sclParam, int32_t colNum) { + for (int32_t i = 0; i < colNum; ++i) { + colDataDestroy((sclParam + i)->columnData); + taosMemoryFree((sclParam + i)->columnData); + } + taosMemoryFree(sclParam); +} + +void makeOneScalarParam(SScalarParam **pSclParam, int32_t type, void *valueArray, TDRowValT valTypeArray[], int32_t rowNum) { + *pSclParam = (SScalarParam *)taosMemoryCalloc(1, sizeof(SScalarParam)); + setScalarParam(*pSclParam, type, valueArray, valTypeArray, rowNum); +} + +bool compareVarData(unsigned char *varData1, unsigned char *varData2) { + if (varDataLen(varData1) == 0 || varDataLen(varData2) == 0) { + return false; + } + if(varDataLen(varData1) != varDataLen(varData2)) { + return false; + } + + return (memcmp(varDataVal(varData1), varDataVal(varData2), varDataLen(varData1)) == 0); +} + +void compareVarDataColumn(SColumnInfoData *columnData1, SColumnInfoData *columnData2, int32_t rowNum) { + for (int32_t i = 0; i < rowNum; ++i) { + bool isNull1 = colDataIsNull_s(columnData1, i); + bool isNull2 = colDataIsNull_s(columnData2, i); + ASSERT_EQ((isNull1 == isNull2), true); + + if (!isNull1) { + bool res = compareVarData((unsigned char *)colDataGetData(columnData1, i), + (unsigned char *)colDataGetData(columnData2, i)); + ASSERT_EQ(res, true); + } + } +} diff --git a/source/libs/geometry/test/geomFuncTestUtil.h b/source/libs/geometry/test/geomFuncTestUtil.h new file mode 100644 index 0000000000..1d7c6d77be --- /dev/null +++ b/source/libs/geometry/test/geomFuncTestUtil.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include + +#include "tdatablock.h" +#include "geomFunc.h" + +void setScalarParam(SScalarParam *sclParam, int32_t type, void *valueArray, TDRowValT valTypeArray[], int32_t rowNum); +void destroyScalarParam(SScalarParam *sclParam, int32_t colNum); + +void makeOneScalarParam(SScalarParam **pSclParam, int32_t type, void *valueArray, TDRowValT valTypeArray[], int32_t rowNum); + +void compareVarDataColumn(SColumnInfoData *columnData1, SColumnInfoData *columnData2, int32_t rowNum); + +void callGeomFromTextWrapper5(void *strArray, TDRowValT valTypeArray[], int32_t rowNum, SScalarParam *pOutputGeomFromText); diff --git a/source/libs/geometry/test/geomIoFuncTest.cpp b/source/libs/geometry/test/geomIoFuncTest.cpp new file mode 100644 index 0000000000..fcb7a4d12a --- /dev/null +++ b/source/libs/geometry/test/geomIoFuncTest.cpp @@ -0,0 +1,321 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "geomFuncTestUtil.h" + +void callGeomFromText(int32_t inputType, void *strArray, TDRowValT valTypeArray[], int32_t rowNum, + SScalarParam **pInputGeomFromText, SScalarParam **pOutputGeomFromText, + int32_t expectedCode) { + makeOneScalarParam(pInputGeomFromText, inputType, strArray, valTypeArray, rowNum); + makeOneScalarParam(pOutputGeomFromText, TSDB_DATA_TYPE_GEOMETRY, 0, 0, rowNum); + + int32_t code = geomFromTextFunction(*pInputGeomFromText, 1, *pOutputGeomFromText); + ASSERT_EQ(code, expectedCode); +} + +void callGeomFromTextWrapper1(int32_t inputType, void *strArray, TDRowValT valTypeArray[], int32_t rowNum, SScalarParam **pOutputGeomFromText) { + SScalarParam *pInputGeomFromText; + callGeomFromText(inputType, strArray, valTypeArray, rowNum, &pInputGeomFromText, pOutputGeomFromText, TSDB_CODE_SUCCESS); + destroyScalarParam(pInputGeomFromText, 1); +} + +void callGeomFromTextWrapper2(void *strArray, TDRowValT valTypeArray[], int32_t rowNum, SScalarParam **pOutputGeomFromText) { + callGeomFromTextWrapper1(TSDB_DATA_TYPE_VARCHAR, strArray, valTypeArray, rowNum, pOutputGeomFromText); +} + +void callGeomFromTextWrapper3(int32_t inputType, void *strArray, TDRowValT valTypeArray[], int32_t rowNum, int32_t expectedCode) { + SScalarParam *pInputGeomFromText; + SScalarParam *pOutputGeomFromText; + + callGeomFromText(inputType, strArray, valTypeArray, rowNum, &pInputGeomFromText, &pOutputGeomFromText, expectedCode); + + destroyScalarParam(pInputGeomFromText, 1); + destroyScalarParam(pOutputGeomFromText, 1); +} + +void callGeomFromTextWrapper4(void *strArray, TDRowValT valTypeArray[], int32_t rowNum, int32_t expectedCode) { + callGeomFromTextWrapper3(TSDB_DATA_TYPE_VARCHAR, strArray, valTypeArray, rowNum, expectedCode); +} + +void callGeomFromTextWrapper5(void *strArray, TDRowValT valTypeArray[], int32_t rowNum, SScalarParam *pOutputGeomFromText) { + SScalarParam *pInputGeomFromText; + makeOneScalarParam(&pInputGeomFromText, TSDB_DATA_TYPE_VARCHAR, strArray, valTypeArray, rowNum); + + setScalarParam(pOutputGeomFromText, TSDB_DATA_TYPE_GEOMETRY, 0, 0, rowNum); + + int32_t code = geomFromTextFunction(pInputGeomFromText, 1, pOutputGeomFromText); + ASSERT_EQ(code, TSDB_CODE_SUCCESS); + + destroyScalarParam(pInputGeomFromText, 1); +} + +void callAsText(int32_t inputType, void *strArray, TDRowValT valTypeArray[], int32_t rowNum, + SScalarParam **pInputAsText, SScalarParam **pOutputAsText, + int32_t expectedCode) { + makeOneScalarParam(pInputAsText, inputType, strArray, valTypeArray, rowNum); + makeOneScalarParam(pOutputAsText, TSDB_DATA_TYPE_VARCHAR, 0, 0, rowNum); + + int32_t code = geomFromTextFunction(*pInputAsText, 1, *pOutputAsText); + ASSERT_EQ(code, expectedCode); +} + +void callAsTextWrapper1(int32_t inputType, void *strArray, TDRowValT valTypeArray[], int32_t rowNum, SScalarParam **pOutputAsText) { + SScalarParam *pInputAsText; + callAsText(inputType, strArray, valTypeArray, rowNum, &pInputAsText, pOutputAsText, TSDB_CODE_SUCCESS); + destroyScalarParam(pInputAsText, 1); +} + +void callAsTextWrapper2(int32_t inputType, void *strArray, TDRowValT valTypeArray[], int32_t rowNum, int32_t expectedCode) { + SScalarParam *pInputAsText; + SScalarParam *pOutputASText; + + callAsText(inputType, strArray, valTypeArray, rowNum, &pInputAsText, &pOutputASText, expectedCode); + + destroyScalarParam(pInputAsText, 1); + destroyScalarParam(pOutputASText, 1); +} + +void callMakePointAndCompareResult(int32_t type1, void *valueArray1, TDRowValT valTypeArray1[], bool isConstant1, + int32_t type2, void *valueArray2, TDRowValT valTypeArray2[], bool isConstant2, + SScalarParam *pExpectedResult, int32_t rowNum) { + int32_t rowNum1 = isConstant1 ? 1 : rowNum; + int32_t rowNum2 = isConstant2 ? 1 : rowNum; + + SScalarParam *pInputMakePoint = (SScalarParam *)taosMemoryCalloc(2, sizeof(SScalarParam)); + setScalarParam(pInputMakePoint, type1, valueArray1, valTypeArray1, rowNum1); + setScalarParam(pInputMakePoint + 1, type2, valueArray2, valTypeArray2, rowNum2); + + SScalarParam *pOutputMakePoint; + makeOneScalarParam(&pOutputMakePoint, TSDB_DATA_TYPE_GEOMETRY, 0, 0, rowNum); + + int32_t code = makePointFunction(pInputMakePoint, 2, pOutputMakePoint); + ASSERT_EQ(code, TSDB_CODE_SUCCESS); + + ASSERT_EQ(pOutputMakePoint->columnData->info.type, TSDB_DATA_TYPE_GEOMETRY); + ASSERT_EQ(pExpectedResult->columnData->info.type, TSDB_DATA_TYPE_GEOMETRY); + + compareVarDataColumn(pOutputMakePoint->columnData, pExpectedResult->columnData, rowNum); + + destroyScalarParam(pInputMakePoint, 2); + destroyScalarParam(pOutputMakePoint, 1); +} + +#define MAKE_POINT_FIRST_COLUMN_VALUES {2, 3, -4} +#define MAKE_POINT_SECOND_COLUMN_VALUES {5, -6, -7} + +TEST(GeomIoFuncTest, makePointFunctionTwoColumns) { + const int32_t rowNum = 3; + SScalarParam *pExpectedResult; + TDRowValT valTypeArray[rowNum] = {TD_VTYPE_NORM, TD_VTYPE_NORM, TD_VTYPE_NORM}; + + // call GeomFromText() and generate pExpectedResult to compare later + char strArray[rowNum][TSDB_MAX_BINARY_LEN]; + STR_TO_VARSTR(strArray[0], "POINT(2.0 5.0)"); + STR_TO_VARSTR(strArray[1], "POINT(3.0 -6.0)"); + STR_TO_VARSTR(strArray[2], "POINT(-4.0 -7.0)"); + callGeomFromTextWrapper2(strArray, valTypeArray, rowNum, &pExpectedResult); + + // call MakePoint() with TINYINT and SMALLINT, and compare with result of GeomFromText() + int8_t tinyIntArray1[rowNum] = MAKE_POINT_FIRST_COLUMN_VALUES; + int16_t smallIntArray2[rowNum] = MAKE_POINT_SECOND_COLUMN_VALUES; + callMakePointAndCompareResult(TSDB_DATA_TYPE_TINYINT, tinyIntArray1, valTypeArray, false, + TSDB_DATA_TYPE_SMALLINT, smallIntArray2, valTypeArray, false, + pExpectedResult, rowNum); + + // call MakePoint() with INT and BIGINT, and compare with result of GeomFromText() + int32_t intArray1[rowNum] = MAKE_POINT_FIRST_COLUMN_VALUES; + int64_t bigIntArray2[rowNum] = MAKE_POINT_SECOND_COLUMN_VALUES; + callMakePointAndCompareResult(TSDB_DATA_TYPE_INT, intArray1, valTypeArray, false, + TSDB_DATA_TYPE_BIGINT, bigIntArray2, valTypeArray, false, + pExpectedResult, rowNum); + + // call MakePoint() with FLOAT and DOUBLE, and compare with result of GeomFromText() + float floatArray1[rowNum] = MAKE_POINT_FIRST_COLUMN_VALUES; + double doubleArray2[rowNum] = MAKE_POINT_SECOND_COLUMN_VALUES; + callMakePointAndCompareResult(TSDB_DATA_TYPE_FLOAT, floatArray1, valTypeArray, false, + TSDB_DATA_TYPE_DOUBLE, doubleArray2, valTypeArray, false, + pExpectedResult, rowNum); + + destroyScalarParam(pExpectedResult, 1); +} + +TEST(GeomIoFuncTest, makePointFunctionConstant) { + const int32_t rowNum = 3; + SScalarParam *pExpectedResult; + TDRowValT valTypeArray[rowNum] = {TD_VTYPE_NORM, TD_VTYPE_NORM, TD_VTYPE_NORM}; + + // 1. call GeomFromText() and generate pExpectedResult with first constant + char strArray[rowNum][TSDB_MAX_BINARY_LEN]; + STR_TO_VARSTR(strArray[0], "POINT(3.0 5.0)"); + STR_TO_VARSTR(strArray[1], "POINT(3.0 -6.0)"); + STR_TO_VARSTR(strArray[2], "POINT(3.0 -7.0)"); + callGeomFromTextWrapper2(strArray, valTypeArray, rowNum, &pExpectedResult); + + // call MakePoint() with TINYINT constant and BIGINT column, and compare with result of GeomFromText() + int8_t tinyIntConstant = 3; + int64_t bigIntArray[rowNum] = MAKE_POINT_SECOND_COLUMN_VALUES; + callMakePointAndCompareResult(TSDB_DATA_TYPE_TINYINT, &tinyIntConstant, valTypeArray, true, + TSDB_DATA_TYPE_BIGINT, bigIntArray, valTypeArray, false, + pExpectedResult, rowNum); + + destroyScalarParam(pExpectedResult, 1); + + // 2. call GeomFromText() and generate pExpectedResult with second constant + STR_TO_VARSTR(strArray[0], "POINT(2.0 3.0)"); + STR_TO_VARSTR(strArray[1], "POINT(3.0 3.0)"); + STR_TO_VARSTR(strArray[2], "POINT(-4.0 3.0)"); + callGeomFromTextWrapper2(strArray, valTypeArray, rowNum, &pExpectedResult); + + // call MakePoint() with INT column and FLOAT constant, and compare with result of GeomFromText() + int32_t intArray[rowNum] = MAKE_POINT_FIRST_COLUMN_VALUES; + float floatConstant = 3; + callMakePointAndCompareResult(TSDB_DATA_TYPE_INT, intArray, valTypeArray, false, + TSDB_DATA_TYPE_FLOAT, &floatConstant, valTypeArray, true, + pExpectedResult, rowNum); + + destroyScalarParam(pExpectedResult, 1); +} + +TEST(GeomIoFuncTest, makePointFunctionWithNull) { + const int32_t rowNum = 3; + SScalarParam *pExpectedResult; + TDRowValT valTypeNormArray[rowNum] = {TD_VTYPE_NORM, TD_VTYPE_NORM, TD_VTYPE_NORM}; + + // call GeomFromText() and generate pExpectedResult with all NULL values + char strArray[rowNum][TSDB_MAX_BINARY_LEN]; + TDRowValT valTypeNullArray[rowNum] = {TD_VTYPE_NULL, TD_VTYPE_NULL, TD_VTYPE_NULL}; + callGeomFromTextWrapper2(strArray, valTypeNullArray, rowNum, &pExpectedResult); + + // 1. call MakePoint() with NULL type and INT column, and compare all NULL results + int64_t intArray[rowNum] = MAKE_POINT_SECOND_COLUMN_VALUES; + callMakePointAndCompareResult(TSDB_DATA_TYPE_NULL, 0, 0, true, + TSDB_DATA_TYPE_INT, intArray, valTypeNormArray, false, + pExpectedResult, rowNum); + // swap params and compare + callMakePointAndCompareResult(TSDB_DATA_TYPE_INT, intArray, valTypeNormArray, false, + TSDB_DATA_TYPE_NULL, 0, 0, true, + pExpectedResult, rowNum); + + // call MakePoint() with SMALLINT NULL constant and BIGINT column, and compare all NULL results + int16_t smallIntConstant = 0; + int64_t bigIntArray[rowNum] = MAKE_POINT_SECOND_COLUMN_VALUES; + callMakePointAndCompareResult(TSDB_DATA_TYPE_SMALLINT, &smallIntConstant, valTypeNullArray, true, + TSDB_DATA_TYPE_BIGINT, bigIntArray, valTypeNormArray, false, + pExpectedResult, rowNum); + // swap params and compare + callMakePointAndCompareResult(TSDB_DATA_TYPE_BIGINT, bigIntArray, valTypeNormArray, false, + TSDB_DATA_TYPE_SMALLINT, &smallIntConstant, valTypeNullArray, true, + pExpectedResult, rowNum); + + destroyScalarParam(pExpectedResult, 1); + + // 2. call GeomFromText() and generate pExpectedResult with NULL value + STR_TO_VARSTR(strArray[0], "POINT(2.0 5.0)"); + STR_TO_VARSTR(strArray[2], "POINT(-4.0 -7.0)"); + TDRowValT valTypeWithNullArray[rowNum] = {TD_VTYPE_NORM, TD_VTYPE_NULL, TD_VTYPE_NORM}; + callGeomFromTextWrapper2(strArray, valTypeWithNullArray, rowNum, &pExpectedResult); + + // call MakePoint() with TINYINT column with NULL value and FLOAT column, and compare results with NULL value + int8_t tinyIntArray[rowNum] = MAKE_POINT_FIRST_COLUMN_VALUES; + float floatArray[rowNum] = MAKE_POINT_SECOND_COLUMN_VALUES; + callMakePointAndCompareResult(TSDB_DATA_TYPE_TINYINT, tinyIntArray, valTypeWithNullArray, false, + TSDB_DATA_TYPE_FLOAT, floatArray, valTypeNormArray, false, + pExpectedResult, rowNum); + + // call MakePoint() with SMALLINT column and DOUBLE column with NULL value, and compare results with NULL value + int16_t smallIntArray[rowNum] = MAKE_POINT_FIRST_COLUMN_VALUES; + double doubleArray[rowNum] = MAKE_POINT_SECOND_COLUMN_VALUES; + callMakePointAndCompareResult(TSDB_DATA_TYPE_SMALLINT, smallIntArray, valTypeNormArray, false, + TSDB_DATA_TYPE_DOUBLE, doubleArray, valTypeWithNullArray, false, + pExpectedResult, rowNum); + + destroyScalarParam(pExpectedResult, 1); +} + +TEST(GeomIoFuncTest, geomFromTextFunction) { + const int32_t rowNum = 4; + char strArray[rowNum][TSDB_MAX_BINARY_LEN]; + TDRowValT valTypeNormArray[rowNum] = {TD_VTYPE_NORM, TD_VTYPE_NORM, TD_VTYPE_NORM, TD_VTYPE_NORM}; + + // column input + // input of GeomFromText (with NULL value) and output of AsText should be same after calling GeomFromText() and AsText() + SScalarParam *pInputGeomFromText; + SScalarParam *pOutputGeomFromText; + SScalarParam *pOutputAsText; + + STR_TO_VARSTR(strArray[0], "POINT (2.000000 5.000000)"); + STR_TO_VARSTR(strArray[2], "LINESTRING (3.000000 -6.000000, -71.160837 42.259113)"); + STR_TO_VARSTR(strArray[3], "POLYGON ((-71.177658 42.390290, -71.177682 42.390370, -71.177606 42.390382, -71.177582 42.390303, -71.177658 42.390290))"); + TDRowValT valTypeWithNullArray[rowNum] = {TD_VTYPE_NORM, TD_VTYPE_NULL, TD_VTYPE_NORM, TD_VTYPE_NORM}; + callGeomFromText(TSDB_DATA_TYPE_VARCHAR, strArray, valTypeWithNullArray, rowNum, &pInputGeomFromText, &pOutputGeomFromText, TSDB_CODE_SUCCESS); + + makeOneScalarParam(&pOutputAsText, TSDB_DATA_TYPE_VARCHAR, 0, 0, rowNum); + int32_t code = asTextFunction(pOutputGeomFromText, 1, pOutputAsText); // pOutputGeomFromText is input for AsText() + ASSERT_EQ(code, TSDB_CODE_SUCCESS); + + compareVarDataColumn(pInputGeomFromText->columnData, pOutputAsText->columnData, rowNum); + + destroyScalarParam(pInputGeomFromText, 1); + destroyScalarParam(pOutputGeomFromText, 1); + destroyScalarParam(pOutputAsText, 1); + + // empty input + STR_TO_VARSTR(strArray[0], ""); + callGeomFromTextWrapper4(strArray, valTypeNormArray, 1, TSDB_CODE_SUCCESS); + + // NULL type input + callGeomFromTextWrapper1(TSDB_DATA_TYPE_NULL, 0, 0, 1, &pOutputGeomFromText); + ASSERT_EQ(colDataIsNull_s(pOutputGeomFromText->columnData, 0), true); + destroyScalarParam(pOutputGeomFromText, 1); + + // wrong type input [ToDo] make sure it is handled in geomFunc + int32_t intInput = 3; + callGeomFromTextWrapper3(TSDB_DATA_TYPE_INT, &intInput, valTypeNormArray, 1, TSDB_CODE_FUNC_FUNTION_PARA_VALUE); + + // wrong content input + STR_TO_VARSTR(strArray[0], "POIN(2 5)"); // lack of the last letter of 'POINT' + callGeomFromTextWrapper4(strArray, valTypeNormArray, 1, TSDB_CODE_FUNC_FUNTION_PARA_VALUE); + STR_TO_VARSTR(strArray[0], "LINESTRING(3 -6.1,-7.1 4.2,)"); // redundant comma at the end + callGeomFromTextWrapper4(strArray, valTypeNormArray, 1, TSDB_CODE_FUNC_FUNTION_PARA_VALUE); + STR_TO_VARSTR(strArray[0], "POLYGON((-71.1 42.3,-71.2 42.4,-71.3 42.5,-71.1 42.8))"); // the first point and last one are not same + callGeomFromTextWrapper4(strArray, valTypeNormArray, 1, TSDB_CODE_FUNC_FUNTION_PARA_VALUE); +} + +TEST(GeomIoFuncTest, asTextFunction) { + // column input has been tested in geomFromTextFunction + + TDRowValT valTypeArray[1] = {TD_VTYPE_NORM}; + + // empty input + char strInput[TSDB_MAX_BINARY_LEN]; + STR_TO_VARSTR(strInput, ""); + SScalarParam *pOutputAsText; + callAsTextWrapper1(TSDB_DATA_TYPE_GEOMETRY, strInput, valTypeArray, 1, &pOutputAsText); + ASSERT_EQ(colDataIsNull_s(pOutputAsText->columnData, 0), true); + destroyScalarParam(pOutputAsText, 1); + + // NULL type input + callAsTextWrapper1(TSDB_DATA_TYPE_NULL, 0, 0, 1, &pOutputAsText); + ASSERT_EQ(colDataIsNull_s(pOutputAsText->columnData, 0), true); + destroyScalarParam(pOutputAsText, 1); + + // wrong type input [ToDo] make sure it is handled in geomFunc + int32_t intInput = 3; + callAsTextWrapper2(TSDB_DATA_TYPE_INT, &intInput, valTypeArray, 1, TSDB_CODE_FUNC_FUNTION_PARA_VALUE); + + // wrong content input + STR_TO_VARSTR(strInput, "XXX"); + callAsTextWrapper2(TSDB_DATA_TYPE_GEOMETRY, strInput, valTypeArray, 1, TSDB_CODE_FUNC_FUNTION_PARA_VALUE); +} diff --git a/source/libs/geometry/test/geomRelationFuncTest.cpp b/source/libs/geometry/test/geomRelationFuncTest.cpp new file mode 100644 index 0000000000..1084c94178 --- /dev/null +++ b/source/libs/geometry/test/geomRelationFuncTest.cpp @@ -0,0 +1,239 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "geomFuncTestUtil.h" + +void callGeomRelationFuncAndCompareResult(FScalarExecProcess geomRelationFunc, + SScalarParam *pInput, int32_t rowNum, + int32_t expectedCode, int8_t expectedResult[]) { + SScalarParam *pOutput; + makeOneScalarParam(&pOutput, TSDB_DATA_TYPE_BOOL, 0, 0, rowNum); + int32_t code = geomRelationFunc(pInput, 2, pOutput); + ASSERT_EQ(code, expectedCode); + + if (code == TSDB_CODE_SUCCESS) { + int8_t res = -1; + for (int32_t i = 0; i < rowNum; ++i) { + bool isNull1 = colDataIsNull_s(pOutput->columnData, i); + if (isNull1) { + res = -1; + } + else { + res = *(bool*)colDataGetData(pOutput->columnData, i); + } + + ASSERT_EQ(res, expectedResult[i]); + } + } + + destroyScalarParam(pOutput, 1); + destroyScalarParam(pInput, 2); +} + +/* +-- Use the following SQL to get expected results for all relation functions in PostgreSQL with PostGIS +WITH geom_str AS +(SELECT 'POINT(3.5 7.0)' AS g1, 'POINT(3.5 7.0)' AS g2 +UNION ALL +SELECT 'POINT(3.0 3.0)' AS g1, 'LINESTRING(1.0 1.0, 2.0 2.0, 5.0 6.0)' AS g2 +UNION ALL +SELECT 'POINT(3.0 6.0)' AS g1, 'POLYGON((3.0 6.0, 5.0 6.0, 5.0 8.0, 3.0 8.0, 3.0 6.0))' AS g2 +UNION ALL +SELECT 'LINESTRING(1.0 1.0, 2.0 2.0, 5.0 5.0)' AS g1, 'LINESTRING(1.0 4.0, 2.0 3.0, 5.0 0.0)' AS g2 +UNION ALL +SELECT 'LINESTRING(3.0 7.0, 4.0 7.0, 5.0 7.0)' AS g1, 'POLYGON((3.0 6.0, 5.0 6.0, 5.0 8.0, 3.0 8.0, 3.0 6.0))' AS g2 +UNION ALL +SELECT 'POLYGON((3.0 6.0, 5.0 6.0, 5.0 8.0, 3.0 8.0, 3.0 6.0))' AS g1, 'POLYGON((5.0 6.0, 7.0 6.0, 7.0 8.0, 5.0 8.0, 5.0 6.0))' AS g2 +) +SELECT ST_Intersects(g1, g2), ST_Equals(g1, g2), ST_Touches(g1, g2), ST_Covers(g1, g2), ST_Contains(g1, g2), ST_ContainsProperly(g1, g2) FROM geom_str +*/ +void geomRelationFuncTest(FScalarExecProcess geomRelationFunc, int8_t expectedResults[6][6]) { + const int32_t rowNum = 6; + + char strArray1[rowNum][TSDB_MAX_BINARY_LEN]; + STR_TO_VARSTR(strArray1[0], "POINT(3.5 7.0)"); + STR_TO_VARSTR(strArray1[1], "POINT(3.0 3.0)"); + STR_TO_VARSTR(strArray1[2], "POINT(3.0 6.0)"); + STR_TO_VARSTR(strArray1[3], "LINESTRING(1.0 1.0, 2.0 2.0, 5.0 5.0)"); + STR_TO_VARSTR(strArray1[4], "LINESTRING(3.0 7.0, 4.0 7.0, 5.0 7.0)"); + STR_TO_VARSTR(strArray1[5], "POLYGON((3.0 6.0, 5.0 6.0, 5.0 8.0, 3.0 8.0, 3.0 6.0))"); + TDRowValT valTypeArray1[rowNum] = {TD_VTYPE_NORM, TD_VTYPE_NORM, TD_VTYPE_NORM, TD_VTYPE_NORM, TD_VTYPE_NORM, TD_VTYPE_NORM}; + + char strArray2[rowNum][TSDB_MAX_BINARY_LEN]; + STR_TO_VARSTR(strArray2[0], "POINT(3.5 7.0)"); + STR_TO_VARSTR(strArray2[1], "LINESTRING(1.0 1.0, 2.0 2.0, 5.0 6.0)"); + STR_TO_VARSTR(strArray2[2], "POLYGON((3.0 6.0, 5.0 6.0, 5.0 8.0, 3.0 8.0, 3.0 6.0))"); + STR_TO_VARSTR(strArray2[3], "LINESTRING(1.0 4.0, 2.0 3.0, 5.0 0.0)"); + STR_TO_VARSTR(strArray2[4], "POLYGON((3.0 6.0, 5.0 6.0, 5.0 8.0, 3.0 8.0, 3.0 6.0))"); + STR_TO_VARSTR(strArray2[5], "POLYGON((5.0 6.0, 7.0 6.0, 7.0 8.0, 5.0 8.0, 5.0 6.0))"); + TDRowValT valTypeArray2[rowNum] = {TD_VTYPE_NORM, TD_VTYPE_NORM, TD_VTYPE_NORM, TD_VTYPE_NORM, TD_VTYPE_NORM, TD_VTYPE_NORM}; + + // two columns input + SScalarParam *pInput = (SScalarParam *)taosMemoryCalloc(2, sizeof(SScalarParam)); + callGeomFromTextWrapper5(strArray1, valTypeArray1, rowNum, pInput); //pInput come from GeomFromText() + callGeomFromTextWrapper5(strArray2, valTypeArray2, rowNum, pInput + 1); + callGeomRelationFuncAndCompareResult(geomRelationFunc, pInput, rowNum, TSDB_CODE_SUCCESS, expectedResults[0]); + + // swap two columns + pInput = (SScalarParam *)taosMemoryCalloc(2, sizeof(SScalarParam)); + callGeomFromTextWrapper5(strArray2, valTypeArray2, rowNum, pInput); + callGeomFromTextWrapper5(strArray1, valTypeArray1, rowNum, pInput + 1); + callGeomRelationFuncAndCompareResult(geomRelationFunc, pInput, rowNum, TSDB_CODE_SUCCESS, expectedResults[1]); + + // constant and column input + pInput = (SScalarParam *)taosMemoryCalloc(2, sizeof(SScalarParam)); + callGeomFromTextWrapper5(strArray1, valTypeArray1, 1, pInput); + callGeomFromTextWrapper5(strArray2, valTypeArray2, rowNum, pInput + 1); + callGeomRelationFuncAndCompareResult(geomRelationFunc, pInput, rowNum, TSDB_CODE_SUCCESS, expectedResults[2]); + + // column and constant input + pInput = (SScalarParam *)taosMemoryCalloc(2, sizeof(SScalarParam)); + callGeomFromTextWrapper5(strArray1, valTypeArray1, rowNum, pInput); + callGeomFromTextWrapper5(strArray2, valTypeArray2, 1, pInput + 1); + callGeomRelationFuncAndCompareResult(geomRelationFunc, pInput, rowNum, TSDB_CODE_SUCCESS, expectedResults[3]); + + // two constants input + pInput = (SScalarParam *)taosMemoryCalloc(2, sizeof(SScalarParam)); + callGeomFromTextWrapper5(strArray1, valTypeArray1, 1, pInput); + callGeomFromTextWrapper5(strArray2, valTypeArray2, 1, pInput + 1); + callGeomRelationFuncAndCompareResult(geomRelationFunc, pInput, 1, TSDB_CODE_SUCCESS, expectedResults[4]); + + // two columns with NULL value input + pInput = (SScalarParam *)taosMemoryCalloc(2, sizeof(SScalarParam)); + valTypeArray1[2] = TD_VTYPE_NULL; + valTypeArray2[4] = TD_VTYPE_NULL; + callGeomFromTextWrapper5(strArray1, valTypeArray1, rowNum, pInput); + callGeomFromTextWrapper5(strArray2, valTypeArray2, rowNum, pInput + 1); + callGeomRelationFuncAndCompareResult(geomRelationFunc, pInput, rowNum, TSDB_CODE_SUCCESS, expectedResults[5]); + + // first NULL type input + pInput = (SScalarParam *)taosMemoryCalloc(2, sizeof(SScalarParam)); + setScalarParam(pInput, TSDB_DATA_TYPE_NULL, 0, 0, 1); + callGeomFromTextWrapper5(strArray2, valTypeArray2, rowNum, pInput + 1); + int8_t expectedResultNullType[rowNum] = {-1, -1, -1, -1, -1, -1}; + callGeomRelationFuncAndCompareResult(geomRelationFunc, pInput, rowNum, TSDB_CODE_SUCCESS, expectedResultNullType); + + // second NULL type input + pInput = (SScalarParam *)taosMemoryCalloc(2, sizeof(SScalarParam)); + callGeomFromTextWrapper5(strArray1, valTypeArray1, rowNum, pInput); + setScalarParam(pInput + 1, TSDB_DATA_TYPE_NULL, 0, 0, 1); + callGeomRelationFuncAndCompareResult(geomRelationFunc, pInput, rowNum, TSDB_CODE_SUCCESS, expectedResultNullType); + + // first empty content input + pInput = (SScalarParam *)taosMemoryCalloc(2, sizeof(SScalarParam)); + char strInput[TSDB_MAX_BINARY_LEN]; + STR_TO_VARSTR(strInput, ""); + setScalarParam(pInput, TSDB_DATA_TYPE_GEOMETRY, strInput, valTypeArray1, 1); + callGeomFromTextWrapper5(strArray2, valTypeArray2, rowNum, pInput + 1); + callGeomRelationFuncAndCompareResult(geomRelationFunc, pInput, rowNum, TSDB_CODE_SUCCESS, expectedResultNullType); + + // first wrong type input + pInput = (SScalarParam *)taosMemoryCalloc(2, sizeof(SScalarParam)); + int32_t intInput = 3; + setScalarParam(pInput, TSDB_DATA_TYPE_INT, &intInput, valTypeArray1, 1); + callGeomFromTextWrapper5(strArray2, valTypeArray2, rowNum, pInput + 1); + callGeomRelationFuncAndCompareResult(geomRelationFunc, pInput, rowNum, TSDB_CODE_FUNC_FUNTION_PARA_VALUE, 0); + + // second wrong content input + pInput = (SScalarParam *)taosMemoryCalloc(2, sizeof(SScalarParam)); + STR_TO_VARSTR(strInput, "XXX"); + callGeomFromTextWrapper5(strArray1, valTypeArray1, rowNum, pInput); + setScalarParam(pInput + 1, TSDB_DATA_TYPE_GEOMETRY, strInput, valTypeArray2, 1); + callGeomRelationFuncAndCompareResult(geomRelationFunc, pInput, rowNum, TSDB_CODE_FUNC_FUNTION_PARA_VALUE, 0); +} + +TEST(GeomRelationFuncTest, intersectsFunction) { + // 1: true, 0: false, -1: null + int8_t expectedResults[6][6] = { + {1, 0, 1, 1, 1, 1}, // two columns + {1, 0, 1, 1, 1, 1}, // two columns swpped + {1, 0, 1, 0, 1, 0}, // first constant + {1, 0, 0, 0, 1, 1}, // second constant + {1}, // two constant + {1, 0, -1, 1, -1, 1} // with Null value + }; + + geomRelationFuncTest(intersectsFunction, expectedResults); +} + +TEST(GeomRelationFuncTest, equalsFunction) { + // 1: true, 0: false, -1: null + int8_t expectedResults[6][6] = { + {1, 0, 0, 0, 0, 0}, // two columns + {1, 0, 0, 0, 0, 0}, // two columns swapped + {1, 0, 0, 0, 0, 0}, // first constant + {1, 0, 0, 0, 0, 0}, // second constant + {1}, // two constant + {1, 0, -1, 0, -1, 0} // with Null value + }; + + geomRelationFuncTest(equalsFunction, expectedResults); +} + +TEST(GeomRelationFuncTest, touchesFunction) { + // 1: true, 0: false, -1: null + int8_t expectedResults[6][6] = { + {0, 0, 1, 0, 0, 1}, // two columns + {0, 0, 1, 0, 0, 1}, // two columns swapped + {0, 0, 0, 0, 0, 0}, // first constant + {0, 0, 0, 0, 0, 0}, // second constant + {0}, // two constant + {0, 0, -1, 0, -1, 1} // with Null value + }; + + geomRelationFuncTest(touchesFunction, expectedResults); +} + +TEST(GeomRelationFuncTest, coversFunction) { + // 1: true, 0: false, -1: null + int8_t expectedResults[6][6] = { + {1, 0, 0, 0, 0, 0}, // two columns + {1, 0, 1, 0, 1, 0}, // two columns swapped + {1, 0, 0, 0, 0, 0}, // first constant + {1, 0, 0, 0, 1, 1}, // second constant + {1}, // two constant + {1, 0, -1, 0, -1, 0} // with Null value + }; + + geomRelationFuncTest(coversFunction, expectedResults); +} + +TEST(GeomRelationFuncTest, containsFunction) { + // 1: true, 0: false, -1: null + int8_t expectedResults[6][6] = { + {1, 0, 0, 0, 0, 0}, // two columns + {1, 0, 0, 0, 1, 0}, // two columns swapped + {1, 0, 0, 0, 0, 0}, // first constant + {1, 0, 0, 0, 1, 1}, // second constant + {1}, // two constant + {1, 0, -1, 0, -1, 0} // with Null value + }; + + geomRelationFuncTest(containsFunction, expectedResults); +} + +TEST(GeomRelationFuncTest, containsProperlyFunction) { + // 1: true, 0: false, -1: null + int8_t expectedResults[6][6] = { + {1, 0, 0, 0, 0, 0}, // two columns + {1, 0, 0, 0, 0, 0}, // two columns swapped + {1, 0, 0, 0, 0, 0}, // first constant + {1, 0, 0, 0, 1, 1}, // second constant + {1}, // two constant + {1, 0, -1, 0, -1, 0} // with Null value + }; + + geomRelationFuncTest(containsProperlyFunction, expectedResults); +} diff --git a/source/libs/index/src/indexCache.c b/source/libs/index/src/indexCache.c index 8b0e712553..a6fbc73332 100644 --- a/source/libs/index/src/indexCache.c +++ b/source/libs/index/src/indexCache.c @@ -738,7 +738,7 @@ static MemTable* idxInternalCacheCreate(int8_t type) { MemTable* tbl = taosMemoryCalloc(1, sizeof(MemTable)); idxMemRef(tbl); - // if (ttype == TSDB_DATA_TYPE_BINARY || ttype == TSDB_DATA_TYPE_NCHAR) { + // if (ttype == TSDB_DATA_TYPE_BINARY || ttype == TSDB_DATA_TYPE_NCHAR || ttype == TSDB_DATA_TYPE_GEOMETRY) { tbl->mem = tSkipListCreate(MAX_SKIP_LIST_LEVEL, ttype, MAX_INDEX_KEY_LEN, cmpFn, SL_ALLOW_DUP_KEY, idxCacheTermGet); //} return tbl; diff --git a/source/libs/index/src/indexComm.c b/source/libs/index/src/indexComm.c index c2ac7f4478..a0310a9f0e 100644 --- a/source/libs/index/src/indexComm.c +++ b/source/libs/index/src/indexComm.c @@ -76,7 +76,7 @@ char* idxInt2str(int64_t val, char* dst, int radix) { return dst - 1; } __compar_fn_t idxGetCompar(int8_t type) { - if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR) { + if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_GEOMETRY) { return (__compar_fn_t)strcmp; } return getComparFunc(type, 0); @@ -107,7 +107,8 @@ static FORCE_INLINE TExeCond tCompareEqual(void* a, void* b, int8_t type) { return tCompare(func, QUERY_TERM, a, b, type); } TExeCond tCompare(__compar_fn_t func, int8_t cmptype, void* a, void* b, int8_t dtype) { - if (dtype == TSDB_DATA_TYPE_BINARY || dtype == TSDB_DATA_TYPE_NCHAR || dtype == TSDB_DATA_TYPE_VARBINARY) { + if (dtype == TSDB_DATA_TYPE_BINARY || dtype == TSDB_DATA_TYPE_NCHAR || + dtype == TSDB_DATA_TYPE_VARBINARY || dtype == TSDB_DATA_TYPE_GEOMETRY) { return tDoCompare(func, cmptype, a, b); } #if 1 @@ -354,7 +355,8 @@ int32_t idxConvertData(void* src, int8_t type, void** dst) { break; } - case TSDB_DATA_TYPE_VARCHAR: { // TSDB_DATA_TYPE_BINARY + case TSDB_DATA_TYPE_VARCHAR: // TSDB_DATA_TYPE_BINARY + case TSDB_DATA_TYPE_GEOMETRY: { tlen = taosEncodeBinary(NULL, src, strlen(src)); *dst = taosMemoryCalloc(1, tlen + 1); tlen = taosEncodeBinary(dst, src, strlen(src)); @@ -444,7 +446,8 @@ int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) { *dst = (char*)*dst - tlen; break; } - case TSDB_DATA_TYPE_VARCHAR: { // TSDB_DATA_TYPE_BINARY + case TSDB_DATA_TYPE_VARCHAR: // TSDB_DATA_TYPE_BINARY + case TSDB_DATA_TYPE_GEOMETRY: { tlen = taosEncodeBinary(NULL, varDataVal(src), varDataLen(src)); *dst = taosMemoryCalloc(1, tlen + 1); tlen = taosEncodeBinary(dst, varDataVal(src), varDataLen(src)); diff --git a/source/libs/index/src/indexJson.c b/source/libs/index/src/indexJson.c index 32b794cb71..1b4f847919 100644 --- a/source/libs/index/src/indexJson.c +++ b/source/libs/index/src/indexJson.c @@ -25,7 +25,7 @@ int indexJsonPut(SIndexJson *index, SIndexJsonMultiTerm *terms, uint64_t uid) { if (p->colType == TSDB_DATA_TYPE_BOOL) { p->colType = TSDB_DATA_TYPE_INT; } else if (p->colType == TSDB_DATA_TYPE_VARCHAR || p->colType == TSDB_DATA_TYPE_NCHAR || - p->colType == TSDB_DATA_TYPE_BINARY) { + p->colType == TSDB_DATA_TYPE_BINARY || p->colType == TSDB_DATA_TYPE_GEOMETRY) { // p->colType = TSDB_DATA_TYPE_NCHAR; } else { p->colType = TSDB_DATA_TYPE_DOUBLE; @@ -43,7 +43,7 @@ int indexJsonSearch(SIndexJson *index, SIndexJsonMultiTermQuery *tq, SArray *res if (p->colType == TSDB_DATA_TYPE_BOOL) { p->colType = TSDB_DATA_TYPE_INT; } else if (p->colType == TSDB_DATA_TYPE_VARCHAR || p->colType == TSDB_DATA_TYPE_NCHAR || - p->colType == TSDB_DATA_TYPE_BINARY) { + p->colType == TSDB_DATA_TYPE_BINARY || p->colType == TSDB_DATA_TYPE_GEOMETRY) { // p->colType = TSDB_DATA_TYPE_NCHAR; } else { p->colType = TSDB_DATA_TYPE_DOUBLE; diff --git a/source/libs/index/src/indexTfile.c b/source/libs/index/src/indexTfile.c index cdd1cc7386..9b6ba40318 100644 --- a/source/libs/index/src/indexTfile.c +++ b/source/libs/index/src/indexTfile.c @@ -545,7 +545,8 @@ int tfileWriterPut(TFileWriter* tw, void* data, bool order) { int8_t colType = tw->header.colType; colType = IDX_TYPE_GET_TYPE(colType); - if (colType == TSDB_DATA_TYPE_BINARY || colType == TSDB_DATA_TYPE_NCHAR) { + if (colType == TSDB_DATA_TYPE_BINARY || colType == TSDB_DATA_TYPE_NCHAR || + colType == TSDB_DATA_TYPE_GEOMETRY) { fn = tfileStrCompare; } else { fn = getComparFunc(colType, 0); diff --git a/source/libs/index/test/indexBench.cc b/source/libs/index/test/indexBench.cc index b828be0ffe..78c687029c 100644 --- a/source/libs/index/test/indexBench.cc +++ b/source/libs/index/test/indexBench.cc @@ -87,7 +87,7 @@ SIndexTerm *indexTermCreateT(int64_t suid, SIndexOperOnColumn oper, uint8_t colT int16_t sz = nColVal; memcpy(buf, (uint16_t *)&sz, 2); memcpy(buf + 2, colVal, nColVal); - if (colType == TSDB_DATA_TYPE_BINARY) { + if (colType == TSDB_DATA_TYPE_BINARY || colType == TSDB_DATA_TYPE_GEOMETRY) { return indexTermCreate(suid, oper, colType, colName, nColName, buf, sizeof(buf)); } else { return indexTermCreate(suid, oper, colType, colName, nColName, colVal, nColVal); diff --git a/source/libs/index/test/indexTests.cc b/source/libs/index/test/indexTests.cc index 08bf84ff60..612ce107c7 100644 --- a/source/libs/index/test/indexTests.cc +++ b/source/libs/index/test/indexTests.cc @@ -574,7 +574,7 @@ SIndexTerm* indexTermCreateT(int64_t suid, SIndexOperOnColumn oper, uint8_t colT int16_t sz = nColVal; memcpy(buf, (uint16_t*)&sz, 2); memcpy(buf + 2, colVal, nColVal); - if (colType == TSDB_DATA_TYPE_BINARY) { + if (colType == TSDB_DATA_TYPE_BINARY || colType == TSDB_DATA_TYPE_GEOMETRY) { return indexTermCreate(suid, oper, colType, colName, nColName, buf, sizeof(buf)); } else { return indexTermCreate(suid, oper, colType, colName, nColName, colVal, nColVal); diff --git a/source/libs/index/test/jsonUT.cc b/source/libs/index/test/jsonUT.cc index 8ae3fd4135..0e76980799 100644 --- a/source/libs/index/test/jsonUT.cc +++ b/source/libs/index/test/jsonUT.cc @@ -24,7 +24,7 @@ SIndexTerm* indexTermCreateT(int64_t suid, SIndexOperOnColumn oper, uint8_t colT int16_t sz = nColVal; memcpy(buf, (uint16_t*)&sz, 2); memcpy(buf + 2, colVal, nColVal); - if (colType == TSDB_DATA_TYPE_BINARY) { + if (colType == TSDB_DATA_TYPE_BINARY || colType == TSDB_DATA_TYPE_GEOMETRY) { return indexTermCreate(suid, oper, colType, colName, nColName, buf, sizeof(buf)); } else { return indexTermCreate(suid, oper, colType, colName, nColName, colVal, nColVal); diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index 0f4e7bde63..2115044228 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -157,7 +157,8 @@ static int32_t valueNodeCopy(const SValueNode* pSrc, SValueNode* pDst) { break; case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_VARCHAR: - case TSDB_DATA_TYPE_VARBINARY: { + case TSDB_DATA_TYPE_VARBINARY: + case TSDB_DATA_TYPE_GEOMETRY: { int32_t len = pSrc->node.resType.bytes + 1; pDst->datum.p = taosMemoryCalloc(1, len); if (NULL == pDst->datum.p) { diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index 136d1fc391..a6d808608d 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -3176,6 +3176,7 @@ static int32_t datumToJson(const void* pObj, SJson* pJson) { } case TSDB_DATA_TYPE_VARCHAR: case TSDB_DATA_TYPE_VARBINARY: + case TSDB_DATA_TYPE_GEOMETRY: code = tjsonAddStringToObject(pJson, jkValueDatum, varDataVal(pNode->datum.p)); break; case TSDB_DATA_TYPE_JSON: { @@ -3289,7 +3290,8 @@ static int32_t jsonToDatum(const SJson* pJson, void* pObj) { break; case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_VARCHAR: - case TSDB_DATA_TYPE_VARBINARY: { + case TSDB_DATA_TYPE_VARBINARY: + case TSDB_DATA_TYPE_GEOMETRY: { pNode->datum.p = taosMemoryCalloc(1, pNode->node.resType.bytes + 1); if (NULL == pNode->datum.p) { code = TSDB_CODE_OUT_OF_MEMORY; @@ -5510,6 +5512,7 @@ static const char* jkDropDnodeStmtDnodeId = "DnodeId"; static const char* jkDropDnodeStmtFqdn = "Fqdn"; static const char* jkDropDnodeStmtPort = "Port"; static const char* jkDropDnodeStmtForce = "Force"; +static const char* jkDropDnodeStmtUnsafe = "Unsafe"; static int32_t dropDnodeStmtToJson(const void* pObj, SJson* pJson) { const SDropDnodeStmt* pNode = (const SDropDnodeStmt*)pObj; @@ -5524,6 +5527,9 @@ static int32_t dropDnodeStmtToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddBoolToObject(pJson, jkDropDnodeStmtForce, pNode->force); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddBoolToObject(pJson, jkDropDnodeStmtUnsafe, pNode->unsafe); + } return code; } @@ -5541,6 +5547,9 @@ static int32_t jsonToDropDnodeStmt(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetBoolValue(pJson, jkDropDnodeStmtForce, &pNode->force); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetBoolValue(pJson, jkDropDnodeStmtUnsafe, &pNode->unsafe); + } return code; } diff --git a/source/libs/nodes/src/nodesEqualFuncs.c b/source/libs/nodes/src/nodesEqualFuncs.c index 156744ef1d..eed70cfccf 100644 --- a/source/libs/nodes/src/nodesEqualFuncs.c +++ b/source/libs/nodes/src/nodesEqualFuncs.c @@ -109,6 +109,7 @@ static bool valueNodeEqual(const SValueNode* a, const SValueNode* b) { case TSDB_DATA_TYPE_VARCHAR: case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_NCHAR: + case TSDB_DATA_TYPE_GEOMETRY: COMPARE_VARDATA_FIELD(datum.p); break; case TSDB_DATA_TYPE_JSON: diff --git a/source/libs/nodes/src/nodesMsgFuncs.c b/source/libs/nodes/src/nodesMsgFuncs.c index c06eb62771..4ffd38ee36 100644 --- a/source/libs/nodes/src/nodesMsgFuncs.c +++ b/source/libs/nodes/src/nodesMsgFuncs.c @@ -825,6 +825,7 @@ static int32_t datumToMsg(const void* pObj, STlvEncoder* pEncoder) { case TSDB_DATA_TYPE_VARCHAR: case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_NCHAR: + case TSDB_DATA_TYPE_GEOMETRY: code = tlvEncodeBinary(pEncoder, VALUE_CODE_DATUM, pNode->datum.p, varDataTLen(pNode->datum.p)); break; case TSDB_DATA_TYPE_JSON: @@ -923,7 +924,8 @@ static int32_t msgToDatum(STlv* pTlv, void* pObj) { break; case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_VARCHAR: - case TSDB_DATA_TYPE_VARBINARY: { + case TSDB_DATA_TYPE_VARBINARY: + case TSDB_DATA_TYPE_GEOMETRY: { if (pTlv->len > pNode->node.resType.bytes + VARSTR_HEADER_SIZE) { code = TSDB_CODE_FAILED; break; diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index d29afd82a9..17a5677987 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -1575,6 +1575,7 @@ void* nodesGetValueFromNode(SValueNode* pNode) { case TSDB_DATA_TYPE_VARCHAR: case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_JSON: + case TSDB_DATA_TYPE_GEOMETRY: return (void*)pNode->datum.p; default: break; @@ -1637,6 +1638,7 @@ int32_t nodesSetValueNodeValue(SValueNode* pNode, void* value) { case TSDB_DATA_TYPE_VARCHAR: case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_JSON: + case TSDB_DATA_TYPE_GEOMETRY: pNode->datum.p = (char*)value; break; default: @@ -1694,7 +1696,8 @@ char* nodesGetStrValueFromNode(SValueNode* pNode) { } case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_VARCHAR: - case TSDB_DATA_TYPE_VARBINARY: { + case TSDB_DATA_TYPE_VARBINARY: + case TSDB_DATA_TYPE_GEOMETRY: { int32_t bufSize = varDataLen(pNode->datum.p) + 2 + 1; void* buf = taosMemoryMalloc(bufSize); if (NULL == buf) { @@ -2130,6 +2133,7 @@ void nodesValueNodeToVariant(const SValueNode* pNode, SVariant* pVal) { case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_VARCHAR: case TSDB_DATA_TYPE_VARBINARY: + case TSDB_DATA_TYPE_GEOMETRY: pVal->pz = taosMemoryMalloc(pVal->nLen + 1); memcpy(pVal->pz, pNode->datum.p, pVal->nLen); pVal->pz[pVal->nLen] = 0; diff --git a/source/libs/parser/CMakeLists.txt b/source/libs/parser/CMakeLists.txt index 860250df85..41553918e1 100644 --- a/source/libs/parser/CMakeLists.txt +++ b/source/libs/parser/CMakeLists.txt @@ -8,7 +8,7 @@ target_include_directories( target_link_libraries( parser - PRIVATE os util nodes catalog function scalar transport qcom + PRIVATE os util nodes catalog function scalar geometry transport qcom ) if(${BUILD_TEST}) diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 1d1a522d01..43765c8112 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -192,7 +192,7 @@ SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const ST SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t alterType, const SToken* pVal); SNode* createDropUserStmt(SAstCreateContext* pCxt, SToken* pUserName); SNode* createCreateDnodeStmt(SAstCreateContext* pCxt, const SToken* pFqdn, const SToken* pPort); -SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, bool force); +SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, bool force, bool unsafe); SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const SToken* pConfig, const SToken* pValue); SNode* createRealTableNodeForIndexName(SAstCreateContext* pCxt, SToken* pDbName, SToken* pIndexName); SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool ignoreExists, SNode* pIndexName, diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index b682cdd4fd..9b8393f624 100755 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -126,8 +126,10 @@ with_opt(A) ::= WITH search_condition(B). /************************************************ create/drop/alter/restore dnode *********************************************/ cmd ::= CREATE DNODE dnode_endpoint(A). { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &A, NULL); } cmd ::= CREATE DNODE dnode_endpoint(A) PORT NK_INTEGER(B). { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &A, &B); } -cmd ::= DROP DNODE NK_INTEGER(A) force_opt(B). { pCxt->pRootNode = createDropDnodeStmt(pCxt, &A, B); } -cmd ::= DROP DNODE dnode_endpoint(A) force_opt(B). { pCxt->pRootNode = createDropDnodeStmt(pCxt, &A, B); } +cmd ::= DROP DNODE NK_INTEGER(A) force_opt(B). { pCxt->pRootNode = createDropDnodeStmt(pCxt, &A, B, false); } +cmd ::= DROP DNODE dnode_endpoint(A) force_opt(B). { pCxt->pRootNode = createDropDnodeStmt(pCxt, &A, B, false); } +cmd ::= DROP DNODE NK_INTEGER(A) unsafe_opt(B). { pCxt->pRootNode = createDropDnodeStmt(pCxt, &A, false, B); } +cmd ::= DROP DNODE dnode_endpoint(A) unsafe_opt(B). { pCxt->pRootNode = createDropDnodeStmt(pCxt, &A, false, B); } cmd ::= ALTER DNODE NK_INTEGER(A) NK_STRING(B). { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &A, &B, NULL); } cmd ::= ALTER DNODE NK_INTEGER(A) NK_STRING(B) NK_STRING(C). { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &A, &B, &C); } cmd ::= ALTER ALL DNODES NK_STRING(A). { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &A, NULL); } @@ -145,6 +147,10 @@ dnode_endpoint(A) ::= NK_IPTOKEN(B). force_opt(A) ::= . { A = false; } force_opt(A) ::= FORCE. { A = true; } +%type unsafe_opt { bool } +%destructor unsafe_opt { } +unsafe_opt(A) ::= UNSAFE. { A = true; } + /************************************************ alter local *********************************************************/ cmd ::= ALTER LOCAL NK_STRING(A). { pCxt->pRootNode = createAlterLocalStmt(pCxt, &A, NULL); } cmd ::= ALTER LOCAL NK_STRING(A) NK_STRING(B). { pCxt->pRootNode = createAlterLocalStmt(pCxt, &A, &B); } @@ -376,6 +382,7 @@ type_name(A) ::= VARCHAR NK_LP NK_INTEGER(B) NK_RP. type_name(A) ::= MEDIUMBLOB. { A = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } type_name(A) ::= BLOB. { A = createDataType(TSDB_DATA_TYPE_BLOB); } type_name(A) ::= VARBINARY NK_LP NK_INTEGER(B) NK_RP. { A = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &B); } +type_name(A) ::= GEOMETRY NK_LP NK_INTEGER(B) NK_RP. { A = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &B); } type_name(A) ::= DECIMAL. { A = createDataType(TSDB_DATA_TYPE_DECIMAL); } type_name(A) ::= DECIMAL NK_LP NK_INTEGER NK_RP. { A = createDataType(TSDB_DATA_TYPE_DECIMAL); } type_name(A) ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP. { A = createDataType(TSDB_DATA_TYPE_DECIMAL); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index eeccf18c7b..4223455b65 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -498,7 +498,7 @@ SNode* createCastFunctionNode(SAstCreateContext* pCxt, SNode* pExpr, SDataType d CHECK_OUT_OF_MEM(func); strcpy(func->functionName, "cast"); func->node.resType = dt; - if (TSDB_DATA_TYPE_VARCHAR == dt.type) { + if (TSDB_DATA_TYPE_VARCHAR == dt.type || TSDB_DATA_TYPE_GEOMETRY == dt.type) { func->node.resType.bytes = func->node.resType.bytes + VARSTR_HEADER_SIZE; } else if (TSDB_DATA_TYPE_NCHAR == dt.type) { func->node.resType.bytes = func->node.resType.bytes * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE; @@ -1576,7 +1576,7 @@ SNode* createCreateDnodeStmt(SAstCreateContext* pCxt, const SToken* pFqdn, const return (SNode*)pStmt; } -SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, bool force) { +SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, bool force, bool unsafe) { CHECK_PARSER_STATUS(pCxt); SDropDnodeStmt* pStmt = (SDropDnodeStmt*)nodesMakeNode(QUERY_NODE_DROP_DNODE_STMT); CHECK_OUT_OF_MEM(pStmt); @@ -1589,6 +1589,7 @@ SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, bool f } } pStmt->force = force; + pStmt->unsafe = unsafe; return (SNode*)pStmt; } diff --git a/source/libs/parser/src/parInsertSml.c b/source/libs/parser/src/parInsertSml.c index dbf5931e8a..0e5ffc57da 100644 --- a/source/libs/parser/src/parInsertSml.c +++ b/source/libs/parser/src/parInsertSml.c @@ -134,7 +134,8 @@ static int32_t smlBuildTagRow(SArray* cols, SBoundColInfo* tags, SSchema* pSchem taosArrayPush(*tagName, pTagSchema->name); STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; // strcpy(val.colName, pTagSchema->name); - if (pTagSchema->type == TSDB_DATA_TYPE_BINARY) { + if (pTagSchema->type == TSDB_DATA_TYPE_BINARY || + pTagSchema->type == TSDB_DATA_TYPE_GEOMETRY) { val.pData = (uint8_t*)kv->value; val.nData = kv->length; } else if (pTagSchema->type == TSDB_DATA_TYPE_NCHAR) { @@ -236,7 +237,7 @@ int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* data, int32 } pVal->value.pData = pUcs4; pVal->value.nData = len; - } else if (kv->type == TSDB_DATA_TYPE_BINARY) { + } else if (kv->type == TSDB_DATA_TYPE_BINARY || kv->type == TSDB_DATA_TYPE_GEOMETRY) { pVal->value.nData = kv->length; pVal->value.pData = (uint8_t*)kv->value; } else { @@ -363,7 +364,7 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc } pVal->value.pData = pUcs4; pVal->value.nData = len; - } else if (kv->type == TSDB_DATA_TYPE_BINARY) { + } else if (kv->type == TSDB_DATA_TYPE_BINARY || kv->type == TSDB_DATA_TYPE_GEOMETRY) { pVal->value.nData = kv->length; pVal->value.pData = (uint8_t*)kv->value; } else { diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 02de9f227d..43a73af3c3 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -18,6 +18,7 @@ #include "scalar.h" #include "tglobal.h" #include "ttime.h" +#include "geosWrapper.h" #define NEXT_TOKEN_WITH_PREV(pSql, token) \ do { \ @@ -305,6 +306,26 @@ static int parseTime(const char** end, SToken* pToken, int16_t timePrec, int64_t return TSDB_CODE_SUCCESS; } +// need to call geosFreeBuffer(*output) later +static int parseGeometry(SToken *pToken, unsigned char **output, size_t *size) { + int32_t code = TSDB_CODE_FAILED; + + //[ToDo] support to parse WKB as well as WKT + if (pToken->type == TK_NK_STRING) { + code = initCtxGeomFromText(); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + code = doGeomFromText(pToken->z, output, size); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + } + + return code; +} + static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema, int16_t timePrec, STagVal* val, SMsgBuf* pMsgBuf) { int64_t iv; @@ -446,7 +467,8 @@ static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema, break; } - case TSDB_DATA_TYPE_BINARY: { + case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_GEOMETRY: { // Too long values will raise the invalid sql error message if (pToken->n + VARSTR_HEADER_SIZE > pSchema->bytes) { return generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name); @@ -1350,6 +1372,37 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql, pVal->value.nData = pToken->n; break; } + case TSDB_DATA_TYPE_GEOMETRY: { + int32_t code = TSDB_CODE_FAILED; + unsigned char *output = NULL; + size_t size = 0; + + code = parseGeometry(pToken, &output, &size); + if (code != TSDB_CODE_SUCCESS) { + code = buildSyntaxErrMsg(&pCxt->msg, getThreadLocalGeosCtx()->errMsg, pToken->z); + } + // Too long values will raise the invalid sql error message + else if (size > pSchema->bytes) { + code = generateSyntaxErrMsg(&pCxt->msg, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name); + } + else { + pVal->value.pData = taosMemoryMalloc(size); + if (NULL == pVal->value.pData) { + code = TSDB_CODE_OUT_OF_MEMORY; + } + else { + memcpy(pVal->value.pData, output, size); + pVal->value.nData = size; + } + } + + geosFreeBuffer(output); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + break; + } case TSDB_DATA_TYPE_TIMESTAMP: { if (parseTime(pSql, pToken, timePrec, &pVal->value.val, &pCxt->msg) != TSDB_CODE_SUCCESS) { return buildSyntaxErrMsg(&pCxt->msg, "invalid timestamp", pToken->z); diff --git a/source/libs/parser/src/parInsertStmt.c b/source/libs/parser/src/parInsertStmt.c index 922a0f45ff..f654d2527f 100644 --- a/source/libs/parser/src/parInsertStmt.c +++ b/source/libs/parser/src/parInsertStmt.c @@ -128,7 +128,8 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch } else { STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; // strcpy(val.colName, pTagSchema->name); - if (pTagSchema->type == TSDB_DATA_TYPE_BINARY) { + if (pTagSchema->type == TSDB_DATA_TYPE_BINARY || + pTagSchema->type == TSDB_DATA_TYPE_GEOMETRY) { val.pData = (uint8_t*)bind[c].buffer; val.nData = colLen; } else if (pTagSchema->type == TSDB_DATA_TYPE_NCHAR) { diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 5c1f4bf98c..3af2d440c9 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -103,6 +103,7 @@ static SKeyword keywordTable[] = { {"FORCE", TK_FORCE}, {"FUNCTION", TK_FUNCTION}, {"FUNCTIONS", TK_FUNCTIONS}, + {"GEOMETRY", TK_GEOMETRY}, {"GRANT", TK_GRANT}, {"GRANTS", TK_GRANTS}, {"GROUP", TK_GROUP}, @@ -241,6 +242,7 @@ static SKeyword keywordTable[] = { {"TSERIES", TK_TSERIES}, {"TTL", TK_TTL}, {"UNION", TK_UNION}, + {"UNSAFE", TK_UNSAFE}, {"UNSIGNED", TK_UNSIGNED}, {"UNTREATED", TK_UNTREATED}, {"UPDATE", TK_UPDATE}, diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index c5fe3a1f73..864513f15d 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1168,7 +1168,8 @@ static EDealRes translateNormalValue(STranslateContext* pCxt, SValueNode* pVal, break; } case TSDB_DATA_TYPE_VARCHAR: - case TSDB_DATA_TYPE_VARBINARY: { + case TSDB_DATA_TYPE_VARBINARY: + case TSDB_DATA_TYPE_GEOMETRY: { if (strict && (pVal->node.resType.bytes > targetDt.bytes - VARSTR_HEADER_SIZE)) { return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); } @@ -1241,7 +1242,7 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD } static int32_t calcTypeBytes(SDataType dt) { - if (TSDB_DATA_TYPE_BINARY == dt.type) { + if (TSDB_DATA_TYPE_BINARY == dt.type || TSDB_DATA_TYPE_GEOMETRY == dt.type) { return dt.bytes + VARSTR_HEADER_SIZE; } else if (TSDB_DATA_TYPE_NCHAR == dt.type) { return dt.bytes * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE; @@ -1523,14 +1524,15 @@ static int32_t translateInterpFunc(STranslateContext* pCxt, SFunctionNode* pFunc SSelectStmt* pSelect = (SSelectStmt*)pCxt->pCurrStmt; SNode* pTable = pSelect->pFromTable; - if ((NULL != pTable && QUERY_NODE_REAL_TABLE != nodeType(pTable))) { - return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE, - "%s is only supported in single table query", pFunc->functionName); - } - if (pSelect->hasAggFuncs || pSelect->hasMultiRowsFunc || pSelect->hasIndefiniteRowsFunc) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC); } + + if (pSelect->hasInterpFunc && (FUNC_RETURN_ROWS_INDEFINITE == pSelect->returnRows || pSelect->returnRows != fmGetFuncReturnRows(pFunc))) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC, + "%s ignoring null value options cannot be used when applying to multiple columns", pFunc->functionName); + } + if (NULL != pSelect->pWindow || NULL != pSelect->pGroupByList) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC, "%s function is not supported in window query or group query", pFunc->functionName); @@ -1731,7 +1733,10 @@ static void setFuncClassification(SNode* pCurrStmt, SFunctionNode* pFunc) { if (fmIsIndefiniteRowsFunc(pFunc->funcId)) { pSelect->hasIndefiniteRowsFunc = true; pSelect->returnRows = fmGetFuncReturnRows(pFunc); + } else if (fmIsInterpFunc(pFunc->funcId)) { + pSelect->returnRows = fmGetFuncReturnRows(pFunc); } + pSelect->hasMultiRowsFunc = pSelect->hasMultiRowsFunc ? true : fmIsMultiRowsFunc(pFunc->funcId); if (fmIsSelectFunc(pFunc->funcId)) { pSelect->hasSelectFunc = true; @@ -2916,6 +2921,7 @@ static int32_t getPositionValue(const SValueNode* pVal) { case TSDB_DATA_TYPE_VARCHAR: case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_JSON: + case TSDB_DATA_TYPE_GEOMETRY: return -1; case TSDB_DATA_TYPE_BOOL: return (pVal->datum.b ? 1 : 0); @@ -4611,7 +4617,8 @@ static int32_t checkTableTagsSchema(STranslateContext* pCxt, SHashObj* pHash, SN } if (TSDB_CODE_SUCCESS == code) { if ((TSDB_DATA_TYPE_VARCHAR == pTag->dataType.type && calcTypeBytes(pTag->dataType) > TSDB_MAX_TAGS_LEN) || - (TSDB_DATA_TYPE_NCHAR == pTag->dataType.type && calcTypeBytes(pTag->dataType) > TSDB_MAX_TAGS_LEN)) { + (TSDB_DATA_TYPE_NCHAR == pTag->dataType.type && calcTypeBytes(pTag->dataType) > TSDB_MAX_TAGS_LEN) || + (TSDB_DATA_TYPE_GEOMETRY == pTag->dataType.type && calcTypeBytes(pTag->dataType) > TSDB_MAX_TAGS_LEN)) { code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN); } } @@ -4662,7 +4669,8 @@ static int32_t checkTableColsSchema(STranslateContext* pCxt, SHashObj* pHash, in } if (TSDB_CODE_SUCCESS == code) { if ((TSDB_DATA_TYPE_VARCHAR == pCol->dataType.type && calcTypeBytes(pCol->dataType) > TSDB_MAX_BINARY_LEN) || - (TSDB_DATA_TYPE_NCHAR == pCol->dataType.type && calcTypeBytes(pCol->dataType) > TSDB_MAX_NCHAR_LEN)) { + (TSDB_DATA_TYPE_NCHAR == pCol->dataType.type && calcTypeBytes(pCol->dataType) > TSDB_MAX_NCHAR_LEN) || + (TSDB_DATA_TYPE_GEOMETRY == pCol->dataType.type && calcTypeBytes(pCol->dataType) > TSDB_MAX_GEOMETRY_LEN)) { code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN); } } @@ -5517,6 +5525,7 @@ static int32_t translateDropDnode(STranslateContext* pCxt, SDropDnodeStmt* pStmt strcpy(dropReq.fqdn, pStmt->fqdn); dropReq.port = pStmt->port; dropReq.force = pStmt->force; + dropReq.unsafe = pStmt->unsafe; return buildCmdMsg(pCxt, TDMT_MND_DROP_DNODE, (FSerializeFunc)tSerializeSDropDnodeReq, &dropReq); } diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index 14da6f8aab..5597bd3df8 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -305,6 +305,7 @@ int32_t trimString(const char* src, int32_t len, char* dst, int32_t dlen) { dst[j] = src[k]; j++; } + if (j >= dlen) j = dlen - 1; dst[j] = '\0'; return j; } diff --git a/source/libs/parser/src/parser.c b/source/libs/parser/src/parser.c index 47482db740..28d116c381 100644 --- a/source/libs/parser/src/parser.c +++ b/source/libs/parser/src/parser.c @@ -99,6 +99,7 @@ static int32_t setValueByBindParam(SValueNode* pVal, TAOS_MULTI_BIND* pParam) { switch (pParam->buffer_type) { case TSDB_DATA_TYPE_VARCHAR: case TSDB_DATA_TYPE_VARBINARY: + case TSDB_DATA_TYPE_GEOMETRY: pVal->datum.p = taosMemoryCalloc(1, pVal->node.resType.bytes + VARSTR_HEADER_SIZE + 1); if (NULL == pVal->datum.p) { return TSDB_CODE_OUT_OF_MEMORY; diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index bb0b040035..43ef166c41 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -25,7 +25,6 @@ #include #include /************ Begin %include sections from the grammar ************************/ -#line 11 "sql.y" #include #include @@ -42,7 +41,6 @@ #include "parAst.h" #define YYSTACKDEPTH 0 -#line 46 "sql.c" /**************** End of %include directives **********************************/ /* These constants specify the various numeric values for terminal symbols ** in a format understandable to "makeheaders". This section is blank unless @@ -106,27 +104,27 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 482 +#define YYNOCODE 485 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SNodeList* yy72; - SNode* yy164; - EJoinType yy196; - bool yy441; - EFillMode yy446; - SToken yy497; - ENullOrder yy517; - EOrder yy550; - int32_t yy560; - int8_t yy563; - int64_t yy693; - SDataType yy700; - SAlterOption yy761; - EOperatorType yy796; - STokenPair yy953; + EOrder yy48; + EOperatorType yy70; + int8_t yy73; + int32_t yy120; + SNodeList* yy174; + EFillMode yy204; + SNode* yy242; + STokenPair yy257; + int64_t yy349; + EJoinType yy482; + SAlterOption yy535; + SToken yy669; + ENullOrder yy687; + bool yy777; + SDataType yy794; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -142,18 +140,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 787 -#define YYNRULE 591 -#define YYNRULE_WITH_ACTION 591 -#define YYNTOKEN 335 -#define YY_MAX_SHIFT 786 -#define YY_MIN_SHIFTREDUCE 1162 -#define YY_MAX_SHIFTREDUCE 1752 -#define YY_ERROR_ACTION 1753 -#define YY_ACCEPT_ACTION 1754 -#define YY_NO_ACTION 1755 -#define YY_MIN_REDUCE 1756 -#define YY_MAX_REDUCE 2346 +#define YYNSTATE 792 +#define YYNRULE 595 +#define YYNRULE_WITH_ACTION 595 +#define YYNTOKEN 337 +#define YY_MAX_SHIFT 791 +#define YY_MIN_SHIFTREDUCE 1169 +#define YY_MAX_SHIFTREDUCE 1763 +#define YY_ERROR_ACTION 1764 +#define YY_ACCEPT_ACTION 1765 +#define YY_NO_ACTION 1766 +#define YY_MIN_REDUCE 1767 +#define YY_MAX_REDUCE 2361 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -220,842 +218,792 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2980) +#define YY_ACTTAB_COUNT (2716) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 2158, 402, 680, 1930, 38, 303, 182, 2091, 643, 162, - /* 10 */ 694, 2317, 48, 46, 1680, 1757, 380, 1932, 1969, 216, - /* 20 */ 399, 133, 1529, 529, 1980, 1799, 642, 186, 564, 655, - /* 30 */ 140, 2318, 644, 1610, 1829, 1527, 123, 2176, 107, 122, - /* 40 */ 121, 120, 119, 118, 117, 116, 115, 114, 1555, 2126, - /* 50 */ 1907, 696, 41, 40, 251, 141, 47, 45, 44, 43, - /* 60 */ 42, 1605, 531, 1922, 1557, 41, 40, 19, 528, 47, - /* 70 */ 45, 44, 43, 42, 1535, 1905, 1554, 47, 45, 44, - /* 80 */ 43, 42, 142, 2157, 526, 2217, 2193, 527, 1792, 339, - /* 90 */ 2159, 700, 2161, 2162, 695, 693, 690, 681, 2211, 783, - /* 100 */ 167, 30, 15, 760, 759, 758, 757, 411, 1871, 756, - /* 110 */ 755, 144, 750, 749, 748, 747, 746, 745, 744, 157, - /* 120 */ 740, 739, 738, 410, 409, 735, 734, 733, 175, 174, - /* 130 */ 657, 184, 2254, 2255, 1350, 138, 2259, 123, 1612, 1613, - /* 140 */ 122, 121, 120, 119, 118, 117, 116, 115, 114, 1341, - /* 150 */ 722, 721, 720, 1345, 719, 1347, 1348, 718, 715, 679, - /* 160 */ 1356, 712, 1358, 1359, 709, 706, 1384, 1385, 1585, 1595, - /* 170 */ 680, 1930, 41, 40, 1611, 1614, 47, 45, 44, 43, - /* 180 */ 42, 730, 155, 154, 727, 726, 725, 152, 1530, 133, - /* 190 */ 1528, 62, 666, 408, 407, 568, 569, 41, 40, 567, - /* 200 */ 661, 47, 45, 44, 43, 42, 730, 155, 154, 727, - /* 210 */ 726, 725, 152, 665, 262, 534, 1536, 1554, 527, 1792, - /* 220 */ 1533, 1534, 543, 1584, 1587, 1588, 1589, 1590, 1591, 1592, - /* 230 */ 1593, 1594, 692, 688, 1603, 1604, 1606, 1607, 1608, 1609, - /* 240 */ 2, 48, 46, 541, 2158, 2041, 349, 618, 1552, 399, - /* 250 */ 2317, 1529, 14, 13, 658, 482, 358, 2048, 496, 638, - /* 260 */ 679, 495, 1610, 52, 1527, 2323, 186, 582, 581, 580, - /* 270 */ 2318, 644, 2046, 667, 572, 137, 576, 465, 2136, 497, - /* 280 */ 575, 2176, 234, 467, 1195, 574, 579, 374, 373, 1756, - /* 290 */ 1605, 573, 1921, 2126, 1982, 696, 19, 1982, 172, 1677, - /* 300 */ 1639, 379, 2140, 1535, 389, 560, 556, 552, 548, 1980, - /* 310 */ 231, 179, 1980, 132, 131, 130, 129, 128, 127, 126, - /* 320 */ 125, 124, 168, 1197, 1768, 1200, 1201, 2157, 783, 367, - /* 330 */ 2193, 15, 2032, 110, 2159, 700, 2161, 2162, 695, 2142, - /* 340 */ 690, 455, 51, 2261, 1749, 183, 189, 2246, 1982, 690, - /* 350 */ 88, 395, 2242, 229, 1653, 394, 1640, 404, 445, 732, - /* 360 */ 1975, 1977, 444, 1980, 188, 1439, 1440, 1612, 1613, 2258, - /* 370 */ 493, 1539, 2272, 487, 486, 485, 484, 481, 480, 479, - /* 380 */ 478, 477, 473, 472, 471, 470, 348, 462, 461, 460, - /* 390 */ 218, 457, 456, 365, 529, 679, 1799, 1585, 1595, 2012, - /* 400 */ 1555, 655, 140, 1611, 1614, 618, 41, 40, 2317, 2322, - /* 410 */ 47, 45, 44, 43, 42, 1982, 371, 1530, 189, 1528, - /* 420 */ 228, 222, 364, 2323, 186, 227, 1556, 539, 2318, 644, - /* 430 */ 1980, 1754, 2048, 37, 397, 1634, 1635, 1636, 1637, 1638, - /* 440 */ 1642, 1643, 1644, 1645, 392, 220, 1748, 2045, 667, 1533, - /* 450 */ 1534, 637, 1584, 1587, 1588, 1589, 1590, 1591, 1592, 1593, - /* 460 */ 1594, 692, 688, 1603, 1604, 1606, 1607, 1608, 1609, 2, - /* 470 */ 12, 48, 46, 87, 87, 393, 666, 51, 2176, 399, - /* 480 */ 451, 1529, 1779, 165, 372, 666, 370, 369, 2158, 566, - /* 490 */ 368, 1932, 1610, 643, 1527, 1708, 2317, 189, 697, 1925, - /* 500 */ 1926, 1719, 414, 185, 2254, 2255, 413, 138, 2259, 1742, - /* 510 */ 568, 642, 186, 2158, 567, 1982, 2318, 644, 1456, 1457, - /* 520 */ 1605, 680, 1930, 697, 345, 2176, 19, 664, 489, 2041, - /* 530 */ 1981, 2126, 636, 1535, 655, 140, 675, 2126, 2041, 696, - /* 540 */ 191, 633, 630, 629, 1706, 1707, 1709, 1710, 1711, 618, - /* 550 */ 2176, 1778, 2317, 1676, 1455, 1458, 469, 66, 783, 523, - /* 560 */ 101, 15, 2126, 1553, 696, 468, 521, 2323, 186, 517, - /* 570 */ 513, 2157, 2318, 644, 2193, 1832, 284, 169, 2159, 700, - /* 580 */ 2161, 2162, 695, 12, 690, 1923, 41, 40, 207, 206, - /* 590 */ 47, 45, 44, 43, 42, 596, 2157, 1612, 1613, 2193, - /* 600 */ 2126, 605, 110, 2159, 700, 2161, 2162, 695, 594, 690, - /* 610 */ 592, 488, 143, 1684, 150, 2217, 2246, 619, 2283, 1554, - /* 620 */ 395, 2242, 179, 1554, 294, 295, 1529, 1585, 1595, 293, - /* 630 */ 639, 634, 627, 1611, 1614, 2261, 187, 2254, 2255, 1527, - /* 640 */ 138, 2259, 366, 2031, 582, 581, 580, 1530, 165, 1528, - /* 650 */ 249, 572, 137, 576, 248, 62, 1933, 575, 1777, 723, - /* 660 */ 1620, 2257, 574, 579, 374, 373, 1554, 2158, 573, 730, - /* 670 */ 155, 154, 727, 726, 725, 152, 260, 658, 1535, 1533, - /* 680 */ 1534, 1696, 1584, 1587, 1588, 1589, 1590, 1591, 1592, 1593, - /* 690 */ 1594, 692, 688, 1603, 1604, 1606, 1607, 1608, 1609, 2, - /* 700 */ 48, 46, 1615, 783, 2176, 62, 1535, 2126, 399, 1294, - /* 710 */ 1529, 1218, 62, 1217, 90, 2158, 2126, 353, 696, 91, - /* 720 */ 378, 1610, 598, 1527, 34, 697, 233, 1801, 680, 1930, - /* 730 */ 41, 40, 680, 1930, 47, 45, 44, 43, 42, 9, - /* 740 */ 655, 140, 1776, 2261, 1219, 285, 742, 57, 1296, 1605, - /* 750 */ 2157, 449, 2176, 2193, 680, 1930, 110, 2159, 700, 2161, - /* 760 */ 2162, 695, 1535, 690, 2126, 2119, 696, 1586, 183, 2256, - /* 770 */ 2246, 36, 1775, 450, 395, 2242, 1538, 41, 40, 408, - /* 780 */ 407, 47, 45, 44, 43, 42, 62, 783, 93, 1543, - /* 790 */ 49, 2126, 1530, 1906, 1528, 2273, 153, 443, 2157, 442, - /* 800 */ 1610, 2193, 1536, 2158, 110, 2159, 700, 2161, 2162, 695, - /* 810 */ 189, 690, 618, 697, 1586, 2317, 2337, 570, 2246, 680, - /* 820 */ 1930, 2126, 395, 2242, 1533, 1534, 1612, 1613, 1605, 441, - /* 830 */ 2323, 186, 680, 1930, 1919, 2318, 644, 402, 459, 1292, - /* 840 */ 2176, 1535, 282, 2254, 654, 165, 134, 653, 12, 2317, - /* 850 */ 10, 474, 2126, 1932, 696, 56, 1585, 1595, 1774, 732, - /* 860 */ 189, 1773, 1611, 1614, 642, 186, 686, 189, 1982, 2318, - /* 870 */ 644, 680, 1930, 578, 577, 403, 1530, 2136, 1528, 2322, - /* 880 */ 1915, 2322, 2317, 1980, 2317, 1772, 2157, 680, 1930, 2193, - /* 890 */ 475, 2145, 170, 2159, 700, 2161, 2162, 695, 2321, 690, - /* 900 */ 2321, 2140, 2318, 2320, 2318, 2319, 542, 2126, 1533, 1534, - /* 910 */ 2126, 1584, 1587, 1588, 1589, 1590, 1591, 1592, 1593, 1594, - /* 920 */ 692, 688, 1603, 1604, 1606, 1607, 1608, 1609, 2, 48, - /* 930 */ 46, 1541, 680, 1930, 2126, 2158, 1771, 399, 2142, 1529, - /* 940 */ 1305, 189, 2321, 645, 2338, 697, 405, 2280, 690, 1917, - /* 950 */ 1610, 1927, 1527, 1304, 165, 1544, 1673, 1539, 1770, 41, - /* 960 */ 40, 1767, 1932, 47, 45, 44, 43, 42, 317, 41, - /* 970 */ 40, 1959, 2176, 47, 45, 44, 43, 42, 1605, 1554, - /* 980 */ 680, 1930, 1976, 1977, 2126, 2126, 696, 1547, 1549, 680, - /* 990 */ 1930, 1535, 680, 1930, 680, 1930, 1309, 2109, 2120, 252, - /* 1000 */ 688, 1603, 1604, 1606, 1607, 1608, 1609, 2126, 614, 1308, - /* 1010 */ 2126, 659, 2027, 663, 1556, 1913, 783, 498, 2157, 49, - /* 1020 */ 1218, 2193, 1217, 2158, 110, 2159, 700, 2161, 2162, 695, - /* 1030 */ 250, 690, 587, 697, 724, 2293, 2337, 1973, 2246, 680, - /* 1040 */ 1930, 728, 395, 2242, 1973, 618, 1641, 597, 2317, 1766, - /* 1050 */ 203, 680, 1930, 1219, 433, 1612, 1613, 199, 298, 1765, - /* 1060 */ 2176, 247, 1764, 2323, 186, 680, 1930, 1557, 2318, 644, - /* 1070 */ 677, 1763, 2126, 500, 696, 680, 1930, 590, 680, 1930, - /* 1080 */ 1557, 435, 431, 584, 678, 1585, 1595, 754, 752, 246, - /* 1090 */ 84, 1611, 1614, 83, 304, 1200, 1201, 406, 2126, 1500, - /* 1100 */ 1501, 44, 43, 42, 1203, 1530, 2157, 1528, 2126, 2193, - /* 1110 */ 1553, 2126, 110, 2159, 700, 2161, 2162, 695, 1762, 690, - /* 1120 */ 2126, 164, 603, 35, 2337, 1761, 2246, 1586, 1760, 70, - /* 1130 */ 395, 2242, 69, 1646, 1759, 2266, 1673, 1533, 1534, 2027, - /* 1140 */ 1584, 1587, 1588, 1589, 1590, 1591, 1592, 1593, 1594, 692, - /* 1150 */ 688, 1603, 1604, 1606, 1607, 1608, 1609, 2, 48, 46, - /* 1160 */ 2027, 2158, 2136, 682, 284, 2218, 399, 2126, 1529, 618, - /* 1170 */ 2112, 697, 2317, 625, 2126, 743, 2144, 2126, 1892, 1610, - /* 1180 */ 684, 1527, 2218, 2126, 201, 74, 2140, 2323, 186, 452, - /* 1190 */ 617, 729, 2318, 644, 1973, 54, 1908, 3, 2176, 146, - /* 1200 */ 239, 135, 453, 237, 1816, 205, 241, 1605, 153, 240, - /* 1210 */ 2126, 428, 696, 571, 1808, 243, 646, 200, 242, 421, - /* 1220 */ 1535, 1806, 245, 2142, 396, 244, 583, 600, 153, 599, - /* 1230 */ 261, 50, 50, 690, 82, 1290, 585, 266, 153, 647, - /* 1240 */ 148, 1751, 1752, 588, 2157, 783, 50, 2193, 15, 687, - /* 1250 */ 110, 2159, 700, 2161, 2162, 695, 650, 690, 2147, 291, - /* 1260 */ 71, 1802, 2337, 1537, 2246, 106, 151, 1495, 395, 2242, - /* 1270 */ 153, 14, 13, 64, 50, 103, 50, 736, 737, 704, - /* 1280 */ 151, 153, 136, 151, 1612, 1613, 1934, 1498, 1251, 256, - /* 1290 */ 1705, 1704, 691, 259, 1872, 1769, 268, 662, 2286, 1270, - /* 1300 */ 1268, 279, 631, 166, 232, 1453, 273, 1870, 323, 1869, - /* 1310 */ 2177, 778, 55, 2149, 1585, 1595, 412, 2036, 296, 672, - /* 1320 */ 1611, 1614, 321, 73, 1793, 300, 72, 1252, 1798, 1335, - /* 1330 */ 2276, 1970, 1647, 1596, 1530, 316, 1528, 346, 1362, 1366, - /* 1340 */ 1373, 1371, 156, 656, 278, 281, 1, 214, 508, 506, - /* 1350 */ 503, 5, 415, 420, 362, 2158, 1560, 437, 436, 194, - /* 1360 */ 193, 196, 439, 1476, 204, 697, 1533, 1534, 311, 1584, - /* 1370 */ 1587, 1588, 1589, 1590, 1591, 1592, 1593, 1594, 692, 688, - /* 1380 */ 1603, 1604, 1606, 1607, 1608, 1609, 2, 62, 1557, 454, - /* 1390 */ 2037, 491, 2176, 458, 463, 1552, 476, 483, 2029, 490, - /* 1400 */ 492, 501, 1631, 502, 2126, 499, 696, 504, 209, 211, - /* 1410 */ 208, 505, 507, 509, 1558, 524, 535, 4, 1540, 532, - /* 1420 */ 525, 533, 219, 1555, 2158, 109, 536, 1559, 221, 537, - /* 1430 */ 1561, 538, 540, 224, 697, 544, 2311, 226, 2157, 85, - /* 1440 */ 86, 2193, 1221, 561, 110, 2159, 700, 2161, 2162, 695, - /* 1450 */ 230, 690, 563, 562, 352, 112, 2221, 2100, 2246, 602, - /* 1460 */ 604, 2176, 395, 2242, 565, 81, 80, 448, 1920, 89, - /* 1470 */ 198, 236, 1916, 2126, 648, 696, 149, 238, 312, 158, - /* 1480 */ 159, 1918, 1914, 440, 438, 160, 2158, 253, 161, 608, - /* 1490 */ 607, 257, 1483, 651, 347, 609, 697, 429, 2265, 615, - /* 1500 */ 427, 423, 419, 416, 441, 2097, 2096, 2157, 2277, 612, - /* 1510 */ 2193, 255, 2158, 110, 2159, 700, 2161, 2162, 695, 2287, - /* 1520 */ 690, 632, 697, 2176, 622, 2337, 2292, 2246, 670, 613, - /* 1530 */ 264, 395, 2242, 2291, 628, 2126, 384, 696, 267, 2268, - /* 1540 */ 8, 635, 189, 641, 623, 385, 621, 620, 277, 2176, - /* 1550 */ 2340, 649, 652, 139, 1673, 1556, 2262, 660, 388, 286, - /* 1560 */ 274, 2126, 1562, 696, 313, 2042, 96, 668, 669, 2157, - /* 1570 */ 2056, 314, 2193, 2055, 276, 110, 2159, 700, 2161, 2162, - /* 1580 */ 695, 673, 690, 275, 2054, 272, 2158, 2337, 173, 2246, - /* 1590 */ 391, 674, 61, 395, 2242, 2157, 697, 98, 2193, 2316, - /* 1600 */ 100, 110, 2159, 700, 2161, 2162, 695, 280, 690, 102, - /* 1610 */ 2227, 315, 702, 2219, 1974, 2246, 1893, 1931, 779, 395, - /* 1620 */ 2242, 318, 780, 2176, 782, 327, 53, 341, 307, 331, - /* 1630 */ 320, 2118, 322, 2117, 342, 2126, 2116, 696, 78, 2113, - /* 1640 */ 417, 418, 1520, 1521, 354, 355, 192, 2158, 2111, 422, - /* 1650 */ 424, 425, 426, 2110, 363, 2108, 430, 697, 434, 432, - /* 1660 */ 2106, 1511, 2087, 195, 2086, 197, 1479, 79, 1478, 2157, - /* 1670 */ 2107, 2068, 2193, 2158, 2067, 110, 2159, 700, 2161, 2162, - /* 1680 */ 695, 2066, 690, 697, 2176, 446, 447, 683, 2065, 2246, - /* 1690 */ 2064, 1430, 2020, 395, 2242, 2019, 2126, 2017, 696, 145, - /* 1700 */ 2016, 2015, 2018, 2014, 2013, 2011, 2010, 2009, 202, 2158, - /* 1710 */ 2176, 464, 2008, 466, 2022, 2007, 2006, 2005, 2004, 697, - /* 1720 */ 147, 1992, 2126, 2003, 696, 2002, 2001, 2000, 1999, 1998, - /* 1730 */ 2157, 1997, 1996, 2193, 1995, 1994, 111, 2159, 700, 2161, - /* 1740 */ 2162, 695, 1993, 690, 1991, 1990, 2176, 2021, 1989, 1988, - /* 1750 */ 2246, 1987, 1432, 1986, 2245, 2242, 2157, 1985, 2126, 2193, - /* 1760 */ 696, 494, 111, 2159, 700, 2161, 2162, 695, 1984, 690, - /* 1770 */ 1983, 1835, 1306, 2158, 1310, 1302, 2246, 1834, 1833, 1831, - /* 1780 */ 685, 2242, 225, 697, 350, 351, 1828, 511, 1827, 1820, - /* 1790 */ 510, 1810, 698, 514, 210, 2193, 518, 2158, 111, 2159, - /* 1800 */ 700, 2161, 2162, 695, 212, 690, 512, 697, 515, 519, - /* 1810 */ 2176, 516, 2246, 520, 1788, 213, 357, 2242, 215, 522, - /* 1820 */ 76, 1202, 2126, 1787, 696, 2085, 77, 2146, 2075, 180, - /* 1830 */ 2063, 2062, 2040, 217, 2176, 223, 1909, 181, 1830, 530, - /* 1840 */ 1826, 1244, 547, 545, 546, 1824, 2126, 549, 696, 550, - /* 1850 */ 551, 1822, 553, 554, 555, 1819, 2157, 557, 558, 2193, - /* 1860 */ 559, 2158, 111, 2159, 700, 2161, 2162, 695, 1805, 690, - /* 1870 */ 1804, 697, 1784, 1911, 63, 235, 2246, 1378, 1377, 1910, - /* 1880 */ 2157, 2243, 606, 2193, 1293, 1291, 169, 2159, 700, 2161, - /* 1890 */ 2162, 695, 751, 690, 1289, 1288, 1287, 1286, 2176, 1285, - /* 1900 */ 786, 1282, 753, 382, 1281, 1280, 1279, 1817, 375, 1809, - /* 1910 */ 2126, 376, 696, 1807, 310, 377, 586, 589, 1783, 2158, - /* 1920 */ 591, 1782, 593, 1781, 595, 113, 1505, 2284, 29, 697, - /* 1930 */ 178, 1507, 1504, 2084, 58, 2158, 1509, 776, 772, 768, - /* 1940 */ 764, 67, 308, 1485, 2157, 697, 1487, 2193, 2074, 610, - /* 1950 */ 340, 2159, 700, 2161, 2162, 695, 2176, 690, 2061, 2059, - /* 1960 */ 1489, 383, 6, 2322, 611, 31, 163, 624, 2126, 258, - /* 1970 */ 696, 381, 2176, 20, 17, 616, 7, 1721, 263, 21, - /* 1980 */ 22, 265, 108, 1703, 2126, 301, 696, 1695, 626, 271, - /* 1990 */ 171, 270, 65, 2147, 269, 33, 2158, 32, 24, 1736, - /* 2000 */ 92, 1735, 2157, 1741, 1742, 2193, 697, 23, 340, 2159, - /* 2010 */ 700, 2161, 2162, 695, 386, 690, 1740, 676, 2157, 1739, - /* 2020 */ 387, 2193, 2158, 18, 333, 2159, 700, 2161, 2162, 695, - /* 2030 */ 283, 690, 697, 2176, 1670, 1669, 60, 176, 59, 2060, - /* 2040 */ 2058, 2057, 2039, 94, 95, 2126, 289, 696, 671, 2038, - /* 2050 */ 97, 25, 288, 290, 302, 1701, 103, 287, 2158, 2176, - /* 2060 */ 26, 11, 177, 292, 390, 297, 13, 640, 694, 68, - /* 2070 */ 299, 2126, 99, 696, 1622, 1621, 1545, 254, 2196, 2157, - /* 2080 */ 1600, 1598, 2193, 1597, 689, 170, 2159, 700, 2161, 2162, - /* 2090 */ 695, 190, 690, 39, 2158, 2176, 16, 27, 1577, 1569, - /* 2100 */ 28, 701, 703, 1363, 697, 2157, 401, 2126, 2193, 696, - /* 2110 */ 705, 340, 2159, 700, 2161, 2162, 695, 1360, 690, 707, - /* 2120 */ 2158, 708, 710, 1632, 1357, 711, 699, 1351, 713, 714, - /* 2130 */ 697, 2176, 1349, 716, 717, 104, 398, 2339, 305, 105, - /* 2140 */ 1372, 2157, 1355, 2126, 2193, 696, 1354, 339, 2159, 700, - /* 2150 */ 2161, 2162, 695, 75, 690, 1353, 2212, 2176, 1352, 1368, - /* 2160 */ 1242, 1274, 400, 731, 1273, 1272, 1271, 1269, 1267, 2126, - /* 2170 */ 1266, 696, 306, 1300, 1265, 741, 1263, 2157, 1262, 1261, - /* 2180 */ 2193, 1260, 1259, 340, 2159, 700, 2161, 2162, 695, 1258, - /* 2190 */ 690, 1257, 1297, 1295, 1248, 2158, 1254, 1253, 1250, 1249, - /* 2200 */ 1247, 1825, 761, 2157, 762, 697, 2193, 763, 1823, 340, - /* 2210 */ 2159, 700, 2161, 2162, 695, 2158, 690, 765, 766, 767, - /* 2220 */ 1821, 1818, 769, 770, 771, 697, 773, 774, 775, 1803, - /* 2230 */ 777, 1192, 2176, 1780, 309, 781, 1755, 1531, 319, 784, - /* 2240 */ 1755, 1755, 785, 1755, 2126, 1755, 696, 1755, 1755, 1755, - /* 2250 */ 1755, 1755, 2176, 1755, 1755, 1755, 1755, 1755, 1755, 1755, - /* 2260 */ 1755, 1755, 1755, 1755, 2126, 1755, 696, 1755, 1755, 1755, - /* 2270 */ 1755, 1755, 1755, 1755, 1755, 1755, 1755, 1755, 601, 1755, - /* 2280 */ 1755, 2193, 1755, 2158, 335, 2159, 700, 2161, 2162, 695, - /* 2290 */ 1755, 690, 1755, 697, 1755, 1755, 1755, 1755, 2157, 1755, - /* 2300 */ 2158, 2193, 1755, 1755, 324, 2159, 700, 2161, 2162, 695, - /* 2310 */ 697, 690, 1755, 1755, 1755, 1755, 1755, 1755, 1755, 1755, - /* 2320 */ 2176, 1755, 1755, 1755, 1755, 1755, 1755, 1755, 1755, 1755, - /* 2330 */ 1755, 1755, 2126, 1755, 696, 1755, 1755, 2176, 1755, 1755, - /* 2340 */ 1755, 1755, 1755, 1755, 1755, 1755, 1755, 1755, 2158, 2126, - /* 2350 */ 1755, 696, 1755, 1755, 1755, 1755, 1755, 1755, 697, 1755, - /* 2360 */ 1755, 1755, 1755, 1755, 1755, 1755, 2157, 1755, 2158, 2193, - /* 2370 */ 1755, 1755, 325, 2159, 700, 2161, 2162, 695, 697, 690, - /* 2380 */ 1755, 1755, 1755, 2157, 1755, 2176, 2193, 1755, 1755, 326, - /* 2390 */ 2159, 700, 2161, 2162, 695, 1755, 690, 2126, 2158, 696, - /* 2400 */ 1755, 1755, 1755, 1755, 1755, 2176, 1755, 1755, 697, 1755, - /* 2410 */ 1755, 1755, 1755, 1755, 1755, 1755, 2158, 2126, 1755, 696, - /* 2420 */ 1755, 1755, 1755, 1755, 1755, 1755, 697, 1755, 1755, 1755, - /* 2430 */ 1755, 2157, 1755, 1755, 2193, 2176, 1755, 332, 2159, 700, - /* 2440 */ 2161, 2162, 695, 1755, 690, 1755, 2158, 2126, 1755, 696, - /* 2450 */ 1755, 2157, 1755, 2176, 2193, 1755, 697, 336, 2159, 700, - /* 2460 */ 2161, 2162, 695, 1755, 690, 2126, 1755, 696, 1755, 1755, - /* 2470 */ 1755, 1755, 1755, 1755, 1755, 1755, 2158, 1755, 1755, 1755, - /* 2480 */ 1755, 2157, 1755, 2176, 2193, 1755, 697, 328, 2159, 700, - /* 2490 */ 2161, 2162, 695, 1755, 690, 2126, 1755, 696, 1755, 2157, - /* 2500 */ 1755, 1755, 2193, 1755, 1755, 337, 2159, 700, 2161, 2162, - /* 2510 */ 695, 1755, 690, 2176, 1755, 1755, 1755, 1755, 1755, 1755, - /* 2520 */ 1755, 1755, 1755, 1755, 2158, 2126, 1755, 696, 1755, 2157, - /* 2530 */ 1755, 1755, 2193, 1755, 697, 329, 2159, 700, 2161, 2162, - /* 2540 */ 695, 1755, 690, 1755, 2158, 1755, 1755, 1755, 1755, 1755, - /* 2550 */ 1755, 1755, 1755, 1755, 697, 1755, 1755, 1755, 1755, 2157, - /* 2560 */ 1755, 2176, 2193, 1755, 1755, 338, 2159, 700, 2161, 2162, - /* 2570 */ 695, 1755, 690, 2126, 1755, 696, 1755, 1755, 1755, 1755, - /* 2580 */ 1755, 2176, 1755, 1755, 1755, 1755, 1755, 1755, 1755, 1755, - /* 2590 */ 1755, 1755, 1755, 2126, 1755, 696, 1755, 1755, 1755, 1755, - /* 2600 */ 1755, 1755, 1755, 1755, 1755, 1755, 1755, 2157, 1755, 1755, - /* 2610 */ 2193, 1755, 1755, 330, 2159, 700, 2161, 2162, 695, 1755, - /* 2620 */ 690, 1755, 2158, 1755, 1755, 1755, 1755, 2157, 1755, 1755, - /* 2630 */ 2193, 1755, 697, 343, 2159, 700, 2161, 2162, 695, 2158, - /* 2640 */ 690, 1755, 1755, 1755, 1755, 1755, 1755, 1755, 1755, 697, - /* 2650 */ 1755, 1755, 1755, 1755, 1755, 1755, 1755, 1755, 1755, 2176, - /* 2660 */ 1755, 1755, 1755, 1755, 1755, 1755, 1755, 1755, 1755, 1755, - /* 2670 */ 1755, 2126, 1755, 696, 1755, 1755, 2176, 1755, 1755, 1755, - /* 2680 */ 1755, 1755, 1755, 1755, 1755, 1755, 1755, 2158, 2126, 1755, - /* 2690 */ 696, 1755, 1755, 1755, 1755, 1755, 1755, 697, 1755, 1755, - /* 2700 */ 1755, 1755, 1755, 1755, 1755, 2157, 1755, 2158, 2193, 1755, - /* 2710 */ 1755, 344, 2159, 700, 2161, 2162, 695, 697, 690, 1755, - /* 2720 */ 1755, 1755, 2157, 1755, 2176, 2193, 1755, 1755, 2170, 2159, - /* 2730 */ 700, 2161, 2162, 695, 1755, 690, 2126, 2158, 696, 1755, - /* 2740 */ 1755, 1755, 1755, 1755, 2176, 1755, 1755, 697, 1755, 1755, - /* 2750 */ 1755, 1755, 1755, 1755, 1755, 2158, 2126, 1755, 696, 1755, - /* 2760 */ 1755, 1755, 1755, 1755, 1755, 697, 1755, 1755, 1755, 1755, - /* 2770 */ 2157, 1755, 1755, 2193, 2176, 1755, 2169, 2159, 700, 2161, - /* 2780 */ 2162, 695, 1755, 690, 1755, 2158, 2126, 1755, 696, 1755, - /* 2790 */ 2157, 1755, 2176, 2193, 1755, 697, 2168, 2159, 700, 2161, - /* 2800 */ 2162, 695, 1755, 690, 2126, 1755, 696, 1755, 1755, 1755, - /* 2810 */ 1755, 1755, 1755, 1755, 1755, 2158, 1755, 1755, 1755, 1755, - /* 2820 */ 2157, 1755, 2176, 2193, 1755, 697, 359, 2159, 700, 2161, - /* 2830 */ 2162, 695, 1755, 690, 2126, 1755, 696, 1755, 2157, 1755, - /* 2840 */ 1755, 2193, 1755, 1755, 360, 2159, 700, 2161, 2162, 695, - /* 2850 */ 1755, 690, 2176, 1755, 1755, 1755, 1755, 1755, 1755, 1755, - /* 2860 */ 1755, 1755, 1755, 2158, 2126, 1755, 696, 1755, 2157, 1755, - /* 2870 */ 1755, 2193, 1755, 697, 356, 2159, 700, 2161, 2162, 695, - /* 2880 */ 1755, 690, 1755, 2158, 1755, 1755, 1755, 1755, 1755, 1755, - /* 2890 */ 1755, 1755, 1755, 697, 1755, 1755, 1755, 1755, 2157, 1755, - /* 2900 */ 2176, 2193, 1755, 1755, 361, 2159, 700, 2161, 2162, 695, - /* 2910 */ 1755, 690, 2126, 1755, 696, 1755, 1755, 1755, 1755, 1755, - /* 2920 */ 2176, 1755, 1755, 1755, 1755, 1755, 1755, 1755, 1755, 1755, - /* 2930 */ 1755, 1755, 2126, 1755, 696, 1755, 1755, 1755, 1755, 1755, - /* 2940 */ 1755, 1755, 1755, 1755, 1755, 1755, 698, 1755, 1755, 2193, - /* 2950 */ 1755, 1755, 335, 2159, 700, 2161, 2162, 695, 1755, 690, - /* 2960 */ 1755, 1755, 1755, 1755, 1755, 1755, 2157, 1755, 1755, 2193, - /* 2970 */ 1755, 1755, 334, 2159, 700, 2161, 2162, 695, 1755, 690, + /* 0 */ 2173, 169, 2337, 38, 303, 2332, 170, 445, 1779, 1885, + /* 10 */ 660, 444, 48, 46, 1691, 1933, 181, 2337, 2151, 1790, + /* 20 */ 399, 2336, 1540, 41, 40, 2333, 2335, 47, 45, 44, + /* 30 */ 43, 42, 2159, 1621, 1567, 1538, 366, 2046, 2191, 41, + /* 40 */ 40, 451, 2155, 47, 45, 44, 43, 42, 402, 663, + /* 50 */ 2141, 1568, 698, 1566, 620, 526, 164, 2332, 527, 1803, + /* 60 */ 2173, 218, 1616, 380, 1946, 529, 167, 1810, 19, 2141, + /* 70 */ 699, 1995, 2338, 188, 1947, 1546, 184, 2333, 646, 2157, + /* 80 */ 396, 2106, 2337, 358, 2172, 2332, 345, 2208, 1984, 692, + /* 90 */ 110, 2174, 702, 2176, 2177, 697, 620, 692, 2191, 2332, + /* 100 */ 788, 2336, 185, 15, 2261, 2333, 2334, 220, 395, 2257, + /* 110 */ 2141, 529, 698, 1810, 2338, 188, 48, 46, 1753, 2333, + /* 120 */ 646, 190, 682, 1944, 399, 1789, 1540, 1650, 251, 2287, + /* 130 */ 47, 45, 44, 43, 42, 668, 1567, 1621, 205, 1538, + /* 140 */ 1623, 1624, 133, 2063, 2172, 682, 1944, 2208, 1304, 566, + /* 150 */ 110, 2174, 702, 2176, 2177, 697, 2124, 692, 2061, 669, + /* 160 */ 145, 1565, 152, 2232, 2261, 193, 1616, 668, 395, 2257, + /* 170 */ 1596, 1606, 19, 1395, 1396, 2141, 1622, 1625, 84, 1546, + /* 180 */ 1920, 83, 657, 142, 1651, 1768, 284, 541, 1306, 2056, + /* 190 */ 1541, 123, 1539, 681, 122, 121, 120, 119, 118, 117, + /* 200 */ 116, 115, 114, 262, 788, 668, 123, 15, 2173, 122, + /* 210 */ 121, 120, 119, 118, 117, 116, 115, 114, 699, 666, + /* 220 */ 1812, 2056, 1544, 1545, 1767, 1595, 1598, 1599, 1600, 1601, + /* 230 */ 1602, 1603, 1604, 1605, 694, 690, 1614, 1615, 1617, 1618, + /* 240 */ 1619, 1620, 2, 681, 1623, 1624, 2191, 737, 132, 131, + /* 250 */ 130, 129, 128, 127, 126, 125, 124, 677, 2141, 2056, + /* 260 */ 698, 37, 397, 1645, 1646, 1647, 1648, 1649, 1653, 1654, + /* 270 */ 1655, 1656, 543, 2173, 1596, 1606, 51, 682, 1944, 66, + /* 280 */ 1622, 1625, 9, 660, 659, 186, 2269, 2270, 284, 140, + /* 290 */ 2274, 1227, 2172, 1226, 1541, 2208, 1539, 133, 110, 2174, + /* 300 */ 702, 2176, 2177, 697, 571, 692, 138, 531, 682, 1944, + /* 310 */ 2352, 2191, 2261, 528, 41, 40, 395, 2257, 47, 45, + /* 320 */ 44, 43, 42, 2141, 1228, 698, 1544, 1545, 57, 1595, + /* 330 */ 1598, 1599, 1600, 1601, 1602, 1603, 1604, 1605, 694, 690, + /* 340 */ 1614, 1615, 1617, 1618, 1619, 1620, 2, 12, 48, 46, + /* 350 */ 1227, 2173, 1226, 408, 407, 2336, 399, 2172, 1540, 2276, + /* 360 */ 2208, 696, 1922, 110, 2174, 702, 2176, 2177, 697, 1621, + /* 370 */ 692, 1538, 428, 1997, 181, 185, 1547, 2261, 62, 639, + /* 380 */ 379, 395, 2257, 1228, 2063, 2273, 41, 40, 1995, 2191, + /* 390 */ 47, 45, 44, 43, 42, 2047, 392, 1360, 1616, 2060, + /* 400 */ 669, 2141, 2288, 698, 19, 534, 150, 2191, 527, 1803, + /* 410 */ 1730, 1546, 1351, 727, 726, 725, 1355, 724, 1357, 1358, + /* 420 */ 723, 720, 30, 1366, 717, 1368, 1369, 714, 711, 708, + /* 430 */ 667, 1695, 191, 1565, 107, 2172, 788, 1565, 2208, 15, + /* 440 */ 101, 339, 2174, 702, 2176, 2177, 697, 695, 692, 683, + /* 450 */ 2226, 143, 48, 46, 1626, 87, 635, 34, 234, 1936, + /* 460 */ 399, 638, 1540, 41, 40, 1937, 681, 47, 45, 44, + /* 470 */ 43, 42, 368, 1621, 174, 1538, 1623, 1624, 640, 682, + /* 480 */ 1944, 1939, 560, 556, 552, 548, 2042, 233, 285, 393, + /* 490 */ 735, 157, 156, 732, 731, 730, 154, 167, 2173, 449, + /* 500 */ 1202, 1684, 1616, 1565, 1719, 1946, 1596, 1606, 699, 12, + /* 510 */ 2295, 10, 1622, 1625, 2042, 1546, 41, 40, 682, 1944, + /* 520 */ 47, 45, 44, 43, 42, 1564, 1541, 88, 1539, 62, + /* 530 */ 231, 93, 201, 1550, 191, 489, 2191, 1568, 450, 1204, + /* 540 */ 788, 1207, 1208, 49, 1788, 641, 636, 629, 2141, 51, + /* 550 */ 698, 632, 631, 1717, 1718, 1720, 1721, 1722, 1544, 1545, + /* 560 */ 203, 1595, 1598, 1599, 1600, 1601, 1602, 1603, 1604, 1605, + /* 570 */ 694, 690, 1614, 1615, 1617, 1618, 1619, 1620, 2, 62, + /* 580 */ 1623, 1624, 2172, 1450, 1451, 2208, 62, 1597, 110, 2174, + /* 590 */ 702, 2176, 2177, 697, 2141, 692, 209, 208, 230, 224, + /* 600 */ 2352, 523, 2261, 229, 737, 539, 395, 2257, 2173, 521, + /* 610 */ 1596, 1606, 517, 513, 682, 1944, 1622, 1625, 699, 488, + /* 620 */ 2308, 682, 1944, 222, 607, 2151, 52, 62, 294, 295, + /* 630 */ 1541, 648, 1539, 293, 459, 584, 583, 582, 684, 1935, + /* 640 */ 2233, 474, 574, 139, 578, 2127, 2191, 1787, 577, 2155, + /* 650 */ 657, 142, 1549, 576, 581, 374, 373, 2027, 2141, 575, + /* 660 */ 698, 2134, 1544, 1545, 1566, 1595, 1598, 1599, 1600, 1601, + /* 670 */ 1602, 1603, 1604, 1605, 694, 690, 1614, 1615, 1617, 1618, + /* 680 */ 1619, 1620, 2, 48, 46, 191, 2157, 682, 1944, 202, + /* 690 */ 1760, 399, 2172, 1540, 421, 2208, 692, 2141, 110, 2174, + /* 700 */ 702, 2176, 2177, 697, 1621, 692, 1538, 475, 620, 2173, + /* 710 */ 2352, 2332, 2261, 443, 402, 442, 395, 2257, 1921, 699, + /* 720 */ 404, 589, 167, 1990, 1992, 2276, 2338, 188, 682, 1944, + /* 730 */ 1946, 2333, 646, 1616, 1631, 191, 599, 1991, 1992, 2173, + /* 740 */ 1565, 433, 191, 682, 1944, 441, 1546, 2191, 542, 699, + /* 750 */ 247, 2272, 598, 282, 2269, 656, 12, 134, 655, 2141, + /* 760 */ 2332, 698, 405, 1941, 2276, 596, 592, 594, 435, 431, + /* 770 */ 167, 788, 1546, 586, 49, 644, 188, 2191, 1946, 246, + /* 780 */ 2333, 646, 191, 191, 1467, 1468, 747, 48, 46, 2141, + /* 790 */ 2271, 698, 1759, 2172, 1315, 399, 2208, 1540, 250, 111, + /* 800 */ 2174, 702, 2176, 2177, 697, 1652, 692, 1314, 1621, 1552, + /* 810 */ 1538, 1623, 1624, 2261, 657, 142, 469, 2260, 2257, 70, + /* 820 */ 1466, 1469, 69, 2172, 1919, 468, 2208, 728, 1997, 171, + /* 830 */ 2174, 702, 2176, 2177, 697, 389, 692, 1616, 1786, 2173, + /* 840 */ 1210, 1596, 1606, 1995, 682, 1944, 1564, 1622, 1625, 699, + /* 850 */ 1546, 735, 157, 156, 732, 731, 730, 154, 452, 1997, + /* 860 */ 686, 1541, 2233, 1539, 252, 155, 394, 1511, 1512, 621, + /* 870 */ 2298, 453, 498, 36, 1995, 788, 1929, 2191, 15, 41, + /* 880 */ 40, 1931, 35, 47, 45, 44, 43, 42, 2141, 2141, + /* 890 */ 1597, 698, 1657, 1544, 1545, 1927, 1595, 1598, 1599, 1600, + /* 900 */ 1601, 1602, 1603, 1604, 1605, 694, 690, 1614, 1615, 1617, + /* 910 */ 1618, 1619, 1620, 2, 1785, 1623, 1624, 187, 2269, 2270, + /* 920 */ 1765, 140, 2274, 2172, 1784, 56, 2208, 1783, 1782, 171, + /* 930 */ 2174, 702, 2176, 2177, 697, 349, 692, 1563, 44, 43, + /* 940 */ 42, 1997, 259, 2173, 482, 1596, 1606, 496, 403, 1781, + /* 950 */ 495, 1622, 1625, 699, 1997, 627, 1995, 735, 157, 156, + /* 960 */ 732, 731, 730, 154, 2141, 1541, 465, 1539, 497, 1996, + /* 970 */ 2299, 682, 1944, 467, 2141, 1540, 1319, 2141, 2141, 41, + /* 980 */ 40, 2191, 1778, 47, 45, 44, 43, 42, 1538, 1318, + /* 990 */ 1568, 616, 414, 2141, 1777, 698, 413, 1544, 1545, 2141, + /* 1000 */ 1595, 1598, 1599, 1600, 1601, 1602, 1603, 1604, 1605, 694, + /* 1010 */ 690, 1614, 1615, 1617, 1618, 1619, 1620, 2, 1843, 367, + /* 1020 */ 1565, 682, 1944, 657, 142, 580, 579, 2172, 1546, 1948, + /* 1030 */ 2208, 455, 2141, 110, 2174, 702, 2176, 2177, 697, 620, + /* 1040 */ 692, 661, 2332, 1776, 2141, 2352, 570, 2261, 1230, 1231, + /* 1050 */ 569, 395, 2257, 788, 500, 562, 561, 2338, 188, 564, + /* 1060 */ 563, 493, 2333, 646, 487, 486, 485, 484, 481, 480, + /* 1070 */ 479, 478, 477, 473, 472, 471, 470, 348, 462, 461, + /* 1080 */ 460, 652, 457, 456, 365, 759, 757, 1775, 765, 764, + /* 1090 */ 763, 762, 411, 2141, 761, 760, 146, 755, 754, 753, + /* 1100 */ 752, 751, 750, 749, 159, 745, 744, 743, 410, 409, + /* 1110 */ 740, 739, 738, 177, 176, 168, 682, 1944, 2135, 1774, + /* 1120 */ 323, 1773, 1772, 408, 407, 256, 189, 2269, 2270, 2173, + /* 1130 */ 140, 2274, 371, 1554, 321, 73, 665, 2141, 72, 699, + /* 1140 */ 693, 2326, 261, 1541, 1621, 1539, 1547, 41, 40, 346, + /* 1150 */ 1688, 47, 45, 44, 43, 42, 2042, 1771, 682, 1944, + /* 1160 */ 216, 508, 506, 503, 54, 620, 3, 2191, 2332, 2141, + /* 1170 */ 1597, 2141, 2141, 1616, 649, 1544, 1545, 2173, 298, 2141, + /* 1180 */ 1770, 698, 260, 2338, 188, 2151, 1546, 699, 2333, 646, + /* 1190 */ 41, 40, 14, 13, 47, 45, 44, 43, 42, 2160, + /* 1200 */ 62, 372, 207, 370, 369, 74, 568, 2141, 87, 2155, + /* 1210 */ 689, 688, 605, 2172, 144, 2191, 2208, 2232, 1886, 110, + /* 1220 */ 2174, 702, 2176, 2177, 697, 91, 692, 2141, 570, 698, + /* 1230 */ 2141, 2352, 569, 2261, 1940, 2173, 572, 395, 2257, 109, + /* 1240 */ 148, 729, 135, 1707, 1988, 699, 2157, 2280, 733, 734, + /* 1250 */ 317, 1988, 1988, 1974, 748, 82, 692, 1906, 1302, 620, + /* 1260 */ 239, 2172, 2332, 237, 2208, 2281, 1684, 333, 2174, 702, + /* 1270 */ 2176, 2177, 697, 2191, 692, 1207, 1208, 2338, 188, 81, + /* 1280 */ 80, 448, 2333, 646, 200, 2141, 2173, 698, 241, 1780, + /* 1290 */ 573, 240, 619, 682, 1944, 1664, 699, 440, 438, 243, + /* 1300 */ 2301, 1555, 242, 1550, 245, 1762, 1763, 244, 347, 1830, + /* 1310 */ 642, 429, 1300, 679, 427, 423, 419, 416, 441, 2172, + /* 1320 */ 653, 602, 2208, 601, 2191, 110, 2174, 702, 2176, 2177, + /* 1330 */ 697, 585, 692, 1558, 1560, 1821, 2141, 2352, 698, 2261, + /* 1340 */ 1819, 155, 645, 395, 2257, 2332, 690, 1614, 1615, 1617, + /* 1350 */ 1618, 1619, 1620, 2173, 166, 249, 191, 587, 155, 248, + /* 1360 */ 644, 188, 590, 699, 1642, 2333, 646, 279, 50, 50, + /* 1370 */ 2172, 266, 155, 2208, 50, 291, 110, 2174, 702, 2176, + /* 1380 */ 2177, 697, 633, 692, 682, 1944, 2173, 137, 2236, 106, + /* 1390 */ 2261, 2191, 682, 1944, 395, 2257, 699, 682, 1944, 103, + /* 1400 */ 71, 1506, 2162, 2141, 680, 698, 1687, 153, 155, 14, + /* 1410 */ 13, 650, 304, 2173, 64, 273, 55, 406, 1509, 90, + /* 1420 */ 1548, 1813, 353, 699, 2191, 378, 50, 600, 1716, 1715, + /* 1430 */ 741, 268, 664, 50, 1464, 296, 2141, 2172, 698, 2192, + /* 1440 */ 2208, 1884, 706, 110, 2174, 702, 2176, 2177, 697, 2173, + /* 1450 */ 692, 2191, 1280, 1883, 153, 2234, 155, 2261, 2164, 699, + /* 1460 */ 674, 395, 2257, 2141, 136, 698, 412, 300, 1345, 153, + /* 1470 */ 2172, 783, 1261, 2208, 1658, 2173, 110, 2174, 702, 2176, + /* 1480 */ 2177, 697, 2051, 692, 1804, 699, 1607, 2191, 685, 742, + /* 1490 */ 2261, 1809, 1985, 316, 395, 2257, 2291, 2172, 658, 2141, + /* 1500 */ 2208, 698, 1373, 111, 2174, 702, 2176, 2177, 697, 281, + /* 1510 */ 692, 1278, 1262, 2191, 1377, 278, 1384, 2261, 1, 5, + /* 1520 */ 415, 687, 2257, 420, 1382, 2141, 362, 698, 1571, 158, + /* 1530 */ 437, 436, 196, 700, 439, 198, 2208, 195, 1487, 111, + /* 1540 */ 2174, 702, 2176, 2177, 697, 311, 692, 206, 454, 1568, + /* 1550 */ 2052, 458, 491, 2261, 2173, 463, 1563, 357, 2257, 2172, + /* 1560 */ 476, 2044, 2208, 483, 699, 172, 2174, 702, 2176, 2177, + /* 1570 */ 697, 490, 692, 492, 501, 502, 499, 1551, 210, 504, + /* 1580 */ 2173, 211, 505, 213, 507, 509, 1569, 524, 4, 525, + /* 1590 */ 699, 532, 2191, 533, 1566, 221, 536, 535, 1570, 223, + /* 1600 */ 1572, 537, 565, 538, 2141, 1997, 698, 540, 544, 226, + /* 1610 */ 228, 85, 364, 86, 2115, 232, 647, 2353, 2191, 112, + /* 1620 */ 1995, 2112, 352, 382, 567, 604, 1934, 606, 2111, 89, + /* 1630 */ 2141, 610, 698, 609, 312, 151, 611, 253, 2172, 236, + /* 1640 */ 1930, 2208, 2173, 238, 111, 2174, 702, 2176, 2177, 697, + /* 1650 */ 160, 692, 699, 161, 1932, 255, 1928, 162, 2261, 2173, + /* 1660 */ 163, 614, 257, 2258, 2172, 1494, 617, 2208, 2292, 699, + /* 1670 */ 340, 2174, 702, 2176, 2177, 697, 672, 692, 2173, 615, + /* 1680 */ 2191, 624, 634, 645, 2302, 383, 2332, 8, 699, 630, + /* 1690 */ 2307, 2306, 2141, 264, 698, 267, 2283, 2191, 384, 643, + /* 1700 */ 637, 644, 188, 385, 625, 623, 2333, 646, 622, 2141, + /* 1710 */ 1684, 698, 654, 277, 651, 141, 2191, 2355, 1567, 175, + /* 1720 */ 2331, 390, 2277, 662, 388, 286, 2172, 274, 2141, 2208, + /* 1730 */ 698, 96, 340, 2174, 702, 2176, 2177, 697, 272, 692, + /* 1740 */ 1573, 313, 2057, 2172, 280, 276, 2208, 670, 275, 172, + /* 1750 */ 2174, 702, 2176, 2177, 697, 675, 692, 671, 2071, 314, + /* 1760 */ 676, 2070, 2172, 98, 2173, 2208, 2069, 391, 340, 2174, + /* 1770 */ 702, 2176, 2177, 697, 696, 692, 315, 1945, 100, 61, + /* 1780 */ 2242, 2173, 102, 704, 1989, 318, 784, 1907, 307, 322, + /* 1790 */ 785, 699, 787, 53, 354, 327, 355, 342, 2133, 320, + /* 1800 */ 2173, 2354, 2191, 341, 2132, 331, 2131, 78, 2128, 417, + /* 1810 */ 699, 418, 1531, 1532, 2141, 194, 698, 422, 2126, 2191, + /* 1820 */ 424, 425, 426, 2125, 398, 363, 2123, 430, 2122, 432, + /* 1830 */ 2121, 2141, 434, 698, 2102, 1522, 197, 2101, 2191, 199, + /* 1840 */ 1490, 79, 1489, 400, 2083, 2082, 2081, 446, 2172, 447, + /* 1850 */ 2141, 2208, 698, 2080, 339, 2174, 702, 2176, 2177, 697, + /* 1860 */ 2079, 692, 1441, 2227, 2035, 2172, 147, 608, 2208, 2034, + /* 1870 */ 2032, 340, 2174, 702, 2176, 2177, 697, 2031, 692, 2030, + /* 1880 */ 2033, 2029, 2028, 2026, 2172, 791, 2025, 2208, 2024, 204, + /* 1890 */ 340, 2174, 702, 2176, 2177, 697, 464, 692, 2173, 310, + /* 1900 */ 2023, 466, 2037, 2022, 2021, 2020, 2019, 2018, 699, 2017, + /* 1910 */ 2016, 2015, 2014, 2013, 2012, 180, 149, 2007, 2006, 2005, + /* 1920 */ 2036, 2004, 2003, 781, 777, 773, 769, 2011, 308, 2010, + /* 1930 */ 2009, 2173, 2008, 2002, 2001, 2000, 2191, 1443, 494, 1999, + /* 1940 */ 1998, 699, 350, 351, 1849, 1316, 1320, 212, 2141, 1848, + /* 1950 */ 698, 214, 1847, 215, 1845, 1842, 1841, 511, 1834, 1823, + /* 1960 */ 1312, 510, 1799, 1798, 2173, 227, 514, 512, 108, 2191, + /* 1970 */ 2100, 301, 2090, 2078, 699, 516, 518, 522, 2077, 1209, + /* 1980 */ 2055, 2141, 603, 698, 1923, 2208, 520, 515, 335, 2174, + /* 1990 */ 702, 2176, 2177, 697, 519, 692, 1844, 182, 2161, 217, + /* 2000 */ 2173, 1840, 2191, 77, 678, 547, 76, 183, 530, 219, + /* 2010 */ 699, 545, 1254, 225, 2141, 2172, 698, 546, 2208, 1838, + /* 2020 */ 549, 324, 2174, 702, 2176, 2177, 697, 551, 692, 1836, + /* 2030 */ 550, 554, 553, 2173, 555, 1833, 558, 557, 2191, 288, + /* 2040 */ 1818, 1816, 559, 699, 287, 1817, 1815, 1795, 2172, 1925, + /* 2050 */ 2141, 2208, 698, 1389, 325, 2174, 702, 2176, 2177, 697, + /* 2060 */ 63, 692, 2173, 1924, 254, 1388, 1303, 1301, 1299, 1298, + /* 2070 */ 756, 2191, 699, 1297, 1296, 1831, 1290, 1295, 375, 1292, + /* 2080 */ 758, 235, 1822, 2141, 2172, 698, 1291, 2208, 376, 1820, + /* 2090 */ 326, 2174, 702, 2176, 2177, 697, 1289, 692, 377, 588, + /* 2100 */ 2191, 597, 591, 1794, 593, 1793, 595, 1792, 113, 1516, + /* 2110 */ 1520, 29, 2141, 1518, 698, 1515, 2099, 2172, 58, 67, + /* 2120 */ 2208, 1496, 2173, 332, 2174, 702, 2176, 2177, 697, 2089, + /* 2130 */ 692, 1498, 699, 612, 2076, 2074, 2337, 20, 17, 6, + /* 2140 */ 31, 2173, 7, 21, 22, 271, 2172, 1500, 270, 2208, + /* 2150 */ 33, 699, 336, 2174, 702, 2176, 2177, 697, 613, 692, + /* 2160 */ 2191, 1732, 381, 258, 265, 263, 626, 628, 165, 2162, + /* 2170 */ 618, 65, 2141, 173, 698, 24, 1714, 1706, 1747, 2191, + /* 2180 */ 269, 1746, 386, 1751, 32, 1750, 92, 283, 387, 2173, + /* 2190 */ 2075, 2141, 178, 698, 1752, 60, 1753, 2073, 2072, 699, + /* 2200 */ 1681, 1680, 2054, 95, 289, 94, 2172, 2053, 2173, 2208, + /* 2210 */ 97, 25, 328, 2174, 702, 2176, 2177, 697, 699, 692, + /* 2220 */ 26, 290, 1712, 292, 297, 2172, 68, 2191, 2208, 99, + /* 2230 */ 673, 337, 2174, 702, 2176, 2177, 697, 299, 692, 2141, + /* 2240 */ 23, 698, 1846, 103, 11, 1633, 2191, 13, 302, 1556, + /* 2250 */ 59, 179, 1643, 1611, 1588, 18, 2173, 1632, 2141, 1609, + /* 2260 */ 698, 2211, 691, 39, 192, 1608, 699, 1580, 16, 27, + /* 2270 */ 28, 705, 401, 2172, 701, 707, 2208, 2173, 709, 329, + /* 2280 */ 2174, 702, 2176, 2177, 697, 1374, 692, 699, 703, 1371, + /* 2290 */ 710, 712, 2172, 1370, 2191, 2208, 713, 715, 338, 2174, + /* 2300 */ 702, 2176, 2177, 697, 718, 692, 2141, 1367, 698, 716, + /* 2310 */ 721, 719, 584, 583, 582, 2191, 1361, 1359, 722, 574, + /* 2320 */ 139, 578, 104, 305, 1365, 577, 105, 2141, 1383, 698, + /* 2330 */ 576, 581, 374, 373, 1364, 1363, 575, 75, 1379, 1362, + /* 2340 */ 2172, 1252, 736, 2208, 1284, 2173, 330, 2174, 702, 2176, + /* 2350 */ 2177, 697, 1283, 692, 1282, 699, 1281, 1279, 1277, 1276, + /* 2360 */ 1275, 2172, 1310, 2173, 2208, 746, 1270, 343, 2174, 702, + /* 2370 */ 2176, 2177, 697, 699, 692, 306, 1273, 1272, 1271, 1307, + /* 2380 */ 1269, 1268, 1267, 2191, 1305, 1264, 1263, 1260, 1259, 1258, + /* 2390 */ 1257, 1839, 766, 2173, 1837, 2141, 770, 698, 768, 772, + /* 2400 */ 1835, 2191, 776, 699, 774, 767, 1832, 771, 778, 780, + /* 2410 */ 1814, 775, 782, 2141, 779, 698, 1199, 1791, 309, 786, + /* 2420 */ 1766, 1542, 790, 319, 2173, 789, 1766, 1766, 1766, 2172, + /* 2430 */ 1766, 2191, 2208, 1766, 699, 344, 2174, 702, 2176, 2177, + /* 2440 */ 697, 2173, 692, 2141, 1766, 698, 1766, 2172, 1766, 1766, + /* 2450 */ 2208, 699, 1766, 2185, 2174, 702, 2176, 2177, 697, 1766, + /* 2460 */ 692, 1766, 2191, 1766, 1766, 1766, 1766, 1766, 1766, 1766, + /* 2470 */ 1766, 1766, 1766, 1766, 2141, 1766, 698, 2172, 1766, 2191, + /* 2480 */ 2208, 1766, 1766, 2184, 2174, 702, 2176, 2177, 697, 1766, + /* 2490 */ 692, 2141, 2173, 698, 1766, 1766, 1766, 1766, 1766, 1766, + /* 2500 */ 1766, 1766, 699, 1766, 1766, 1766, 1766, 1766, 2172, 1766, + /* 2510 */ 1766, 2208, 1766, 2173, 2183, 2174, 702, 2176, 2177, 697, + /* 2520 */ 1766, 692, 1766, 699, 1766, 2172, 1766, 1766, 2208, 1766, + /* 2530 */ 2191, 359, 2174, 702, 2176, 2177, 697, 1766, 692, 1766, + /* 2540 */ 2173, 1766, 2141, 1766, 698, 1766, 1766, 1766, 1766, 1766, + /* 2550 */ 699, 2191, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, + /* 2560 */ 1766, 1766, 1766, 2141, 1766, 698, 1766, 1766, 1766, 1766, + /* 2570 */ 1766, 1766, 1766, 1766, 1766, 1766, 2172, 1766, 2191, 2208, + /* 2580 */ 1766, 1766, 360, 2174, 702, 2176, 2177, 697, 1766, 692, + /* 2590 */ 2141, 1766, 698, 1766, 1766, 1766, 1766, 2172, 1766, 1766, + /* 2600 */ 2208, 2173, 1766, 356, 2174, 702, 2176, 2177, 697, 1766, + /* 2610 */ 692, 699, 1766, 1766, 1766, 1766, 1766, 1766, 2173, 1766, + /* 2620 */ 1766, 1766, 1766, 1766, 2172, 1766, 1766, 2208, 699, 1766, + /* 2630 */ 361, 2174, 702, 2176, 2177, 697, 1766, 692, 1766, 2191, + /* 2640 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, + /* 2650 */ 1766, 2141, 1766, 698, 1766, 1766, 2191, 1766, 1766, 1766, + /* 2660 */ 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 2141, 1766, + /* 2670 */ 698, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, 1766, + /* 2680 */ 1766, 1766, 1766, 1766, 1766, 700, 1766, 1766, 2208, 1766, + /* 2690 */ 1766, 335, 2174, 702, 2176, 2177, 697, 1766, 692, 1766, + /* 2700 */ 1766, 1766, 2172, 1766, 1766, 2208, 1766, 1766, 334, 2174, + /* 2710 */ 702, 2176, 2177, 697, 1766, 692, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 338, 367, 347, 348, 442, 443, 374, 371, 453, 375, - /* 10 */ 348, 456, 12, 13, 14, 0, 382, 383, 386, 343, - /* 20 */ 20, 366, 22, 347, 390, 349, 471, 472, 373, 347, - /* 30 */ 348, 476, 477, 33, 0, 35, 21, 375, 353, 24, - /* 40 */ 25, 26, 27, 28, 29, 30, 31, 32, 20, 387, - /* 50 */ 0, 389, 8, 9, 418, 370, 12, 13, 14, 15, - /* 60 */ 16, 61, 14, 378, 20, 8, 9, 67, 20, 12, - /* 70 */ 13, 14, 15, 16, 74, 0, 20, 12, 13, 14, - /* 80 */ 15, 16, 437, 421, 342, 440, 424, 345, 346, 427, - /* 90 */ 428, 429, 430, 431, 432, 433, 434, 435, 436, 99, - /* 100 */ 356, 44, 102, 69, 70, 71, 72, 73, 364, 75, - /* 110 */ 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - /* 120 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - /* 130 */ 448, 449, 450, 451, 99, 453, 454, 21, 138, 139, - /* 140 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 114, - /* 150 */ 115, 116, 117, 118, 119, 120, 121, 122, 123, 20, - /* 160 */ 125, 126, 127, 128, 129, 130, 138, 139, 168, 169, - /* 170 */ 347, 348, 8, 9, 174, 175, 12, 13, 14, 15, - /* 180 */ 16, 131, 132, 133, 134, 135, 136, 137, 188, 366, - /* 190 */ 190, 102, 347, 12, 13, 131, 373, 8, 9, 135, - /* 200 */ 406, 12, 13, 14, 15, 16, 131, 132, 133, 134, - /* 210 */ 135, 136, 137, 20, 170, 342, 35, 20, 345, 346, - /* 220 */ 220, 221, 66, 223, 224, 225, 226, 227, 228, 229, + /* 0 */ 340, 359, 456, 445, 446, 459, 339, 409, 341, 367, + /* 10 */ 350, 413, 12, 13, 14, 379, 378, 3, 366, 340, + /* 20 */ 20, 475, 22, 8, 9, 479, 480, 12, 13, 14, + /* 30 */ 15, 16, 380, 33, 20, 35, 398, 399, 378, 8, + /* 40 */ 9, 349, 390, 12, 13, 14, 15, 16, 370, 409, + /* 50 */ 390, 20, 392, 20, 456, 344, 378, 459, 347, 348, + /* 60 */ 340, 345, 62, 385, 386, 349, 378, 351, 68, 390, + /* 70 */ 350, 393, 474, 475, 386, 75, 377, 479, 480, 427, + /* 80 */ 428, 374, 456, 68, 424, 459, 394, 427, 389, 437, + /* 90 */ 430, 431, 432, 433, 434, 435, 456, 437, 378, 459, + /* 100 */ 100, 475, 442, 103, 444, 479, 480, 345, 448, 449, + /* 110 */ 390, 349, 392, 351, 474, 475, 12, 13, 104, 479, + /* 120 */ 480, 461, 349, 350, 20, 340, 22, 112, 421, 469, + /* 130 */ 12, 13, 14, 15, 16, 349, 20, 33, 62, 35, + /* 140 */ 140, 141, 369, 392, 424, 349, 350, 427, 35, 376, + /* 150 */ 430, 431, 432, 433, 434, 435, 0, 437, 407, 408, + /* 160 */ 440, 20, 442, 443, 444, 369, 62, 349, 448, 449, + /* 170 */ 170, 171, 68, 140, 141, 390, 176, 177, 102, 75, + /* 180 */ 0, 105, 349, 350, 169, 0, 172, 401, 75, 403, + /* 190 */ 190, 21, 192, 20, 24, 25, 26, 27, 28, 29, + /* 200 */ 30, 31, 32, 172, 100, 349, 21, 103, 340, 24, + /* 210 */ 25, 26, 27, 28, 29, 30, 31, 32, 350, 401, + /* 220 */ 352, 403, 222, 223, 0, 225, 226, 227, 228, 229, /* 230 */ 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - /* 240 */ 240, 12, 13, 398, 338, 400, 18, 453, 20, 20, - /* 250 */ 456, 22, 1, 2, 348, 27, 67, 389, 30, 20, - /* 260 */ 20, 33, 33, 102, 35, 471, 472, 69, 70, 71, - /* 270 */ 476, 477, 404, 405, 76, 77, 78, 49, 363, 51, - /* 280 */ 82, 375, 33, 55, 4, 87, 88, 89, 90, 0, - /* 290 */ 61, 93, 377, 387, 375, 389, 67, 375, 49, 4, - /* 300 */ 111, 382, 387, 74, 382, 56, 57, 58, 59, 390, - /* 310 */ 61, 375, 390, 24, 25, 26, 27, 28, 29, 30, - /* 320 */ 31, 32, 337, 43, 339, 45, 46, 421, 99, 101, - /* 330 */ 424, 102, 396, 427, 428, 429, 430, 431, 432, 424, - /* 340 */ 434, 113, 102, 426, 180, 439, 257, 441, 375, 434, - /* 350 */ 101, 445, 446, 104, 103, 382, 167, 385, 406, 66, - /* 360 */ 388, 389, 410, 390, 458, 168, 169, 138, 139, 452, - /* 370 */ 142, 190, 466, 145, 146, 147, 148, 149, 150, 151, - /* 380 */ 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, - /* 390 */ 343, 163, 164, 165, 347, 20, 349, 168, 169, 0, - /* 400 */ 20, 347, 348, 174, 175, 453, 8, 9, 456, 3, - /* 410 */ 12, 13, 14, 15, 16, 375, 37, 188, 257, 190, - /* 420 */ 171, 172, 382, 471, 472, 176, 20, 178, 476, 477, - /* 430 */ 390, 335, 389, 244, 245, 246, 247, 248, 249, 250, - /* 440 */ 251, 252, 253, 254, 401, 196, 282, 404, 405, 220, - /* 450 */ 221, 348, 223, 224, 225, 226, 227, 228, 229, 230, - /* 460 */ 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, - /* 470 */ 241, 12, 13, 355, 355, 367, 347, 102, 375, 20, - /* 480 */ 347, 22, 338, 375, 105, 347, 107, 108, 338, 110, - /* 490 */ 372, 383, 33, 453, 35, 220, 456, 257, 348, 381, - /* 500 */ 381, 103, 406, 449, 450, 451, 410, 453, 454, 103, - /* 510 */ 131, 471, 472, 338, 135, 375, 476, 477, 138, 139, - /* 520 */ 61, 347, 348, 348, 391, 375, 67, 398, 83, 400, - /* 530 */ 390, 387, 429, 74, 347, 348, 398, 387, 400, 389, - /* 540 */ 366, 173, 267, 268, 269, 270, 271, 272, 273, 453, - /* 550 */ 375, 338, 456, 258, 174, 175, 157, 4, 99, 49, - /* 560 */ 353, 102, 387, 20, 389, 166, 56, 471, 472, 59, - /* 570 */ 60, 421, 476, 477, 424, 0, 170, 427, 428, 429, - /* 580 */ 430, 431, 432, 241, 434, 378, 8, 9, 143, 144, - /* 590 */ 12, 13, 14, 15, 16, 21, 421, 138, 139, 424, - /* 600 */ 387, 113, 427, 428, 429, 430, 431, 432, 34, 434, - /* 610 */ 36, 166, 437, 14, 439, 440, 441, 467, 468, 20, - /* 620 */ 445, 446, 375, 20, 132, 133, 22, 168, 169, 137, - /* 630 */ 262, 263, 264, 174, 175, 426, 449, 450, 451, 35, - /* 640 */ 453, 454, 395, 396, 69, 70, 71, 188, 375, 190, - /* 650 */ 133, 76, 77, 78, 137, 102, 383, 82, 338, 113, - /* 660 */ 14, 452, 87, 88, 89, 90, 20, 338, 93, 131, - /* 670 */ 132, 133, 134, 135, 136, 137, 61, 348, 74, 220, - /* 680 */ 221, 103, 223, 224, 225, 226, 227, 228, 229, 230, - /* 690 */ 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, - /* 700 */ 12, 13, 14, 99, 375, 102, 74, 387, 20, 35, - /* 710 */ 22, 20, 102, 22, 197, 338, 387, 200, 389, 104, - /* 720 */ 203, 33, 205, 35, 2, 348, 35, 350, 347, 348, - /* 730 */ 8, 9, 347, 348, 12, 13, 14, 15, 16, 39, - /* 740 */ 347, 348, 338, 426, 53, 61, 74, 366, 74, 61, - /* 750 */ 421, 366, 375, 424, 347, 348, 427, 428, 429, 430, - /* 760 */ 431, 432, 74, 434, 387, 406, 389, 168, 439, 452, - /* 770 */ 441, 2, 338, 366, 445, 446, 35, 8, 9, 12, - /* 780 */ 13, 12, 13, 14, 15, 16, 102, 99, 104, 22, - /* 790 */ 102, 387, 188, 0, 190, 466, 44, 187, 421, 189, - /* 800 */ 33, 424, 35, 338, 427, 428, 429, 430, 431, 432, - /* 810 */ 257, 434, 453, 348, 168, 456, 439, 13, 441, 347, - /* 820 */ 348, 387, 445, 446, 220, 221, 138, 139, 61, 219, - /* 830 */ 471, 472, 347, 348, 376, 476, 477, 367, 366, 35, - /* 840 */ 375, 74, 449, 450, 451, 375, 453, 454, 241, 456, - /* 850 */ 243, 366, 387, 383, 389, 103, 168, 169, 338, 66, - /* 860 */ 257, 338, 174, 175, 471, 472, 99, 257, 375, 476, - /* 870 */ 477, 347, 348, 360, 361, 382, 188, 363, 190, 453, - /* 880 */ 376, 453, 456, 390, 456, 338, 421, 347, 348, 424, - /* 890 */ 366, 377, 427, 428, 429, 430, 431, 432, 472, 434, - /* 900 */ 472, 387, 476, 477, 476, 477, 366, 387, 220, 221, - /* 910 */ 387, 223, 224, 225, 226, 227, 228, 229, 230, 231, - /* 920 */ 232, 233, 234, 235, 236, 237, 238, 239, 240, 12, - /* 930 */ 13, 190, 347, 348, 387, 338, 338, 20, 424, 22, - /* 940 */ 22, 257, 3, 478, 479, 348, 367, 350, 434, 376, - /* 950 */ 33, 366, 35, 35, 375, 188, 256, 190, 338, 8, - /* 960 */ 9, 338, 383, 12, 13, 14, 15, 16, 368, 8, - /* 970 */ 9, 371, 375, 12, 13, 14, 15, 16, 61, 20, - /* 980 */ 347, 348, 388, 389, 387, 387, 389, 220, 221, 347, - /* 990 */ 348, 74, 347, 348, 347, 348, 22, 0, 406, 366, - /* 1000 */ 233, 234, 235, 236, 237, 238, 239, 387, 366, 35, - /* 1010 */ 387, 366, 348, 366, 20, 376, 99, 99, 421, 102, - /* 1020 */ 20, 424, 22, 338, 427, 428, 429, 430, 431, 432, - /* 1030 */ 132, 434, 4, 348, 384, 350, 439, 387, 441, 347, - /* 1040 */ 348, 384, 445, 446, 387, 453, 167, 19, 456, 338, - /* 1050 */ 61, 347, 348, 53, 183, 138, 139, 393, 366, 338, - /* 1060 */ 375, 33, 338, 471, 472, 347, 348, 20, 476, 477, - /* 1070 */ 366, 338, 387, 99, 389, 347, 348, 49, 347, 348, - /* 1080 */ 20, 210, 211, 55, 366, 168, 169, 360, 361, 61, - /* 1090 */ 101, 174, 175, 104, 366, 45, 46, 366, 387, 201, - /* 1100 */ 202, 14, 15, 16, 14, 188, 421, 190, 387, 424, - /* 1110 */ 20, 387, 427, 428, 429, 430, 431, 432, 338, 434, - /* 1120 */ 387, 170, 406, 244, 439, 338, 441, 168, 338, 101, - /* 1130 */ 445, 446, 104, 254, 338, 255, 256, 220, 221, 348, - /* 1140 */ 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - /* 1150 */ 233, 234, 235, 236, 237, 238, 239, 240, 12, 13, - /* 1160 */ 348, 338, 363, 438, 170, 440, 20, 387, 22, 453, - /* 1170 */ 0, 348, 456, 350, 387, 362, 377, 387, 365, 33, - /* 1180 */ 438, 35, 440, 387, 393, 113, 387, 471, 472, 22, - /* 1190 */ 48, 384, 476, 477, 387, 42, 0, 44, 375, 42, - /* 1200 */ 106, 44, 35, 109, 0, 393, 106, 61, 44, 109, - /* 1210 */ 387, 214, 389, 13, 0, 106, 277, 170, 109, 49, - /* 1220 */ 74, 0, 106, 424, 425, 109, 22, 204, 44, 206, - /* 1230 */ 170, 44, 44, 434, 162, 35, 22, 44, 44, 44, - /* 1240 */ 44, 138, 139, 22, 421, 99, 44, 424, 102, 67, - /* 1250 */ 427, 428, 429, 430, 431, 432, 44, 434, 47, 44, - /* 1260 */ 44, 0, 439, 35, 441, 102, 44, 103, 445, 446, - /* 1270 */ 44, 1, 2, 44, 44, 112, 44, 13, 13, 44, - /* 1280 */ 44, 44, 44, 44, 138, 139, 376, 103, 35, 376, - /* 1290 */ 103, 103, 376, 411, 364, 339, 103, 103, 397, 35, - /* 1300 */ 35, 480, 469, 18, 351, 103, 463, 363, 23, 363, - /* 1310 */ 375, 50, 170, 102, 168, 169, 351, 397, 103, 103, - /* 1320 */ 174, 175, 37, 38, 346, 103, 41, 74, 348, 103, - /* 1330 */ 397, 386, 103, 103, 188, 103, 190, 52, 103, 103, - /* 1340 */ 103, 103, 103, 455, 447, 473, 457, 62, 63, 64, - /* 1350 */ 65, 259, 423, 49, 422, 338, 20, 415, 203, 355, - /* 1360 */ 420, 355, 415, 186, 42, 348, 220, 221, 408, 223, - /* 1370 */ 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, - /* 1380 */ 234, 235, 236, 237, 238, 239, 240, 102, 20, 394, - /* 1390 */ 397, 167, 375, 394, 392, 20, 347, 394, 347, 392, - /* 1400 */ 392, 100, 220, 359, 387, 98, 389, 97, 347, 347, - /* 1410 */ 358, 357, 347, 347, 20, 340, 415, 48, 190, 340, - /* 1420 */ 344, 344, 355, 20, 338, 140, 389, 20, 355, 349, - /* 1430 */ 20, 407, 349, 355, 348, 347, 350, 355, 421, 355, - /* 1440 */ 355, 424, 54, 352, 427, 428, 429, 430, 431, 432, - /* 1450 */ 355, 434, 340, 352, 340, 347, 439, 387, 441, 207, - /* 1460 */ 419, 375, 445, 446, 375, 180, 181, 182, 375, 102, - /* 1470 */ 185, 375, 375, 387, 279, 389, 417, 375, 415, 375, - /* 1480 */ 375, 375, 375, 198, 199, 375, 338, 353, 375, 194, - /* 1490 */ 193, 353, 192, 281, 209, 414, 348, 212, 350, 347, - /* 1500 */ 215, 216, 217, 218, 219, 387, 387, 421, 397, 389, - /* 1510 */ 424, 413, 338, 427, 428, 429, 430, 431, 432, 397, - /* 1520 */ 434, 266, 348, 375, 387, 439, 462, 441, 265, 412, - /* 1530 */ 402, 445, 446, 462, 387, 387, 387, 389, 402, 465, - /* 1540 */ 274, 387, 257, 179, 276, 283, 275, 260, 423, 375, - /* 1550 */ 481, 278, 280, 348, 256, 20, 426, 347, 349, 353, - /* 1560 */ 461, 387, 20, 389, 402, 400, 353, 387, 387, 421, - /* 1570 */ 387, 402, 424, 387, 459, 427, 428, 429, 430, 431, - /* 1580 */ 432, 172, 434, 460, 387, 464, 338, 439, 462, 441, - /* 1590 */ 387, 399, 102, 445, 446, 421, 348, 353, 424, 475, - /* 1600 */ 353, 427, 428, 429, 430, 431, 432, 474, 434, 102, - /* 1610 */ 444, 371, 379, 439, 387, 441, 365, 348, 36, 445, - /* 1620 */ 446, 347, 341, 375, 340, 369, 409, 369, 353, 369, - /* 1630 */ 354, 0, 336, 0, 416, 387, 0, 389, 42, 0, - /* 1640 */ 35, 213, 35, 35, 403, 403, 35, 338, 0, 213, - /* 1650 */ 35, 35, 213, 0, 213, 0, 35, 348, 35, 22, - /* 1660 */ 0, 208, 0, 196, 0, 196, 190, 197, 188, 421, - /* 1670 */ 0, 0, 424, 338, 0, 427, 428, 429, 430, 431, - /* 1680 */ 432, 0, 434, 348, 375, 184, 183, 439, 0, 441, - /* 1690 */ 0, 47, 0, 445, 446, 0, 387, 0, 389, 42, - /* 1700 */ 0, 0, 0, 0, 0, 0, 0, 0, 157, 338, - /* 1710 */ 375, 35, 0, 157, 0, 0, 0, 0, 0, 348, - /* 1720 */ 42, 0, 387, 0, 389, 0, 0, 0, 0, 0, - /* 1730 */ 421, 0, 0, 424, 0, 0, 427, 428, 429, 430, - /* 1740 */ 431, 432, 0, 434, 0, 0, 375, 0, 0, 0, - /* 1750 */ 441, 0, 22, 0, 445, 446, 421, 0, 387, 424, - /* 1760 */ 389, 141, 427, 428, 429, 430, 431, 432, 0, 434, - /* 1770 */ 0, 0, 22, 338, 22, 35, 441, 0, 0, 0, - /* 1780 */ 445, 446, 179, 348, 48, 48, 0, 49, 0, 0, - /* 1790 */ 35, 0, 421, 35, 61, 424, 35, 338, 427, 428, - /* 1800 */ 429, 430, 431, 432, 61, 434, 39, 348, 49, 49, - /* 1810 */ 375, 39, 441, 39, 0, 61, 445, 446, 42, 35, - /* 1820 */ 39, 14, 387, 0, 389, 0, 39, 47, 0, 44, - /* 1830 */ 0, 0, 0, 40, 375, 39, 0, 47, 0, 47, - /* 1840 */ 0, 68, 39, 35, 49, 0, 387, 35, 389, 49, - /* 1850 */ 39, 0, 35, 49, 39, 0, 421, 35, 49, 424, - /* 1860 */ 39, 338, 427, 428, 429, 430, 431, 432, 0, 434, - /* 1870 */ 0, 348, 0, 0, 111, 109, 441, 35, 22, 0, - /* 1880 */ 421, 446, 1, 424, 35, 35, 427, 428, 429, 430, - /* 1890 */ 431, 432, 44, 434, 35, 35, 35, 35, 375, 35, - /* 1900 */ 19, 35, 44, 380, 35, 22, 35, 0, 22, 0, - /* 1910 */ 387, 22, 389, 0, 33, 22, 51, 35, 0, 338, - /* 1920 */ 35, 0, 35, 0, 22, 20, 35, 468, 102, 348, - /* 1930 */ 49, 35, 35, 0, 170, 338, 103, 56, 57, 58, - /* 1940 */ 59, 102, 61, 35, 421, 348, 22, 424, 0, 22, - /* 1950 */ 427, 428, 429, 430, 431, 432, 375, 434, 0, 0, - /* 1960 */ 195, 380, 48, 3, 170, 102, 191, 100, 387, 172, - /* 1970 */ 389, 170, 375, 44, 261, 177, 48, 103, 102, 44, - /* 1980 */ 44, 103, 101, 103, 387, 104, 389, 103, 98, 47, - /* 1990 */ 102, 44, 3, 47, 102, 44, 338, 102, 44, 35, - /* 2000 */ 102, 35, 421, 103, 103, 424, 348, 261, 427, 428, - /* 2010 */ 429, 430, 431, 432, 35, 434, 35, 136, 421, 35, - /* 2020 */ 35, 424, 338, 261, 427, 428, 429, 430, 431, 432, - /* 2030 */ 47, 434, 348, 375, 103, 103, 44, 47, 255, 0, - /* 2040 */ 0, 0, 0, 102, 39, 387, 47, 389, 173, 0, - /* 2050 */ 39, 102, 171, 103, 47, 103, 112, 176, 338, 375, - /* 2060 */ 44, 242, 47, 102, 380, 102, 2, 470, 348, 102, - /* 2070 */ 171, 387, 102, 389, 100, 100, 22, 196, 102, 421, - /* 2080 */ 103, 103, 424, 103, 102, 427, 428, 429, 430, 431, - /* 2090 */ 432, 47, 434, 102, 338, 375, 102, 102, 22, 103, - /* 2100 */ 102, 113, 35, 103, 348, 421, 35, 387, 424, 389, - /* 2110 */ 102, 427, 428, 429, 430, 431, 432, 103, 434, 35, - /* 2120 */ 338, 102, 35, 220, 103, 102, 222, 103, 35, 102, - /* 2130 */ 348, 375, 103, 35, 102, 102, 380, 479, 44, 102, - /* 2140 */ 35, 421, 124, 387, 424, 389, 124, 427, 428, 429, - /* 2150 */ 430, 431, 432, 102, 434, 124, 436, 375, 124, 22, - /* 2160 */ 68, 35, 380, 67, 35, 35, 35, 35, 35, 387, - /* 2170 */ 35, 389, 44, 74, 35, 96, 35, 421, 35, 35, - /* 2180 */ 424, 22, 35, 427, 428, 429, 430, 431, 432, 35, - /* 2190 */ 434, 35, 74, 35, 22, 338, 35, 35, 35, 35, - /* 2200 */ 35, 0, 35, 421, 49, 348, 424, 39, 0, 427, - /* 2210 */ 428, 429, 430, 431, 432, 338, 434, 35, 49, 39, - /* 2220 */ 0, 0, 35, 49, 39, 348, 35, 49, 39, 0, - /* 2230 */ 35, 35, 375, 0, 22, 21, 482, 22, 22, 21, - /* 2240 */ 482, 482, 20, 482, 387, 482, 389, 482, 482, 482, - /* 2250 */ 482, 482, 375, 482, 482, 482, 482, 482, 482, 482, - /* 2260 */ 482, 482, 482, 482, 387, 482, 389, 482, 482, 482, - /* 2270 */ 482, 482, 482, 482, 482, 482, 482, 482, 421, 482, - /* 2280 */ 482, 424, 482, 338, 427, 428, 429, 430, 431, 432, - /* 2290 */ 482, 434, 482, 348, 482, 482, 482, 482, 421, 482, - /* 2300 */ 338, 424, 482, 482, 427, 428, 429, 430, 431, 432, - /* 2310 */ 348, 434, 482, 482, 482, 482, 482, 482, 482, 482, - /* 2320 */ 375, 482, 482, 482, 482, 482, 482, 482, 482, 482, - /* 2330 */ 482, 482, 387, 482, 389, 482, 482, 375, 482, 482, - /* 2340 */ 482, 482, 482, 482, 482, 482, 482, 482, 338, 387, - /* 2350 */ 482, 389, 482, 482, 482, 482, 482, 482, 348, 482, - /* 2360 */ 482, 482, 482, 482, 482, 482, 421, 482, 338, 424, - /* 2370 */ 482, 482, 427, 428, 429, 430, 431, 432, 348, 434, - /* 2380 */ 482, 482, 482, 421, 482, 375, 424, 482, 482, 427, - /* 2390 */ 428, 429, 430, 431, 432, 482, 434, 387, 338, 389, - /* 2400 */ 482, 482, 482, 482, 482, 375, 482, 482, 348, 482, - /* 2410 */ 482, 482, 482, 482, 482, 482, 338, 387, 482, 389, - /* 2420 */ 482, 482, 482, 482, 482, 482, 348, 482, 482, 482, - /* 2430 */ 482, 421, 482, 482, 424, 375, 482, 427, 428, 429, - /* 2440 */ 430, 431, 432, 482, 434, 482, 338, 387, 482, 389, - /* 2450 */ 482, 421, 482, 375, 424, 482, 348, 427, 428, 429, - /* 2460 */ 430, 431, 432, 482, 434, 387, 482, 389, 482, 482, - /* 2470 */ 482, 482, 482, 482, 482, 482, 338, 482, 482, 482, - /* 2480 */ 482, 421, 482, 375, 424, 482, 348, 427, 428, 429, - /* 2490 */ 430, 431, 432, 482, 434, 387, 482, 389, 482, 421, - /* 2500 */ 482, 482, 424, 482, 482, 427, 428, 429, 430, 431, - /* 2510 */ 432, 482, 434, 375, 482, 482, 482, 482, 482, 482, - /* 2520 */ 482, 482, 482, 482, 338, 387, 482, 389, 482, 421, - /* 2530 */ 482, 482, 424, 482, 348, 427, 428, 429, 430, 431, - /* 2540 */ 432, 482, 434, 482, 338, 482, 482, 482, 482, 482, - /* 2550 */ 482, 482, 482, 482, 348, 482, 482, 482, 482, 421, - /* 2560 */ 482, 375, 424, 482, 482, 427, 428, 429, 430, 431, - /* 2570 */ 432, 482, 434, 387, 482, 389, 482, 482, 482, 482, - /* 2580 */ 482, 375, 482, 482, 482, 482, 482, 482, 482, 482, - /* 2590 */ 482, 482, 482, 387, 482, 389, 482, 482, 482, 482, - /* 2600 */ 482, 482, 482, 482, 482, 482, 482, 421, 482, 482, - /* 2610 */ 424, 482, 482, 427, 428, 429, 430, 431, 432, 482, - /* 2620 */ 434, 482, 338, 482, 482, 482, 482, 421, 482, 482, - /* 2630 */ 424, 482, 348, 427, 428, 429, 430, 431, 432, 338, - /* 2640 */ 434, 482, 482, 482, 482, 482, 482, 482, 482, 348, - /* 2650 */ 482, 482, 482, 482, 482, 482, 482, 482, 482, 375, - /* 2660 */ 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, - /* 2670 */ 482, 387, 482, 389, 482, 482, 375, 482, 482, 482, - /* 2680 */ 482, 482, 482, 482, 482, 482, 482, 338, 387, 482, - /* 2690 */ 389, 482, 482, 482, 482, 482, 482, 348, 482, 482, - /* 2700 */ 482, 482, 482, 482, 482, 421, 482, 338, 424, 482, - /* 2710 */ 482, 427, 428, 429, 430, 431, 432, 348, 434, 482, - /* 2720 */ 482, 482, 421, 482, 375, 424, 482, 482, 427, 428, - /* 2730 */ 429, 430, 431, 432, 482, 434, 387, 338, 389, 482, - /* 2740 */ 482, 482, 482, 482, 375, 482, 482, 348, 482, 482, - /* 2750 */ 482, 482, 482, 482, 482, 338, 387, 482, 389, 482, - /* 2760 */ 482, 482, 482, 482, 482, 348, 482, 482, 482, 482, - /* 2770 */ 421, 482, 482, 424, 375, 482, 427, 428, 429, 430, - /* 2780 */ 431, 432, 482, 434, 482, 338, 387, 482, 389, 482, - /* 2790 */ 421, 482, 375, 424, 482, 348, 427, 428, 429, 430, - /* 2800 */ 431, 432, 482, 434, 387, 482, 389, 482, 482, 482, - /* 2810 */ 482, 482, 482, 482, 482, 338, 482, 482, 482, 482, - /* 2820 */ 421, 482, 375, 424, 482, 348, 427, 428, 429, 430, - /* 2830 */ 431, 432, 482, 434, 387, 482, 389, 482, 421, 482, - /* 2840 */ 482, 424, 482, 482, 427, 428, 429, 430, 431, 432, - /* 2850 */ 482, 434, 375, 482, 482, 482, 482, 482, 482, 482, - /* 2860 */ 482, 482, 482, 338, 387, 482, 389, 482, 421, 482, - /* 2870 */ 482, 424, 482, 348, 427, 428, 429, 430, 431, 432, - /* 2880 */ 482, 434, 482, 338, 482, 482, 482, 482, 482, 482, - /* 2890 */ 482, 482, 482, 348, 482, 482, 482, 482, 421, 482, - /* 2900 */ 375, 424, 482, 482, 427, 428, 429, 430, 431, 432, - /* 2910 */ 482, 434, 387, 482, 389, 482, 482, 482, 482, 482, - /* 2920 */ 375, 482, 482, 482, 482, 482, 482, 482, 482, 482, - /* 2930 */ 482, 482, 387, 482, 389, 482, 482, 482, 482, 482, - /* 2940 */ 482, 482, 482, 482, 482, 482, 421, 482, 482, 424, - /* 2950 */ 482, 482, 427, 428, 429, 430, 431, 432, 482, 434, - /* 2960 */ 482, 482, 482, 482, 482, 482, 421, 482, 482, 424, - /* 2970 */ 482, 482, 427, 428, 429, 430, 431, 432, 482, 434, - /* 2980 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 2990 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3000 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3010 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3020 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3030 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3040 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3050 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3060 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3070 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3080 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3090 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3100 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3110 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3120 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3130 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3140 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3150 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3160 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3170 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3180 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3190 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3200 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3210 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3220 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3230 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3240 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3250 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3260 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3270 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3280 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3290 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3300 */ 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, - /* 3310 */ 335, 335, 335, 335, 335, + /* 240 */ 240, 241, 242, 20, 140, 141, 378, 67, 24, 25, + /* 250 */ 26, 27, 28, 29, 30, 31, 32, 401, 390, 403, + /* 260 */ 392, 246, 247, 248, 249, 250, 251, 252, 253, 254, + /* 270 */ 255, 256, 67, 340, 170, 171, 103, 349, 350, 4, + /* 280 */ 176, 177, 39, 350, 451, 452, 453, 454, 172, 456, + /* 290 */ 457, 20, 424, 22, 190, 427, 192, 369, 430, 431, + /* 300 */ 432, 433, 434, 435, 376, 437, 35, 14, 349, 350, + /* 310 */ 442, 378, 444, 20, 8, 9, 448, 449, 12, 13, + /* 320 */ 14, 15, 16, 390, 53, 392, 222, 223, 369, 225, + /* 330 */ 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + /* 340 */ 236, 237, 238, 239, 240, 241, 242, 243, 12, 13, + /* 350 */ 20, 340, 22, 12, 13, 3, 20, 424, 22, 429, + /* 360 */ 427, 350, 0, 430, 431, 432, 433, 434, 435, 33, + /* 370 */ 437, 35, 216, 378, 378, 442, 35, 444, 103, 350, + /* 380 */ 385, 448, 449, 53, 392, 455, 8, 9, 393, 378, + /* 390 */ 12, 13, 14, 15, 16, 399, 404, 100, 62, 407, + /* 400 */ 408, 390, 469, 392, 68, 344, 44, 378, 347, 348, + /* 410 */ 104, 75, 115, 116, 117, 118, 119, 120, 121, 122, + /* 420 */ 123, 124, 44, 126, 127, 128, 129, 130, 131, 132, + /* 430 */ 20, 14, 259, 20, 356, 424, 100, 20, 427, 103, + /* 440 */ 356, 430, 431, 432, 433, 434, 435, 436, 437, 438, + /* 450 */ 439, 373, 12, 13, 14, 358, 175, 2, 33, 381, + /* 460 */ 20, 432, 22, 8, 9, 381, 20, 12, 13, 14, + /* 470 */ 15, 16, 375, 33, 49, 35, 140, 141, 20, 349, + /* 480 */ 350, 384, 57, 58, 59, 60, 350, 62, 62, 370, + /* 490 */ 133, 134, 135, 136, 137, 138, 139, 378, 340, 369, + /* 500 */ 4, 258, 62, 20, 222, 386, 170, 171, 350, 243, + /* 510 */ 352, 245, 176, 177, 350, 75, 8, 9, 349, 350, + /* 520 */ 12, 13, 14, 15, 16, 20, 190, 102, 192, 103, + /* 530 */ 105, 105, 396, 192, 259, 84, 378, 20, 369, 43, + /* 540 */ 100, 45, 46, 103, 340, 264, 265, 266, 390, 103, + /* 550 */ 392, 269, 270, 271, 272, 273, 274, 275, 222, 223, + /* 560 */ 396, 225, 226, 227, 228, 229, 230, 231, 232, 233, + /* 570 */ 234, 235, 236, 237, 238, 239, 240, 241, 242, 103, + /* 580 */ 140, 141, 424, 170, 171, 427, 103, 170, 430, 431, + /* 590 */ 432, 433, 434, 435, 390, 437, 145, 146, 173, 174, + /* 600 */ 442, 49, 444, 178, 67, 180, 448, 449, 340, 57, + /* 610 */ 170, 171, 60, 61, 349, 350, 176, 177, 350, 168, + /* 620 */ 352, 349, 350, 198, 114, 366, 103, 103, 134, 135, + /* 630 */ 190, 279, 192, 139, 369, 70, 71, 72, 441, 380, + /* 640 */ 443, 369, 77, 78, 79, 0, 378, 340, 83, 390, + /* 650 */ 349, 350, 35, 88, 89, 90, 91, 0, 390, 94, + /* 660 */ 392, 409, 222, 223, 20, 225, 226, 227, 228, 229, + /* 670 */ 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + /* 680 */ 240, 241, 242, 12, 13, 259, 427, 349, 350, 172, + /* 690 */ 182, 20, 424, 22, 49, 427, 437, 390, 430, 431, + /* 700 */ 432, 433, 434, 435, 33, 437, 35, 369, 456, 340, + /* 710 */ 442, 459, 444, 189, 370, 191, 448, 449, 0, 350, + /* 720 */ 388, 4, 378, 391, 392, 429, 474, 475, 349, 350, + /* 730 */ 386, 479, 480, 62, 14, 259, 19, 391, 392, 340, + /* 740 */ 20, 185, 259, 349, 350, 221, 75, 378, 369, 350, + /* 750 */ 33, 455, 21, 452, 453, 454, 243, 456, 457, 390, + /* 760 */ 459, 392, 370, 369, 429, 34, 49, 36, 212, 213, + /* 770 */ 378, 100, 75, 56, 103, 474, 475, 378, 386, 62, + /* 780 */ 479, 480, 259, 259, 140, 141, 75, 12, 13, 390, + /* 790 */ 455, 392, 284, 424, 22, 20, 427, 22, 134, 430, + /* 800 */ 431, 432, 433, 434, 435, 169, 437, 35, 33, 192, + /* 810 */ 35, 140, 141, 444, 349, 350, 159, 448, 449, 102, + /* 820 */ 176, 177, 105, 424, 0, 168, 427, 114, 378, 430, + /* 830 */ 431, 432, 433, 434, 435, 385, 437, 62, 340, 340, + /* 840 */ 14, 170, 171, 393, 349, 350, 20, 176, 177, 350, + /* 850 */ 75, 133, 134, 135, 136, 137, 138, 139, 22, 378, + /* 860 */ 441, 190, 443, 192, 369, 44, 385, 203, 204, 470, + /* 870 */ 471, 35, 100, 2, 393, 100, 379, 378, 103, 8, + /* 880 */ 9, 379, 246, 12, 13, 14, 15, 16, 390, 390, + /* 890 */ 170, 392, 256, 222, 223, 379, 225, 226, 227, 228, + /* 900 */ 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + /* 910 */ 239, 240, 241, 242, 340, 140, 141, 452, 453, 454, + /* 920 */ 337, 456, 457, 424, 340, 104, 427, 340, 340, 430, + /* 930 */ 431, 432, 433, 434, 435, 18, 437, 20, 14, 15, + /* 940 */ 16, 378, 414, 340, 27, 170, 171, 30, 385, 340, + /* 950 */ 33, 176, 177, 350, 378, 352, 393, 133, 134, 135, + /* 960 */ 136, 137, 138, 139, 390, 190, 49, 192, 51, 393, + /* 970 */ 471, 349, 350, 56, 390, 22, 22, 390, 390, 8, + /* 980 */ 9, 378, 340, 12, 13, 14, 15, 16, 35, 35, + /* 990 */ 20, 369, 409, 390, 340, 392, 413, 222, 223, 390, + /* 1000 */ 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, + /* 1010 */ 235, 236, 237, 238, 239, 240, 241, 242, 0, 102, + /* 1020 */ 20, 349, 350, 349, 350, 363, 364, 424, 75, 379, + /* 1030 */ 427, 114, 390, 430, 431, 432, 433, 434, 435, 456, + /* 1040 */ 437, 369, 459, 340, 390, 442, 133, 444, 54, 55, + /* 1050 */ 137, 448, 449, 100, 100, 354, 355, 474, 475, 354, + /* 1060 */ 355, 144, 479, 480, 147, 148, 149, 150, 151, 152, + /* 1070 */ 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, + /* 1080 */ 163, 44, 165, 166, 167, 363, 364, 340, 70, 71, + /* 1090 */ 72, 73, 74, 390, 76, 77, 78, 79, 80, 81, + /* 1100 */ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + /* 1110 */ 92, 93, 94, 95, 96, 18, 349, 350, 409, 340, + /* 1120 */ 23, 340, 340, 12, 13, 379, 452, 453, 454, 340, + /* 1130 */ 456, 457, 37, 22, 37, 38, 369, 390, 41, 350, + /* 1140 */ 379, 352, 172, 190, 33, 192, 35, 8, 9, 52, + /* 1150 */ 4, 12, 13, 14, 15, 16, 350, 340, 349, 350, + /* 1160 */ 63, 64, 65, 66, 42, 456, 44, 378, 459, 390, + /* 1170 */ 170, 390, 390, 62, 44, 222, 223, 340, 369, 390, + /* 1180 */ 340, 392, 62, 474, 475, 366, 75, 350, 479, 480, + /* 1190 */ 8, 9, 1, 2, 12, 13, 14, 15, 16, 380, + /* 1200 */ 103, 106, 396, 108, 109, 114, 111, 390, 358, 390, + /* 1210 */ 68, 100, 409, 424, 440, 378, 427, 443, 367, 430, + /* 1220 */ 431, 432, 433, 434, 435, 105, 437, 390, 133, 392, + /* 1230 */ 390, 442, 137, 444, 384, 340, 13, 448, 449, 142, + /* 1240 */ 42, 387, 44, 104, 390, 350, 427, 352, 387, 387, + /* 1250 */ 371, 390, 390, 374, 365, 164, 437, 368, 35, 456, + /* 1260 */ 107, 424, 459, 110, 427, 257, 258, 430, 431, 432, + /* 1270 */ 433, 434, 435, 378, 437, 45, 46, 474, 475, 182, + /* 1280 */ 183, 184, 479, 480, 187, 390, 340, 392, 107, 341, + /* 1290 */ 13, 110, 48, 349, 350, 104, 350, 200, 201, 107, + /* 1300 */ 400, 190, 110, 192, 107, 140, 141, 110, 211, 0, + /* 1310 */ 473, 214, 35, 369, 217, 218, 219, 220, 221, 424, + /* 1320 */ 283, 206, 427, 208, 378, 430, 431, 432, 433, 434, + /* 1330 */ 435, 22, 437, 222, 223, 0, 390, 442, 392, 444, + /* 1340 */ 0, 44, 456, 448, 449, 459, 235, 236, 237, 238, + /* 1350 */ 239, 240, 241, 340, 172, 135, 259, 22, 44, 139, + /* 1360 */ 474, 475, 22, 350, 222, 479, 480, 483, 44, 44, + /* 1370 */ 424, 44, 44, 427, 44, 44, 430, 431, 432, 433, + /* 1380 */ 434, 435, 472, 437, 349, 350, 340, 353, 442, 103, + /* 1390 */ 444, 378, 349, 350, 448, 449, 350, 349, 350, 113, + /* 1400 */ 44, 104, 47, 390, 369, 392, 260, 44, 44, 1, + /* 1410 */ 2, 281, 369, 340, 44, 466, 172, 369, 104, 199, + /* 1420 */ 35, 0, 202, 350, 378, 205, 44, 207, 104, 104, + /* 1430 */ 13, 104, 104, 44, 104, 104, 390, 424, 392, 378, + /* 1440 */ 427, 366, 44, 430, 431, 432, 433, 434, 435, 340, + /* 1450 */ 437, 378, 35, 366, 44, 442, 44, 444, 103, 350, + /* 1460 */ 104, 448, 449, 390, 44, 392, 353, 104, 104, 44, + /* 1470 */ 424, 50, 35, 427, 104, 340, 430, 431, 432, 433, + /* 1480 */ 434, 435, 400, 437, 348, 350, 104, 378, 442, 13, + /* 1490 */ 444, 350, 389, 104, 448, 449, 400, 424, 458, 390, + /* 1500 */ 427, 392, 104, 430, 431, 432, 433, 434, 435, 476, + /* 1510 */ 437, 35, 75, 378, 104, 450, 104, 444, 460, 261, + /* 1520 */ 426, 448, 449, 49, 104, 390, 425, 392, 20, 104, + /* 1530 */ 418, 205, 358, 424, 418, 358, 427, 423, 188, 430, + /* 1540 */ 431, 432, 433, 434, 435, 411, 437, 42, 397, 20, + /* 1550 */ 400, 397, 169, 444, 340, 395, 20, 448, 449, 424, + /* 1560 */ 349, 349, 427, 397, 350, 430, 431, 432, 433, 434, + /* 1570 */ 435, 395, 437, 395, 101, 362, 99, 192, 361, 98, + /* 1580 */ 340, 349, 360, 349, 349, 349, 20, 342, 48, 346, + /* 1590 */ 350, 342, 378, 346, 20, 358, 392, 418, 20, 358, + /* 1600 */ 20, 351, 342, 410, 390, 378, 392, 351, 349, 358, + /* 1610 */ 358, 358, 385, 358, 390, 358, 481, 482, 378, 349, + /* 1620 */ 393, 390, 342, 383, 378, 209, 378, 422, 390, 103, + /* 1630 */ 390, 196, 392, 195, 418, 420, 417, 356, 424, 378, + /* 1640 */ 378, 427, 340, 378, 430, 431, 432, 433, 434, 435, + /* 1650 */ 378, 437, 350, 378, 378, 416, 378, 378, 444, 340, + /* 1660 */ 378, 392, 356, 449, 424, 194, 349, 427, 400, 350, + /* 1670 */ 430, 431, 432, 433, 434, 435, 267, 437, 340, 415, + /* 1680 */ 378, 390, 268, 456, 400, 383, 459, 276, 350, 390, + /* 1690 */ 465, 465, 390, 405, 392, 405, 468, 378, 390, 181, + /* 1700 */ 390, 474, 475, 285, 278, 277, 479, 480, 262, 390, + /* 1710 */ 258, 392, 282, 426, 280, 350, 378, 484, 20, 465, + /* 1720 */ 478, 383, 429, 349, 351, 356, 424, 464, 390, 427, + /* 1730 */ 392, 356, 430, 431, 432, 433, 434, 435, 467, 437, + /* 1740 */ 20, 405, 403, 424, 477, 462, 427, 390, 463, 430, + /* 1750 */ 431, 432, 433, 434, 435, 174, 437, 390, 390, 405, + /* 1760 */ 402, 390, 424, 356, 340, 427, 390, 390, 430, 431, + /* 1770 */ 432, 433, 434, 435, 350, 437, 374, 350, 356, 103, + /* 1780 */ 447, 340, 103, 382, 390, 349, 36, 368, 356, 338, + /* 1790 */ 343, 350, 342, 412, 406, 372, 406, 419, 0, 357, + /* 1800 */ 340, 482, 378, 372, 0, 372, 0, 42, 0, 35, + /* 1810 */ 350, 215, 35, 35, 390, 35, 392, 215, 0, 378, + /* 1820 */ 35, 35, 215, 0, 383, 215, 0, 35, 0, 22, + /* 1830 */ 0, 390, 35, 392, 0, 210, 198, 0, 378, 198, + /* 1840 */ 192, 199, 190, 383, 0, 0, 0, 186, 424, 185, + /* 1850 */ 390, 427, 392, 0, 430, 431, 432, 433, 434, 435, + /* 1860 */ 0, 437, 47, 439, 0, 424, 42, 1, 427, 0, + /* 1870 */ 0, 430, 431, 432, 433, 434, 435, 0, 437, 0, + /* 1880 */ 0, 0, 0, 0, 424, 19, 0, 427, 0, 159, + /* 1890 */ 430, 431, 432, 433, 434, 435, 35, 437, 340, 33, + /* 1900 */ 0, 159, 0, 0, 0, 0, 0, 0, 350, 0, + /* 1910 */ 0, 0, 0, 0, 0, 49, 42, 0, 0, 0, + /* 1920 */ 0, 0, 0, 57, 58, 59, 60, 0, 62, 0, + /* 1930 */ 0, 340, 0, 0, 0, 0, 378, 22, 143, 0, + /* 1940 */ 0, 350, 48, 48, 0, 22, 22, 62, 390, 0, + /* 1950 */ 392, 62, 0, 62, 0, 0, 0, 49, 0, 0, + /* 1960 */ 35, 35, 0, 0, 340, 181, 35, 39, 102, 378, + /* 1970 */ 0, 105, 0, 0, 350, 39, 35, 35, 0, 14, + /* 1980 */ 0, 390, 424, 392, 0, 427, 39, 49, 430, 431, + /* 1990 */ 432, 433, 434, 435, 49, 437, 0, 44, 47, 42, + /* 2000 */ 340, 0, 378, 39, 138, 39, 39, 47, 47, 40, + /* 2010 */ 350, 35, 69, 39, 390, 424, 392, 49, 427, 0, + /* 2020 */ 35, 430, 431, 432, 433, 434, 435, 39, 437, 0, + /* 2030 */ 49, 49, 35, 340, 39, 0, 49, 35, 378, 173, + /* 2040 */ 0, 0, 39, 350, 178, 0, 0, 0, 424, 0, + /* 2050 */ 390, 427, 392, 35, 430, 431, 432, 433, 434, 435, + /* 2060 */ 112, 437, 340, 0, 198, 22, 35, 35, 35, 35, + /* 2070 */ 44, 378, 350, 35, 35, 0, 22, 35, 22, 35, + /* 2080 */ 44, 110, 0, 390, 424, 392, 35, 427, 22, 0, + /* 2090 */ 430, 431, 432, 433, 434, 435, 35, 437, 22, 51, + /* 2100 */ 378, 22, 35, 0, 35, 0, 35, 0, 20, 35, + /* 2110 */ 104, 103, 390, 35, 392, 35, 0, 424, 172, 103, + /* 2120 */ 427, 35, 340, 430, 431, 432, 433, 434, 435, 0, + /* 2130 */ 437, 22, 350, 22, 0, 0, 3, 44, 263, 48, + /* 2140 */ 103, 340, 48, 44, 44, 47, 424, 197, 44, 427, + /* 2150 */ 44, 350, 430, 431, 432, 433, 434, 435, 172, 437, + /* 2160 */ 378, 104, 172, 174, 104, 103, 101, 99, 193, 47, + /* 2170 */ 179, 3, 390, 103, 392, 44, 104, 104, 35, 378, + /* 2180 */ 103, 35, 35, 35, 103, 35, 103, 47, 35, 340, + /* 2190 */ 0, 390, 47, 392, 104, 44, 104, 0, 0, 350, + /* 2200 */ 104, 104, 0, 39, 47, 103, 424, 0, 340, 427, + /* 2210 */ 39, 103, 430, 431, 432, 433, 434, 435, 350, 437, + /* 2220 */ 44, 104, 104, 103, 103, 424, 103, 378, 427, 103, + /* 2230 */ 175, 430, 431, 432, 433, 434, 435, 173, 437, 390, + /* 2240 */ 263, 392, 0, 113, 244, 101, 378, 2, 47, 22, + /* 2250 */ 257, 47, 222, 104, 22, 263, 340, 101, 390, 104, + /* 2260 */ 392, 103, 103, 103, 47, 104, 350, 104, 103, 103, + /* 2270 */ 103, 35, 35, 424, 224, 103, 427, 340, 35, 430, + /* 2280 */ 431, 432, 433, 434, 435, 104, 437, 350, 114, 104, + /* 2290 */ 103, 35, 424, 104, 378, 427, 103, 35, 430, 431, + /* 2300 */ 432, 433, 434, 435, 35, 437, 390, 104, 392, 103, + /* 2310 */ 35, 103, 70, 71, 72, 378, 104, 104, 103, 77, + /* 2320 */ 78, 79, 103, 44, 125, 83, 103, 390, 35, 392, + /* 2330 */ 88, 89, 90, 91, 125, 125, 94, 103, 22, 125, + /* 2340 */ 424, 69, 68, 427, 35, 340, 430, 431, 432, 433, + /* 2350 */ 434, 435, 35, 437, 35, 350, 35, 35, 35, 35, + /* 2360 */ 35, 424, 75, 340, 427, 97, 22, 430, 431, 432, + /* 2370 */ 433, 434, 435, 350, 437, 44, 35, 35, 35, 75, + /* 2380 */ 35, 35, 35, 378, 35, 35, 35, 35, 35, 22, + /* 2390 */ 35, 0, 35, 340, 0, 390, 35, 392, 39, 39, + /* 2400 */ 0, 378, 39, 350, 35, 49, 0, 49, 35, 39, + /* 2410 */ 0, 49, 35, 390, 49, 392, 35, 0, 22, 21, + /* 2420 */ 485, 22, 20, 22, 340, 21, 485, 485, 485, 424, + /* 2430 */ 485, 378, 427, 485, 350, 430, 431, 432, 433, 434, + /* 2440 */ 435, 340, 437, 390, 485, 392, 485, 424, 485, 485, + /* 2450 */ 427, 350, 485, 430, 431, 432, 433, 434, 435, 485, + /* 2460 */ 437, 485, 378, 485, 485, 485, 485, 485, 485, 485, + /* 2470 */ 485, 485, 485, 485, 390, 485, 392, 424, 485, 378, + /* 2480 */ 427, 485, 485, 430, 431, 432, 433, 434, 435, 485, + /* 2490 */ 437, 390, 340, 392, 485, 485, 485, 485, 485, 485, + /* 2500 */ 485, 485, 350, 485, 485, 485, 485, 485, 424, 485, + /* 2510 */ 485, 427, 485, 340, 430, 431, 432, 433, 434, 435, + /* 2520 */ 485, 437, 485, 350, 485, 424, 485, 485, 427, 485, + /* 2530 */ 378, 430, 431, 432, 433, 434, 435, 485, 437, 485, + /* 2540 */ 340, 485, 390, 485, 392, 485, 485, 485, 485, 485, + /* 2550 */ 350, 378, 485, 485, 485, 485, 485, 485, 485, 485, + /* 2560 */ 485, 485, 485, 390, 485, 392, 485, 485, 485, 485, + /* 2570 */ 485, 485, 485, 485, 485, 485, 424, 485, 378, 427, + /* 2580 */ 485, 485, 430, 431, 432, 433, 434, 435, 485, 437, + /* 2590 */ 390, 485, 392, 485, 485, 485, 485, 424, 485, 485, + /* 2600 */ 427, 340, 485, 430, 431, 432, 433, 434, 435, 485, + /* 2610 */ 437, 350, 485, 485, 485, 485, 485, 485, 340, 485, + /* 2620 */ 485, 485, 485, 485, 424, 485, 485, 427, 350, 485, + /* 2630 */ 430, 431, 432, 433, 434, 435, 485, 437, 485, 378, + /* 2640 */ 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, + /* 2650 */ 485, 390, 485, 392, 485, 485, 378, 485, 485, 485, + /* 2660 */ 485, 485, 485, 485, 485, 485, 485, 485, 390, 485, + /* 2670 */ 392, 485, 485, 485, 485, 485, 485, 485, 485, 485, + /* 2680 */ 485, 485, 485, 485, 485, 424, 485, 485, 427, 485, + /* 2690 */ 485, 430, 431, 432, 433, 434, 435, 485, 437, 485, + /* 2700 */ 485, 485, 424, 485, 485, 427, 485, 485, 430, 431, + /* 2710 */ 432, 433, 434, 435, 485, 437, 485, 485, 485, 485, + /* 2720 */ 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, + /* 2730 */ 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, + /* 2740 */ 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, + /* 2750 */ 485, 485, 485, 485, 485, 485, 485, 485, 485, 485, + /* 2760 */ 485, 485, 485, 337, 337, 337, 337, 337, 337, 337, + /* 2770 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 2780 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 2790 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 2800 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 2810 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 2820 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 2830 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 2840 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 2850 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 2860 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 2870 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 2880 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 2890 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 2900 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 2910 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 2920 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 2930 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 2940 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 2950 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 2960 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 2970 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 2980 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 2990 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 3000 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 3010 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 3020 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 3030 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 3040 */ 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, + /* 3050 */ 337, 337, 337, }; -#define YY_SHIFT_COUNT (786) +#define YY_SHIFT_COUNT (791) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2233) +#define YY_SHIFT_MAX (2417) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 1285, 0, 229, 0, 459, 459, 459, 459, 459, 459, - /* 10 */ 459, 459, 459, 459, 459, 459, 688, 917, 917, 1146, - /* 20 */ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917, - /* 30 */ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917, - /* 40 */ 917, 917, 917, 917, 917, 917, 917, 917, 917, 917, - /* 50 */ 917, 240, 603, 610, 375, 684, 89, 161, 89, 375, - /* 60 */ 375, 767, 89, 767, 767, 553, 89, 56, 380, 139, - /* 70 */ 139, 380, 280, 280, 197, 28, 48, 48, 139, 139, - /* 80 */ 139, 139, 139, 139, 139, 193, 139, 139, 156, 56, - /* 90 */ 139, 139, 239, 139, 56, 139, 193, 139, 193, 56, - /* 100 */ 139, 139, 56, 139, 56, 56, 56, 139, 293, 228, - /* 110 */ 189, 189, 198, 116, 604, 604, 604, 604, 604, 604, - /* 120 */ 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, - /* 130 */ 604, 604, 604, 379, 406, 197, 28, 674, 994, 994, - /* 140 */ 994, 793, 607, 607, 674, 543, 543, 543, 156, 488, - /* 150 */ 342, 56, 632, 56, 632, 632, 546, 672, 35, 35, - /* 160 */ 35, 35, 35, 35, 35, 35, 1881, 575, 15, 44, - /* 170 */ 164, 275, 691, 368, 181, 181, 599, 646, 1000, 1047, - /* 180 */ 1050, 1090, 64, 1060, 880, 700, 939, 880, 1153, 295, - /* 190 */ 959, 1092, 1304, 1336, 1155, 156, 1336, 156, 1177, 1322, - /* 200 */ 1368, 1322, 1224, 1375, 1375, 1322, 1224, 1224, 1301, 1307, - /* 210 */ 1375, 1310, 1375, 1375, 1375, 1394, 1369, 1394, 1369, 1336, - /* 220 */ 156, 1403, 156, 1407, 1410, 156, 1407, 156, 156, 156, - /* 230 */ 1375, 156, 1388, 1388, 1394, 56, 56, 56, 56, 56, - /* 240 */ 56, 56, 56, 56, 56, 56, 1375, 1394, 632, 632, - /* 250 */ 632, 1252, 1367, 1336, 293, 1295, 1297, 1403, 293, 1300, - /* 260 */ 1375, 1368, 1368, 632, 1255, 1263, 632, 1255, 1263, 632, - /* 270 */ 632, 56, 1266, 1364, 1255, 1268, 1271, 1287, 1092, 1262, - /* 280 */ 1272, 1273, 1298, 543, 1535, 1375, 1407, 293, 293, 1542, - /* 290 */ 1263, 632, 632, 632, 632, 632, 1263, 632, 1409, 293, - /* 300 */ 546, 293, 543, 1490, 1507, 632, 672, 1375, 293, 1582, - /* 310 */ 1394, 2980, 2980, 2980, 2980, 2980, 2980, 2980, 2980, 2980, - /* 320 */ 34, 249, 289, 1028, 398, 57, 578, 50, 722, 769, - /* 330 */ 951, 75, 961, 961, 961, 961, 961, 961, 961, 961, - /* 340 */ 961, 538, 517, 65, 65, 445, 510, 871, 399, 989, - /* 350 */ 918, 974, 574, 898, 492, 492, 1087, 251, 879, 1087, - /* 360 */ 1087, 1087, 1170, 997, 752, 1167, 1157, 1072, 1196, 1094, - /* 370 */ 1100, 1109, 1116, 804, 1200, 1204, 1214, 1221, 1023, 1164, - /* 380 */ 1184, 615, 1187, 1188, 1193, 1103, 1195, 1212, 1142, 1194, - /* 390 */ 1202, 1215, 1216, 1222, 1226, 1270, 1229, 1182, 1230, 1211, - /* 400 */ 1232, 1235, 1236, 1237, 1238, 1239, 1163, 741, 1228, 1264, - /* 410 */ 1265, 1253, 1261, 1631, 1633, 1636, 1596, 1639, 1605, 1428, - /* 420 */ 1607, 1608, 1611, 1436, 1648, 1615, 1616, 1439, 1653, 1441, - /* 430 */ 1655, 1621, 1670, 1637, 1660, 1623, 1453, 1662, 1467, 1664, - /* 440 */ 1469, 1470, 1476, 1480, 1671, 1674, 1681, 1501, 1503, 1688, - /* 450 */ 1690, 1644, 1692, 1695, 1697, 1657, 1700, 1701, 1702, 1703, - /* 460 */ 1704, 1705, 1706, 1707, 1551, 1676, 1712, 1556, 1714, 1715, - /* 470 */ 1716, 1717, 1718, 1723, 1725, 1726, 1727, 1728, 1729, 1731, - /* 480 */ 1732, 1734, 1735, 1742, 1678, 1721, 1744, 1745, 1747, 1748, - /* 490 */ 1749, 1730, 1751, 1753, 1757, 1620, 1768, 1770, 1750, 1736, - /* 500 */ 1752, 1737, 1771, 1733, 1740, 1777, 1743, 1778, 1754, 1779, - /* 510 */ 1786, 1755, 1738, 1767, 1788, 1758, 1759, 1772, 1789, 1761, - /* 520 */ 1760, 1774, 1791, 1784, 1814, 1776, 1781, 1785, 1780, 1790, - /* 530 */ 1807, 1792, 1823, 1793, 1787, 1825, 1828, 1830, 1796, 1603, - /* 540 */ 1831, 1832, 1836, 1773, 1838, 1840, 1808, 1795, 1803, 1845, - /* 550 */ 1812, 1800, 1811, 1851, 1817, 1804, 1815, 1855, 1822, 1809, - /* 560 */ 1821, 1868, 1870, 1872, 1873, 1763, 1766, 1842, 1856, 1879, - /* 570 */ 1849, 1850, 1859, 1860, 1861, 1862, 1864, 1848, 1858, 1866, - /* 580 */ 1869, 1883, 1871, 1907, 1886, 1909, 1889, 1865, 1913, 1893, - /* 590 */ 1882, 1918, 1885, 1921, 1887, 1923, 1902, 1905, 1891, 1896, - /* 600 */ 1897, 1833, 1826, 1933, 1764, 1839, 1765, 1908, 1924, 1948, - /* 610 */ 1775, 1927, 1794, 1797, 1958, 1959, 1801, 1798, 1960, 1929, - /* 620 */ 1713, 1863, 1874, 1876, 1914, 1867, 1928, 1890, 1878, 1935, - /* 630 */ 1936, 1880, 1888, 1892, 1895, 1884, 1947, 1942, 1946, 1898, - /* 640 */ 1951, 1746, 1900, 1901, 1989, 1954, 1762, 1964, 1966, 1979, - /* 650 */ 1981, 1984, 1985, 1931, 1932, 1983, 1783, 1992, 1990, 2039, - /* 660 */ 2040, 2041, 2042, 1941, 2005, 1780, 1999, 1949, 1950, 1952, - /* 670 */ 1961, 1963, 1875, 1967, 2049, 2011, 1899, 1970, 1944, 1780, - /* 680 */ 2007, 2016, 1974, 1819, 1975, 2064, 2054, 1903, 1976, 1977, - /* 690 */ 1982, 1978, 1991, 1980, 2015, 1994, 1995, 2044, 1996, 2076, - /* 700 */ 1904, 1998, 1988, 2000, 2067, 2071, 2008, 2014, 2084, 2019, - /* 710 */ 2021, 2087, 2023, 2024, 2093, 2027, 2029, 2098, 2032, 2018, - /* 720 */ 2022, 2031, 2034, 2033, 2094, 2037, 2105, 2051, 2094, 2094, - /* 730 */ 2137, 2092, 2096, 2126, 2129, 2130, 2131, 2132, 2133, 2135, - /* 740 */ 2139, 2099, 2079, 2128, 2141, 2143, 2144, 2159, 2147, 2154, - /* 750 */ 2156, 2118, 1848, 2158, 1858, 2161, 2162, 2163, 2164, 2172, - /* 760 */ 2165, 2201, 2167, 2155, 2168, 2208, 2182, 2169, 2180, 2220, - /* 770 */ 2187, 2174, 2185, 2221, 2191, 2178, 2189, 2229, 2195, 2196, - /* 780 */ 2233, 2212, 2214, 2215, 2216, 2218, 2222, + /* 0 */ 1097, 0, 104, 0, 336, 336, 336, 336, 336, 336, + /* 10 */ 336, 336, 336, 336, 336, 336, 440, 671, 671, 775, + /* 20 */ 671, 671, 671, 671, 671, 671, 671, 671, 671, 671, + /* 30 */ 671, 671, 671, 671, 671, 671, 671, 671, 671, 671, + /* 40 */ 671, 671, 671, 671, 671, 671, 671, 671, 671, 671, + /* 50 */ 671, 173, 483, 524, 446, 426, 476, 523, 476, 446, + /* 60 */ 446, 1111, 476, 1111, 1111, 275, 476, 141, 644, 223, + /* 70 */ 223, 644, 496, 496, 413, 33, 293, 293, 223, 223, + /* 80 */ 223, 223, 223, 223, 223, 410, 223, 223, 205, 141, + /* 90 */ 223, 223, 458, 223, 141, 223, 410, 223, 410, 141, + /* 100 */ 223, 223, 141, 223, 141, 141, 141, 223, 537, 917, + /* 110 */ 15, 15, 565, 170, 953, 953, 953, 953, 953, 953, + /* 120 */ 953, 953, 953, 953, 953, 953, 953, 953, 953, 953, + /* 130 */ 953, 953, 953, 1095, 14, 413, 33, 994, 994, 113, + /* 140 */ 116, 116, 116, 180, 266, 266, 113, 505, 505, 505, + /* 150 */ 205, 510, 513, 141, 697, 141, 697, 697, 713, 711, + /* 160 */ 297, 297, 297, 297, 297, 297, 297, 297, 1866, 2242, + /* 170 */ 185, 31, 508, 282, 271, 281, 341, 341, 417, 720, + /* 180 */ 330, 517, 1230, 826, 913, 970, 1008, 243, 352, 1008, + /* 190 */ 1122, 1146, 1000, 1258, 1474, 1508, 1326, 205, 1508, 205, + /* 200 */ 1350, 1505, 1529, 1505, 1383, 1536, 1536, 1505, 1383, 1383, + /* 210 */ 1473, 1477, 1536, 1481, 1536, 1536, 1536, 1566, 1540, 1566, + /* 220 */ 1540, 1508, 205, 1574, 205, 1578, 1580, 205, 1578, 205, + /* 230 */ 205, 205, 1536, 205, 1566, 141, 141, 141, 141, 141, + /* 240 */ 141, 141, 141, 141, 141, 141, 1536, 1566, 697, 697, + /* 250 */ 697, 1416, 1526, 1508, 537, 1435, 1438, 1574, 537, 1471, + /* 260 */ 1536, 1529, 1529, 697, 1414, 1409, 697, 1414, 1409, 697, + /* 270 */ 697, 141, 1411, 1518, 1414, 1426, 1428, 1446, 1258, 1418, + /* 280 */ 1430, 1434, 1452, 505, 1698, 1536, 1578, 537, 537, 1720, + /* 290 */ 1409, 697, 697, 697, 697, 697, 1409, 697, 1581, 537, + /* 300 */ 713, 537, 505, 1676, 1679, 697, 711, 1536, 537, 1750, + /* 310 */ 1566, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, + /* 320 */ 1018, 425, 224, 717, 306, 378, 1139, 718, 455, 871, + /* 330 */ 1182, 824, 971, 971, 971, 971, 971, 971, 971, 971, + /* 340 */ 971, 357, 1220, 118, 118, 451, 552, 556, 657, 76, + /* 350 */ 772, 954, 731, 664, 494, 494, 924, 1191, 636, 924, + /* 360 */ 924, 924, 645, 156, 821, 836, 1198, 1091, 362, 1153, + /* 370 */ 1181, 1192, 1197, 1223, 1277, 1309, 1335, 1340, 1115, 1297, + /* 380 */ 1314, 1120, 1324, 1325, 1327, 1165, 1130, 1037, 1244, 1328, + /* 390 */ 1330, 1331, 1356, 1363, 1364, 1408, 1370, 1142, 1382, 1355, + /* 400 */ 1389, 1398, 1410, 1412, 1420, 1425, 1286, 617, 1385, 1417, + /* 410 */ 1476, 1437, 1421, 1798, 1804, 1806, 1765, 1808, 1774, 1596, + /* 420 */ 1777, 1778, 1780, 1602, 1818, 1785, 1786, 1607, 1823, 1610, + /* 430 */ 1826, 1792, 1828, 1807, 1830, 1797, 1625, 1834, 1638, 1837, + /* 440 */ 1641, 1642, 1648, 1652, 1844, 1845, 1846, 1661, 1664, 1853, + /* 450 */ 1860, 1815, 1864, 1869, 1870, 1824, 1877, 1879, 1880, 1881, + /* 460 */ 1882, 1883, 1886, 1888, 1730, 1861, 1900, 1742, 1902, 1903, + /* 470 */ 1904, 1905, 1906, 1907, 1909, 1910, 1911, 1912, 1913, 1914, + /* 480 */ 1927, 1929, 1930, 1932, 1874, 1917, 1918, 1919, 1920, 1921, + /* 490 */ 1922, 1915, 1933, 1934, 1935, 1795, 1939, 1940, 1923, 1894, + /* 500 */ 1924, 1895, 1944, 1885, 1925, 1949, 1889, 1952, 1891, 1954, + /* 510 */ 1955, 1926, 1908, 1928, 1956, 1931, 1938, 1936, 1958, 1941, + /* 520 */ 1945, 1947, 1959, 1942, 1962, 1957, 1967, 1953, 1951, 1960, + /* 530 */ 1965, 1961, 1963, 1969, 1964, 1970, 1972, 1973, 1974, 1784, + /* 540 */ 1978, 1980, 1984, 1943, 1996, 2001, 1976, 1968, 1966, 2019, + /* 550 */ 1985, 1981, 1988, 2029, 1997, 1982, 1995, 2035, 2002, 1987, + /* 560 */ 2003, 2040, 2041, 2045, 2046, 2047, 2049, 1948, 1971, 2018, + /* 570 */ 2043, 2063, 2031, 2032, 2033, 2034, 2038, 2039, 2042, 2026, + /* 580 */ 2036, 2044, 2051, 2054, 2061, 2075, 2056, 2082, 2066, 2048, + /* 590 */ 2089, 2076, 2067, 2103, 2069, 2105, 2071, 2107, 2079, 2088, + /* 600 */ 2074, 2078, 2080, 2006, 2008, 2116, 1946, 2016, 1950, 2086, + /* 610 */ 2109, 2129, 1975, 2111, 1986, 1989, 2134, 2135, 1990, 1991, + /* 620 */ 2133, 2093, 1875, 2037, 2057, 2062, 2091, 2065, 2094, 2068, + /* 630 */ 2060, 2099, 2100, 2072, 2070, 2077, 2081, 2073, 2104, 2098, + /* 640 */ 2122, 2083, 2106, 1977, 2090, 2092, 2168, 2131, 1992, 2143, + /* 650 */ 2146, 2147, 2148, 2150, 2153, 2096, 2097, 2140, 1993, 2151, + /* 660 */ 2145, 2190, 2197, 2198, 2202, 2102, 2164, 1951, 2157, 2108, + /* 670 */ 2117, 2118, 2120, 2121, 2055, 2123, 2207, 2171, 2064, 2126, + /* 680 */ 2130, 1951, 2201, 2176, 2144, 2000, 2156, 2245, 2227, 2030, + /* 690 */ 2158, 2149, 2159, 2155, 2160, 2161, 2204, 2165, 2166, 2217, + /* 700 */ 2163, 2232, 2050, 2167, 2174, 2181, 2236, 2237, 2172, 2185, + /* 710 */ 2243, 2187, 2189, 2256, 2193, 2203, 2262, 2206, 2212, 2269, + /* 720 */ 2208, 2213, 2275, 2215, 2199, 2209, 2210, 2214, 2219, 2279, + /* 730 */ 2223, 2293, 2234, 2279, 2279, 2316, 2272, 2274, 2309, 2317, + /* 740 */ 2319, 2321, 2322, 2323, 2324, 2325, 2287, 2268, 2331, 2341, + /* 750 */ 2342, 2343, 2344, 2345, 2346, 2347, 2304, 2026, 2349, 2036, + /* 760 */ 2350, 2351, 2352, 2353, 2367, 2355, 2391, 2357, 2356, 2359, + /* 770 */ 2394, 2361, 2358, 2360, 2400, 2369, 2362, 2363, 2406, 2373, + /* 780 */ 2365, 2370, 2410, 2377, 2381, 2417, 2396, 2398, 2399, 2401, + /* 790 */ 2404, 2402, }; #define YY_REDUCE_COUNT (319) -#define YY_REDUCE_MIN (-445) -#define YY_REDUCE_MAX (2545) +#define YY_REDUCE_MIN (-454) +#define YY_REDUCE_MAX (2278) static const short yy_reduce_ofst[] = { - /* 0 */ 96, -94, 175, 329, 377, 597, 685, 823, 1086, 1148, - /* 10 */ 1017, 1174, 1248, 1309, 1335, 1371, -338, 150, 465, 1435, - /* 20 */ 1459, 1523, 1581, 1597, 1658, 1684, 1720, 1756, 1782, 1857, - /* 30 */ 1877, 1945, 1962, 2010, 2030, 2060, 2078, 2108, 2138, 2186, - /* 40 */ 2206, 2284, 2301, 2349, 2369, 2399, 2417, 2447, 2477, 2525, - /* 50 */ 2545, 393, 40, -48, -318, -206, 359, 592, 716, 54, - /* 60 */ 187, 799, -445, -85, 514, 426, 428, -366, 43, -345, - /* 70 */ -177, -132, -258, -127, 247, -28, -324, 47, 174, 381, - /* 80 */ 385, 407, 472, 485, 524, -155, 540, 585, 118, -81, - /* 90 */ 633, 642, 103, 645, -78, 647, 129, 692, 138, 108, - /* 100 */ 704, 718, -27, 728, 470, 493, 579, 731, -315, 133, - /* 110 */ -438, -438, -256, -15, 144, 213, 320, 404, 434, 520, - /* 120 */ 523, 547, 598, 620, 623, 711, 721, 724, 733, 780, - /* 130 */ 787, 790, 796, -368, -83, -64, 594, 513, -83, 209, - /* 140 */ 317, 207, 725, 742, 727, 664, 791, 812, 119, -364, - /* 150 */ -355, 273, 650, 140, 657, 807, 600, 813, 458, 504, - /* 160 */ 573, 639, 910, 913, 916, 910, 882, 930, 956, 901, - /* 170 */ 821, 833, 953, 843, 944, 946, 935, 935, 965, 920, - /* 180 */ 978, 980, 945, 933, 888, 888, 872, 888, 897, 889, - /* 190 */ 935, 929, 932, 942, 940, 1004, 947, 1006, 960, 995, - /* 200 */ 993, 999, 1002, 1049, 1051, 1003, 1007, 1008, 1044, 1052, - /* 210 */ 1061, 1054, 1062, 1065, 1066, 1075, 1076, 1079, 1077, 1001, - /* 220 */ 1067, 1037, 1073, 1080, 1024, 1078, 1083, 1082, 1084, 1085, - /* 230 */ 1088, 1095, 1091, 1101, 1112, 1089, 1093, 1096, 1097, 1102, - /* 240 */ 1104, 1105, 1106, 1107, 1110, 1113, 1108, 1114, 1070, 1118, - /* 250 */ 1119, 1041, 1059, 1063, 1134, 1081, 1098, 1120, 1138, 1117, - /* 260 */ 1152, 1111, 1122, 1137, 1064, 1128, 1147, 1071, 1136, 1149, - /* 270 */ 1154, 935, 1074, 1121, 1126, 1099, 1123, 1115, 1125, 1069, - /* 280 */ 1124, 1133, 888, 1205, 1130, 1210, 1209, 1206, 1213, 1165, - /* 290 */ 1162, 1180, 1181, 1183, 1186, 1197, 1169, 1203, 1192, 1244, - /* 300 */ 1240, 1247, 1269, 1166, 1233, 1227, 1251, 1274, 1275, 1281, - /* 310 */ 1284, 1217, 1218, 1241, 1242, 1256, 1258, 1260, 1276, 1296, + /* 0 */ 583, -340, -280, -67, -132, 158, 268, 603, 789, 895, + /* 10 */ 946, 1013, 1046, 369, 1073, 1109, 11, 399, 1135, 1214, + /* 20 */ 499, 1240, 1302, 837, 1319, 1338, 1424, 1441, 1460, 1558, + /* 30 */ 1591, 1624, 1660, 1693, 1722, 1782, 1801, 1849, 1868, 1916, + /* 40 */ 1937, 2005, 2023, 2053, 2084, 2101, 2152, 2173, 2200, 2261, + /* 50 */ 2278, 301, 1227, -402, -167, -360, 252, 709, 803, 465, + /* 60 */ 674, -348, 886, 259, 819, -454, -374, -322, -8, -227, + /* 70 */ -72, -249, -289, 61, -362, 332, -284, -238, -204, -41, + /* 80 */ 130, 169, 265, 272, 338, -214, 379, 394, 97, -5, + /* 90 */ 495, 622, 29, 672, 450, 767, -182, 809, -144, 119, + /* 100 */ 944, 1035, 481, 1043, 344, 563, 392, 1048, 78, -308, + /* 110 */ -442, -442, -358, -333, -321, -215, 204, 307, 498, 574, + /* 120 */ 584, 587, 588, 609, 642, 654, 703, 747, 779, 781, + /* 130 */ 782, 817, 840, -301, -70, -4, 346, 701, 705, 662, + /* 140 */ -70, 296, 335, 84, 197, 419, 722, 136, 164, 806, + /* 150 */ 850, -293, 774, -312, 854, 576, 861, 862, 879, 889, + /* 160 */ -364, 497, 502, 516, 650, 746, 761, 650, 528, 851, + /* 170 */ 948, 900, 884, 910, 1034, 949, 1075, 1087, 1061, 1061, + /* 180 */ 1113, 1082, 1136, 1141, 1103, 1096, 1040, 1040, 1033, 1040, + /* 190 */ 1065, 1058, 1061, 1094, 1101, 1112, 1114, 1174, 1116, 1177, + /* 200 */ 1134, 1151, 1150, 1154, 1160, 1211, 1212, 1166, 1176, 1178, + /* 210 */ 1213, 1217, 1232, 1222, 1234, 1235, 1236, 1245, 1243, 1249, + /* 220 */ 1247, 1179, 1237, 1204, 1241, 1250, 1193, 1251, 1256, 1252, + /* 230 */ 1253, 1255, 1259, 1257, 1260, 1246, 1248, 1261, 1262, 1265, + /* 240 */ 1272, 1275, 1276, 1278, 1279, 1282, 1270, 1280, 1224, 1231, + /* 250 */ 1238, 1205, 1215, 1216, 1281, 1219, 1239, 1269, 1306, 1264, + /* 260 */ 1317, 1268, 1284, 1291, 1225, 1288, 1299, 1226, 1290, 1308, + /* 270 */ 1310, 1061, 1228, 1271, 1254, 1263, 1285, 1283, 1287, 1233, + /* 280 */ 1242, 1267, 1040, 1365, 1293, 1374, 1373, 1369, 1375, 1339, + /* 290 */ 1336, 1357, 1367, 1368, 1371, 1376, 1354, 1377, 1358, 1407, + /* 300 */ 1402, 1422, 1427, 1333, 1401, 1394, 1419, 1436, 1432, 1447, + /* 310 */ 1450, 1381, 1378, 1388, 1390, 1423, 1431, 1433, 1442, 1451, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 10 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 20 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 30 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 40 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 50 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 60 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 70 */ 1753, 1753, 1753, 1753, 2030, 1753, 1753, 1753, 1753, 1753, - /* 80 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1839, 1753, - /* 90 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 100 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1837, 2023, - /* 110 */ 2248, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 120 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 130 */ 1753, 1753, 1753, 1753, 2260, 1753, 1753, 1753, 2260, 2260, - /* 140 */ 2260, 1837, 2220, 2220, 1753, 1753, 1753, 1753, 1839, 2090, - /* 150 */ 1753, 1753, 1753, 1753, 1753, 1753, 1958, 1753, 1753, 1753, - /* 160 */ 1753, 1753, 1982, 1753, 1753, 1753, 2082, 1753, 1753, 2285, - /* 170 */ 2341, 1753, 1753, 2288, 1753, 1753, 1753, 1753, 1753, 2035, - /* 180 */ 1753, 1753, 1912, 2275, 2252, 2266, 2325, 2253, 2250, 2269, - /* 190 */ 1753, 2279, 1753, 1753, 2104, 1839, 1753, 1839, 2069, 2028, - /* 200 */ 1753, 2028, 2025, 1753, 1753, 2028, 2025, 2025, 1901, 1897, - /* 210 */ 1753, 1895, 1753, 1753, 1753, 1753, 1800, 1753, 1800, 1753, - /* 220 */ 1839, 1753, 1839, 1753, 1753, 1839, 1753, 1839, 1839, 1839, - /* 230 */ 1753, 1839, 1814, 1814, 1753, 1753, 1753, 1753, 1753, 1753, - /* 240 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 250 */ 1753, 2102, 2088, 1753, 1837, 2080, 2078, 1753, 1837, 2076, - /* 260 */ 1753, 1753, 1753, 1753, 2296, 2294, 1753, 2296, 2294, 1753, - /* 270 */ 1753, 1753, 2310, 2306, 2296, 2314, 2312, 2281, 2279, 2344, - /* 280 */ 2331, 2327, 2266, 1753, 1753, 1753, 1753, 1837, 1837, 1753, - /* 290 */ 2294, 1753, 1753, 1753, 1753, 1753, 2294, 1753, 1753, 1837, - /* 300 */ 1753, 1837, 1753, 1753, 1928, 1753, 1753, 1753, 1837, 1785, - /* 310 */ 1753, 2071, 2093, 2053, 2053, 1961, 1961, 1961, 1840, 1758, - /* 320 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 330 */ 1753, 1753, 2309, 2308, 2175, 1753, 2224, 2223, 2222, 2213, - /* 340 */ 2174, 1924, 1753, 2173, 2172, 1753, 1753, 1753, 1753, 1753, - /* 350 */ 1753, 1753, 1753, 1753, 2044, 2043, 2166, 1753, 1753, 2167, - /* 360 */ 2165, 2164, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 370 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 380 */ 1753, 1753, 1753, 1753, 1753, 1753, 2328, 2332, 1753, 1753, - /* 390 */ 1753, 1753, 1753, 1753, 1753, 2249, 1753, 1753, 1753, 2148, - /* 400 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 410 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 420 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 430 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 440 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 450 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 460 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 470 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 480 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 490 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 500 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 510 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 520 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1790, 2153, 1753, - /* 530 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 540 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 550 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 560 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 570 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1878, 1877, 1753, - /* 580 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 590 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 600 */ 1753, 2157, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 610 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 2324, 2282, - /* 620 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 630 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 2148, 1753, - /* 640 */ 2307, 1753, 1753, 2322, 1753, 2326, 1753, 1753, 1753, 1753, - /* 650 */ 1753, 1753, 1753, 2259, 2255, 1753, 1753, 2251, 1753, 1753, - /* 660 */ 1753, 1753, 1753, 1753, 1753, 2156, 1753, 1753, 1753, 1753, - /* 670 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 2147, - /* 680 */ 1753, 2210, 1753, 1753, 1753, 2244, 1753, 1753, 2195, 1753, - /* 690 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 2157, 1753, - /* 700 */ 2160, 1753, 1753, 1753, 1753, 1753, 1955, 1753, 1753, 1753, - /* 710 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1940, - /* 720 */ 1938, 1937, 1936, 1753, 1968, 1753, 1753, 1753, 1964, 1963, - /* 730 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 740 */ 1753, 1753, 1753, 1858, 1753, 1753, 1753, 1753, 1753, 1753, - /* 750 */ 1753, 1753, 1850, 1753, 1849, 1753, 1753, 1753, 1753, 1753, - /* 760 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 770 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, 1753, - /* 780 */ 1753, 1753, 1753, 1753, 1753, 1753, 1753, + /* 0 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 10 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 20 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 30 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 40 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 50 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 60 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 70 */ 1764, 1764, 1764, 1764, 2045, 1764, 1764, 1764, 1764, 1764, + /* 80 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1853, 1764, + /* 90 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 100 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1851, 2038, + /* 110 */ 2263, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 120 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 130 */ 1764, 1764, 1764, 1764, 2275, 1764, 1764, 1827, 1827, 1764, + /* 140 */ 2275, 2275, 2275, 1851, 2235, 2235, 1764, 1764, 1764, 1764, + /* 150 */ 1853, 2105, 1764, 1764, 1764, 1764, 1764, 1764, 1973, 1764, + /* 160 */ 1764, 1764, 1764, 1764, 1997, 1764, 1764, 1764, 2097, 1764, + /* 170 */ 1764, 2300, 2356, 1764, 1764, 2303, 1764, 1764, 1764, 1764, + /* 180 */ 1764, 2050, 1764, 1764, 1926, 2290, 2267, 2281, 2340, 2268, + /* 190 */ 2265, 2284, 1764, 2294, 1764, 1764, 2119, 1853, 1764, 1853, + /* 200 */ 2084, 2043, 1764, 2043, 2040, 1764, 1764, 2043, 2040, 2040, + /* 210 */ 1915, 1911, 1764, 1909, 1764, 1764, 1764, 1764, 1811, 1764, + /* 220 */ 1811, 1764, 1853, 1764, 1853, 1764, 1764, 1853, 1764, 1853, + /* 230 */ 1853, 1853, 1764, 1853, 1764, 1764, 1764, 1764, 1764, 1764, + /* 240 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 250 */ 1764, 2117, 2103, 1764, 1851, 2095, 2093, 1764, 1851, 2091, + /* 260 */ 1764, 1764, 1764, 1764, 2311, 2309, 1764, 2311, 2309, 1764, + /* 270 */ 1764, 1764, 2325, 2321, 2311, 2329, 2327, 2296, 2294, 2359, + /* 280 */ 2346, 2342, 2281, 1764, 1764, 1764, 1764, 1851, 1851, 1764, + /* 290 */ 2309, 1764, 1764, 1764, 1764, 1764, 2309, 1764, 1764, 1851, + /* 300 */ 1764, 1851, 1764, 1764, 1942, 1764, 1764, 1764, 1851, 1796, + /* 310 */ 1764, 2086, 2108, 2068, 2068, 1976, 1976, 1976, 1854, 1769, + /* 320 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 330 */ 1764, 1764, 2324, 2323, 2190, 1764, 2239, 2238, 2237, 2228, + /* 340 */ 2189, 1938, 1764, 2188, 2187, 1764, 1764, 1764, 1764, 1764, + /* 350 */ 1764, 1764, 1764, 1764, 2059, 2058, 2181, 1764, 1764, 2182, + /* 360 */ 2180, 2179, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 370 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 380 */ 1764, 1764, 1764, 1764, 1764, 1764, 2343, 2347, 1764, 1764, + /* 390 */ 1764, 1764, 1764, 1764, 1764, 2264, 1764, 1764, 1764, 2163, + /* 400 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 410 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 420 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 430 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 440 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 450 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 460 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 470 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 480 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 490 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 500 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 510 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 520 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1801, 2168, 1764, + /* 530 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 540 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 550 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 560 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 570 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1892, + /* 580 */ 1891, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 590 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 600 */ 1764, 1764, 1764, 2172, 1764, 1764, 1764, 1764, 1764, 1764, + /* 610 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 620 */ 2339, 2297, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 630 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 640 */ 2163, 1764, 2322, 1764, 1764, 2337, 1764, 2341, 1764, 1764, + /* 650 */ 1764, 1764, 1764, 1764, 1764, 2274, 2270, 1764, 1764, 2266, + /* 660 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 2171, 1764, 1764, + /* 670 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 680 */ 1764, 2162, 1764, 2225, 1764, 1764, 1764, 2259, 1764, 1764, + /* 690 */ 2210, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 700 */ 2172, 1764, 2175, 1764, 1764, 1764, 1764, 1764, 1970, 1764, + /* 710 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 720 */ 1764, 1764, 1764, 1764, 1954, 1952, 1951, 1950, 1764, 1983, + /* 730 */ 1764, 1764, 1764, 1979, 1978, 1764, 1764, 1764, 1764, 1764, + /* 740 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1872, 1764, + /* 750 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1864, 1764, 1863, + /* 760 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 770 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 780 */ 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, 1764, + /* 790 */ 1764, 1764, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1130,6 +1078,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* RESTORE => nothing */ 0, /* NK_IPTOKEN => nothing */ 0, /* FORCE => nothing */ + 0, /* UNSAFE => nothing */ 0, /* LOCAL => nothing */ 0, /* QNODE => nothing */ 0, /* BNODE => nothing */ @@ -1175,7 +1124,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* MAX_SPEED => nothing */ 0, /* START => nothing */ 0, /* TIMESTAMP => nothing */ - 284, /* END => ABORT */ + 286, /* END => ABORT */ 0, /* TABLE => nothing */ 0, /* NK_LP => nothing */ 0, /* NK_RP => nothing */ @@ -1205,6 +1154,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* MEDIUMBLOB => nothing */ 0, /* BLOB => nothing */ 0, /* VARBINARY => nothing */ + 0, /* GEOMETRY => nothing */ 0, /* DECIMAL => nothing */ 0, /* COMMENT => nothing */ 0, /* MAX_DELAY => nothing */ @@ -1360,56 +1310,56 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASC => nothing */ 0, /* NULLS => nothing */ 0, /* ABORT => nothing */ - 284, /* AFTER => ABORT */ - 284, /* ATTACH => ABORT */ - 284, /* BEFORE => ABORT */ - 284, /* BEGIN => ABORT */ - 284, /* BITAND => ABORT */ - 284, /* BITNOT => ABORT */ - 284, /* BITOR => ABORT */ - 284, /* BLOCKS => ABORT */ - 284, /* CHANGE => ABORT */ - 284, /* COMMA => ABORT */ - 284, /* CONCAT => ABORT */ - 284, /* CONFLICT => ABORT */ - 284, /* COPY => ABORT */ - 284, /* DEFERRED => ABORT */ - 284, /* DELIMITERS => ABORT */ - 284, /* DETACH => ABORT */ - 284, /* DIVIDE => ABORT */ - 284, /* DOT => ABORT */ - 284, /* EACH => ABORT */ - 284, /* FAIL => ABORT */ - 284, /* FILE => ABORT */ - 284, /* FOR => ABORT */ - 284, /* GLOB => ABORT */ - 284, /* ID => ABORT */ - 284, /* IMMEDIATE => ABORT */ - 284, /* IMPORT => ABORT */ - 284, /* INITIALLY => ABORT */ - 284, /* INSTEAD => ABORT */ - 284, /* ISNULL => ABORT */ - 284, /* KEY => ABORT */ - 284, /* MODULES => ABORT */ - 284, /* NK_BITNOT => ABORT */ - 284, /* NK_SEMI => ABORT */ - 284, /* NOTNULL => ABORT */ - 284, /* OF => ABORT */ - 284, /* PLUS => ABORT */ - 284, /* PRIVILEGE => ABORT */ - 284, /* RAISE => ABORT */ - 284, /* RESTRICT => ABORT */ - 284, /* ROW => ABORT */ - 284, /* SEMI => ABORT */ - 284, /* STAR => ABORT */ - 284, /* STATEMENT => ABORT */ - 284, /* STRICT => ABORT */ - 284, /* STRING => ABORT */ - 284, /* TIMES => ABORT */ - 284, /* VALUES => ABORT */ - 284, /* VARIABLE => ABORT */ - 284, /* VIEW => ABORT */ - 284, /* WAL => ABORT */ + 286, /* AFTER => ABORT */ + 286, /* ATTACH => ABORT */ + 286, /* BEFORE => ABORT */ + 286, /* BEGIN => ABORT */ + 286, /* BITAND => ABORT */ + 286, /* BITNOT => ABORT */ + 286, /* BITOR => ABORT */ + 286, /* BLOCKS => ABORT */ + 286, /* CHANGE => ABORT */ + 286, /* COMMA => ABORT */ + 286, /* CONCAT => ABORT */ + 286, /* CONFLICT => ABORT */ + 286, /* COPY => ABORT */ + 286, /* DEFERRED => ABORT */ + 286, /* DELIMITERS => ABORT */ + 286, /* DETACH => ABORT */ + 286, /* DIVIDE => ABORT */ + 286, /* DOT => ABORT */ + 286, /* EACH => ABORT */ + 286, /* FAIL => ABORT */ + 286, /* FILE => ABORT */ + 286, /* FOR => ABORT */ + 286, /* GLOB => ABORT */ + 286, /* ID => ABORT */ + 286, /* IMMEDIATE => ABORT */ + 286, /* IMPORT => ABORT */ + 286, /* INITIALLY => ABORT */ + 286, /* INSTEAD => ABORT */ + 286, /* ISNULL => ABORT */ + 286, /* KEY => ABORT */ + 286, /* MODULES => ABORT */ + 286, /* NK_BITNOT => ABORT */ + 286, /* NK_SEMI => ABORT */ + 286, /* NOTNULL => ABORT */ + 286, /* OF => ABORT */ + 286, /* PLUS => ABORT */ + 286, /* PRIVILEGE => ABORT */ + 286, /* RAISE => ABORT */ + 286, /* RESTRICT => ABORT */ + 286, /* ROW => ABORT */ + 286, /* SEMI => ABORT */ + 286, /* STAR => ABORT */ + 286, /* STATEMENT => ABORT */ + 286, /* STRICT => ABORT */ + 286, /* STRING => ABORT */ + 286, /* TIMES => ABORT */ + 286, /* VALUES => ABORT */ + 286, /* VARIABLE => ABORT */ + 286, /* VIEW => ABORT */ + 286, /* WAL => ABORT */ }; #endif /* YYFALLBACK */ @@ -1552,433 +1502,436 @@ static const char *const yyTokenName[] = { /* 52 */ "RESTORE", /* 53 */ "NK_IPTOKEN", /* 54 */ "FORCE", - /* 55 */ "LOCAL", - /* 56 */ "QNODE", - /* 57 */ "BNODE", - /* 58 */ "SNODE", - /* 59 */ "MNODE", - /* 60 */ "VNODE", - /* 61 */ "DATABASE", - /* 62 */ "USE", - /* 63 */ "FLUSH", - /* 64 */ "TRIM", - /* 65 */ "COMPACT", - /* 66 */ "IF", - /* 67 */ "NOT", - /* 68 */ "EXISTS", - /* 69 */ "BUFFER", - /* 70 */ "CACHEMODEL", - /* 71 */ "CACHESIZE", - /* 72 */ "COMP", - /* 73 */ "DURATION", - /* 74 */ "NK_VARIABLE", - /* 75 */ "MAXROWS", - /* 76 */ "MINROWS", - /* 77 */ "KEEP", - /* 78 */ "PAGES", - /* 79 */ "PAGESIZE", - /* 80 */ "TSDB_PAGESIZE", - /* 81 */ "PRECISION", - /* 82 */ "REPLICA", - /* 83 */ "VGROUPS", - /* 84 */ "SINGLE_STABLE", - /* 85 */ "RETENTIONS", - /* 86 */ "SCHEMALESS", - /* 87 */ "WAL_LEVEL", - /* 88 */ "WAL_FSYNC_PERIOD", - /* 89 */ "WAL_RETENTION_PERIOD", - /* 90 */ "WAL_RETENTION_SIZE", - /* 91 */ "WAL_ROLL_PERIOD", - /* 92 */ "WAL_SEGMENT_SIZE", - /* 93 */ "STT_TRIGGER", - /* 94 */ "TABLE_PREFIX", - /* 95 */ "TABLE_SUFFIX", - /* 96 */ "NK_COLON", - /* 97 */ "MAX_SPEED", - /* 98 */ "START", - /* 99 */ "TIMESTAMP", - /* 100 */ "END", - /* 101 */ "TABLE", - /* 102 */ "NK_LP", - /* 103 */ "NK_RP", - /* 104 */ "STABLE", - /* 105 */ "ADD", - /* 106 */ "COLUMN", - /* 107 */ "MODIFY", - /* 108 */ "RENAME", - /* 109 */ "TAG", - /* 110 */ "SET", - /* 111 */ "NK_EQ", - /* 112 */ "USING", - /* 113 */ "TAGS", - /* 114 */ "BOOL", - /* 115 */ "TINYINT", - /* 116 */ "SMALLINT", - /* 117 */ "INT", - /* 118 */ "INTEGER", - /* 119 */ "BIGINT", - /* 120 */ "FLOAT", - /* 121 */ "DOUBLE", - /* 122 */ "BINARY", - /* 123 */ "NCHAR", - /* 124 */ "UNSIGNED", - /* 125 */ "JSON", - /* 126 */ "VARCHAR", - /* 127 */ "MEDIUMBLOB", - /* 128 */ "BLOB", - /* 129 */ "VARBINARY", - /* 130 */ "DECIMAL", - /* 131 */ "COMMENT", - /* 132 */ "MAX_DELAY", - /* 133 */ "WATERMARK", - /* 134 */ "ROLLUP", - /* 135 */ "TTL", - /* 136 */ "SMA", - /* 137 */ "DELETE_MARK", - /* 138 */ "FIRST", - /* 139 */ "LAST", - /* 140 */ "SHOW", - /* 141 */ "PRIVILEGES", - /* 142 */ "DATABASES", - /* 143 */ "TABLES", - /* 144 */ "STABLES", - /* 145 */ "MNODES", - /* 146 */ "QNODES", - /* 147 */ "FUNCTIONS", - /* 148 */ "INDEXES", - /* 149 */ "ACCOUNTS", - /* 150 */ "APPS", - /* 151 */ "CONNECTIONS", - /* 152 */ "LICENCES", - /* 153 */ "GRANTS", - /* 154 */ "QUERIES", - /* 155 */ "SCORES", - /* 156 */ "TOPICS", - /* 157 */ "VARIABLES", - /* 158 */ "CLUSTER", - /* 159 */ "BNODES", - /* 160 */ "SNODES", - /* 161 */ "TRANSACTIONS", - /* 162 */ "DISTRIBUTED", - /* 163 */ "CONSUMERS", - /* 164 */ "SUBSCRIPTIONS", - /* 165 */ "VNODES", - /* 166 */ "ALIVE", - /* 167 */ "LIKE", - /* 168 */ "TBNAME", - /* 169 */ "QTAGS", - /* 170 */ "AS", - /* 171 */ "INDEX", - /* 172 */ "FUNCTION", - /* 173 */ "INTERVAL", - /* 174 */ "COUNT", - /* 175 */ "LAST_ROW", - /* 176 */ "TOPIC", - /* 177 */ "META", - /* 178 */ "CONSUMER", - /* 179 */ "GROUP", - /* 180 */ "DESC", - /* 181 */ "DESCRIBE", - /* 182 */ "RESET", - /* 183 */ "QUERY", - /* 184 */ "CACHE", - /* 185 */ "EXPLAIN", - /* 186 */ "ANALYZE", - /* 187 */ "VERBOSE", - /* 188 */ "NK_BOOL", - /* 189 */ "RATIO", - /* 190 */ "NK_FLOAT", - /* 191 */ "OUTPUTTYPE", - /* 192 */ "AGGREGATE", - /* 193 */ "BUFSIZE", - /* 194 */ "LANGUAGE", - /* 195 */ "REPLACE", - /* 196 */ "STREAM", - /* 197 */ "INTO", - /* 198 */ "PAUSE", - /* 199 */ "RESUME", - /* 200 */ "TRIGGER", - /* 201 */ "AT_ONCE", - /* 202 */ "WINDOW_CLOSE", - /* 203 */ "IGNORE", - /* 204 */ "EXPIRED", - /* 205 */ "FILL_HISTORY", - /* 206 */ "UPDATE", - /* 207 */ "SUBTABLE", - /* 208 */ "UNTREATED", - /* 209 */ "KILL", - /* 210 */ "CONNECTION", - /* 211 */ "TRANSACTION", - /* 212 */ "BALANCE", - /* 213 */ "VGROUP", - /* 214 */ "LEADER", - /* 215 */ "MERGE", - /* 216 */ "REDISTRIBUTE", - /* 217 */ "SPLIT", - /* 218 */ "DELETE", - /* 219 */ "INSERT", - /* 220 */ "NULL", - /* 221 */ "NK_QUESTION", - /* 222 */ "NK_ARROW", - /* 223 */ "ROWTS", - /* 224 */ "QSTART", - /* 225 */ "QEND", - /* 226 */ "QDURATION", - /* 227 */ "WSTART", - /* 228 */ "WEND", - /* 229 */ "WDURATION", - /* 230 */ "IROWTS", - /* 231 */ "ISFILLED", - /* 232 */ "CAST", - /* 233 */ "NOW", - /* 234 */ "TODAY", - /* 235 */ "TIMEZONE", - /* 236 */ "CLIENT_VERSION", - /* 237 */ "SERVER_VERSION", - /* 238 */ "SERVER_STATUS", - /* 239 */ "CURRENT_USER", - /* 240 */ "CASE", - /* 241 */ "WHEN", - /* 242 */ "THEN", - /* 243 */ "ELSE", - /* 244 */ "BETWEEN", - /* 245 */ "IS", - /* 246 */ "NK_LT", - /* 247 */ "NK_GT", - /* 248 */ "NK_LE", - /* 249 */ "NK_GE", - /* 250 */ "NK_NE", - /* 251 */ "MATCH", - /* 252 */ "NMATCH", - /* 253 */ "CONTAINS", - /* 254 */ "IN", - /* 255 */ "JOIN", - /* 256 */ "INNER", - /* 257 */ "SELECT", - /* 258 */ "DISTINCT", - /* 259 */ "WHERE", - /* 260 */ "PARTITION", - /* 261 */ "BY", - /* 262 */ "SESSION", - /* 263 */ "STATE_WINDOW", - /* 264 */ "EVENT_WINDOW", - /* 265 */ "SLIDING", - /* 266 */ "FILL", - /* 267 */ "VALUE", - /* 268 */ "VALUE_F", - /* 269 */ "NONE", - /* 270 */ "PREV", - /* 271 */ "NULL_F", - /* 272 */ "LINEAR", - /* 273 */ "NEXT", - /* 274 */ "HAVING", - /* 275 */ "RANGE", - /* 276 */ "EVERY", - /* 277 */ "ORDER", - /* 278 */ "SLIMIT", - /* 279 */ "SOFFSET", - /* 280 */ "LIMIT", - /* 281 */ "OFFSET", - /* 282 */ "ASC", - /* 283 */ "NULLS", - /* 284 */ "ABORT", - /* 285 */ "AFTER", - /* 286 */ "ATTACH", - /* 287 */ "BEFORE", - /* 288 */ "BEGIN", - /* 289 */ "BITAND", - /* 290 */ "BITNOT", - /* 291 */ "BITOR", - /* 292 */ "BLOCKS", - /* 293 */ "CHANGE", - /* 294 */ "COMMA", - /* 295 */ "CONCAT", - /* 296 */ "CONFLICT", - /* 297 */ "COPY", - /* 298 */ "DEFERRED", - /* 299 */ "DELIMITERS", - /* 300 */ "DETACH", - /* 301 */ "DIVIDE", - /* 302 */ "DOT", - /* 303 */ "EACH", - /* 304 */ "FAIL", - /* 305 */ "FILE", - /* 306 */ "FOR", - /* 307 */ "GLOB", - /* 308 */ "ID", - /* 309 */ "IMMEDIATE", - /* 310 */ "IMPORT", - /* 311 */ "INITIALLY", - /* 312 */ "INSTEAD", - /* 313 */ "ISNULL", - /* 314 */ "KEY", - /* 315 */ "MODULES", - /* 316 */ "NK_BITNOT", - /* 317 */ "NK_SEMI", - /* 318 */ "NOTNULL", - /* 319 */ "OF", - /* 320 */ "PLUS", - /* 321 */ "PRIVILEGE", - /* 322 */ "RAISE", - /* 323 */ "RESTRICT", - /* 324 */ "ROW", - /* 325 */ "SEMI", - /* 326 */ "STAR", - /* 327 */ "STATEMENT", - /* 328 */ "STRICT", - /* 329 */ "STRING", - /* 330 */ "TIMES", - /* 331 */ "VALUES", - /* 332 */ "VARIABLE", - /* 333 */ "VIEW", - /* 334 */ "WAL", - /* 335 */ "cmd", - /* 336 */ "account_options", - /* 337 */ "alter_account_options", - /* 338 */ "literal", - /* 339 */ "alter_account_option", - /* 340 */ "user_name", - /* 341 */ "sysinfo_opt", - /* 342 */ "privileges", - /* 343 */ "priv_level", - /* 344 */ "with_opt", - /* 345 */ "priv_type_list", - /* 346 */ "priv_type", - /* 347 */ "db_name", - /* 348 */ "table_name", - /* 349 */ "topic_name", - /* 350 */ "search_condition", - /* 351 */ "dnode_endpoint", - /* 352 */ "force_opt", - /* 353 */ "not_exists_opt", - /* 354 */ "db_options", - /* 355 */ "exists_opt", - /* 356 */ "alter_db_options", - /* 357 */ "speed_opt", - /* 358 */ "start_opt", - /* 359 */ "end_opt", - /* 360 */ "integer_list", - /* 361 */ "variable_list", - /* 362 */ "retention_list", - /* 363 */ "signed", - /* 364 */ "alter_db_option", - /* 365 */ "retention", - /* 366 */ "full_table_name", - /* 367 */ "column_def_list", - /* 368 */ "tags_def_opt", - /* 369 */ "table_options", - /* 370 */ "multi_create_clause", - /* 371 */ "tags_def", - /* 372 */ "multi_drop_clause", - /* 373 */ "alter_table_clause", - /* 374 */ "alter_table_options", - /* 375 */ "column_name", - /* 376 */ "type_name", - /* 377 */ "signed_literal", - /* 378 */ "create_subtable_clause", - /* 379 */ "specific_cols_opt", - /* 380 */ "expression_list", - /* 381 */ "drop_table_clause", - /* 382 */ "col_name_list", - /* 383 */ "column_def", - /* 384 */ "duration_list", - /* 385 */ "rollup_func_list", - /* 386 */ "alter_table_option", - /* 387 */ "duration_literal", - /* 388 */ "rollup_func_name", - /* 389 */ "function_name", - /* 390 */ "col_name", - /* 391 */ "db_name_cond_opt", - /* 392 */ "like_pattern_opt", - /* 393 */ "table_name_cond", - /* 394 */ "from_db_opt", - /* 395 */ "tag_list_opt", - /* 396 */ "tag_item", - /* 397 */ "column_alias", - /* 398 */ "full_index_name", - /* 399 */ "index_options", - /* 400 */ "index_name", - /* 401 */ "func_list", - /* 402 */ "sliding_opt", - /* 403 */ "sma_stream_opt", - /* 404 */ "func", - /* 405 */ "sma_func_name", - /* 406 */ "query_or_subquery", - /* 407 */ "cgroup_name", - /* 408 */ "analyze_opt", - /* 409 */ "explain_options", - /* 410 */ "insert_query", - /* 411 */ "or_replace_opt", - /* 412 */ "agg_func_opt", - /* 413 */ "bufsize_opt", - /* 414 */ "language_opt", - /* 415 */ "stream_name", - /* 416 */ "stream_options", - /* 417 */ "col_list_opt", - /* 418 */ "tag_def_or_ref_opt", - /* 419 */ "subtable_opt", - /* 420 */ "ignore_opt", - /* 421 */ "expression", - /* 422 */ "dnode_list", - /* 423 */ "where_clause_opt", - /* 424 */ "literal_func", - /* 425 */ "literal_list", - /* 426 */ "table_alias", - /* 427 */ "expr_or_subquery", - /* 428 */ "pseudo_column", - /* 429 */ "column_reference", - /* 430 */ "function_expression", - /* 431 */ "case_when_expression", - /* 432 */ "star_func", - /* 433 */ "star_func_para_list", - /* 434 */ "noarg_func", - /* 435 */ "other_para_list", - /* 436 */ "star_func_para", - /* 437 */ "when_then_list", - /* 438 */ "case_when_else_opt", - /* 439 */ "common_expression", - /* 440 */ "when_then_expr", - /* 441 */ "predicate", - /* 442 */ "compare_op", - /* 443 */ "in_op", - /* 444 */ "in_predicate_value", - /* 445 */ "boolean_value_expression", - /* 446 */ "boolean_primary", - /* 447 */ "from_clause_opt", - /* 448 */ "table_reference_list", - /* 449 */ "table_reference", - /* 450 */ "table_primary", - /* 451 */ "joined_table", - /* 452 */ "alias_opt", - /* 453 */ "subquery", - /* 454 */ "parenthesized_joined_table", - /* 455 */ "join_type", - /* 456 */ "query_specification", - /* 457 */ "set_quantifier_opt", - /* 458 */ "select_list", - /* 459 */ "partition_by_clause_opt", - /* 460 */ "range_opt", - /* 461 */ "every_opt", - /* 462 */ "fill_opt", - /* 463 */ "twindow_clause_opt", - /* 464 */ "group_by_clause_opt", - /* 465 */ "having_clause_opt", - /* 466 */ "select_item", - /* 467 */ "partition_list", - /* 468 */ "partition_item", - /* 469 */ "fill_mode", - /* 470 */ "group_by_list", - /* 471 */ "query_expression", - /* 472 */ "query_simple", - /* 473 */ "order_by_clause_opt", - /* 474 */ "slimit_clause_opt", - /* 475 */ "limit_clause_opt", - /* 476 */ "union_query_expression", - /* 477 */ "query_simple_or_subquery", - /* 478 */ "sort_specification_list", - /* 479 */ "sort_specification", - /* 480 */ "ordering_specification_opt", - /* 481 */ "null_ordering_opt", + /* 55 */ "UNSAFE", + /* 56 */ "LOCAL", + /* 57 */ "QNODE", + /* 58 */ "BNODE", + /* 59 */ "SNODE", + /* 60 */ "MNODE", + /* 61 */ "VNODE", + /* 62 */ "DATABASE", + /* 63 */ "USE", + /* 64 */ "FLUSH", + /* 65 */ "TRIM", + /* 66 */ "COMPACT", + /* 67 */ "IF", + /* 68 */ "NOT", + /* 69 */ "EXISTS", + /* 70 */ "BUFFER", + /* 71 */ "CACHEMODEL", + /* 72 */ "CACHESIZE", + /* 73 */ "COMP", + /* 74 */ "DURATION", + /* 75 */ "NK_VARIABLE", + /* 76 */ "MAXROWS", + /* 77 */ "MINROWS", + /* 78 */ "KEEP", + /* 79 */ "PAGES", + /* 80 */ "PAGESIZE", + /* 81 */ "TSDB_PAGESIZE", + /* 82 */ "PRECISION", + /* 83 */ "REPLICA", + /* 84 */ "VGROUPS", + /* 85 */ "SINGLE_STABLE", + /* 86 */ "RETENTIONS", + /* 87 */ "SCHEMALESS", + /* 88 */ "WAL_LEVEL", + /* 89 */ "WAL_FSYNC_PERIOD", + /* 90 */ "WAL_RETENTION_PERIOD", + /* 91 */ "WAL_RETENTION_SIZE", + /* 92 */ "WAL_ROLL_PERIOD", + /* 93 */ "WAL_SEGMENT_SIZE", + /* 94 */ "STT_TRIGGER", + /* 95 */ "TABLE_PREFIX", + /* 96 */ "TABLE_SUFFIX", + /* 97 */ "NK_COLON", + /* 98 */ "MAX_SPEED", + /* 99 */ "START", + /* 100 */ "TIMESTAMP", + /* 101 */ "END", + /* 102 */ "TABLE", + /* 103 */ "NK_LP", + /* 104 */ "NK_RP", + /* 105 */ "STABLE", + /* 106 */ "ADD", + /* 107 */ "COLUMN", + /* 108 */ "MODIFY", + /* 109 */ "RENAME", + /* 110 */ "TAG", + /* 111 */ "SET", + /* 112 */ "NK_EQ", + /* 113 */ "USING", + /* 114 */ "TAGS", + /* 115 */ "BOOL", + /* 116 */ "TINYINT", + /* 117 */ "SMALLINT", + /* 118 */ "INT", + /* 119 */ "INTEGER", + /* 120 */ "BIGINT", + /* 121 */ "FLOAT", + /* 122 */ "DOUBLE", + /* 123 */ "BINARY", + /* 124 */ "NCHAR", + /* 125 */ "UNSIGNED", + /* 126 */ "JSON", + /* 127 */ "VARCHAR", + /* 128 */ "MEDIUMBLOB", + /* 129 */ "BLOB", + /* 130 */ "VARBINARY", + /* 131 */ "GEOMETRY", + /* 132 */ "DECIMAL", + /* 133 */ "COMMENT", + /* 134 */ "MAX_DELAY", + /* 135 */ "WATERMARK", + /* 136 */ "ROLLUP", + /* 137 */ "TTL", + /* 138 */ "SMA", + /* 139 */ "DELETE_MARK", + /* 140 */ "FIRST", + /* 141 */ "LAST", + /* 142 */ "SHOW", + /* 143 */ "PRIVILEGES", + /* 144 */ "DATABASES", + /* 145 */ "TABLES", + /* 146 */ "STABLES", + /* 147 */ "MNODES", + /* 148 */ "QNODES", + /* 149 */ "FUNCTIONS", + /* 150 */ "INDEXES", + /* 151 */ "ACCOUNTS", + /* 152 */ "APPS", + /* 153 */ "CONNECTIONS", + /* 154 */ "LICENCES", + /* 155 */ "GRANTS", + /* 156 */ "QUERIES", + /* 157 */ "SCORES", + /* 158 */ "TOPICS", + /* 159 */ "VARIABLES", + /* 160 */ "CLUSTER", + /* 161 */ "BNODES", + /* 162 */ "SNODES", + /* 163 */ "TRANSACTIONS", + /* 164 */ "DISTRIBUTED", + /* 165 */ "CONSUMERS", + /* 166 */ "SUBSCRIPTIONS", + /* 167 */ "VNODES", + /* 168 */ "ALIVE", + /* 169 */ "LIKE", + /* 170 */ "TBNAME", + /* 171 */ "QTAGS", + /* 172 */ "AS", + /* 173 */ "INDEX", + /* 174 */ "FUNCTION", + /* 175 */ "INTERVAL", + /* 176 */ "COUNT", + /* 177 */ "LAST_ROW", + /* 178 */ "TOPIC", + /* 179 */ "META", + /* 180 */ "CONSUMER", + /* 181 */ "GROUP", + /* 182 */ "DESC", + /* 183 */ "DESCRIBE", + /* 184 */ "RESET", + /* 185 */ "QUERY", + /* 186 */ "CACHE", + /* 187 */ "EXPLAIN", + /* 188 */ "ANALYZE", + /* 189 */ "VERBOSE", + /* 190 */ "NK_BOOL", + /* 191 */ "RATIO", + /* 192 */ "NK_FLOAT", + /* 193 */ "OUTPUTTYPE", + /* 194 */ "AGGREGATE", + /* 195 */ "BUFSIZE", + /* 196 */ "LANGUAGE", + /* 197 */ "REPLACE", + /* 198 */ "STREAM", + /* 199 */ "INTO", + /* 200 */ "PAUSE", + /* 201 */ "RESUME", + /* 202 */ "TRIGGER", + /* 203 */ "AT_ONCE", + /* 204 */ "WINDOW_CLOSE", + /* 205 */ "IGNORE", + /* 206 */ "EXPIRED", + /* 207 */ "FILL_HISTORY", + /* 208 */ "UPDATE", + /* 209 */ "SUBTABLE", + /* 210 */ "UNTREATED", + /* 211 */ "KILL", + /* 212 */ "CONNECTION", + /* 213 */ "TRANSACTION", + /* 214 */ "BALANCE", + /* 215 */ "VGROUP", + /* 216 */ "LEADER", + /* 217 */ "MERGE", + /* 218 */ "REDISTRIBUTE", + /* 219 */ "SPLIT", + /* 220 */ "DELETE", + /* 221 */ "INSERT", + /* 222 */ "NULL", + /* 223 */ "NK_QUESTION", + /* 224 */ "NK_ARROW", + /* 225 */ "ROWTS", + /* 226 */ "QSTART", + /* 227 */ "QEND", + /* 228 */ "QDURATION", + /* 229 */ "WSTART", + /* 230 */ "WEND", + /* 231 */ "WDURATION", + /* 232 */ "IROWTS", + /* 233 */ "ISFILLED", + /* 234 */ "CAST", + /* 235 */ "NOW", + /* 236 */ "TODAY", + /* 237 */ "TIMEZONE", + /* 238 */ "CLIENT_VERSION", + /* 239 */ "SERVER_VERSION", + /* 240 */ "SERVER_STATUS", + /* 241 */ "CURRENT_USER", + /* 242 */ "CASE", + /* 243 */ "WHEN", + /* 244 */ "THEN", + /* 245 */ "ELSE", + /* 246 */ "BETWEEN", + /* 247 */ "IS", + /* 248 */ "NK_LT", + /* 249 */ "NK_GT", + /* 250 */ "NK_LE", + /* 251 */ "NK_GE", + /* 252 */ "NK_NE", + /* 253 */ "MATCH", + /* 254 */ "NMATCH", + /* 255 */ "CONTAINS", + /* 256 */ "IN", + /* 257 */ "JOIN", + /* 258 */ "INNER", + /* 259 */ "SELECT", + /* 260 */ "DISTINCT", + /* 261 */ "WHERE", + /* 262 */ "PARTITION", + /* 263 */ "BY", + /* 264 */ "SESSION", + /* 265 */ "STATE_WINDOW", + /* 266 */ "EVENT_WINDOW", + /* 267 */ "SLIDING", + /* 268 */ "FILL", + /* 269 */ "VALUE", + /* 270 */ "VALUE_F", + /* 271 */ "NONE", + /* 272 */ "PREV", + /* 273 */ "NULL_F", + /* 274 */ "LINEAR", + /* 275 */ "NEXT", + /* 276 */ "HAVING", + /* 277 */ "RANGE", + /* 278 */ "EVERY", + /* 279 */ "ORDER", + /* 280 */ "SLIMIT", + /* 281 */ "SOFFSET", + /* 282 */ "LIMIT", + /* 283 */ "OFFSET", + /* 284 */ "ASC", + /* 285 */ "NULLS", + /* 286 */ "ABORT", + /* 287 */ "AFTER", + /* 288 */ "ATTACH", + /* 289 */ "BEFORE", + /* 290 */ "BEGIN", + /* 291 */ "BITAND", + /* 292 */ "BITNOT", + /* 293 */ "BITOR", + /* 294 */ "BLOCKS", + /* 295 */ "CHANGE", + /* 296 */ "COMMA", + /* 297 */ "CONCAT", + /* 298 */ "CONFLICT", + /* 299 */ "COPY", + /* 300 */ "DEFERRED", + /* 301 */ "DELIMITERS", + /* 302 */ "DETACH", + /* 303 */ "DIVIDE", + /* 304 */ "DOT", + /* 305 */ "EACH", + /* 306 */ "FAIL", + /* 307 */ "FILE", + /* 308 */ "FOR", + /* 309 */ "GLOB", + /* 310 */ "ID", + /* 311 */ "IMMEDIATE", + /* 312 */ "IMPORT", + /* 313 */ "INITIALLY", + /* 314 */ "INSTEAD", + /* 315 */ "ISNULL", + /* 316 */ "KEY", + /* 317 */ "MODULES", + /* 318 */ "NK_BITNOT", + /* 319 */ "NK_SEMI", + /* 320 */ "NOTNULL", + /* 321 */ "OF", + /* 322 */ "PLUS", + /* 323 */ "PRIVILEGE", + /* 324 */ "RAISE", + /* 325 */ "RESTRICT", + /* 326 */ "ROW", + /* 327 */ "SEMI", + /* 328 */ "STAR", + /* 329 */ "STATEMENT", + /* 330 */ "STRICT", + /* 331 */ "STRING", + /* 332 */ "TIMES", + /* 333 */ "VALUES", + /* 334 */ "VARIABLE", + /* 335 */ "VIEW", + /* 336 */ "WAL", + /* 337 */ "cmd", + /* 338 */ "account_options", + /* 339 */ "alter_account_options", + /* 340 */ "literal", + /* 341 */ "alter_account_option", + /* 342 */ "user_name", + /* 343 */ "sysinfo_opt", + /* 344 */ "privileges", + /* 345 */ "priv_level", + /* 346 */ "with_opt", + /* 347 */ "priv_type_list", + /* 348 */ "priv_type", + /* 349 */ "db_name", + /* 350 */ "table_name", + /* 351 */ "topic_name", + /* 352 */ "search_condition", + /* 353 */ "dnode_endpoint", + /* 354 */ "force_opt", + /* 355 */ "unsafe_opt", + /* 356 */ "not_exists_opt", + /* 357 */ "db_options", + /* 358 */ "exists_opt", + /* 359 */ "alter_db_options", + /* 360 */ "speed_opt", + /* 361 */ "start_opt", + /* 362 */ "end_opt", + /* 363 */ "integer_list", + /* 364 */ "variable_list", + /* 365 */ "retention_list", + /* 366 */ "signed", + /* 367 */ "alter_db_option", + /* 368 */ "retention", + /* 369 */ "full_table_name", + /* 370 */ "column_def_list", + /* 371 */ "tags_def_opt", + /* 372 */ "table_options", + /* 373 */ "multi_create_clause", + /* 374 */ "tags_def", + /* 375 */ "multi_drop_clause", + /* 376 */ "alter_table_clause", + /* 377 */ "alter_table_options", + /* 378 */ "column_name", + /* 379 */ "type_name", + /* 380 */ "signed_literal", + /* 381 */ "create_subtable_clause", + /* 382 */ "specific_cols_opt", + /* 383 */ "expression_list", + /* 384 */ "drop_table_clause", + /* 385 */ "col_name_list", + /* 386 */ "column_def", + /* 387 */ "duration_list", + /* 388 */ "rollup_func_list", + /* 389 */ "alter_table_option", + /* 390 */ "duration_literal", + /* 391 */ "rollup_func_name", + /* 392 */ "function_name", + /* 393 */ "col_name", + /* 394 */ "db_name_cond_opt", + /* 395 */ "like_pattern_opt", + /* 396 */ "table_name_cond", + /* 397 */ "from_db_opt", + /* 398 */ "tag_list_opt", + /* 399 */ "tag_item", + /* 400 */ "column_alias", + /* 401 */ "full_index_name", + /* 402 */ "index_options", + /* 403 */ "index_name", + /* 404 */ "func_list", + /* 405 */ "sliding_opt", + /* 406 */ "sma_stream_opt", + /* 407 */ "func", + /* 408 */ "sma_func_name", + /* 409 */ "query_or_subquery", + /* 410 */ "cgroup_name", + /* 411 */ "analyze_opt", + /* 412 */ "explain_options", + /* 413 */ "insert_query", + /* 414 */ "or_replace_opt", + /* 415 */ "agg_func_opt", + /* 416 */ "bufsize_opt", + /* 417 */ "language_opt", + /* 418 */ "stream_name", + /* 419 */ "stream_options", + /* 420 */ "col_list_opt", + /* 421 */ "tag_def_or_ref_opt", + /* 422 */ "subtable_opt", + /* 423 */ "ignore_opt", + /* 424 */ "expression", + /* 425 */ "dnode_list", + /* 426 */ "where_clause_opt", + /* 427 */ "literal_func", + /* 428 */ "literal_list", + /* 429 */ "table_alias", + /* 430 */ "expr_or_subquery", + /* 431 */ "pseudo_column", + /* 432 */ "column_reference", + /* 433 */ "function_expression", + /* 434 */ "case_when_expression", + /* 435 */ "star_func", + /* 436 */ "star_func_para_list", + /* 437 */ "noarg_func", + /* 438 */ "other_para_list", + /* 439 */ "star_func_para", + /* 440 */ "when_then_list", + /* 441 */ "case_when_else_opt", + /* 442 */ "common_expression", + /* 443 */ "when_then_expr", + /* 444 */ "predicate", + /* 445 */ "compare_op", + /* 446 */ "in_op", + /* 447 */ "in_predicate_value", + /* 448 */ "boolean_value_expression", + /* 449 */ "boolean_primary", + /* 450 */ "from_clause_opt", + /* 451 */ "table_reference_list", + /* 452 */ "table_reference", + /* 453 */ "table_primary", + /* 454 */ "joined_table", + /* 455 */ "alias_opt", + /* 456 */ "subquery", + /* 457 */ "parenthesized_joined_table", + /* 458 */ "join_type", + /* 459 */ "query_specification", + /* 460 */ "set_quantifier_opt", + /* 461 */ "select_list", + /* 462 */ "partition_by_clause_opt", + /* 463 */ "range_opt", + /* 464 */ "every_opt", + /* 465 */ "fill_opt", + /* 466 */ "twindow_clause_opt", + /* 467 */ "group_by_clause_opt", + /* 468 */ "having_clause_opt", + /* 469 */ "select_item", + /* 470 */ "partition_list", + /* 471 */ "partition_item", + /* 472 */ "fill_mode", + /* 473 */ "group_by_list", + /* 474 */ "query_expression", + /* 475 */ "query_simple", + /* 476 */ "order_by_clause_opt", + /* 477 */ "slimit_clause_opt", + /* 478 */ "limit_clause_opt", + /* 479 */ "union_query_expression", + /* 480 */ "query_simple_or_subquery", + /* 481 */ "sort_specification_list", + /* 482 */ "sort_specification", + /* 483 */ "ordering_specification_opt", + /* 484 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -2036,547 +1989,551 @@ static const char *const yyRuleName[] = { /* 47 */ "cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER", /* 48 */ "cmd ::= DROP DNODE NK_INTEGER force_opt", /* 49 */ "cmd ::= DROP DNODE dnode_endpoint force_opt", - /* 50 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING", - /* 51 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING", - /* 52 */ "cmd ::= ALTER ALL DNODES NK_STRING", - /* 53 */ "cmd ::= ALTER ALL DNODES NK_STRING NK_STRING", - /* 54 */ "cmd ::= RESTORE DNODE NK_INTEGER", - /* 55 */ "dnode_endpoint ::= NK_STRING", - /* 56 */ "dnode_endpoint ::= NK_ID", - /* 57 */ "dnode_endpoint ::= NK_IPTOKEN", - /* 58 */ "force_opt ::=", - /* 59 */ "force_opt ::= FORCE", - /* 60 */ "cmd ::= ALTER LOCAL NK_STRING", - /* 61 */ "cmd ::= ALTER LOCAL NK_STRING NK_STRING", - /* 62 */ "cmd ::= CREATE QNODE ON DNODE NK_INTEGER", - /* 63 */ "cmd ::= DROP QNODE ON DNODE NK_INTEGER", - /* 64 */ "cmd ::= RESTORE QNODE ON DNODE NK_INTEGER", - /* 65 */ "cmd ::= CREATE BNODE ON DNODE NK_INTEGER", - /* 66 */ "cmd ::= DROP BNODE ON DNODE NK_INTEGER", - /* 67 */ "cmd ::= CREATE SNODE ON DNODE NK_INTEGER", - /* 68 */ "cmd ::= DROP SNODE ON DNODE NK_INTEGER", - /* 69 */ "cmd ::= CREATE MNODE ON DNODE NK_INTEGER", - /* 70 */ "cmd ::= DROP MNODE ON DNODE NK_INTEGER", - /* 71 */ "cmd ::= RESTORE MNODE ON DNODE NK_INTEGER", - /* 72 */ "cmd ::= RESTORE VNODE ON DNODE NK_INTEGER", - /* 73 */ "cmd ::= CREATE DATABASE not_exists_opt db_name db_options", - /* 74 */ "cmd ::= DROP DATABASE exists_opt db_name", - /* 75 */ "cmd ::= USE db_name", - /* 76 */ "cmd ::= ALTER DATABASE db_name alter_db_options", - /* 77 */ "cmd ::= FLUSH DATABASE db_name", - /* 78 */ "cmd ::= TRIM DATABASE db_name speed_opt", - /* 79 */ "cmd ::= COMPACT DATABASE db_name start_opt end_opt", - /* 80 */ "not_exists_opt ::= IF NOT EXISTS", - /* 81 */ "not_exists_opt ::=", - /* 82 */ "exists_opt ::= IF EXISTS", - /* 83 */ "exists_opt ::=", - /* 84 */ "db_options ::=", - /* 85 */ "db_options ::= db_options BUFFER NK_INTEGER", - /* 86 */ "db_options ::= db_options CACHEMODEL NK_STRING", - /* 87 */ "db_options ::= db_options CACHESIZE NK_INTEGER", - /* 88 */ "db_options ::= db_options COMP NK_INTEGER", - /* 89 */ "db_options ::= db_options DURATION NK_INTEGER", - /* 90 */ "db_options ::= db_options DURATION NK_VARIABLE", - /* 91 */ "db_options ::= db_options MAXROWS NK_INTEGER", - /* 92 */ "db_options ::= db_options MINROWS NK_INTEGER", - /* 93 */ "db_options ::= db_options KEEP integer_list", - /* 94 */ "db_options ::= db_options KEEP variable_list", - /* 95 */ "db_options ::= db_options PAGES NK_INTEGER", - /* 96 */ "db_options ::= db_options PAGESIZE NK_INTEGER", - /* 97 */ "db_options ::= db_options TSDB_PAGESIZE NK_INTEGER", - /* 98 */ "db_options ::= db_options PRECISION NK_STRING", - /* 99 */ "db_options ::= db_options REPLICA NK_INTEGER", - /* 100 */ "db_options ::= db_options VGROUPS NK_INTEGER", - /* 101 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", - /* 102 */ "db_options ::= db_options RETENTIONS retention_list", - /* 103 */ "db_options ::= db_options SCHEMALESS NK_INTEGER", - /* 104 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER", - /* 105 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER", - /* 106 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER", - /* 107 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", - /* 108 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER", - /* 109 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", - /* 110 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER", - /* 111 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER", - /* 112 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER", - /* 113 */ "db_options ::= db_options TABLE_PREFIX signed", - /* 114 */ "db_options ::= db_options TABLE_SUFFIX signed", - /* 115 */ "alter_db_options ::= alter_db_option", - /* 116 */ "alter_db_options ::= alter_db_options alter_db_option", - /* 117 */ "alter_db_option ::= BUFFER NK_INTEGER", - /* 118 */ "alter_db_option ::= CACHEMODEL NK_STRING", - /* 119 */ "alter_db_option ::= CACHESIZE NK_INTEGER", - /* 120 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER", - /* 121 */ "alter_db_option ::= KEEP integer_list", - /* 122 */ "alter_db_option ::= KEEP variable_list", - /* 123 */ "alter_db_option ::= PAGES NK_INTEGER", - /* 124 */ "alter_db_option ::= REPLICA NK_INTEGER", - /* 125 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER", - /* 126 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER", - /* 127 */ "alter_db_option ::= MINROWS NK_INTEGER", - /* 128 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER", - /* 129 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", - /* 130 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER", - /* 131 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", - /* 132 */ "integer_list ::= NK_INTEGER", - /* 133 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", - /* 134 */ "variable_list ::= NK_VARIABLE", - /* 135 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", - /* 136 */ "retention_list ::= retention", - /* 137 */ "retention_list ::= retention_list NK_COMMA retention", - /* 138 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", - /* 139 */ "speed_opt ::=", - /* 140 */ "speed_opt ::= MAX_SPEED NK_INTEGER", - /* 141 */ "start_opt ::=", - /* 142 */ "start_opt ::= START WITH NK_INTEGER", - /* 143 */ "start_opt ::= START WITH NK_STRING", - /* 144 */ "start_opt ::= START WITH TIMESTAMP NK_STRING", - /* 145 */ "end_opt ::=", - /* 146 */ "end_opt ::= END WITH NK_INTEGER", - /* 147 */ "end_opt ::= END WITH NK_STRING", - /* 148 */ "end_opt ::= END WITH TIMESTAMP NK_STRING", - /* 149 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", - /* 150 */ "cmd ::= CREATE TABLE multi_create_clause", - /* 151 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 152 */ "cmd ::= DROP TABLE multi_drop_clause", - /* 153 */ "cmd ::= DROP STABLE exists_opt full_table_name", - /* 154 */ "cmd ::= ALTER TABLE alter_table_clause", - /* 155 */ "cmd ::= ALTER STABLE alter_table_clause", - /* 156 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 157 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", - /* 158 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 159 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", - /* 160 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 161 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", - /* 162 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 163 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", - /* 164 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", - /* 165 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", - /* 166 */ "multi_create_clause ::= create_subtable_clause", - /* 167 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 168 */ "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", - /* 169 */ "multi_drop_clause ::= drop_table_clause", - /* 170 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", - /* 171 */ "drop_table_clause ::= exists_opt full_table_name", - /* 172 */ "specific_cols_opt ::=", - /* 173 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", - /* 174 */ "full_table_name ::= table_name", - /* 175 */ "full_table_name ::= db_name NK_DOT table_name", - /* 176 */ "column_def_list ::= column_def", - /* 177 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 178 */ "column_def ::= column_name type_name", - /* 179 */ "type_name ::= BOOL", - /* 180 */ "type_name ::= TINYINT", - /* 181 */ "type_name ::= SMALLINT", - /* 182 */ "type_name ::= INT", - /* 183 */ "type_name ::= INTEGER", - /* 184 */ "type_name ::= BIGINT", - /* 185 */ "type_name ::= FLOAT", - /* 186 */ "type_name ::= DOUBLE", - /* 187 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 188 */ "type_name ::= TIMESTAMP", - /* 189 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 190 */ "type_name ::= TINYINT UNSIGNED", - /* 191 */ "type_name ::= SMALLINT UNSIGNED", - /* 192 */ "type_name ::= INT UNSIGNED", - /* 193 */ "type_name ::= BIGINT UNSIGNED", - /* 194 */ "type_name ::= JSON", - /* 195 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 196 */ "type_name ::= MEDIUMBLOB", - /* 197 */ "type_name ::= BLOB", - /* 198 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 199 */ "type_name ::= DECIMAL", - /* 200 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 201 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 202 */ "tags_def_opt ::=", - /* 203 */ "tags_def_opt ::= tags_def", - /* 204 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", - /* 205 */ "table_options ::=", - /* 206 */ "table_options ::= table_options COMMENT NK_STRING", - /* 207 */ "table_options ::= table_options MAX_DELAY duration_list", - /* 208 */ "table_options ::= table_options WATERMARK duration_list", - /* 209 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", - /* 210 */ "table_options ::= table_options TTL NK_INTEGER", - /* 211 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 212 */ "table_options ::= table_options DELETE_MARK duration_list", - /* 213 */ "alter_table_options ::= alter_table_option", - /* 214 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 215 */ "alter_table_option ::= COMMENT NK_STRING", - /* 216 */ "alter_table_option ::= TTL NK_INTEGER", - /* 217 */ "duration_list ::= duration_literal", - /* 218 */ "duration_list ::= duration_list NK_COMMA duration_literal", - /* 219 */ "rollup_func_list ::= rollup_func_name", - /* 220 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", - /* 221 */ "rollup_func_name ::= function_name", - /* 222 */ "rollup_func_name ::= FIRST", - /* 223 */ "rollup_func_name ::= LAST", - /* 224 */ "col_name_list ::= col_name", - /* 225 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 226 */ "col_name ::= column_name", - /* 227 */ "cmd ::= SHOW DNODES", - /* 228 */ "cmd ::= SHOW USERS", - /* 229 */ "cmd ::= SHOW USER PRIVILEGES", - /* 230 */ "cmd ::= SHOW DATABASES", - /* 231 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", - /* 232 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 233 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 234 */ "cmd ::= SHOW MNODES", - /* 235 */ "cmd ::= SHOW QNODES", - /* 236 */ "cmd ::= SHOW FUNCTIONS", - /* 237 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 238 */ "cmd ::= SHOW STREAMS", - /* 239 */ "cmd ::= SHOW ACCOUNTS", - /* 240 */ "cmd ::= SHOW APPS", - /* 241 */ "cmd ::= SHOW CONNECTIONS", - /* 242 */ "cmd ::= SHOW LICENCES", - /* 243 */ "cmd ::= SHOW GRANTS", - /* 244 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 245 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 246 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 247 */ "cmd ::= SHOW QUERIES", - /* 248 */ "cmd ::= SHOW SCORES", - /* 249 */ "cmd ::= SHOW TOPICS", - /* 250 */ "cmd ::= SHOW VARIABLES", - /* 251 */ "cmd ::= SHOW CLUSTER VARIABLES", - /* 252 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 253 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", - /* 254 */ "cmd ::= SHOW BNODES", - /* 255 */ "cmd ::= SHOW SNODES", - /* 256 */ "cmd ::= SHOW CLUSTER", - /* 257 */ "cmd ::= SHOW TRANSACTIONS", - /* 258 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 259 */ "cmd ::= SHOW CONSUMERS", - /* 260 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 261 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", - /* 262 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", - /* 263 */ "cmd ::= SHOW VNODES NK_INTEGER", - /* 264 */ "cmd ::= SHOW VNODES NK_STRING", - /* 265 */ "cmd ::= SHOW db_name_cond_opt ALIVE", - /* 266 */ "cmd ::= SHOW CLUSTER ALIVE", - /* 267 */ "db_name_cond_opt ::=", - /* 268 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 269 */ "like_pattern_opt ::=", - /* 270 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 271 */ "table_name_cond ::= table_name", - /* 272 */ "from_db_opt ::=", - /* 273 */ "from_db_opt ::= FROM db_name", - /* 274 */ "tag_list_opt ::=", - /* 275 */ "tag_list_opt ::= tag_item", - /* 276 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", - /* 277 */ "tag_item ::= TBNAME", - /* 278 */ "tag_item ::= QTAGS", - /* 279 */ "tag_item ::= column_name", - /* 280 */ "tag_item ::= column_name column_alias", - /* 281 */ "tag_item ::= column_name AS column_alias", - /* 282 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options", - /* 283 */ "cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP", - /* 284 */ "cmd ::= DROP INDEX exists_opt full_index_name", - /* 285 */ "full_index_name ::= index_name", - /* 286 */ "full_index_name ::= db_name NK_DOT index_name", - /* 287 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 288 */ "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", - /* 289 */ "func_list ::= func", - /* 290 */ "func_list ::= func_list NK_COMMA func", - /* 291 */ "func ::= sma_func_name NK_LP expression_list NK_RP", - /* 292 */ "sma_func_name ::= function_name", - /* 293 */ "sma_func_name ::= COUNT", - /* 294 */ "sma_func_name ::= FIRST", - /* 295 */ "sma_func_name ::= LAST", - /* 296 */ "sma_func_name ::= LAST_ROW", - /* 297 */ "sma_stream_opt ::=", - /* 298 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", - /* 299 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", - /* 300 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", - /* 301 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 302 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", - /* 303 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", - /* 304 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", - /* 305 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", - /* 306 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 307 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 308 */ "cmd ::= DESC full_table_name", - /* 309 */ "cmd ::= DESCRIBE full_table_name", - /* 310 */ "cmd ::= RESET QUERY CACHE", - /* 311 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 312 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", - /* 313 */ "analyze_opt ::=", - /* 314 */ "analyze_opt ::= ANALYZE", - /* 315 */ "explain_options ::=", - /* 316 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 317 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 318 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", - /* 319 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 320 */ "agg_func_opt ::=", - /* 321 */ "agg_func_opt ::= AGGREGATE", - /* 322 */ "bufsize_opt ::=", - /* 323 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 324 */ "language_opt ::=", - /* 325 */ "language_opt ::= LANGUAGE NK_STRING", - /* 326 */ "or_replace_opt ::=", - /* 327 */ "or_replace_opt ::= OR REPLACE", - /* 328 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery", - /* 329 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 330 */ "cmd ::= PAUSE STREAM exists_opt stream_name", - /* 331 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", - /* 332 */ "col_list_opt ::=", - /* 333 */ "col_list_opt ::= NK_LP col_name_list NK_RP", - /* 334 */ "tag_def_or_ref_opt ::=", - /* 335 */ "tag_def_or_ref_opt ::= tags_def", - /* 336 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", - /* 337 */ "stream_options ::=", - /* 338 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 339 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 340 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 341 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 342 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 343 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 344 */ "stream_options ::= stream_options DELETE_MARK duration_literal", - /* 345 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", - /* 346 */ "subtable_opt ::=", - /* 347 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 348 */ "ignore_opt ::=", - /* 349 */ "ignore_opt ::= IGNORE UNTREATED", - /* 350 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 351 */ "cmd ::= KILL QUERY NK_STRING", - /* 352 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 353 */ "cmd ::= BALANCE VGROUP", - /* 354 */ "cmd ::= BALANCE VGROUP LEADER", - /* 355 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 356 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 357 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 358 */ "dnode_list ::= DNODE NK_INTEGER", - /* 359 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 360 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 361 */ "cmd ::= query_or_subquery", - /* 362 */ "cmd ::= insert_query", - /* 363 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 364 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 365 */ "literal ::= NK_INTEGER", - /* 366 */ "literal ::= NK_FLOAT", - /* 367 */ "literal ::= NK_STRING", - /* 368 */ "literal ::= NK_BOOL", - /* 369 */ "literal ::= TIMESTAMP NK_STRING", - /* 370 */ "literal ::= duration_literal", - /* 371 */ "literal ::= NULL", - /* 372 */ "literal ::= NK_QUESTION", - /* 373 */ "duration_literal ::= NK_VARIABLE", - /* 374 */ "signed ::= NK_INTEGER", - /* 375 */ "signed ::= NK_PLUS NK_INTEGER", - /* 376 */ "signed ::= NK_MINUS NK_INTEGER", - /* 377 */ "signed ::= NK_FLOAT", - /* 378 */ "signed ::= NK_PLUS NK_FLOAT", - /* 379 */ "signed ::= NK_MINUS NK_FLOAT", - /* 380 */ "signed_literal ::= signed", - /* 381 */ "signed_literal ::= NK_STRING", - /* 382 */ "signed_literal ::= NK_BOOL", - /* 383 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 384 */ "signed_literal ::= duration_literal", - /* 385 */ "signed_literal ::= NULL", - /* 386 */ "signed_literal ::= literal_func", - /* 387 */ "signed_literal ::= NK_QUESTION", - /* 388 */ "literal_list ::= signed_literal", - /* 389 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 390 */ "db_name ::= NK_ID", - /* 391 */ "table_name ::= NK_ID", - /* 392 */ "column_name ::= NK_ID", - /* 393 */ "function_name ::= NK_ID", - /* 394 */ "table_alias ::= NK_ID", - /* 395 */ "column_alias ::= NK_ID", - /* 396 */ "user_name ::= NK_ID", - /* 397 */ "topic_name ::= NK_ID", - /* 398 */ "stream_name ::= NK_ID", - /* 399 */ "cgroup_name ::= NK_ID", - /* 400 */ "index_name ::= NK_ID", - /* 401 */ "expr_or_subquery ::= expression", - /* 402 */ "expression ::= literal", - /* 403 */ "expression ::= pseudo_column", - /* 404 */ "expression ::= column_reference", - /* 405 */ "expression ::= function_expression", - /* 406 */ "expression ::= case_when_expression", - /* 407 */ "expression ::= NK_LP expression NK_RP", - /* 408 */ "expression ::= NK_PLUS expr_or_subquery", - /* 409 */ "expression ::= NK_MINUS expr_or_subquery", - /* 410 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 411 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 412 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 413 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 414 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 415 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 416 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 417 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 418 */ "expression_list ::= expr_or_subquery", - /* 419 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 420 */ "column_reference ::= column_name", - /* 421 */ "column_reference ::= table_name NK_DOT column_name", - /* 422 */ "pseudo_column ::= ROWTS", - /* 423 */ "pseudo_column ::= TBNAME", - /* 424 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 425 */ "pseudo_column ::= QSTART", - /* 426 */ "pseudo_column ::= QEND", - /* 427 */ "pseudo_column ::= QDURATION", - /* 428 */ "pseudo_column ::= WSTART", - /* 429 */ "pseudo_column ::= WEND", - /* 430 */ "pseudo_column ::= WDURATION", - /* 431 */ "pseudo_column ::= IROWTS", - /* 432 */ "pseudo_column ::= ISFILLED", - /* 433 */ "pseudo_column ::= QTAGS", - /* 434 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 435 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 436 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 437 */ "function_expression ::= literal_func", - /* 438 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 439 */ "literal_func ::= NOW", - /* 440 */ "noarg_func ::= NOW", - /* 441 */ "noarg_func ::= TODAY", - /* 442 */ "noarg_func ::= TIMEZONE", - /* 443 */ "noarg_func ::= DATABASE", - /* 444 */ "noarg_func ::= CLIENT_VERSION", - /* 445 */ "noarg_func ::= SERVER_VERSION", - /* 446 */ "noarg_func ::= SERVER_STATUS", - /* 447 */ "noarg_func ::= CURRENT_USER", - /* 448 */ "noarg_func ::= USER", - /* 449 */ "star_func ::= COUNT", - /* 450 */ "star_func ::= FIRST", - /* 451 */ "star_func ::= LAST", - /* 452 */ "star_func ::= LAST_ROW", - /* 453 */ "star_func_para_list ::= NK_STAR", - /* 454 */ "star_func_para_list ::= other_para_list", - /* 455 */ "other_para_list ::= star_func_para", - /* 456 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 457 */ "star_func_para ::= expr_or_subquery", - /* 458 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 459 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 460 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 461 */ "when_then_list ::= when_then_expr", - /* 462 */ "when_then_list ::= when_then_list when_then_expr", - /* 463 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 464 */ "case_when_else_opt ::=", - /* 465 */ "case_when_else_opt ::= ELSE common_expression", - /* 466 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 467 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 468 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 469 */ "predicate ::= expr_or_subquery IS NULL", - /* 470 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 471 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 472 */ "compare_op ::= NK_LT", - /* 473 */ "compare_op ::= NK_GT", - /* 474 */ "compare_op ::= NK_LE", - /* 475 */ "compare_op ::= NK_GE", - /* 476 */ "compare_op ::= NK_NE", - /* 477 */ "compare_op ::= NK_EQ", - /* 478 */ "compare_op ::= LIKE", - /* 479 */ "compare_op ::= NOT LIKE", - /* 480 */ "compare_op ::= MATCH", - /* 481 */ "compare_op ::= NMATCH", - /* 482 */ "compare_op ::= CONTAINS", - /* 483 */ "in_op ::= IN", - /* 484 */ "in_op ::= NOT IN", - /* 485 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 486 */ "boolean_value_expression ::= boolean_primary", - /* 487 */ "boolean_value_expression ::= NOT boolean_primary", - /* 488 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 489 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 490 */ "boolean_primary ::= predicate", - /* 491 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 492 */ "common_expression ::= expr_or_subquery", - /* 493 */ "common_expression ::= boolean_value_expression", - /* 494 */ "from_clause_opt ::=", - /* 495 */ "from_clause_opt ::= FROM table_reference_list", - /* 496 */ "table_reference_list ::= table_reference", - /* 497 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 498 */ "table_reference ::= table_primary", - /* 499 */ "table_reference ::= joined_table", - /* 500 */ "table_primary ::= table_name alias_opt", - /* 501 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 502 */ "table_primary ::= subquery alias_opt", - /* 503 */ "table_primary ::= parenthesized_joined_table", - /* 504 */ "alias_opt ::=", - /* 505 */ "alias_opt ::= table_alias", - /* 506 */ "alias_opt ::= AS table_alias", - /* 507 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 508 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 509 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 510 */ "join_type ::=", - /* 511 */ "join_type ::= INNER", - /* 512 */ "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", - /* 513 */ "set_quantifier_opt ::=", - /* 514 */ "set_quantifier_opt ::= DISTINCT", - /* 515 */ "set_quantifier_opt ::= ALL", - /* 516 */ "select_list ::= select_item", - /* 517 */ "select_list ::= select_list NK_COMMA select_item", - /* 518 */ "select_item ::= NK_STAR", - /* 519 */ "select_item ::= common_expression", - /* 520 */ "select_item ::= common_expression column_alias", - /* 521 */ "select_item ::= common_expression AS column_alias", - /* 522 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 523 */ "where_clause_opt ::=", - /* 524 */ "where_clause_opt ::= WHERE search_condition", - /* 525 */ "partition_by_clause_opt ::=", - /* 526 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 527 */ "partition_list ::= partition_item", - /* 528 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 529 */ "partition_item ::= expr_or_subquery", - /* 530 */ "partition_item ::= expr_or_subquery column_alias", - /* 531 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 532 */ "twindow_clause_opt ::=", - /* 533 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 534 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 535 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 536 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 537 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 538 */ "sliding_opt ::=", - /* 539 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 540 */ "fill_opt ::=", - /* 541 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 542 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", - /* 543 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", - /* 544 */ "fill_mode ::= NONE", - /* 545 */ "fill_mode ::= PREV", - /* 546 */ "fill_mode ::= NULL", - /* 547 */ "fill_mode ::= NULL_F", - /* 548 */ "fill_mode ::= LINEAR", - /* 549 */ "fill_mode ::= NEXT", - /* 550 */ "group_by_clause_opt ::=", - /* 551 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 552 */ "group_by_list ::= expr_or_subquery", - /* 553 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 554 */ "having_clause_opt ::=", - /* 555 */ "having_clause_opt ::= HAVING search_condition", - /* 556 */ "range_opt ::=", - /* 557 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 558 */ "every_opt ::=", - /* 559 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 560 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 561 */ "query_simple ::= query_specification", - /* 562 */ "query_simple ::= union_query_expression", - /* 563 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 564 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 565 */ "query_simple_or_subquery ::= query_simple", - /* 566 */ "query_simple_or_subquery ::= subquery", - /* 567 */ "query_or_subquery ::= query_expression", - /* 568 */ "query_or_subquery ::= subquery", - /* 569 */ "order_by_clause_opt ::=", - /* 570 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 571 */ "slimit_clause_opt ::=", - /* 572 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 573 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 574 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 575 */ "limit_clause_opt ::=", - /* 576 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 577 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 578 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 579 */ "subquery ::= NK_LP query_expression NK_RP", - /* 580 */ "subquery ::= NK_LP subquery NK_RP", - /* 581 */ "search_condition ::= common_expression", - /* 582 */ "sort_specification_list ::= sort_specification", - /* 583 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 584 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 585 */ "ordering_specification_opt ::=", - /* 586 */ "ordering_specification_opt ::= ASC", - /* 587 */ "ordering_specification_opt ::= DESC", - /* 588 */ "null_ordering_opt ::=", - /* 589 */ "null_ordering_opt ::= NULLS FIRST", - /* 590 */ "null_ordering_opt ::= NULLS LAST", + /* 50 */ "cmd ::= DROP DNODE NK_INTEGER unsafe_opt", + /* 51 */ "cmd ::= DROP DNODE dnode_endpoint unsafe_opt", + /* 52 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING", + /* 53 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING", + /* 54 */ "cmd ::= ALTER ALL DNODES NK_STRING", + /* 55 */ "cmd ::= ALTER ALL DNODES NK_STRING NK_STRING", + /* 56 */ "cmd ::= RESTORE DNODE NK_INTEGER", + /* 57 */ "dnode_endpoint ::= NK_STRING", + /* 58 */ "dnode_endpoint ::= NK_ID", + /* 59 */ "dnode_endpoint ::= NK_IPTOKEN", + /* 60 */ "force_opt ::=", + /* 61 */ "force_opt ::= FORCE", + /* 62 */ "unsafe_opt ::= UNSAFE", + /* 63 */ "cmd ::= ALTER LOCAL NK_STRING", + /* 64 */ "cmd ::= ALTER LOCAL NK_STRING NK_STRING", + /* 65 */ "cmd ::= CREATE QNODE ON DNODE NK_INTEGER", + /* 66 */ "cmd ::= DROP QNODE ON DNODE NK_INTEGER", + /* 67 */ "cmd ::= RESTORE QNODE ON DNODE NK_INTEGER", + /* 68 */ "cmd ::= CREATE BNODE ON DNODE NK_INTEGER", + /* 69 */ "cmd ::= DROP BNODE ON DNODE NK_INTEGER", + /* 70 */ "cmd ::= CREATE SNODE ON DNODE NK_INTEGER", + /* 71 */ "cmd ::= DROP SNODE ON DNODE NK_INTEGER", + /* 72 */ "cmd ::= CREATE MNODE ON DNODE NK_INTEGER", + /* 73 */ "cmd ::= DROP MNODE ON DNODE NK_INTEGER", + /* 74 */ "cmd ::= RESTORE MNODE ON DNODE NK_INTEGER", + /* 75 */ "cmd ::= RESTORE VNODE ON DNODE NK_INTEGER", + /* 76 */ "cmd ::= CREATE DATABASE not_exists_opt db_name db_options", + /* 77 */ "cmd ::= DROP DATABASE exists_opt db_name", + /* 78 */ "cmd ::= USE db_name", + /* 79 */ "cmd ::= ALTER DATABASE db_name alter_db_options", + /* 80 */ "cmd ::= FLUSH DATABASE db_name", + /* 81 */ "cmd ::= TRIM DATABASE db_name speed_opt", + /* 82 */ "cmd ::= COMPACT DATABASE db_name start_opt end_opt", + /* 83 */ "not_exists_opt ::= IF NOT EXISTS", + /* 84 */ "not_exists_opt ::=", + /* 85 */ "exists_opt ::= IF EXISTS", + /* 86 */ "exists_opt ::=", + /* 87 */ "db_options ::=", + /* 88 */ "db_options ::= db_options BUFFER NK_INTEGER", + /* 89 */ "db_options ::= db_options CACHEMODEL NK_STRING", + /* 90 */ "db_options ::= db_options CACHESIZE NK_INTEGER", + /* 91 */ "db_options ::= db_options COMP NK_INTEGER", + /* 92 */ "db_options ::= db_options DURATION NK_INTEGER", + /* 93 */ "db_options ::= db_options DURATION NK_VARIABLE", + /* 94 */ "db_options ::= db_options MAXROWS NK_INTEGER", + /* 95 */ "db_options ::= db_options MINROWS NK_INTEGER", + /* 96 */ "db_options ::= db_options KEEP integer_list", + /* 97 */ "db_options ::= db_options KEEP variable_list", + /* 98 */ "db_options ::= db_options PAGES NK_INTEGER", + /* 99 */ "db_options ::= db_options PAGESIZE NK_INTEGER", + /* 100 */ "db_options ::= db_options TSDB_PAGESIZE NK_INTEGER", + /* 101 */ "db_options ::= db_options PRECISION NK_STRING", + /* 102 */ "db_options ::= db_options REPLICA NK_INTEGER", + /* 103 */ "db_options ::= db_options VGROUPS NK_INTEGER", + /* 104 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", + /* 105 */ "db_options ::= db_options RETENTIONS retention_list", + /* 106 */ "db_options ::= db_options SCHEMALESS NK_INTEGER", + /* 107 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER", + /* 108 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER", + /* 109 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER", + /* 110 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", + /* 111 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER", + /* 112 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", + /* 113 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER", + /* 114 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER", + /* 115 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER", + /* 116 */ "db_options ::= db_options TABLE_PREFIX signed", + /* 117 */ "db_options ::= db_options TABLE_SUFFIX signed", + /* 118 */ "alter_db_options ::= alter_db_option", + /* 119 */ "alter_db_options ::= alter_db_options alter_db_option", + /* 120 */ "alter_db_option ::= BUFFER NK_INTEGER", + /* 121 */ "alter_db_option ::= CACHEMODEL NK_STRING", + /* 122 */ "alter_db_option ::= CACHESIZE NK_INTEGER", + /* 123 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER", + /* 124 */ "alter_db_option ::= KEEP integer_list", + /* 125 */ "alter_db_option ::= KEEP variable_list", + /* 126 */ "alter_db_option ::= PAGES NK_INTEGER", + /* 127 */ "alter_db_option ::= REPLICA NK_INTEGER", + /* 128 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER", + /* 129 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER", + /* 130 */ "alter_db_option ::= MINROWS NK_INTEGER", + /* 131 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER", + /* 132 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", + /* 133 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER", + /* 134 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", + /* 135 */ "integer_list ::= NK_INTEGER", + /* 136 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", + /* 137 */ "variable_list ::= NK_VARIABLE", + /* 138 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", + /* 139 */ "retention_list ::= retention", + /* 140 */ "retention_list ::= retention_list NK_COMMA retention", + /* 141 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", + /* 142 */ "speed_opt ::=", + /* 143 */ "speed_opt ::= MAX_SPEED NK_INTEGER", + /* 144 */ "start_opt ::=", + /* 145 */ "start_opt ::= START WITH NK_INTEGER", + /* 146 */ "start_opt ::= START WITH NK_STRING", + /* 147 */ "start_opt ::= START WITH TIMESTAMP NK_STRING", + /* 148 */ "end_opt ::=", + /* 149 */ "end_opt ::= END WITH NK_INTEGER", + /* 150 */ "end_opt ::= END WITH NK_STRING", + /* 151 */ "end_opt ::= END WITH TIMESTAMP NK_STRING", + /* 152 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", + /* 153 */ "cmd ::= CREATE TABLE multi_create_clause", + /* 154 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", + /* 155 */ "cmd ::= DROP TABLE multi_drop_clause", + /* 156 */ "cmd ::= DROP STABLE exists_opt full_table_name", + /* 157 */ "cmd ::= ALTER TABLE alter_table_clause", + /* 158 */ "cmd ::= ALTER STABLE alter_table_clause", + /* 159 */ "alter_table_clause ::= full_table_name alter_table_options", + /* 160 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", + /* 161 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", + /* 162 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", + /* 163 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", + /* 164 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", + /* 165 */ "alter_table_clause ::= full_table_name DROP TAG column_name", + /* 166 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", + /* 167 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", + /* 168 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", + /* 169 */ "multi_create_clause ::= create_subtable_clause", + /* 170 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", + /* 171 */ "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", + /* 172 */ "multi_drop_clause ::= drop_table_clause", + /* 173 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", + /* 174 */ "drop_table_clause ::= exists_opt full_table_name", + /* 175 */ "specific_cols_opt ::=", + /* 176 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", + /* 177 */ "full_table_name ::= table_name", + /* 178 */ "full_table_name ::= db_name NK_DOT table_name", + /* 179 */ "column_def_list ::= column_def", + /* 180 */ "column_def_list ::= column_def_list NK_COMMA column_def", + /* 181 */ "column_def ::= column_name type_name", + /* 182 */ "type_name ::= BOOL", + /* 183 */ "type_name ::= TINYINT", + /* 184 */ "type_name ::= SMALLINT", + /* 185 */ "type_name ::= INT", + /* 186 */ "type_name ::= INTEGER", + /* 187 */ "type_name ::= BIGINT", + /* 188 */ "type_name ::= FLOAT", + /* 189 */ "type_name ::= DOUBLE", + /* 190 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 191 */ "type_name ::= TIMESTAMP", + /* 192 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 193 */ "type_name ::= TINYINT UNSIGNED", + /* 194 */ "type_name ::= SMALLINT UNSIGNED", + /* 195 */ "type_name ::= INT UNSIGNED", + /* 196 */ "type_name ::= BIGINT UNSIGNED", + /* 197 */ "type_name ::= JSON", + /* 198 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 199 */ "type_name ::= MEDIUMBLOB", + /* 200 */ "type_name ::= BLOB", + /* 201 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 202 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP", + /* 203 */ "type_name ::= DECIMAL", + /* 204 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 205 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 206 */ "tags_def_opt ::=", + /* 207 */ "tags_def_opt ::= tags_def", + /* 208 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", + /* 209 */ "table_options ::=", + /* 210 */ "table_options ::= table_options COMMENT NK_STRING", + /* 211 */ "table_options ::= table_options MAX_DELAY duration_list", + /* 212 */ "table_options ::= table_options WATERMARK duration_list", + /* 213 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", + /* 214 */ "table_options ::= table_options TTL NK_INTEGER", + /* 215 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 216 */ "table_options ::= table_options DELETE_MARK duration_list", + /* 217 */ "alter_table_options ::= alter_table_option", + /* 218 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 219 */ "alter_table_option ::= COMMENT NK_STRING", + /* 220 */ "alter_table_option ::= TTL NK_INTEGER", + /* 221 */ "duration_list ::= duration_literal", + /* 222 */ "duration_list ::= duration_list NK_COMMA duration_literal", + /* 223 */ "rollup_func_list ::= rollup_func_name", + /* 224 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", + /* 225 */ "rollup_func_name ::= function_name", + /* 226 */ "rollup_func_name ::= FIRST", + /* 227 */ "rollup_func_name ::= LAST", + /* 228 */ "col_name_list ::= col_name", + /* 229 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 230 */ "col_name ::= column_name", + /* 231 */ "cmd ::= SHOW DNODES", + /* 232 */ "cmd ::= SHOW USERS", + /* 233 */ "cmd ::= SHOW USER PRIVILEGES", + /* 234 */ "cmd ::= SHOW DATABASES", + /* 235 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", + /* 236 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 237 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 238 */ "cmd ::= SHOW MNODES", + /* 239 */ "cmd ::= SHOW QNODES", + /* 240 */ "cmd ::= SHOW FUNCTIONS", + /* 241 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 242 */ "cmd ::= SHOW STREAMS", + /* 243 */ "cmd ::= SHOW ACCOUNTS", + /* 244 */ "cmd ::= SHOW APPS", + /* 245 */ "cmd ::= SHOW CONNECTIONS", + /* 246 */ "cmd ::= SHOW LICENCES", + /* 247 */ "cmd ::= SHOW GRANTS", + /* 248 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 249 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 250 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 251 */ "cmd ::= SHOW QUERIES", + /* 252 */ "cmd ::= SHOW SCORES", + /* 253 */ "cmd ::= SHOW TOPICS", + /* 254 */ "cmd ::= SHOW VARIABLES", + /* 255 */ "cmd ::= SHOW CLUSTER VARIABLES", + /* 256 */ "cmd ::= SHOW LOCAL VARIABLES", + /* 257 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", + /* 258 */ "cmd ::= SHOW BNODES", + /* 259 */ "cmd ::= SHOW SNODES", + /* 260 */ "cmd ::= SHOW CLUSTER", + /* 261 */ "cmd ::= SHOW TRANSACTIONS", + /* 262 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", + /* 263 */ "cmd ::= SHOW CONSUMERS", + /* 264 */ "cmd ::= SHOW SUBSCRIPTIONS", + /* 265 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", + /* 266 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", + /* 267 */ "cmd ::= SHOW VNODES NK_INTEGER", + /* 268 */ "cmd ::= SHOW VNODES NK_STRING", + /* 269 */ "cmd ::= SHOW db_name_cond_opt ALIVE", + /* 270 */ "cmd ::= SHOW CLUSTER ALIVE", + /* 271 */ "db_name_cond_opt ::=", + /* 272 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 273 */ "like_pattern_opt ::=", + /* 274 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 275 */ "table_name_cond ::= table_name", + /* 276 */ "from_db_opt ::=", + /* 277 */ "from_db_opt ::= FROM db_name", + /* 278 */ "tag_list_opt ::=", + /* 279 */ "tag_list_opt ::= tag_item", + /* 280 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", + /* 281 */ "tag_item ::= TBNAME", + /* 282 */ "tag_item ::= QTAGS", + /* 283 */ "tag_item ::= column_name", + /* 284 */ "tag_item ::= column_name column_alias", + /* 285 */ "tag_item ::= column_name AS column_alias", + /* 286 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options", + /* 287 */ "cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP", + /* 288 */ "cmd ::= DROP INDEX exists_opt full_index_name", + /* 289 */ "full_index_name ::= index_name", + /* 290 */ "full_index_name ::= db_name NK_DOT index_name", + /* 291 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 292 */ "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", + /* 293 */ "func_list ::= func", + /* 294 */ "func_list ::= func_list NK_COMMA func", + /* 295 */ "func ::= sma_func_name NK_LP expression_list NK_RP", + /* 296 */ "sma_func_name ::= function_name", + /* 297 */ "sma_func_name ::= COUNT", + /* 298 */ "sma_func_name ::= FIRST", + /* 299 */ "sma_func_name ::= LAST", + /* 300 */ "sma_func_name ::= LAST_ROW", + /* 301 */ "sma_stream_opt ::=", + /* 302 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", + /* 303 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", + /* 304 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", + /* 305 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 306 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", + /* 307 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", + /* 308 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", + /* 309 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", + /* 310 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 311 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 312 */ "cmd ::= DESC full_table_name", + /* 313 */ "cmd ::= DESCRIBE full_table_name", + /* 314 */ "cmd ::= RESET QUERY CACHE", + /* 315 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 316 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", + /* 317 */ "analyze_opt ::=", + /* 318 */ "analyze_opt ::= ANALYZE", + /* 319 */ "explain_options ::=", + /* 320 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 321 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 322 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", + /* 323 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 324 */ "agg_func_opt ::=", + /* 325 */ "agg_func_opt ::= AGGREGATE", + /* 326 */ "bufsize_opt ::=", + /* 327 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 328 */ "language_opt ::=", + /* 329 */ "language_opt ::= LANGUAGE NK_STRING", + /* 330 */ "or_replace_opt ::=", + /* 331 */ "or_replace_opt ::= OR REPLACE", + /* 332 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery", + /* 333 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 334 */ "cmd ::= PAUSE STREAM exists_opt stream_name", + /* 335 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", + /* 336 */ "col_list_opt ::=", + /* 337 */ "col_list_opt ::= NK_LP col_name_list NK_RP", + /* 338 */ "tag_def_or_ref_opt ::=", + /* 339 */ "tag_def_or_ref_opt ::= tags_def", + /* 340 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", + /* 341 */ "stream_options ::=", + /* 342 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 343 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 344 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 345 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 346 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 347 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 348 */ "stream_options ::= stream_options DELETE_MARK duration_literal", + /* 349 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", + /* 350 */ "subtable_opt ::=", + /* 351 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 352 */ "ignore_opt ::=", + /* 353 */ "ignore_opt ::= IGNORE UNTREATED", + /* 354 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 355 */ "cmd ::= KILL QUERY NK_STRING", + /* 356 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 357 */ "cmd ::= BALANCE VGROUP", + /* 358 */ "cmd ::= BALANCE VGROUP LEADER", + /* 359 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 360 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 361 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 362 */ "dnode_list ::= DNODE NK_INTEGER", + /* 363 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 364 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 365 */ "cmd ::= query_or_subquery", + /* 366 */ "cmd ::= insert_query", + /* 367 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 368 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", + /* 369 */ "literal ::= NK_INTEGER", + /* 370 */ "literal ::= NK_FLOAT", + /* 371 */ "literal ::= NK_STRING", + /* 372 */ "literal ::= NK_BOOL", + /* 373 */ "literal ::= TIMESTAMP NK_STRING", + /* 374 */ "literal ::= duration_literal", + /* 375 */ "literal ::= NULL", + /* 376 */ "literal ::= NK_QUESTION", + /* 377 */ "duration_literal ::= NK_VARIABLE", + /* 378 */ "signed ::= NK_INTEGER", + /* 379 */ "signed ::= NK_PLUS NK_INTEGER", + /* 380 */ "signed ::= NK_MINUS NK_INTEGER", + /* 381 */ "signed ::= NK_FLOAT", + /* 382 */ "signed ::= NK_PLUS NK_FLOAT", + /* 383 */ "signed ::= NK_MINUS NK_FLOAT", + /* 384 */ "signed_literal ::= signed", + /* 385 */ "signed_literal ::= NK_STRING", + /* 386 */ "signed_literal ::= NK_BOOL", + /* 387 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 388 */ "signed_literal ::= duration_literal", + /* 389 */ "signed_literal ::= NULL", + /* 390 */ "signed_literal ::= literal_func", + /* 391 */ "signed_literal ::= NK_QUESTION", + /* 392 */ "literal_list ::= signed_literal", + /* 393 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 394 */ "db_name ::= NK_ID", + /* 395 */ "table_name ::= NK_ID", + /* 396 */ "column_name ::= NK_ID", + /* 397 */ "function_name ::= NK_ID", + /* 398 */ "table_alias ::= NK_ID", + /* 399 */ "column_alias ::= NK_ID", + /* 400 */ "user_name ::= NK_ID", + /* 401 */ "topic_name ::= NK_ID", + /* 402 */ "stream_name ::= NK_ID", + /* 403 */ "cgroup_name ::= NK_ID", + /* 404 */ "index_name ::= NK_ID", + /* 405 */ "expr_or_subquery ::= expression", + /* 406 */ "expression ::= literal", + /* 407 */ "expression ::= pseudo_column", + /* 408 */ "expression ::= column_reference", + /* 409 */ "expression ::= function_expression", + /* 410 */ "expression ::= case_when_expression", + /* 411 */ "expression ::= NK_LP expression NK_RP", + /* 412 */ "expression ::= NK_PLUS expr_or_subquery", + /* 413 */ "expression ::= NK_MINUS expr_or_subquery", + /* 414 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 415 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 416 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 417 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 418 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 419 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 420 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 421 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 422 */ "expression_list ::= expr_or_subquery", + /* 423 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 424 */ "column_reference ::= column_name", + /* 425 */ "column_reference ::= table_name NK_DOT column_name", + /* 426 */ "pseudo_column ::= ROWTS", + /* 427 */ "pseudo_column ::= TBNAME", + /* 428 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 429 */ "pseudo_column ::= QSTART", + /* 430 */ "pseudo_column ::= QEND", + /* 431 */ "pseudo_column ::= QDURATION", + /* 432 */ "pseudo_column ::= WSTART", + /* 433 */ "pseudo_column ::= WEND", + /* 434 */ "pseudo_column ::= WDURATION", + /* 435 */ "pseudo_column ::= IROWTS", + /* 436 */ "pseudo_column ::= ISFILLED", + /* 437 */ "pseudo_column ::= QTAGS", + /* 438 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 439 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 440 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 441 */ "function_expression ::= literal_func", + /* 442 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 443 */ "literal_func ::= NOW", + /* 444 */ "noarg_func ::= NOW", + /* 445 */ "noarg_func ::= TODAY", + /* 446 */ "noarg_func ::= TIMEZONE", + /* 447 */ "noarg_func ::= DATABASE", + /* 448 */ "noarg_func ::= CLIENT_VERSION", + /* 449 */ "noarg_func ::= SERVER_VERSION", + /* 450 */ "noarg_func ::= SERVER_STATUS", + /* 451 */ "noarg_func ::= CURRENT_USER", + /* 452 */ "noarg_func ::= USER", + /* 453 */ "star_func ::= COUNT", + /* 454 */ "star_func ::= FIRST", + /* 455 */ "star_func ::= LAST", + /* 456 */ "star_func ::= LAST_ROW", + /* 457 */ "star_func_para_list ::= NK_STAR", + /* 458 */ "star_func_para_list ::= other_para_list", + /* 459 */ "other_para_list ::= star_func_para", + /* 460 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 461 */ "star_func_para ::= expr_or_subquery", + /* 462 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 463 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 464 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 465 */ "when_then_list ::= when_then_expr", + /* 466 */ "when_then_list ::= when_then_list when_then_expr", + /* 467 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 468 */ "case_when_else_opt ::=", + /* 469 */ "case_when_else_opt ::= ELSE common_expression", + /* 470 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 471 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 472 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 473 */ "predicate ::= expr_or_subquery IS NULL", + /* 474 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 475 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 476 */ "compare_op ::= NK_LT", + /* 477 */ "compare_op ::= NK_GT", + /* 478 */ "compare_op ::= NK_LE", + /* 479 */ "compare_op ::= NK_GE", + /* 480 */ "compare_op ::= NK_NE", + /* 481 */ "compare_op ::= NK_EQ", + /* 482 */ "compare_op ::= LIKE", + /* 483 */ "compare_op ::= NOT LIKE", + /* 484 */ "compare_op ::= MATCH", + /* 485 */ "compare_op ::= NMATCH", + /* 486 */ "compare_op ::= CONTAINS", + /* 487 */ "in_op ::= IN", + /* 488 */ "in_op ::= NOT IN", + /* 489 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 490 */ "boolean_value_expression ::= boolean_primary", + /* 491 */ "boolean_value_expression ::= NOT boolean_primary", + /* 492 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 493 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 494 */ "boolean_primary ::= predicate", + /* 495 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 496 */ "common_expression ::= expr_or_subquery", + /* 497 */ "common_expression ::= boolean_value_expression", + /* 498 */ "from_clause_opt ::=", + /* 499 */ "from_clause_opt ::= FROM table_reference_list", + /* 500 */ "table_reference_list ::= table_reference", + /* 501 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 502 */ "table_reference ::= table_primary", + /* 503 */ "table_reference ::= joined_table", + /* 504 */ "table_primary ::= table_name alias_opt", + /* 505 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 506 */ "table_primary ::= subquery alias_opt", + /* 507 */ "table_primary ::= parenthesized_joined_table", + /* 508 */ "alias_opt ::=", + /* 509 */ "alias_opt ::= table_alias", + /* 510 */ "alias_opt ::= AS table_alias", + /* 511 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 512 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 513 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 514 */ "join_type ::=", + /* 515 */ "join_type ::= INNER", + /* 516 */ "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", + /* 517 */ "set_quantifier_opt ::=", + /* 518 */ "set_quantifier_opt ::= DISTINCT", + /* 519 */ "set_quantifier_opt ::= ALL", + /* 520 */ "select_list ::= select_item", + /* 521 */ "select_list ::= select_list NK_COMMA select_item", + /* 522 */ "select_item ::= NK_STAR", + /* 523 */ "select_item ::= common_expression", + /* 524 */ "select_item ::= common_expression column_alias", + /* 525 */ "select_item ::= common_expression AS column_alias", + /* 526 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 527 */ "where_clause_opt ::=", + /* 528 */ "where_clause_opt ::= WHERE search_condition", + /* 529 */ "partition_by_clause_opt ::=", + /* 530 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 531 */ "partition_list ::= partition_item", + /* 532 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 533 */ "partition_item ::= expr_or_subquery", + /* 534 */ "partition_item ::= expr_or_subquery column_alias", + /* 535 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 536 */ "twindow_clause_opt ::=", + /* 537 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 538 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 539 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 540 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 541 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 542 */ "sliding_opt ::=", + /* 543 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 544 */ "fill_opt ::=", + /* 545 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 546 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", + /* 547 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", + /* 548 */ "fill_mode ::= NONE", + /* 549 */ "fill_mode ::= PREV", + /* 550 */ "fill_mode ::= NULL", + /* 551 */ "fill_mode ::= NULL_F", + /* 552 */ "fill_mode ::= LINEAR", + /* 553 */ "fill_mode ::= NEXT", + /* 554 */ "group_by_clause_opt ::=", + /* 555 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 556 */ "group_by_list ::= expr_or_subquery", + /* 557 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 558 */ "having_clause_opt ::=", + /* 559 */ "having_clause_opt ::= HAVING search_condition", + /* 560 */ "range_opt ::=", + /* 561 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 562 */ "every_opt ::=", + /* 563 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 564 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 565 */ "query_simple ::= query_specification", + /* 566 */ "query_simple ::= union_query_expression", + /* 567 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 568 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 569 */ "query_simple_or_subquery ::= query_simple", + /* 570 */ "query_simple_or_subquery ::= subquery", + /* 571 */ "query_or_subquery ::= query_expression", + /* 572 */ "query_or_subquery ::= subquery", + /* 573 */ "order_by_clause_opt ::=", + /* 574 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 575 */ "slimit_clause_opt ::=", + /* 576 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 577 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 578 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 579 */ "limit_clause_opt ::=", + /* 580 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 581 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 582 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 583 */ "subquery ::= NK_LP query_expression NK_RP", + /* 584 */ "subquery ::= NK_LP subquery NK_RP", + /* 585 */ "search_condition ::= common_expression", + /* 586 */ "sort_specification_list ::= sort_specification", + /* 587 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 588 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 589 */ "ordering_specification_opt ::=", + /* 590 */ "ordering_specification_opt ::= ASC", + /* 591 */ "ordering_specification_opt ::= DESC", + /* 592 */ "null_ordering_opt ::=", + /* 593 */ "null_ordering_opt ::= NULLS FIRST", + /* 594 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2703,241 +2660,212 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 335: /* cmd */ - case 338: /* literal */ - case 344: /* with_opt */ - case 350: /* search_condition */ - case 354: /* db_options */ - case 356: /* alter_db_options */ - case 358: /* start_opt */ - case 359: /* end_opt */ - case 363: /* signed */ - case 365: /* retention */ - case 366: /* full_table_name */ - case 369: /* table_options */ - case 373: /* alter_table_clause */ - case 374: /* alter_table_options */ - case 377: /* signed_literal */ - case 378: /* create_subtable_clause */ - case 381: /* drop_table_clause */ - case 383: /* column_def */ - case 387: /* duration_literal */ - case 388: /* rollup_func_name */ - case 390: /* col_name */ - case 391: /* db_name_cond_opt */ - case 392: /* like_pattern_opt */ - case 393: /* table_name_cond */ - case 394: /* from_db_opt */ - case 396: /* tag_item */ - case 398: /* full_index_name */ - case 399: /* index_options */ - case 402: /* sliding_opt */ - case 403: /* sma_stream_opt */ - case 404: /* func */ - case 406: /* query_or_subquery */ - case 409: /* explain_options */ - case 410: /* insert_query */ - case 416: /* stream_options */ - case 419: /* subtable_opt */ - case 421: /* expression */ - case 423: /* where_clause_opt */ - case 424: /* literal_func */ - case 427: /* expr_or_subquery */ - case 428: /* pseudo_column */ - case 429: /* column_reference */ - case 430: /* function_expression */ - case 431: /* case_when_expression */ - case 436: /* star_func_para */ - case 438: /* case_when_else_opt */ - case 439: /* common_expression */ - case 440: /* when_then_expr */ - case 441: /* predicate */ - case 444: /* in_predicate_value */ - case 445: /* boolean_value_expression */ - case 446: /* boolean_primary */ - case 447: /* from_clause_opt */ - case 448: /* table_reference_list */ - case 449: /* table_reference */ - case 450: /* table_primary */ - case 451: /* joined_table */ - case 453: /* subquery */ - case 454: /* parenthesized_joined_table */ - case 456: /* query_specification */ - case 460: /* range_opt */ - case 461: /* every_opt */ - case 462: /* fill_opt */ - case 463: /* twindow_clause_opt */ - case 465: /* having_clause_opt */ - case 466: /* select_item */ - case 468: /* partition_item */ - case 471: /* query_expression */ - case 472: /* query_simple */ - case 474: /* slimit_clause_opt */ - case 475: /* limit_clause_opt */ - case 476: /* union_query_expression */ - case 477: /* query_simple_or_subquery */ - case 479: /* sort_specification */ + case 337: /* cmd */ + case 340: /* literal */ + case 346: /* with_opt */ + case 352: /* search_condition */ + case 357: /* db_options */ + case 359: /* alter_db_options */ + case 361: /* start_opt */ + case 362: /* end_opt */ + case 366: /* signed */ + case 368: /* retention */ + case 369: /* full_table_name */ + case 372: /* table_options */ + case 376: /* alter_table_clause */ + case 377: /* alter_table_options */ + case 380: /* signed_literal */ + case 381: /* create_subtable_clause */ + case 384: /* drop_table_clause */ + case 386: /* column_def */ + case 390: /* duration_literal */ + case 391: /* rollup_func_name */ + case 393: /* col_name */ + case 394: /* db_name_cond_opt */ + case 395: /* like_pattern_opt */ + case 396: /* table_name_cond */ + case 397: /* from_db_opt */ + case 399: /* tag_item */ + case 401: /* full_index_name */ + case 402: /* index_options */ + case 405: /* sliding_opt */ + case 406: /* sma_stream_opt */ + case 407: /* func */ + case 409: /* query_or_subquery */ + case 412: /* explain_options */ + case 413: /* insert_query */ + case 419: /* stream_options */ + case 422: /* subtable_opt */ + case 424: /* expression */ + case 426: /* where_clause_opt */ + case 427: /* literal_func */ + case 430: /* expr_or_subquery */ + case 431: /* pseudo_column */ + case 432: /* column_reference */ + case 433: /* function_expression */ + case 434: /* case_when_expression */ + case 439: /* star_func_para */ + case 441: /* case_when_else_opt */ + case 442: /* common_expression */ + case 443: /* when_then_expr */ + case 444: /* predicate */ + case 447: /* in_predicate_value */ + case 448: /* boolean_value_expression */ + case 449: /* boolean_primary */ + case 450: /* from_clause_opt */ + case 451: /* table_reference_list */ + case 452: /* table_reference */ + case 453: /* table_primary */ + case 454: /* joined_table */ + case 456: /* subquery */ + case 457: /* parenthesized_joined_table */ + case 459: /* query_specification */ + case 463: /* range_opt */ + case 464: /* every_opt */ + case 465: /* fill_opt */ + case 466: /* twindow_clause_opt */ + case 468: /* having_clause_opt */ + case 469: /* select_item */ + case 471: /* partition_item */ + case 474: /* query_expression */ + case 475: /* query_simple */ + case 477: /* slimit_clause_opt */ + case 478: /* limit_clause_opt */ + case 479: /* union_query_expression */ + case 480: /* query_simple_or_subquery */ + case 482: /* sort_specification */ { -#line 7 "sql.y" - nodesDestroyNode((yypminor->yy164)); -#line 2784 "sql.c" + nodesDestroyNode((yypminor->yy242)); } break; - case 336: /* account_options */ - case 337: /* alter_account_options */ - case 339: /* alter_account_option */ - case 357: /* speed_opt */ - case 413: /* bufsize_opt */ + case 338: /* account_options */ + case 339: /* alter_account_options */ + case 341: /* alter_account_option */ + case 360: /* speed_opt */ + case 416: /* bufsize_opt */ { -#line 54 "sql.y" -#line 2795 "sql.c" } break; - case 340: /* user_name */ - case 347: /* db_name */ - case 348: /* table_name */ - case 349: /* topic_name */ - case 351: /* dnode_endpoint */ - case 375: /* column_name */ - case 389: /* function_name */ - case 397: /* column_alias */ - case 400: /* index_name */ - case 405: /* sma_func_name */ - case 407: /* cgroup_name */ - case 414: /* language_opt */ - case 415: /* stream_name */ - case 426: /* table_alias */ - case 432: /* star_func */ - case 434: /* noarg_func */ - case 452: /* alias_opt */ + case 342: /* user_name */ + case 349: /* db_name */ + case 350: /* table_name */ + case 351: /* topic_name */ + case 353: /* dnode_endpoint */ + case 378: /* column_name */ + case 392: /* function_name */ + case 400: /* column_alias */ + case 403: /* index_name */ + case 408: /* sma_func_name */ + case 410: /* cgroup_name */ + case 417: /* language_opt */ + case 418: /* stream_name */ + case 429: /* table_alias */ + case 435: /* star_func */ + case 437: /* noarg_func */ + case 455: /* alias_opt */ { -#line 728 "sql.y" -#line 2818 "sql.c" } break; - case 341: /* sysinfo_opt */ + case 343: /* sysinfo_opt */ { -#line 92 "sql.y" -#line 2825 "sql.c" } break; - case 342: /* privileges */ - case 345: /* priv_type_list */ - case 346: /* priv_type */ + case 344: /* privileges */ + case 347: /* priv_type_list */ + case 348: /* priv_type */ { -#line 101 "sql.y" -#line 2834 "sql.c" } break; - case 343: /* priv_level */ + case 345: /* priv_level */ { -#line 117 "sql.y" -#line 2841 "sql.c" } break; - case 352: /* force_opt */ - case 353: /* not_exists_opt */ - case 355: /* exists_opt */ - case 408: /* analyze_opt */ - case 411: /* or_replace_opt */ - case 412: /* agg_func_opt */ - case 420: /* ignore_opt */ - case 457: /* set_quantifier_opt */ + case 354: /* force_opt */ + case 355: /* unsafe_opt */ + case 356: /* not_exists_opt */ + case 358: /* exists_opt */ + case 411: /* analyze_opt */ + case 414: /* or_replace_opt */ + case 415: /* agg_func_opt */ + case 423: /* ignore_opt */ + case 460: /* set_quantifier_opt */ { -#line 144 "sql.y" -#line 2855 "sql.c" } break; - case 360: /* integer_list */ - case 361: /* variable_list */ - case 362: /* retention_list */ - case 367: /* column_def_list */ - case 368: /* tags_def_opt */ - case 370: /* multi_create_clause */ - case 371: /* tags_def */ - case 372: /* multi_drop_clause */ - case 379: /* specific_cols_opt */ - case 380: /* expression_list */ - case 382: /* col_name_list */ - case 384: /* duration_list */ - case 385: /* rollup_func_list */ - case 395: /* tag_list_opt */ - case 401: /* func_list */ - case 417: /* col_list_opt */ - case 418: /* tag_def_or_ref_opt */ - case 422: /* dnode_list */ - case 425: /* literal_list */ - case 433: /* star_func_para_list */ - case 435: /* other_para_list */ - case 437: /* when_then_list */ - case 458: /* select_list */ - case 459: /* partition_by_clause_opt */ - case 464: /* group_by_clause_opt */ - case 467: /* partition_list */ - case 470: /* group_by_list */ - case 473: /* order_by_clause_opt */ - case 478: /* sort_specification_list */ + case 363: /* integer_list */ + case 364: /* variable_list */ + case 365: /* retention_list */ + case 370: /* column_def_list */ + case 371: /* tags_def_opt */ + case 373: /* multi_create_clause */ + case 374: /* tags_def */ + case 375: /* multi_drop_clause */ + case 382: /* specific_cols_opt */ + case 383: /* expression_list */ + case 385: /* col_name_list */ + case 387: /* duration_list */ + case 388: /* rollup_func_list */ + case 398: /* tag_list_opt */ + case 404: /* func_list */ + case 420: /* col_list_opt */ + case 421: /* tag_def_or_ref_opt */ + case 425: /* dnode_list */ + case 428: /* literal_list */ + case 436: /* star_func_para_list */ + case 438: /* other_para_list */ + case 440: /* when_then_list */ + case 461: /* select_list */ + case 462: /* partition_by_clause_opt */ + case 467: /* group_by_clause_opt */ + case 470: /* partition_list */ + case 473: /* group_by_list */ + case 476: /* order_by_clause_opt */ + case 481: /* sort_specification_list */ { -#line 264 "sql.y" - nodesDestroyList((yypminor->yy72)); -#line 2890 "sql.c" + nodesDestroyList((yypminor->yy174)); } break; - case 364: /* alter_db_option */ - case 386: /* alter_table_option */ + case 367: /* alter_db_option */ + case 389: /* alter_table_option */ { -#line 237 "sql.y" -#line 2898 "sql.c" } break; - case 376: /* type_name */ + case 379: /* type_name */ { -#line 358 "sql.y" -#line 2905 "sql.c" } break; - case 442: /* compare_op */ - case 443: /* in_op */ + case 445: /* compare_op */ + case 446: /* in_op */ { -#line 916 "sql.y" -#line 2913 "sql.c" } break; - case 455: /* join_type */ + case 458: /* join_type */ { -#line 992 "sql.y" -#line 2920 "sql.c" } break; - case 469: /* fill_mode */ + case 472: /* fill_mode */ { -#line 1067 "sql.y" -#line 2927 "sql.c" } break; - case 480: /* ordering_specification_opt */ + case 483: /* ordering_specification_opt */ { -#line 1150 "sql.y" -#line 2934 "sql.c" } break; - case 481: /* null_ordering_opt */ + case 484: /* null_ordering_opt */ { -#line 1156 "sql.y" -#line 2941 "sql.c" } break; /********* End destructor definitions *****************************************/ @@ -3226,597 +3154,601 @@ static void yy_shift( /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side ** of that rule */ static const YYCODETYPE yyRuleInfoLhs[] = { - 335, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - 335, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - 336, /* (2) account_options ::= */ - 336, /* (3) account_options ::= account_options PPS literal */ - 336, /* (4) account_options ::= account_options TSERIES literal */ - 336, /* (5) account_options ::= account_options STORAGE literal */ - 336, /* (6) account_options ::= account_options STREAMS literal */ - 336, /* (7) account_options ::= account_options QTIME literal */ - 336, /* (8) account_options ::= account_options DBS literal */ - 336, /* (9) account_options ::= account_options USERS literal */ - 336, /* (10) account_options ::= account_options CONNS literal */ - 336, /* (11) account_options ::= account_options STATE literal */ - 337, /* (12) alter_account_options ::= alter_account_option */ - 337, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - 339, /* (14) alter_account_option ::= PASS literal */ - 339, /* (15) alter_account_option ::= PPS literal */ - 339, /* (16) alter_account_option ::= TSERIES literal */ - 339, /* (17) alter_account_option ::= STORAGE literal */ - 339, /* (18) alter_account_option ::= STREAMS literal */ - 339, /* (19) alter_account_option ::= QTIME literal */ - 339, /* (20) alter_account_option ::= DBS literal */ - 339, /* (21) alter_account_option ::= USERS literal */ - 339, /* (22) alter_account_option ::= CONNS literal */ - 339, /* (23) alter_account_option ::= STATE literal */ - 335, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ - 335, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ - 335, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - 335, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - 335, /* (28) cmd ::= DROP USER user_name */ - 341, /* (29) sysinfo_opt ::= */ - 341, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ - 335, /* (31) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ - 335, /* (32) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ - 342, /* (33) privileges ::= ALL */ - 342, /* (34) privileges ::= priv_type_list */ - 342, /* (35) privileges ::= SUBSCRIBE */ - 345, /* (36) priv_type_list ::= priv_type */ - 345, /* (37) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - 346, /* (38) priv_type ::= READ */ - 346, /* (39) priv_type ::= WRITE */ - 343, /* (40) priv_level ::= NK_STAR NK_DOT NK_STAR */ - 343, /* (41) priv_level ::= db_name NK_DOT NK_STAR */ - 343, /* (42) priv_level ::= db_name NK_DOT table_name */ - 343, /* (43) priv_level ::= topic_name */ - 344, /* (44) with_opt ::= */ - 344, /* (45) with_opt ::= WITH search_condition */ - 335, /* (46) cmd ::= CREATE DNODE dnode_endpoint */ - 335, /* (47) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - 335, /* (48) cmd ::= DROP DNODE NK_INTEGER force_opt */ - 335, /* (49) cmd ::= DROP DNODE dnode_endpoint force_opt */ - 335, /* (50) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - 335, /* (51) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - 335, /* (52) cmd ::= ALTER ALL DNODES NK_STRING */ - 335, /* (53) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - 335, /* (54) cmd ::= RESTORE DNODE NK_INTEGER */ - 351, /* (55) dnode_endpoint ::= NK_STRING */ - 351, /* (56) dnode_endpoint ::= NK_ID */ - 351, /* (57) dnode_endpoint ::= NK_IPTOKEN */ - 352, /* (58) force_opt ::= */ - 352, /* (59) force_opt ::= FORCE */ - 335, /* (60) cmd ::= ALTER LOCAL NK_STRING */ - 335, /* (61) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - 335, /* (62) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - 335, /* (63) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - 335, /* (64) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ - 335, /* (65) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - 335, /* (66) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - 335, /* (67) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - 335, /* (68) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - 335, /* (69) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - 335, /* (70) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - 335, /* (71) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ - 335, /* (72) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ - 335, /* (73) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - 335, /* (74) cmd ::= DROP DATABASE exists_opt db_name */ - 335, /* (75) cmd ::= USE db_name */ - 335, /* (76) cmd ::= ALTER DATABASE db_name alter_db_options */ - 335, /* (77) cmd ::= FLUSH DATABASE db_name */ - 335, /* (78) cmd ::= TRIM DATABASE db_name speed_opt */ - 335, /* (79) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ - 353, /* (80) not_exists_opt ::= IF NOT EXISTS */ - 353, /* (81) not_exists_opt ::= */ - 355, /* (82) exists_opt ::= IF EXISTS */ - 355, /* (83) exists_opt ::= */ - 354, /* (84) db_options ::= */ - 354, /* (85) db_options ::= db_options BUFFER NK_INTEGER */ - 354, /* (86) db_options ::= db_options CACHEMODEL NK_STRING */ - 354, /* (87) db_options ::= db_options CACHESIZE NK_INTEGER */ - 354, /* (88) db_options ::= db_options COMP NK_INTEGER */ - 354, /* (89) db_options ::= db_options DURATION NK_INTEGER */ - 354, /* (90) db_options ::= db_options DURATION NK_VARIABLE */ - 354, /* (91) db_options ::= db_options MAXROWS NK_INTEGER */ - 354, /* (92) db_options ::= db_options MINROWS NK_INTEGER */ - 354, /* (93) db_options ::= db_options KEEP integer_list */ - 354, /* (94) db_options ::= db_options KEEP variable_list */ - 354, /* (95) db_options ::= db_options PAGES NK_INTEGER */ - 354, /* (96) db_options ::= db_options PAGESIZE NK_INTEGER */ - 354, /* (97) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ - 354, /* (98) db_options ::= db_options PRECISION NK_STRING */ - 354, /* (99) db_options ::= db_options REPLICA NK_INTEGER */ - 354, /* (100) db_options ::= db_options VGROUPS NK_INTEGER */ - 354, /* (101) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - 354, /* (102) db_options ::= db_options RETENTIONS retention_list */ - 354, /* (103) db_options ::= db_options SCHEMALESS NK_INTEGER */ - 354, /* (104) db_options ::= db_options WAL_LEVEL NK_INTEGER */ - 354, /* (105) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ - 354, /* (106) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ - 354, /* (107) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - 354, /* (108) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ - 354, /* (109) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - 354, /* (110) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ - 354, /* (111) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ - 354, /* (112) db_options ::= db_options STT_TRIGGER NK_INTEGER */ - 354, /* (113) db_options ::= db_options TABLE_PREFIX signed */ - 354, /* (114) db_options ::= db_options TABLE_SUFFIX signed */ - 356, /* (115) alter_db_options ::= alter_db_option */ - 356, /* (116) alter_db_options ::= alter_db_options alter_db_option */ - 364, /* (117) alter_db_option ::= BUFFER NK_INTEGER */ - 364, /* (118) alter_db_option ::= CACHEMODEL NK_STRING */ - 364, /* (119) alter_db_option ::= CACHESIZE NK_INTEGER */ - 364, /* (120) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - 364, /* (121) alter_db_option ::= KEEP integer_list */ - 364, /* (122) alter_db_option ::= KEEP variable_list */ - 364, /* (123) alter_db_option ::= PAGES NK_INTEGER */ - 364, /* (124) alter_db_option ::= REPLICA NK_INTEGER */ - 364, /* (125) alter_db_option ::= WAL_LEVEL NK_INTEGER */ - 364, /* (126) alter_db_option ::= STT_TRIGGER NK_INTEGER */ - 364, /* (127) alter_db_option ::= MINROWS NK_INTEGER */ - 364, /* (128) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ - 364, /* (129) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - 364, /* (130) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ - 364, /* (131) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - 360, /* (132) integer_list ::= NK_INTEGER */ - 360, /* (133) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - 361, /* (134) variable_list ::= NK_VARIABLE */ - 361, /* (135) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - 362, /* (136) retention_list ::= retention */ - 362, /* (137) retention_list ::= retention_list NK_COMMA retention */ - 365, /* (138) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - 357, /* (139) speed_opt ::= */ - 357, /* (140) speed_opt ::= MAX_SPEED NK_INTEGER */ - 358, /* (141) start_opt ::= */ - 358, /* (142) start_opt ::= START WITH NK_INTEGER */ - 358, /* (143) start_opt ::= START WITH NK_STRING */ - 358, /* (144) start_opt ::= START WITH TIMESTAMP NK_STRING */ - 359, /* (145) end_opt ::= */ - 359, /* (146) end_opt ::= END WITH NK_INTEGER */ - 359, /* (147) end_opt ::= END WITH NK_STRING */ - 359, /* (148) end_opt ::= END WITH TIMESTAMP NK_STRING */ - 335, /* (149) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - 335, /* (150) cmd ::= CREATE TABLE multi_create_clause */ - 335, /* (151) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - 335, /* (152) cmd ::= DROP TABLE multi_drop_clause */ - 335, /* (153) cmd ::= DROP STABLE exists_opt full_table_name */ - 335, /* (154) cmd ::= ALTER TABLE alter_table_clause */ - 335, /* (155) cmd ::= ALTER STABLE alter_table_clause */ - 373, /* (156) alter_table_clause ::= full_table_name alter_table_options */ - 373, /* (157) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - 373, /* (158) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - 373, /* (159) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - 373, /* (160) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - 373, /* (161) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - 373, /* (162) alter_table_clause ::= full_table_name DROP TAG column_name */ - 373, /* (163) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - 373, /* (164) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - 373, /* (165) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - 370, /* (166) multi_create_clause ::= create_subtable_clause */ - 370, /* (167) multi_create_clause ::= multi_create_clause create_subtable_clause */ - 378, /* (168) 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 */ - 372, /* (169) multi_drop_clause ::= drop_table_clause */ - 372, /* (170) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - 381, /* (171) drop_table_clause ::= exists_opt full_table_name */ - 379, /* (172) specific_cols_opt ::= */ - 379, /* (173) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - 366, /* (174) full_table_name ::= table_name */ - 366, /* (175) full_table_name ::= db_name NK_DOT table_name */ - 367, /* (176) column_def_list ::= column_def */ - 367, /* (177) column_def_list ::= column_def_list NK_COMMA column_def */ - 383, /* (178) column_def ::= column_name type_name */ - 376, /* (179) type_name ::= BOOL */ - 376, /* (180) type_name ::= TINYINT */ - 376, /* (181) type_name ::= SMALLINT */ - 376, /* (182) type_name ::= INT */ - 376, /* (183) type_name ::= INTEGER */ - 376, /* (184) type_name ::= BIGINT */ - 376, /* (185) type_name ::= FLOAT */ - 376, /* (186) type_name ::= DOUBLE */ - 376, /* (187) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - 376, /* (188) type_name ::= TIMESTAMP */ - 376, /* (189) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - 376, /* (190) type_name ::= TINYINT UNSIGNED */ - 376, /* (191) type_name ::= SMALLINT UNSIGNED */ - 376, /* (192) type_name ::= INT UNSIGNED */ - 376, /* (193) type_name ::= BIGINT UNSIGNED */ - 376, /* (194) type_name ::= JSON */ - 376, /* (195) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - 376, /* (196) type_name ::= MEDIUMBLOB */ - 376, /* (197) type_name ::= BLOB */ - 376, /* (198) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - 376, /* (199) type_name ::= DECIMAL */ - 376, /* (200) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - 376, /* (201) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 368, /* (202) tags_def_opt ::= */ - 368, /* (203) tags_def_opt ::= tags_def */ - 371, /* (204) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - 369, /* (205) table_options ::= */ - 369, /* (206) table_options ::= table_options COMMENT NK_STRING */ - 369, /* (207) table_options ::= table_options MAX_DELAY duration_list */ - 369, /* (208) table_options ::= table_options WATERMARK duration_list */ - 369, /* (209) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - 369, /* (210) table_options ::= table_options TTL NK_INTEGER */ - 369, /* (211) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - 369, /* (212) table_options ::= table_options DELETE_MARK duration_list */ - 374, /* (213) alter_table_options ::= alter_table_option */ - 374, /* (214) alter_table_options ::= alter_table_options alter_table_option */ - 386, /* (215) alter_table_option ::= COMMENT NK_STRING */ - 386, /* (216) alter_table_option ::= TTL NK_INTEGER */ - 384, /* (217) duration_list ::= duration_literal */ - 384, /* (218) duration_list ::= duration_list NK_COMMA duration_literal */ - 385, /* (219) rollup_func_list ::= rollup_func_name */ - 385, /* (220) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - 388, /* (221) rollup_func_name ::= function_name */ - 388, /* (222) rollup_func_name ::= FIRST */ - 388, /* (223) rollup_func_name ::= LAST */ - 382, /* (224) col_name_list ::= col_name */ - 382, /* (225) col_name_list ::= col_name_list NK_COMMA col_name */ - 390, /* (226) col_name ::= column_name */ - 335, /* (227) cmd ::= SHOW DNODES */ - 335, /* (228) cmd ::= SHOW USERS */ - 335, /* (229) cmd ::= SHOW USER PRIVILEGES */ - 335, /* (230) cmd ::= SHOW DATABASES */ - 335, /* (231) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - 335, /* (232) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - 335, /* (233) cmd ::= SHOW db_name_cond_opt VGROUPS */ - 335, /* (234) cmd ::= SHOW MNODES */ - 335, /* (235) cmd ::= SHOW QNODES */ - 335, /* (236) cmd ::= SHOW FUNCTIONS */ - 335, /* (237) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - 335, /* (238) cmd ::= SHOW STREAMS */ - 335, /* (239) cmd ::= SHOW ACCOUNTS */ - 335, /* (240) cmd ::= SHOW APPS */ - 335, /* (241) cmd ::= SHOW CONNECTIONS */ - 335, /* (242) cmd ::= SHOW LICENCES */ - 335, /* (243) cmd ::= SHOW GRANTS */ - 335, /* (244) cmd ::= SHOW CREATE DATABASE db_name */ - 335, /* (245) cmd ::= SHOW CREATE TABLE full_table_name */ - 335, /* (246) cmd ::= SHOW CREATE STABLE full_table_name */ - 335, /* (247) cmd ::= SHOW QUERIES */ - 335, /* (248) cmd ::= SHOW SCORES */ - 335, /* (249) cmd ::= SHOW TOPICS */ - 335, /* (250) cmd ::= SHOW VARIABLES */ - 335, /* (251) cmd ::= SHOW CLUSTER VARIABLES */ - 335, /* (252) cmd ::= SHOW LOCAL VARIABLES */ - 335, /* (253) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - 335, /* (254) cmd ::= SHOW BNODES */ - 335, /* (255) cmd ::= SHOW SNODES */ - 335, /* (256) cmd ::= SHOW CLUSTER */ - 335, /* (257) cmd ::= SHOW TRANSACTIONS */ - 335, /* (258) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - 335, /* (259) cmd ::= SHOW CONSUMERS */ - 335, /* (260) cmd ::= SHOW SUBSCRIPTIONS */ - 335, /* (261) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - 335, /* (262) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - 335, /* (263) cmd ::= SHOW VNODES NK_INTEGER */ - 335, /* (264) cmd ::= SHOW VNODES NK_STRING */ - 335, /* (265) cmd ::= SHOW db_name_cond_opt ALIVE */ - 335, /* (266) cmd ::= SHOW CLUSTER ALIVE */ - 391, /* (267) db_name_cond_opt ::= */ - 391, /* (268) db_name_cond_opt ::= db_name NK_DOT */ - 392, /* (269) like_pattern_opt ::= */ - 392, /* (270) like_pattern_opt ::= LIKE NK_STRING */ - 393, /* (271) table_name_cond ::= table_name */ - 394, /* (272) from_db_opt ::= */ - 394, /* (273) from_db_opt ::= FROM db_name */ - 395, /* (274) tag_list_opt ::= */ - 395, /* (275) tag_list_opt ::= tag_item */ - 395, /* (276) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - 396, /* (277) tag_item ::= TBNAME */ - 396, /* (278) tag_item ::= QTAGS */ - 396, /* (279) tag_item ::= column_name */ - 396, /* (280) tag_item ::= column_name column_alias */ - 396, /* (281) tag_item ::= column_name AS column_alias */ - 335, /* (282) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ - 335, /* (283) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ - 335, /* (284) cmd ::= DROP INDEX exists_opt full_index_name */ - 398, /* (285) full_index_name ::= index_name */ - 398, /* (286) full_index_name ::= db_name NK_DOT index_name */ - 399, /* (287) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - 399, /* (288) 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 */ - 401, /* (289) func_list ::= func */ - 401, /* (290) func_list ::= func_list NK_COMMA func */ - 404, /* (291) func ::= sma_func_name NK_LP expression_list NK_RP */ - 405, /* (292) sma_func_name ::= function_name */ - 405, /* (293) sma_func_name ::= COUNT */ - 405, /* (294) sma_func_name ::= FIRST */ - 405, /* (295) sma_func_name ::= LAST */ - 405, /* (296) sma_func_name ::= LAST_ROW */ - 403, /* (297) sma_stream_opt ::= */ - 403, /* (298) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - 403, /* (299) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - 403, /* (300) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - 335, /* (301) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - 335, /* (302) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ - 335, /* (303) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ - 335, /* (304) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ - 335, /* (305) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ - 335, /* (306) cmd ::= DROP TOPIC exists_opt topic_name */ - 335, /* (307) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - 335, /* (308) cmd ::= DESC full_table_name */ - 335, /* (309) cmd ::= DESCRIBE full_table_name */ - 335, /* (310) cmd ::= RESET QUERY CACHE */ - 335, /* (311) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - 335, /* (312) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 408, /* (313) analyze_opt ::= */ - 408, /* (314) analyze_opt ::= ANALYZE */ - 409, /* (315) explain_options ::= */ - 409, /* (316) explain_options ::= explain_options VERBOSE NK_BOOL */ - 409, /* (317) explain_options ::= explain_options RATIO NK_FLOAT */ - 335, /* (318) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - 335, /* (319) cmd ::= DROP FUNCTION exists_opt function_name */ - 412, /* (320) agg_func_opt ::= */ - 412, /* (321) agg_func_opt ::= AGGREGATE */ - 413, /* (322) bufsize_opt ::= */ - 413, /* (323) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 414, /* (324) language_opt ::= */ - 414, /* (325) language_opt ::= LANGUAGE NK_STRING */ - 411, /* (326) or_replace_opt ::= */ - 411, /* (327) or_replace_opt ::= OR REPLACE */ - 335, /* (328) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ - 335, /* (329) cmd ::= DROP STREAM exists_opt stream_name */ - 335, /* (330) cmd ::= PAUSE STREAM exists_opt stream_name */ - 335, /* (331) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 417, /* (332) col_list_opt ::= */ - 417, /* (333) col_list_opt ::= NK_LP col_name_list NK_RP */ - 418, /* (334) tag_def_or_ref_opt ::= */ - 418, /* (335) tag_def_or_ref_opt ::= tags_def */ - 418, /* (336) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - 416, /* (337) stream_options ::= */ - 416, /* (338) stream_options ::= stream_options TRIGGER AT_ONCE */ - 416, /* (339) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - 416, /* (340) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - 416, /* (341) stream_options ::= stream_options WATERMARK duration_literal */ - 416, /* (342) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - 416, /* (343) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - 416, /* (344) stream_options ::= stream_options DELETE_MARK duration_literal */ - 416, /* (345) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 419, /* (346) subtable_opt ::= */ - 419, /* (347) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 420, /* (348) ignore_opt ::= */ - 420, /* (349) ignore_opt ::= IGNORE UNTREATED */ - 335, /* (350) cmd ::= KILL CONNECTION NK_INTEGER */ - 335, /* (351) cmd ::= KILL QUERY NK_STRING */ - 335, /* (352) cmd ::= KILL TRANSACTION NK_INTEGER */ - 335, /* (353) cmd ::= BALANCE VGROUP */ - 335, /* (354) cmd ::= BALANCE VGROUP LEADER */ - 335, /* (355) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - 335, /* (356) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - 335, /* (357) cmd ::= SPLIT VGROUP NK_INTEGER */ - 422, /* (358) dnode_list ::= DNODE NK_INTEGER */ - 422, /* (359) dnode_list ::= dnode_list DNODE NK_INTEGER */ - 335, /* (360) cmd ::= DELETE FROM full_table_name where_clause_opt */ - 335, /* (361) cmd ::= query_or_subquery */ - 335, /* (362) cmd ::= insert_query */ - 410, /* (363) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - 410, /* (364) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - 338, /* (365) literal ::= NK_INTEGER */ - 338, /* (366) literal ::= NK_FLOAT */ - 338, /* (367) literal ::= NK_STRING */ - 338, /* (368) literal ::= NK_BOOL */ - 338, /* (369) literal ::= TIMESTAMP NK_STRING */ - 338, /* (370) literal ::= duration_literal */ - 338, /* (371) literal ::= NULL */ - 338, /* (372) literal ::= NK_QUESTION */ - 387, /* (373) duration_literal ::= NK_VARIABLE */ - 363, /* (374) signed ::= NK_INTEGER */ - 363, /* (375) signed ::= NK_PLUS NK_INTEGER */ - 363, /* (376) signed ::= NK_MINUS NK_INTEGER */ - 363, /* (377) signed ::= NK_FLOAT */ - 363, /* (378) signed ::= NK_PLUS NK_FLOAT */ - 363, /* (379) signed ::= NK_MINUS NK_FLOAT */ - 377, /* (380) signed_literal ::= signed */ - 377, /* (381) signed_literal ::= NK_STRING */ - 377, /* (382) signed_literal ::= NK_BOOL */ - 377, /* (383) signed_literal ::= TIMESTAMP NK_STRING */ - 377, /* (384) signed_literal ::= duration_literal */ - 377, /* (385) signed_literal ::= NULL */ - 377, /* (386) signed_literal ::= literal_func */ - 377, /* (387) signed_literal ::= NK_QUESTION */ - 425, /* (388) literal_list ::= signed_literal */ - 425, /* (389) literal_list ::= literal_list NK_COMMA signed_literal */ - 347, /* (390) db_name ::= NK_ID */ - 348, /* (391) table_name ::= NK_ID */ - 375, /* (392) column_name ::= NK_ID */ - 389, /* (393) function_name ::= NK_ID */ - 426, /* (394) table_alias ::= NK_ID */ - 397, /* (395) column_alias ::= NK_ID */ - 340, /* (396) user_name ::= NK_ID */ - 349, /* (397) topic_name ::= NK_ID */ - 415, /* (398) stream_name ::= NK_ID */ - 407, /* (399) cgroup_name ::= NK_ID */ - 400, /* (400) index_name ::= NK_ID */ - 427, /* (401) expr_or_subquery ::= expression */ - 421, /* (402) expression ::= literal */ - 421, /* (403) expression ::= pseudo_column */ - 421, /* (404) expression ::= column_reference */ - 421, /* (405) expression ::= function_expression */ - 421, /* (406) expression ::= case_when_expression */ - 421, /* (407) expression ::= NK_LP expression NK_RP */ - 421, /* (408) expression ::= NK_PLUS expr_or_subquery */ - 421, /* (409) expression ::= NK_MINUS expr_or_subquery */ - 421, /* (410) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - 421, /* (411) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - 421, /* (412) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - 421, /* (413) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - 421, /* (414) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - 421, /* (415) expression ::= column_reference NK_ARROW NK_STRING */ - 421, /* (416) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - 421, /* (417) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - 380, /* (418) expression_list ::= expr_or_subquery */ - 380, /* (419) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - 429, /* (420) column_reference ::= column_name */ - 429, /* (421) column_reference ::= table_name NK_DOT column_name */ - 428, /* (422) pseudo_column ::= ROWTS */ - 428, /* (423) pseudo_column ::= TBNAME */ - 428, /* (424) pseudo_column ::= table_name NK_DOT TBNAME */ - 428, /* (425) pseudo_column ::= QSTART */ - 428, /* (426) pseudo_column ::= QEND */ - 428, /* (427) pseudo_column ::= QDURATION */ - 428, /* (428) pseudo_column ::= WSTART */ - 428, /* (429) pseudo_column ::= WEND */ - 428, /* (430) pseudo_column ::= WDURATION */ - 428, /* (431) pseudo_column ::= IROWTS */ - 428, /* (432) pseudo_column ::= ISFILLED */ - 428, /* (433) pseudo_column ::= QTAGS */ - 430, /* (434) function_expression ::= function_name NK_LP expression_list NK_RP */ - 430, /* (435) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - 430, /* (436) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - 430, /* (437) function_expression ::= literal_func */ - 424, /* (438) literal_func ::= noarg_func NK_LP NK_RP */ - 424, /* (439) literal_func ::= NOW */ - 434, /* (440) noarg_func ::= NOW */ - 434, /* (441) noarg_func ::= TODAY */ - 434, /* (442) noarg_func ::= TIMEZONE */ - 434, /* (443) noarg_func ::= DATABASE */ - 434, /* (444) noarg_func ::= CLIENT_VERSION */ - 434, /* (445) noarg_func ::= SERVER_VERSION */ - 434, /* (446) noarg_func ::= SERVER_STATUS */ - 434, /* (447) noarg_func ::= CURRENT_USER */ - 434, /* (448) noarg_func ::= USER */ - 432, /* (449) star_func ::= COUNT */ - 432, /* (450) star_func ::= FIRST */ - 432, /* (451) star_func ::= LAST */ - 432, /* (452) star_func ::= LAST_ROW */ - 433, /* (453) star_func_para_list ::= NK_STAR */ - 433, /* (454) star_func_para_list ::= other_para_list */ - 435, /* (455) other_para_list ::= star_func_para */ - 435, /* (456) other_para_list ::= other_para_list NK_COMMA star_func_para */ - 436, /* (457) star_func_para ::= expr_or_subquery */ - 436, /* (458) star_func_para ::= table_name NK_DOT NK_STAR */ - 431, /* (459) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - 431, /* (460) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - 437, /* (461) when_then_list ::= when_then_expr */ - 437, /* (462) when_then_list ::= when_then_list when_then_expr */ - 440, /* (463) when_then_expr ::= WHEN common_expression THEN common_expression */ - 438, /* (464) case_when_else_opt ::= */ - 438, /* (465) case_when_else_opt ::= ELSE common_expression */ - 441, /* (466) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - 441, /* (467) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - 441, /* (468) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - 441, /* (469) predicate ::= expr_or_subquery IS NULL */ - 441, /* (470) predicate ::= expr_or_subquery IS NOT NULL */ - 441, /* (471) predicate ::= expr_or_subquery in_op in_predicate_value */ - 442, /* (472) compare_op ::= NK_LT */ - 442, /* (473) compare_op ::= NK_GT */ - 442, /* (474) compare_op ::= NK_LE */ - 442, /* (475) compare_op ::= NK_GE */ - 442, /* (476) compare_op ::= NK_NE */ - 442, /* (477) compare_op ::= NK_EQ */ - 442, /* (478) compare_op ::= LIKE */ - 442, /* (479) compare_op ::= NOT LIKE */ - 442, /* (480) compare_op ::= MATCH */ - 442, /* (481) compare_op ::= NMATCH */ - 442, /* (482) compare_op ::= CONTAINS */ - 443, /* (483) in_op ::= IN */ - 443, /* (484) in_op ::= NOT IN */ - 444, /* (485) in_predicate_value ::= NK_LP literal_list NK_RP */ - 445, /* (486) boolean_value_expression ::= boolean_primary */ - 445, /* (487) boolean_value_expression ::= NOT boolean_primary */ - 445, /* (488) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - 445, /* (489) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - 446, /* (490) boolean_primary ::= predicate */ - 446, /* (491) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - 439, /* (492) common_expression ::= expr_or_subquery */ - 439, /* (493) common_expression ::= boolean_value_expression */ - 447, /* (494) from_clause_opt ::= */ - 447, /* (495) from_clause_opt ::= FROM table_reference_list */ - 448, /* (496) table_reference_list ::= table_reference */ - 448, /* (497) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - 449, /* (498) table_reference ::= table_primary */ - 449, /* (499) table_reference ::= joined_table */ - 450, /* (500) table_primary ::= table_name alias_opt */ - 450, /* (501) table_primary ::= db_name NK_DOT table_name alias_opt */ - 450, /* (502) table_primary ::= subquery alias_opt */ - 450, /* (503) table_primary ::= parenthesized_joined_table */ - 452, /* (504) alias_opt ::= */ - 452, /* (505) alias_opt ::= table_alias */ - 452, /* (506) alias_opt ::= AS table_alias */ - 454, /* (507) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - 454, /* (508) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - 451, /* (509) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - 455, /* (510) join_type ::= */ - 455, /* (511) join_type ::= INNER */ - 456, /* (512) 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 */ - 457, /* (513) set_quantifier_opt ::= */ - 457, /* (514) set_quantifier_opt ::= DISTINCT */ - 457, /* (515) set_quantifier_opt ::= ALL */ - 458, /* (516) select_list ::= select_item */ - 458, /* (517) select_list ::= select_list NK_COMMA select_item */ - 466, /* (518) select_item ::= NK_STAR */ - 466, /* (519) select_item ::= common_expression */ - 466, /* (520) select_item ::= common_expression column_alias */ - 466, /* (521) select_item ::= common_expression AS column_alias */ - 466, /* (522) select_item ::= table_name NK_DOT NK_STAR */ - 423, /* (523) where_clause_opt ::= */ - 423, /* (524) where_clause_opt ::= WHERE search_condition */ - 459, /* (525) partition_by_clause_opt ::= */ - 459, /* (526) partition_by_clause_opt ::= PARTITION BY partition_list */ - 467, /* (527) partition_list ::= partition_item */ - 467, /* (528) partition_list ::= partition_list NK_COMMA partition_item */ - 468, /* (529) partition_item ::= expr_or_subquery */ - 468, /* (530) partition_item ::= expr_or_subquery column_alias */ - 468, /* (531) partition_item ::= expr_or_subquery AS column_alias */ - 463, /* (532) twindow_clause_opt ::= */ - 463, /* (533) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - 463, /* (534) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - 463, /* (535) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - 463, /* (536) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - 463, /* (537) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 402, /* (538) sliding_opt ::= */ - 402, /* (539) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - 462, /* (540) fill_opt ::= */ - 462, /* (541) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - 462, /* (542) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - 462, /* (543) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - 469, /* (544) fill_mode ::= NONE */ - 469, /* (545) fill_mode ::= PREV */ - 469, /* (546) fill_mode ::= NULL */ - 469, /* (547) fill_mode ::= NULL_F */ - 469, /* (548) fill_mode ::= LINEAR */ - 469, /* (549) fill_mode ::= NEXT */ - 464, /* (550) group_by_clause_opt ::= */ - 464, /* (551) group_by_clause_opt ::= GROUP BY group_by_list */ - 470, /* (552) group_by_list ::= expr_or_subquery */ - 470, /* (553) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 465, /* (554) having_clause_opt ::= */ - 465, /* (555) having_clause_opt ::= HAVING search_condition */ - 460, /* (556) range_opt ::= */ - 460, /* (557) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - 461, /* (558) every_opt ::= */ - 461, /* (559) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - 471, /* (560) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - 472, /* (561) query_simple ::= query_specification */ - 472, /* (562) query_simple ::= union_query_expression */ - 476, /* (563) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - 476, /* (564) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - 477, /* (565) query_simple_or_subquery ::= query_simple */ - 477, /* (566) query_simple_or_subquery ::= subquery */ - 406, /* (567) query_or_subquery ::= query_expression */ - 406, /* (568) query_or_subquery ::= subquery */ - 473, /* (569) order_by_clause_opt ::= */ - 473, /* (570) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 474, /* (571) slimit_clause_opt ::= */ - 474, /* (572) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - 474, /* (573) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - 474, /* (574) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 475, /* (575) limit_clause_opt ::= */ - 475, /* (576) limit_clause_opt ::= LIMIT NK_INTEGER */ - 475, /* (577) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - 475, /* (578) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 453, /* (579) subquery ::= NK_LP query_expression NK_RP */ - 453, /* (580) subquery ::= NK_LP subquery NK_RP */ - 350, /* (581) search_condition ::= common_expression */ - 478, /* (582) sort_specification_list ::= sort_specification */ - 478, /* (583) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - 479, /* (584) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 480, /* (585) ordering_specification_opt ::= */ - 480, /* (586) ordering_specification_opt ::= ASC */ - 480, /* (587) ordering_specification_opt ::= DESC */ - 481, /* (588) null_ordering_opt ::= */ - 481, /* (589) null_ordering_opt ::= NULLS FIRST */ - 481, /* (590) null_ordering_opt ::= NULLS LAST */ + 337, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + 337, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + 338, /* (2) account_options ::= */ + 338, /* (3) account_options ::= account_options PPS literal */ + 338, /* (4) account_options ::= account_options TSERIES literal */ + 338, /* (5) account_options ::= account_options STORAGE literal */ + 338, /* (6) account_options ::= account_options STREAMS literal */ + 338, /* (7) account_options ::= account_options QTIME literal */ + 338, /* (8) account_options ::= account_options DBS literal */ + 338, /* (9) account_options ::= account_options USERS literal */ + 338, /* (10) account_options ::= account_options CONNS literal */ + 338, /* (11) account_options ::= account_options STATE literal */ + 339, /* (12) alter_account_options ::= alter_account_option */ + 339, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + 341, /* (14) alter_account_option ::= PASS literal */ + 341, /* (15) alter_account_option ::= PPS literal */ + 341, /* (16) alter_account_option ::= TSERIES literal */ + 341, /* (17) alter_account_option ::= STORAGE literal */ + 341, /* (18) alter_account_option ::= STREAMS literal */ + 341, /* (19) alter_account_option ::= QTIME literal */ + 341, /* (20) alter_account_option ::= DBS literal */ + 341, /* (21) alter_account_option ::= USERS literal */ + 341, /* (22) alter_account_option ::= CONNS literal */ + 341, /* (23) alter_account_option ::= STATE literal */ + 337, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ + 337, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ + 337, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ + 337, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ + 337, /* (28) cmd ::= DROP USER user_name */ + 343, /* (29) sysinfo_opt ::= */ + 343, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ + 337, /* (31) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ + 337, /* (32) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ + 344, /* (33) privileges ::= ALL */ + 344, /* (34) privileges ::= priv_type_list */ + 344, /* (35) privileges ::= SUBSCRIBE */ + 347, /* (36) priv_type_list ::= priv_type */ + 347, /* (37) priv_type_list ::= priv_type_list NK_COMMA priv_type */ + 348, /* (38) priv_type ::= READ */ + 348, /* (39) priv_type ::= WRITE */ + 345, /* (40) priv_level ::= NK_STAR NK_DOT NK_STAR */ + 345, /* (41) priv_level ::= db_name NK_DOT NK_STAR */ + 345, /* (42) priv_level ::= db_name NK_DOT table_name */ + 345, /* (43) priv_level ::= topic_name */ + 346, /* (44) with_opt ::= */ + 346, /* (45) with_opt ::= WITH search_condition */ + 337, /* (46) cmd ::= CREATE DNODE dnode_endpoint */ + 337, /* (47) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ + 337, /* (48) cmd ::= DROP DNODE NK_INTEGER force_opt */ + 337, /* (49) cmd ::= DROP DNODE dnode_endpoint force_opt */ + 337, /* (50) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ + 337, /* (51) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ + 337, /* (52) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + 337, /* (53) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + 337, /* (54) cmd ::= ALTER ALL DNODES NK_STRING */ + 337, /* (55) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + 337, /* (56) cmd ::= RESTORE DNODE NK_INTEGER */ + 353, /* (57) dnode_endpoint ::= NK_STRING */ + 353, /* (58) dnode_endpoint ::= NK_ID */ + 353, /* (59) dnode_endpoint ::= NK_IPTOKEN */ + 354, /* (60) force_opt ::= */ + 354, /* (61) force_opt ::= FORCE */ + 355, /* (62) unsafe_opt ::= UNSAFE */ + 337, /* (63) cmd ::= ALTER LOCAL NK_STRING */ + 337, /* (64) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + 337, /* (65) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + 337, /* (66) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + 337, /* (67) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ + 337, /* (68) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + 337, /* (69) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + 337, /* (70) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + 337, /* (71) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + 337, /* (72) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + 337, /* (73) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + 337, /* (74) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ + 337, /* (75) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ + 337, /* (76) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + 337, /* (77) cmd ::= DROP DATABASE exists_opt db_name */ + 337, /* (78) cmd ::= USE db_name */ + 337, /* (79) cmd ::= ALTER DATABASE db_name alter_db_options */ + 337, /* (80) cmd ::= FLUSH DATABASE db_name */ + 337, /* (81) cmd ::= TRIM DATABASE db_name speed_opt */ + 337, /* (82) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ + 356, /* (83) not_exists_opt ::= IF NOT EXISTS */ + 356, /* (84) not_exists_opt ::= */ + 358, /* (85) exists_opt ::= IF EXISTS */ + 358, /* (86) exists_opt ::= */ + 357, /* (87) db_options ::= */ + 357, /* (88) db_options ::= db_options BUFFER NK_INTEGER */ + 357, /* (89) db_options ::= db_options CACHEMODEL NK_STRING */ + 357, /* (90) db_options ::= db_options CACHESIZE NK_INTEGER */ + 357, /* (91) db_options ::= db_options COMP NK_INTEGER */ + 357, /* (92) db_options ::= db_options DURATION NK_INTEGER */ + 357, /* (93) db_options ::= db_options DURATION NK_VARIABLE */ + 357, /* (94) db_options ::= db_options MAXROWS NK_INTEGER */ + 357, /* (95) db_options ::= db_options MINROWS NK_INTEGER */ + 357, /* (96) db_options ::= db_options KEEP integer_list */ + 357, /* (97) db_options ::= db_options KEEP variable_list */ + 357, /* (98) db_options ::= db_options PAGES NK_INTEGER */ + 357, /* (99) db_options ::= db_options PAGESIZE NK_INTEGER */ + 357, /* (100) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ + 357, /* (101) db_options ::= db_options PRECISION NK_STRING */ + 357, /* (102) db_options ::= db_options REPLICA NK_INTEGER */ + 357, /* (103) db_options ::= db_options VGROUPS NK_INTEGER */ + 357, /* (104) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + 357, /* (105) db_options ::= db_options RETENTIONS retention_list */ + 357, /* (106) db_options ::= db_options SCHEMALESS NK_INTEGER */ + 357, /* (107) db_options ::= db_options WAL_LEVEL NK_INTEGER */ + 357, /* (108) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ + 357, /* (109) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ + 357, /* (110) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + 357, /* (111) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ + 357, /* (112) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + 357, /* (113) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ + 357, /* (114) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ + 357, /* (115) db_options ::= db_options STT_TRIGGER NK_INTEGER */ + 357, /* (116) db_options ::= db_options TABLE_PREFIX signed */ + 357, /* (117) db_options ::= db_options TABLE_SUFFIX signed */ + 359, /* (118) alter_db_options ::= alter_db_option */ + 359, /* (119) alter_db_options ::= alter_db_options alter_db_option */ + 367, /* (120) alter_db_option ::= BUFFER NK_INTEGER */ + 367, /* (121) alter_db_option ::= CACHEMODEL NK_STRING */ + 367, /* (122) alter_db_option ::= CACHESIZE NK_INTEGER */ + 367, /* (123) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ + 367, /* (124) alter_db_option ::= KEEP integer_list */ + 367, /* (125) alter_db_option ::= KEEP variable_list */ + 367, /* (126) alter_db_option ::= PAGES NK_INTEGER */ + 367, /* (127) alter_db_option ::= REPLICA NK_INTEGER */ + 367, /* (128) alter_db_option ::= WAL_LEVEL NK_INTEGER */ + 367, /* (129) alter_db_option ::= STT_TRIGGER NK_INTEGER */ + 367, /* (130) alter_db_option ::= MINROWS NK_INTEGER */ + 367, /* (131) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ + 367, /* (132) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + 367, /* (133) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ + 367, /* (134) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + 363, /* (135) integer_list ::= NK_INTEGER */ + 363, /* (136) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + 364, /* (137) variable_list ::= NK_VARIABLE */ + 364, /* (138) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + 365, /* (139) retention_list ::= retention */ + 365, /* (140) retention_list ::= retention_list NK_COMMA retention */ + 368, /* (141) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + 360, /* (142) speed_opt ::= */ + 360, /* (143) speed_opt ::= MAX_SPEED NK_INTEGER */ + 361, /* (144) start_opt ::= */ + 361, /* (145) start_opt ::= START WITH NK_INTEGER */ + 361, /* (146) start_opt ::= START WITH NK_STRING */ + 361, /* (147) start_opt ::= START WITH TIMESTAMP NK_STRING */ + 362, /* (148) end_opt ::= */ + 362, /* (149) end_opt ::= END WITH NK_INTEGER */ + 362, /* (150) end_opt ::= END WITH NK_STRING */ + 362, /* (151) end_opt ::= END WITH TIMESTAMP NK_STRING */ + 337, /* (152) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + 337, /* (153) cmd ::= CREATE TABLE multi_create_clause */ + 337, /* (154) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + 337, /* (155) cmd ::= DROP TABLE multi_drop_clause */ + 337, /* (156) cmd ::= DROP STABLE exists_opt full_table_name */ + 337, /* (157) cmd ::= ALTER TABLE alter_table_clause */ + 337, /* (158) cmd ::= ALTER STABLE alter_table_clause */ + 376, /* (159) alter_table_clause ::= full_table_name alter_table_options */ + 376, /* (160) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + 376, /* (161) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + 376, /* (162) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + 376, /* (163) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + 376, /* (164) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + 376, /* (165) alter_table_clause ::= full_table_name DROP TAG column_name */ + 376, /* (166) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + 376, /* (167) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + 376, /* (168) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + 373, /* (169) multi_create_clause ::= create_subtable_clause */ + 373, /* (170) multi_create_clause ::= multi_create_clause create_subtable_clause */ + 381, /* (171) 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 */ + 375, /* (172) multi_drop_clause ::= drop_table_clause */ + 375, /* (173) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ + 384, /* (174) drop_table_clause ::= exists_opt full_table_name */ + 382, /* (175) specific_cols_opt ::= */ + 382, /* (176) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + 369, /* (177) full_table_name ::= table_name */ + 369, /* (178) full_table_name ::= db_name NK_DOT table_name */ + 370, /* (179) column_def_list ::= column_def */ + 370, /* (180) column_def_list ::= column_def_list NK_COMMA column_def */ + 386, /* (181) column_def ::= column_name type_name */ + 379, /* (182) type_name ::= BOOL */ + 379, /* (183) type_name ::= TINYINT */ + 379, /* (184) type_name ::= SMALLINT */ + 379, /* (185) type_name ::= INT */ + 379, /* (186) type_name ::= INTEGER */ + 379, /* (187) type_name ::= BIGINT */ + 379, /* (188) type_name ::= FLOAT */ + 379, /* (189) type_name ::= DOUBLE */ + 379, /* (190) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + 379, /* (191) type_name ::= TIMESTAMP */ + 379, /* (192) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + 379, /* (193) type_name ::= TINYINT UNSIGNED */ + 379, /* (194) type_name ::= SMALLINT UNSIGNED */ + 379, /* (195) type_name ::= INT UNSIGNED */ + 379, /* (196) type_name ::= BIGINT UNSIGNED */ + 379, /* (197) type_name ::= JSON */ + 379, /* (198) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + 379, /* (199) type_name ::= MEDIUMBLOB */ + 379, /* (200) type_name ::= BLOB */ + 379, /* (201) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + 379, /* (202) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + 379, /* (203) type_name ::= DECIMAL */ + 379, /* (204) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + 379, /* (205) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 371, /* (206) tags_def_opt ::= */ + 371, /* (207) tags_def_opt ::= tags_def */ + 374, /* (208) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + 372, /* (209) table_options ::= */ + 372, /* (210) table_options ::= table_options COMMENT NK_STRING */ + 372, /* (211) table_options ::= table_options MAX_DELAY duration_list */ + 372, /* (212) table_options ::= table_options WATERMARK duration_list */ + 372, /* (213) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + 372, /* (214) table_options ::= table_options TTL NK_INTEGER */ + 372, /* (215) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + 372, /* (216) table_options ::= table_options DELETE_MARK duration_list */ + 377, /* (217) alter_table_options ::= alter_table_option */ + 377, /* (218) alter_table_options ::= alter_table_options alter_table_option */ + 389, /* (219) alter_table_option ::= COMMENT NK_STRING */ + 389, /* (220) alter_table_option ::= TTL NK_INTEGER */ + 387, /* (221) duration_list ::= duration_literal */ + 387, /* (222) duration_list ::= duration_list NK_COMMA duration_literal */ + 388, /* (223) rollup_func_list ::= rollup_func_name */ + 388, /* (224) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + 391, /* (225) rollup_func_name ::= function_name */ + 391, /* (226) rollup_func_name ::= FIRST */ + 391, /* (227) rollup_func_name ::= LAST */ + 385, /* (228) col_name_list ::= col_name */ + 385, /* (229) col_name_list ::= col_name_list NK_COMMA col_name */ + 393, /* (230) col_name ::= column_name */ + 337, /* (231) cmd ::= SHOW DNODES */ + 337, /* (232) cmd ::= SHOW USERS */ + 337, /* (233) cmd ::= SHOW USER PRIVILEGES */ + 337, /* (234) cmd ::= SHOW DATABASES */ + 337, /* (235) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + 337, /* (236) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + 337, /* (237) cmd ::= SHOW db_name_cond_opt VGROUPS */ + 337, /* (238) cmd ::= SHOW MNODES */ + 337, /* (239) cmd ::= SHOW QNODES */ + 337, /* (240) cmd ::= SHOW FUNCTIONS */ + 337, /* (241) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + 337, /* (242) cmd ::= SHOW STREAMS */ + 337, /* (243) cmd ::= SHOW ACCOUNTS */ + 337, /* (244) cmd ::= SHOW APPS */ + 337, /* (245) cmd ::= SHOW CONNECTIONS */ + 337, /* (246) cmd ::= SHOW LICENCES */ + 337, /* (247) cmd ::= SHOW GRANTS */ + 337, /* (248) cmd ::= SHOW CREATE DATABASE db_name */ + 337, /* (249) cmd ::= SHOW CREATE TABLE full_table_name */ + 337, /* (250) cmd ::= SHOW CREATE STABLE full_table_name */ + 337, /* (251) cmd ::= SHOW QUERIES */ + 337, /* (252) cmd ::= SHOW SCORES */ + 337, /* (253) cmd ::= SHOW TOPICS */ + 337, /* (254) cmd ::= SHOW VARIABLES */ + 337, /* (255) cmd ::= SHOW CLUSTER VARIABLES */ + 337, /* (256) cmd ::= SHOW LOCAL VARIABLES */ + 337, /* (257) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + 337, /* (258) cmd ::= SHOW BNODES */ + 337, /* (259) cmd ::= SHOW SNODES */ + 337, /* (260) cmd ::= SHOW CLUSTER */ + 337, /* (261) cmd ::= SHOW TRANSACTIONS */ + 337, /* (262) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + 337, /* (263) cmd ::= SHOW CONSUMERS */ + 337, /* (264) cmd ::= SHOW SUBSCRIPTIONS */ + 337, /* (265) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + 337, /* (266) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + 337, /* (267) cmd ::= SHOW VNODES NK_INTEGER */ + 337, /* (268) cmd ::= SHOW VNODES NK_STRING */ + 337, /* (269) cmd ::= SHOW db_name_cond_opt ALIVE */ + 337, /* (270) cmd ::= SHOW CLUSTER ALIVE */ + 394, /* (271) db_name_cond_opt ::= */ + 394, /* (272) db_name_cond_opt ::= db_name NK_DOT */ + 395, /* (273) like_pattern_opt ::= */ + 395, /* (274) like_pattern_opt ::= LIKE NK_STRING */ + 396, /* (275) table_name_cond ::= table_name */ + 397, /* (276) from_db_opt ::= */ + 397, /* (277) from_db_opt ::= FROM db_name */ + 398, /* (278) tag_list_opt ::= */ + 398, /* (279) tag_list_opt ::= tag_item */ + 398, /* (280) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + 399, /* (281) tag_item ::= TBNAME */ + 399, /* (282) tag_item ::= QTAGS */ + 399, /* (283) tag_item ::= column_name */ + 399, /* (284) tag_item ::= column_name column_alias */ + 399, /* (285) tag_item ::= column_name AS column_alias */ + 337, /* (286) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ + 337, /* (287) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ + 337, /* (288) cmd ::= DROP INDEX exists_opt full_index_name */ + 401, /* (289) full_index_name ::= index_name */ + 401, /* (290) full_index_name ::= db_name NK_DOT index_name */ + 402, /* (291) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + 402, /* (292) 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 */ + 404, /* (293) func_list ::= func */ + 404, /* (294) func_list ::= func_list NK_COMMA func */ + 407, /* (295) func ::= sma_func_name NK_LP expression_list NK_RP */ + 408, /* (296) sma_func_name ::= function_name */ + 408, /* (297) sma_func_name ::= COUNT */ + 408, /* (298) sma_func_name ::= FIRST */ + 408, /* (299) sma_func_name ::= LAST */ + 408, /* (300) sma_func_name ::= LAST_ROW */ + 406, /* (301) sma_stream_opt ::= */ + 406, /* (302) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + 406, /* (303) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + 406, /* (304) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + 337, /* (305) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + 337, /* (306) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + 337, /* (307) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + 337, /* (308) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + 337, /* (309) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + 337, /* (310) cmd ::= DROP TOPIC exists_opt topic_name */ + 337, /* (311) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + 337, /* (312) cmd ::= DESC full_table_name */ + 337, /* (313) cmd ::= DESCRIBE full_table_name */ + 337, /* (314) cmd ::= RESET QUERY CACHE */ + 337, /* (315) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + 337, /* (316) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 411, /* (317) analyze_opt ::= */ + 411, /* (318) analyze_opt ::= ANALYZE */ + 412, /* (319) explain_options ::= */ + 412, /* (320) explain_options ::= explain_options VERBOSE NK_BOOL */ + 412, /* (321) explain_options ::= explain_options RATIO NK_FLOAT */ + 337, /* (322) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + 337, /* (323) cmd ::= DROP FUNCTION exists_opt function_name */ + 415, /* (324) agg_func_opt ::= */ + 415, /* (325) agg_func_opt ::= AGGREGATE */ + 416, /* (326) bufsize_opt ::= */ + 416, /* (327) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 417, /* (328) language_opt ::= */ + 417, /* (329) language_opt ::= LANGUAGE NK_STRING */ + 414, /* (330) or_replace_opt ::= */ + 414, /* (331) or_replace_opt ::= OR REPLACE */ + 337, /* (332) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ + 337, /* (333) cmd ::= DROP STREAM exists_opt stream_name */ + 337, /* (334) cmd ::= PAUSE STREAM exists_opt stream_name */ + 337, /* (335) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 420, /* (336) col_list_opt ::= */ + 420, /* (337) col_list_opt ::= NK_LP col_name_list NK_RP */ + 421, /* (338) tag_def_or_ref_opt ::= */ + 421, /* (339) tag_def_or_ref_opt ::= tags_def */ + 421, /* (340) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ + 419, /* (341) stream_options ::= */ + 419, /* (342) stream_options ::= stream_options TRIGGER AT_ONCE */ + 419, /* (343) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + 419, /* (344) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + 419, /* (345) stream_options ::= stream_options WATERMARK duration_literal */ + 419, /* (346) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + 419, /* (347) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + 419, /* (348) stream_options ::= stream_options DELETE_MARK duration_literal */ + 419, /* (349) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 422, /* (350) subtable_opt ::= */ + 422, /* (351) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 423, /* (352) ignore_opt ::= */ + 423, /* (353) ignore_opt ::= IGNORE UNTREATED */ + 337, /* (354) cmd ::= KILL CONNECTION NK_INTEGER */ + 337, /* (355) cmd ::= KILL QUERY NK_STRING */ + 337, /* (356) cmd ::= KILL TRANSACTION NK_INTEGER */ + 337, /* (357) cmd ::= BALANCE VGROUP */ + 337, /* (358) cmd ::= BALANCE VGROUP LEADER */ + 337, /* (359) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + 337, /* (360) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + 337, /* (361) cmd ::= SPLIT VGROUP NK_INTEGER */ + 425, /* (362) dnode_list ::= DNODE NK_INTEGER */ + 425, /* (363) dnode_list ::= dnode_list DNODE NK_INTEGER */ + 337, /* (364) cmd ::= DELETE FROM full_table_name where_clause_opt */ + 337, /* (365) cmd ::= query_or_subquery */ + 337, /* (366) cmd ::= insert_query */ + 413, /* (367) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + 413, /* (368) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + 340, /* (369) literal ::= NK_INTEGER */ + 340, /* (370) literal ::= NK_FLOAT */ + 340, /* (371) literal ::= NK_STRING */ + 340, /* (372) literal ::= NK_BOOL */ + 340, /* (373) literal ::= TIMESTAMP NK_STRING */ + 340, /* (374) literal ::= duration_literal */ + 340, /* (375) literal ::= NULL */ + 340, /* (376) literal ::= NK_QUESTION */ + 390, /* (377) duration_literal ::= NK_VARIABLE */ + 366, /* (378) signed ::= NK_INTEGER */ + 366, /* (379) signed ::= NK_PLUS NK_INTEGER */ + 366, /* (380) signed ::= NK_MINUS NK_INTEGER */ + 366, /* (381) signed ::= NK_FLOAT */ + 366, /* (382) signed ::= NK_PLUS NK_FLOAT */ + 366, /* (383) signed ::= NK_MINUS NK_FLOAT */ + 380, /* (384) signed_literal ::= signed */ + 380, /* (385) signed_literal ::= NK_STRING */ + 380, /* (386) signed_literal ::= NK_BOOL */ + 380, /* (387) signed_literal ::= TIMESTAMP NK_STRING */ + 380, /* (388) signed_literal ::= duration_literal */ + 380, /* (389) signed_literal ::= NULL */ + 380, /* (390) signed_literal ::= literal_func */ + 380, /* (391) signed_literal ::= NK_QUESTION */ + 428, /* (392) literal_list ::= signed_literal */ + 428, /* (393) literal_list ::= literal_list NK_COMMA signed_literal */ + 349, /* (394) db_name ::= NK_ID */ + 350, /* (395) table_name ::= NK_ID */ + 378, /* (396) column_name ::= NK_ID */ + 392, /* (397) function_name ::= NK_ID */ + 429, /* (398) table_alias ::= NK_ID */ + 400, /* (399) column_alias ::= NK_ID */ + 342, /* (400) user_name ::= NK_ID */ + 351, /* (401) topic_name ::= NK_ID */ + 418, /* (402) stream_name ::= NK_ID */ + 410, /* (403) cgroup_name ::= NK_ID */ + 403, /* (404) index_name ::= NK_ID */ + 430, /* (405) expr_or_subquery ::= expression */ + 424, /* (406) expression ::= literal */ + 424, /* (407) expression ::= pseudo_column */ + 424, /* (408) expression ::= column_reference */ + 424, /* (409) expression ::= function_expression */ + 424, /* (410) expression ::= case_when_expression */ + 424, /* (411) expression ::= NK_LP expression NK_RP */ + 424, /* (412) expression ::= NK_PLUS expr_or_subquery */ + 424, /* (413) expression ::= NK_MINUS expr_or_subquery */ + 424, /* (414) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + 424, /* (415) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + 424, /* (416) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + 424, /* (417) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + 424, /* (418) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + 424, /* (419) expression ::= column_reference NK_ARROW NK_STRING */ + 424, /* (420) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + 424, /* (421) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + 383, /* (422) expression_list ::= expr_or_subquery */ + 383, /* (423) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + 432, /* (424) column_reference ::= column_name */ + 432, /* (425) column_reference ::= table_name NK_DOT column_name */ + 431, /* (426) pseudo_column ::= ROWTS */ + 431, /* (427) pseudo_column ::= TBNAME */ + 431, /* (428) pseudo_column ::= table_name NK_DOT TBNAME */ + 431, /* (429) pseudo_column ::= QSTART */ + 431, /* (430) pseudo_column ::= QEND */ + 431, /* (431) pseudo_column ::= QDURATION */ + 431, /* (432) pseudo_column ::= WSTART */ + 431, /* (433) pseudo_column ::= WEND */ + 431, /* (434) pseudo_column ::= WDURATION */ + 431, /* (435) pseudo_column ::= IROWTS */ + 431, /* (436) pseudo_column ::= ISFILLED */ + 431, /* (437) pseudo_column ::= QTAGS */ + 433, /* (438) function_expression ::= function_name NK_LP expression_list NK_RP */ + 433, /* (439) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + 433, /* (440) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + 433, /* (441) function_expression ::= literal_func */ + 427, /* (442) literal_func ::= noarg_func NK_LP NK_RP */ + 427, /* (443) literal_func ::= NOW */ + 437, /* (444) noarg_func ::= NOW */ + 437, /* (445) noarg_func ::= TODAY */ + 437, /* (446) noarg_func ::= TIMEZONE */ + 437, /* (447) noarg_func ::= DATABASE */ + 437, /* (448) noarg_func ::= CLIENT_VERSION */ + 437, /* (449) noarg_func ::= SERVER_VERSION */ + 437, /* (450) noarg_func ::= SERVER_STATUS */ + 437, /* (451) noarg_func ::= CURRENT_USER */ + 437, /* (452) noarg_func ::= USER */ + 435, /* (453) star_func ::= COUNT */ + 435, /* (454) star_func ::= FIRST */ + 435, /* (455) star_func ::= LAST */ + 435, /* (456) star_func ::= LAST_ROW */ + 436, /* (457) star_func_para_list ::= NK_STAR */ + 436, /* (458) star_func_para_list ::= other_para_list */ + 438, /* (459) other_para_list ::= star_func_para */ + 438, /* (460) other_para_list ::= other_para_list NK_COMMA star_func_para */ + 439, /* (461) star_func_para ::= expr_or_subquery */ + 439, /* (462) star_func_para ::= table_name NK_DOT NK_STAR */ + 434, /* (463) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + 434, /* (464) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + 440, /* (465) when_then_list ::= when_then_expr */ + 440, /* (466) when_then_list ::= when_then_list when_then_expr */ + 443, /* (467) when_then_expr ::= WHEN common_expression THEN common_expression */ + 441, /* (468) case_when_else_opt ::= */ + 441, /* (469) case_when_else_opt ::= ELSE common_expression */ + 444, /* (470) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + 444, /* (471) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + 444, /* (472) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + 444, /* (473) predicate ::= expr_or_subquery IS NULL */ + 444, /* (474) predicate ::= expr_or_subquery IS NOT NULL */ + 444, /* (475) predicate ::= expr_or_subquery in_op in_predicate_value */ + 445, /* (476) compare_op ::= NK_LT */ + 445, /* (477) compare_op ::= NK_GT */ + 445, /* (478) compare_op ::= NK_LE */ + 445, /* (479) compare_op ::= NK_GE */ + 445, /* (480) compare_op ::= NK_NE */ + 445, /* (481) compare_op ::= NK_EQ */ + 445, /* (482) compare_op ::= LIKE */ + 445, /* (483) compare_op ::= NOT LIKE */ + 445, /* (484) compare_op ::= MATCH */ + 445, /* (485) compare_op ::= NMATCH */ + 445, /* (486) compare_op ::= CONTAINS */ + 446, /* (487) in_op ::= IN */ + 446, /* (488) in_op ::= NOT IN */ + 447, /* (489) in_predicate_value ::= NK_LP literal_list NK_RP */ + 448, /* (490) boolean_value_expression ::= boolean_primary */ + 448, /* (491) boolean_value_expression ::= NOT boolean_primary */ + 448, /* (492) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + 448, /* (493) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + 449, /* (494) boolean_primary ::= predicate */ + 449, /* (495) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + 442, /* (496) common_expression ::= expr_or_subquery */ + 442, /* (497) common_expression ::= boolean_value_expression */ + 450, /* (498) from_clause_opt ::= */ + 450, /* (499) from_clause_opt ::= FROM table_reference_list */ + 451, /* (500) table_reference_list ::= table_reference */ + 451, /* (501) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + 452, /* (502) table_reference ::= table_primary */ + 452, /* (503) table_reference ::= joined_table */ + 453, /* (504) table_primary ::= table_name alias_opt */ + 453, /* (505) table_primary ::= db_name NK_DOT table_name alias_opt */ + 453, /* (506) table_primary ::= subquery alias_opt */ + 453, /* (507) table_primary ::= parenthesized_joined_table */ + 455, /* (508) alias_opt ::= */ + 455, /* (509) alias_opt ::= table_alias */ + 455, /* (510) alias_opt ::= AS table_alias */ + 457, /* (511) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + 457, /* (512) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + 454, /* (513) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + 458, /* (514) join_type ::= */ + 458, /* (515) join_type ::= INNER */ + 459, /* (516) 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 */ + 460, /* (517) set_quantifier_opt ::= */ + 460, /* (518) set_quantifier_opt ::= DISTINCT */ + 460, /* (519) set_quantifier_opt ::= ALL */ + 461, /* (520) select_list ::= select_item */ + 461, /* (521) select_list ::= select_list NK_COMMA select_item */ + 469, /* (522) select_item ::= NK_STAR */ + 469, /* (523) select_item ::= common_expression */ + 469, /* (524) select_item ::= common_expression column_alias */ + 469, /* (525) select_item ::= common_expression AS column_alias */ + 469, /* (526) select_item ::= table_name NK_DOT NK_STAR */ + 426, /* (527) where_clause_opt ::= */ + 426, /* (528) where_clause_opt ::= WHERE search_condition */ + 462, /* (529) partition_by_clause_opt ::= */ + 462, /* (530) partition_by_clause_opt ::= PARTITION BY partition_list */ + 470, /* (531) partition_list ::= partition_item */ + 470, /* (532) partition_list ::= partition_list NK_COMMA partition_item */ + 471, /* (533) partition_item ::= expr_or_subquery */ + 471, /* (534) partition_item ::= expr_or_subquery column_alias */ + 471, /* (535) partition_item ::= expr_or_subquery AS column_alias */ + 466, /* (536) twindow_clause_opt ::= */ + 466, /* (537) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + 466, /* (538) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + 466, /* (539) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + 466, /* (540) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + 466, /* (541) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 405, /* (542) sliding_opt ::= */ + 405, /* (543) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + 465, /* (544) fill_opt ::= */ + 465, /* (545) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + 465, /* (546) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + 465, /* (547) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + 472, /* (548) fill_mode ::= NONE */ + 472, /* (549) fill_mode ::= PREV */ + 472, /* (550) fill_mode ::= NULL */ + 472, /* (551) fill_mode ::= NULL_F */ + 472, /* (552) fill_mode ::= LINEAR */ + 472, /* (553) fill_mode ::= NEXT */ + 467, /* (554) group_by_clause_opt ::= */ + 467, /* (555) group_by_clause_opt ::= GROUP BY group_by_list */ + 473, /* (556) group_by_list ::= expr_or_subquery */ + 473, /* (557) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 468, /* (558) having_clause_opt ::= */ + 468, /* (559) having_clause_opt ::= HAVING search_condition */ + 463, /* (560) range_opt ::= */ + 463, /* (561) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + 464, /* (562) every_opt ::= */ + 464, /* (563) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + 474, /* (564) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + 475, /* (565) query_simple ::= query_specification */ + 475, /* (566) query_simple ::= union_query_expression */ + 479, /* (567) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + 479, /* (568) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + 480, /* (569) query_simple_or_subquery ::= query_simple */ + 480, /* (570) query_simple_or_subquery ::= subquery */ + 409, /* (571) query_or_subquery ::= query_expression */ + 409, /* (572) query_or_subquery ::= subquery */ + 476, /* (573) order_by_clause_opt ::= */ + 476, /* (574) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 477, /* (575) slimit_clause_opt ::= */ + 477, /* (576) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + 477, /* (577) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + 477, /* (578) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 478, /* (579) limit_clause_opt ::= */ + 478, /* (580) limit_clause_opt ::= LIMIT NK_INTEGER */ + 478, /* (581) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + 478, /* (582) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 456, /* (583) subquery ::= NK_LP query_expression NK_RP */ + 456, /* (584) subquery ::= NK_LP subquery NK_RP */ + 352, /* (585) search_condition ::= common_expression */ + 481, /* (586) sort_specification_list ::= sort_specification */ + 481, /* (587) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + 482, /* (588) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 483, /* (589) ordering_specification_opt ::= */ + 483, /* (590) ordering_specification_opt ::= ASC */ + 483, /* (591) ordering_specification_opt ::= DESC */ + 484, /* (592) null_ordering_opt ::= */ + 484, /* (593) null_ordering_opt ::= NULLS FIRST */ + 484, /* (594) null_ordering_opt ::= NULLS LAST */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -3872,547 +3804,551 @@ static const signed char yyRuleInfoNRhs[] = { -5, /* (47) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -4, /* (48) cmd ::= DROP DNODE NK_INTEGER force_opt */ -4, /* (49) cmd ::= DROP DNODE dnode_endpoint force_opt */ - -4, /* (50) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - -5, /* (51) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - -4, /* (52) cmd ::= ALTER ALL DNODES NK_STRING */ - -5, /* (53) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - -3, /* (54) cmd ::= RESTORE DNODE NK_INTEGER */ - -1, /* (55) dnode_endpoint ::= NK_STRING */ - -1, /* (56) dnode_endpoint ::= NK_ID */ - -1, /* (57) dnode_endpoint ::= NK_IPTOKEN */ - 0, /* (58) force_opt ::= */ - -1, /* (59) force_opt ::= FORCE */ - -3, /* (60) cmd ::= ALTER LOCAL NK_STRING */ - -4, /* (61) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - -5, /* (62) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - -5, /* (63) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - -5, /* (64) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ - -5, /* (65) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - -5, /* (66) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - -5, /* (67) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - -5, /* (68) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - -5, /* (69) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - -5, /* (70) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - -5, /* (71) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ - -5, /* (72) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ - -5, /* (73) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - -4, /* (74) cmd ::= DROP DATABASE exists_opt db_name */ - -2, /* (75) cmd ::= USE db_name */ - -4, /* (76) cmd ::= ALTER DATABASE db_name alter_db_options */ - -3, /* (77) cmd ::= FLUSH DATABASE db_name */ - -4, /* (78) cmd ::= TRIM DATABASE db_name speed_opt */ - -5, /* (79) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ - -3, /* (80) not_exists_opt ::= IF NOT EXISTS */ - 0, /* (81) not_exists_opt ::= */ - -2, /* (82) exists_opt ::= IF EXISTS */ - 0, /* (83) exists_opt ::= */ - 0, /* (84) db_options ::= */ - -3, /* (85) db_options ::= db_options BUFFER NK_INTEGER */ - -3, /* (86) db_options ::= db_options CACHEMODEL NK_STRING */ - -3, /* (87) db_options ::= db_options CACHESIZE NK_INTEGER */ - -3, /* (88) db_options ::= db_options COMP NK_INTEGER */ - -3, /* (89) db_options ::= db_options DURATION NK_INTEGER */ - -3, /* (90) db_options ::= db_options DURATION NK_VARIABLE */ - -3, /* (91) db_options ::= db_options MAXROWS NK_INTEGER */ - -3, /* (92) db_options ::= db_options MINROWS NK_INTEGER */ - -3, /* (93) db_options ::= db_options KEEP integer_list */ - -3, /* (94) db_options ::= db_options KEEP variable_list */ - -3, /* (95) db_options ::= db_options PAGES NK_INTEGER */ - -3, /* (96) db_options ::= db_options PAGESIZE NK_INTEGER */ - -3, /* (97) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ - -3, /* (98) db_options ::= db_options PRECISION NK_STRING */ - -3, /* (99) db_options ::= db_options REPLICA NK_INTEGER */ - -3, /* (100) db_options ::= db_options VGROUPS NK_INTEGER */ - -3, /* (101) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - -3, /* (102) db_options ::= db_options RETENTIONS retention_list */ - -3, /* (103) db_options ::= db_options SCHEMALESS NK_INTEGER */ - -3, /* (104) db_options ::= db_options WAL_LEVEL NK_INTEGER */ - -3, /* (105) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ - -3, /* (106) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ - -4, /* (107) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - -3, /* (108) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ - -4, /* (109) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - -3, /* (110) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ - -3, /* (111) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ - -3, /* (112) db_options ::= db_options STT_TRIGGER NK_INTEGER */ - -3, /* (113) db_options ::= db_options TABLE_PREFIX signed */ - -3, /* (114) db_options ::= db_options TABLE_SUFFIX signed */ - -1, /* (115) alter_db_options ::= alter_db_option */ - -2, /* (116) alter_db_options ::= alter_db_options alter_db_option */ - -2, /* (117) alter_db_option ::= BUFFER NK_INTEGER */ - -2, /* (118) alter_db_option ::= CACHEMODEL NK_STRING */ - -2, /* (119) alter_db_option ::= CACHESIZE NK_INTEGER */ - -2, /* (120) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - -2, /* (121) alter_db_option ::= KEEP integer_list */ - -2, /* (122) alter_db_option ::= KEEP variable_list */ - -2, /* (123) alter_db_option ::= PAGES NK_INTEGER */ - -2, /* (124) alter_db_option ::= REPLICA NK_INTEGER */ - -2, /* (125) alter_db_option ::= WAL_LEVEL NK_INTEGER */ - -2, /* (126) alter_db_option ::= STT_TRIGGER NK_INTEGER */ - -2, /* (127) alter_db_option ::= MINROWS NK_INTEGER */ - -2, /* (128) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ - -3, /* (129) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - -2, /* (130) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ - -3, /* (131) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - -1, /* (132) integer_list ::= NK_INTEGER */ - -3, /* (133) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - -1, /* (134) variable_list ::= NK_VARIABLE */ - -3, /* (135) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - -1, /* (136) retention_list ::= retention */ - -3, /* (137) retention_list ::= retention_list NK_COMMA retention */ - -3, /* (138) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - 0, /* (139) speed_opt ::= */ - -2, /* (140) speed_opt ::= MAX_SPEED NK_INTEGER */ - 0, /* (141) start_opt ::= */ - -3, /* (142) start_opt ::= START WITH NK_INTEGER */ - -3, /* (143) start_opt ::= START WITH NK_STRING */ - -4, /* (144) start_opt ::= START WITH TIMESTAMP NK_STRING */ - 0, /* (145) end_opt ::= */ - -3, /* (146) end_opt ::= END WITH NK_INTEGER */ - -3, /* (147) end_opt ::= END WITH NK_STRING */ - -4, /* (148) end_opt ::= END WITH TIMESTAMP NK_STRING */ - -9, /* (149) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - -3, /* (150) cmd ::= CREATE TABLE multi_create_clause */ - -9, /* (151) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - -3, /* (152) cmd ::= DROP TABLE multi_drop_clause */ - -4, /* (153) cmd ::= DROP STABLE exists_opt full_table_name */ - -3, /* (154) cmd ::= ALTER TABLE alter_table_clause */ - -3, /* (155) cmd ::= ALTER STABLE alter_table_clause */ - -2, /* (156) alter_table_clause ::= full_table_name alter_table_options */ - -5, /* (157) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - -4, /* (158) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - -5, /* (159) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - -5, /* (160) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - -5, /* (161) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - -4, /* (162) alter_table_clause ::= full_table_name DROP TAG column_name */ - -5, /* (163) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - -5, /* (164) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - -6, /* (165) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - -1, /* (166) multi_create_clause ::= create_subtable_clause */ - -2, /* (167) multi_create_clause ::= multi_create_clause create_subtable_clause */ - -10, /* (168) 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 */ - -1, /* (169) multi_drop_clause ::= drop_table_clause */ - -3, /* (170) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - -2, /* (171) drop_table_clause ::= exists_opt full_table_name */ - 0, /* (172) specific_cols_opt ::= */ - -3, /* (173) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - -1, /* (174) full_table_name ::= table_name */ - -3, /* (175) full_table_name ::= db_name NK_DOT table_name */ - -1, /* (176) column_def_list ::= column_def */ - -3, /* (177) column_def_list ::= column_def_list NK_COMMA column_def */ - -2, /* (178) column_def ::= column_name type_name */ - -1, /* (179) type_name ::= BOOL */ - -1, /* (180) type_name ::= TINYINT */ - -1, /* (181) type_name ::= SMALLINT */ - -1, /* (182) type_name ::= INT */ - -1, /* (183) type_name ::= INTEGER */ - -1, /* (184) type_name ::= BIGINT */ - -1, /* (185) type_name ::= FLOAT */ - -1, /* (186) type_name ::= DOUBLE */ - -4, /* (187) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - -1, /* (188) type_name ::= TIMESTAMP */ - -4, /* (189) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - -2, /* (190) type_name ::= TINYINT UNSIGNED */ - -2, /* (191) type_name ::= SMALLINT UNSIGNED */ - -2, /* (192) type_name ::= INT UNSIGNED */ - -2, /* (193) type_name ::= BIGINT UNSIGNED */ - -1, /* (194) type_name ::= JSON */ - -4, /* (195) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - -1, /* (196) type_name ::= MEDIUMBLOB */ - -1, /* (197) type_name ::= BLOB */ - -4, /* (198) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - -1, /* (199) type_name ::= DECIMAL */ - -4, /* (200) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - -6, /* (201) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 0, /* (202) tags_def_opt ::= */ - -1, /* (203) tags_def_opt ::= tags_def */ - -4, /* (204) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - 0, /* (205) table_options ::= */ - -3, /* (206) table_options ::= table_options COMMENT NK_STRING */ - -3, /* (207) table_options ::= table_options MAX_DELAY duration_list */ - -3, /* (208) table_options ::= table_options WATERMARK duration_list */ - -5, /* (209) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - -3, /* (210) table_options ::= table_options TTL NK_INTEGER */ - -5, /* (211) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - -3, /* (212) table_options ::= table_options DELETE_MARK duration_list */ - -1, /* (213) alter_table_options ::= alter_table_option */ - -2, /* (214) alter_table_options ::= alter_table_options alter_table_option */ - -2, /* (215) alter_table_option ::= COMMENT NK_STRING */ - -2, /* (216) alter_table_option ::= TTL NK_INTEGER */ - -1, /* (217) duration_list ::= duration_literal */ - -3, /* (218) duration_list ::= duration_list NK_COMMA duration_literal */ - -1, /* (219) rollup_func_list ::= rollup_func_name */ - -3, /* (220) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - -1, /* (221) rollup_func_name ::= function_name */ - -1, /* (222) rollup_func_name ::= FIRST */ - -1, /* (223) rollup_func_name ::= LAST */ - -1, /* (224) col_name_list ::= col_name */ - -3, /* (225) col_name_list ::= col_name_list NK_COMMA col_name */ - -1, /* (226) col_name ::= column_name */ - -2, /* (227) cmd ::= SHOW DNODES */ - -2, /* (228) cmd ::= SHOW USERS */ - -3, /* (229) cmd ::= SHOW USER PRIVILEGES */ - -2, /* (230) cmd ::= SHOW DATABASES */ - -4, /* (231) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - -4, /* (232) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - -3, /* (233) cmd ::= SHOW db_name_cond_opt VGROUPS */ - -2, /* (234) cmd ::= SHOW MNODES */ - -2, /* (235) cmd ::= SHOW QNODES */ - -2, /* (236) cmd ::= SHOW FUNCTIONS */ - -5, /* (237) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - -2, /* (238) cmd ::= SHOW STREAMS */ - -2, /* (239) cmd ::= SHOW ACCOUNTS */ - -2, /* (240) cmd ::= SHOW APPS */ - -2, /* (241) cmd ::= SHOW CONNECTIONS */ - -2, /* (242) cmd ::= SHOW LICENCES */ - -2, /* (243) cmd ::= SHOW GRANTS */ - -4, /* (244) cmd ::= SHOW CREATE DATABASE db_name */ - -4, /* (245) cmd ::= SHOW CREATE TABLE full_table_name */ - -4, /* (246) cmd ::= SHOW CREATE STABLE full_table_name */ - -2, /* (247) cmd ::= SHOW QUERIES */ - -2, /* (248) cmd ::= SHOW SCORES */ - -2, /* (249) cmd ::= SHOW TOPICS */ - -2, /* (250) cmd ::= SHOW VARIABLES */ - -3, /* (251) cmd ::= SHOW CLUSTER VARIABLES */ - -3, /* (252) cmd ::= SHOW LOCAL VARIABLES */ - -5, /* (253) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - -2, /* (254) cmd ::= SHOW BNODES */ - -2, /* (255) cmd ::= SHOW SNODES */ - -2, /* (256) cmd ::= SHOW CLUSTER */ - -2, /* (257) cmd ::= SHOW TRANSACTIONS */ - -4, /* (258) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - -2, /* (259) cmd ::= SHOW CONSUMERS */ - -2, /* (260) cmd ::= SHOW SUBSCRIPTIONS */ - -5, /* (261) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - -7, /* (262) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - -3, /* (263) cmd ::= SHOW VNODES NK_INTEGER */ - -3, /* (264) cmd ::= SHOW VNODES NK_STRING */ - -3, /* (265) cmd ::= SHOW db_name_cond_opt ALIVE */ - -3, /* (266) cmd ::= SHOW CLUSTER ALIVE */ - 0, /* (267) db_name_cond_opt ::= */ - -2, /* (268) db_name_cond_opt ::= db_name NK_DOT */ - 0, /* (269) like_pattern_opt ::= */ - -2, /* (270) like_pattern_opt ::= LIKE NK_STRING */ - -1, /* (271) table_name_cond ::= table_name */ - 0, /* (272) from_db_opt ::= */ - -2, /* (273) from_db_opt ::= FROM db_name */ - 0, /* (274) tag_list_opt ::= */ - -1, /* (275) tag_list_opt ::= tag_item */ - -3, /* (276) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - -1, /* (277) tag_item ::= TBNAME */ - -1, /* (278) tag_item ::= QTAGS */ - -1, /* (279) tag_item ::= column_name */ - -2, /* (280) tag_item ::= column_name column_alias */ - -3, /* (281) tag_item ::= column_name AS column_alias */ - -8, /* (282) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ - -9, /* (283) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ - -4, /* (284) cmd ::= DROP INDEX exists_opt full_index_name */ - -1, /* (285) full_index_name ::= index_name */ - -3, /* (286) full_index_name ::= db_name NK_DOT index_name */ - -10, /* (287) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - -12, /* (288) 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 */ - -1, /* (289) func_list ::= func */ - -3, /* (290) func_list ::= func_list NK_COMMA func */ - -4, /* (291) func ::= sma_func_name NK_LP expression_list NK_RP */ - -1, /* (292) sma_func_name ::= function_name */ - -1, /* (293) sma_func_name ::= COUNT */ - -1, /* (294) sma_func_name ::= FIRST */ - -1, /* (295) sma_func_name ::= LAST */ - -1, /* (296) sma_func_name ::= LAST_ROW */ - 0, /* (297) sma_stream_opt ::= */ - -3, /* (298) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - -3, /* (299) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - -3, /* (300) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - -6, /* (301) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - -7, /* (302) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ - -9, /* (303) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ - -7, /* (304) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ - -9, /* (305) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ - -4, /* (306) cmd ::= DROP TOPIC exists_opt topic_name */ - -7, /* (307) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - -2, /* (308) cmd ::= DESC full_table_name */ - -2, /* (309) cmd ::= DESCRIBE full_table_name */ - -3, /* (310) cmd ::= RESET QUERY CACHE */ - -4, /* (311) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - -4, /* (312) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 0, /* (313) analyze_opt ::= */ - -1, /* (314) analyze_opt ::= ANALYZE */ - 0, /* (315) explain_options ::= */ - -3, /* (316) explain_options ::= explain_options VERBOSE NK_BOOL */ - -3, /* (317) explain_options ::= explain_options RATIO NK_FLOAT */ - -12, /* (318) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - -4, /* (319) cmd ::= DROP FUNCTION exists_opt function_name */ - 0, /* (320) agg_func_opt ::= */ - -1, /* (321) agg_func_opt ::= AGGREGATE */ - 0, /* (322) bufsize_opt ::= */ - -2, /* (323) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 0, /* (324) language_opt ::= */ - -2, /* (325) language_opt ::= LANGUAGE NK_STRING */ - 0, /* (326) or_replace_opt ::= */ - -2, /* (327) or_replace_opt ::= OR REPLACE */ - -12, /* (328) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ - -4, /* (329) cmd ::= DROP STREAM exists_opt stream_name */ - -4, /* (330) cmd ::= PAUSE STREAM exists_opt stream_name */ - -5, /* (331) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 0, /* (332) col_list_opt ::= */ - -3, /* (333) col_list_opt ::= NK_LP col_name_list NK_RP */ - 0, /* (334) tag_def_or_ref_opt ::= */ - -1, /* (335) tag_def_or_ref_opt ::= tags_def */ - -4, /* (336) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - 0, /* (337) stream_options ::= */ - -3, /* (338) stream_options ::= stream_options TRIGGER AT_ONCE */ - -3, /* (339) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - -4, /* (340) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - -3, /* (341) stream_options ::= stream_options WATERMARK duration_literal */ - -4, /* (342) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - -3, /* (343) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - -3, /* (344) stream_options ::= stream_options DELETE_MARK duration_literal */ - -4, /* (345) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 0, /* (346) subtable_opt ::= */ - -4, /* (347) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 0, /* (348) ignore_opt ::= */ - -2, /* (349) ignore_opt ::= IGNORE UNTREATED */ - -3, /* (350) cmd ::= KILL CONNECTION NK_INTEGER */ - -3, /* (351) cmd ::= KILL QUERY NK_STRING */ - -3, /* (352) cmd ::= KILL TRANSACTION NK_INTEGER */ - -2, /* (353) cmd ::= BALANCE VGROUP */ - -3, /* (354) cmd ::= BALANCE VGROUP LEADER */ - -4, /* (355) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - -4, /* (356) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - -3, /* (357) cmd ::= SPLIT VGROUP NK_INTEGER */ - -2, /* (358) dnode_list ::= DNODE NK_INTEGER */ - -3, /* (359) dnode_list ::= dnode_list DNODE NK_INTEGER */ - -4, /* (360) cmd ::= DELETE FROM full_table_name where_clause_opt */ - -1, /* (361) cmd ::= query_or_subquery */ - -1, /* (362) cmd ::= insert_query */ - -7, /* (363) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - -4, /* (364) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - -1, /* (365) literal ::= NK_INTEGER */ - -1, /* (366) literal ::= NK_FLOAT */ - -1, /* (367) literal ::= NK_STRING */ - -1, /* (368) literal ::= NK_BOOL */ - -2, /* (369) literal ::= TIMESTAMP NK_STRING */ - -1, /* (370) literal ::= duration_literal */ - -1, /* (371) literal ::= NULL */ - -1, /* (372) literal ::= NK_QUESTION */ - -1, /* (373) duration_literal ::= NK_VARIABLE */ - -1, /* (374) signed ::= NK_INTEGER */ - -2, /* (375) signed ::= NK_PLUS NK_INTEGER */ - -2, /* (376) signed ::= NK_MINUS NK_INTEGER */ - -1, /* (377) signed ::= NK_FLOAT */ - -2, /* (378) signed ::= NK_PLUS NK_FLOAT */ - -2, /* (379) signed ::= NK_MINUS NK_FLOAT */ - -1, /* (380) signed_literal ::= signed */ - -1, /* (381) signed_literal ::= NK_STRING */ - -1, /* (382) signed_literal ::= NK_BOOL */ - -2, /* (383) signed_literal ::= TIMESTAMP NK_STRING */ - -1, /* (384) signed_literal ::= duration_literal */ - -1, /* (385) signed_literal ::= NULL */ - -1, /* (386) signed_literal ::= literal_func */ - -1, /* (387) signed_literal ::= NK_QUESTION */ - -1, /* (388) literal_list ::= signed_literal */ - -3, /* (389) literal_list ::= literal_list NK_COMMA signed_literal */ - -1, /* (390) db_name ::= NK_ID */ - -1, /* (391) table_name ::= NK_ID */ - -1, /* (392) column_name ::= NK_ID */ - -1, /* (393) function_name ::= NK_ID */ - -1, /* (394) table_alias ::= NK_ID */ - -1, /* (395) column_alias ::= NK_ID */ - -1, /* (396) user_name ::= NK_ID */ - -1, /* (397) topic_name ::= NK_ID */ - -1, /* (398) stream_name ::= NK_ID */ - -1, /* (399) cgroup_name ::= NK_ID */ - -1, /* (400) index_name ::= NK_ID */ - -1, /* (401) expr_or_subquery ::= expression */ - -1, /* (402) expression ::= literal */ - -1, /* (403) expression ::= pseudo_column */ - -1, /* (404) expression ::= column_reference */ - -1, /* (405) expression ::= function_expression */ - -1, /* (406) expression ::= case_when_expression */ - -3, /* (407) expression ::= NK_LP expression NK_RP */ - -2, /* (408) expression ::= NK_PLUS expr_or_subquery */ - -2, /* (409) expression ::= NK_MINUS expr_or_subquery */ - -3, /* (410) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - -3, /* (411) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - -3, /* (412) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - -3, /* (413) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - -3, /* (414) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - -3, /* (415) expression ::= column_reference NK_ARROW NK_STRING */ - -3, /* (416) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - -3, /* (417) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - -1, /* (418) expression_list ::= expr_or_subquery */ - -3, /* (419) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - -1, /* (420) column_reference ::= column_name */ - -3, /* (421) column_reference ::= table_name NK_DOT column_name */ - -1, /* (422) pseudo_column ::= ROWTS */ - -1, /* (423) pseudo_column ::= TBNAME */ - -3, /* (424) pseudo_column ::= table_name NK_DOT TBNAME */ - -1, /* (425) pseudo_column ::= QSTART */ - -1, /* (426) pseudo_column ::= QEND */ - -1, /* (427) pseudo_column ::= QDURATION */ - -1, /* (428) pseudo_column ::= WSTART */ - -1, /* (429) pseudo_column ::= WEND */ - -1, /* (430) pseudo_column ::= WDURATION */ - -1, /* (431) pseudo_column ::= IROWTS */ - -1, /* (432) pseudo_column ::= ISFILLED */ - -1, /* (433) pseudo_column ::= QTAGS */ - -4, /* (434) function_expression ::= function_name NK_LP expression_list NK_RP */ - -4, /* (435) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - -6, /* (436) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - -1, /* (437) function_expression ::= literal_func */ - -3, /* (438) literal_func ::= noarg_func NK_LP NK_RP */ - -1, /* (439) literal_func ::= NOW */ - -1, /* (440) noarg_func ::= NOW */ - -1, /* (441) noarg_func ::= TODAY */ - -1, /* (442) noarg_func ::= TIMEZONE */ - -1, /* (443) noarg_func ::= DATABASE */ - -1, /* (444) noarg_func ::= CLIENT_VERSION */ - -1, /* (445) noarg_func ::= SERVER_VERSION */ - -1, /* (446) noarg_func ::= SERVER_STATUS */ - -1, /* (447) noarg_func ::= CURRENT_USER */ - -1, /* (448) noarg_func ::= USER */ - -1, /* (449) star_func ::= COUNT */ - -1, /* (450) star_func ::= FIRST */ - -1, /* (451) star_func ::= LAST */ - -1, /* (452) star_func ::= LAST_ROW */ - -1, /* (453) star_func_para_list ::= NK_STAR */ - -1, /* (454) star_func_para_list ::= other_para_list */ - -1, /* (455) other_para_list ::= star_func_para */ - -3, /* (456) other_para_list ::= other_para_list NK_COMMA star_func_para */ - -1, /* (457) star_func_para ::= expr_or_subquery */ - -3, /* (458) star_func_para ::= table_name NK_DOT NK_STAR */ - -4, /* (459) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - -5, /* (460) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - -1, /* (461) when_then_list ::= when_then_expr */ - -2, /* (462) when_then_list ::= when_then_list when_then_expr */ - -4, /* (463) when_then_expr ::= WHEN common_expression THEN common_expression */ - 0, /* (464) case_when_else_opt ::= */ - -2, /* (465) case_when_else_opt ::= ELSE common_expression */ - -3, /* (466) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - -5, /* (467) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - -6, /* (468) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - -3, /* (469) predicate ::= expr_or_subquery IS NULL */ - -4, /* (470) predicate ::= expr_or_subquery IS NOT NULL */ - -3, /* (471) predicate ::= expr_or_subquery in_op in_predicate_value */ - -1, /* (472) compare_op ::= NK_LT */ - -1, /* (473) compare_op ::= NK_GT */ - -1, /* (474) compare_op ::= NK_LE */ - -1, /* (475) compare_op ::= NK_GE */ - -1, /* (476) compare_op ::= NK_NE */ - -1, /* (477) compare_op ::= NK_EQ */ - -1, /* (478) compare_op ::= LIKE */ - -2, /* (479) compare_op ::= NOT LIKE */ - -1, /* (480) compare_op ::= MATCH */ - -1, /* (481) compare_op ::= NMATCH */ - -1, /* (482) compare_op ::= CONTAINS */ - -1, /* (483) in_op ::= IN */ - -2, /* (484) in_op ::= NOT IN */ - -3, /* (485) in_predicate_value ::= NK_LP literal_list NK_RP */ - -1, /* (486) boolean_value_expression ::= boolean_primary */ - -2, /* (487) boolean_value_expression ::= NOT boolean_primary */ - -3, /* (488) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - -3, /* (489) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - -1, /* (490) boolean_primary ::= predicate */ - -3, /* (491) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - -1, /* (492) common_expression ::= expr_or_subquery */ - -1, /* (493) common_expression ::= boolean_value_expression */ - 0, /* (494) from_clause_opt ::= */ - -2, /* (495) from_clause_opt ::= FROM table_reference_list */ - -1, /* (496) table_reference_list ::= table_reference */ - -3, /* (497) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - -1, /* (498) table_reference ::= table_primary */ - -1, /* (499) table_reference ::= joined_table */ - -2, /* (500) table_primary ::= table_name alias_opt */ - -4, /* (501) table_primary ::= db_name NK_DOT table_name alias_opt */ - -2, /* (502) table_primary ::= subquery alias_opt */ - -1, /* (503) table_primary ::= parenthesized_joined_table */ - 0, /* (504) alias_opt ::= */ - -1, /* (505) alias_opt ::= table_alias */ - -2, /* (506) alias_opt ::= AS table_alias */ - -3, /* (507) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - -3, /* (508) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - -6, /* (509) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - 0, /* (510) join_type ::= */ - -1, /* (511) join_type ::= INNER */ - -12, /* (512) 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 */ - 0, /* (513) set_quantifier_opt ::= */ - -1, /* (514) set_quantifier_opt ::= DISTINCT */ - -1, /* (515) set_quantifier_opt ::= ALL */ - -1, /* (516) select_list ::= select_item */ - -3, /* (517) select_list ::= select_list NK_COMMA select_item */ - -1, /* (518) select_item ::= NK_STAR */ - -1, /* (519) select_item ::= common_expression */ - -2, /* (520) select_item ::= common_expression column_alias */ - -3, /* (521) select_item ::= common_expression AS column_alias */ - -3, /* (522) select_item ::= table_name NK_DOT NK_STAR */ - 0, /* (523) where_clause_opt ::= */ - -2, /* (524) where_clause_opt ::= WHERE search_condition */ - 0, /* (525) partition_by_clause_opt ::= */ - -3, /* (526) partition_by_clause_opt ::= PARTITION BY partition_list */ - -1, /* (527) partition_list ::= partition_item */ - -3, /* (528) partition_list ::= partition_list NK_COMMA partition_item */ - -1, /* (529) partition_item ::= expr_or_subquery */ - -2, /* (530) partition_item ::= expr_or_subquery column_alias */ - -3, /* (531) partition_item ::= expr_or_subquery AS column_alias */ - 0, /* (532) twindow_clause_opt ::= */ - -6, /* (533) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - -4, /* (534) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - -6, /* (535) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - -8, /* (536) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - -7, /* (537) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 0, /* (538) sliding_opt ::= */ - -4, /* (539) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - 0, /* (540) fill_opt ::= */ - -4, /* (541) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - -6, /* (542) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - -6, /* (543) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - -1, /* (544) fill_mode ::= NONE */ - -1, /* (545) fill_mode ::= PREV */ - -1, /* (546) fill_mode ::= NULL */ - -1, /* (547) fill_mode ::= NULL_F */ - -1, /* (548) fill_mode ::= LINEAR */ - -1, /* (549) fill_mode ::= NEXT */ - 0, /* (550) group_by_clause_opt ::= */ - -3, /* (551) group_by_clause_opt ::= GROUP BY group_by_list */ - -1, /* (552) group_by_list ::= expr_or_subquery */ - -3, /* (553) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 0, /* (554) having_clause_opt ::= */ - -2, /* (555) having_clause_opt ::= HAVING search_condition */ - 0, /* (556) range_opt ::= */ - -6, /* (557) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - 0, /* (558) every_opt ::= */ - -4, /* (559) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - -4, /* (560) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - -1, /* (561) query_simple ::= query_specification */ - -1, /* (562) query_simple ::= union_query_expression */ - -4, /* (563) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - -3, /* (564) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - -1, /* (565) query_simple_or_subquery ::= query_simple */ - -1, /* (566) query_simple_or_subquery ::= subquery */ - -1, /* (567) query_or_subquery ::= query_expression */ - -1, /* (568) query_or_subquery ::= subquery */ - 0, /* (569) order_by_clause_opt ::= */ - -3, /* (570) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 0, /* (571) slimit_clause_opt ::= */ - -2, /* (572) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - -4, /* (573) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - -4, /* (574) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 0, /* (575) limit_clause_opt ::= */ - -2, /* (576) limit_clause_opt ::= LIMIT NK_INTEGER */ - -4, /* (577) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - -4, /* (578) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - -3, /* (579) subquery ::= NK_LP query_expression NK_RP */ - -3, /* (580) subquery ::= NK_LP subquery NK_RP */ - -1, /* (581) search_condition ::= common_expression */ - -1, /* (582) sort_specification_list ::= sort_specification */ - -3, /* (583) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - -3, /* (584) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 0, /* (585) ordering_specification_opt ::= */ - -1, /* (586) ordering_specification_opt ::= ASC */ - -1, /* (587) ordering_specification_opt ::= DESC */ - 0, /* (588) null_ordering_opt ::= */ - -2, /* (589) null_ordering_opt ::= NULLS FIRST */ - -2, /* (590) null_ordering_opt ::= NULLS LAST */ + -4, /* (50) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ + -4, /* (51) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ + -4, /* (52) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + -5, /* (53) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + -4, /* (54) cmd ::= ALTER ALL DNODES NK_STRING */ + -5, /* (55) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + -3, /* (56) cmd ::= RESTORE DNODE NK_INTEGER */ + -1, /* (57) dnode_endpoint ::= NK_STRING */ + -1, /* (58) dnode_endpoint ::= NK_ID */ + -1, /* (59) dnode_endpoint ::= NK_IPTOKEN */ + 0, /* (60) force_opt ::= */ + -1, /* (61) force_opt ::= FORCE */ + -1, /* (62) unsafe_opt ::= UNSAFE */ + -3, /* (63) cmd ::= ALTER LOCAL NK_STRING */ + -4, /* (64) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + -5, /* (65) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + -5, /* (66) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + -5, /* (67) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ + -5, /* (68) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + -5, /* (69) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + -5, /* (70) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + -5, /* (71) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + -5, /* (72) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + -5, /* (73) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + -5, /* (74) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ + -5, /* (75) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ + -5, /* (76) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + -4, /* (77) cmd ::= DROP DATABASE exists_opt db_name */ + -2, /* (78) cmd ::= USE db_name */ + -4, /* (79) cmd ::= ALTER DATABASE db_name alter_db_options */ + -3, /* (80) cmd ::= FLUSH DATABASE db_name */ + -4, /* (81) cmd ::= TRIM DATABASE db_name speed_opt */ + -5, /* (82) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ + -3, /* (83) not_exists_opt ::= IF NOT EXISTS */ + 0, /* (84) not_exists_opt ::= */ + -2, /* (85) exists_opt ::= IF EXISTS */ + 0, /* (86) exists_opt ::= */ + 0, /* (87) db_options ::= */ + -3, /* (88) db_options ::= db_options BUFFER NK_INTEGER */ + -3, /* (89) db_options ::= db_options CACHEMODEL NK_STRING */ + -3, /* (90) db_options ::= db_options CACHESIZE NK_INTEGER */ + -3, /* (91) db_options ::= db_options COMP NK_INTEGER */ + -3, /* (92) db_options ::= db_options DURATION NK_INTEGER */ + -3, /* (93) db_options ::= db_options DURATION NK_VARIABLE */ + -3, /* (94) db_options ::= db_options MAXROWS NK_INTEGER */ + -3, /* (95) db_options ::= db_options MINROWS NK_INTEGER */ + -3, /* (96) db_options ::= db_options KEEP integer_list */ + -3, /* (97) db_options ::= db_options KEEP variable_list */ + -3, /* (98) db_options ::= db_options PAGES NK_INTEGER */ + -3, /* (99) db_options ::= db_options PAGESIZE NK_INTEGER */ + -3, /* (100) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ + -3, /* (101) db_options ::= db_options PRECISION NK_STRING */ + -3, /* (102) db_options ::= db_options REPLICA NK_INTEGER */ + -3, /* (103) db_options ::= db_options VGROUPS NK_INTEGER */ + -3, /* (104) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + -3, /* (105) db_options ::= db_options RETENTIONS retention_list */ + -3, /* (106) db_options ::= db_options SCHEMALESS NK_INTEGER */ + -3, /* (107) db_options ::= db_options WAL_LEVEL NK_INTEGER */ + -3, /* (108) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ + -3, /* (109) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ + -4, /* (110) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + -3, /* (111) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ + -4, /* (112) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + -3, /* (113) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ + -3, /* (114) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ + -3, /* (115) db_options ::= db_options STT_TRIGGER NK_INTEGER */ + -3, /* (116) db_options ::= db_options TABLE_PREFIX signed */ + -3, /* (117) db_options ::= db_options TABLE_SUFFIX signed */ + -1, /* (118) alter_db_options ::= alter_db_option */ + -2, /* (119) alter_db_options ::= alter_db_options alter_db_option */ + -2, /* (120) alter_db_option ::= BUFFER NK_INTEGER */ + -2, /* (121) alter_db_option ::= CACHEMODEL NK_STRING */ + -2, /* (122) alter_db_option ::= CACHESIZE NK_INTEGER */ + -2, /* (123) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ + -2, /* (124) alter_db_option ::= KEEP integer_list */ + -2, /* (125) alter_db_option ::= KEEP variable_list */ + -2, /* (126) alter_db_option ::= PAGES NK_INTEGER */ + -2, /* (127) alter_db_option ::= REPLICA NK_INTEGER */ + -2, /* (128) alter_db_option ::= WAL_LEVEL NK_INTEGER */ + -2, /* (129) alter_db_option ::= STT_TRIGGER NK_INTEGER */ + -2, /* (130) alter_db_option ::= MINROWS NK_INTEGER */ + -2, /* (131) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ + -3, /* (132) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + -2, /* (133) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ + -3, /* (134) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + -1, /* (135) integer_list ::= NK_INTEGER */ + -3, /* (136) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + -1, /* (137) variable_list ::= NK_VARIABLE */ + -3, /* (138) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + -1, /* (139) retention_list ::= retention */ + -3, /* (140) retention_list ::= retention_list NK_COMMA retention */ + -3, /* (141) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + 0, /* (142) speed_opt ::= */ + -2, /* (143) speed_opt ::= MAX_SPEED NK_INTEGER */ + 0, /* (144) start_opt ::= */ + -3, /* (145) start_opt ::= START WITH NK_INTEGER */ + -3, /* (146) start_opt ::= START WITH NK_STRING */ + -4, /* (147) start_opt ::= START WITH TIMESTAMP NK_STRING */ + 0, /* (148) end_opt ::= */ + -3, /* (149) end_opt ::= END WITH NK_INTEGER */ + -3, /* (150) end_opt ::= END WITH NK_STRING */ + -4, /* (151) end_opt ::= END WITH TIMESTAMP NK_STRING */ + -9, /* (152) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + -3, /* (153) cmd ::= CREATE TABLE multi_create_clause */ + -9, /* (154) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + -3, /* (155) cmd ::= DROP TABLE multi_drop_clause */ + -4, /* (156) cmd ::= DROP STABLE exists_opt full_table_name */ + -3, /* (157) cmd ::= ALTER TABLE alter_table_clause */ + -3, /* (158) cmd ::= ALTER STABLE alter_table_clause */ + -2, /* (159) alter_table_clause ::= full_table_name alter_table_options */ + -5, /* (160) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + -4, /* (161) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + -5, /* (162) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + -5, /* (163) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + -5, /* (164) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + -4, /* (165) alter_table_clause ::= full_table_name DROP TAG column_name */ + -5, /* (166) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + -5, /* (167) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + -6, /* (168) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + -1, /* (169) multi_create_clause ::= create_subtable_clause */ + -2, /* (170) multi_create_clause ::= multi_create_clause create_subtable_clause */ + -10, /* (171) 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 */ + -1, /* (172) multi_drop_clause ::= drop_table_clause */ + -3, /* (173) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ + -2, /* (174) drop_table_clause ::= exists_opt full_table_name */ + 0, /* (175) specific_cols_opt ::= */ + -3, /* (176) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + -1, /* (177) full_table_name ::= table_name */ + -3, /* (178) full_table_name ::= db_name NK_DOT table_name */ + -1, /* (179) column_def_list ::= column_def */ + -3, /* (180) column_def_list ::= column_def_list NK_COMMA column_def */ + -2, /* (181) column_def ::= column_name type_name */ + -1, /* (182) type_name ::= BOOL */ + -1, /* (183) type_name ::= TINYINT */ + -1, /* (184) type_name ::= SMALLINT */ + -1, /* (185) type_name ::= INT */ + -1, /* (186) type_name ::= INTEGER */ + -1, /* (187) type_name ::= BIGINT */ + -1, /* (188) type_name ::= FLOAT */ + -1, /* (189) type_name ::= DOUBLE */ + -4, /* (190) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + -1, /* (191) type_name ::= TIMESTAMP */ + -4, /* (192) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + -2, /* (193) type_name ::= TINYINT UNSIGNED */ + -2, /* (194) type_name ::= SMALLINT UNSIGNED */ + -2, /* (195) type_name ::= INT UNSIGNED */ + -2, /* (196) type_name ::= BIGINT UNSIGNED */ + -1, /* (197) type_name ::= JSON */ + -4, /* (198) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + -1, /* (199) type_name ::= MEDIUMBLOB */ + -1, /* (200) type_name ::= BLOB */ + -4, /* (201) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + -4, /* (202) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + -1, /* (203) type_name ::= DECIMAL */ + -4, /* (204) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + -6, /* (205) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 0, /* (206) tags_def_opt ::= */ + -1, /* (207) tags_def_opt ::= tags_def */ + -4, /* (208) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + 0, /* (209) table_options ::= */ + -3, /* (210) table_options ::= table_options COMMENT NK_STRING */ + -3, /* (211) table_options ::= table_options MAX_DELAY duration_list */ + -3, /* (212) table_options ::= table_options WATERMARK duration_list */ + -5, /* (213) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + -3, /* (214) table_options ::= table_options TTL NK_INTEGER */ + -5, /* (215) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + -3, /* (216) table_options ::= table_options DELETE_MARK duration_list */ + -1, /* (217) alter_table_options ::= alter_table_option */ + -2, /* (218) alter_table_options ::= alter_table_options alter_table_option */ + -2, /* (219) alter_table_option ::= COMMENT NK_STRING */ + -2, /* (220) alter_table_option ::= TTL NK_INTEGER */ + -1, /* (221) duration_list ::= duration_literal */ + -3, /* (222) duration_list ::= duration_list NK_COMMA duration_literal */ + -1, /* (223) rollup_func_list ::= rollup_func_name */ + -3, /* (224) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + -1, /* (225) rollup_func_name ::= function_name */ + -1, /* (226) rollup_func_name ::= FIRST */ + -1, /* (227) rollup_func_name ::= LAST */ + -1, /* (228) col_name_list ::= col_name */ + -3, /* (229) col_name_list ::= col_name_list NK_COMMA col_name */ + -1, /* (230) col_name ::= column_name */ + -2, /* (231) cmd ::= SHOW DNODES */ + -2, /* (232) cmd ::= SHOW USERS */ + -3, /* (233) cmd ::= SHOW USER PRIVILEGES */ + -2, /* (234) cmd ::= SHOW DATABASES */ + -4, /* (235) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + -4, /* (236) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + -3, /* (237) cmd ::= SHOW db_name_cond_opt VGROUPS */ + -2, /* (238) cmd ::= SHOW MNODES */ + -2, /* (239) cmd ::= SHOW QNODES */ + -2, /* (240) cmd ::= SHOW FUNCTIONS */ + -5, /* (241) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + -2, /* (242) cmd ::= SHOW STREAMS */ + -2, /* (243) cmd ::= SHOW ACCOUNTS */ + -2, /* (244) cmd ::= SHOW APPS */ + -2, /* (245) cmd ::= SHOW CONNECTIONS */ + -2, /* (246) cmd ::= SHOW LICENCES */ + -2, /* (247) cmd ::= SHOW GRANTS */ + -4, /* (248) cmd ::= SHOW CREATE DATABASE db_name */ + -4, /* (249) cmd ::= SHOW CREATE TABLE full_table_name */ + -4, /* (250) cmd ::= SHOW CREATE STABLE full_table_name */ + -2, /* (251) cmd ::= SHOW QUERIES */ + -2, /* (252) cmd ::= SHOW SCORES */ + -2, /* (253) cmd ::= SHOW TOPICS */ + -2, /* (254) cmd ::= SHOW VARIABLES */ + -3, /* (255) cmd ::= SHOW CLUSTER VARIABLES */ + -3, /* (256) cmd ::= SHOW LOCAL VARIABLES */ + -5, /* (257) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + -2, /* (258) cmd ::= SHOW BNODES */ + -2, /* (259) cmd ::= SHOW SNODES */ + -2, /* (260) cmd ::= SHOW CLUSTER */ + -2, /* (261) cmd ::= SHOW TRANSACTIONS */ + -4, /* (262) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + -2, /* (263) cmd ::= SHOW CONSUMERS */ + -2, /* (264) cmd ::= SHOW SUBSCRIPTIONS */ + -5, /* (265) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + -7, /* (266) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + -3, /* (267) cmd ::= SHOW VNODES NK_INTEGER */ + -3, /* (268) cmd ::= SHOW VNODES NK_STRING */ + -3, /* (269) cmd ::= SHOW db_name_cond_opt ALIVE */ + -3, /* (270) cmd ::= SHOW CLUSTER ALIVE */ + 0, /* (271) db_name_cond_opt ::= */ + -2, /* (272) db_name_cond_opt ::= db_name NK_DOT */ + 0, /* (273) like_pattern_opt ::= */ + -2, /* (274) like_pattern_opt ::= LIKE NK_STRING */ + -1, /* (275) table_name_cond ::= table_name */ + 0, /* (276) from_db_opt ::= */ + -2, /* (277) from_db_opt ::= FROM db_name */ + 0, /* (278) tag_list_opt ::= */ + -1, /* (279) tag_list_opt ::= tag_item */ + -3, /* (280) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + -1, /* (281) tag_item ::= TBNAME */ + -1, /* (282) tag_item ::= QTAGS */ + -1, /* (283) tag_item ::= column_name */ + -2, /* (284) tag_item ::= column_name column_alias */ + -3, /* (285) tag_item ::= column_name AS column_alias */ + -8, /* (286) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ + -9, /* (287) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ + -4, /* (288) cmd ::= DROP INDEX exists_opt full_index_name */ + -1, /* (289) full_index_name ::= index_name */ + -3, /* (290) full_index_name ::= db_name NK_DOT index_name */ + -10, /* (291) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + -12, /* (292) 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 */ + -1, /* (293) func_list ::= func */ + -3, /* (294) func_list ::= func_list NK_COMMA func */ + -4, /* (295) func ::= sma_func_name NK_LP expression_list NK_RP */ + -1, /* (296) sma_func_name ::= function_name */ + -1, /* (297) sma_func_name ::= COUNT */ + -1, /* (298) sma_func_name ::= FIRST */ + -1, /* (299) sma_func_name ::= LAST */ + -1, /* (300) sma_func_name ::= LAST_ROW */ + 0, /* (301) sma_stream_opt ::= */ + -3, /* (302) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + -3, /* (303) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + -3, /* (304) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + -6, /* (305) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + -7, /* (306) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + -9, /* (307) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + -7, /* (308) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + -9, /* (309) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + -4, /* (310) cmd ::= DROP TOPIC exists_opt topic_name */ + -7, /* (311) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + -2, /* (312) cmd ::= DESC full_table_name */ + -2, /* (313) cmd ::= DESCRIBE full_table_name */ + -3, /* (314) cmd ::= RESET QUERY CACHE */ + -4, /* (315) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + -4, /* (316) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 0, /* (317) analyze_opt ::= */ + -1, /* (318) analyze_opt ::= ANALYZE */ + 0, /* (319) explain_options ::= */ + -3, /* (320) explain_options ::= explain_options VERBOSE NK_BOOL */ + -3, /* (321) explain_options ::= explain_options RATIO NK_FLOAT */ + -12, /* (322) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + -4, /* (323) cmd ::= DROP FUNCTION exists_opt function_name */ + 0, /* (324) agg_func_opt ::= */ + -1, /* (325) agg_func_opt ::= AGGREGATE */ + 0, /* (326) bufsize_opt ::= */ + -2, /* (327) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 0, /* (328) language_opt ::= */ + -2, /* (329) language_opt ::= LANGUAGE NK_STRING */ + 0, /* (330) or_replace_opt ::= */ + -2, /* (331) or_replace_opt ::= OR REPLACE */ + -12, /* (332) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ + -4, /* (333) cmd ::= DROP STREAM exists_opt stream_name */ + -4, /* (334) cmd ::= PAUSE STREAM exists_opt stream_name */ + -5, /* (335) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 0, /* (336) col_list_opt ::= */ + -3, /* (337) col_list_opt ::= NK_LP col_name_list NK_RP */ + 0, /* (338) tag_def_or_ref_opt ::= */ + -1, /* (339) tag_def_or_ref_opt ::= tags_def */ + -4, /* (340) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ + 0, /* (341) stream_options ::= */ + -3, /* (342) stream_options ::= stream_options TRIGGER AT_ONCE */ + -3, /* (343) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + -4, /* (344) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + -3, /* (345) stream_options ::= stream_options WATERMARK duration_literal */ + -4, /* (346) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + -3, /* (347) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + -3, /* (348) stream_options ::= stream_options DELETE_MARK duration_literal */ + -4, /* (349) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 0, /* (350) subtable_opt ::= */ + -4, /* (351) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 0, /* (352) ignore_opt ::= */ + -2, /* (353) ignore_opt ::= IGNORE UNTREATED */ + -3, /* (354) cmd ::= KILL CONNECTION NK_INTEGER */ + -3, /* (355) cmd ::= KILL QUERY NK_STRING */ + -3, /* (356) cmd ::= KILL TRANSACTION NK_INTEGER */ + -2, /* (357) cmd ::= BALANCE VGROUP */ + -3, /* (358) cmd ::= BALANCE VGROUP LEADER */ + -4, /* (359) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + -4, /* (360) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + -3, /* (361) cmd ::= SPLIT VGROUP NK_INTEGER */ + -2, /* (362) dnode_list ::= DNODE NK_INTEGER */ + -3, /* (363) dnode_list ::= dnode_list DNODE NK_INTEGER */ + -4, /* (364) cmd ::= DELETE FROM full_table_name where_clause_opt */ + -1, /* (365) cmd ::= query_or_subquery */ + -1, /* (366) cmd ::= insert_query */ + -7, /* (367) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + -4, /* (368) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + -1, /* (369) literal ::= NK_INTEGER */ + -1, /* (370) literal ::= NK_FLOAT */ + -1, /* (371) literal ::= NK_STRING */ + -1, /* (372) literal ::= NK_BOOL */ + -2, /* (373) literal ::= TIMESTAMP NK_STRING */ + -1, /* (374) literal ::= duration_literal */ + -1, /* (375) literal ::= NULL */ + -1, /* (376) literal ::= NK_QUESTION */ + -1, /* (377) duration_literal ::= NK_VARIABLE */ + -1, /* (378) signed ::= NK_INTEGER */ + -2, /* (379) signed ::= NK_PLUS NK_INTEGER */ + -2, /* (380) signed ::= NK_MINUS NK_INTEGER */ + -1, /* (381) signed ::= NK_FLOAT */ + -2, /* (382) signed ::= NK_PLUS NK_FLOAT */ + -2, /* (383) signed ::= NK_MINUS NK_FLOAT */ + -1, /* (384) signed_literal ::= signed */ + -1, /* (385) signed_literal ::= NK_STRING */ + -1, /* (386) signed_literal ::= NK_BOOL */ + -2, /* (387) signed_literal ::= TIMESTAMP NK_STRING */ + -1, /* (388) signed_literal ::= duration_literal */ + -1, /* (389) signed_literal ::= NULL */ + -1, /* (390) signed_literal ::= literal_func */ + -1, /* (391) signed_literal ::= NK_QUESTION */ + -1, /* (392) literal_list ::= signed_literal */ + -3, /* (393) literal_list ::= literal_list NK_COMMA signed_literal */ + -1, /* (394) db_name ::= NK_ID */ + -1, /* (395) table_name ::= NK_ID */ + -1, /* (396) column_name ::= NK_ID */ + -1, /* (397) function_name ::= NK_ID */ + -1, /* (398) table_alias ::= NK_ID */ + -1, /* (399) column_alias ::= NK_ID */ + -1, /* (400) user_name ::= NK_ID */ + -1, /* (401) topic_name ::= NK_ID */ + -1, /* (402) stream_name ::= NK_ID */ + -1, /* (403) cgroup_name ::= NK_ID */ + -1, /* (404) index_name ::= NK_ID */ + -1, /* (405) expr_or_subquery ::= expression */ + -1, /* (406) expression ::= literal */ + -1, /* (407) expression ::= pseudo_column */ + -1, /* (408) expression ::= column_reference */ + -1, /* (409) expression ::= function_expression */ + -1, /* (410) expression ::= case_when_expression */ + -3, /* (411) expression ::= NK_LP expression NK_RP */ + -2, /* (412) expression ::= NK_PLUS expr_or_subquery */ + -2, /* (413) expression ::= NK_MINUS expr_or_subquery */ + -3, /* (414) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + -3, /* (415) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + -3, /* (416) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + -3, /* (417) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + -3, /* (418) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + -3, /* (419) expression ::= column_reference NK_ARROW NK_STRING */ + -3, /* (420) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + -3, /* (421) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + -1, /* (422) expression_list ::= expr_or_subquery */ + -3, /* (423) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + -1, /* (424) column_reference ::= column_name */ + -3, /* (425) column_reference ::= table_name NK_DOT column_name */ + -1, /* (426) pseudo_column ::= ROWTS */ + -1, /* (427) pseudo_column ::= TBNAME */ + -3, /* (428) pseudo_column ::= table_name NK_DOT TBNAME */ + -1, /* (429) pseudo_column ::= QSTART */ + -1, /* (430) pseudo_column ::= QEND */ + -1, /* (431) pseudo_column ::= QDURATION */ + -1, /* (432) pseudo_column ::= WSTART */ + -1, /* (433) pseudo_column ::= WEND */ + -1, /* (434) pseudo_column ::= WDURATION */ + -1, /* (435) pseudo_column ::= IROWTS */ + -1, /* (436) pseudo_column ::= ISFILLED */ + -1, /* (437) pseudo_column ::= QTAGS */ + -4, /* (438) function_expression ::= function_name NK_LP expression_list NK_RP */ + -4, /* (439) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + -6, /* (440) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + -1, /* (441) function_expression ::= literal_func */ + -3, /* (442) literal_func ::= noarg_func NK_LP NK_RP */ + -1, /* (443) literal_func ::= NOW */ + -1, /* (444) noarg_func ::= NOW */ + -1, /* (445) noarg_func ::= TODAY */ + -1, /* (446) noarg_func ::= TIMEZONE */ + -1, /* (447) noarg_func ::= DATABASE */ + -1, /* (448) noarg_func ::= CLIENT_VERSION */ + -1, /* (449) noarg_func ::= SERVER_VERSION */ + -1, /* (450) noarg_func ::= SERVER_STATUS */ + -1, /* (451) noarg_func ::= CURRENT_USER */ + -1, /* (452) noarg_func ::= USER */ + -1, /* (453) star_func ::= COUNT */ + -1, /* (454) star_func ::= FIRST */ + -1, /* (455) star_func ::= LAST */ + -1, /* (456) star_func ::= LAST_ROW */ + -1, /* (457) star_func_para_list ::= NK_STAR */ + -1, /* (458) star_func_para_list ::= other_para_list */ + -1, /* (459) other_para_list ::= star_func_para */ + -3, /* (460) other_para_list ::= other_para_list NK_COMMA star_func_para */ + -1, /* (461) star_func_para ::= expr_or_subquery */ + -3, /* (462) star_func_para ::= table_name NK_DOT NK_STAR */ + -4, /* (463) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + -5, /* (464) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + -1, /* (465) when_then_list ::= when_then_expr */ + -2, /* (466) when_then_list ::= when_then_list when_then_expr */ + -4, /* (467) when_then_expr ::= WHEN common_expression THEN common_expression */ + 0, /* (468) case_when_else_opt ::= */ + -2, /* (469) case_when_else_opt ::= ELSE common_expression */ + -3, /* (470) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + -5, /* (471) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + -6, /* (472) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + -3, /* (473) predicate ::= expr_or_subquery IS NULL */ + -4, /* (474) predicate ::= expr_or_subquery IS NOT NULL */ + -3, /* (475) predicate ::= expr_or_subquery in_op in_predicate_value */ + -1, /* (476) compare_op ::= NK_LT */ + -1, /* (477) compare_op ::= NK_GT */ + -1, /* (478) compare_op ::= NK_LE */ + -1, /* (479) compare_op ::= NK_GE */ + -1, /* (480) compare_op ::= NK_NE */ + -1, /* (481) compare_op ::= NK_EQ */ + -1, /* (482) compare_op ::= LIKE */ + -2, /* (483) compare_op ::= NOT LIKE */ + -1, /* (484) compare_op ::= MATCH */ + -1, /* (485) compare_op ::= NMATCH */ + -1, /* (486) compare_op ::= CONTAINS */ + -1, /* (487) in_op ::= IN */ + -2, /* (488) in_op ::= NOT IN */ + -3, /* (489) in_predicate_value ::= NK_LP literal_list NK_RP */ + -1, /* (490) boolean_value_expression ::= boolean_primary */ + -2, /* (491) boolean_value_expression ::= NOT boolean_primary */ + -3, /* (492) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + -3, /* (493) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + -1, /* (494) boolean_primary ::= predicate */ + -3, /* (495) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + -1, /* (496) common_expression ::= expr_or_subquery */ + -1, /* (497) common_expression ::= boolean_value_expression */ + 0, /* (498) from_clause_opt ::= */ + -2, /* (499) from_clause_opt ::= FROM table_reference_list */ + -1, /* (500) table_reference_list ::= table_reference */ + -3, /* (501) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + -1, /* (502) table_reference ::= table_primary */ + -1, /* (503) table_reference ::= joined_table */ + -2, /* (504) table_primary ::= table_name alias_opt */ + -4, /* (505) table_primary ::= db_name NK_DOT table_name alias_opt */ + -2, /* (506) table_primary ::= subquery alias_opt */ + -1, /* (507) table_primary ::= parenthesized_joined_table */ + 0, /* (508) alias_opt ::= */ + -1, /* (509) alias_opt ::= table_alias */ + -2, /* (510) alias_opt ::= AS table_alias */ + -3, /* (511) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + -3, /* (512) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + -6, /* (513) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + 0, /* (514) join_type ::= */ + -1, /* (515) join_type ::= INNER */ + -12, /* (516) 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 */ + 0, /* (517) set_quantifier_opt ::= */ + -1, /* (518) set_quantifier_opt ::= DISTINCT */ + -1, /* (519) set_quantifier_opt ::= ALL */ + -1, /* (520) select_list ::= select_item */ + -3, /* (521) select_list ::= select_list NK_COMMA select_item */ + -1, /* (522) select_item ::= NK_STAR */ + -1, /* (523) select_item ::= common_expression */ + -2, /* (524) select_item ::= common_expression column_alias */ + -3, /* (525) select_item ::= common_expression AS column_alias */ + -3, /* (526) select_item ::= table_name NK_DOT NK_STAR */ + 0, /* (527) where_clause_opt ::= */ + -2, /* (528) where_clause_opt ::= WHERE search_condition */ + 0, /* (529) partition_by_clause_opt ::= */ + -3, /* (530) partition_by_clause_opt ::= PARTITION BY partition_list */ + -1, /* (531) partition_list ::= partition_item */ + -3, /* (532) partition_list ::= partition_list NK_COMMA partition_item */ + -1, /* (533) partition_item ::= expr_or_subquery */ + -2, /* (534) partition_item ::= expr_or_subquery column_alias */ + -3, /* (535) partition_item ::= expr_or_subquery AS column_alias */ + 0, /* (536) twindow_clause_opt ::= */ + -6, /* (537) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + -4, /* (538) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + -6, /* (539) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + -8, /* (540) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + -7, /* (541) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 0, /* (542) sliding_opt ::= */ + -4, /* (543) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + 0, /* (544) fill_opt ::= */ + -4, /* (545) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + -6, /* (546) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + -6, /* (547) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + -1, /* (548) fill_mode ::= NONE */ + -1, /* (549) fill_mode ::= PREV */ + -1, /* (550) fill_mode ::= NULL */ + -1, /* (551) fill_mode ::= NULL_F */ + -1, /* (552) fill_mode ::= LINEAR */ + -1, /* (553) fill_mode ::= NEXT */ + 0, /* (554) group_by_clause_opt ::= */ + -3, /* (555) group_by_clause_opt ::= GROUP BY group_by_list */ + -1, /* (556) group_by_list ::= expr_or_subquery */ + -3, /* (557) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 0, /* (558) having_clause_opt ::= */ + -2, /* (559) having_clause_opt ::= HAVING search_condition */ + 0, /* (560) range_opt ::= */ + -6, /* (561) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + 0, /* (562) every_opt ::= */ + -4, /* (563) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + -4, /* (564) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + -1, /* (565) query_simple ::= query_specification */ + -1, /* (566) query_simple ::= union_query_expression */ + -4, /* (567) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + -3, /* (568) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + -1, /* (569) query_simple_or_subquery ::= query_simple */ + -1, /* (570) query_simple_or_subquery ::= subquery */ + -1, /* (571) query_or_subquery ::= query_expression */ + -1, /* (572) query_or_subquery ::= subquery */ + 0, /* (573) order_by_clause_opt ::= */ + -3, /* (574) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 0, /* (575) slimit_clause_opt ::= */ + -2, /* (576) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + -4, /* (577) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + -4, /* (578) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 0, /* (579) limit_clause_opt ::= */ + -2, /* (580) limit_clause_opt ::= LIMIT NK_INTEGER */ + -4, /* (581) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + -4, /* (582) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + -3, /* (583) subquery ::= NK_LP query_expression NK_RP */ + -3, /* (584) subquery ::= NK_LP subquery NK_RP */ + -1, /* (585) search_condition ::= common_expression */ + -1, /* (586) sort_specification_list ::= sort_specification */ + -3, /* (587) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + -3, /* (588) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 0, /* (589) ordering_specification_opt ::= */ + -1, /* (590) ordering_specification_opt ::= ASC */ + -1, /* (591) ordering_specification_opt ::= DESC */ + 0, /* (592) null_ordering_opt ::= */ + -2, /* (593) null_ordering_opt ::= NULLS FIRST */ + -2, /* (594) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -4503,21 +4439,15 @@ static YYACTIONTYPE yy_reduce( /********** Begin reduce actions **********************************************/ YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ -#line 50 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 4509 "sql.c" - yy_destructor(yypParser,336,&yymsp[0].minor); + yy_destructor(yypParser,338,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ -#line 51 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 4515 "sql.c" - yy_destructor(yypParser,337,&yymsp[0].minor); + yy_destructor(yypParser,339,&yymsp[0].minor); break; case 2: /* account_options ::= */ -#line 55 "sql.y" { } -#line 4521 "sql.c" break; case 3: /* account_options ::= account_options PPS literal */ case 4: /* account_options ::= account_options TSERIES literal */ yytestcase(yyruleno==4); @@ -4528,26 +4458,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,336,&yymsp[-2].minor); -#line 56 "sql.y" +{ yy_destructor(yypParser,338,&yymsp[-2].minor); { } -#line 4535 "sql.c" - yy_destructor(yypParser,338,&yymsp[0].minor); + yy_destructor(yypParser,340,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,339,&yymsp[0].minor); -#line 68 "sql.y" +{ yy_destructor(yypParser,341,&yymsp[0].minor); { } -#line 4543 "sql.c" } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,337,&yymsp[-1].minor); -#line 69 "sql.y" +{ yy_destructor(yypParser,339,&yymsp[-1].minor); { } -#line 4550 "sql.c" - yy_destructor(yypParser,339,&yymsp[0].minor); + yy_destructor(yypParser,341,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -4560,2405 +4484,1631 @@ static YYACTIONTYPE yy_reduce( case 21: /* alter_account_option ::= USERS literal */ yytestcase(yyruleno==21); case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); -#line 73 "sql.y" { } -#line 4566 "sql.c" - yy_destructor(yypParser,338,&yymsp[0].minor); + yy_destructor(yypParser,340,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ -#line 85 "sql.y" -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy497, &yymsp[-1].minor.yy0, yymsp[0].minor.yy563); } -#line 4572 "sql.c" +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy669, &yymsp[-1].minor.yy0, yymsp[0].minor.yy73); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -#line 86 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy497, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } -#line 4577 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy669, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 26: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -#line 87 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy497, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } -#line 4582 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy669, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -#line 88 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy497, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } -#line 4587 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy669, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 28: /* cmd ::= DROP USER user_name */ -#line 89 "sql.y" -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy497); } -#line 4592 "sql.c" +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy669); } break; case 29: /* sysinfo_opt ::= */ -#line 93 "sql.y" -{ yymsp[1].minor.yy563 = 1; } -#line 4597 "sql.c" +{ yymsp[1].minor.yy73 = 1; } break; case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -#line 94 "sql.y" -{ yymsp[-1].minor.yy563 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } -#line 4602 "sql.c" +{ yymsp[-1].minor.yy73 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } break; case 31: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ -#line 97 "sql.y" -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy693, &yymsp[-3].minor.yy953, &yymsp[0].minor.yy497, yymsp[-2].minor.yy164); } -#line 4607 "sql.c" +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy349, &yymsp[-3].minor.yy257, &yymsp[0].minor.yy669, yymsp[-2].minor.yy242); } break; case 32: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ -#line 98 "sql.y" -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy693, &yymsp[-3].minor.yy953, &yymsp[0].minor.yy497, yymsp[-2].minor.yy164); } -#line 4612 "sql.c" +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy349, &yymsp[-3].minor.yy257, &yymsp[0].minor.yy669, yymsp[-2].minor.yy242); } break; case 33: /* privileges ::= ALL */ -#line 102 "sql.y" -{ yymsp[0].minor.yy693 = PRIVILEGE_TYPE_ALL; } -#line 4617 "sql.c" +{ yymsp[0].minor.yy349 = PRIVILEGE_TYPE_ALL; } break; case 34: /* privileges ::= priv_type_list */ case 36: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==36); -#line 103 "sql.y" -{ yylhsminor.yy693 = yymsp[0].minor.yy693; } -#line 4623 "sql.c" - yymsp[0].minor.yy693 = yylhsminor.yy693; +{ yylhsminor.yy349 = yymsp[0].minor.yy349; } + yymsp[0].minor.yy349 = yylhsminor.yy349; break; case 35: /* privileges ::= SUBSCRIBE */ -#line 104 "sql.y" -{ yymsp[0].minor.yy693 = PRIVILEGE_TYPE_SUBSCRIBE; } -#line 4629 "sql.c" +{ yymsp[0].minor.yy349 = PRIVILEGE_TYPE_SUBSCRIBE; } break; case 37: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -#line 109 "sql.y" -{ yylhsminor.yy693 = yymsp[-2].minor.yy693 | yymsp[0].minor.yy693; } -#line 4634 "sql.c" - yymsp[-2].minor.yy693 = yylhsminor.yy693; +{ yylhsminor.yy349 = yymsp[-2].minor.yy349 | yymsp[0].minor.yy349; } + yymsp[-2].minor.yy349 = yylhsminor.yy349; break; case 38: /* priv_type ::= READ */ -#line 113 "sql.y" -{ yymsp[0].minor.yy693 = PRIVILEGE_TYPE_READ; } -#line 4640 "sql.c" +{ yymsp[0].minor.yy349 = PRIVILEGE_TYPE_READ; } break; case 39: /* priv_type ::= WRITE */ -#line 114 "sql.y" -{ yymsp[0].minor.yy693 = PRIVILEGE_TYPE_WRITE; } -#line 4645 "sql.c" +{ yymsp[0].minor.yy349 = PRIVILEGE_TYPE_WRITE; } break; case 40: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -#line 118 "sql.y" -{ yylhsminor.yy953.first = yymsp[-2].minor.yy0; yylhsminor.yy953.second = yymsp[0].minor.yy0; } -#line 4650 "sql.c" - yymsp[-2].minor.yy953 = yylhsminor.yy953; +{ yylhsminor.yy257.first = yymsp[-2].minor.yy0; yylhsminor.yy257.second = yymsp[0].minor.yy0; } + yymsp[-2].minor.yy257 = yylhsminor.yy257; break; case 41: /* priv_level ::= db_name NK_DOT NK_STAR */ -#line 119 "sql.y" -{ yylhsminor.yy953.first = yymsp[-2].minor.yy497; yylhsminor.yy953.second = yymsp[0].minor.yy0; } -#line 4656 "sql.c" - yymsp[-2].minor.yy953 = yylhsminor.yy953; +{ yylhsminor.yy257.first = yymsp[-2].minor.yy669; yylhsminor.yy257.second = yymsp[0].minor.yy0; } + yymsp[-2].minor.yy257 = yylhsminor.yy257; break; case 42: /* priv_level ::= db_name NK_DOT table_name */ -#line 120 "sql.y" -{ yylhsminor.yy953.first = yymsp[-2].minor.yy497; yylhsminor.yy953.second = yymsp[0].minor.yy497; } -#line 4662 "sql.c" - yymsp[-2].minor.yy953 = yylhsminor.yy953; +{ yylhsminor.yy257.first = yymsp[-2].minor.yy669; yylhsminor.yy257.second = yymsp[0].minor.yy669; } + yymsp[-2].minor.yy257 = yylhsminor.yy257; break; case 43: /* priv_level ::= topic_name */ -#line 121 "sql.y" -{ yylhsminor.yy953.first = yymsp[0].minor.yy497; yylhsminor.yy953.second = nil_token; } -#line 4668 "sql.c" - yymsp[0].minor.yy953 = yylhsminor.yy953; +{ yylhsminor.yy257.first = yymsp[0].minor.yy669; yylhsminor.yy257.second = nil_token; } + yymsp[0].minor.yy257 = yylhsminor.yy257; break; case 44: /* with_opt ::= */ - case 141: /* start_opt ::= */ yytestcase(yyruleno==141); - case 145: /* end_opt ::= */ yytestcase(yyruleno==145); - case 269: /* like_pattern_opt ::= */ yytestcase(yyruleno==269); - case 346: /* subtable_opt ::= */ yytestcase(yyruleno==346); - case 464: /* case_when_else_opt ::= */ yytestcase(yyruleno==464); - case 494: /* from_clause_opt ::= */ yytestcase(yyruleno==494); - case 523: /* where_clause_opt ::= */ yytestcase(yyruleno==523); - case 532: /* twindow_clause_opt ::= */ yytestcase(yyruleno==532); - case 538: /* sliding_opt ::= */ yytestcase(yyruleno==538); - case 540: /* fill_opt ::= */ yytestcase(yyruleno==540); - case 554: /* having_clause_opt ::= */ yytestcase(yyruleno==554); - case 556: /* range_opt ::= */ yytestcase(yyruleno==556); - case 558: /* every_opt ::= */ yytestcase(yyruleno==558); - case 571: /* slimit_clause_opt ::= */ yytestcase(yyruleno==571); - case 575: /* limit_clause_opt ::= */ yytestcase(yyruleno==575); -#line 123 "sql.y" -{ yymsp[1].minor.yy164 = NULL; } -#line 4689 "sql.c" + case 144: /* start_opt ::= */ yytestcase(yyruleno==144); + case 148: /* end_opt ::= */ yytestcase(yyruleno==148); + case 273: /* like_pattern_opt ::= */ yytestcase(yyruleno==273); + case 350: /* subtable_opt ::= */ yytestcase(yyruleno==350); + case 468: /* case_when_else_opt ::= */ yytestcase(yyruleno==468); + case 498: /* from_clause_opt ::= */ yytestcase(yyruleno==498); + case 527: /* where_clause_opt ::= */ yytestcase(yyruleno==527); + case 536: /* twindow_clause_opt ::= */ yytestcase(yyruleno==536); + case 542: /* sliding_opt ::= */ yytestcase(yyruleno==542); + case 544: /* fill_opt ::= */ yytestcase(yyruleno==544); + case 558: /* having_clause_opt ::= */ yytestcase(yyruleno==558); + case 560: /* range_opt ::= */ yytestcase(yyruleno==560); + case 562: /* every_opt ::= */ yytestcase(yyruleno==562); + case 575: /* slimit_clause_opt ::= */ yytestcase(yyruleno==575); + case 579: /* limit_clause_opt ::= */ yytestcase(yyruleno==579); +{ yymsp[1].minor.yy242 = NULL; } break; case 45: /* with_opt ::= WITH search_condition */ - case 495: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==495); - case 524: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==524); - case 555: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==555); -#line 124 "sql.y" -{ yymsp[-1].minor.yy164 = yymsp[0].minor.yy164; } -#line 4697 "sql.c" + case 499: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==499); + case 528: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==528); + case 559: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==559); +{ yymsp[-1].minor.yy242 = yymsp[0].minor.yy242; } break; case 46: /* cmd ::= CREATE DNODE dnode_endpoint */ -#line 127 "sql.y" -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy497, NULL); } -#line 4702 "sql.c" +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy669, NULL); } break; case 47: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -#line 128 "sql.y" -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy497, &yymsp[0].minor.yy0); } -#line 4707 "sql.c" +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy669, &yymsp[0].minor.yy0); } break; case 48: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ -#line 129 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy441); } -#line 4712 "sql.c" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy777, false); } break; case 49: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ -#line 130 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy497, yymsp[0].minor.yy441); } -#line 4717 "sql.c" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy669, yymsp[0].minor.yy777, false); } break; - case 50: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ -#line 131 "sql.y" + case 50: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy777); } + break; + case 51: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy669, false, yymsp[0].minor.yy777); } + break; + case 52: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } -#line 4722 "sql.c" break; - case 51: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ -#line 132 "sql.y" + case 53: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 4727 "sql.c" break; - case 52: /* cmd ::= ALTER ALL DNODES NK_STRING */ -#line 133 "sql.y" + case 54: /* cmd ::= ALTER ALL DNODES NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); } -#line 4732 "sql.c" break; - case 53: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ -#line 134 "sql.y" + case 55: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 4737 "sql.c" break; - case 54: /* cmd ::= RESTORE DNODE NK_INTEGER */ -#line 135 "sql.y" + case 56: /* cmd ::= RESTORE DNODE NK_INTEGER */ { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_DNODE_STMT, &yymsp[0].minor.yy0); } -#line 4742 "sql.c" break; - case 55: /* dnode_endpoint ::= NK_STRING */ - case 56: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==56); - case 57: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==57); - case 293: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==293); - case 294: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==294); - case 295: /* sma_func_name ::= LAST */ yytestcase(yyruleno==295); - case 296: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==296); - case 390: /* db_name ::= NK_ID */ yytestcase(yyruleno==390); - case 391: /* table_name ::= NK_ID */ yytestcase(yyruleno==391); - case 392: /* column_name ::= NK_ID */ yytestcase(yyruleno==392); - case 393: /* function_name ::= NK_ID */ yytestcase(yyruleno==393); - case 394: /* table_alias ::= NK_ID */ yytestcase(yyruleno==394); - case 395: /* column_alias ::= NK_ID */ yytestcase(yyruleno==395); - case 396: /* user_name ::= NK_ID */ yytestcase(yyruleno==396); - case 397: /* topic_name ::= NK_ID */ yytestcase(yyruleno==397); - case 398: /* stream_name ::= NK_ID */ yytestcase(yyruleno==398); - case 399: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==399); - case 400: /* index_name ::= NK_ID */ yytestcase(yyruleno==400); - case 440: /* noarg_func ::= NOW */ yytestcase(yyruleno==440); - case 441: /* noarg_func ::= TODAY */ yytestcase(yyruleno==441); - case 442: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==442); - case 443: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==443); - case 444: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==444); - case 445: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==445); - case 446: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==446); - case 447: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==447); - case 448: /* noarg_func ::= USER */ yytestcase(yyruleno==448); - case 449: /* star_func ::= COUNT */ yytestcase(yyruleno==449); - case 450: /* star_func ::= FIRST */ yytestcase(yyruleno==450); - case 451: /* star_func ::= LAST */ yytestcase(yyruleno==451); - case 452: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==452); -#line 139 "sql.y" -{ yylhsminor.yy497 = yymsp[0].minor.yy0; } -#line 4777 "sql.c" - yymsp[0].minor.yy497 = yylhsminor.yy497; + case 57: /* dnode_endpoint ::= NK_STRING */ + case 58: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==58); + case 59: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==59); + case 297: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==297); + case 298: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==298); + case 299: /* sma_func_name ::= LAST */ yytestcase(yyruleno==299); + case 300: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==300); + case 394: /* db_name ::= NK_ID */ yytestcase(yyruleno==394); + case 395: /* table_name ::= NK_ID */ yytestcase(yyruleno==395); + case 396: /* column_name ::= NK_ID */ yytestcase(yyruleno==396); + case 397: /* function_name ::= NK_ID */ yytestcase(yyruleno==397); + case 398: /* table_alias ::= NK_ID */ yytestcase(yyruleno==398); + case 399: /* column_alias ::= NK_ID */ yytestcase(yyruleno==399); + case 400: /* user_name ::= NK_ID */ yytestcase(yyruleno==400); + case 401: /* topic_name ::= NK_ID */ yytestcase(yyruleno==401); + case 402: /* stream_name ::= NK_ID */ yytestcase(yyruleno==402); + case 403: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==403); + case 404: /* index_name ::= NK_ID */ yytestcase(yyruleno==404); + case 444: /* noarg_func ::= NOW */ yytestcase(yyruleno==444); + case 445: /* noarg_func ::= TODAY */ yytestcase(yyruleno==445); + case 446: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==446); + case 447: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==447); + case 448: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==448); + case 449: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==449); + case 450: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==450); + case 451: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==451); + case 452: /* noarg_func ::= USER */ yytestcase(yyruleno==452); + case 453: /* star_func ::= COUNT */ yytestcase(yyruleno==453); + case 454: /* star_func ::= FIRST */ yytestcase(yyruleno==454); + case 455: /* star_func ::= LAST */ yytestcase(yyruleno==455); + case 456: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==456); +{ yylhsminor.yy669 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy669 = yylhsminor.yy669; break; - case 58: /* force_opt ::= */ - case 81: /* not_exists_opt ::= */ yytestcase(yyruleno==81); - case 83: /* exists_opt ::= */ yytestcase(yyruleno==83); - case 313: /* analyze_opt ::= */ yytestcase(yyruleno==313); - case 320: /* agg_func_opt ::= */ yytestcase(yyruleno==320); - case 326: /* or_replace_opt ::= */ yytestcase(yyruleno==326); - case 348: /* ignore_opt ::= */ yytestcase(yyruleno==348); - case 513: /* set_quantifier_opt ::= */ yytestcase(yyruleno==513); -#line 145 "sql.y" -{ yymsp[1].minor.yy441 = false; } -#line 4790 "sql.c" + case 60: /* force_opt ::= */ + case 84: /* not_exists_opt ::= */ yytestcase(yyruleno==84); + case 86: /* exists_opt ::= */ yytestcase(yyruleno==86); + case 317: /* analyze_opt ::= */ yytestcase(yyruleno==317); + case 324: /* agg_func_opt ::= */ yytestcase(yyruleno==324); + case 330: /* or_replace_opt ::= */ yytestcase(yyruleno==330); + case 352: /* ignore_opt ::= */ yytestcase(yyruleno==352); + case 517: /* set_quantifier_opt ::= */ yytestcase(yyruleno==517); +{ yymsp[1].minor.yy777 = false; } break; - case 59: /* force_opt ::= FORCE */ - case 314: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==314); - case 321: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==321); - case 514: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==514); -#line 146 "sql.y" -{ yymsp[0].minor.yy441 = true; } -#line 4798 "sql.c" + case 61: /* force_opt ::= FORCE */ + case 62: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==62); + case 318: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==318); + case 325: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==325); + case 518: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==518); +{ yymsp[0].minor.yy777 = true; } break; - case 60: /* cmd ::= ALTER LOCAL NK_STRING */ -#line 149 "sql.y" + case 63: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 4803 "sql.c" break; - case 61: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */ -#line 150 "sql.y" + case 64: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 4808 "sql.c" break; - case 62: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ -#line 153 "sql.y" + case 65: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 4813 "sql.c" break; - case 63: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */ -#line 154 "sql.y" + case 66: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 4818 "sql.c" break; - case 64: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ -#line 155 "sql.y" + case 67: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 4823 "sql.c" break; - case 65: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ -#line 158 "sql.y" + case 68: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); } -#line 4828 "sql.c" break; - case 66: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */ -#line 159 "sql.y" + case 69: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); } -#line 4833 "sql.c" break; - case 67: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ -#line 162 "sql.y" + case 70: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); } -#line 4838 "sql.c" break; - case 68: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */ -#line 163 "sql.y" + case 71: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); } -#line 4843 "sql.c" break; - case 69: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ -#line 166 "sql.y" + case 72: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 4848 "sql.c" break; - case 70: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */ -#line 167 "sql.y" + case 73: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 4853 "sql.c" break; - case 71: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ -#line 168 "sql.y" + case 74: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 4858 "sql.c" break; - case 72: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ -#line 171 "sql.y" + case 75: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); } -#line 4863 "sql.c" break; - case 73: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -#line 174 "sql.y" -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy441, &yymsp[-1].minor.yy497, yymsp[0].minor.yy164); } -#line 4868 "sql.c" + case 76: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy777, &yymsp[-1].minor.yy669, yymsp[0].minor.yy242); } break; - case 74: /* cmd ::= DROP DATABASE exists_opt db_name */ -#line 175 "sql.y" -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy441, &yymsp[0].minor.yy497); } -#line 4873 "sql.c" + case 77: /* cmd ::= DROP DATABASE exists_opt db_name */ +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy777, &yymsp[0].minor.yy669); } break; - case 75: /* cmd ::= USE db_name */ -#line 176 "sql.y" -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy497); } -#line 4878 "sql.c" + case 78: /* cmd ::= USE db_name */ +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy669); } break; - case 76: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -#line 177 "sql.y" -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy497, yymsp[0].minor.yy164); } -#line 4883 "sql.c" + case 79: /* cmd ::= ALTER DATABASE db_name alter_db_options */ +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy669, yymsp[0].minor.yy242); } break; - case 77: /* cmd ::= FLUSH DATABASE db_name */ -#line 178 "sql.y" -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy497); } -#line 4888 "sql.c" + case 80: /* cmd ::= FLUSH DATABASE db_name */ +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy669); } break; - case 78: /* cmd ::= TRIM DATABASE db_name speed_opt */ -#line 179 "sql.y" -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy497, yymsp[0].minor.yy560); } -#line 4893 "sql.c" + case 81: /* cmd ::= TRIM DATABASE db_name speed_opt */ +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy669, yymsp[0].minor.yy120); } break; - case 79: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ -#line 180 "sql.y" -{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy497, yymsp[-1].minor.yy164, yymsp[0].minor.yy164); } -#line 4898 "sql.c" + case 82: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ +{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy669, yymsp[-1].minor.yy242, yymsp[0].minor.yy242); } break; - case 80: /* not_exists_opt ::= IF NOT EXISTS */ -#line 184 "sql.y" -{ yymsp[-2].minor.yy441 = true; } -#line 4903 "sql.c" + case 83: /* not_exists_opt ::= IF NOT EXISTS */ +{ yymsp[-2].minor.yy777 = true; } break; - case 82: /* exists_opt ::= IF EXISTS */ - case 327: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==327); - case 349: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==349); -#line 189 "sql.y" -{ yymsp[-1].minor.yy441 = true; } -#line 4910 "sql.c" + case 85: /* exists_opt ::= IF EXISTS */ + case 331: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==331); + case 353: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==353); +{ yymsp[-1].minor.yy777 = true; } break; - case 84: /* db_options ::= */ -#line 192 "sql.y" -{ yymsp[1].minor.yy164 = createDefaultDatabaseOptions(pCxt); } -#line 4915 "sql.c" + case 87: /* db_options ::= */ +{ yymsp[1].minor.yy242 = createDefaultDatabaseOptions(pCxt); } break; - case 85: /* db_options ::= db_options BUFFER NK_INTEGER */ -#line 193 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } -#line 4920 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 88: /* db_options ::= db_options BUFFER NK_INTEGER */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 86: /* db_options ::= db_options CACHEMODEL NK_STRING */ -#line 194 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } -#line 4926 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 89: /* db_options ::= db_options CACHEMODEL NK_STRING */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 87: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -#line 195 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } -#line 4932 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 90: /* db_options ::= db_options CACHESIZE NK_INTEGER */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 88: /* db_options ::= db_options COMP NK_INTEGER */ -#line 196 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_COMP, &yymsp[0].minor.yy0); } -#line 4938 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 91: /* db_options ::= db_options COMP NK_INTEGER */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 89: /* db_options ::= db_options DURATION NK_INTEGER */ - case 90: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==90); -#line 197 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } -#line 4945 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 92: /* db_options ::= db_options DURATION NK_INTEGER */ + case 93: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==93); +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 91: /* db_options ::= db_options MAXROWS NK_INTEGER */ -#line 199 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } -#line 4951 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 94: /* db_options ::= db_options MAXROWS NK_INTEGER */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 92: /* db_options ::= db_options MINROWS NK_INTEGER */ -#line 200 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } -#line 4957 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 95: /* db_options ::= db_options MINROWS NK_INTEGER */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 93: /* db_options ::= db_options KEEP integer_list */ - case 94: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==94); -#line 201 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_KEEP, yymsp[0].minor.yy72); } -#line 4964 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 96: /* db_options ::= db_options KEEP integer_list */ + case 97: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==97); +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_KEEP, yymsp[0].minor.yy174); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 95: /* db_options ::= db_options PAGES NK_INTEGER */ -#line 203 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } -#line 4970 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 98: /* db_options ::= db_options PAGES NK_INTEGER */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 96: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -#line 204 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } -#line 4976 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 99: /* db_options ::= db_options PAGESIZE NK_INTEGER */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 97: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ -#line 205 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } -#line 4982 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 100: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 98: /* db_options ::= db_options PRECISION NK_STRING */ -#line 206 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } -#line 4988 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 101: /* db_options ::= db_options PRECISION NK_STRING */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 99: /* db_options ::= db_options REPLICA NK_INTEGER */ -#line 207 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } -#line 4994 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 102: /* db_options ::= db_options REPLICA NK_INTEGER */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 100: /* db_options ::= db_options VGROUPS NK_INTEGER */ -#line 209 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } -#line 5000 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 103: /* db_options ::= db_options VGROUPS NK_INTEGER */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 101: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -#line 210 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } -#line 5006 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 104: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 102: /* db_options ::= db_options RETENTIONS retention_list */ -#line 211 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_RETENTIONS, yymsp[0].minor.yy72); } -#line 5012 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 105: /* db_options ::= db_options RETENTIONS retention_list */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_RETENTIONS, yymsp[0].minor.yy174); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 103: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -#line 212 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } -#line 5018 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 106: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 104: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ -#line 213 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_WAL, &yymsp[0].minor.yy0); } -#line 5024 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 107: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 105: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ -#line 214 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } -#line 5030 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 108: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 106: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -#line 215 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } -#line 5036 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 109: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 107: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ -#line 216 "sql.y" + case 110: /* 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.yy164 = setDatabaseOption(pCxt, yymsp[-3].minor.yy164, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-3].minor.yy242, DB_OPTION_WAL_RETENTION_PERIOD, &t); } -#line 5046 "sql.c" - yymsp[-3].minor.yy164 = yylhsminor.yy164; + yymsp[-3].minor.yy242 = yylhsminor.yy242; break; - case 108: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -#line 221 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } -#line 5052 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 111: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 109: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ -#line 222 "sql.y" + case 112: /* 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.yy164 = setDatabaseOption(pCxt, yymsp[-3].minor.yy164, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-3].minor.yy242, DB_OPTION_WAL_RETENTION_SIZE, &t); } -#line 5062 "sql.c" - yymsp[-3].minor.yy164 = yylhsminor.yy164; + yymsp[-3].minor.yy242 = yylhsminor.yy242; break; - case 110: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -#line 227 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } -#line 5068 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 113: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 111: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -#line 228 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } -#line 5074 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 114: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 112: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ -#line 229 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } -#line 5080 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 115: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 113: /* db_options ::= db_options TABLE_PREFIX signed */ -#line 230 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy164); } -#line 5086 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 116: /* db_options ::= db_options TABLE_PREFIX signed */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy242); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 114: /* db_options ::= db_options TABLE_SUFFIX signed */ -#line 231 "sql.y" -{ yylhsminor.yy164 = setDatabaseOption(pCxt, yymsp[-2].minor.yy164, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy164); } -#line 5092 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 117: /* db_options ::= db_options TABLE_SUFFIX signed */ +{ yylhsminor.yy242 = setDatabaseOption(pCxt, yymsp[-2].minor.yy242, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy242); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 115: /* alter_db_options ::= alter_db_option */ -#line 233 "sql.y" -{ yylhsminor.yy164 = createAlterDatabaseOptions(pCxt); yylhsminor.yy164 = setAlterDatabaseOption(pCxt, yylhsminor.yy164, &yymsp[0].minor.yy761); } -#line 5098 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; + case 118: /* alter_db_options ::= alter_db_option */ +{ yylhsminor.yy242 = createAlterDatabaseOptions(pCxt); yylhsminor.yy242 = setAlterDatabaseOption(pCxt, yylhsminor.yy242, &yymsp[0].minor.yy535); } + yymsp[0].minor.yy242 = yylhsminor.yy242; break; - case 116: /* alter_db_options ::= alter_db_options alter_db_option */ -#line 234 "sql.y" -{ yylhsminor.yy164 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy164, &yymsp[0].minor.yy761); } -#line 5104 "sql.c" - yymsp[-1].minor.yy164 = yylhsminor.yy164; + case 119: /* alter_db_options ::= alter_db_options alter_db_option */ +{ yylhsminor.yy242 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy242, &yymsp[0].minor.yy535); } + yymsp[-1].minor.yy242 = yylhsminor.yy242; break; - case 117: /* alter_db_option ::= BUFFER NK_INTEGER */ -#line 238 "sql.y" -{ yymsp[-1].minor.yy761.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy761.val = yymsp[0].minor.yy0; } -#line 5110 "sql.c" + case 120: /* alter_db_option ::= BUFFER NK_INTEGER */ +{ yymsp[-1].minor.yy535.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; } break; - case 118: /* alter_db_option ::= CACHEMODEL NK_STRING */ -#line 239 "sql.y" -{ yymsp[-1].minor.yy761.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy761.val = yymsp[0].minor.yy0; } -#line 5115 "sql.c" + case 121: /* alter_db_option ::= CACHEMODEL NK_STRING */ +{ yymsp[-1].minor.yy535.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; } break; - case 119: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -#line 240 "sql.y" -{ yymsp[-1].minor.yy761.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy761.val = yymsp[0].minor.yy0; } -#line 5120 "sql.c" + case 122: /* alter_db_option ::= CACHESIZE NK_INTEGER */ +{ yymsp[-1].minor.yy535.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; } break; - case 120: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ -#line 241 "sql.y" -{ yymsp[-1].minor.yy761.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy761.val = yymsp[0].minor.yy0; } -#line 5125 "sql.c" + case 123: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ +{ yymsp[-1].minor.yy535.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; } break; - case 121: /* alter_db_option ::= KEEP integer_list */ - case 122: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==122); -#line 242 "sql.y" -{ yymsp[-1].minor.yy761.type = DB_OPTION_KEEP; yymsp[-1].minor.yy761.pList = yymsp[0].minor.yy72; } -#line 5131 "sql.c" + case 124: /* alter_db_option ::= KEEP integer_list */ + case 125: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==125); +{ yymsp[-1].minor.yy535.type = DB_OPTION_KEEP; yymsp[-1].minor.yy535.pList = yymsp[0].minor.yy174; } break; - case 123: /* alter_db_option ::= PAGES NK_INTEGER */ -#line 244 "sql.y" -{ yymsp[-1].minor.yy761.type = DB_OPTION_PAGES; yymsp[-1].minor.yy761.val = yymsp[0].minor.yy0; } -#line 5136 "sql.c" + case 126: /* alter_db_option ::= PAGES NK_INTEGER */ +{ yymsp[-1].minor.yy535.type = DB_OPTION_PAGES; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; } break; - case 124: /* alter_db_option ::= REPLICA NK_INTEGER */ -#line 245 "sql.y" -{ yymsp[-1].minor.yy761.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy761.val = yymsp[0].minor.yy0; } -#line 5141 "sql.c" + case 127: /* alter_db_option ::= REPLICA NK_INTEGER */ +{ yymsp[-1].minor.yy535.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; } break; - case 125: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ -#line 247 "sql.y" -{ yymsp[-1].minor.yy761.type = DB_OPTION_WAL; yymsp[-1].minor.yy761.val = yymsp[0].minor.yy0; } -#line 5146 "sql.c" + case 128: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ +{ yymsp[-1].minor.yy535.type = DB_OPTION_WAL; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; } break; - case 126: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ -#line 248 "sql.y" -{ yymsp[-1].minor.yy761.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy761.val = yymsp[0].minor.yy0; } -#line 5151 "sql.c" + case 129: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ +{ yymsp[-1].minor.yy535.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; } break; - case 127: /* alter_db_option ::= MINROWS NK_INTEGER */ -#line 249 "sql.y" -{ yymsp[-1].minor.yy761.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy761.val = yymsp[0].minor.yy0; } -#line 5156 "sql.c" + case 130: /* alter_db_option ::= MINROWS NK_INTEGER */ +{ yymsp[-1].minor.yy535.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; } break; - case 128: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ -#line 250 "sql.y" -{ yymsp[-1].minor.yy761.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy761.val = yymsp[0].minor.yy0; } -#line 5161 "sql.c" + case 131: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ +{ yymsp[-1].minor.yy535.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; } break; - case 129: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ -#line 251 "sql.y" + case 132: /* alter_db_option ::= 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; - yymsp[-2].minor.yy761.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy761.val = t; + yymsp[-2].minor.yy535.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy535.val = t; } -#line 5170 "sql.c" break; - case 130: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ -#line 256 "sql.y" -{ yymsp[-1].minor.yy761.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy761.val = yymsp[0].minor.yy0; } -#line 5175 "sql.c" + case 133: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ +{ yymsp[-1].minor.yy535.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; } break; - case 131: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ -#line 257 "sql.y" + case 134: /* alter_db_option ::= 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; - yymsp[-2].minor.yy761.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy761.val = t; + yymsp[-2].minor.yy535.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy535.val = t; } -#line 5184 "sql.c" - break; - case 132: /* integer_list ::= NK_INTEGER */ -#line 265 "sql.y" -{ yylhsminor.yy72 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 5189 "sql.c" - yymsp[0].minor.yy72 = yylhsminor.yy72; - break; - case 133: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 359: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==359); -#line 266 "sql.y" -{ yylhsminor.yy72 = addNodeToList(pCxt, yymsp[-2].minor.yy72, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 5196 "sql.c" - yymsp[-2].minor.yy72 = yylhsminor.yy72; - break; - case 134: /* variable_list ::= NK_VARIABLE */ -#line 270 "sql.y" -{ yylhsminor.yy72 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 5202 "sql.c" - yymsp[0].minor.yy72 = yylhsminor.yy72; - break; - case 135: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -#line 271 "sql.y" -{ yylhsminor.yy72 = addNodeToList(pCxt, yymsp[-2].minor.yy72, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 5208 "sql.c" - yymsp[-2].minor.yy72 = yylhsminor.yy72; - break; - case 136: /* retention_list ::= retention */ - case 166: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==166); - case 169: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==169); - case 176: /* column_def_list ::= column_def */ yytestcase(yyruleno==176); - case 219: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==219); - case 224: /* col_name_list ::= col_name */ yytestcase(yyruleno==224); - case 275: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==275); - case 289: /* func_list ::= func */ yytestcase(yyruleno==289); - case 388: /* literal_list ::= signed_literal */ yytestcase(yyruleno==388); - case 455: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==455); - case 461: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==461); - case 516: /* select_list ::= select_item */ yytestcase(yyruleno==516); - case 527: /* partition_list ::= partition_item */ yytestcase(yyruleno==527); - case 582: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==582); -#line 275 "sql.y" -{ yylhsminor.yy72 = createNodeList(pCxt, yymsp[0].minor.yy164); } -#line 5227 "sql.c" - yymsp[0].minor.yy72 = yylhsminor.yy72; - break; - case 137: /* retention_list ::= retention_list NK_COMMA retention */ - case 170: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==170); - case 177: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==177); - case 220: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==220); - case 225: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==225); - case 276: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==276); - case 290: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==290); - case 389: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==389); - case 456: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==456); - case 517: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==517); - case 528: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==528); - case 583: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==583); -#line 276 "sql.y" -{ yylhsminor.yy72 = addNodeToList(pCxt, yymsp[-2].minor.yy72, yymsp[0].minor.yy164); } -#line 5244 "sql.c" - yymsp[-2].minor.yy72 = yylhsminor.yy72; - break; - case 138: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -#line 278 "sql.y" -{ yylhsminor.yy164 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 5250 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; - break; - case 139: /* speed_opt ::= */ - case 322: /* bufsize_opt ::= */ yytestcase(yyruleno==322); -#line 282 "sql.y" -{ yymsp[1].minor.yy560 = 0; } -#line 5257 "sql.c" - break; - case 140: /* speed_opt ::= MAX_SPEED NK_INTEGER */ - case 323: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==323); -#line 283 "sql.y" -{ yymsp[-1].minor.yy560 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } -#line 5263 "sql.c" - break; - case 142: /* start_opt ::= START WITH NK_INTEGER */ - case 146: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==146); -#line 286 "sql.y" -{ yymsp[-2].minor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } -#line 5269 "sql.c" - break; - case 143: /* start_opt ::= START WITH NK_STRING */ - case 147: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==147); -#line 287 "sql.y" -{ yymsp[-2].minor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 5275 "sql.c" - break; - case 144: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ - case 148: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==148); -#line 288 "sql.y" -{ yymsp[-3].minor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 5281 "sql.c" - break; - case 149: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - case 151: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==151); -#line 297 "sql.y" -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy441, yymsp[-5].minor.yy164, yymsp[-3].minor.yy72, yymsp[-1].minor.yy72, yymsp[0].minor.yy164); } -#line 5287 "sql.c" - break; - case 150: /* cmd ::= CREATE TABLE multi_create_clause */ -#line 298 "sql.y" -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy72); } -#line 5292 "sql.c" - break; - case 152: /* cmd ::= DROP TABLE multi_drop_clause */ -#line 301 "sql.y" -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy72); } -#line 5297 "sql.c" - break; - case 153: /* cmd ::= DROP STABLE exists_opt full_table_name */ -#line 302 "sql.y" -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy441, yymsp[0].minor.yy164); } -#line 5302 "sql.c" - break; - case 154: /* cmd ::= ALTER TABLE alter_table_clause */ - case 361: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==361); - case 362: /* cmd ::= insert_query */ yytestcase(yyruleno==362); -#line 304 "sql.y" -{ pCxt->pRootNode = yymsp[0].minor.yy164; } -#line 5309 "sql.c" - break; - case 155: /* cmd ::= ALTER STABLE alter_table_clause */ -#line 305 "sql.y" -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy164); } -#line 5314 "sql.c" - break; - case 156: /* alter_table_clause ::= full_table_name alter_table_options */ -#line 307 "sql.y" -{ yylhsminor.yy164 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy164, yymsp[0].minor.yy164); } -#line 5319 "sql.c" - yymsp[-1].minor.yy164 = yylhsminor.yy164; - break; - case 157: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -#line 309 "sql.y" -{ yylhsminor.yy164 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy164, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy497, yymsp[0].minor.yy700); } -#line 5325 "sql.c" - yymsp[-4].minor.yy164 = yylhsminor.yy164; - break; - case 158: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -#line 310 "sql.y" -{ yylhsminor.yy164 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy164, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy497); } -#line 5331 "sql.c" - yymsp[-3].minor.yy164 = yylhsminor.yy164; - break; - case 159: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -#line 312 "sql.y" -{ yylhsminor.yy164 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy164, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy497, yymsp[0].minor.yy700); } -#line 5337 "sql.c" - yymsp[-4].minor.yy164 = yylhsminor.yy164; - break; - case 160: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -#line 314 "sql.y" -{ yylhsminor.yy164 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy164, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy497, &yymsp[0].minor.yy497); } -#line 5343 "sql.c" - yymsp[-4].minor.yy164 = yylhsminor.yy164; - break; - case 161: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -#line 316 "sql.y" -{ yylhsminor.yy164 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy164, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy497, yymsp[0].minor.yy700); } -#line 5349 "sql.c" - yymsp[-4].minor.yy164 = yylhsminor.yy164; - break; - case 162: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -#line 317 "sql.y" -{ yylhsminor.yy164 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy164, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy497); } -#line 5355 "sql.c" - yymsp[-3].minor.yy164 = yylhsminor.yy164; - break; - case 163: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -#line 319 "sql.y" -{ yylhsminor.yy164 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy164, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy497, yymsp[0].minor.yy700); } -#line 5361 "sql.c" - yymsp[-4].minor.yy164 = yylhsminor.yy164; - break; - case 164: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -#line 321 "sql.y" -{ yylhsminor.yy164 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy164, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy497, &yymsp[0].minor.yy497); } -#line 5367 "sql.c" - yymsp[-4].minor.yy164 = yylhsminor.yy164; - break; - case 165: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -#line 323 "sql.y" -{ yylhsminor.yy164 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy164, &yymsp[-2].minor.yy497, yymsp[0].minor.yy164); } -#line 5373 "sql.c" - yymsp[-5].minor.yy164 = yylhsminor.yy164; - break; - case 167: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 462: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==462); -#line 328 "sql.y" -{ yylhsminor.yy72 = addNodeToList(pCxt, yymsp[-1].minor.yy72, yymsp[0].minor.yy164); } -#line 5380 "sql.c" - yymsp[-1].minor.yy72 = yylhsminor.yy72; - break; - case 168: /* 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 */ -#line 332 "sql.y" -{ yylhsminor.yy164 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy441, yymsp[-8].minor.yy164, yymsp[-6].minor.yy164, yymsp[-5].minor.yy72, yymsp[-2].minor.yy72, yymsp[0].minor.yy164); } -#line 5386 "sql.c" - yymsp[-9].minor.yy164 = yylhsminor.yy164; - break; - case 171: /* drop_table_clause ::= exists_opt full_table_name */ -#line 339 "sql.y" -{ yylhsminor.yy164 = createDropTableClause(pCxt, yymsp[-1].minor.yy441, yymsp[0].minor.yy164); } -#line 5392 "sql.c" - yymsp[-1].minor.yy164 = yylhsminor.yy164; - break; - case 172: /* specific_cols_opt ::= */ - case 202: /* tags_def_opt ::= */ yytestcase(yyruleno==202); - case 274: /* tag_list_opt ::= */ yytestcase(yyruleno==274); - case 332: /* col_list_opt ::= */ yytestcase(yyruleno==332); - case 334: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==334); - case 525: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==525); - case 550: /* group_by_clause_opt ::= */ yytestcase(yyruleno==550); - case 569: /* order_by_clause_opt ::= */ yytestcase(yyruleno==569); -#line 343 "sql.y" -{ yymsp[1].minor.yy72 = NULL; } -#line 5405 "sql.c" - break; - case 173: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ - case 333: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==333); -#line 344 "sql.y" -{ yymsp[-2].minor.yy72 = yymsp[-1].minor.yy72; } -#line 5411 "sql.c" - break; - case 174: /* full_table_name ::= table_name */ -#line 346 "sql.y" -{ yylhsminor.yy164 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy497, NULL); } -#line 5416 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; - break; - case 175: /* full_table_name ::= db_name NK_DOT table_name */ -#line 347 "sql.y" -{ yylhsminor.yy164 = createRealTableNode(pCxt, &yymsp[-2].minor.yy497, &yymsp[0].minor.yy497, NULL); } -#line 5422 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; - break; - case 178: /* column_def ::= column_name type_name */ -#line 354 "sql.y" -{ yylhsminor.yy164 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy497, yymsp[0].minor.yy700, NULL); } -#line 5428 "sql.c" - yymsp[-1].minor.yy164 = yylhsminor.yy164; - break; - case 179: /* type_name ::= BOOL */ -#line 359 "sql.y" -{ yymsp[0].minor.yy700 = createDataType(TSDB_DATA_TYPE_BOOL); } -#line 5434 "sql.c" - break; - case 180: /* type_name ::= TINYINT */ -#line 360 "sql.y" -{ yymsp[0].minor.yy700 = createDataType(TSDB_DATA_TYPE_TINYINT); } -#line 5439 "sql.c" - break; - case 181: /* type_name ::= SMALLINT */ -#line 361 "sql.y" -{ yymsp[0].minor.yy700 = createDataType(TSDB_DATA_TYPE_SMALLINT); } -#line 5444 "sql.c" - break; - case 182: /* type_name ::= INT */ - case 183: /* type_name ::= INTEGER */ yytestcase(yyruleno==183); -#line 362 "sql.y" -{ yymsp[0].minor.yy700 = createDataType(TSDB_DATA_TYPE_INT); } -#line 5450 "sql.c" - break; - case 184: /* type_name ::= BIGINT */ -#line 364 "sql.y" -{ yymsp[0].minor.yy700 = createDataType(TSDB_DATA_TYPE_BIGINT); } -#line 5455 "sql.c" - break; - case 185: /* type_name ::= FLOAT */ -#line 365 "sql.y" -{ yymsp[0].minor.yy700 = createDataType(TSDB_DATA_TYPE_FLOAT); } -#line 5460 "sql.c" - break; - case 186: /* type_name ::= DOUBLE */ -#line 366 "sql.y" -{ yymsp[0].minor.yy700 = createDataType(TSDB_DATA_TYPE_DOUBLE); } -#line 5465 "sql.c" - break; - case 187: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -#line 367 "sql.y" -{ yymsp[-3].minor.yy700 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } -#line 5470 "sql.c" - break; - case 188: /* type_name ::= TIMESTAMP */ -#line 368 "sql.y" -{ yymsp[0].minor.yy700 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } -#line 5475 "sql.c" - break; - case 189: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -#line 369 "sql.y" -{ yymsp[-3].minor.yy700 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } -#line 5480 "sql.c" - break; - case 190: /* type_name ::= TINYINT UNSIGNED */ -#line 370 "sql.y" -{ yymsp[-1].minor.yy700 = createDataType(TSDB_DATA_TYPE_UTINYINT); } -#line 5485 "sql.c" - break; - case 191: /* type_name ::= SMALLINT UNSIGNED */ -#line 371 "sql.y" -{ yymsp[-1].minor.yy700 = createDataType(TSDB_DATA_TYPE_USMALLINT); } -#line 5490 "sql.c" - break; - case 192: /* type_name ::= INT UNSIGNED */ -#line 372 "sql.y" -{ yymsp[-1].minor.yy700 = createDataType(TSDB_DATA_TYPE_UINT); } -#line 5495 "sql.c" - break; - case 193: /* type_name ::= BIGINT UNSIGNED */ -#line 373 "sql.y" -{ yymsp[-1].minor.yy700 = createDataType(TSDB_DATA_TYPE_UBIGINT); } -#line 5500 "sql.c" - break; - case 194: /* type_name ::= JSON */ -#line 374 "sql.y" -{ yymsp[0].minor.yy700 = createDataType(TSDB_DATA_TYPE_JSON); } -#line 5505 "sql.c" - break; - case 195: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -#line 375 "sql.y" -{ yymsp[-3].minor.yy700 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } -#line 5510 "sql.c" - break; - case 196: /* type_name ::= MEDIUMBLOB */ -#line 376 "sql.y" -{ yymsp[0].minor.yy700 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } -#line 5515 "sql.c" - break; - case 197: /* type_name ::= BLOB */ -#line 377 "sql.y" -{ yymsp[0].minor.yy700 = createDataType(TSDB_DATA_TYPE_BLOB); } -#line 5520 "sql.c" - break; - case 198: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -#line 378 "sql.y" -{ yymsp[-3].minor.yy700 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } -#line 5525 "sql.c" - break; - case 199: /* type_name ::= DECIMAL */ -#line 379 "sql.y" -{ yymsp[0].minor.yy700 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 5530 "sql.c" - break; - case 200: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -#line 380 "sql.y" -{ yymsp[-3].minor.yy700 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 5535 "sql.c" - break; - case 201: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -#line 381 "sql.y" -{ yymsp[-5].minor.yy700 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 5540 "sql.c" - break; - case 203: /* tags_def_opt ::= tags_def */ - case 335: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==335); - case 454: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==454); -#line 386 "sql.y" -{ yylhsminor.yy72 = yymsp[0].minor.yy72; } -#line 5547 "sql.c" - yymsp[0].minor.yy72 = yylhsminor.yy72; - break; - case 204: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ - case 336: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==336); -#line 390 "sql.y" -{ yymsp[-3].minor.yy72 = yymsp[-1].minor.yy72; } -#line 5554 "sql.c" - break; - case 205: /* table_options ::= */ -#line 392 "sql.y" -{ yymsp[1].minor.yy164 = createDefaultTableOptions(pCxt); } -#line 5559 "sql.c" - break; - case 206: /* table_options ::= table_options COMMENT NK_STRING */ -#line 393 "sql.y" -{ yylhsminor.yy164 = setTableOption(pCxt, yymsp[-2].minor.yy164, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } -#line 5564 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; - break; - case 207: /* table_options ::= table_options MAX_DELAY duration_list */ -#line 394 "sql.y" -{ yylhsminor.yy164 = setTableOption(pCxt, yymsp[-2].minor.yy164, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy72); } -#line 5570 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; - break; - case 208: /* table_options ::= table_options WATERMARK duration_list */ -#line 395 "sql.y" -{ yylhsminor.yy164 = setTableOption(pCxt, yymsp[-2].minor.yy164, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy72); } -#line 5576 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; - break; - case 209: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -#line 396 "sql.y" -{ yylhsminor.yy164 = setTableOption(pCxt, yymsp[-4].minor.yy164, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy72); } -#line 5582 "sql.c" - yymsp[-4].minor.yy164 = yylhsminor.yy164; - break; - case 210: /* table_options ::= table_options TTL NK_INTEGER */ -#line 397 "sql.y" -{ yylhsminor.yy164 = setTableOption(pCxt, yymsp[-2].minor.yy164, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } -#line 5588 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; - break; - case 211: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -#line 398 "sql.y" -{ yylhsminor.yy164 = setTableOption(pCxt, yymsp[-4].minor.yy164, TABLE_OPTION_SMA, yymsp[-1].minor.yy72); } -#line 5594 "sql.c" - yymsp[-4].minor.yy164 = yylhsminor.yy164; - break; - case 212: /* table_options ::= table_options DELETE_MARK duration_list */ -#line 399 "sql.y" -{ yylhsminor.yy164 = setTableOption(pCxt, yymsp[-2].minor.yy164, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy72); } -#line 5600 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; - break; - case 213: /* alter_table_options ::= alter_table_option */ -#line 401 "sql.y" -{ yylhsminor.yy164 = createAlterTableOptions(pCxt); yylhsminor.yy164 = setTableOption(pCxt, yylhsminor.yy164, yymsp[0].minor.yy761.type, &yymsp[0].minor.yy761.val); } -#line 5606 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; - break; - case 214: /* alter_table_options ::= alter_table_options alter_table_option */ -#line 402 "sql.y" -{ yylhsminor.yy164 = setTableOption(pCxt, yymsp[-1].minor.yy164, yymsp[0].minor.yy761.type, &yymsp[0].minor.yy761.val); } -#line 5612 "sql.c" - yymsp[-1].minor.yy164 = yylhsminor.yy164; - break; - case 215: /* alter_table_option ::= COMMENT NK_STRING */ -#line 406 "sql.y" -{ yymsp[-1].minor.yy761.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy761.val = yymsp[0].minor.yy0; } -#line 5618 "sql.c" - break; - case 216: /* alter_table_option ::= TTL NK_INTEGER */ -#line 407 "sql.y" -{ yymsp[-1].minor.yy761.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy761.val = yymsp[0].minor.yy0; } -#line 5623 "sql.c" - break; - case 217: /* duration_list ::= duration_literal */ - case 418: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==418); -#line 411 "sql.y" -{ yylhsminor.yy72 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy164)); } -#line 5629 "sql.c" - yymsp[0].minor.yy72 = yylhsminor.yy72; - break; - case 218: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 419: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==419); -#line 412 "sql.y" -{ yylhsminor.yy72 = addNodeToList(pCxt, yymsp[-2].minor.yy72, releaseRawExprNode(pCxt, yymsp[0].minor.yy164)); } -#line 5636 "sql.c" - yymsp[-2].minor.yy72 = yylhsminor.yy72; - break; - case 221: /* rollup_func_name ::= function_name */ -#line 419 "sql.y" -{ yylhsminor.yy164 = createFunctionNode(pCxt, &yymsp[0].minor.yy497, NULL); } -#line 5642 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; - break; - case 222: /* rollup_func_name ::= FIRST */ - case 223: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==223); - case 278: /* tag_item ::= QTAGS */ yytestcase(yyruleno==278); -#line 420 "sql.y" -{ yylhsminor.yy164 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 5650 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; - break; - case 226: /* col_name ::= column_name */ - case 279: /* tag_item ::= column_name */ yytestcase(yyruleno==279); -#line 428 "sql.y" -{ yylhsminor.yy164 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy497); } -#line 5657 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; - break; - case 227: /* cmd ::= SHOW DNODES */ -#line 431 "sql.y" + break; + case 135: /* integer_list ::= NK_INTEGER */ +{ yylhsminor.yy174 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy174 = yylhsminor.yy174; + break; + case 136: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ + case 363: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==363); +{ yylhsminor.yy174 = addNodeToList(pCxt, yymsp[-2].minor.yy174, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy174 = yylhsminor.yy174; + break; + case 137: /* variable_list ::= NK_VARIABLE */ +{ yylhsminor.yy174 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy174 = yylhsminor.yy174; + break; + case 138: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ +{ yylhsminor.yy174 = addNodeToList(pCxt, yymsp[-2].minor.yy174, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy174 = yylhsminor.yy174; + break; + case 139: /* retention_list ::= retention */ + case 169: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==169); + case 172: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==172); + case 179: /* column_def_list ::= column_def */ yytestcase(yyruleno==179); + case 223: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==223); + case 228: /* col_name_list ::= col_name */ yytestcase(yyruleno==228); + case 279: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==279); + case 293: /* func_list ::= func */ yytestcase(yyruleno==293); + case 392: /* literal_list ::= signed_literal */ yytestcase(yyruleno==392); + case 459: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==459); + case 465: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==465); + case 520: /* select_list ::= select_item */ yytestcase(yyruleno==520); + case 531: /* partition_list ::= partition_item */ yytestcase(yyruleno==531); + case 586: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==586); +{ yylhsminor.yy174 = createNodeList(pCxt, yymsp[0].minor.yy242); } + yymsp[0].minor.yy174 = yylhsminor.yy174; + break; + case 140: /* retention_list ::= retention_list NK_COMMA retention */ + case 173: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==173); + case 180: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==180); + case 224: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==224); + case 229: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==229); + case 280: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==280); + case 294: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==294); + case 393: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==393); + case 460: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==460); + case 521: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==521); + case 532: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==532); + case 587: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==587); +{ yylhsminor.yy174 = addNodeToList(pCxt, yymsp[-2].minor.yy174, yymsp[0].minor.yy242); } + yymsp[-2].minor.yy174 = yylhsminor.yy174; + break; + case 141: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ +{ yylhsminor.yy242 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; + break; + case 142: /* speed_opt ::= */ + case 326: /* bufsize_opt ::= */ yytestcase(yyruleno==326); +{ yymsp[1].minor.yy120 = 0; } + break; + case 143: /* speed_opt ::= MAX_SPEED NK_INTEGER */ + case 327: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==327); +{ yymsp[-1].minor.yy120 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } + break; + case 145: /* start_opt ::= START WITH NK_INTEGER */ + case 149: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==149); +{ yymsp[-2].minor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + break; + case 146: /* start_opt ::= START WITH NK_STRING */ + case 150: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==150); +{ yymsp[-2].minor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + break; + case 147: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ + case 151: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==151); +{ yymsp[-3].minor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + break; + case 152: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + case 154: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==154); +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy777, yymsp[-5].minor.yy242, yymsp[-3].minor.yy174, yymsp[-1].minor.yy174, yymsp[0].minor.yy242); } + break; + case 153: /* cmd ::= CREATE TABLE multi_create_clause */ +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy174); } + break; + case 155: /* cmd ::= DROP TABLE multi_drop_clause */ +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy174); } + break; + case 156: /* cmd ::= DROP STABLE exists_opt full_table_name */ +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy777, yymsp[0].minor.yy242); } + break; + case 157: /* cmd ::= ALTER TABLE alter_table_clause */ + case 365: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==365); + case 366: /* cmd ::= insert_query */ yytestcase(yyruleno==366); +{ pCxt->pRootNode = yymsp[0].minor.yy242; } + break; + case 158: /* cmd ::= ALTER STABLE alter_table_clause */ +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy242); } + break; + case 159: /* alter_table_clause ::= full_table_name alter_table_options */ +{ yylhsminor.yy242 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy242, yymsp[0].minor.yy242); } + yymsp[-1].minor.yy242 = yylhsminor.yy242; + break; + case 160: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ +{ yylhsminor.yy242 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy242, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy669, yymsp[0].minor.yy794); } + yymsp[-4].minor.yy242 = yylhsminor.yy242; + break; + case 161: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ +{ yylhsminor.yy242 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy242, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy669); } + yymsp[-3].minor.yy242 = yylhsminor.yy242; + break; + case 162: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ +{ yylhsminor.yy242 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy242, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy669, yymsp[0].minor.yy794); } + yymsp[-4].minor.yy242 = yylhsminor.yy242; + break; + case 163: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ +{ yylhsminor.yy242 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy242, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy669, &yymsp[0].minor.yy669); } + yymsp[-4].minor.yy242 = yylhsminor.yy242; + break; + case 164: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ +{ yylhsminor.yy242 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy242, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy669, yymsp[0].minor.yy794); } + yymsp[-4].minor.yy242 = yylhsminor.yy242; + break; + case 165: /* alter_table_clause ::= full_table_name DROP TAG column_name */ +{ yylhsminor.yy242 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy242, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy669); } + yymsp[-3].minor.yy242 = yylhsminor.yy242; + break; + case 166: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ +{ yylhsminor.yy242 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy242, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy669, yymsp[0].minor.yy794); } + yymsp[-4].minor.yy242 = yylhsminor.yy242; + break; + case 167: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ +{ yylhsminor.yy242 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy242, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy669, &yymsp[0].minor.yy669); } + yymsp[-4].minor.yy242 = yylhsminor.yy242; + break; + case 168: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ +{ yylhsminor.yy242 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy242, &yymsp[-2].minor.yy669, yymsp[0].minor.yy242); } + yymsp[-5].minor.yy242 = yylhsminor.yy242; + break; + case 170: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ + case 466: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==466); +{ yylhsminor.yy174 = addNodeToList(pCxt, yymsp[-1].minor.yy174, yymsp[0].minor.yy242); } + yymsp[-1].minor.yy174 = yylhsminor.yy174; + break; + case 171: /* 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.yy242 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy777, yymsp[-8].minor.yy242, yymsp[-6].minor.yy242, yymsp[-5].minor.yy174, yymsp[-2].minor.yy174, yymsp[0].minor.yy242); } + yymsp[-9].minor.yy242 = yylhsminor.yy242; + break; + case 174: /* drop_table_clause ::= exists_opt full_table_name */ +{ yylhsminor.yy242 = createDropTableClause(pCxt, yymsp[-1].minor.yy777, yymsp[0].minor.yy242); } + yymsp[-1].minor.yy242 = yylhsminor.yy242; + break; + case 175: /* specific_cols_opt ::= */ + case 206: /* tags_def_opt ::= */ yytestcase(yyruleno==206); + case 278: /* tag_list_opt ::= */ yytestcase(yyruleno==278); + case 336: /* col_list_opt ::= */ yytestcase(yyruleno==336); + case 338: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==338); + case 529: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==529); + case 554: /* group_by_clause_opt ::= */ yytestcase(yyruleno==554); + case 573: /* order_by_clause_opt ::= */ yytestcase(yyruleno==573); +{ yymsp[1].minor.yy174 = NULL; } + break; + case 176: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ + case 337: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==337); +{ yymsp[-2].minor.yy174 = yymsp[-1].minor.yy174; } + break; + case 177: /* full_table_name ::= table_name */ +{ yylhsminor.yy242 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy669, NULL); } + yymsp[0].minor.yy242 = yylhsminor.yy242; + break; + case 178: /* full_table_name ::= db_name NK_DOT table_name */ +{ yylhsminor.yy242 = createRealTableNode(pCxt, &yymsp[-2].minor.yy669, &yymsp[0].minor.yy669, NULL); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; + break; + case 181: /* column_def ::= column_name type_name */ +{ yylhsminor.yy242 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy669, yymsp[0].minor.yy794, NULL); } + yymsp[-1].minor.yy242 = yylhsminor.yy242; + break; + case 182: /* type_name ::= BOOL */ +{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_BOOL); } + break; + case 183: /* type_name ::= TINYINT */ +{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_TINYINT); } + break; + case 184: /* type_name ::= SMALLINT */ +{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_SMALLINT); } + break; + case 185: /* type_name ::= INT */ + case 186: /* type_name ::= INTEGER */ yytestcase(yyruleno==186); +{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_INT); } + break; + case 187: /* type_name ::= BIGINT */ +{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_BIGINT); } + break; + case 188: /* type_name ::= FLOAT */ +{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_FLOAT); } + break; + case 189: /* type_name ::= DOUBLE */ +{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_DOUBLE); } + break; + case 190: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy794 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } + break; + case 191: /* type_name ::= TIMESTAMP */ +{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } + break; + case 192: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy794 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } + break; + case 193: /* type_name ::= TINYINT UNSIGNED */ +{ yymsp[-1].minor.yy794 = createDataType(TSDB_DATA_TYPE_UTINYINT); } + break; + case 194: /* type_name ::= SMALLINT UNSIGNED */ +{ yymsp[-1].minor.yy794 = createDataType(TSDB_DATA_TYPE_USMALLINT); } + break; + case 195: /* type_name ::= INT UNSIGNED */ +{ yymsp[-1].minor.yy794 = createDataType(TSDB_DATA_TYPE_UINT); } + break; + case 196: /* type_name ::= BIGINT UNSIGNED */ +{ yymsp[-1].minor.yy794 = createDataType(TSDB_DATA_TYPE_UBIGINT); } + break; + case 197: /* type_name ::= JSON */ +{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_JSON); } + break; + case 198: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy794 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } + break; + case 199: /* type_name ::= MEDIUMBLOB */ +{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } + break; + case 200: /* type_name ::= BLOB */ +{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_BLOB); } + break; + case 201: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy794 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } + break; + case 202: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy794 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } + break; + case 203: /* type_name ::= DECIMAL */ +{ yymsp[0].minor.yy794 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + break; + case 204: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy794 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + break; + case 205: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy794 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + break; + case 207: /* tags_def_opt ::= tags_def */ + case 339: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==339); + case 458: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==458); +{ yylhsminor.yy174 = yymsp[0].minor.yy174; } + yymsp[0].minor.yy174 = yylhsminor.yy174; + break; + case 208: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ + case 340: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==340); +{ yymsp[-3].minor.yy174 = yymsp[-1].minor.yy174; } + break; + case 209: /* table_options ::= */ +{ yymsp[1].minor.yy242 = createDefaultTableOptions(pCxt); } + break; + case 210: /* table_options ::= table_options COMMENT NK_STRING */ +{ yylhsminor.yy242 = setTableOption(pCxt, yymsp[-2].minor.yy242, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; + break; + case 211: /* table_options ::= table_options MAX_DELAY duration_list */ +{ yylhsminor.yy242 = setTableOption(pCxt, yymsp[-2].minor.yy242, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy174); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; + break; + case 212: /* table_options ::= table_options WATERMARK duration_list */ +{ yylhsminor.yy242 = setTableOption(pCxt, yymsp[-2].minor.yy242, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy174); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; + break; + case 213: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ +{ yylhsminor.yy242 = setTableOption(pCxt, yymsp[-4].minor.yy242, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy174); } + yymsp[-4].minor.yy242 = yylhsminor.yy242; + break; + case 214: /* table_options ::= table_options TTL NK_INTEGER */ +{ yylhsminor.yy242 = setTableOption(pCxt, yymsp[-2].minor.yy242, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; + break; + case 215: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ +{ yylhsminor.yy242 = setTableOption(pCxt, yymsp[-4].minor.yy242, TABLE_OPTION_SMA, yymsp[-1].minor.yy174); } + yymsp[-4].minor.yy242 = yylhsminor.yy242; + break; + case 216: /* table_options ::= table_options DELETE_MARK duration_list */ +{ yylhsminor.yy242 = setTableOption(pCxt, yymsp[-2].minor.yy242, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy174); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; + break; + case 217: /* alter_table_options ::= alter_table_option */ +{ yylhsminor.yy242 = createAlterTableOptions(pCxt); yylhsminor.yy242 = setTableOption(pCxt, yylhsminor.yy242, yymsp[0].minor.yy535.type, &yymsp[0].minor.yy535.val); } + yymsp[0].minor.yy242 = yylhsminor.yy242; + break; + case 218: /* alter_table_options ::= alter_table_options alter_table_option */ +{ yylhsminor.yy242 = setTableOption(pCxt, yymsp[-1].minor.yy242, yymsp[0].minor.yy535.type, &yymsp[0].minor.yy535.val); } + yymsp[-1].minor.yy242 = yylhsminor.yy242; + break; + case 219: /* alter_table_option ::= COMMENT NK_STRING */ +{ yymsp[-1].minor.yy535.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; } + break; + case 220: /* alter_table_option ::= TTL NK_INTEGER */ +{ yymsp[-1].minor.yy535.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy535.val = yymsp[0].minor.yy0; } + break; + case 221: /* duration_list ::= duration_literal */ + case 422: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==422); +{ yylhsminor.yy174 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy242)); } + yymsp[0].minor.yy174 = yylhsminor.yy174; + break; + case 222: /* duration_list ::= duration_list NK_COMMA duration_literal */ + case 423: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==423); +{ yylhsminor.yy174 = addNodeToList(pCxt, yymsp[-2].minor.yy174, releaseRawExprNode(pCxt, yymsp[0].minor.yy242)); } + yymsp[-2].minor.yy174 = yylhsminor.yy174; + break; + case 225: /* rollup_func_name ::= function_name */ +{ yylhsminor.yy242 = createFunctionNode(pCxt, &yymsp[0].minor.yy669, NULL); } + yymsp[0].minor.yy242 = yylhsminor.yy242; + break; + case 226: /* rollup_func_name ::= FIRST */ + case 227: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==227); + case 282: /* tag_item ::= QTAGS */ yytestcase(yyruleno==282); +{ yylhsminor.yy242 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy242 = yylhsminor.yy242; + break; + case 230: /* col_name ::= column_name */ + case 283: /* tag_item ::= column_name */ yytestcase(yyruleno==283); +{ yylhsminor.yy242 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy669); } + yymsp[0].minor.yy242 = yylhsminor.yy242; + break; + case 231: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } -#line 5663 "sql.c" break; - case 228: /* cmd ::= SHOW USERS */ -#line 432 "sql.y" + case 232: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } -#line 5668 "sql.c" break; - case 229: /* cmd ::= SHOW USER PRIVILEGES */ -#line 433 "sql.y" + case 233: /* cmd ::= SHOW USER PRIVILEGES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } -#line 5673 "sql.c" break; - case 230: /* cmd ::= SHOW DATABASES */ -#line 434 "sql.y" + case 234: /* cmd ::= SHOW DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } -#line 5678 "sql.c" break; - case 231: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -#line 435 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy164, yymsp[0].minor.yy164, OP_TYPE_LIKE); } -#line 5683 "sql.c" + case 235: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, OP_TYPE_LIKE); } break; - case 232: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -#line 436 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy164, yymsp[0].minor.yy164, OP_TYPE_LIKE); } -#line 5688 "sql.c" + case 236: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, OP_TYPE_LIKE); } break; - case 233: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -#line 437 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy164, NULL, OP_TYPE_LIKE); } -#line 5693 "sql.c" + case 237: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy242, NULL, OP_TYPE_LIKE); } break; - case 234: /* cmd ::= SHOW MNODES */ -#line 438 "sql.y" + case 238: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } -#line 5698 "sql.c" break; - case 235: /* cmd ::= SHOW QNODES */ -#line 440 "sql.y" + case 239: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } -#line 5703 "sql.c" break; - case 236: /* cmd ::= SHOW FUNCTIONS */ -#line 441 "sql.y" + case 240: /* cmd ::= SHOW FUNCTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } -#line 5708 "sql.c" break; - case 237: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -#line 442 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy164, yymsp[-1].minor.yy164, OP_TYPE_EQUAL); } -#line 5713 "sql.c" + case 241: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy242, yymsp[-1].minor.yy242, OP_TYPE_EQUAL); } break; - case 238: /* cmd ::= SHOW STREAMS */ -#line 443 "sql.y" + case 242: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } -#line 5718 "sql.c" break; - case 239: /* cmd ::= SHOW ACCOUNTS */ -#line 444 "sql.y" + case 243: /* cmd ::= SHOW ACCOUNTS */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 5723 "sql.c" break; - case 240: /* cmd ::= SHOW APPS */ -#line 445 "sql.y" + case 244: /* cmd ::= SHOW APPS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } -#line 5728 "sql.c" break; - case 241: /* cmd ::= SHOW CONNECTIONS */ -#line 446 "sql.y" + case 245: /* cmd ::= SHOW CONNECTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } -#line 5733 "sql.c" break; - case 242: /* cmd ::= SHOW LICENCES */ - case 243: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==243); -#line 447 "sql.y" + case 246: /* cmd ::= SHOW LICENCES */ + case 247: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==247); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } -#line 5739 "sql.c" break; - case 244: /* cmd ::= SHOW CREATE DATABASE db_name */ -#line 449 "sql.y" -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy497); } -#line 5744 "sql.c" + case 248: /* cmd ::= SHOW CREATE DATABASE db_name */ +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy669); } break; - case 245: /* cmd ::= SHOW CREATE TABLE full_table_name */ -#line 450 "sql.y" -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy164); } -#line 5749 "sql.c" + case 249: /* cmd ::= SHOW CREATE TABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy242); } break; - case 246: /* cmd ::= SHOW CREATE STABLE full_table_name */ -#line 451 "sql.y" -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy164); } -#line 5754 "sql.c" + case 250: /* cmd ::= SHOW CREATE STABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy242); } break; - case 247: /* cmd ::= SHOW QUERIES */ -#line 452 "sql.y" + case 251: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } -#line 5759 "sql.c" break; - case 248: /* cmd ::= SHOW SCORES */ -#line 453 "sql.y" + case 252: /* cmd ::= SHOW SCORES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } -#line 5764 "sql.c" break; - case 249: /* cmd ::= SHOW TOPICS */ -#line 454 "sql.y" + case 253: /* cmd ::= SHOW TOPICS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } -#line 5769 "sql.c" break; - case 250: /* cmd ::= SHOW VARIABLES */ - case 251: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==251); -#line 455 "sql.y" + case 254: /* cmd ::= SHOW VARIABLES */ + case 255: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==255); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } -#line 5775 "sql.c" break; - case 252: /* cmd ::= SHOW LOCAL VARIABLES */ -#line 457 "sql.y" + case 256: /* cmd ::= SHOW LOCAL VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } -#line 5780 "sql.c" break; - case 253: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ -#line 458 "sql.y" -{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy164); } -#line 5785 "sql.c" + case 257: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy242); } break; - case 254: /* cmd ::= SHOW BNODES */ -#line 459 "sql.y" + case 258: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } -#line 5790 "sql.c" break; - case 255: /* cmd ::= SHOW SNODES */ -#line 460 "sql.y" + case 259: /* cmd ::= SHOW SNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } -#line 5795 "sql.c" break; - case 256: /* cmd ::= SHOW CLUSTER */ -#line 461 "sql.y" + case 260: /* cmd ::= SHOW CLUSTER */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } -#line 5800 "sql.c" break; - case 257: /* cmd ::= SHOW TRANSACTIONS */ -#line 462 "sql.y" + case 261: /* cmd ::= SHOW TRANSACTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } -#line 5805 "sql.c" break; - case 258: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -#line 463 "sql.y" -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy164); } -#line 5810 "sql.c" + case 262: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy242); } break; - case 259: /* cmd ::= SHOW CONSUMERS */ -#line 464 "sql.y" + case 263: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } -#line 5815 "sql.c" break; - case 260: /* cmd ::= SHOW SUBSCRIPTIONS */ -#line 465 "sql.y" + case 264: /* cmd ::= SHOW SUBSCRIPTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } -#line 5820 "sql.c" break; - case 261: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -#line 466 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy164, yymsp[-1].minor.yy164, OP_TYPE_EQUAL); } -#line 5825 "sql.c" + case 265: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy242, yymsp[-1].minor.yy242, OP_TYPE_EQUAL); } break; - case 262: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ -#line 467 "sql.y" -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy164, yymsp[0].minor.yy164, yymsp[-3].minor.yy72); } -#line 5830 "sql.c" + case 266: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy242, yymsp[0].minor.yy242, yymsp[-3].minor.yy174); } break; - case 263: /* cmd ::= SHOW VNODES NK_INTEGER */ -#line 468 "sql.y" + case 267: /* cmd ::= SHOW VNODES NK_INTEGER */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } -#line 5835 "sql.c" break; - case 264: /* cmd ::= SHOW VNODES NK_STRING */ -#line 469 "sql.y" + case 268: /* cmd ::= SHOW VNODES NK_STRING */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, createValueNode(pCxt, TSDB_DATA_TYPE_VARCHAR, &yymsp[0].minor.yy0)); } -#line 5840 "sql.c" break; - case 265: /* cmd ::= SHOW db_name_cond_opt ALIVE */ -#line 471 "sql.y" -{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy164, QUERY_NODE_SHOW_DB_ALIVE_STMT); } -#line 5845 "sql.c" + case 269: /* cmd ::= SHOW db_name_cond_opt ALIVE */ +{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy242, QUERY_NODE_SHOW_DB_ALIVE_STMT); } break; - case 266: /* cmd ::= SHOW CLUSTER ALIVE */ -#line 472 "sql.y" + case 270: /* cmd ::= SHOW CLUSTER ALIVE */ { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } -#line 5850 "sql.c" break; - case 267: /* db_name_cond_opt ::= */ - case 272: /* from_db_opt ::= */ yytestcase(yyruleno==272); -#line 474 "sql.y" -{ yymsp[1].minor.yy164 = createDefaultDatabaseCondValue(pCxt); } -#line 5856 "sql.c" + case 271: /* db_name_cond_opt ::= */ + case 276: /* from_db_opt ::= */ yytestcase(yyruleno==276); +{ yymsp[1].minor.yy242 = createDefaultDatabaseCondValue(pCxt); } break; - case 268: /* db_name_cond_opt ::= db_name NK_DOT */ -#line 475 "sql.y" -{ yylhsminor.yy164 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy497); } -#line 5861 "sql.c" - yymsp[-1].minor.yy164 = yylhsminor.yy164; + case 272: /* db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy242 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy669); } + yymsp[-1].minor.yy242 = yylhsminor.yy242; break; - case 270: /* like_pattern_opt ::= LIKE NK_STRING */ -#line 478 "sql.y" -{ yymsp[-1].minor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } -#line 5867 "sql.c" + case 274: /* like_pattern_opt ::= LIKE NK_STRING */ +{ yymsp[-1].minor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 271: /* table_name_cond ::= table_name */ -#line 480 "sql.y" -{ yylhsminor.yy164 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy497); } -#line 5872 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; + case 275: /* table_name_cond ::= table_name */ +{ yylhsminor.yy242 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy669); } + yymsp[0].minor.yy242 = yylhsminor.yy242; break; - case 273: /* from_db_opt ::= FROM db_name */ -#line 483 "sql.y" -{ yymsp[-1].minor.yy164 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy497); } -#line 5878 "sql.c" + case 277: /* from_db_opt ::= FROM db_name */ +{ yymsp[-1].minor.yy242 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy669); } break; - case 277: /* tag_item ::= TBNAME */ -#line 491 "sql.y" -{ yylhsminor.yy164 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } -#line 5883 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; + case 281: /* tag_item ::= TBNAME */ +{ yylhsminor.yy242 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } + yymsp[0].minor.yy242 = yylhsminor.yy242; break; - case 280: /* tag_item ::= column_name column_alias */ -#line 494 "sql.y" -{ yylhsminor.yy164 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy497), &yymsp[0].minor.yy497); } -#line 5889 "sql.c" - yymsp[-1].minor.yy164 = yylhsminor.yy164; + case 284: /* tag_item ::= column_name column_alias */ +{ yylhsminor.yy242 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy669), &yymsp[0].minor.yy669); } + yymsp[-1].minor.yy242 = yylhsminor.yy242; break; - case 281: /* tag_item ::= column_name AS column_alias */ -#line 495 "sql.y" -{ yylhsminor.yy164 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy497), &yymsp[0].minor.yy497); } -#line 5895 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 285: /* tag_item ::= column_name AS column_alias */ +{ yylhsminor.yy242 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy669), &yymsp[0].minor.yy669); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 282: /* cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ -#line 499 "sql.y" -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy441, yymsp[-3].minor.yy164, yymsp[-1].minor.yy164, NULL, yymsp[0].minor.yy164); } -#line 5901 "sql.c" + case 286: /* cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy777, yymsp[-3].minor.yy242, yymsp[-1].minor.yy242, NULL, yymsp[0].minor.yy242); } break; - case 283: /* cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ -#line 501 "sql.y" -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy441, yymsp[-5].minor.yy164, yymsp[-3].minor.yy164, yymsp[-1].minor.yy72, NULL); } -#line 5906 "sql.c" + case 287: /* cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy777, yymsp[-5].minor.yy242, yymsp[-3].minor.yy242, yymsp[-1].minor.yy174, NULL); } break; - case 284: /* cmd ::= DROP INDEX exists_opt full_index_name */ -#line 502 "sql.y" -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy441, yymsp[0].minor.yy164); } -#line 5911 "sql.c" + case 288: /* cmd ::= DROP INDEX exists_opt full_index_name */ +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy777, yymsp[0].minor.yy242); } break; - case 285: /* full_index_name ::= index_name */ -#line 504 "sql.y" -{ yylhsminor.yy164 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy497); } -#line 5916 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; + case 289: /* full_index_name ::= index_name */ +{ yylhsminor.yy242 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy669); } + yymsp[0].minor.yy242 = yylhsminor.yy242; break; - case 286: /* full_index_name ::= db_name NK_DOT index_name */ -#line 505 "sql.y" -{ yylhsminor.yy164 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy497, &yymsp[0].minor.yy497); } -#line 5922 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 290: /* full_index_name ::= db_name NK_DOT index_name */ +{ yylhsminor.yy242 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy669, &yymsp[0].minor.yy669); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 287: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -#line 508 "sql.y" -{ yymsp[-9].minor.yy164 = createIndexOption(pCxt, yymsp[-7].minor.yy72, releaseRawExprNode(pCxt, yymsp[-3].minor.yy164), NULL, yymsp[-1].minor.yy164, yymsp[0].minor.yy164); } -#line 5928 "sql.c" + case 291: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ +{ yymsp[-9].minor.yy242 = createIndexOption(pCxt, yymsp[-7].minor.yy174, releaseRawExprNode(pCxt, yymsp[-3].minor.yy242), NULL, yymsp[-1].minor.yy242, yymsp[0].minor.yy242); } break; - case 288: /* 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 */ -#line 511 "sql.y" -{ yymsp[-11].minor.yy164 = createIndexOption(pCxt, yymsp[-9].minor.yy72, releaseRawExprNode(pCxt, yymsp[-5].minor.yy164), releaseRawExprNode(pCxt, yymsp[-3].minor.yy164), yymsp[-1].minor.yy164, yymsp[0].minor.yy164); } -#line 5933 "sql.c" + case 292: /* 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.yy242 = createIndexOption(pCxt, yymsp[-9].minor.yy174, releaseRawExprNode(pCxt, yymsp[-5].minor.yy242), releaseRawExprNode(pCxt, yymsp[-3].minor.yy242), yymsp[-1].minor.yy242, yymsp[0].minor.yy242); } break; - case 291: /* func ::= sma_func_name NK_LP expression_list NK_RP */ -#line 518 "sql.y" -{ yylhsminor.yy164 = createFunctionNode(pCxt, &yymsp[-3].minor.yy497, yymsp[-1].minor.yy72); } -#line 5938 "sql.c" - yymsp[-3].minor.yy164 = yylhsminor.yy164; + case 295: /* func ::= sma_func_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy242 = createFunctionNode(pCxt, &yymsp[-3].minor.yy669, yymsp[-1].minor.yy174); } + yymsp[-3].minor.yy242 = yylhsminor.yy242; break; - case 292: /* sma_func_name ::= function_name */ - case 505: /* alias_opt ::= table_alias */ yytestcase(yyruleno==505); -#line 522 "sql.y" -{ yylhsminor.yy497 = yymsp[0].minor.yy497; } -#line 5945 "sql.c" - yymsp[0].minor.yy497 = yylhsminor.yy497; + case 296: /* sma_func_name ::= function_name */ + case 509: /* alias_opt ::= table_alias */ yytestcase(yyruleno==509); +{ yylhsminor.yy669 = yymsp[0].minor.yy669; } + yymsp[0].minor.yy669 = yylhsminor.yy669; break; - case 297: /* sma_stream_opt ::= */ - case 337: /* stream_options ::= */ yytestcase(yyruleno==337); -#line 528 "sql.y" -{ yymsp[1].minor.yy164 = createStreamOptions(pCxt); } -#line 5952 "sql.c" + case 301: /* sma_stream_opt ::= */ + case 341: /* stream_options ::= */ yytestcase(yyruleno==341); +{ yymsp[1].minor.yy242 = createStreamOptions(pCxt); } break; - case 298: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ -#line 529 "sql.y" -{ ((SStreamOptions*)yymsp[-2].minor.yy164)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy164); yylhsminor.yy164 = yymsp[-2].minor.yy164; } -#line 5957 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 302: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy242)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy242); yylhsminor.yy242 = yymsp[-2].minor.yy242; } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 299: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ -#line 530 "sql.y" -{ ((SStreamOptions*)yymsp[-2].minor.yy164)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy164); yylhsminor.yy164 = yymsp[-2].minor.yy164; } -#line 5963 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 303: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy242)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy242); yylhsminor.yy242 = yymsp[-2].minor.yy242; } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 300: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ -#line 531 "sql.y" -{ ((SStreamOptions*)yymsp[-2].minor.yy164)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy164); yylhsminor.yy164 = yymsp[-2].minor.yy164; } -#line 5969 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 304: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy242)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy242); yylhsminor.yy242 = yymsp[-2].minor.yy242; } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 301: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -#line 534 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy441, &yymsp[-2].minor.yy497, yymsp[0].minor.yy164); } -#line 5975 "sql.c" + case 305: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy777, &yymsp[-2].minor.yy669, yymsp[0].minor.yy242); } break; - case 302: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ -#line 535 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy441, &yymsp[-3].minor.yy497, &yymsp[0].minor.yy497, false); } -#line 5980 "sql.c" + case 306: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy777, &yymsp[-3].minor.yy669, &yymsp[0].minor.yy669, false); } break; - case 303: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ -#line 537 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy441, &yymsp[-5].minor.yy497, &yymsp[0].minor.yy497, true); } -#line 5985 "sql.c" + case 307: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy777, &yymsp[-5].minor.yy669, &yymsp[0].minor.yy669, true); } break; - case 304: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ -#line 539 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy441, &yymsp[-3].minor.yy497, yymsp[0].minor.yy164, false); } -#line 5990 "sql.c" + case 308: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy777, &yymsp[-3].minor.yy669, yymsp[0].minor.yy242, false); } break; - case 305: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ -#line 541 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy441, &yymsp[-5].minor.yy497, yymsp[0].minor.yy164, true); } -#line 5995 "sql.c" + case 309: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy777, &yymsp[-5].minor.yy669, yymsp[0].minor.yy242, true); } break; - case 306: /* cmd ::= DROP TOPIC exists_opt topic_name */ -#line 542 "sql.y" -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy441, &yymsp[0].minor.yy497); } -#line 6000 "sql.c" + case 310: /* cmd ::= DROP TOPIC exists_opt topic_name */ +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy777, &yymsp[0].minor.yy669); } break; - case 307: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -#line 543 "sql.y" -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy441, &yymsp[-2].minor.yy497, &yymsp[0].minor.yy497); } -#line 6005 "sql.c" + case 311: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy777, &yymsp[-2].minor.yy669, &yymsp[0].minor.yy669); } break; - case 308: /* cmd ::= DESC full_table_name */ - case 309: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==309); -#line 546 "sql.y" -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy164); } -#line 6011 "sql.c" + case 312: /* cmd ::= DESC full_table_name */ + case 313: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==313); +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy242); } break; - case 310: /* cmd ::= RESET QUERY CACHE */ -#line 550 "sql.y" + case 314: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } -#line 6016 "sql.c" break; - case 311: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - case 312: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==312); -#line 553 "sql.y" -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy441, yymsp[-1].minor.yy164, yymsp[0].minor.yy164); } -#line 6022 "sql.c" + case 315: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + case 316: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==316); +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy777, yymsp[-1].minor.yy242, yymsp[0].minor.yy242); } break; - case 315: /* explain_options ::= */ -#line 561 "sql.y" -{ yymsp[1].minor.yy164 = createDefaultExplainOptions(pCxt); } -#line 6027 "sql.c" + case 319: /* explain_options ::= */ +{ yymsp[1].minor.yy242 = createDefaultExplainOptions(pCxt); } break; - case 316: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -#line 562 "sql.y" -{ yylhsminor.yy164 = setExplainVerbose(pCxt, yymsp[-2].minor.yy164, &yymsp[0].minor.yy0); } -#line 6032 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 320: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy242 = setExplainVerbose(pCxt, yymsp[-2].minor.yy242, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 317: /* explain_options ::= explain_options RATIO NK_FLOAT */ -#line 563 "sql.y" -{ yylhsminor.yy164 = setExplainRatio(pCxt, yymsp[-2].minor.yy164, &yymsp[0].minor.yy0); } -#line 6038 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 321: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy242 = setExplainRatio(pCxt, yymsp[-2].minor.yy242, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 318: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ -#line 568 "sql.y" -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy441, yymsp[-9].minor.yy441, &yymsp[-6].minor.yy497, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy700, yymsp[-1].minor.yy560, &yymsp[0].minor.yy497, yymsp[-10].minor.yy441); } -#line 6044 "sql.c" + case 322: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy777, yymsp[-9].minor.yy777, &yymsp[-6].minor.yy669, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy794, yymsp[-1].minor.yy120, &yymsp[0].minor.yy669, yymsp[-10].minor.yy777); } break; - case 319: /* cmd ::= DROP FUNCTION exists_opt function_name */ -#line 569 "sql.y" -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy441, &yymsp[0].minor.yy497); } -#line 6049 "sql.c" + case 323: /* cmd ::= DROP FUNCTION exists_opt function_name */ +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy777, &yymsp[0].minor.yy669); } break; - case 324: /* language_opt ::= */ -#line 583 "sql.y" -{ yymsp[1].minor.yy497 = nil_token; } -#line 6054 "sql.c" + case 328: /* language_opt ::= */ +{ yymsp[1].minor.yy669 = nil_token; } break; - case 325: /* language_opt ::= LANGUAGE NK_STRING */ -#line 584 "sql.y" -{ yymsp[-1].minor.yy497 = yymsp[0].minor.yy0; } -#line 6059 "sql.c" + case 329: /* language_opt ::= LANGUAGE NK_STRING */ +{ yymsp[-1].minor.yy669 = yymsp[0].minor.yy0; } break; - case 328: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ -#line 594 "sql.y" -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy441, &yymsp[-8].minor.yy497, yymsp[-5].minor.yy164, yymsp[-7].minor.yy164, yymsp[-3].minor.yy72, yymsp[-2].minor.yy164, yymsp[0].minor.yy164, yymsp[-4].minor.yy72); } -#line 6064 "sql.c" + case 332: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy777, &yymsp[-8].minor.yy669, yymsp[-5].minor.yy242, yymsp[-7].minor.yy242, yymsp[-3].minor.yy174, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, yymsp[-4].minor.yy174); } break; - case 329: /* cmd ::= DROP STREAM exists_opt stream_name */ -#line 595 "sql.y" -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy441, &yymsp[0].minor.yy497); } -#line 6069 "sql.c" + case 333: /* cmd ::= DROP STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy777, &yymsp[0].minor.yy669); } break; - case 330: /* cmd ::= PAUSE STREAM exists_opt stream_name */ -#line 596 "sql.y" -{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy441, &yymsp[0].minor.yy497); } -#line 6074 "sql.c" + case 334: /* cmd ::= PAUSE STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy777, &yymsp[0].minor.yy669); } break; - case 331: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ -#line 597 "sql.y" -{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy441, yymsp[-1].minor.yy441, &yymsp[0].minor.yy497); } -#line 6079 "sql.c" + case 335: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ +{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy777, yymsp[-1].minor.yy777, &yymsp[0].minor.yy669); } break; - case 338: /* stream_options ::= stream_options TRIGGER AT_ONCE */ - case 339: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==339); -#line 611 "sql.y" -{ yylhsminor.yy164 = setStreamOptions(pCxt, yymsp[-2].minor.yy164, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } -#line 6085 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 342: /* stream_options ::= stream_options TRIGGER AT_ONCE */ + case 343: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==343); +{ yylhsminor.yy242 = setStreamOptions(pCxt, yymsp[-2].minor.yy242, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 340: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -#line 613 "sql.y" -{ yylhsminor.yy164 = setStreamOptions(pCxt, yymsp[-3].minor.yy164, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy164)); } -#line 6091 "sql.c" - yymsp[-3].minor.yy164 = yylhsminor.yy164; + case 344: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +{ yylhsminor.yy242 = setStreamOptions(pCxt, yymsp[-3].minor.yy242, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy242)); } + yymsp[-3].minor.yy242 = yylhsminor.yy242; break; - case 341: /* stream_options ::= stream_options WATERMARK duration_literal */ -#line 614 "sql.y" -{ yylhsminor.yy164 = setStreamOptions(pCxt, yymsp[-2].minor.yy164, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy164)); } -#line 6097 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 345: /* stream_options ::= stream_options WATERMARK duration_literal */ +{ yylhsminor.yy242 = setStreamOptions(pCxt, yymsp[-2].minor.yy242, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy242)); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 342: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -#line 615 "sql.y" -{ yylhsminor.yy164 = setStreamOptions(pCxt, yymsp[-3].minor.yy164, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } -#line 6103 "sql.c" - yymsp[-3].minor.yy164 = yylhsminor.yy164; + case 346: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +{ yylhsminor.yy242 = setStreamOptions(pCxt, yymsp[-3].minor.yy242, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy242 = yylhsminor.yy242; break; - case 343: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ -#line 616 "sql.y" -{ yylhsminor.yy164 = setStreamOptions(pCxt, yymsp[-2].minor.yy164, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } -#line 6109 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 347: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ +{ yylhsminor.yy242 = setStreamOptions(pCxt, yymsp[-2].minor.yy242, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 344: /* stream_options ::= stream_options DELETE_MARK duration_literal */ -#line 617 "sql.y" -{ yylhsminor.yy164 = setStreamOptions(pCxt, yymsp[-2].minor.yy164, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy164)); } -#line 6115 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 348: /* stream_options ::= stream_options DELETE_MARK duration_literal */ +{ yylhsminor.yy242 = setStreamOptions(pCxt, yymsp[-2].minor.yy242, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy242)); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 345: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ -#line 618 "sql.y" -{ yylhsminor.yy164 = setStreamOptions(pCxt, yymsp[-3].minor.yy164, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } -#line 6121 "sql.c" - yymsp[-3].minor.yy164 = yylhsminor.yy164; + case 349: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ +{ yylhsminor.yy242 = setStreamOptions(pCxt, yymsp[-3].minor.yy242, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy242 = yylhsminor.yy242; break; - case 347: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 539: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==539); - case 559: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==559); -#line 621 "sql.y" -{ yymsp[-3].minor.yy164 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy164); } -#line 6129 "sql.c" + case 351: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 543: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==543); + case 563: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==563); +{ yymsp[-3].minor.yy242 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy242); } break; - case 350: /* cmd ::= KILL CONNECTION NK_INTEGER */ -#line 629 "sql.y" + case 354: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } -#line 6134 "sql.c" break; - case 351: /* cmd ::= KILL QUERY NK_STRING */ -#line 630 "sql.y" + case 355: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } -#line 6139 "sql.c" break; - case 352: /* cmd ::= KILL TRANSACTION NK_INTEGER */ -#line 631 "sql.y" + case 356: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } -#line 6144 "sql.c" break; - case 353: /* cmd ::= BALANCE VGROUP */ -#line 634 "sql.y" + case 357: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } -#line 6149 "sql.c" break; - case 354: /* cmd ::= BALANCE VGROUP LEADER */ -#line 635 "sql.y" + case 358: /* cmd ::= BALANCE VGROUP LEADER */ { pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt); } -#line 6154 "sql.c" break; - case 355: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ -#line 636 "sql.y" + case 359: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 6159 "sql.c" break; - case 356: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -#line 637 "sql.y" -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy72); } -#line 6164 "sql.c" + case 360: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy174); } break; - case 357: /* cmd ::= SPLIT VGROUP NK_INTEGER */ -#line 638 "sql.y" + case 361: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } -#line 6169 "sql.c" break; - case 358: /* dnode_list ::= DNODE NK_INTEGER */ -#line 642 "sql.y" -{ yymsp[-1].minor.yy72 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 6174 "sql.c" + case 362: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy174 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 360: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -#line 649 "sql.y" -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy164, yymsp[0].minor.yy164); } -#line 6179 "sql.c" + case 364: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy242, yymsp[0].minor.yy242); } break; - case 363: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ -#line 658 "sql.y" -{ yymsp[-6].minor.yy164 = createInsertStmt(pCxt, yymsp[-4].minor.yy164, yymsp[-2].minor.yy72, yymsp[0].minor.yy164); } -#line 6184 "sql.c" + case 367: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +{ yymsp[-6].minor.yy242 = createInsertStmt(pCxt, yymsp[-4].minor.yy242, yymsp[-2].minor.yy174, yymsp[0].minor.yy242); } break; - case 364: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ -#line 659 "sql.y" -{ yymsp[-3].minor.yy164 = createInsertStmt(pCxt, yymsp[-1].minor.yy164, NULL, yymsp[0].minor.yy164); } -#line 6189 "sql.c" + case 368: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ +{ yymsp[-3].minor.yy242 = createInsertStmt(pCxt, yymsp[-1].minor.yy242, NULL, yymsp[0].minor.yy242); } break; - case 365: /* literal ::= NK_INTEGER */ -#line 662 "sql.y" -{ yylhsminor.yy164 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } -#line 6194 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; + case 369: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy242 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy242 = yylhsminor.yy242; break; - case 366: /* literal ::= NK_FLOAT */ -#line 663 "sql.y" -{ yylhsminor.yy164 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } -#line 6200 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; + case 370: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy242 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy242 = yylhsminor.yy242; break; - case 367: /* literal ::= NK_STRING */ -#line 664 "sql.y" -{ yylhsminor.yy164 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 6206 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; + case 371: /* literal ::= NK_STRING */ +{ yylhsminor.yy242 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy242 = yylhsminor.yy242; break; - case 368: /* literal ::= NK_BOOL */ -#line 665 "sql.y" -{ yylhsminor.yy164 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } -#line 6212 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; + case 372: /* literal ::= NK_BOOL */ +{ yylhsminor.yy242 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy242 = yylhsminor.yy242; break; - case 369: /* literal ::= TIMESTAMP NK_STRING */ -#line 666 "sql.y" -{ yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } -#line 6218 "sql.c" - yymsp[-1].minor.yy164 = yylhsminor.yy164; + case 373: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy242 = yylhsminor.yy242; break; - case 370: /* literal ::= duration_literal */ - case 380: /* signed_literal ::= signed */ yytestcase(yyruleno==380); - case 401: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==401); - case 402: /* expression ::= literal */ yytestcase(yyruleno==402); - case 403: /* expression ::= pseudo_column */ yytestcase(yyruleno==403); - case 404: /* expression ::= column_reference */ yytestcase(yyruleno==404); - case 405: /* expression ::= function_expression */ yytestcase(yyruleno==405); - case 406: /* expression ::= case_when_expression */ yytestcase(yyruleno==406); - case 437: /* function_expression ::= literal_func */ yytestcase(yyruleno==437); - case 486: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==486); - case 490: /* boolean_primary ::= predicate */ yytestcase(yyruleno==490); - case 492: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==492); - case 493: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==493); - case 496: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==496); - case 498: /* table_reference ::= table_primary */ yytestcase(yyruleno==498); - case 499: /* table_reference ::= joined_table */ yytestcase(yyruleno==499); - case 503: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==503); - case 561: /* query_simple ::= query_specification */ yytestcase(yyruleno==561); - case 562: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==562); - case 565: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==565); - case 567: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==567); -#line 667 "sql.y" -{ yylhsminor.yy164 = yymsp[0].minor.yy164; } -#line 6244 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; + case 374: /* literal ::= duration_literal */ + case 384: /* signed_literal ::= signed */ yytestcase(yyruleno==384); + case 405: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==405); + case 406: /* expression ::= literal */ yytestcase(yyruleno==406); + case 407: /* expression ::= pseudo_column */ yytestcase(yyruleno==407); + case 408: /* expression ::= column_reference */ yytestcase(yyruleno==408); + case 409: /* expression ::= function_expression */ yytestcase(yyruleno==409); + case 410: /* expression ::= case_when_expression */ yytestcase(yyruleno==410); + case 441: /* function_expression ::= literal_func */ yytestcase(yyruleno==441); + case 490: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==490); + case 494: /* boolean_primary ::= predicate */ yytestcase(yyruleno==494); + case 496: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==496); + case 497: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==497); + case 500: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==500); + case 502: /* table_reference ::= table_primary */ yytestcase(yyruleno==502); + case 503: /* table_reference ::= joined_table */ yytestcase(yyruleno==503); + case 507: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==507); + case 565: /* query_simple ::= query_specification */ yytestcase(yyruleno==565); + case 566: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==566); + case 569: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==569); + case 571: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==571); +{ yylhsminor.yy242 = yymsp[0].minor.yy242; } + yymsp[0].minor.yy242 = yylhsminor.yy242; break; - case 371: /* literal ::= NULL */ -#line 668 "sql.y" -{ yylhsminor.yy164 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } -#line 6250 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; + case 375: /* literal ::= NULL */ +{ yylhsminor.yy242 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy242 = yylhsminor.yy242; break; - case 372: /* literal ::= NK_QUESTION */ -#line 669 "sql.y" -{ yylhsminor.yy164 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 6256 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; + case 376: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy242 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy242 = yylhsminor.yy242; break; - case 373: /* duration_literal ::= NK_VARIABLE */ -#line 671 "sql.y" -{ yylhsminor.yy164 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 6262 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; + case 377: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy242 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy242 = yylhsminor.yy242; break; - case 374: /* signed ::= NK_INTEGER */ -#line 673 "sql.y" -{ yylhsminor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } -#line 6268 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; + case 378: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy242 = yylhsminor.yy242; break; - case 375: /* signed ::= NK_PLUS NK_INTEGER */ -#line 674 "sql.y" -{ yymsp[-1].minor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } -#line 6274 "sql.c" + case 379: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } break; - case 376: /* signed ::= NK_MINUS NK_INTEGER */ -#line 675 "sql.y" + case 380: /* 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.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } -#line 6283 "sql.c" - yymsp[-1].minor.yy164 = yylhsminor.yy164; + yymsp[-1].minor.yy242 = yylhsminor.yy242; break; - case 377: /* signed ::= NK_FLOAT */ -#line 680 "sql.y" -{ yylhsminor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } -#line 6289 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; + case 381: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy242 = yylhsminor.yy242; break; - case 378: /* signed ::= NK_PLUS NK_FLOAT */ -#line 681 "sql.y" -{ yymsp[-1].minor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } -#line 6295 "sql.c" + case 382: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 379: /* signed ::= NK_MINUS NK_FLOAT */ -#line 682 "sql.y" + case 383: /* 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.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } -#line 6304 "sql.c" - yymsp[-1].minor.yy164 = yylhsminor.yy164; + yymsp[-1].minor.yy242 = yylhsminor.yy242; break; - case 381: /* signed_literal ::= NK_STRING */ -#line 689 "sql.y" -{ yylhsminor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } -#line 6310 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; + case 385: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy242 = yylhsminor.yy242; break; - case 382: /* signed_literal ::= NK_BOOL */ -#line 690 "sql.y" -{ yylhsminor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } -#line 6316 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; + case 386: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy242 = yylhsminor.yy242; break; - case 383: /* signed_literal ::= TIMESTAMP NK_STRING */ -#line 691 "sql.y" -{ yymsp[-1].minor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 6322 "sql.c" + case 387: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 384: /* signed_literal ::= duration_literal */ - case 386: /* signed_literal ::= literal_func */ yytestcase(yyruleno==386); - case 457: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==457); - case 519: /* select_item ::= common_expression */ yytestcase(yyruleno==519); - case 529: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==529); - case 566: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==566); - case 568: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==568); - case 581: /* search_condition ::= common_expression */ yytestcase(yyruleno==581); -#line 692 "sql.y" -{ yylhsminor.yy164 = releaseRawExprNode(pCxt, yymsp[0].minor.yy164); } -#line 6334 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; + case 388: /* signed_literal ::= duration_literal */ + case 390: /* signed_literal ::= literal_func */ yytestcase(yyruleno==390); + case 461: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==461); + case 523: /* select_item ::= common_expression */ yytestcase(yyruleno==523); + case 533: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==533); + case 570: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==570); + case 572: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==572); + case 585: /* search_condition ::= common_expression */ yytestcase(yyruleno==585); +{ yylhsminor.yy242 = releaseRawExprNode(pCxt, yymsp[0].minor.yy242); } + yymsp[0].minor.yy242 = yylhsminor.yy242; break; - case 385: /* signed_literal ::= NULL */ -#line 693 "sql.y" -{ yylhsminor.yy164 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } -#line 6340 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; + case 389: /* signed_literal ::= NULL */ +{ yylhsminor.yy242 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy242 = yylhsminor.yy242; break; - case 387: /* signed_literal ::= NK_QUESTION */ -#line 695 "sql.y" -{ yylhsminor.yy164 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } -#line 6346 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; + case 391: /* signed_literal ::= NK_QUESTION */ +{ yylhsminor.yy242 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy242 = yylhsminor.yy242; break; - case 407: /* expression ::= NK_LP expression NK_RP */ - case 491: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==491); - case 580: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==580); -#line 756 "sql.y" -{ yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy164)); } -#line 6354 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 411: /* expression ::= NK_LP expression NK_RP */ + case 495: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==495); + case 584: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==584); +{ yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy242)); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 408: /* expression ::= NK_PLUS expr_or_subquery */ -#line 757 "sql.y" + case 412: /* expression ::= NK_PLUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); - yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy164)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242); + yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy242)); } -#line 6363 "sql.c" - yymsp[-1].minor.yy164 = yylhsminor.yy164; + yymsp[-1].minor.yy242 = yylhsminor.yy242; break; - case 409: /* expression ::= NK_MINUS expr_or_subquery */ -#line 761 "sql.y" + case 413: /* expression ::= NK_MINUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); - yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy164), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242); + yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy242), NULL)); } -#line 6372 "sql.c" - yymsp[-1].minor.yy164 = yylhsminor.yy164; + yymsp[-1].minor.yy242 = yylhsminor.yy242; break; - case 410: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ -#line 765 "sql.y" + case 414: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); - yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242); + yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242))); } -#line 6382 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 411: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ -#line 770 "sql.y" + case 415: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); - yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242); + yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242))); } -#line 6392 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 412: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ -#line 775 "sql.y" + case 416: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); - yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242); + yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242))); } -#line 6402 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 413: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ -#line 780 "sql.y" + case 417: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); - yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242); + yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242))); } -#line 6412 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 414: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ -#line 785 "sql.y" + case 418: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); - yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242); + yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242))); } -#line 6422 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 415: /* expression ::= column_reference NK_ARROW NK_STRING */ -#line 790 "sql.y" + case 419: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); - yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242); + yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } -#line 6431 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 416: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ -#line 794 "sql.y" + case 420: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); - yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242); + yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242))); } -#line 6441 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 417: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ -#line 799 "sql.y" + case 421: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); - yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242); + yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242))); } -#line 6451 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 420: /* column_reference ::= column_name */ -#line 810 "sql.y" -{ yylhsminor.yy164 = createRawExprNode(pCxt, &yymsp[0].minor.yy497, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy497)); } -#line 6457 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; + case 424: /* column_reference ::= column_name */ +{ yylhsminor.yy242 = createRawExprNode(pCxt, &yymsp[0].minor.yy669, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy669)); } + yymsp[0].minor.yy242 = yylhsminor.yy242; break; - case 421: /* column_reference ::= table_name NK_DOT column_name */ -#line 811 "sql.y" -{ yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy497, &yymsp[0].minor.yy497, createColumnNode(pCxt, &yymsp[-2].minor.yy497, &yymsp[0].minor.yy497)); } -#line 6463 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 425: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy669, &yymsp[0].minor.yy669, createColumnNode(pCxt, &yymsp[-2].minor.yy669, &yymsp[0].minor.yy669)); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 422: /* pseudo_column ::= ROWTS */ - case 423: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==423); - case 425: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==425); - case 426: /* pseudo_column ::= QEND */ yytestcase(yyruleno==426); - case 427: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==427); - case 428: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==428); - case 429: /* pseudo_column ::= WEND */ yytestcase(yyruleno==429); - case 430: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==430); - case 431: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==431); - case 432: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==432); - case 433: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==433); - case 439: /* literal_func ::= NOW */ yytestcase(yyruleno==439); -#line 813 "sql.y" -{ yylhsminor.yy164 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } -#line 6480 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; + case 426: /* pseudo_column ::= ROWTS */ + case 427: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==427); + case 429: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==429); + case 430: /* pseudo_column ::= QEND */ yytestcase(yyruleno==430); + case 431: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==431); + case 432: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==432); + case 433: /* pseudo_column ::= WEND */ yytestcase(yyruleno==433); + case 434: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==434); + case 435: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==435); + case 436: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==436); + case 437: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==437); + case 443: /* literal_func ::= NOW */ yytestcase(yyruleno==443); +{ yylhsminor.yy242 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy242 = yylhsminor.yy242; break; - case 424: /* pseudo_column ::= table_name NK_DOT TBNAME */ -#line 815 "sql.y" -{ yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy497, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy497)))); } -#line 6486 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 428: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy669, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy669)))); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 434: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 435: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==435); -#line 826 "sql.y" -{ yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy497, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy497, yymsp[-1].minor.yy72)); } -#line 6493 "sql.c" - yymsp[-3].minor.yy164 = yylhsminor.yy164; + case 438: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 439: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==439); +{ yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy669, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy669, yymsp[-1].minor.yy174)); } + yymsp[-3].minor.yy242 = yylhsminor.yy242; break; - case 436: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ -#line 829 "sql.y" -{ yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy164), yymsp[-1].minor.yy700)); } -#line 6499 "sql.c" - yymsp[-5].minor.yy164 = yylhsminor.yy164; + case 440: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ +{ yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy242), yymsp[-1].minor.yy794)); } + yymsp[-5].minor.yy242 = yylhsminor.yy242; break; - case 438: /* literal_func ::= noarg_func NK_LP NK_RP */ -#line 832 "sql.y" -{ yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy497, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy497, NULL)); } -#line 6505 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 442: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy669, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy669, NULL)); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 453: /* star_func_para_list ::= NK_STAR */ -#line 856 "sql.y" -{ yylhsminor.yy72 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } -#line 6511 "sql.c" - yymsp[0].minor.yy72 = yylhsminor.yy72; + case 457: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy174 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy174 = yylhsminor.yy174; break; - case 458: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 522: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==522); -#line 865 "sql.y" -{ yylhsminor.yy164 = createColumnNode(pCxt, &yymsp[-2].minor.yy497, &yymsp[0].minor.yy0); } -#line 6518 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 462: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 526: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==526); +{ yylhsminor.yy242 = createColumnNode(pCxt, &yymsp[-2].minor.yy669, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 459: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ -#line 868 "sql.y" -{ yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy72, yymsp[-1].minor.yy164)); } -#line 6524 "sql.c" - yymsp[-3].minor.yy164 = yylhsminor.yy164; + case 463: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +{ yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy174, yymsp[-1].minor.yy242)); } + yymsp[-3].minor.yy242 = yylhsminor.yy242; break; - case 460: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -#line 870 "sql.y" -{ yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy164), yymsp[-2].minor.yy72, yymsp[-1].minor.yy164)); } -#line 6530 "sql.c" - yymsp[-4].minor.yy164 = yylhsminor.yy164; + case 464: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +{ yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy242), yymsp[-2].minor.yy174, yymsp[-1].minor.yy242)); } + yymsp[-4].minor.yy242 = yylhsminor.yy242; break; - case 463: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -#line 877 "sql.y" -{ yymsp[-3].minor.yy164 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164)); } -#line 6536 "sql.c" + case 467: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +{ yymsp[-3].minor.yy242 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242)); } break; - case 465: /* case_when_else_opt ::= ELSE common_expression */ -#line 880 "sql.y" -{ yymsp[-1].minor.yy164 = releaseRawExprNode(pCxt, yymsp[0].minor.yy164); } -#line 6541 "sql.c" + case 469: /* case_when_else_opt ::= ELSE common_expression */ +{ yymsp[-1].minor.yy242 = releaseRawExprNode(pCxt, yymsp[0].minor.yy242); } break; - case 466: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 471: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==471); -#line 883 "sql.y" + case 470: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 475: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==475); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); - yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy796, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242); + yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy70, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242))); } -#line 6551 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 467: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ -#line 890 "sql.y" + case 471: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy164); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); - yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy164), releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy242); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242); + yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy242), releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242))); } -#line 6561 "sql.c" - yymsp[-4].minor.yy164 = yylhsminor.yy164; + yymsp[-4].minor.yy242 = yylhsminor.yy242; break; - case 468: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ -#line 896 "sql.y" + case 472: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy164); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); - yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy164), releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy242); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242); + yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy242), releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242))); } -#line 6571 "sql.c" - yymsp[-5].minor.yy164 = yylhsminor.yy164; + yymsp[-5].minor.yy242 = yylhsminor.yy242; break; - case 469: /* predicate ::= expr_or_subquery IS NULL */ -#line 901 "sql.y" + case 473: /* predicate ::= expr_or_subquery IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); - yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242); + yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), NULL)); } -#line 6580 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 470: /* predicate ::= expr_or_subquery IS NOT NULL */ -#line 905 "sql.y" + case 474: /* predicate ::= expr_or_subquery IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy164); - yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy164), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy242); + yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy242), NULL)); } -#line 6589 "sql.c" - yymsp[-3].minor.yy164 = yylhsminor.yy164; + yymsp[-3].minor.yy242 = yylhsminor.yy242; break; - case 472: /* compare_op ::= NK_LT */ -#line 917 "sql.y" -{ yymsp[0].minor.yy796 = OP_TYPE_LOWER_THAN; } -#line 6595 "sql.c" + case 476: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy70 = OP_TYPE_LOWER_THAN; } break; - case 473: /* compare_op ::= NK_GT */ -#line 918 "sql.y" -{ yymsp[0].minor.yy796 = OP_TYPE_GREATER_THAN; } -#line 6600 "sql.c" + case 477: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy70 = OP_TYPE_GREATER_THAN; } break; - case 474: /* compare_op ::= NK_LE */ -#line 919 "sql.y" -{ yymsp[0].minor.yy796 = OP_TYPE_LOWER_EQUAL; } -#line 6605 "sql.c" + case 478: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy70 = OP_TYPE_LOWER_EQUAL; } break; - case 475: /* compare_op ::= NK_GE */ -#line 920 "sql.y" -{ yymsp[0].minor.yy796 = OP_TYPE_GREATER_EQUAL; } -#line 6610 "sql.c" + case 479: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy70 = OP_TYPE_GREATER_EQUAL; } break; - case 476: /* compare_op ::= NK_NE */ -#line 921 "sql.y" -{ yymsp[0].minor.yy796 = OP_TYPE_NOT_EQUAL; } -#line 6615 "sql.c" + case 480: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy70 = OP_TYPE_NOT_EQUAL; } break; - case 477: /* compare_op ::= NK_EQ */ -#line 922 "sql.y" -{ yymsp[0].minor.yy796 = OP_TYPE_EQUAL; } -#line 6620 "sql.c" + case 481: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy70 = OP_TYPE_EQUAL; } break; - case 478: /* compare_op ::= LIKE */ -#line 923 "sql.y" -{ yymsp[0].minor.yy796 = OP_TYPE_LIKE; } -#line 6625 "sql.c" + case 482: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy70 = OP_TYPE_LIKE; } break; - case 479: /* compare_op ::= NOT LIKE */ -#line 924 "sql.y" -{ yymsp[-1].minor.yy796 = OP_TYPE_NOT_LIKE; } -#line 6630 "sql.c" + case 483: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy70 = OP_TYPE_NOT_LIKE; } break; - case 480: /* compare_op ::= MATCH */ -#line 925 "sql.y" -{ yymsp[0].minor.yy796 = OP_TYPE_MATCH; } -#line 6635 "sql.c" + case 484: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy70 = OP_TYPE_MATCH; } break; - case 481: /* compare_op ::= NMATCH */ -#line 926 "sql.y" -{ yymsp[0].minor.yy796 = OP_TYPE_NMATCH; } -#line 6640 "sql.c" + case 485: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy70 = OP_TYPE_NMATCH; } break; - case 482: /* compare_op ::= CONTAINS */ -#line 927 "sql.y" -{ yymsp[0].minor.yy796 = OP_TYPE_JSON_CONTAINS; } -#line 6645 "sql.c" + case 486: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy70 = OP_TYPE_JSON_CONTAINS; } break; - case 483: /* in_op ::= IN */ -#line 931 "sql.y" -{ yymsp[0].minor.yy796 = OP_TYPE_IN; } -#line 6650 "sql.c" + case 487: /* in_op ::= IN */ +{ yymsp[0].minor.yy70 = OP_TYPE_IN; } break; - case 484: /* in_op ::= NOT IN */ -#line 932 "sql.y" -{ yymsp[-1].minor.yy796 = OP_TYPE_NOT_IN; } -#line 6655 "sql.c" + case 488: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy70 = OP_TYPE_NOT_IN; } break; - case 485: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -#line 934 "sql.y" -{ yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy72)); } -#line 6660 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 489: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +{ yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy174)); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 487: /* boolean_value_expression ::= NOT boolean_primary */ -#line 938 "sql.y" + case 491: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); - yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy164), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242); + yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy242), NULL)); } -#line 6669 "sql.c" - yymsp[-1].minor.yy164 = yylhsminor.yy164; + yymsp[-1].minor.yy242 = yylhsminor.yy242; break; - case 488: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ -#line 943 "sql.y" + case 492: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); - yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242); + yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242))); } -#line 6679 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 489: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ -#line 949 "sql.y" + case 493: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy164); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy164); - yylhsminor.yy164 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy242); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy242); + yylhsminor.yy242 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), releaseRawExprNode(pCxt, yymsp[0].minor.yy242))); } -#line 6689 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 497: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -#line 967 "sql.y" -{ yylhsminor.yy164 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy164, yymsp[0].minor.yy164, NULL); } -#line 6695 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 501: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy242 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy242, yymsp[0].minor.yy242, NULL); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 500: /* table_primary ::= table_name alias_opt */ -#line 973 "sql.y" -{ yylhsminor.yy164 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy497, &yymsp[0].minor.yy497); } -#line 6701 "sql.c" - yymsp[-1].minor.yy164 = yylhsminor.yy164; + case 504: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy242 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy669, &yymsp[0].minor.yy669); } + yymsp[-1].minor.yy242 = yylhsminor.yy242; break; - case 501: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -#line 974 "sql.y" -{ yylhsminor.yy164 = createRealTableNode(pCxt, &yymsp[-3].minor.yy497, &yymsp[-1].minor.yy497, &yymsp[0].minor.yy497); } -#line 6707 "sql.c" - yymsp[-3].minor.yy164 = yylhsminor.yy164; + case 505: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy242 = createRealTableNode(pCxt, &yymsp[-3].minor.yy669, &yymsp[-1].minor.yy669, &yymsp[0].minor.yy669); } + yymsp[-3].minor.yy242 = yylhsminor.yy242; break; - case 502: /* table_primary ::= subquery alias_opt */ -#line 975 "sql.y" -{ yylhsminor.yy164 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy164), &yymsp[0].minor.yy497); } -#line 6713 "sql.c" - yymsp[-1].minor.yy164 = yylhsminor.yy164; + case 506: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy242 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy242), &yymsp[0].minor.yy669); } + yymsp[-1].minor.yy242 = yylhsminor.yy242; break; - case 504: /* alias_opt ::= */ -#line 980 "sql.y" -{ yymsp[1].minor.yy497 = nil_token; } -#line 6719 "sql.c" + case 508: /* alias_opt ::= */ +{ yymsp[1].minor.yy669 = nil_token; } break; - case 506: /* alias_opt ::= AS table_alias */ -#line 982 "sql.y" -{ yymsp[-1].minor.yy497 = yymsp[0].minor.yy497; } -#line 6724 "sql.c" + case 510: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy669 = yymsp[0].minor.yy669; } break; - case 507: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 508: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==508); -#line 984 "sql.y" -{ yymsp[-2].minor.yy164 = yymsp[-1].minor.yy164; } -#line 6730 "sql.c" + case 511: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 512: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==512); +{ yymsp[-2].minor.yy242 = yymsp[-1].minor.yy242; } break; - case 509: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -#line 989 "sql.y" -{ yylhsminor.yy164 = createJoinTableNode(pCxt, yymsp[-4].minor.yy196, yymsp[-5].minor.yy164, yymsp[-2].minor.yy164, yymsp[0].minor.yy164); } -#line 6735 "sql.c" - yymsp[-5].minor.yy164 = yylhsminor.yy164; + case 513: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy242 = createJoinTableNode(pCxt, yymsp[-4].minor.yy482, yymsp[-5].minor.yy242, yymsp[-2].minor.yy242, yymsp[0].minor.yy242); } + yymsp[-5].minor.yy242 = yylhsminor.yy242; break; - case 510: /* join_type ::= */ -#line 993 "sql.y" -{ yymsp[1].minor.yy196 = JOIN_TYPE_INNER; } -#line 6741 "sql.c" + case 514: /* join_type ::= */ +{ yymsp[1].minor.yy482 = JOIN_TYPE_INNER; } break; - case 511: /* join_type ::= INNER */ -#line 994 "sql.y" -{ yymsp[0].minor.yy196 = JOIN_TYPE_INNER; } -#line 6746 "sql.c" + case 515: /* join_type ::= INNER */ +{ yymsp[0].minor.yy482 = JOIN_TYPE_INNER; } break; - case 512: /* 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 */ -#line 1000 "sql.y" + case 516: /* 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.yy164 = createSelectStmt(pCxt, yymsp[-10].minor.yy441, yymsp[-9].minor.yy72, yymsp[-8].minor.yy164); - yymsp[-11].minor.yy164 = addWhereClause(pCxt, yymsp[-11].minor.yy164, yymsp[-7].minor.yy164); - yymsp[-11].minor.yy164 = addPartitionByClause(pCxt, yymsp[-11].minor.yy164, yymsp[-6].minor.yy72); - yymsp[-11].minor.yy164 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy164, yymsp[-2].minor.yy164); - yymsp[-11].minor.yy164 = addGroupByClause(pCxt, yymsp[-11].minor.yy164, yymsp[-1].minor.yy72); - yymsp[-11].minor.yy164 = addHavingClause(pCxt, yymsp[-11].minor.yy164, yymsp[0].minor.yy164); - yymsp[-11].minor.yy164 = addRangeClause(pCxt, yymsp[-11].minor.yy164, yymsp[-5].minor.yy164); - yymsp[-11].minor.yy164 = addEveryClause(pCxt, yymsp[-11].minor.yy164, yymsp[-4].minor.yy164); - yymsp[-11].minor.yy164 = addFillClause(pCxt, yymsp[-11].minor.yy164, yymsp[-3].minor.yy164); + yymsp[-11].minor.yy242 = createSelectStmt(pCxt, yymsp[-10].minor.yy777, yymsp[-9].minor.yy174, yymsp[-8].minor.yy242); + yymsp[-11].minor.yy242 = addWhereClause(pCxt, yymsp[-11].minor.yy242, yymsp[-7].minor.yy242); + yymsp[-11].minor.yy242 = addPartitionByClause(pCxt, yymsp[-11].minor.yy242, yymsp[-6].minor.yy174); + yymsp[-11].minor.yy242 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy242, yymsp[-2].minor.yy242); + yymsp[-11].minor.yy242 = addGroupByClause(pCxt, yymsp[-11].minor.yy242, yymsp[-1].minor.yy174); + yymsp[-11].minor.yy242 = addHavingClause(pCxt, yymsp[-11].minor.yy242, yymsp[0].minor.yy242); + yymsp[-11].minor.yy242 = addRangeClause(pCxt, yymsp[-11].minor.yy242, yymsp[-5].minor.yy242); + yymsp[-11].minor.yy242 = addEveryClause(pCxt, yymsp[-11].minor.yy242, yymsp[-4].minor.yy242); + yymsp[-11].minor.yy242 = addFillClause(pCxt, yymsp[-11].minor.yy242, yymsp[-3].minor.yy242); } -#line 6761 "sql.c" break; - case 515: /* set_quantifier_opt ::= ALL */ -#line 1016 "sql.y" -{ yymsp[0].minor.yy441 = false; } -#line 6766 "sql.c" + case 519: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy777 = false; } break; - case 518: /* select_item ::= NK_STAR */ -#line 1023 "sql.y" -{ yylhsminor.yy164 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } -#line 6771 "sql.c" - yymsp[0].minor.yy164 = yylhsminor.yy164; + case 522: /* select_item ::= NK_STAR */ +{ yylhsminor.yy242 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy242 = yylhsminor.yy242; break; - case 520: /* select_item ::= common_expression column_alias */ - case 530: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==530); -#line 1025 "sql.y" -{ yylhsminor.yy164 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy164), &yymsp[0].minor.yy497); } -#line 6778 "sql.c" - yymsp[-1].minor.yy164 = yylhsminor.yy164; + case 524: /* select_item ::= common_expression column_alias */ + case 534: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==534); +{ yylhsminor.yy242 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy242), &yymsp[0].minor.yy669); } + yymsp[-1].minor.yy242 = yylhsminor.yy242; break; - case 521: /* select_item ::= common_expression AS column_alias */ - case 531: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==531); -#line 1026 "sql.y" -{ yylhsminor.yy164 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), &yymsp[0].minor.yy497); } -#line 6785 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 525: /* select_item ::= common_expression AS column_alias */ + case 535: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==535); +{ yylhsminor.yy242 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), &yymsp[0].minor.yy669); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 526: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 551: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==551); - case 570: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==570); -#line 1035 "sql.y" -{ yymsp[-2].minor.yy72 = yymsp[0].minor.yy72; } -#line 6793 "sql.c" + case 530: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 555: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==555); + case 574: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==574); +{ yymsp[-2].minor.yy174 = yymsp[0].minor.yy174; } break; - case 533: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -#line 1048 "sql.y" -{ yymsp[-5].minor.yy164 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy164), releaseRawExprNode(pCxt, yymsp[-1].minor.yy164)); } -#line 6798 "sql.c" + case 537: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy242 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy242), releaseRawExprNode(pCxt, yymsp[-1].minor.yy242)); } break; - case 534: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -#line 1049 "sql.y" -{ yymsp[-3].minor.yy164 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy164)); } -#line 6803 "sql.c" + case 538: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy242 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy242)); } break; - case 535: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -#line 1051 "sql.y" -{ yymsp[-5].minor.yy164 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy164), NULL, yymsp[-1].minor.yy164, yymsp[0].minor.yy164); } -#line 6808 "sql.c" + case 539: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy242 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy242), NULL, yymsp[-1].minor.yy242, yymsp[0].minor.yy242); } break; - case 536: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -#line 1054 "sql.y" -{ yymsp[-7].minor.yy164 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy164), releaseRawExprNode(pCxt, yymsp[-3].minor.yy164), yymsp[-1].minor.yy164, yymsp[0].minor.yy164); } -#line 6813 "sql.c" + case 540: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy242 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy242), releaseRawExprNode(pCxt, yymsp[-3].minor.yy242), yymsp[-1].minor.yy242, yymsp[0].minor.yy242); } break; - case 537: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ -#line 1056 "sql.y" -{ yymsp[-6].minor.yy164 = createEventWindowNode(pCxt, yymsp[-3].minor.yy164, yymsp[0].minor.yy164); } -#line 6818 "sql.c" + case 541: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ +{ yymsp[-6].minor.yy242 = createEventWindowNode(pCxt, yymsp[-3].minor.yy242, yymsp[0].minor.yy242); } break; - case 541: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -#line 1062 "sql.y" -{ yymsp[-3].minor.yy164 = createFillNode(pCxt, yymsp[-1].minor.yy446, NULL); } -#line 6823 "sql.c" + case 545: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy242 = createFillNode(pCxt, yymsp[-1].minor.yy204, NULL); } break; - case 542: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ -#line 1063 "sql.y" -{ yymsp[-5].minor.yy164 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy72)); } -#line 6828 "sql.c" + case 546: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ +{ yymsp[-5].minor.yy242 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy174)); } break; - case 543: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ -#line 1064 "sql.y" -{ yymsp[-5].minor.yy164 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy72)); } -#line 6833 "sql.c" + case 547: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ +{ yymsp[-5].minor.yy242 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy174)); } break; - case 544: /* fill_mode ::= NONE */ -#line 1068 "sql.y" -{ yymsp[0].minor.yy446 = FILL_MODE_NONE; } -#line 6838 "sql.c" + case 548: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy204 = FILL_MODE_NONE; } break; - case 545: /* fill_mode ::= PREV */ -#line 1069 "sql.y" -{ yymsp[0].minor.yy446 = FILL_MODE_PREV; } -#line 6843 "sql.c" + case 549: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy204 = FILL_MODE_PREV; } break; - case 546: /* fill_mode ::= NULL */ -#line 1070 "sql.y" -{ yymsp[0].minor.yy446 = FILL_MODE_NULL; } -#line 6848 "sql.c" + case 550: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy204 = FILL_MODE_NULL; } break; - case 547: /* fill_mode ::= NULL_F */ -#line 1071 "sql.y" -{ yymsp[0].minor.yy446 = FILL_MODE_NULL_F; } -#line 6853 "sql.c" + case 551: /* fill_mode ::= NULL_F */ +{ yymsp[0].minor.yy204 = FILL_MODE_NULL_F; } break; - case 548: /* fill_mode ::= LINEAR */ -#line 1072 "sql.y" -{ yymsp[0].minor.yy446 = FILL_MODE_LINEAR; } -#line 6858 "sql.c" + case 552: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy204 = FILL_MODE_LINEAR; } break; - case 549: /* fill_mode ::= NEXT */ -#line 1073 "sql.y" -{ yymsp[0].minor.yy446 = FILL_MODE_NEXT; } -#line 6863 "sql.c" + case 553: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy204 = FILL_MODE_NEXT; } break; - case 552: /* group_by_list ::= expr_or_subquery */ -#line 1082 "sql.y" -{ yylhsminor.yy72 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); } -#line 6868 "sql.c" - yymsp[0].minor.yy72 = yylhsminor.yy72; + case 556: /* group_by_list ::= expr_or_subquery */ +{ yylhsminor.yy174 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy242))); } + yymsp[0].minor.yy174 = yylhsminor.yy174; break; - case 553: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -#line 1083 "sql.y" -{ yylhsminor.yy72 = addNodeToList(pCxt, yymsp[-2].minor.yy72, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy164))); } -#line 6874 "sql.c" - yymsp[-2].minor.yy72 = yylhsminor.yy72; + case 557: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +{ yylhsminor.yy174 = addNodeToList(pCxt, yymsp[-2].minor.yy174, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy242))); } + yymsp[-2].minor.yy174 = yylhsminor.yy174; break; - case 557: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ -#line 1090 "sql.y" -{ yymsp[-5].minor.yy164 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy164), releaseRawExprNode(pCxt, yymsp[-1].minor.yy164)); } -#line 6880 "sql.c" + case 561: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +{ yymsp[-5].minor.yy242 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy242), releaseRawExprNode(pCxt, yymsp[-1].minor.yy242)); } break; - case 560: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ -#line 1097 "sql.y" + case 564: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy164 = addOrderByClause(pCxt, yymsp[-3].minor.yy164, yymsp[-2].minor.yy72); - yylhsminor.yy164 = addSlimitClause(pCxt, yylhsminor.yy164, yymsp[-1].minor.yy164); - yylhsminor.yy164 = addLimitClause(pCxt, yylhsminor.yy164, yymsp[0].minor.yy164); + yylhsminor.yy242 = addOrderByClause(pCxt, yymsp[-3].minor.yy242, yymsp[-2].minor.yy174); + yylhsminor.yy242 = addSlimitClause(pCxt, yylhsminor.yy242, yymsp[-1].minor.yy242); + yylhsminor.yy242 = addLimitClause(pCxt, yylhsminor.yy242, yymsp[0].minor.yy242); } -#line 6889 "sql.c" - yymsp[-3].minor.yy164 = yylhsminor.yy164; + yymsp[-3].minor.yy242 = yylhsminor.yy242; break; - case 563: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -#line 1107 "sql.y" -{ yylhsminor.yy164 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy164, yymsp[0].minor.yy164); } -#line 6895 "sql.c" - yymsp[-3].minor.yy164 = yylhsminor.yy164; + case 567: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +{ yylhsminor.yy242 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy242, yymsp[0].minor.yy242); } + yymsp[-3].minor.yy242 = yylhsminor.yy242; break; - case 564: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -#line 1109 "sql.y" -{ yylhsminor.yy164 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy164, yymsp[0].minor.yy164); } -#line 6901 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 568: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +{ yylhsminor.yy242 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy242, yymsp[0].minor.yy242); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 572: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 576: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==576); -#line 1123 "sql.y" -{ yymsp[-1].minor.yy164 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 6908 "sql.c" + case 576: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 580: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==580); +{ yymsp[-1].minor.yy242 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 573: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 577: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==577); -#line 1124 "sql.y" -{ yymsp[-3].minor.yy164 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } -#line 6914 "sql.c" + case 577: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 581: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==581); +{ yymsp[-3].minor.yy242 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 574: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 578: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==578); -#line 1125 "sql.y" -{ yymsp[-3].minor.yy164 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } -#line 6920 "sql.c" + case 578: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 582: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==582); +{ yymsp[-3].minor.yy242 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 579: /* subquery ::= NK_LP query_expression NK_RP */ -#line 1133 "sql.y" -{ yylhsminor.yy164 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy164); } -#line 6925 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 583: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy242 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy242); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 584: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -#line 1147 "sql.y" -{ yylhsminor.yy164 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy164), yymsp[-1].minor.yy550, yymsp[0].minor.yy517); } -#line 6931 "sql.c" - yymsp[-2].minor.yy164 = yylhsminor.yy164; + case 588: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy242 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy242), yymsp[-1].minor.yy48, yymsp[0].minor.yy687); } + yymsp[-2].minor.yy242 = yylhsminor.yy242; break; - case 585: /* ordering_specification_opt ::= */ -#line 1151 "sql.y" -{ yymsp[1].minor.yy550 = ORDER_ASC; } -#line 6937 "sql.c" + case 589: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy48 = ORDER_ASC; } break; - case 586: /* ordering_specification_opt ::= ASC */ -#line 1152 "sql.y" -{ yymsp[0].minor.yy550 = ORDER_ASC; } -#line 6942 "sql.c" + case 590: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy48 = ORDER_ASC; } break; - case 587: /* ordering_specification_opt ::= DESC */ -#line 1153 "sql.y" -{ yymsp[0].minor.yy550 = ORDER_DESC; } -#line 6947 "sql.c" + case 591: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy48 = ORDER_DESC; } break; - case 588: /* null_ordering_opt ::= */ -#line 1157 "sql.y" -{ yymsp[1].minor.yy517 = NULL_ORDER_DEFAULT; } -#line 6952 "sql.c" + case 592: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy687 = NULL_ORDER_DEFAULT; } break; - case 589: /* null_ordering_opt ::= NULLS FIRST */ -#line 1158 "sql.y" -{ yymsp[-1].minor.yy517 = NULL_ORDER_FIRST; } -#line 6957 "sql.c" + case 593: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy687 = NULL_ORDER_FIRST; } break; - case 590: /* null_ordering_opt ::= NULLS LAST */ -#line 1159 "sql.y" -{ yymsp[-1].minor.yy517 = NULL_ORDER_LAST; } -#line 6962 "sql.c" + case 594: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy687 = NULL_ORDER_LAST; } break; default: break; @@ -7020,7 +6170,6 @@ static void yy_syntax_error( ParseCTX_FETCH #define TOKEN yyminor /************ Begin %syntax_error code ****************************************/ -#line 29 "sql.y" if (TSDB_CODE_SUCCESS == pCxt->errCode) { if(TOKEN.z) { @@ -7031,7 +6180,6 @@ static void yy_syntax_error( } else if (TSDB_CODE_PAR_DB_NOT_SPECIFIED == pCxt->errCode && TK_NK_FLOAT == TOKEN.type) { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z); } -#line 7035 "sql.c" /************ End %syntax_error code ******************************************/ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseCTX_STORE diff --git a/source/libs/parser/test/parInitialDTest.cpp b/source/libs/parser/test/parInitialDTest.cpp index 203156ec88..cddd2aa8f7 100644 --- a/source/libs/parser/test/parInitialDTest.cpp +++ b/source/libs/parser/test/parInitialDTest.cpp @@ -94,15 +94,17 @@ TEST_F(ParserInitialDTest, dropDnode) { auto clearDropDnodeReq = [&]() { memset(&expect, 0, sizeof(SDropDnodeReq)); }; - auto setDropDnodeReqById = [&](int32_t dnodeId, bool force = false) { + auto setDropDnodeReqById = [&](int32_t dnodeId, bool force = false, bool unsafe = false) { expect.dnodeId = dnodeId; expect.force = force; + expect.unsafe = unsafe; }; - auto setDropDnodeReqByEndpoint = [&](const char* pFqdn, int32_t port = tsServerPort, bool force = false) { + auto setDropDnodeReqByEndpoint = [&](const char* pFqdn, int32_t port = tsServerPort, bool force = false, bool unsafe = false) { strcpy(expect.fqdn, pFqdn); expect.port = port; expect.force = force; + expect.unsafe = unsafe; }; setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { @@ -114,6 +116,7 @@ TEST_F(ParserInitialDTest, dropDnode) { ASSERT_EQ(std::string(req.fqdn), std::string(expect.fqdn)); ASSERT_EQ(req.port, expect.port); ASSERT_EQ(req.force, expect.force); + ASSERT_EQ(req.unsafe, expect.unsafe); }); setDropDnodeReqById(1); @@ -124,6 +127,10 @@ TEST_F(ParserInitialDTest, dropDnode) { run("DROP DNODE 2 FORCE"); clearDropDnodeReq(); + setDropDnodeReqById(2, false, true); + run("DROP DNODE 2 UNSAFE"); + clearDropDnodeReq(); + setDropDnodeReqByEndpoint("host1", 7030); run("DROP DNODE 'host1:7030'"); clearDropDnodeReq(); @@ -132,6 +139,10 @@ TEST_F(ParserInitialDTest, dropDnode) { run("DROP DNODE 'host2:8030' FORCE"); clearDropDnodeReq(); + setDropDnodeReqByEndpoint("host2", 8030, false, true); + run("DROP DNODE 'host2:8030' UNSAFE"); + clearDropDnodeReq(); + setDropDnodeReqByEndpoint("host1"); run("DROP DNODE host1"); clearDropDnodeReq(); @@ -139,6 +150,10 @@ TEST_F(ParserInitialDTest, dropDnode) { setDropDnodeReqByEndpoint("host2", tsServerPort, true); run("DROP DNODE host2 FORCE"); clearDropDnodeReq(); + + setDropDnodeReqByEndpoint("host2", tsServerPort, false, true); + run("DROP DNODE host2 UNSAFE"); + clearDropDnodeReq(); } // todo DROP function diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 72e5081ab9..59b7c417a0 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -1292,6 +1292,16 @@ static int32_t smaIndexOptFindSmaFunc(SNode* pQueryFunc, SNodeList* pSmaFuncs) { return -1; } +static SNode* smaIndexOptFindWStartFunc(SNodeList* pSmaFuncs) { + SNode* pSmaFunc = NULL; + FOREACH(pSmaFunc, pSmaFuncs) { + if (QUERY_NODE_FUNCTION == nodeType(pSmaFunc) && FUNCTION_TYPE_WSTART == ((SFunctionNode*)pSmaFunc)->funcType) { + return pSmaFunc; + } + } + return NULL; +} + static int32_t smaIndexOptCreateSmaCols(SNodeList* pFuncs, uint64_t tableId, SNodeList* pSmaFuncs, SNodeList** pOutput) { SNodeList* pCols = NULL; @@ -1299,6 +1309,7 @@ static int32_t smaIndexOptCreateSmaCols(SNodeList* pFuncs, uint64_t tableId, SNo int32_t code = TSDB_CODE_SUCCESS; int32_t index = 0; int32_t smaFuncIndex = -1; + bool hasWStart = false; FOREACH(pFunc, pFuncs) { smaFuncIndex = smaIndexOptFindSmaFunc(pFunc, pSmaFuncs); if (smaFuncIndex < 0) { @@ -1308,11 +1319,35 @@ static int32_t smaIndexOptCreateSmaCols(SNodeList* pFuncs, uint64_t tableId, SNo if (TSDB_CODE_SUCCESS != code) { break; } + if (!hasWStart) { + if (PRIMARYKEY_TIMESTAMP_COL_ID == ((SColumnNode*)pCols->pTail->pNode)->colId) { + hasWStart = true; + } + } } ++index; } if (TSDB_CODE_SUCCESS == code && smaFuncIndex >= 0) { + if (!hasWStart) { + SNode* pWsNode = smaIndexOptFindWStartFunc(pSmaFuncs); + if (!pWsNode) { + nodesDestroyList(pCols); + code = TSDB_CODE_APP_ERROR; + qError("create sma cols failed since %s(_wstart not exist)", tstrerror(code)); + return code; + } + SExprNode exprNode; + exprNode.resType = ((SExprNode*)pWsNode)->resType; + sprintf(exprNode.aliasName, "#expr_%d", index + 1); + SNode* pkNode = smaIndexOptCreateSmaCol((SNode*)&exprNode, tableId, PRIMARYKEY_TIMESTAMP_COL_ID); + code = nodesListPushFront(pCols, pkNode); + if (TSDB_CODE_SUCCESS != code) { + nodesDestroyNode(pkNode); + nodesDestroyList(pCols); + return code; + } + } *pOutput = pCols; } else { nodesDestroyList(pCols); @@ -2195,6 +2230,13 @@ static bool lastRowScanOptMayBeOptimized(SLogicNode* pNode) { FOREACH(pFunc, ((SAggLogicNode*)pNode)->pAggFuncs) { SFunctionNode* pAggFunc = (SFunctionNode*)pFunc; if (FUNCTION_TYPE_LAST == pAggFunc->funcType) { + SNode* pPar = nodesListGetNode(pAggFunc->pParameterList, 0); + if (QUERY_NODE_COLUMN == nodeType(pPar)) { + SColumnNode* pCol = (SColumnNode*)pPar; + if (pCol->colType != COLUMN_TYPE_COLUMN) { + return false; + } + } if (hasSelectFunc || QUERY_NODE_VALUE == nodeType(nodesListGetNode(pAggFunc->pParameterList, 0))) { return false; } @@ -2295,6 +2337,7 @@ static int32_t lastRowScanOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogic if (NULL != cxt.pLastCols) { cxt.doAgg = false; lastRowScanOptSetLastTargets(pScan->pScanCols, cxt.pLastCols, true); + nodesWalkExprs(pScan->pScanPseudoCols, lastRowScanOptSetColDataType, &cxt); lastRowScanOptSetLastTargets(pScan->node.pTargets, cxt.pLastCols, false); nodesClearList(cxt.pLastCols); } diff --git a/source/libs/planner/test/planStmtTest.cpp b/source/libs/planner/test/planStmtTest.cpp index bab38797cc..df8a509d12 100644 --- a/source/libs/planner/test/planStmtTest.cpp +++ b/source/libs/planner/test/planStmtTest.cpp @@ -108,6 +108,7 @@ class PlanStmtTest : public PlannerTestBase { switch (type) { case TSDB_DATA_TYPE_VARCHAR: case TSDB_DATA_TYPE_VARBINARY: + case TSDB_DATA_TYPE_GEOMETRY: strncpy((char*)pBindParam->buffer, pVal, bytes); break; case TSDB_DATA_TYPE_TIMESTAMP: diff --git a/source/libs/qcom/src/queryUtil.c b/source/libs/qcom/src/queryUtil.c index c70ea57401..b3627e1a96 100644 --- a/source/libs/qcom/src/queryUtil.c +++ b/source/libs/qcom/src/queryUtil.c @@ -52,6 +52,10 @@ static bool doValidateSchema(SSchema* pSchema, int32_t numOfCols, int32_t maxLen if (pSchema[i].bytes > TSDB_MAX_NCHAR_LEN) { return false; } + } else if (pSchema[i].type == TSDB_DATA_TYPE_GEOMETRY) { + if (pSchema[i].bytes > TSDB_MAX_GEOMETRY_LEN) { + return false; + } } else { if (pSchema[i].bytes != tDataTypes[pSchema[i].type].bytes) { return false; @@ -297,6 +301,7 @@ int32_t dataConverToStr(char* str, int type, void* buf, int32_t bufSize, int32_t break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_GEOMETRY: if (bufSize < 0) { // tscError("invalid buf size"); return TSDB_CODE_TSC_INVALID_VALUE; diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index 02a21b66ed..344c3dcca3 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -178,7 +178,7 @@ __compar_fn_t gUint64UsignCompare[] = {compareUint64Uint8, compareUint64Uint16, int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { int8_t comparFn = 0; - if (optr == OP_TYPE_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR)) { + if (optr == OP_TYPE_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR && type != TSDB_DATA_TYPE_GEOMETRY)) { switch (type) { case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_TINYINT: @@ -204,7 +204,7 @@ int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { } } - if (optr == OP_TYPE_NOT_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR)) { + if (optr == OP_TYPE_NOT_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR && type != TSDB_DATA_TYPE_GEOMETRY)) { switch (type) { case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_TINYINT: @@ -255,7 +255,8 @@ int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { case TSDB_DATA_TYPE_DOUBLE: comparFn = 5; break; - case TSDB_DATA_TYPE_BINARY: { + case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_GEOMETRY: { if (optr == OP_TYPE_MATCH) { comparFn = 19; } else if (optr == OP_TYPE_NMATCH) { @@ -448,8 +449,9 @@ static FORCE_INLINE SFilterRangeNode *filterNewRange(SFilterRangeCtx *ctx, SFilt } void *filterInitRangeCtx(int32_t type, int32_t options) { - if (type > TSDB_DATA_TYPE_UBIGINT || type < TSDB_DATA_TYPE_BOOL || type == TSDB_DATA_TYPE_BINARY || - type == TSDB_DATA_TYPE_NCHAR) { + if (type > TSDB_DATA_TYPE_UBIGINT || type < TSDB_DATA_TYPE_BOOL || + type == TSDB_DATA_TYPE_BINARY || + type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_GEOMETRY) { qError("not supported range type:%d", type); return NULL; } @@ -1567,6 +1569,7 @@ int32_t fltConverToStr(char *str, int type, void *buf, int32_t bufSize, int32_t case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: + case TSDB_DATA_TYPE_GEOMETRY: if (bufSize < 0) { // tscError("invalid buf size"); return TSDB_CODE_TSC_INVALID_VALUE; @@ -3739,7 +3742,8 @@ EDealRes fltReviseRewriter(SNode **pNode, void *pContext) { } if (TSDB_DATA_TYPE_BINARY != valueNode->node.resType.type && TSDB_DATA_TYPE_NCHAR != - valueNode->node.resType.type) { return DEAL_RES_CONTINUE; + valueNode->node.resType.type && + TSDB_DATA_TYPE_GEOMETRY != valueNode->node.resType.type) { return DEAL_RES_CONTINUE; } if (stat->precision < 0) { diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index 1afcf44958..b9af716929 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -289,7 +289,7 @@ static int32_t doScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarP static VarDataLenT tlength(char *input, int32_t type) { return varDataLen(input); } static VarDataLenT tcharlength(char *input, int32_t type) { - if (type == TSDB_DATA_TYPE_VARCHAR) { + if (type == TSDB_DATA_TYPE_VARCHAR || type == TSDB_DATA_TYPE_GEOMETRY) { return varDataLen(input); } else { // NCHAR return varDataLen(input) / TSDB_NCHAR_SIZE; @@ -935,7 +935,8 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp } break; } - case TSDB_DATA_TYPE_BINARY: { + case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_GEOMETRY: { if (inputType == TSDB_DATA_TYPE_BOOL) { // NOTE: sprintf will append '\0' at the end of string int32_t len = sprintf(varDataVal(output), "%.*s", (int32_t)(outputLen - VARSTR_HEADER_SIZE), diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index 4d803cb638..4f76f93c6c 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -230,6 +230,8 @@ _getValueAddr_fn_t getVectorValueAddrFn(int32_t srcType) { p = getVectorValueAddr_VAR; } else if (srcType == TSDB_DATA_TYPE_NCHAR) { p = getVectorValueAddr_VAR; + }else if(srcType == TSDB_DATA_TYPE_GEOMETRY) { + p = getVectorValueAddr_VAR; } else { p = getVectorValueAddr_default; } @@ -440,7 +442,7 @@ int32_t vectorConvertFromVarData(SSclVectorConvCtx *pCtx, int32_t *overflow) { if (vton) { memcpy(tmp, data, varDataTLen(data)); } else { - if (TSDB_DATA_TYPE_VARCHAR == convertType) { + if (TSDB_DATA_TYPE_VARCHAR == convertType || TSDB_DATA_TYPE_GEOMETRY == convertType) { memcpy(tmp, varDataVal(data), varDataLen(data)); tmp[varDataLen(data)] = 0; } else if (TSDB_DATA_TYPE_NCHAR == convertType) { @@ -531,7 +533,7 @@ bool convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t } if (optr == OP_TYPE_LIKE || optr == OP_TYPE_NOT_LIKE || optr == OP_TYPE_MATCH || optr == OP_TYPE_NMATCH) { - if (typeLeft != TSDB_DATA_TYPE_NCHAR && typeLeft != TSDB_DATA_TYPE_BINARY) { + if (typeLeft != TSDB_DATA_TYPE_NCHAR && typeLeft != TSDB_DATA_TYPE_BINARY && typeLeft != TSDB_DATA_TYPE_GEOMETRY) { return false; } } @@ -560,7 +562,8 @@ bool convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t if (IS_NUMERIC_TYPE(type)) { if (typeLeft == TSDB_DATA_TYPE_NCHAR || - typeLeft == TSDB_DATA_TYPE_VARCHAR) { + typeLeft == TSDB_DATA_TYPE_VARCHAR || + typeLeft == TSDB_DATA_TYPE_GEOMETRY) { return false; } else if (typeLeft != type) { convertNumberToNumber(*pLeftData, pLeftOut, typeLeft, type); @@ -568,13 +571,14 @@ bool convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t } if (typeRight == TSDB_DATA_TYPE_NCHAR || - typeRight == TSDB_DATA_TYPE_VARCHAR) { + typeRight == TSDB_DATA_TYPE_VARCHAR || + typeRight == TSDB_DATA_TYPE_GEOMETRY) { return false; } else if (typeRight != type) { convertNumberToNumber(*pRightData, pRightOut, typeRight, type); *pRightData = pRightOut; } - } else if (type == TSDB_DATA_TYPE_BINARY) { + } else if (type == TSDB_DATA_TYPE_BINARY || typeLeft == TSDB_DATA_TYPE_GEOMETRY) { if (typeLeft == TSDB_DATA_TYPE_NCHAR) { *pLeftData = ncharTobinary(*pLeftData); *freeLeft = true; @@ -864,7 +868,8 @@ int32_t vectorConvertSingleColImpl(const SScalarParam *pIn, SScalarParam *pOut, break; } case TSDB_DATA_TYPE_BINARY: - case TSDB_DATA_TYPE_NCHAR: { + case TSDB_DATA_TYPE_NCHAR: + case TSDB_DATA_TYPE_GEOMETRY: { return vectorConvertToVarData(&cCtx); } default: @@ -875,27 +880,29 @@ int32_t vectorConvertSingleColImpl(const SScalarParam *pIn, SScalarParam *pOut, return TSDB_CODE_SUCCESS; } -int8_t gConvertTypes[TSDB_DATA_TYPE_BLOB + 1][TSDB_DATA_TYPE_BLOB + 1] = { - /* NULL BOOL TINY SMAL INT BIG FLOA DOUB VARC TIME NCHA UTIN USMA UINT UBIG JSON VARB DECI BLOB */ - /*NULL*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /*BOOL*/ 0, 0, 2, 3, 4, 5, 6, 7, 5, 9, 7, 11, 12, 13, 14, 0, 7, 0, 0, - /*TINY*/ 0, 0, 0, 3, 4, 5, 6, 7, 5, 9, 7, 3, 4, 5, 7, 0, 7, 0, 0, - /*SMAL*/ 0, 0, 0, 0, 4, 5, 6, 7, 5, 9, 7, 3, 4, 5, 7, 0, 7, 0, 0, - /*INT */ 0, 0, 0, 0, 0, 5, 6, 7, 5, 9, 7, 4, 4, 5, 7, 0, 7, 0, 0, - /*BIGI*/ 0, 0, 0, 0, 0, 0, 6, 7, 5, 9, 7, 5, 5, 5, 7, 0, 7, 0, 0, - /*FLOA*/ 0, 0, 0, 0, 0, 0, 0, 7, 7, 6, 7, 6, 6, 6, 6, 0, 7, 0, 0, - /*DOUB*/ 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 0, 7, 0, 0, - /*VARC*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 8, 7, 7, 7, 7, 0, 0, 0, 0, - /*TIME*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 7, 0, 7, 0, 0, - /*NCHA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 0, 0, 0, 0, - /*UTIN*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, 14, 0, 7, 0, 0, - /*USMA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 0, 7, 0, 0, - /*UINT*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 7, 0, 0, - /*UBIG*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, - /*JSON*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /*VARB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /*DECI*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /*BLOB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +int8_t gConvertTypes[TSDB_DATA_TYPE_MAX][TSDB_DATA_TYPE_MAX] = { + /* NULL BOOL TINY SMAL INT BIG FLOA DOUB VARC TIME NCHA UTIN USMA UINT UBIG JSON GEOM VARB DECI BLOB MEDB*/ + /*NULL*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /*BOOL*/ 0, 0, 2, 3, 4, 5, 6, 7, 5, 9, 7, 11, 12, 13, 14, 0, 7, 0, 0, 0, 0, + /*TINY*/ 0, 0, 0, 3, 4, 5, 6, 7, 5, 9, 7, 3, 4, 5, 7, 0, 7, 0, 0, 0, 0, + /*SMAL*/ 0, 0, 0, 0, 4, 5, 6, 7, 5, 9, 7, 3, 4, 5, 7, 0, 7, 0, 0, 0, 0, + /*INT */ 0, 0, 0, 0, 0, 5, 6, 7, 5, 9, 7, 4, 4, 5, 7, 0, 7, 0, 0, 0, 0, + /*BIGI*/ 0, 0, 0, 0, 0, 0, 6, 7, 5, 9, 7, 5, 5, 5, 7, 0, 7, 0, 0, 0, 0, + /*FLOA*/ 0, 0, 0, 0, 0, 0, 0, 7, 7, 6, 7, 6, 6, 6, 6, 0, 7, 0, 0, 0, 0, + /*DOUB*/ 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 0, 7, 0, 0, 0, 0, + /*VARC*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 8, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, + /*TIME*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 7, 0, 7, 0, 0, 0, 0, + /*NCHA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, + /*UTIN*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, 14, 0, 7, 0, 0, 0, 0, + /*USMA*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 0, 7, 0, 0, 0, 0, + /*UINT*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 7, 0, 0, 0, 0, + /*UBIG*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, + /*JSON*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /*VARB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /*DECI*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /*BLOB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /*MEDB*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /*GEOM*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int32_t vectorGetConvertType(int32_t type1, int32_t type2) { if (type1 == type2) { diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index 7af92cfb81..ba24a581e9 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -24,7 +24,7 @@ #include "tcompare.h" #include "tref.h" -#define MAX_TABLE_NAME_NUM 2000000 +#define MAX_TABLE_NAME_NUM 200000 int sessionRangeKeyCmpr(const SSessionKey* pWin1, const SSessionKey* pWin2) { if (pWin1->groupId > pWin2->groupId) { diff --git a/source/util/CMakeLists.txt b/source/util/CMakeLists.txt index 8f3bd42a47..6c9aff046c 100644 --- a/source/util/CMakeLists.txt +++ b/source/util/CMakeLists.txt @@ -4,6 +4,7 @@ add_library(util STATIC ${UTIL_SRC}) if (DEFINED GRANT_CFG_INCLUDE_DIR) add_definitions(-DGRANTS_CFG) endif() + target_include_directories( util PUBLIC "${TD_SOURCE_DIR}/include/util" @@ -15,10 +16,9 @@ target_link_libraries( util PUBLIC os PUBLIC lz4_static - PUBLIC api cjson + PUBLIC api cjson geos_c ) if(${BUILD_TEST}) ADD_SUBDIRECTORY(test) endif(${BUILD_TEST}) - diff --git a/source/util/src/tcompare.c b/source/util/src/tcompare.c index d6f0e898ef..e32ff3da95 100644 --- a/source/util/src/tcompare.c +++ b/source/util/src/tcompare.c @@ -1284,7 +1284,7 @@ int32_t comparewcsPatternNMatch(const void *pLeft, const void *pRight) { __compar_fn_t getComparFunc(int32_t type, int32_t optr) { __compar_fn_t comparFn = NULL; - if (optr == OP_TYPE_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR)) { + if (optr == OP_TYPE_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR && type != TSDB_DATA_TYPE_GEOMETRY)) { switch (type) { case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_TINYINT: @@ -1307,7 +1307,7 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) { } } - if (optr == OP_TYPE_NOT_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR)) { + if (optr == OP_TYPE_NOT_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR && type != TSDB_DATA_TYPE_GEOMETRY)) { switch (type) { case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_TINYINT: @@ -1351,7 +1351,8 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) { case TSDB_DATA_TYPE_DOUBLE: comparFn = compareDoubleVal; break; - case TSDB_DATA_TYPE_BINARY: { + case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_GEOMETRY: { if (optr == OP_TYPE_MATCH) { comparFn = comparestrRegexMatch; } else if (optr == OP_TYPE_NMATCH) { @@ -1436,6 +1437,7 @@ __compar_fn_t getKeyComparFunc(int32_t keyType, int32_t order) { case TSDB_DATA_TYPE_UBIGINT: return (order == TSDB_ORDER_ASC) ? compareUint64Val : compareUint64ValDesc; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_GEOMETRY: return (order == TSDB_ORDER_ASC) ? compareLenPrefixedStr : compareLenPrefixedStrDesc; case TSDB_DATA_TYPE_NCHAR: return (order == TSDB_ORDER_ASC) ? compareLenPrefixedWStr : compareLenPrefixedWStrDesc; diff --git a/source/util/src/tcompression.c b/source/util/src/tcompression.c index b05f1808e8..c31115d14f 100644 --- a/source/util/src/tcompression.c +++ b/source/util/src/tcompression.c @@ -1385,6 +1385,14 @@ static struct { .endFn = tCompBinaryEnd, .getI64 = NULL, .putI64 = NULL}, + {.type = TSDB_DATA_TYPE_GEOMETRY, + .bytes = 1, + .isVarLen = 1, + .startFn = tCompBinaryStart, + .cmprFn = tCompBinary, + .endFn = tCompBinaryEnd, + .getI64 = NULL, + .putI64 = NULL}, }; struct SCompressor { diff --git a/source/util/src/terror.c b/source/util/src/terror.c index bd3f8657a8..31727f7535 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -343,6 +343,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_VND_QUERY_BUSY, "Query busy") TAOS_DEFINE_ERROR(TSDB_CODE_VND_NOT_CATCH_UP, "Vnode didn't catch up its leader") TAOS_DEFINE_ERROR(TSDB_CODE_VND_ALREADY_IS_VOTER, "Vnode already is a voter") TAOS_DEFINE_ERROR(TSDB_CODE_VND_DIR_ALREADY_EXIST, "Vnode directory already exist") +TAOS_DEFINE_ERROR(TSDB_CODE_VND_META_DATA_UNSAFE_DELETE, "Single replica vnode data will lost permanently after this operation, if you make sure this, please use drop dnode unsafe to execute") // tsdb TAOS_DEFINE_ERROR(TSDB_CODE_TDB_INVALID_TABLE_ID, "Invalid table ID") diff --git a/source/util/src/tgeosctx.c b/source/util/src/tgeosctx.c new file mode 100644 index 0000000000..b4e7e953df --- /dev/null +++ b/source/util/src/tgeosctx.c @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "tdef.h" +#include "tgeosctx.h" + +static threadlocal SGeosContext tlGeosCtx = {0}; + +SGeosContext* getThreadLocalGeosCtx() { + return &tlGeosCtx; +} + +void destroyThreadLocalGeosCtx() { + if (tlGeosCtx.WKTReader) { + GEOSWKTReader_destroy_r(tlGeosCtx.handle, tlGeosCtx.WKTReader); + tlGeosCtx.WKTReader = NULL; + } + + if (tlGeosCtx.WKTWriter) { + GEOSWKTWriter_destroy_r(tlGeosCtx.handle, tlGeosCtx.WKTWriter); + tlGeosCtx.WKTWriter = NULL; + } + + if (tlGeosCtx.WKBReader) { + GEOSWKBReader_destroy_r(tlGeosCtx.handle, tlGeosCtx.WKBReader); + tlGeosCtx.WKBReader = NULL; + } + + if (tlGeosCtx.WKBWriter) { + GEOSWKBWriter_destroy_r(tlGeosCtx.handle, tlGeosCtx.WKBWriter); + tlGeosCtx.WKBWriter = NULL; + } + + if(tlGeosCtx.handle) { + GEOS_finish_r(tlGeosCtx.handle); + tlGeosCtx.handle = NULL; + } +} diff --git a/source/util/src/thashutil.c b/source/util/src/thashutil.c index f9c7eb1f56..891c09cfb5 100644 --- a/source/util/src/thashutil.c +++ b/source/util/src/thashutil.c @@ -194,6 +194,7 @@ _hash_fn_t taosGetDefaultHashFunction(int32_t type) { break; case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: + case TSDB_DATA_TYPE_GEOMETRY: fn = MurmurHash3_32; break; case TSDB_DATA_TYPE_UINT: diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index d5915e3e13..711760e549 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -556,6 +556,7 @@ void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, cons len += vsnprintf(buffer + len, LOG_MAX_LINE_DUMP_BUFFER_SIZE - 2 - len, format, argpointer); va_end(argpointer); + len = len > LOG_MAX_LINE_DUMP_BUFFER_SIZE - 2 ? LOG_MAX_LINE_DUMP_BUFFER_SIZE - 2 : len; buffer[len++] = '\n'; buffer[len] = 0; diff --git a/source/util/src/tsched.c b/source/util/src/tsched.c index 5c1706e405..8ad7ccc7c2 100644 --- a/source/util/src/tsched.c +++ b/source/util/src/tsched.c @@ -16,6 +16,7 @@ #define _DEFAULT_SOURCE #include "tsched.h" #include "tdef.h" +#include "tgeosctx.h" #include "tlog.h" #include "ttimer.h" #include "tutil.h" @@ -164,6 +165,8 @@ void *taosProcessSchedQueue(void *scheduler) { (*(msg.tfp))(msg.ahandle, msg.thandle); } + destroyThreadLocalGeosCtx(); + return NULL; } diff --git a/source/util/src/tskiplist.c b/source/util/src/tskiplist.c index 222e0e8a51..6344af523f 100644 --- a/source/util/src/tskiplist.c +++ b/source/util/src/tskiplist.c @@ -376,6 +376,7 @@ void tSkipListPrint(SSkipList *pSkipList, int16_t nlevel) { fprintf(stdout, "%d: %" PRId64 " \n", id++, *(int64_t *)key); break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_GEOMETRY: fprintf(stdout, "%d: %s \n", id++, key); break; case TSDB_DATA_TYPE_DOUBLE: diff --git a/source/util/src/ttimer.c b/source/util/src/ttimer.c index 7e99d6a35c..cb01fb2d13 100644 --- a/source/util/src/ttimer.c +++ b/source/util/src/ttimer.c @@ -113,7 +113,7 @@ typedef struct time_wheel_t { static int32_t tsMaxTmrCtrl = TSDB_MAX_VNODES_PER_DB + 100; -static TdThreadOnce tmrModuleInit = PTHREAD_ONCE_INIT; +static int32_t tmrModuleInit = 0; static TdThreadMutex tmrCtrlMutex; static tmr_ctrl_t* tmrCtrls; static tmr_ctrl_t* unusedTmrCtrl = NULL; @@ -512,11 +512,11 @@ bool taosTmrReset(TAOS_TMR_CALLBACK fp, int32_t mseconds, void* param, void* han return stopped; } -static void taosTmrModuleInit(void) { +static int32_t taosTmrModuleInit(void) { tmrCtrls = taosMemoryMalloc(sizeof(tmr_ctrl_t) * tsMaxTmrCtrl); if (tmrCtrls == NULL) { tmrError("failed to allocate memory for timer controllers."); - return; + return -1; } memset(&timerMap, 0, sizeof(timerMap)); @@ -535,14 +535,14 @@ static void taosTmrModuleInit(void) { time_wheel_t* wheel = wheels + i; if (taosThreadMutexInit(&wheel->mutex, NULL) != 0) { tmrError("failed to create the mutex for wheel, reason:%s", strerror(errno)); - return; + return -1; } wheel->nextScanAt = now + wheel->resolution; wheel->index = 0; wheel->slots = (tmr_obj_t**)taosMemoryCalloc(wheel->size, sizeof(tmr_obj_t*)); if (wheel->slots == NULL) { tmrError("failed to allocate wheel slots"); - return; + return -1; } timerMap.size += wheel->size; } @@ -551,20 +551,48 @@ static void taosTmrModuleInit(void) { timerMap.slots = (timer_list_t*)taosMemoryCalloc(timerMap.size, sizeof(timer_list_t)); if (timerMap.slots == NULL) { tmrError("failed to allocate hash map"); - return; + return -1; } tmrQhandle = taosInitScheduler(10000, taosTmrThreads, "tmr", NULL); taosInitTimer(taosTimerLoopFunc, MSECONDS_PER_TICK); tmrDebug("timer module is initialized, number of threads: %d", taosTmrThreads); + + return 2; +} + +static int32_t taosTmrInitModule(void) { + if (atomic_load_32(&tmrModuleInit) == 2) { + return 0; + } + + if (atomic_load_32(&tmrModuleInit) < 0) { + return -1; + } + + while (true) { + if (0 == atomic_val_compare_exchange_32(&tmrModuleInit, 0, 1)) { + atomic_store_32(&tmrModuleInit, taosTmrModuleInit()); + } else if (atomic_load_32(&tmrModuleInit) < 0) { + return -1; + } else if (atomic_load_32(&tmrModuleInit) == 2) { + return 0; + } else { + taosMsleep(1); + } + } + + return -1; } void* taosTmrInit(int32_t maxNumOfTmrs, int32_t resolution, int32_t longest, const char* label) { const char* ret = taosMonotonicInit(); tmrDebug("ttimer monotonic clock source:%s", ret); - taosThreadOnce(&tmrModuleInit, taosTmrModuleInit); + if (taosTmrInitModule() < 0) { + return NULL; + } taosThreadMutexLock(&tmrCtrlMutex); tmr_ctrl_t* ctrl = unusedTmrCtrl; @@ -581,6 +609,7 @@ void* taosTmrInit(int32_t maxNumOfTmrs, int32_t resolution, int32_t longest, con } tstrncpy(ctrl->label, label, sizeof(ctrl->label)); + tmrDebug("%s timer controller is initialized, number of timer controllers: %d.", label, numOfTmrCtrl); return ctrl; } @@ -629,8 +658,6 @@ void taosTmrCleanUp(void* handle) { tmrCtrls = NULL; unusedTmrCtrl = NULL; -#if defined(LINUX) - tmrModuleInit = PTHREAD_ONCE_INIT; // to support restart -#endif + atomic_store_32(&tmrModuleInit, 0); } } diff --git a/source/util/src/tworker.c b/source/util/src/tworker.c index 6edee27c05..57dc60e539 100644 --- a/source/util/src/tworker.c +++ b/source/util/src/tworker.c @@ -15,6 +15,7 @@ #define _DEFAULT_SOURCE #include "tworker.h" +#include "tgeosctx.h" #include "taoserror.h" #include "tlog.h" @@ -92,6 +93,8 @@ static void *tQWorkerThreadFp(SQueueWorker *worker) { taosUpdateItemSize(qinfo.queue, 1); } + destroyThreadLocalGeosCtx(); + return NULL; } diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index ab4663e5b3..e0d94c0c55 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -513,7 +513,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb-funcNFilter.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py -,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py +#,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqAutoCreateTbl.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDnodeRestart.py diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index c041282bfc..2af8f721b6 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -78,29 +78,38 @@ class TDSql: self.cursor.execute(s) time.sleep(2) - def error(self, sql): + def error(self, sql, expectedErrno = None): + caller = inspect.getframeinfo(inspect.stack()[1][0]) expectErrNotOccured = True + try: self.cursor.execute(sql) except BaseException as e: expectErrNotOccured = False - caller = inspect.getframeinfo(inspect.stack()[1][0]) + self.errno = e.errno self.error_info = repr(e) # print(error_info) # self.error_info = error_info[error_info.index('(')+1:-1].split(",")[0].replace("'","") # self.error_info = (','.join(error_info.split(",")[:-1]).split("(",1)[1:][0]).replace("'","") # print("!!!!!!!!!!!!!!",self.error_info) - + if expectErrNotOccured: - caller = inspect.getframeinfo(inspect.stack()[1][0]) tdLog.exit("%s(%d) failed: sql:%s, expect error not occured" % (caller.filename, caller.lineno, sql)) else: self.queryRows = 0 self.queryCols = 0 self.queryResult = None - tdLog.info("sql:%s, expect error occured" % (sql)) + + if expectedErrno != None: + if expectedErrno == self.errno: + tdLog.info("sql:%s, expected errno %s occured" % (sql, expectedErrno)) + else: + tdLog.exit("%s(%d) failed: sql:%s, errno %s occured, but not expected errno %s" % (caller.filename, caller.lineno, sql, self.errno, expectedErrno)) + else: + tdLog.info("sql:%s, expect error occured" % (sql)) + return self.error_info - + def query(self, sql, row_tag=None,queryTimes=10): self.sql = sql diff --git a/tests/script/api/batchprepare.c b/tests/script/api/batchprepare.c index 99507ef5c3..a8feefec1e 100644 --- a/tests/script/api/batchprepare.c +++ b/tests/script/api/batchprepare.c @@ -453,6 +453,9 @@ void generateInsertSQL(BindData *data) { case TSDB_DATA_TYPE_UBIGINT: len += sprintf(data->sql + len, "tubigdata"); break; + case TSDB_DATA_TYPE_GEOMETRY: + len += sprintf(data->sql + len, "tgeometrydata"); + break; default: printf("!!!invalid tag type:%d", data->pTags[c].buffer_type); exit(1); @@ -521,6 +524,9 @@ void generateInsertSQL(BindData *data) { case TSDB_DATA_TYPE_UBIGINT: len += sprintf(data->sql + len, "ubigdata"); break; + case TSDB_DATA_TYPE_GEOMETRY: + len += sprintf(data->sql + len, "tgeometrydata"); + break; default: printf("!!!invalid col type:%d", data->pBind[c].buffer_type); exit(1); @@ -550,7 +556,7 @@ void bpAppendOperatorParam(BindData *data, int32_t *len, int32_t dataType, int32 if (gCaseCtrl.optrIdxListNum > 0) { pInfo = &operInfo[gCaseCtrl.optrIdxList[idx]]; } else { - if (TSDB_DATA_TYPE_VARCHAR == dataType || TSDB_DATA_TYPE_NCHAR == dataType) { + if (TSDB_DATA_TYPE_VARCHAR == dataType || TSDB_DATA_TYPE_NCHAR == dataType || TSDB_DATA_TYPE_GEOMETRY == dataType) { pInfo = &operInfo[varoperatorList[rand() % tListLen(varoperatorList)]]; } else { pInfo = &operInfo[operatorList[rand() % tListLen(operatorList)]]; @@ -635,6 +641,9 @@ int32_t bpAppendColumnName(BindData *data, int32_t type, int32_t len) { case TSDB_DATA_TYPE_UBIGINT: return sprintf(data->sql + len, "ubigdata"); break; + case TSDB_DATA_TYPE_GEOMETRY: + len += sprintf(data->sql + len, "tgeometrydata"); + break; default: printf("!!!invalid col type:%d", type); exit(1); @@ -868,6 +877,7 @@ int32_t prepareColData(BP_BIND_TYPE bType, BindData *data, int32_t bindIdx, int3 pBase[bindIdx].is_null = data->isNull ? (data->isNull + rowIdx) : NULL; break; case TSDB_DATA_TYPE_VARCHAR: + case TSDB_DATA_TYPE_GEOMETRY: pBase[bindIdx].buffer_length = gVarCharSize; pBase[bindIdx].buffer = data->binaryData + rowIdx * gVarCharSize; pBase[bindIdx].length = data->binaryLen; @@ -1210,6 +1220,7 @@ int32_t bpAppendValueString(char *buf, int type, void *value, int32_t valueLen, case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: + case TSDB_DATA_TYPE_GEOMETRY: buf[*len] = '\''; ++(*len); memcpy(buf + *len, value, valueLen); @@ -1355,7 +1366,7 @@ void bpCheckColTagFields(TAOS_STMT *stmt, int32_t fieldNum, TAOS_FIELD_E* pField exit(1); } - if (pFields[i].type == TSDB_DATA_TYPE_BINARY) { + if (pFields[i].type == TSDB_DATA_TYPE_BINARY || pFields[i].type == TSDB_DATA_TYPE_GEOMETRY) { if (pFields[i].bytes != (pBind[i].buffer_length + 2)) { printf("!!!%s %dth field len %d mis-match expect len %d\n", BP_BIND_TYPE_STR(type), i, pFields[i].bytes, (pBind[i].buffer_length + 2)); exit(1); @@ -2499,6 +2510,9 @@ void generateCreateTableSQL(char *buf, int32_t tblIdx, int32_t colNum, int32_t * case TSDB_DATA_TYPE_UBIGINT: blen += sprintf(buf + blen, "ubigdata bigint unsigned"); break; + case TSDB_DATA_TYPE_GEOMETRY: + blen += sprintf(buf + blen, "geometrydata geometry(%d)", gVarCharSize); + break; default: printf("invalid col type:%d", colList[c]); exit(1); @@ -2557,13 +2571,16 @@ void generateCreateTableSQL(char *buf, int32_t tblIdx, int32_t colNum, int32_t * case TSDB_DATA_TYPE_UBIGINT: blen += sprintf(buf + blen, "tubigdata bigint unsigned"); break; + case TSDB_DATA_TYPE_GEOMETRY: + blen += sprintf(buf + blen, "tgeometrydata geometry(%d)", gVarCharSize); + break; default: printf("invalid col type:%d", colList[c]); exit(1); - } + } } - blen += sprintf(buf + blen, ")"); + blen += sprintf(buf + blen, ")"); } if (3 == tableType) { @@ -2615,6 +2632,9 @@ void generateCreateTableSQL(char *buf, int32_t tblIdx, int32_t colNum, int32_t * case TSDB_DATA_TYPE_UBIGINT: blen += sprintf(buf + blen, "%d", rand() % 128); break; + case TSDB_DATA_TYPE_GEOMETRY: + blen += sprintf(buf + blen, "'geo%d'", rand() % 128); + break; default: printf("invalid col type:%d", colList[c]); exit(1); diff --git a/tests/script/api/demoapi.c b/tests/script/api/demoapi.c index 6c060a6325..18bd89ceee 100644 --- a/tests/script/api/demoapi.c +++ b/tests/script/api/demoapi.c @@ -200,7 +200,8 @@ static int print_result(char *tbname, TAOS_RES* res, int block) { for (int f = 0; f < num_fields; f++) { if ((fields[f].type != TSDB_DATA_TYPE_VARCHAR) && (fields[f].type != TSDB_DATA_TYPE_NCHAR) - && (fields[f].type != TSDB_DATA_TYPE_JSON)) { + && (fields[f].type != TSDB_DATA_TYPE_JSON) + && (fields[f].type != TSDB_DATA_TYPE_GEOMETRY)) { printf("col%d type is %d, no need get offset\n", f, fields[f].type); for (int64_t c = 0; c < rows; c++) { diff --git a/tests/script/api/stmt_function.c b/tests/script/api/stmt_function.c index 62f8fab29f..55ab3f5631 100644 --- a/tests/script/api/stmt_function.c +++ b/tests/script/api/stmt_function.c @@ -400,6 +400,7 @@ void taos_stmt_use_result_query(void *taos, char *col, int type) { params->length = ¶ms->buffer_length; break; case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_GEOMETRY: params->buffer_length = sizeof(v.c6); params->buffer = &v.c6; params->length = ¶ms->buffer_length; diff --git a/tests/script/sh/pycumsum.py b/tests/script/sh/pycumsum.py new file mode 100644 index 0000000000..27d575aec4 --- /dev/null +++ b/tests/script/sh/pycumsum.py @@ -0,0 +1,29 @@ +import pickle +import numpy as np + +def init(): + pass + +def destroy(): + pass + +def start(): + return pickle.dumps(0.0) + +def finish(buf): + return pickle.loads(buf) + +def reduce(datablock, buf): + (rows, cols) = datablock.shape() + state = pickle.loads(buf) + row = [] + for i in range(rows): + for j in range(cols): + cell = datablock.data(i, j) + if cell is not None: + row.append(datablock.data(i, j)) + if len(row) > 1: + new_state = np.cumsum(row)[-1] + else: + new_state = state + return pickle.dumps(new_state) diff --git a/tests/script/tsim/dnode/drop_dnode_force.sim b/tests/script/tsim/dnode/drop_dnode_force.sim index bce51a9888..dbe34ab529 100644 --- a/tests/script/tsim/dnode/drop_dnode_force.sim +++ b/tests/script/tsim/dnode/drop_dnode_force.sim @@ -209,7 +209,8 @@ endi print =============== step5a: drop dnode 3 sql_error drop dnode 3 -sql drop dnode 3 force +sql_error drop dnode 3 force +sql drop dnode 3 unsafe print select * from information_schema.ins_dnodes; sql select * from information_schema.ins_dnodes; diff --git a/tests/script/tsim/query/udfpy.sim b/tests/script/tsim/query/udfpy.sim index 9e0492ffd9..394833b4bd 100644 --- a/tests/script/tsim/query/udfpy.sim +++ b/tests/script/tsim/query/udfpy.sim @@ -15,6 +15,7 @@ system sh/prepare_pyudf.sh system mkdir -p /tmp/pyudf system cp sh/pybitand.py /tmp/pyudf/ system cp sh/pyl2norm.py /tmp/pyudf/ +system cp sh/pycumsum.py /tmp/pyudf/ system ls /tmp/pyudf sql create database udf vgroups 3; @@ -280,6 +281,18 @@ if $data20 != 8.000000000 then return -1 endi +sql create aggregate function pycumsum as '/tmp/pyudf/pycumsum.py' outputtype double bufSize 128 language 'python'; +sql select pycumsum(f2) from udf.t2 +print ======= pycumsum +print $rows $data00 +if $rows != 1 then + return -1 +endi +if $data00 != 20.000000000 then + return -1 +endi +sql drop function pycumsum + sql create or replace function bit_and as '/tmp/udf/libbitand.so' outputtype int sql select func_version from information_schema.ins_functions where name='bit_and' if $data00 != 1 then diff --git a/tests/script/tsim/sma/tsmaCreateInsertQuery.sim b/tests/script/tsim/sma/tsmaCreateInsertQuery.sim index 9b6fc96bc0..242231e408 100644 --- a/tests/script/tsim/sma/tsmaCreateInsertQuery.sim +++ b/tests/script/tsim/sma/tsmaCreateInsertQuery.sim @@ -78,7 +78,7 @@ if $rows != 5 then return -1 endi -print =============== select * from stb from memory in designated vgroup +print =============== select with _wstart from stb from memory in designated vgroup sql select _wstart, _wend, min(c1),max(c2),max(c1) from stb interval(5m,10s) sliding(5m); print $data00 $data01 $data02 $data03 $data04 print $data10 $data11 $data12 $data13 $data14 @@ -102,6 +102,30 @@ if $data04 != 20 then return -1 endi +print =============== select without _wstart from stb from memory in designated vgroup +sql select min(c1),max(c2),max(c1) from stb interval(5m,10s) sliding(5m); +print $data00 $data01 $data02 +print $data10 $data11 $data12 +if $rows != 1 then + print rows $rows != 1 + return -1 +endi + +if $data00 != -13 then + print data00 $data00 != -13 + return -1 +endi + +if $data01 != 20.00000 then + print data01 $data01 != 20.00000 + return -1 +endi + +if $data02 != 20 then + print data02 $data02 != 20 + return -1 +endi + print =============== select * from stb from memory in common vgroups sql select _wstart, _wend, min(c1),max(c2),max(c1),max(c3) from stb interval(5m,10s) sliding(5m); print $data00 $data01 $data02 $data03 $data04 $data05 @@ -148,7 +172,7 @@ if $rows != 5 then return -1 endi -print =============== select * from stb from memory in designated vgroup after reboot +print =============== select with _wstart from stb from memory in designated vgroup after reboot sql select _wstart, _wend, min(c1),max(c2),max(c1) from stb interval(5m,10s) sliding(5m); print $data00 $data01 $data02 $data03 $data04 print $data10 $data11 $data12 $data13 $data14 @@ -172,6 +196,30 @@ if $data04 != 20 then return -1 endi +print =============== select without _wstart from stb from memory in designated vgroup after reboot +sql select min(c1),max(c2),max(c1) from stb interval(5m,10s) sliding(5m); +print $data00 $data01 $data02 +print $data10 $data11 $data12 +if $rows != 1 then + print rows $rows != 1 + return -1 +endi + +if $data00 != -13 then + print data00 $data00 != -13 + return -1 +endi + +if $data01 != 20.00000 then + print data01 $data01 != 20.00000 + return -1 +endi + +if $data02 != 20 then + print data02 $data02 != 20 + return -1 +endi + print =============== select * from stb from memory in common vgroups after reboot sql select _wstart, _wend, min(c1),max(c2),max(c1),max(c3) from stb interval(5m,10s) sliding(5m); print $data00 $data01 $data02 $data03 $data04 $data05 @@ -218,7 +266,7 @@ if $rows != 5 then return -1 endi -print =============== select * from stb from file in designated vgroup +print =============== select with _wstart from stb from file in designated vgroup sql select _wstart, _wend, min(c1),max(c2),max(c1) from stb interval(5m,10s) sliding(5m); print $data00 $data01 $data02 $data03 $data04 if $rows != 1 then @@ -241,6 +289,29 @@ if $data04 != 20 then return -1 endi +print =============== select without _wstart from stb from file in designated vgroup +sql select _wend, min(c1),max(c2),max(c1) from stb interval(5m,10s) sliding(5m); +print $data00 $data01 $data02 $data03 +if $rows != 1 then + print rows $rows != 1 + return -1 +endi + +if $data01 != -13 then + print data01 $data01 != -13 + return -1 +endi + +if $data02 != 20.00000 then + print data02 $data02 != 20.00000 + return -1 +endi + +if $data03 != 20 then + print data03 $data03 != 20 + return -1 +endi + print =============== select * from stb from file in common vgroups sql select _wstart, _wend, min(c1),max(c2),max(c1),max(c3) from stb interval(5m,10s) sliding(5m); print $data00 $data01 $data02 $data03 $data04 $data05 diff --git a/tests/script/tsim/stream/sliding.sim b/tests/script/tsim/stream/sliding.sim index 633b806f71..3312ccbec4 100644 --- a/tests/script/tsim/stream/sliding.sim +++ b/tests/script/tsim/stream/sliding.sim @@ -442,9 +442,8 @@ sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb sql create table t1 using st tags(1,1,1); sql create table t2 using st tags(2,2,2); -sql create stream streams21 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s, 5s); -sql create stream streams22 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt2 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s, 5s); -sql create stream streams23 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt3 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(20s) sliding(10s); +sql create stream streams21 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt21 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from t1 interval(10s, 5s); +sql create stream streams22 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt22 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(10s, 5s); sql insert into t1 values(1648791213000,1,1,1,1.0); sql insert into t1 values(1648791223001,2,2,2,1.1); @@ -468,7 +467,7 @@ if $loop_count == 10 then return -1 endi -sql select * from streamt; +sql select * from streamt21; # row 0 if $data01 != 2 then @@ -526,7 +525,7 @@ if $loop_count == 10 then return -1 endi -sql select * from streamt2; +sql select * from streamt22; # row 0 if $data01 != 4 then @@ -585,7 +584,39 @@ if $loop_count == 10 then return -1 endi -sql select * from streamt3; +sql create database test3 vgroups 6; +sql use test3; +sql create stable st(ts timestamp, a int, b int, c int, d double) tags(ta int,tb int,tc int); +sql create table t1 using st tags(1,1,1); +sql create table t2 using st tags(2,2,2); + +sql create stream streams23 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt23 as select _wstart, count(*) c1, sum(a) c3 , max(b) c4, min(c) c5 from st interval(20s) sliding(10s); + +sql insert into t1 values(1648791213000,1,1,1,1.0); +sql insert into t1 values(1648791223001,2,2,2,1.1); +sql insert into t1 values(1648791233002,3,3,3,2.1); +sql insert into t1 values(1648791243003,4,4,4,3.1); +sql insert into t1 values(1648791213004,4,5,5,4.1); + +sql insert into t2 values(1648791213000,1,6,6,1.0); +sql insert into t2 values(1648791223001,2,7,7,1.1); +sql insert into t2 values(1648791233002,3,8,8,2.1); +sql insert into t2 values(1648791243003,4,9,9,3.1); +sql insert into t2 values(1648791213004,4,10,10,4.1); + +$loop_count = 0 + +print step 7 + +loop4: +sleep 100 + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +sql select * from streamt23; # row 0 if $rows != 5 then @@ -629,7 +660,7 @@ if $loop_count == 10 then return -1 endi -sql select * from streamt3; +sql select * from streamt23; # row 0 if $rows != 7 then @@ -688,6 +719,8 @@ sql create stream streams4 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 in sql insert into t1 values(1648791213000,1,1,1,1.0); sql insert into t1 values(1648791243000,2,1,1,1.0); +sleep 1000 + sql insert into t2 values(1648791273000,3,1,1,1.0); sql insert into t2 values(1648791313000,4,1,1,1.0); diff --git a/tests/system-test/0-others/information_schema.py b/tests/system-test/0-others/information_schema.py index 3c4a71c3e4..8245407ade 100644 --- a/tests/system-test/0-others/information_schema.py +++ b/tests/system-test/0-others/information_schema.py @@ -162,7 +162,53 @@ class TDTestCase: for t in range (2): tdSql.query(f'select * from information_schema.ins_columns where db_name="db2" and table_type=="NORMAL_TABLE"') tdSql.checkEqual(20470,len(tdSql.queryResult)) - + + def ins_dnodes_check(self): + tdSql.execute('drop database if exists db2') + tdSql.execute('create database if not exists db2 vgroups 1 replica 1') + tdSql.query(f'select * from information_schema.ins_dnodes') + result = tdSql.queryResult + tdSql.checkEqual(result[0][0],1) + tdSql.checkEqual(result[0][8],"") + tdSql.checkEqual(result[0][9],"") + self.str107 = 'Hc7VCc+' + for t in range (10): + self.str107 += 'tP+2soIXpP' + self.str108 = self.str107 + '=' + self.str109 = self.str108 + '+' + self.str254 = self.str108 + self.str108 + '01234567890123456789012345678901234567' + self.str255 = self.str254 + '=' + self.str256 = self.str254 + '=(' + self.str257 = self.str254 + '=()' + self.str510 = self.str255 + self.str255 + tdSql.error('alter dnode 1 "activeCode" "a"') + tdSql.error('alter dnode 1 "activeCode" "' + self.str107 + '"') + tdSql.execute('alter all dnodes "activeCode" "' + self.str108 + '"') + tdSql.error('alter dnode 1 "activeCode" "' + self.str109 + '"') + tdSql.error('alter all dnodes "activeCode" "' + self.str510 + '"') + tdSql.query(f'select * from information_schema.ins_dnodes') + tdSql.checkEqual(tdSql.queryResult[0][8],self.str108) + tdSql.execute('alter dnode 1 "activeCode" ""') + tdSql.query(f'select active_code,c_active_code from information_schema.ins_dnodes') + tdSql.checkEqual(tdSql.queryResult[0][0],"") + tdSql.checkEqual(tdSql.queryResult[0][1],'') + tdSql.error('alter dnode 1 "cActiveCode" "a"') + tdSql.error('alter dnode 1 "cActiveCode" "' + self.str107 + '"') + tdSql.error('alter dnode 1 "cActiveCode" "' + self.str256 + '"') + tdSql.error('alter all dnodes "cActiveCode" "' + self.str255 + '"') + tdSql.error('alter all dnodes "cActiveCode" "' + self.str256 + '"') + tdSql.error('alter all dnodes "cActiveCode" "' + self.str257 + '"') + tdSql.execute('alter all dnodes "cActiveCode" "' + self.str254 + '"') + tdSql.error('alter dnode 1 "cActiveCode" "' + self.str510 + '"') + tdSql.query(f'select active_code,c_active_code from information_schema.ins_dnodes') + tdSql.checkEqual(tdSql.queryResult[0][0],"") + tdSql.checkEqual(tdSql.queryResult[0][1],self.str254) + tdSql.execute('alter dnode 1 "cActiveCode" "' + self.str109 + '"') + tdSql.query(f'show dnodes') + tdSql.checkEqual(tdSql.queryResult[0][9],self.str109) + tdSql.execute('alter all dnodes "cActiveCode" ""') + tdSql.query(f'select c_active_code from information_schema.ins_dnodes') + tdSql.checkEqual(tdSql.queryResult[0][0],'') def run(self): self.prepare_data() @@ -170,6 +216,7 @@ class TDTestCase: self.ins_columns_check() # self.ins_col_check_4096() self.ins_stable_check() + self.ins_dnodes_check() def stop(self): diff --git a/tests/system-test/2-query/geometry.py b/tests/system-test/2-query/geometry.py new file mode 100644 index 0000000000..e430b62fb2 --- /dev/null +++ b/tests/system-test/2-query/geometry.py @@ -0,0 +1,257 @@ +import taos +import sys + +from util.log import * +from util.sql import * +from util.cases import * + +class TDTestCase: + + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + + # WKT strings to be input as GEOMETRY type + self.point = "POINT (3.000000 6.000000)" + self.lineString = "LINESTRING (1.000000 1.000000, 2.000000 2.000000, 5.000000 5.000000)" + self.polygon = "POLYGON ((3.000000 6.000000, 5.000000 6.000000, 5.000000 8.000000, 3.000000 8.000000, 3.000000 6.000000))" + + # expected errno + self.errno_TSC_SQL_SYNTAX_ERROR = -2147483114; + self.errno_PAR_SYNTAX_ERROR = -2147473920 + + self.errno_FUNTION_PARA_NUM = -2147473407; + self.errno_FUNTION_PARA_TYPE = -2147473406; + self.errno_FUNTION_PARA_VALUE = -2147473405; + + def prepare_data(self, dbname = "db"): + tdSql.execute( + f'''create table {dbname}.t1 + (ts timestamp, c1 int, c2 float, c3 varchar(256), c4 geometry(512)) + ''' + ) + tdSql.execute( + f'''create table {dbname}.stb1 + (ts timestamp, c1 int, c2 float, c3 varchar(256), c4 geometry(512)) tags (t1 int) + ''' + ) + for i in range(2): + tdSql.execute(f'create table {dbname}.ct{i+1} using {dbname}.stb1 tags ( {i+1} )') + + values = f''' + (now()-1s, 1, 1.1, '{self.point}', '{self.point}') + (now(), 2, 2.2, '{self.lineString}', '{self.lineString}') + (now()+1s, 3, 3.3, '{self.polygon}', '{self.polygon}') + (now()+2s, 4, 4.4, NULL, NULL) + ''' + tdSql.execute(f"insert into {dbname}.t1 values{values}") + tdSql.execute(f"insert into {dbname}.ct1 values{values}") + tdSql.execute(f"insert into {dbname}.ct2 values{values}") + + # the following errors would happen when casting a string to GEOMETRY by ST_GeomFromText(), but raise an error as syntax error + # wrong WTK + tdSql.error(f"insert into {dbname}.ct2 values(now(), 1, 1.1, NULL, 'POIN(1.0 1.5)')", self.errno_TSC_SQL_SYNTAX_ERROR) + # wrong WTK at all + tdSql.error(f"insert into {dbname}.ct2 values(now(), 1, 1.1, NULL, 'XXX')", self.errno_TSC_SQL_SYNTAX_ERROR) + # empty WTK + tdSql.error(f"insert into {dbname}.ct2 values(now(), 1, 1.1, NULL, '')", self.errno_TSC_SQL_SYNTAX_ERROR) + # wrong type + tdSql.error(f"insert into {dbname}.ct2 values(now(), 1, 1.1, NULL, 2)", self.errno_TSC_SQL_SYNTAX_ERROR) + + def geomFromText_test(self, dbname = "db"): + # [ToDo] remove ST_AsText() calling in geomFromText_test once GEOMETRY type is supported in taos-connector-python + + # column input, including NULL value + tdSql.query(f"select ST_AsText(ST_GeomFromText(c3)), ST_AsText(c4) from {dbname}.t1") + for i in range(tdSql.queryRows): + tdSql.checkEqual(tdSql.queryResult[i][0], tdSql.queryResult[i][1]) + + # constant input + tdSql.query(f"select ST_AsText(ST_GeomFromText('{self.point}'))") + tdSql.checkEqual(tdSql.queryResult[0][0], self.point) + + # empty input + tdSql.query(f"select ST_AsText(ST_GeomFromText(''))") + tdSql.checkEqual(tdSql.queryResult[0][0], None) + + # NULL input + tdSql.query(f"select ST_AsText(ST_GeomFromText(NULL))") + tdSql.checkEqual(tdSql.queryResult[0][0], None) + + # wrong type input + tdSql.error(f"select ST_GeomFromText(2)", self.errno_FUNTION_PARA_TYPE) + tdSql.error(f"select ST_GeomFromText(c1) from {dbname}.t1", self.errno_FUNTION_PARA_TYPE) + + # wrong number of params input + tdSql.error(f"select ST_GeomFromText()", self.errno_PAR_SYNTAX_ERROR) + tdSql.error(f"select ST_GeomFromText(c3, c3) from {dbname}.t1", self.errno_FUNTION_PARA_NUM) + + # wrong param content input + # lack of the last letter of 'POINT' + tdSql.error(f"select ST_GeomFromText('POIN(1.0 1.5)')", self.errno_FUNTION_PARA_VALUE) + # redundant comma at the end + tdSql.error(f"select ST_GeomFromText('LINESTRING(1.0 1.0, 2.0 2.0, 5.0 5.0,)')", self.errno_FUNTION_PARA_VALUE) + # the first point and last one are not same + tdSql.error(f"select ST_GeomFromText('POLYGON((3.0 6.0, 5.0 6.0, 5.0 8.0, 3.0 8.0))')", self.errno_FUNTION_PARA_VALUE) + # wrong WTK at all + tdSql.error(f"select ST_GeomFromText('XXX')", self.errno_FUNTION_PARA_VALUE) + + def asText_test(self, dbname = "db"): + # column input, including NULL value + tdSql.query(f"select c3, ST_AsText(c4) from {dbname}.ct1") + for i in range(tdSql.queryRows): + tdSql.checkEqual(tdSql.queryResult[i][0], tdSql.queryResult[i][1]) + + # constant input + tdSql.query(f"select ST_AsText(c4) from {dbname}.ct1 where c1 = 1") + tdSql.checkEqual(tdSql.queryResult[0][0], self.point) + + # empty input should NOT happen for GEOMETRY type + + # NULL input + tdSql.query(f"select ST_AsText(NULL)") + tdSql.checkEqual(tdSql.queryResult[0][0], None) + + # wrong type input + tdSql.error(f"select ST_AsText('XXX')", self.errno_FUNTION_PARA_TYPE) + tdSql.error(f"select ST_AsText(c2) from {dbname}.ct1", self.errno_FUNTION_PARA_TYPE) + + # wrong number of params input + tdSql.error(f"select ST_AsText() from {dbname}.ct1", self.errno_PAR_SYNTAX_ERROR) + tdSql.error(f"select ST_AsText(c4, c4) from {dbname}.ct1", self.errno_FUNTION_PARA_NUM) + + # wrong param content input should NOT happen for GEOMETRY type + + def geomRelationFunc_test(self, geomRelationFuncName, expectedResults, dbname = "db"): + # two columns input, including NULL value + tdSql.query(f"select {geomRelationFuncName}(ST_GeomFromText(c3), c4) from {dbname}.t1") + for i in range(tdSql.queryRows): + tdSql.checkData(i, 0, expectedResults[0][i]) + + # constant and column input + tdSql.query(f"select {geomRelationFuncName}(ST_GeomFromText('{self.point}'), c4) from {dbname}.t1") + for i in range(tdSql.queryRows): + tdSql.checkData(i, 0, expectedResults[1][i]) + + # column and constant input + tdSql.query(f"select {geomRelationFuncName}(c4, ST_GeomFromText('{self.point}')) from {dbname}.t1") + for i in range(tdSql.queryRows): + tdSql.checkData(i, 0, expectedResults[2][i]) + + # two constants input + tdSql.query(f"select {geomRelationFuncName}(ST_GeomFromText('{self.point}'), ST_GeomFromText('{self.lineString}'))") + tdSql.checkEqual(tdSql.queryResult[0][0], expectedResults[3]) + + tdSql.query(f"select {geomRelationFuncName}(ST_GeomFromText('{self.polygon}'), ST_GeomFromText('{self.point}'))") + tdSql.checkEqual(tdSql.queryResult[0][0], expectedResults[4]) + + # NULL type input + tdSql.query(f"select {geomRelationFuncName}(NULL, ST_GeomFromText('{self.point}'))") + tdSql.checkEqual(tdSql.queryResult[0][0], None) + + tdSql.query(f"select {geomRelationFuncName}(ST_GeomFromText('{self.lineString}'), NULL)") + tdSql.checkEqual(tdSql.queryResult[0][0], None) + + tdSql.query(f"select {geomRelationFuncName}(NULL, NULL)") + tdSql.checkEqual(tdSql.queryResult[0][0], None) + + # wrong type input + tdSql.error(f"select {geomRelationFuncName}(c1, c4) from {dbname}.t1", self.errno_FUNTION_PARA_TYPE) + tdSql.error(f"select {geomRelationFuncName}(c4, c2) from {dbname}.t1", self.errno_FUNTION_PARA_TYPE) + tdSql.error(f"select {geomRelationFuncName}(c4, 'XXX') from {dbname}.t1", self.errno_FUNTION_PARA_TYPE) + + # wrong number of params input + tdSql.error(f"select {geomRelationFuncName}(c4) from {dbname}.t1", self.errno_FUNTION_PARA_NUM) + tdSql.error(f"select {geomRelationFuncName}(ST_GeomFromText(c3), c4, c4) from {dbname}.t1", self.errno_FUNTION_PARA_NUM) + + # used in where clause + tdSql.query(f"select c3 from {dbname}.t1 where {geomRelationFuncName}(ST_GeomFromText('{self.point}'), c4)=true") + tdSql.checkEqual(tdSql.queryRows, expectedResults[5][0]) + for i in range(tdSql.queryRows): + tdSql.checkData(i, 0, expectedResults[5][i+1]) + + def run(self): + tdSql.prepare() + + tdLog.printNoPrefix("==========step1: create tables and insert data") + self.prepare_data() + + tdLog.printNoPrefix("==========step2: ST_GeomFromText function test") + self.geomFromText_test() + + tdLog.printNoPrefix("==========step3: ST_AsText function test") + self.asText_test() + + tdLog.printNoPrefix("==========step4: ST_Intersects function test") + expectedResults = [ + [True, True, True, None], # two columns + [True, False, True, None], # constant and column + [True, False, True, None], # column and constant + False, # two constants 1 + True, # two constants 2 + [2, self.point, self.polygon] # in where clause + ] + self.geomRelationFunc_test('ST_Intersects', expectedResults) + + tdLog.printNoPrefix("==========step5: ST_Equals function test") + expectedResults = [ + [True, True, True, None], # two columns + [True, False, False, None], # constant and column + [True, False, False, None], # column and constant + False, # two constants 1 + False, # two constants 2 + [1, self.point] # in where clause + ] + self.geomRelationFunc_test('ST_Equals', expectedResults) + + tdLog.printNoPrefix("==========step6: ST_Touches function test") + expectedResults = [ + [False, False, False, None], # two columns + [False, False, True, None], # constant and column + [False, False, True, None], # column and constant + False, # two constants 1 + True, # two constants 2 + [1, self.polygon] # in where clause + ] + self.geomRelationFunc_test('ST_Touches', expectedResults) + + tdLog.printNoPrefix("==========step7: ST_Covers function test") + expectedResults = [ + [True, True, True, None], # two columns + [True, False, False, None], # constant and column + [True, False, True, None], # column and constant + False, # two constants 1 + True, # two constants 2 + [1, self.point] # in where clause + ] + self.geomRelationFunc_test('ST_Covers', expectedResults) + + tdLog.printNoPrefix("==========step8: ST_Contains function test") + expectedResults = [ + [True, True, True, None], # two columns + [True, False, False, None], # constant and column + [True, False, False, None], # column and constant + False, # two constants 1 + False, # two constants 2 + [1, self.point] # in where clause + ] + self.geomRelationFunc_test('ST_Contains', expectedResults) + + tdLog.printNoPrefix("==========step9: ST_ContainsProperly function test") + expectedResults = [ + [True, False, False, None], # two columns + [True, False, False, None], # constant and column + [True, False, False, None], # column and constant + False, # two constants 1 + False, # two constants 2 + [1, self.point] # in where clause + ] + self.geomRelationFunc_test('ST_ContainsProperly', expectedResults) + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/2-query/interp.py b/tests/system-test/2-query/interp.py index cdbfa0de84..121d4dcff6 100644 --- a/tests/system-test/2-query/interp.py +++ b/tests/system-test/2-query/interp.py @@ -26,6 +26,12 @@ class TDTestCase: ctbname3 = "ctb3" num_of_ctables = 3 + tbname_null = "tb_null" + ctbname1_null = "ctb1_null" + ctbname2_null = "ctb2_null" + ctbname3_null = "ctb3_null" + stbname_null = "stb_null" + tdSql.prepare() tdLog.printNoPrefix("==========step1:create table") @@ -38,6 +44,8 @@ class TDTestCase: tdLog.printNoPrefix("==========step2:insert data") + tdSql.execute(f"use db") + tdSql.execute(f"insert into {dbname}.{tbname} values ('2020-02-01 00:00:05', 5, 5, 5, 5, 5.0, 5.0, true, 'varchar', 'nchar')") tdSql.execute(f"insert into {dbname}.{tbname} values ('2020-02-01 00:00:10', 10, 10, 10, 10, 10.0, 10.0, true, 'varchar', 'nchar')") tdSql.execute(f"insert into {dbname}.{tbname} values ('2020-02-01 00:00:15', 15, 15, 15, 15, 15.0, 15.0, true, 'varchar', 'nchar')") @@ -182,6 +190,35 @@ class TDTestCase: tdSql.checkData(2, 0, 1) tdSql.checkData(3, 0, 1) + ## test fill value with string + tdSql.query(f"select interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:16', '2020-02-01 00:00:19') every(1s) fill(value, 'abc')") + tdSql.checkRows(4) + tdSql.checkData(0, 0, 0) + tdSql.checkData(1, 0, 0) + tdSql.checkData(2, 0, 0) + tdSql.checkData(3, 0, 0) + + tdSql.query(f"select interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:16', '2020-02-01 00:00:19') every(1s) fill(value, '123')") + tdSql.checkRows(4) + tdSql.checkData(0, 0, 123) + tdSql.checkData(1, 0, 123) + tdSql.checkData(2, 0, 123) + tdSql.checkData(3, 0, 123) + + tdSql.query(f"select interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:16', '2020-02-01 00:00:19') every(1s) fill(value, '123.123')") + tdSql.checkRows(4) + tdSql.checkData(0, 0, 123) + tdSql.checkData(1, 0, 123) + tdSql.checkData(2, 0, 123) + tdSql.checkData(3, 0, 123) + + tdSql.query(f"select interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:16', '2020-02-01 00:00:19') every(1s) fill(value, '12abc')") + tdSql.checkRows(4) + tdSql.checkData(0, 0, 12) + tdSql.checkData(1, 0, 12) + tdSql.checkData(2, 0, 12) + tdSql.checkData(3, 0, 12) + tdLog.printNoPrefix("==========step5:fill prev") ## {. . .} @@ -2912,10 +2949,1095 @@ class TDTestCase: tdSql.error(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(null)") tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(null)") + tdLog.printNoPrefix("======step 14: test interp ignore null values") + tdSql.execute( + f'''create table if not exists {dbname}.{tbname_null} + (ts timestamp, c0 int, c1 float, c2 bool) + ''' + ) - tdLog.printNoPrefix("======step 14: test interp pseudo columns") + tdSql.execute(f"insert into {dbname}.{tbname_null} values ('2020-02-02 00:00:01', 1, 1.0, true)") + tdSql.execute(f"insert into {dbname}.{tbname_null} values ('2020-02-02 00:00:02', NULL, NULL, NULL)") + tdSql.execute(f"insert into {dbname}.{tbname_null} values ('2020-02-02 00:00:03', 3, 3.0, false)") + tdSql.execute(f"insert into {dbname}.{tbname_null} values ('2020-02-02 00:00:04', NULL, NULL, NULL)") + tdSql.execute(f"insert into {dbname}.{tbname_null} values ('2020-02-02 00:00:05', NULL, NULL, NULL)") + tdSql.execute(f"insert into {dbname}.{tbname_null} values ('2020-02-02 00:00:06', 6, 6.0, true)") + tdSql.execute(f"insert into {dbname}.{tbname_null} values ('2020-02-02 00:00:07', NULL, NULL, NULL)") + tdSql.execute(f"insert into {dbname}.{tbname_null} values ('2020-02-02 00:00:08', 8, 8.0, false)") + tdSql.execute(f"insert into {dbname}.{tbname_null} values ('2020-02-02 00:00:09', 9, 9.0, true)") + tdSql.execute(f"insert into {dbname}.{tbname_null} values ('2020-02-02 00:00:10', NULL, NULL, NULL)") + tdSql.execute(f"insert into {dbname}.{tbname_null} values ('2020-02-02 00:00:11', NULL, NULL, NULL)") + + tdSql.execute( + f'''create table if not exists {dbname}.{stbname_null} + (ts timestamp, c0 int, c1 float, c2 bool) tags (t0 int) + ''' + ) + + tdSql.execute( + f'''create table if not exists {dbname}.{ctbname1_null} using {dbname}.{stbname_null} tags(1) + ''' + ) + + tdSql.execute( + f'''create table if not exists {dbname}.{ctbname2_null} using {dbname}.{stbname_null} tags(2) + ''' + ) + + tdSql.execute( + f'''create table if not exists {dbname}.{ctbname3_null} using {dbname}.{stbname_null} tags(3) + ''' + ) + + tdSql.execute(f"insert into {dbname}.{ctbname1_null} values ('2020-02-01 00:00:01', 1, 1.0, true)") + tdSql.execute(f"insert into {dbname}.{ctbname1_null} values ('2020-02-01 00:00:07', NULL, NULL, NULL)") + tdSql.execute(f"insert into {dbname}.{ctbname1_null} values ('2020-02-01 00:00:13', 13, 13.0, false)") + + tdSql.execute(f"insert into {dbname}.{ctbname2_null} values ('2020-02-01 00:00:03', NULL, NULL, NULL)") + tdSql.execute(f"insert into {dbname}.{ctbname2_null} values ('2020-02-01 00:00:09', 9, 9.0, true)") + tdSql.execute(f"insert into {dbname}.{ctbname2_null} values ('2020-02-01 00:00:15', 15, 15.0, false)") + + tdSql.execute(f"insert into {dbname}.{ctbname3_null} values ('2020-02-01 00:00:05', NULL, NULL, NULL)") + tdSql.execute(f"insert into {dbname}.{ctbname3_null} values ('2020-02-01 00:00:11', NULL, NULL, NULL)") + tdSql.execute(f"insert into {dbname}.{ctbname3_null} values ('2020-02-01 00:00:17', NULL, NULL, NULL)") + + # fill null + # normal table + tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_null} range('2020-02-02 00:00:01', '2020-02-02 00:00:11') every(1s) fill(NULL)") + + tdSql.checkRows(11) + for i in range (11): + tdSql.checkData(i, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, 3) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, None) + tdSql.checkData(5, 2, 6) + tdSql.checkData(6, 2, None) + tdSql.checkData(7, 2, 8) + tdSql.checkData(8, 2, 9) + tdSql.checkData(9, 2, None) + tdSql.checkData(10, 2, None) + + tdSql.query(f"select _irowts, _isfilled, interp(c0, 0) from {dbname}.{tbname_null} range('2020-02-02 00:00:01', '2020-02-02 00:00:11') every(1s) fill(NULL)") + + tdSql.checkRows(11) + for i in range (11): + tdSql.checkData(i, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, 3) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, None) + tdSql.checkData(5, 2, 6) + tdSql.checkData(6, 2, None) + tdSql.checkData(7, 2, 8) + tdSql.checkData(8, 2, 9) + tdSql.checkData(9, 2, None) + tdSql.checkData(10, 2, None) + + tdSql.query(f"select _irowts, _isfilled, interp(c0, 1) from {dbname}.{tbname_null} range('2020-02-02 00:00:01', '2020-02-02 00:00:11') every(1s) fill(NULL)") + + tdSql.checkRows(11) + tdSql.checkData(0, 1, False) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, False) + tdSql.checkData(3, 1, True) + tdSql.checkData(4, 1, True) + tdSql.checkData(5, 1, False) + tdSql.checkData(6, 1, True) + tdSql.checkData(7, 1, False) + tdSql.checkData(8, 1, False) + tdSql.checkData(9, 1, True) + tdSql.checkData(10, 1, True) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, 3) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, None) + tdSql.checkData(5, 2, 6) + tdSql.checkData(6, 2, None) + tdSql.checkData(7, 2, 8) + tdSql.checkData(8, 2, 9) + tdSql.checkData(9, 2, None) + tdSql.checkData(10, 2, None) + + + tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_null} where c0 is not null range('2020-02-02 00:00:01', '2020-02-02 00:00:11') every(1s) fill(NULL)") + + tdSql.checkRows(11) + tdSql.checkData(0, 1, False) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, False) + tdSql.checkData(3, 1, True) + tdSql.checkData(4, 1, True) + tdSql.checkData(5, 1, False) + tdSql.checkData(6, 1, True) + tdSql.checkData(7, 1, False) + tdSql.checkData(8, 1, False) + tdSql.checkData(9, 1, True) + tdSql.checkData(10, 1, True) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, 3) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, None) + tdSql.checkData(5, 2, 6) + tdSql.checkData(6, 2, None) + tdSql.checkData(7, 2, 8) + tdSql.checkData(8, 2, 9) + tdSql.checkData(9, 2, None) + tdSql.checkData(10, 2, None) + + # super table + tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_null} range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(NULL)") + + tdSql.checkRows(9) + for i in range (9): + tdSql.checkData(i, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, None) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, 9) + tdSql.checkData(5, 2, None) + tdSql.checkData(6, 2, 13) + tdSql.checkData(7, 2, 15) + tdSql.checkData(8, 2, None) + + tdSql.query(f"select _irowts, _isfilled, interp(c0, 0) from {dbname}.{stbname_null} range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(NULL)") + + tdSql.checkRows(9) + for i in range (9): + tdSql.checkData(i, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, None) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, 9) + tdSql.checkData(5, 2, None) + tdSql.checkData(6, 2, 13) + tdSql.checkData(7, 2, 15) + tdSql.checkData(8, 2, None) + + tdSql.query(f"select _irowts, _isfilled, interp(c0, 1) from {dbname}.{stbname_null} range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(NULL)") + + tdSql.checkRows(9) + tdSql.checkData(0, 1, False) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, True) + tdSql.checkData(3, 1, True) + tdSql.checkData(4, 1, False) + tdSql.checkData(5, 1, True) + tdSql.checkData(6, 1, False) + tdSql.checkData(7, 1, False) + tdSql.checkData(8, 1, True) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, None) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, 9) + tdSql.checkData(5, 2, None) + tdSql.checkData(6, 2, 13) + tdSql.checkData(7, 2, 15) + tdSql.checkData(8, 2, None) + + + tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_null} where c0 is not null range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(NULL)") + + tdSql.checkRows(9) + tdSql.checkData(0, 1, False) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, True) + tdSql.checkData(3, 1, True) + tdSql.checkData(4, 1, False) + tdSql.checkData(5, 1, True) + tdSql.checkData(6, 1, False) + tdSql.checkData(7, 1, False) + tdSql.checkData(8, 1, True) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, None) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, 9) + tdSql.checkData(5, 2, None) + tdSql.checkData(6, 2, 13) + tdSql.checkData(7, 2, 15) + tdSql.checkData(8, 2, None) + + tdSql.query(f"select tbname, _irowts, _isfilled, interp(c0, 1) from {dbname}.{stbname_null} partition by tbname range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(NULL)") + + tdSql.checkRows(27) + for i in range(0, 9): + tdSql.checkData(i, 0, 'ctb1_null') + + for i in range(9, 18): + tdSql.checkData(i, 0, 'ctb2_null') + + for i in range(18, 27): + tdSql.checkData(i, 0, 'ctb3_null') + + tdSql.checkData(0, 1, '2020-02-01 00:00:01.000') + tdSql.checkData(8, 1, '2020-02-01 00:00:17.000') + + tdSql.checkData(9, 1, '2020-02-01 00:00:01.000') + tdSql.checkData(17, 1, '2020-02-01 00:00:17.000') + + tdSql.checkData(18, 1, '2020-02-01 00:00:01.000') + tdSql.checkData(26, 1, '2020-02-01 00:00:17.000') + + tdSql.query(f"select tbname, _irowts, _isfilled, interp(c0) from {dbname}.{stbname_null} where c0 is not null partition by tbname range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(NULL)") + + tdSql.checkRows(18) + for i in range(0, 9): + tdSql.checkData(i, 0, 'ctb1_null') + + for i in range(9, 17): + tdSql.checkData(i, 0, 'ctb2_null') + + tdSql.checkData(0, 1, '2020-02-01 00:00:01.000') + tdSql.checkData(8, 1, '2020-02-01 00:00:17.000') + + tdSql.checkData(9, 1, '2020-02-01 00:00:01.000') + tdSql.checkData(17, 1, '2020-02-01 00:00:17.000') + + # fill value + # normal table + tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_null} range('2020-02-02 00:00:01', '2020-02-02 00:00:11') every(1s) fill(value, 0)") + + tdSql.checkRows(11) + for i in range (11): + tdSql.checkData(i, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, 3) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, None) + tdSql.checkData(5, 2, 6) + tdSql.checkData(6, 2, None) + tdSql.checkData(7, 2, 8) + tdSql.checkData(8, 2, 9) + tdSql.checkData(9, 2, None) + tdSql.checkData(10, 2, None) + + tdSql.query(f"select _irowts, _isfilled, interp(c0, 0) from {dbname}.{tbname_null} range('2020-02-02 00:00:01', '2020-02-02 00:00:11') every(1s) fill(value, 0)") + + tdSql.checkRows(11) + for i in range (11): + tdSql.checkData(i, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, 3) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, None) + tdSql.checkData(5, 2, 6) + tdSql.checkData(6, 2, None) + tdSql.checkData(7, 2, 8) + tdSql.checkData(8, 2, 9) + tdSql.checkData(9, 2, None) + tdSql.checkData(10, 2, None) + + tdSql.query(f"select _irowts, _isfilled, interp(c0, 1) from {dbname}.{tbname_null} range('2020-02-02 00:00:01', '2020-02-02 00:00:11') every(1s) fill(value, 0)") + + tdSql.checkRows(11) + tdSql.checkData(0, 1, False) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, False) + tdSql.checkData(3, 1, True) + tdSql.checkData(4, 1, True) + tdSql.checkData(5, 1, False) + tdSql.checkData(6, 1, True) + tdSql.checkData(7, 1, False) + tdSql.checkData(8, 1, False) + tdSql.checkData(9, 1, True) + tdSql.checkData(10, 1, True) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, 0) + tdSql.checkData(2, 2, 3) + tdSql.checkData(3, 2, 0) + tdSql.checkData(4, 2, 0) + tdSql.checkData(5, 2, 6) + tdSql.checkData(6, 2, 0) + tdSql.checkData(7, 2, 8) + tdSql.checkData(8, 2, 9) + tdSql.checkData(9, 2, 0) + tdSql.checkData(10, 2, 0) + + + tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_null} where c0 is not null range('2020-02-02 00:00:01', '2020-02-02 00:00:11') every(1s) fill(value, 0)") + + tdSql.checkRows(11) + tdSql.checkData(0, 1, False) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, False) + tdSql.checkData(3, 1, True) + tdSql.checkData(4, 1, True) + tdSql.checkData(5, 1, False) + tdSql.checkData(6, 1, True) + tdSql.checkData(7, 1, False) + tdSql.checkData(8, 1, False) + tdSql.checkData(9, 1, True) + tdSql.checkData(10, 1, True) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, 0) + tdSql.checkData(2, 2, 3) + tdSql.checkData(3, 2, 0) + tdSql.checkData(4, 2, 0) + tdSql.checkData(5, 2, 6) + tdSql.checkData(6, 2, 0) + tdSql.checkData(7, 2, 8) + tdSql.checkData(8, 2, 9) + tdSql.checkData(9, 2, 0) + tdSql.checkData(10, 2, 0) + + # super table + tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_null} range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(value, 0)") + + tdSql.checkRows(9) + for i in range (9): + tdSql.checkData(i, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, None) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, 9) + tdSql.checkData(5, 2, None) + tdSql.checkData(6, 2, 13) + tdSql.checkData(7, 2, 15) + tdSql.checkData(8, 2, None) + + tdSql.query(f"select _irowts, _isfilled, interp(c0, 0) from {dbname}.{stbname_null} range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(value, 0)") + + tdSql.checkRows(9) + for i in range (9): + tdSql.checkData(i, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, None) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, 9) + tdSql.checkData(5, 2, None) + tdSql.checkData(6, 2, 13) + tdSql.checkData(7, 2, 15) + tdSql.checkData(8, 2, None) + + tdSql.query(f"select _irowts, _isfilled, interp(c0, 1) from {dbname}.{stbname_null} range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(value, 0)") + + tdSql.checkRows(9) + tdSql.checkData(0, 1, False) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, True) + tdSql.checkData(3, 1, True) + tdSql.checkData(4, 1, False) + tdSql.checkData(5, 1, True) + tdSql.checkData(6, 1, False) + tdSql.checkData(7, 1, False) + tdSql.checkData(8, 1, True) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, 0) + tdSql.checkData(2, 2, 0) + tdSql.checkData(3, 2, 0) + tdSql.checkData(4, 2, 9) + tdSql.checkData(5, 2, 0) + tdSql.checkData(6, 2, 13) + tdSql.checkData(7, 2, 15) + tdSql.checkData(8, 2, 0) + + + tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_null} where c0 is not null range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(value, 0)") + + tdSql.checkRows(9) + tdSql.checkData(0, 1, False) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, True) + tdSql.checkData(3, 1, True) + tdSql.checkData(4, 1, False) + tdSql.checkData(5, 1, True) + tdSql.checkData(6, 1, False) + tdSql.checkData(7, 1, False) + tdSql.checkData(8, 1, True) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, 0) + tdSql.checkData(2, 2, 0) + tdSql.checkData(3, 2, 0) + tdSql.checkData(4, 2, 9) + tdSql.checkData(5, 2, 0) + tdSql.checkData(6, 2, 13) + tdSql.checkData(7, 2, 15) + tdSql.checkData(8, 2, 0) + + tdSql.query(f"select tbname, _irowts, _isfilled, interp(c0, 1) from {dbname}.{stbname_null} partition by tbname range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(value, 0)") + + tdSql.checkRows(27) + for i in range(0, 9): + tdSql.checkData(i, 0, 'ctb1_null') + + for i in range(9, 18): + tdSql.checkData(i, 0, 'ctb2_null') + + for i in range(18, 27): + tdSql.checkData(i, 0, 'ctb3_null') + + tdSql.checkData(0, 1, '2020-02-01 00:00:01.000') + tdSql.checkData(8, 1, '2020-02-01 00:00:17.000') + + tdSql.checkData(9, 1, '2020-02-01 00:00:01.000') + tdSql.checkData(17, 1, '2020-02-01 00:00:17.000') + + tdSql.checkData(18, 1, '2020-02-01 00:00:01.000') + tdSql.checkData(26, 1, '2020-02-01 00:00:17.000') + + tdSql.query(f"select tbname, _irowts, _isfilled, interp(c0) from {dbname}.{stbname_null} where c0 is not null partition by tbname range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(value, 0)") + + tdSql.checkRows(18) + for i in range(0, 9): + tdSql.checkData(i, 0, 'ctb1_null') + + for i in range(9, 18): + tdSql.checkData(i, 0, 'ctb2_null') + + tdSql.checkData(0, 1, '2020-02-01 00:00:01.000') + tdSql.checkData(8, 1, '2020-02-01 00:00:17.000') + + tdSql.checkData(9, 1, '2020-02-01 00:00:01.000') + tdSql.checkData(17, 1, '2020-02-01 00:00:17.000') + + # fill prev + # normal table + tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_null} range('2020-02-02 00:00:01', '2020-02-02 00:00:11') every(1s) fill(prev)") + + tdSql.checkRows(11) + for i in range (11): + tdSql.checkData(i, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, 3) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, None) + tdSql.checkData(5, 2, 6) + tdSql.checkData(6, 2, None) + tdSql.checkData(7, 2, 8) + tdSql.checkData(8, 2, 9) + tdSql.checkData(9, 2, None) + tdSql.checkData(10, 2, None) + + tdSql.query(f"select _irowts, _isfilled, interp(c0, 0) from {dbname}.{tbname_null} range('2020-02-02 00:00:01', '2020-02-02 00:00:11') every(1s) fill(prev)") + + tdSql.checkRows(11) + for i in range (11): + tdSql.checkData(i, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, 3) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, None) + tdSql.checkData(5, 2, 6) + tdSql.checkData(6, 2, None) + tdSql.checkData(7, 2, 8) + tdSql.checkData(8, 2, 9) + tdSql.checkData(9, 2, None) + tdSql.checkData(10, 2, None) + + tdSql.query(f"select _irowts, _isfilled, interp(c0, 1) from {dbname}.{tbname_null} range('2020-02-02 00:00:01', '2020-02-02 00:00:11') every(1s) fill(prev)") + + tdSql.checkRows(11) + tdSql.checkData(0, 1, False) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, False) + tdSql.checkData(3, 1, True) + tdSql.checkData(4, 1, True) + tdSql.checkData(5, 1, False) + tdSql.checkData(6, 1, True) + tdSql.checkData(7, 1, False) + tdSql.checkData(8, 1, False) + tdSql.checkData(9, 1, True) + tdSql.checkData(10, 1, True) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, 1) + tdSql.checkData(2, 2, 3) + tdSql.checkData(3, 2, 3) + tdSql.checkData(4, 2, 3) + tdSql.checkData(5, 2, 6) + tdSql.checkData(6, 2, 6) + tdSql.checkData(7, 2, 8) + tdSql.checkData(8, 2, 9) + tdSql.checkData(9, 2, 9) + tdSql.checkData(10, 2, 9) + + + tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_null} where c0 is not null range('2020-02-02 00:00:01', '2020-02-02 00:00:11') every(1s) fill(prev)") + + tdSql.checkRows(11) + tdSql.checkData(0, 1, False) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, False) + tdSql.checkData(3, 1, True) + tdSql.checkData(4, 1, True) + tdSql.checkData(5, 1, False) + tdSql.checkData(6, 1, True) + tdSql.checkData(7, 1, False) + tdSql.checkData(8, 1, False) + tdSql.checkData(9, 1, True) + tdSql.checkData(10, 1, True) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, 1) + tdSql.checkData(2, 2, 3) + tdSql.checkData(3, 2, 3) + tdSql.checkData(4, 2, 3) + tdSql.checkData(5, 2, 6) + tdSql.checkData(6, 2, 6) + tdSql.checkData(7, 2, 8) + tdSql.checkData(8, 2, 9) + tdSql.checkData(9, 2, 9) + tdSql.checkData(10, 2, 9) + + # super table + tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_null} range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(prev)") + + tdSql.checkRows(9) + for i in range (9): + tdSql.checkData(i, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, None) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, 9) + tdSql.checkData(5, 2, None) + tdSql.checkData(6, 2, 13) + tdSql.checkData(7, 2, 15) + tdSql.checkData(8, 2, None) + + tdSql.query(f"select _irowts, _isfilled, interp(c0, 0) from {dbname}.{stbname_null} range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(prev)") + + tdSql.checkRows(9) + for i in range (9): + tdSql.checkData(i, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, None) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, 9) + tdSql.checkData(5, 2, None) + tdSql.checkData(6, 2, 13) + tdSql.checkData(7, 2, 15) + tdSql.checkData(8, 2, None) + + tdSql.query(f"select _irowts, _isfilled, interp(c0, 1) from {dbname}.{stbname_null} range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(prev)") + + tdSql.checkRows(9) + tdSql.checkData(0, 1, False) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, True) + tdSql.checkData(3, 1, True) + tdSql.checkData(4, 1, False) + tdSql.checkData(5, 1, True) + tdSql.checkData(6, 1, False) + tdSql.checkData(7, 1, False) + tdSql.checkData(8, 1, True) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, 1) + tdSql.checkData(2, 2, 1) + tdSql.checkData(3, 2, 1) + tdSql.checkData(4, 2, 9) + tdSql.checkData(5, 2, 9) + tdSql.checkData(6, 2, 13) + tdSql.checkData(7, 2, 15) + tdSql.checkData(8, 2, 15) + + + tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_null} where c0 is not null range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(prev)") + + tdSql.checkRows(9) + tdSql.checkData(0, 1, False) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, True) + tdSql.checkData(3, 1, True) + tdSql.checkData(4, 1, False) + tdSql.checkData(5, 1, True) + tdSql.checkData(6, 1, False) + tdSql.checkData(7, 1, False) + tdSql.checkData(8, 1, True) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, 1) + tdSql.checkData(2, 2, 1) + tdSql.checkData(3, 2, 1) + tdSql.checkData(4, 2, 9) + tdSql.checkData(5, 2, 9) + tdSql.checkData(6, 2, 13) + tdSql.checkData(7, 2, 15) + tdSql.checkData(8, 2, 15) + + tdSql.query(f"select tbname, _irowts, _isfilled, interp(c0, 1) from {dbname}.{stbname_null} partition by tbname range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(prev)") + + tdSql.checkRows(14) + for i in range(0, 9): + tdSql.checkData(i, 0, 'ctb1_null') + + for i in range(9, 13): + tdSql.checkData(i, 0, 'ctb2_null') + + tdSql.checkData(0, 1, '2020-02-01 00:00:01.000') + tdSql.checkData(8, 1, '2020-02-01 00:00:17.000') + + tdSql.checkData(9, 1, '2020-02-01 00:00:09.000') + tdSql.checkData(13, 1, '2020-02-01 00:00:17.000') + + tdSql.query(f"select tbname, _irowts, _isfilled, interp(c0) from {dbname}.{stbname_null} where c0 is not null partition by tbname range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(prev)") + + tdSql.checkRows(14) + for i in range(0, 9): + tdSql.checkData(i, 0, 'ctb1_null') + + for i in range(9, 13): + tdSql.checkData(i, 0, 'ctb2_null') + + tdSql.checkData(0, 1, '2020-02-01 00:00:01.000') + tdSql.checkData(8, 1, '2020-02-01 00:00:17.000') + + tdSql.checkData(9, 1, '2020-02-01 00:00:09.000') + tdSql.checkData(13, 1, '2020-02-01 00:00:17.000') + + # fill next + # normal table + tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_null} range('2020-02-02 00:00:01', '2020-02-02 00:00:11') every(1s) fill(next)") + + tdSql.checkRows(11) + for i in range (11): + tdSql.checkData(i, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, 3) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, None) + tdSql.checkData(5, 2, 6) + tdSql.checkData(6, 2, None) + tdSql.checkData(7, 2, 8) + tdSql.checkData(8, 2, 9) + tdSql.checkData(9, 2, None) + tdSql.checkData(10, 2, None) + + tdSql.query(f"select _irowts, _isfilled, interp(c0, 0) from {dbname}.{tbname_null} range('2020-02-02 00:00:01', '2020-02-02 00:00:11') every(1s) fill(next)") + + tdSql.checkRows(11) + for i in range (11): + tdSql.checkData(i, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, 3) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, None) + tdSql.checkData(5, 2, 6) + tdSql.checkData(6, 2, None) + tdSql.checkData(7, 2, 8) + tdSql.checkData(8, 2, 9) + tdSql.checkData(9, 2, None) + tdSql.checkData(10, 2, None) + + tdSql.query(f"select _irowts, _isfilled, interp(c0, 1) from {dbname}.{tbname_null} range('2020-02-02 00:00:01', '2020-02-02 00:00:11') every(1s) fill(next)") + + tdSql.checkRows(9) + tdSql.checkData(0, 1, False) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, False) + tdSql.checkData(3, 1, True) + tdSql.checkData(4, 1, True) + tdSql.checkData(5, 1, False) + tdSql.checkData(6, 1, True) + tdSql.checkData(7, 1, False) + tdSql.checkData(8, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, 3) + tdSql.checkData(2, 2, 3) + tdSql.checkData(3, 2, 6) + tdSql.checkData(4, 2, 6) + tdSql.checkData(5, 2, 6) + tdSql.checkData(6, 2, 8) + tdSql.checkData(7, 2, 8) + tdSql.checkData(8, 2, 9) + + + tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_null} where c0 is not null range('2020-02-02 00:00:01', '2020-02-02 00:00:11') every(1s) fill(next)") + + tdSql.checkRows(9) + tdSql.checkData(0, 1, False) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, False) + tdSql.checkData(3, 1, True) + tdSql.checkData(4, 1, True) + tdSql.checkData(5, 1, False) + tdSql.checkData(6, 1, True) + tdSql.checkData(7, 1, False) + tdSql.checkData(8, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, 3) + tdSql.checkData(2, 2, 3) + tdSql.checkData(3, 2, 6) + tdSql.checkData(4, 2, 6) + tdSql.checkData(5, 2, 6) + tdSql.checkData(6, 2, 8) + tdSql.checkData(7, 2, 8) + tdSql.checkData(8, 2, 9) + + # super table + tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_null} range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(next)") + + tdSql.checkRows(9) + for i in range (9): + tdSql.checkData(i, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, None) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, 9) + tdSql.checkData(5, 2, None) + tdSql.checkData(6, 2, 13) + tdSql.checkData(7, 2, 15) + tdSql.checkData(8, 2, None) + + tdSql.query(f"select _irowts, _isfilled, interp(c0, 0) from {dbname}.{stbname_null} range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(next)") + + tdSql.checkRows(9) + for i in range (9): + tdSql.checkData(i, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, None) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, 9) + tdSql.checkData(5, 2, None) + tdSql.checkData(6, 2, 13) + tdSql.checkData(7, 2, 15) + tdSql.checkData(8, 2, None) + + tdSql.query(f"select _irowts, _isfilled, interp(c0, 1) from {dbname}.{stbname_null} range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(next)") + + tdSql.checkRows(8) + tdSql.checkData(0, 1, False) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, True) + tdSql.checkData(3, 1, True) + tdSql.checkData(4, 1, False) + tdSql.checkData(5, 1, True) + tdSql.checkData(6, 1, False) + tdSql.checkData(7, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, 9) + tdSql.checkData(2, 2, 9) + tdSql.checkData(3, 2, 9) + tdSql.checkData(4, 2, 9) + tdSql.checkData(5, 2, 13) + tdSql.checkData(6, 2, 13) + tdSql.checkData(7, 2, 15) + + + tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_null} where c0 is not null range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(next)") + + tdSql.checkRows(8) + tdSql.checkData(0, 1, False) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, True) + tdSql.checkData(3, 1, True) + tdSql.checkData(4, 1, False) + tdSql.checkData(5, 1, True) + tdSql.checkData(6, 1, False) + tdSql.checkData(7, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, 9) + tdSql.checkData(2, 2, 9) + tdSql.checkData(3, 2, 9) + tdSql.checkData(4, 2, 9) + tdSql.checkData(5, 2, 13) + tdSql.checkData(6, 2, 13) + tdSql.checkData(7, 2, 15) + + tdSql.query(f"select tbname, _irowts, _isfilled, interp(c0, 1) from {dbname}.{stbname_null} partition by tbname range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(next)") + + tdSql.checkRows(15) + for i in range(0, 7): + tdSql.checkData(i, 0, 'ctb1_null') + + for i in range(7, 15): + tdSql.checkData(i, 0, 'ctb2_null') + + tdSql.checkData(0, 1, '2020-02-01 00:00:01.000') + tdSql.checkData(6, 1, '2020-02-01 00:00:13.000') + + tdSql.checkData(7, 1, '2020-02-01 00:00:01.000') + tdSql.checkData(14, 1, '2020-02-01 00:00:15.000') + + tdSql.query(f"select tbname, _irowts, _isfilled, interp(c0) from {dbname}.{stbname_null} where c0 is not null partition by tbname range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(next)") + + tdSql.checkRows(15) + for i in range(0, 7): + tdSql.checkData(i, 0, 'ctb1_null') + + for i in range(7, 15): + tdSql.checkData(i, 0, 'ctb2_null') + + tdSql.checkData(0, 1, '2020-02-01 00:00:01.000') + tdSql.checkData(6, 1, '2020-02-01 00:00:13.000') + + tdSql.checkData(7, 1, '2020-02-01 00:00:01.000') + tdSql.checkData(14, 1, '2020-02-01 00:00:15.000') + + # fill linear + # normal table + tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_null} range('2020-02-02 00:00:01', '2020-02-02 00:00:11') every(1s) fill(linear)") + + tdSql.checkRows(11) + for i in range (11): + tdSql.checkData(i, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, 3) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, None) + tdSql.checkData(5, 2, 6) + tdSql.checkData(6, 2, None) + tdSql.checkData(7, 2, 8) + tdSql.checkData(8, 2, 9) + tdSql.checkData(9, 2, None) + tdSql.checkData(10, 2, None) + + tdSql.query(f"select _irowts, _isfilled, interp(c0, 0) from {dbname}.{tbname_null} range('2020-02-02 00:00:01', '2020-02-02 00:00:11') every(1s) fill(linear)") + + tdSql.checkRows(11) + for i in range (11): + tdSql.checkData(i, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, 3) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, None) + tdSql.checkData(5, 2, 6) + tdSql.checkData(6, 2, None) + tdSql.checkData(7, 2, 8) + tdSql.checkData(8, 2, 9) + tdSql.checkData(9, 2, None) + tdSql.checkData(10, 2, None) + + tdSql.query(f"select _irowts, _isfilled, interp(c0, 1) from {dbname}.{tbname_null} range('2020-02-02 00:00:01', '2020-02-02 00:00:11') every(1s) fill(linear)") + + tdSql.checkRows(9) + tdSql.checkData(0, 1, False) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, False) + tdSql.checkData(3, 1, True) + tdSql.checkData(4, 1, True) + tdSql.checkData(5, 1, False) + tdSql.checkData(6, 1, True) + tdSql.checkData(7, 1, False) + tdSql.checkData(8, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, 2) + tdSql.checkData(2, 2, 3) + tdSql.checkData(3, 2, 4) + tdSql.checkData(4, 2, 5) + tdSql.checkData(5, 2, 6) + tdSql.checkData(6, 2, 7) + tdSql.checkData(7, 2, 8) + tdSql.checkData(8, 2, 9) + + + tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{tbname_null} where c0 is not null range('2020-02-02 00:00:01', '2020-02-02 00:00:11') every(1s) fill(linear)") + + tdSql.checkRows(9) + tdSql.checkData(0, 1, False) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, False) + tdSql.checkData(3, 1, True) + tdSql.checkData(4, 1, True) + tdSql.checkData(5, 1, False) + tdSql.checkData(6, 1, True) + tdSql.checkData(7, 1, False) + tdSql.checkData(8, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, 2) + tdSql.checkData(2, 2, 3) + tdSql.checkData(3, 2, 4) + tdSql.checkData(4, 2, 5) + tdSql.checkData(5, 2, 6) + tdSql.checkData(6, 2, 7) + tdSql.checkData(7, 2, 8) + tdSql.checkData(8, 2, 9) + + # super table + tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_null} range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(linear)") + + tdSql.checkRows(9) + for i in range (9): + tdSql.checkData(i, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, None) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, 9) + tdSql.checkData(5, 2, None) + tdSql.checkData(6, 2, 13) + tdSql.checkData(7, 2, 15) + tdSql.checkData(8, 2, None) + + tdSql.query(f"select _irowts, _isfilled, interp(c0, 0) from {dbname}.{stbname_null} range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(linear)") + + tdSql.checkRows(9) + for i in range (9): + tdSql.checkData(i, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, None) + tdSql.checkData(2, 2, None) + tdSql.checkData(3, 2, None) + tdSql.checkData(4, 2, 9) + tdSql.checkData(5, 2, None) + tdSql.checkData(6, 2, 13) + tdSql.checkData(7, 2, 15) + tdSql.checkData(8, 2, None) + + tdSql.query(f"select _irowts, _isfilled, interp(c0, 1) from {dbname}.{stbname_null} range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(linear)") + + tdSql.checkRows(8) + tdSql.checkData(0, 1, False) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, True) + tdSql.checkData(3, 1, True) + tdSql.checkData(4, 1, False) + tdSql.checkData(5, 1, True) + tdSql.checkData(6, 1, False) + tdSql.checkData(7, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, 3) + tdSql.checkData(2, 2, 5) + tdSql.checkData(3, 2, 7) + tdSql.checkData(4, 2, 9) + tdSql.checkData(5, 2, 11) + tdSql.checkData(6, 2, 13) + tdSql.checkData(7, 2, 15) + + + tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname_null} where c0 is not null range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(linear)") + + tdSql.checkRows(8) + tdSql.checkData(0, 1, False) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, True) + tdSql.checkData(3, 1, True) + tdSql.checkData(4, 1, False) + tdSql.checkData(5, 1, True) + tdSql.checkData(6, 1, False) + tdSql.checkData(7, 1, False) + + tdSql.checkData(0, 2, 1) + tdSql.checkData(1, 2, 3) + tdSql.checkData(2, 2, 5) + tdSql.checkData(3, 2, 7) + tdSql.checkData(4, 2, 9) + tdSql.checkData(5, 2, 11) + tdSql.checkData(6, 2, 13) + tdSql.checkData(7, 2, 15) + + tdSql.query(f"select tbname, _irowts, _isfilled, interp(c0, 1) from {dbname}.{stbname_null} partition by tbname range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(linear)") + + tdSql.checkRows(11) + for i in range(0, 7): + tdSql.checkData(i, 0, 'ctb1_null') + + for i in range(7, 11): + tdSql.checkData(i, 0, 'ctb2_null') + + tdSql.checkData(0, 1, '2020-02-01 00:00:01.000') + tdSql.checkData(6, 1, '2020-02-01 00:00:13.000') + + tdSql.checkData(7, 1, '2020-02-01 00:00:09.000') + tdSql.checkData(10, 1, '2020-02-01 00:00:15.000') + + tdSql.query(f"select tbname, _irowts, _isfilled, interp(c0) from {dbname}.{stbname_null} where c0 is not null partition by tbname range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(linear)") + + tdSql.checkRows(11) + for i in range(0, 7): + tdSql.checkData(i, 0, 'ctb1_null') + + for i in range(7, 11): + tdSql.checkData(i, 0, 'ctb2_null') + + tdSql.checkData(0, 1, '2020-02-01 00:00:01.000') + tdSql.checkData(6, 1, '2020-02-01 00:00:13.000') + + tdSql.checkData(7, 1, '2020-02-01 00:00:09.000') + tdSql.checkData(10, 1, '2020-02-01 00:00:15.000') + + # multiple column with ignoring null value is not allowed + + tdSql.query(f"select _irowts, _isfilled, interp(c0), interp(c1), interp(c2) from {dbname}.{stbname_null} range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(linear)") + tdSql.query(f"select _irowts, _isfilled, interp(c0, 0), interp(c1, 0), interp(c2, 0) from {dbname}.{stbname_null} range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(linear)") + tdSql.query(f"select _irowts, _isfilled, interp(c0), interp(c1, 0), interp(c2) from {dbname}.{stbname_null} range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(linear)") + + tdSql.error(f"select _irowts, _isfilled, interp(c0), interp(c1, 1), interp(c2) from {dbname}.{stbname_null} range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(linear)") + tdSql.error(f"select _irowts, _isfilled, interp(c0, 1), interp(c1, 0), interp(c2, 0) from {dbname}.{stbname_null} range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(linear)") + tdSql.error(f"select _irowts, _isfilled, interp(c0), interp(c1, 0), interp(c2, 1) from {dbname}.{stbname_null} range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(linear)") + tdSql.error(f"select _irowts, _isfilled, interp(c0, 1), interp(c1, 1), interp(c2, 1) from {dbname}.{stbname_null} range('2020-02-01 00:00:01', '2020-02-01 00:00:17') every(2s) fill(linear)") + + + + tdLog.printNoPrefix("======step 15: test interp pseudo columns") tdSql.error(f"select _irowts, c6 from {dbname}.{tbname}") + tdLog.printNoPrefix("======step 15: test interp in nested query") + tdSql.query(f"select _irowts, _isfilled, interp(c0) from (select * from {dbname}.{stbname}) range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)") + tdSql.query(f"select _irowts, _isfilled, interp(c0) from (select * from {dbname}.{ctbname1}) range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)") + + tdSql.error(f"select _irowts, _isfilled, interp(c0) from (select * from {dbname}.{stbname}) partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)") + tdSql.error(f"select _irowts, _isfilled, interp(c0) from (select * from {dbname}.{ctbname1}) partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)") + + tdSql.error(f"select _irowts, _isfilled, interp(c0) from (select * from {dbname}.{ctbname1} union select * from {dbname}.{ctbname2}) range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)") + tdSql.error(f"select _irowts, _isfilled, interp(c0) from (select * from {dbname}.{ctbname1} union select * from {dbname}.{ctbname2} order by ts) range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)") + + tdSql.error(f"select _irowts, _isfilled, interp(c0) from (select * from {dbname}.{ctbname1} union all select * from {dbname}.{ctbname2}) range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)") + tdSql.error(f"select _irowts, _isfilled, interp(c0) from (select * from {dbname}.{ctbname1} union all select * from {dbname}.{ctbname2} order by ts) range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)") + + tdSql.error(f"select _irowts, _isfilled, interp(c0) from (select * from {dbname}.{ctbname1} union all select * from {dbname}.{ctbname2}) range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)") + tdSql.error(f"select _irowts, _isfilled, interp(c0) from (select * from {dbname}.{ctbname1} union all select * from {dbname}.{ctbname2} order by ts) range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)") + + tdSql.query(f"select _irowts, _isfilled, interp(c0) from (select {ctbname1}.ts,{ctbname1}.c0 from {dbname}.{ctbname1}, {dbname}.{ctbname2} where {ctbname1}.ts = {ctbname2}.ts) range('2020-02-01 00:00:00', '2020-02-01 00:00:14') every(1s) fill(null)") + def stop(self): tdSql.close() tdLog.success(f"{__file__} successfully executed") diff --git a/tests/system-test/2-query/odbc.py b/tests/system-test/2-query/odbc.py index f7851ad04b..5241406b65 100644 --- a/tests/system-test/2-query/odbc.py +++ b/tests/system-test/2-query/odbc.py @@ -22,8 +22,8 @@ class TDTestCase: tdSql.execute("insert into db.ctb using db.stb tags(1) (ts, c1) values (now, 1)") tdSql.query("select count(*) from information_schema.ins_columns") - # enterprise version: 285, community version: 277 - tdSql.checkData(0, 0, 285) + # enterprise version: 288, community version: 280 + tdSql.checkData(0, 0, 288) tdSql.query("select * from information_schema.ins_columns where table_name = 'ntb'") tdSql.checkRows(14) diff --git a/tests/system-test/7-tmq/ins_topics_test.py b/tests/system-test/7-tmq/ins_topics_test.py new file mode 100644 index 0000000000..8bf0a7e91a --- /dev/null +++ b/tests/system-test/7-tmq/ins_topics_test.py @@ -0,0 +1,67 @@ + +import taos +import sys +import time +import socket +import os +import threading + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * + +class TDTestCase: + hostname = socket.gethostname() + # rpcDebugFlagVal = '143' + #clientCfgDict = {'serverPort': '', 'firstEp': '', 'secondEp':'', 'rpcDebugFlag':'135', 'fqdn':''} + #clientCfgDict["rpcDebugFlag"] = rpcDebugFlagVal + #updatecfgDict = {'clientCfg': {}, 'serverPort': '', 'firstEp': '', 'secondEp':'', 'rpcDebugFlag':'135', 'fqdn':''} + # updatecfgDict["rpcDebugFlag"] = rpcDebugFlagVal + #print ("===================: ", updatecfgDict) + + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + #tdSql.init(conn.cursor(), logSql) # output sql.txt file + + def test(self): + tdLog.info("create database, stb, ctb") + tdSql.execute("create database if not exists db1 vgroups 4 wal_retention_period 3600") + tdSql.execute("create table if not exists db1.st(ts timestamp, c1 int, c2 bool, c3 tinyint, c4 double, c5 nchar(8)) tags(t1 int, t2 float, t3 binary(4))") + tdSql.execute("create table if not exists db1.nt(ts timestamp, c1 smallint, c2 float, c3 binary(64), c4 bigint)") + tdSql.execute("create table if not exists db1.st1 using db1.st tags(1, 9.3, \"st1\")") + + tdLog.info("create topic") + tdSql.execute("create topic topic_1 as database db1") + tdSql.execute("create topic topic_2 with meta as stable db1.st") + tdSql.execute("create topic topic_3 as select * from db1.nt") + tdSql.execute("create topic topic_4 as select ts,c3,c5,t2 from db1.st") + + tdSql.query("select * from information_schema.ins_topics order by topic_name") + tdSql.checkRows(4) + tdSql.checkData(0, 4, "NULL") + tdSql.checkData(0, 5, "no") + tdSql.checkData(0, 6, "db") + tdSql.checkData(1, 4, "[{\"name\":\"ts\",\"type\":\"TIMESTAMP\",\"length\":8},{\"name\":\"c1\",\"type\":\"INT\",\"length\":4},{\"name\":\"c2\",\"type\":\"BOOL\",\"length\":1},{\"name\":\"c3\",\"type\":\"TINYINT\",\"length\":1},{\"name\":\"c4\",\"type\":\"DOUBLE\",\"length\":8},{\"name\":\"c5\",\"type\":\"NCHAR\",\"length\":8}]") + tdSql.checkData(1, 5, "yes") + tdSql.checkData(1, 6, "stable") + tdSql.checkData(2, 4, "[{\"name\":\"ts\",\"type\":\"TIMESTAMP\",\"length\":8},{\"name\":\"c1\",\"type\":\"SMALLINT\",\"length\":2},{\"name\":\"c2\",\"type\":\"FLOAT\",\"length\":4},{\"name\":\"c3\",\"type\":\"VARCHAR\",\"length\":64},{\"name\":\"c4\",\"type\":\"BIGINT\",\"length\":8}]") + tdSql.checkData(2, 5, "no") + tdSql.checkData(2, 6, "column") + tdSql.checkData(3, 4, "[{\"name\":\"ts\",\"type\":\"TIMESTAMP\",\"length\":8},{\"name\":\"c3\",\"type\":\"TINYINT\",\"length\":1},{\"name\":\"c5\",\"type\":\"NCHAR\",\"length\":8},{\"name\":\"t2\",\"type\":\"FLOAT\",\"length\":4}]") + tdSql.checkData(3, 5, "no") + tdSql.checkData(3, 6, "column") + + tdLog.printNoPrefix("======== test case end ...... ") + + def run(self): + self.test() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tools/shell/CMakeLists.txt b/tools/shell/CMakeLists.txt index 7b1dc3a541..acc47d4910 100644 --- a/tools/shell/CMakeLists.txt +++ b/tools/shell/CMakeLists.txt @@ -40,7 +40,7 @@ endif () target_link_libraries( shell - PRIVATE os common transport util + PRIVATE os common transport geometry util ) target_include_directories( diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index e2752f7899..7b30052659 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -20,6 +20,7 @@ #define _DEFAULT_SOURCE #include "shellInt.h" #include "shellAuto.h" +#include "geosWrapper.h" static bool shellIsEmptyCommand(const char *cmd); static int32_t shellRunSingleCommand(char *command); @@ -29,6 +30,7 @@ static void shellRunSingleCommandImp(char *command); static char *shellFormatTimestamp(char *buf, int64_t val, int32_t precision); static int32_t shellDumpResultToFile(const char *fname, TAOS_RES *tres); static void shellPrintNChar(const char *str, int32_t length, int32_t width); +static void shellPrintGeometry(const unsigned char *str, int32_t length, int32_t width); static int32_t shellVerticalPrintResult(TAOS_RES *tres, const char *sql); static int32_t shellHorizontalPrintResult(TAOS_RES *tres, const char *sql); static int32_t shellDumpResult(TAOS_RES *tres, char *fname, int32_t *error_no, bool vertical, const char *sql); @@ -306,6 +308,15 @@ char *shellFormatTimestamp(char *buf, int64_t val, int32_t precision) { return buf; } +char *shellDumpHexValue(char *buf, const char *val, int32_t length) { + for (int32_t i = 0; i < length; i++) { + sprintf(buf + (i * 2), "%02X", val[i]); + } + buf[length * 2] = 0; + + return buf; +} + void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, int32_t length, int32_t precision) { if (val == NULL) { taosFprintfFile(pFile, "NULL"); @@ -384,6 +395,10 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i taosFprintfFile(pFile, "%s%s%s", quotationStr, buf, quotationStr); } break; + case TSDB_DATA_TYPE_GEOMETRY: + shellDumpHexValue(buf, val, length); + taosFprintfFile(pFile, "%s", buf); + break; case TSDB_DATA_TYPE_TIMESTAMP: shellFormatTimestamp(buf, *(int64_t *)val, precision); taosFprintfFile(pFile, "%s%s%s", quotationStr, buf, quotationStr); @@ -507,16 +522,53 @@ void shellPrintNChar(const char *str, int32_t length, int32_t width) { } } +void shellPrintString(const char *str, int32_t width) { + int32_t len = strlen(str); + + if (width == 0) { + printf("%s", str); + } + else if (len > width) { + if (width <= 3) { + printf("%.*s.", width - 1, str); + } + else { + printf("%.*s...", width - 3, str); + } + } else { + printf("%s%*.s", str, width - len, ""); + } +} + +void shellPrintGeometry(const unsigned char *val, int32_t length, int32_t width) { + if (length == 0) { //empty value + shellPrintString("", width); + return; + } + + int32_t code = TSDB_CODE_FAILED; + + code = initCtxAsText(); + if (code != TSDB_CODE_SUCCESS) { + shellPrintString(getThreadLocalGeosCtx()->errMsg, width); + return; + } + + char *outputWKT = NULL; + code = doAsText(val, length, &outputWKT); + if (code != TSDB_CODE_SUCCESS) { + shellPrintString(getThreadLocalGeosCtx()->errMsg, width); //should NOT happen + return; + } + + shellPrintString(outputWKT, width); + + geosFreeBuffer(outputWKT); +} + void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t length, int32_t precision) { if (val == NULL) { - int32_t w = width; - if (field->type < TSDB_DATA_TYPE_TINYINT || field->type > TSDB_DATA_TYPE_DOUBLE) { - w = 0; - } - w = printf("%*s", w, TSDB_DATA_NULL_STR); - for (; w < width; w++) { - putchar(' '); - } + shellPrintString(TSDB_DATA_NULL_STR, width); return; } @@ -524,7 +576,7 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t char buf[TSDB_MAX_BYTES_PER_ROW]; switch (field->type) { case TSDB_DATA_TYPE_BOOL: - printf("%*s", width, ((((int32_t)(*((char *)val))) == 1) ? "true" : "false")); + shellPrintString(((((int32_t)(*((char *)val))) == 1) ? "true" : "false"), width); break; case TSDB_DATA_TYPE_TINYINT: printf("%*d", width, *((int8_t *)val)); @@ -580,6 +632,9 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t case TSDB_DATA_TYPE_JSON: shellPrintNChar(val, length, width); break; + case TSDB_DATA_TYPE_GEOMETRY: + shellPrintGeometry(val, length, width); + break; case TSDB_DATA_TYPE_TIMESTAMP: shellFormatTimestamp(buf, *(int64_t *)val, precision); printf("%s", buf); @@ -708,6 +763,7 @@ int32_t shellCalcColWidth(TAOS_FIELD *field, int32_t precision) { return TMAX(25, width); case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_GEOMETRY: if (field->bytes > shell.args.displayWidth) { return TMAX(shell.args.displayWidth, width); } else { @@ -1089,6 +1145,7 @@ void *shellThreadLoop(void *arg) { taosResetTerminalMode(); } while (shellRunCommand(command, true) == 0); + destroyThreadLocalGeosCtx(); taosMemoryFreeClear(command); shellWriteHistory(); shellExit(); diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index ac5aff4727..94619339e9 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -1132,6 +1132,155 @@ int sml_td22900_Test() { return code; } +int sml_td24070_Test() { + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + TAOS_RES *pRes = taos_query(taos, "CREATE user test_db pass 'test'"); + ASSERT(taos_errno(pRes) == 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "CREATE DATABASE IF NOT EXISTS td24070_read"); + ASSERT(taos_errno(pRes) == 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "grant read on td24070_read to test_db"); + ASSERT(taos_errno(pRes) == 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "CREATE DATABASE IF NOT EXISTS td24070_write"); + ASSERT(taos_errno(pRes) == 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "grant write on td24070_write to test_db"); + ASSERT(taos_errno(pRes) == 0); + taos_free_result(pRes); + + taos_close(taos); + + + // test db privilege + taos = taos_connect("localhost", "test_db", "test", NULL, 0); + const char* sql[] = {"stb2,t1=1,dataModelName=t0 f1=283i32 1632299372000"}; + + pRes = taos_query(taos, "use td24070_read"); + taos_free_result(pRes); + + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + int code = taos_errno(pRes); + ASSERT(code != 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "use td24070_write"); + taos_free_result(pRes); + + pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + code = taos_errno(pRes); + ASSERT(code == 0); + taos_free_result(pRes); + taos_close(taos); + // test db privilege end + + + // test stable privilege + taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + pRes = taos_query(taos, "CREATE user test_stb_read pass 'test'"); + ASSERT(taos_errno(pRes) == 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "CREATE user test_stb_write pass 'test'"); + ASSERT(taos_errno(pRes) == 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "grant read on td24070_write.stb2 to test_stb_read"); + ASSERT(taos_errno(pRes) == 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "grant write on td24070_write.stb2 to test_stb_write"); + ASSERT(taos_errno(pRes) == 0); + taos_free_result(pRes); + taos_close(taos); + + taos = taos_connect("localhost", "test_stb_read", "test", "td24070_write", 0); + const char* sql1[] = {"stb2,t1=1,dataModelName=t0 f1=283i32 1632299373000"}; + + pRes = taos_schemaless_insert(taos, (char **)sql1, sizeof(sql1) / sizeof(sql1[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + code = taos_errno(pRes); + ASSERT(code != 0); + taos_free_result(pRes); + taos_close(taos); + + taos = taos_connect("localhost", "test_stb_write", "test", "td24070_write", 0); + const char* sql2[] = {"stb2,t1=1,dataModelName=t0 f1=283i32 1632299373000"}; + + pRes = taos_schemaless_insert(taos, (char **)sql2, sizeof(sql2) / sizeof(sql2[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + code = taos_errno(pRes); + ASSERT(code == 0); + taos_free_result(pRes); + taos_close(taos); + // test stable privilege + + // test table privilege + taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + + pRes = taos_query(taos, "CREATE user test_tb_read pass 'test'"); + ASSERT(taos_errno(pRes) == 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "CREATE user test_tb_write pass 'test'"); + ASSERT(taos_errno(pRes) == 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "grant read on td24070_write.stb2 with t1=1 to test_tb_read"); + ASSERT(taos_errno(pRes) == 0); + taos_free_result(pRes); + + pRes = taos_query(taos, "grant write on td24070_write.stb2 with t1=1 to test_tb_write"); + ASSERT(taos_errno(pRes) == 0); + taos_free_result(pRes); + taos_close(taos); + + taos = taos_connect("localhost", "test_tb_read", "test", "td24070_write", 0); + const char* sql3[] = {"stb2,t1=1,dataModelName=t0 f1=283i32 1632299374000"}; + + + pRes = taos_schemaless_insert(taos, (char **)sql3, sizeof(sql3) / sizeof(sql3[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + code = taos_errno(pRes); + ASSERT(code != 0); + taos_free_result(pRes); + taos_close(taos); + + taos = taos_connect("localhost", "test_tb_write", "test", "td24070_write", 0); + const char* sql4[] = {"stb2,t1=1,dataModelName=t0 f1=283i32 1632299374000"}; + + pRes = taos_schemaless_insert(taos, (char **)sql4, sizeof(sql4) / sizeof(sql4[0]), TSDB_SML_LINE_PROTOCOL, + TSDB_SML_TIMESTAMP_MILLI_SECONDS); + + printf("%s result:%s\n", __FUNCTION__, taos_errstr(pRes)); + code = taos_errno(pRes); + ASSERT(code == 0); + taos_free_result(pRes); + taos_close(taos); + // test table privilege + + return code; +} + int sml_td23881_Test() { TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); @@ -1379,6 +1528,8 @@ int main(int argc, char *argv[]) { } int ret = 0; + ret = sml_td24070_Test(); + ASSERT(!ret); ret = sml_td23881_Test(); ASSERT(ret); ret = sml_escape_Test(); diff --git a/utils/test/c/tmqSim.c b/utils/test/c/tmqSim.c index d98a45f0d3..dd6875185f 100644 --- a/utils/test/c/tmqSim.c +++ b/utils/test/c/tmqSim.c @@ -542,7 +542,8 @@ static void shellDumpFieldToFile(TdFilePtr pFile, const char* val, TAOS_FIELD* f break; case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: - case TSDB_DATA_TYPE_JSON: { + case TSDB_DATA_TYPE_JSON: + case TSDB_DATA_TYPE_GEOMETRY: { int32_t bufIndex = 0; for (int32_t i = 0; i < length; i++) { buf[bufIndex] = val[i]; diff --git a/utils/tsim/src/simExe.c b/utils/tsim/src/simExe.c index 1be28635ef..c1f0f502f3 100644 --- a/utils/tsim/src/simExe.c +++ b/utils/tsim/src/simExe.c @@ -752,6 +752,7 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) { break; case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: + case TSDB_DATA_TYPE_GEOMETRY: if (length[i] < 0 || length[i] > 1 << 20) { fprintf(stderr, "Invalid length(%d) of BINARY or NCHAR\n", length[i]); exit(-1);