diff --git a/README-CN.md b/README-CN.md index 2b1790f4bb..4931c0177e 100644 --- a/README-CN.md +++ b/README-CN.md @@ -45,7 +45,7 @@ TDengine 目前可以在 Linux、 Windows、macOS 等平台上安装和运行。 TDengine 还提供一组辅助工具软件 taosTools,目前它包含 taosBenchmark(曾命名为 taosdemo)和 taosdump 两个软件。默认 TDengine 编译不包含 taosTools, 您可以在编译 TDengine 时使用`cmake .. -DBUILD_TOOLS=true` 来同时编译 taosTools。 -为了构建TDengine, 请使用 [CMake](https://cmake.org/) 3.0.2 或者更高版本。 +为了构建TDengine, 请使用 [CMake](https://cmake.org/) 3.13.0 或者更高版本。 ## 安装工具 @@ -124,7 +124,7 @@ brew install argp-standalone gflags pkgconfig TDengine 包含数个使用 Go 语言开发的组件,比如taosAdapter, 请参考 golang.org 官方文档设置 go 开发环境。 -请使用 1.14 及以上版本。对于中国用户,我们建议使用代理来加速软件包下载。 +请使用 1.20 及以上版本。对于中国用户,我们建议使用代理来加速软件包下载。 ``` go env -w GO111MODULE=on diff --git a/README.md b/README.md index a8c20ea3f6..31d3a8bf67 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ You can choose to install through source code, [container](https://docs.tdengine TDengine provide a few useful tools such as taosBenchmark (was named taosdemo) and taosdump. They were part of TDengine. By default, TDengine compiling does not include taosTools. You can use `cmake .. -DBUILD_TOOLS=true` to make them be compiled with TDengine. -To build TDengine, use [CMake](https://cmake.org/) 3.0.2 or higher versions in the project directory. +To build TDengine, use [CMake](https://cmake.org/) 3.13.0 or higher versions in the project directory. ## Install build tools @@ -131,7 +131,7 @@ brew install argp-standalone gflags pkgconfig TDengine includes a few components like taosAdapter developed by Go language. Please refer to golang.org official documentation for golang environment setup. -Please use version 1.14+. For the user in China, we recommend using a proxy to accelerate package downloading. +Please use version 1.20+. For the user in China, we recommend using a proxy to accelerate package downloading. ``` go env -w GO111MODULE=on diff --git a/cmake/cmake.define b/cmake/cmake.define index 73f9497809..12e1b50539 100644 --- a/cmake/cmake.define +++ b/cmake/cmake.define @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.0) -set(CMAKE_VERBOSE_MAKEFILE TRUE) +set(CMAKE_VERBOSE_MAKEFILE FALSE) set(TD_BUILD_TAOSA_INTERNAL FALSE) #set output directory diff --git a/cmake/taosadapter_CMakeLists.txt.in b/cmake/taosadapter_CMakeLists.txt.in index ef6ed4af1d..13826a1a74 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 3.0 + GIT_TAG main SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter" BINARY_DIR "" #BUILD_IN_SOURCE TRUE diff --git a/deps/arm/dm_static/libdmodule.a b/deps/arm/dm_static/libdmodule.a index 9e69059651..dbad0112cf 100644 Binary files a/deps/arm/dm_static/libdmodule.a and b/deps/arm/dm_static/libdmodule.a differ diff --git a/deps/darwin/arm/dm_static/libdmodule.a b/deps/darwin/arm/dm_static/libdmodule.a index 5fbfc4dd58..2aab587b18 100644 Binary files a/deps/darwin/arm/dm_static/libdmodule.a and b/deps/darwin/arm/dm_static/libdmodule.a differ diff --git a/deps/darwin/x64/dm_static/libdmodule.a b/deps/darwin/x64/dm_static/libdmodule.a index 9f81fe8381..1fb6794f65 100644 Binary files a/deps/darwin/x64/dm_static/libdmodule.a and b/deps/darwin/x64/dm_static/libdmodule.a differ diff --git a/deps/x86/dm_static/libdmodule.a b/deps/x86/dm_static/libdmodule.a index cce0217501..9d37818a79 100644 Binary files a/deps/x86/dm_static/libdmodule.a and b/deps/x86/dm_static/libdmodule.a differ diff --git a/docs/en/01-index.md b/docs/en/01-index.md index 9fe5e7800a..54271659ec 100644 --- a/docs/en/01-index.md +++ b/docs/en/01-index.md @@ -19,7 +19,9 @@ TDengine uses ubiquitous SQL as its query language, which greatly reduces learni If you are a system administrator who cares about installation, upgrade, fault tolerance, disaster recovery, data import, data export, system configuration, how to monitor whether TDengine is running healthily, and how to improve system performance, please refer to, and thoroughly read the [Administration](./operation) section. -If you want to know more about TDengine tools, the REST API, and connectors for various programming languages, please see the [Reference](./reference) chapter. +If you want to know more about TDengine tools and the REST API, please see the [Reference](./reference) chapter. + +For information about connecting to TDengine with different programming languages, see [Client Libraries](./client-libraries/). If you are very interested in the internal design of TDengine, please read the chapter [Inside TDengine](./tdinternal), which introduces the cluster design, data partitioning, sharding, writing, and reading processes in detail. If you want to study TDengine code or even contribute code, please read this chapter carefully. diff --git a/docs/en/02-intro/index.md b/docs/en/02-intro/index.md index f9fe68b47a..28b94a5236 100644 --- a/docs/en/02-intro/index.md +++ b/docs/en/02-intro/index.md @@ -37,27 +37,26 @@ The major features are listed below: - Provides an interactive [Command Line Interface (CLI)](../reference/taos-shell) for management, maintenance and ad-hoc queries. - Provides a tool [taosBenchmark](../reference/taosbenchmark/) for testing the performance of TDengine. 10. Programming - - Provides [connectors](../reference/connector/) for [C/C++](../reference/connector/cpp), [Java](../reference/connector/java), [Python](../reference/connector/python), [Go](../reference/connector/go), [Rust](../reference/connector/rust), [Node.js](../reference/connector/node) and other programming languages. + - Provides [client libraries](../client-libraries/) for [C/C++](../client-libraries/cpp), [Java](../client-libraries/java), [Python](../client-libraries/python), [Go](../client-libraries/go), [Rust](../client-libraries/rust), [Node.js](../client-libraries/node) and other programming languages. - Provides a [REST API](../reference/rest-api/). For more details on features, please read through the entire documentation. ## Competitive Advantages -By making full use of [characteristics of time series data](https://tdengine.com/tsdb/characteristics-of-time-series-data/), TDengine differentiates itself from other [time series databases](https://tdengine.com/tsdb/), with the following advantages. +By making full use of [characteristics of time series data](https://tdengine.com/characteristics-of-time-series-data/), TDengine differentiates itself from other time series databases with the following advantages. -- **[High-Performance](https://tdengine.com/tdengine/high-performance-time-series-database/)**: TDengine is the only time-series database to solve the high cardinality issue to support billions of data collection points while out performing other time-series databases for data ingestion, querying and data compression. +- **[High-Performance](https://tdengine.com/high-performance/)**: TDengine is the only time-series database to solve the high cardinality issue to support billions of data collection points while out performing other time-series databases for data ingestion, querying and data compression. -- **[Simplified Solution](https://tdengine.com/tdengine/simplified-time-series-data-solution/)**: Through built-in caching, stream processing and data subscription features, TDengine provides a simplified solution for time-series data processing. It reduces system design complexity and operation costs significantly. +- **[Simplified Solution](https://tdengine.com/comprehensive-industrial-data-solution/)**: Through built-in caching, stream processing and data subscription features, TDengine provides a simplified solution for time-series data processing. It reduces system design complexity and operation costs significantly. -- **[Cloud Native](https://tdengine.com/tdengine/cloud-native-time-series-database/)**: Through native distributed design, sharding and partitioning, separation of compute and storage, RAFT, support for Kubernetes deployment and full observability, TDengine is a cloud native Time-series Database and can be deployed on public, private or hybrid clouds. +- **[Cloud Native](https://tdengine.com/cloud-native/)**: Through native distributed design, sharding and partitioning, separation of compute and storage, RAFT, support for Kubernetes deployment and full observability, TDengine is a cloud native Time-series Database and can be deployed on public, private or hybrid clouds. -- **[Ease of Use](https://tdengine.com/tdengine/easy-time-series-data-platform/)**: For administrators, TDengine significantly reduces the effort to[ - ](https://tdengine.com/tdengine/easy-time-series-data-platform/) deploy and maintain. For developers, it provides a simple interface, simplified solution and seamless integrations for third party tools. For data users, it gives easy data access. +- **[Ease of Use](https://tdengine.com/easy-to-use/)**: For administrators, TDengine significantly reduces the effort to deploy and maintain. For developers, it provides a simple interface, simplified solution and seamless integrations for third party tools. For data users, it gives easy data access. -- **[Easy Data Analytics](https://tdengine.com/tdengine/time-series-data-analytics-made-easy/)**: Through super tables, storage and compute separation, data partitioning by time interval, pre-computation and other means, TDengine makes it easy to explore, format, and get access to data in a highly efficient way. +- **[Easy Data Analytics](https://tdengine.com/simplifying-time-series-analysis-for-data-scientists/)**: Through super tables, storage and compute separation, data partitioning by time interval, pre-computation and other means, TDengine makes it easy to explore, format, and get access to data in a highly efficient way. -- **[Open Source](https://tdengine.com/tdengine/open-source-time-series-database/)**: TDengine's core modules, including cluster feature, are all available under open source licenses. It has gathered over 19k stars on GitHub. There is an active developer community, and over 140k running instances worldwide. +- **[Open Source](https://tdengine.com/open-source/)**: TDengine's core modules, including cluster feature, are all available under open source licenses. It has gathered over 22k stars on GitHub. There is an active developer community, and over 400k running instances worldwide. With TDengine, the total cost of ownership of your time-series data platform can be greatly reduced. @@ -125,16 +124,9 @@ As a high-performance, scalable and SQL supported time-series database, TDengine - [TDengine vs. InfluxDB](https://tdengine.com/tsdb-comparison-influxdb-vs-tdengine/) - [TDengine vs. TimescaleDB](https://tdengine.com/tsdb-comparison-timescaledb-vs-tdengine/) -- [TDengine vs. OpenTSDB](https://tdengine.com/performance-tdengine-vs-opentsdb/) -- [TDengine vs. Cassandra](https://tdengine.com/performance-tdengine-vs-cassandra/) - -## More readings -- [Introduction to Time-Series Database](https://tdengine.com/tsdb/) -- [Introduction to TDengine competitive advantages](https://tdengine.com/tdengine/) - ## Products -There are two products offered by TDengine: TDengine Enterprise and TDengine Cloud, for details please refer to -- [TDengine Enterprise](https://www.taosdata.com/tdengine-pro) -- [TDengine Cloud](https://cloud.taosdata.com/?utm_source=menu&utm_medium=webcn) +For information about our paid offerings, see: +- [TDengine Enterprise](https://tdengine.com/enterprise/) +- [TDengine Cloud](https://cloud.tdengine.com) \ No newline at end of file diff --git a/docs/en/05-get-started/01-docker.md b/docs/en/05-get-started/01-docker.md index 723194a325..761faf4a05 100644 --- a/docs/en/05-get-started/01-docker.md +++ b/docs/en/05-get-started/01-docker.md @@ -30,7 +30,7 @@ And then run the following command: docker run -d -p 6030:6030 -p 6041:6041 -p 6043-6049:6043-6049 -p 6043-6049:6043-6049/udp tdengine/tdengine ``` -Note that TDengine Server 3.0 uses TCP port 6030. Port 6041 is used by taosAdapter for the REST API service. Ports 6043 through 6049 are used by taosAdapter for other connectors. You can open these ports as needed. +Note that TDengine Server 3.0 uses TCP port 6030. Port 6041 is used by taosAdapter for the REST API service. Ports 6043 through 6049 are used by taosAdapter for other connections. You can open these ports as needed. If you need to persist data to a specific directory on your local machine, please run the following command: ```shell diff --git a/docs/en/05-get-started/03-package.md b/docs/en/05-get-started/03-package.md index d34df2c970..c6f3e60932 100644 --- a/docs/en/05-get-started/03-package.md +++ b/docs/en/05-get-started/03-package.md @@ -14,9 +14,9 @@ This document describes how to install TDengine on Linux/Windows/macOS and perfo - To get started with TDengine on Docker, see [Quick Install on Docker](../../get-started/docker). - If you want to view the source code, build TDengine yourself, or contribute to the project, see the [TDengine GitHub repository](https://github.com/taosdata/TDengine). -The full package of TDengine includes the TDengine Server (`taosd`), TDengine Client (`taosc`), taosAdapter for connecting with third-party systems and providing a RESTful interface, a command-line interface (CLI, taos), and some tools. Note that taosAdapter supports Linux only. In addition to connectors for multiple languages, TDengine also provides a [REST API](../../reference/rest-api) through [taosAdapter](../../reference/taosadapter). +The full package of TDengine includes the TDengine Server (`taosd`), TDengine Client (`taosc`), taosAdapter for connecting with third-party systems and providing a RESTful interface, a command-line interface (CLI, taos), and some tools. Note that taosAdapter supports Linux only. In addition to client libraries for multiple languages, TDengine also provides a [REST API](../../reference/rest-api) through [taosAdapter](../../reference/taosadapter). -The standard server installation package includes `taos`, `taosd`, `taosAdapter`, `taosBenchmark`, and sample code. You can also download the Lite package that includes only `taosd` and the C/C++ connector. +The standard server installation package includes `taos`, `taosd`, `taosAdapter`, `taosBenchmark`, and sample code. You can also download the Lite package that includes only `taosd` and the C/C++ client library. TDengine OSS is released as Deb and RPM packages. The Deb package can be installed on Debian, Ubuntu, and derivative systems. The RPM package can be installed on CentOS, RHEL, SUSE, and derivative systems. A .tar.gz package is also provided for enterprise customers, and you can install TDengine over `apt-get` as well. The .tar.tz package includes `taosdump` and the TDinsight installation script. If you want to use these utilities with the Deb or RPM package, download and install taosTools separately. TDengine can also be installed on x64 Windows and x64/m1 macOS. diff --git a/docs/en/05-get-started/_pkg_install.mdx b/docs/en/05-get-started/_pkg_install.mdx index 2372d2ff26..768cc7cd74 100644 --- a/docs/en/05-get-started/_pkg_install.mdx +++ b/docs/en/05-get-started/_pkg_install.mdx @@ -2,7 +2,7 @@ import PkgList from "/components/PkgList"; TDengine is easy to download and install. -The standard server installation package includes `taos`, `taosd`, `taosAdapter`, `taosBenchmark`, and sample code. You can also download a lite package that includes only `taosd` and the C/C++ connector. +The standard server installation package includes `taos`, `taosd`, `taosAdapter`, `taosBenchmark`, and sample code. You can also download a lite package that includes only `taosd` and the C/C++ client library. You can download the TDengine installation package in .rpm, .deb, or .tar.gz format. The .tar.tz package includes `taosdump` and the TDinsight installation script. If you want to use these utilities with the .deb or .rpm package, download and install taosTools separately. @@ -10,7 +10,7 @@ Between official releases, beta versions may be released that contain new featur -For information about installing TDengine, see [Install and Uninstall](../../operation/pkg-install). +For information about installing TDengine, see [Install and Uninstall](../operation/pkg-install). For information about TDengine releases, see [All Downloads](https://tdengine.com/all-downloads) diff --git a/docs/en/05-get-started/index.md b/docs/en/05-get-started/index.md index 5c4ab59f75..697f98af15 100644 --- a/docs/en/05-get-started/index.md +++ b/docs/en/05-get-started/index.md @@ -12,7 +12,7 @@ import StackOverflowSVG from './stackoverflow.svg' You can install and run TDengine on Linux/Windows/macOS machines as well as Docker containers. You can also deploy TDengine as a managed service with TDengine Cloud. -The full package of TDengine includes the TDengine Server (`taosd`), TDengine Client (`taosc`), taosAdapter for connecting with third-party systems and providing a RESTful interface, a command-line interface, and some tools. In addition to connectors for multiple languages, TDengine also provides a [RESTful interface](../reference/rest-api) through [taosAdapter](../reference/taosadapter). +The full package of TDengine includes the TDengine Server (`taosd`), TDengine Client (`taosc`), taosAdapter for connecting with third-party systems and providing a RESTful interface, a command-line interface, and some tools. In addition to client libraries for multiple languages, TDengine also provides a [RESTful interface](../reference/rest-api) through [taosAdapter](../reference/taosadapter). ```mdx-code-block import DocCardList from '@theme/DocCardList'; diff --git a/docs/en/07-develop/01-connect/_connect_java.mdx b/docs/en/07-develop/01-connect/_connect_java.mdx index fda86f2221..4d29e24911 100644 --- a/docs/en/07-develop/01-connect/_connect_java.mdx +++ b/docs/en/07-develop/01-connect/_connect_java.mdx @@ -12,4 +12,4 @@ When using REST connection, the feature of bulk pulling can be enabled if the si {{#include docs/examples/java/src/main/java/com/taos/example/WSConnectExample.java:main}} ``` -More configuration about connection, please refer to [Java Connector](../../reference/connector/java) +More configuration about connection, please refer to [Java Client Library](../../client-libraries/java) diff --git a/docs/en/07-develop/01-connect/_connect_rust.mdx b/docs/en/07-develop/01-connect/_connect_rust.mdx index 80ac1f4ff4..5746968263 100644 --- a/docs/en/07-develop/01-connect/_connect_rust.mdx +++ b/docs/en/07-develop/01-connect/_connect_rust.mdx @@ -3,6 +3,6 @@ ``` :::note -For Rust connector, the connection depends on the feature being used. If "rest" feature is enabled, then only the implementation for "rest" is compiled and packaged. +For Rust client library, the connection depends on the feature being used. If "rest" feature is enabled, then only the implementation for "rest" is compiled and packaged. ::: diff --git a/docs/en/07-develop/01-connect/index.md b/docs/en/07-develop/01-connect/index.md index 3f09f9fb6a..2f826920ad 100644 --- a/docs/en/07-develop/01-connect/index.md +++ b/docs/en/07-develop/01-connect/index.md @@ -1,7 +1,7 @@ --- title: Connect to TDengine sidebar_label: Connect -description: This document describes how to establish connections to TDengine and how to install and use TDengine connectors. +description: This document describes how to establish connections to TDengine and how to install and use TDengine client libraries. --- import Tabs from "@theme/Tabs"; @@ -15,28 +15,28 @@ import ConnCSNative from "./_connect_cs.mdx"; import ConnC from "./_connect_c.mdx"; import ConnR from "./_connect_r.mdx"; import ConnPHP from "./_connect_php.mdx"; -import InstallOnLinux from "../../14-reference/03-connector/_linux_install.mdx"; -import InstallOnWindows from "../../14-reference/03-connector/_windows_install.mdx"; -import InstallOnMacOS from "../../14-reference/03-connector/_macos_install.mdx"; -import VerifyLinux from "../../14-reference/03-connector/_verify_linux.mdx"; -import VerifyWindows from "../../14-reference/03-connector/_verify_windows.mdx"; -import VerifyMacOS from "../../14-reference/03-connector/_verify_macos.mdx"; +import InstallOnLinux from "../../08-client-libraries/_linux_install.mdx"; +import InstallOnWindows from "../../08-client-libraries/_windows_install.mdx"; +import InstallOnMacOS from "../../08-client-libraries/_macos_install.mdx"; +import VerifyLinux from "../../08-client-libraries/_verify_linux.mdx"; +import VerifyWindows from "../../08-client-libraries/_verify_windows.mdx"; +import VerifyMacOS from "../../08-client-libraries/_verify_macos.mdx"; -Any application running on any platform can access TDengine through the REST API provided by TDengine. For information, see [REST API](../../reference/rest-api/). Applications can also use the connectors for various programming languages, including C/C++, Java, Python, Go, Node.js, C#, and Rust, to access TDengine. These connectors support connecting to TDengine clusters using both native interfaces (taosc). Some connectors also support connecting over a REST interface. Community developers have also contributed several unofficial connectors, such as the ADO.NET connector, the Lua connector, and the PHP connector. +Any application running on any platform can access TDengine through the REST API provided by TDengine. For information, see [REST API](../../reference/rest-api/). Applications can also use the client libraries for various programming languages, including C/C++, Java, Python, Go, Node.js, C#, and Rust, to access TDengine. These client libraries support connecting to TDengine clusters using both native interfaces (taosc). Some client libraries also support connecting over a REST interface. Community developers have also contributed several unofficial client libraries, such as the ADO.NET, Lua, and PHP libraries. ## Establish Connection -There are two ways for a connector to establish connections to TDengine: +There are two ways for a client library to establish connections to TDengine: 1. REST connection through the REST API provided by the taosAdapter component. 2. Native connection through the TDengine client driver (taosc). -For REST and native connections, connectors provide similar APIs for performing operations and running SQL statements on your databases. The main difference is the method of establishing the connection, which is not visible to users. +For REST and native connections, client libraries provide similar APIs for performing operations and running SQL statements on your databases. The main difference is the method of establishing the connection, which is not visible to users. Key differences: 3. The REST connection is more accessible with cross-platform support, however it results in a 30% performance downgrade. -1. The TDengine client driver (taosc) has the highest performance with all the features of TDengine like [Parameter Binding](../../reference/connector/cpp#parameter-binding-api), [Subscription](../../reference/connector/cpp#subscription-and-consumption-api), etc. +1. The TDengine client driver (taosc) has the highest performance with all the features of TDengine like [Parameter Binding](../../client-libraries/cpp#parameter-binding-api), [Subscription](../../client-libraries/cpp#subscription-and-consumption-api), etc. ## Install Client Driver taosc @@ -72,7 +72,7 @@ After the above installation and configuration are done and making sure TDengine -## Install Connectors +## Install Client Library @@ -131,7 +131,7 @@ libtaos = { version = "0.4.2"} ``` :::info -Rust connector uses different features to distinguish the way to establish connection. To establish REST connection, please enable `rest` feature. +Rust client library uses different features to distinguish the way to establish connection. To establish REST connection, please enable `rest` feature. ```toml libtaos = { version = "*", features = ["rest"] } @@ -142,9 +142,9 @@ libtaos = { version = "*", features = ["rest"] } -Node.js connector provides different ways of establishing connections by providing different packages. +Node.js client library provides different ways of establishing connections by providing different packages. -1. Install Node.js Native Connector +1. Install Node.js Native Client Library ``` npm install @tdengine/client @@ -154,7 +154,7 @@ npm install @tdengine/client It's recommend to use Node whose version is between `node-v12.8.0` and `node-v13.0.0`. ::: -2. Install Node.js REST Connector +2. Install Node.js REST Client Library ``` npm install @tdengine/rest @@ -177,7 +177,7 @@ Just need to add the reference to [TDengine.Connector](https://www.nuget.org/pac - + @@ -207,7 +207,7 @@ install.packages("RJDBC") -If the client driver (taosc) is already installed, then the C connector is already available. +If the client driver (taosc) is already installed, then the C client library is already available.
diff --git a/docs/en/07-develop/03-insert-data/01-sql-writing.mdx b/docs/en/07-develop/03-insert-data/01-sql-writing.mdx index 1e719283cc..b9ec36e3ac 100644 --- a/docs/en/07-develop/03-insert-data/01-sql-writing.mdx +++ b/docs/en/07-develop/03-insert-data/01-sql-writing.mdx @@ -24,7 +24,7 @@ import PhpStmt from "./_php_stmt.mdx"; ## Introduction -Application programs can execute `INSERT` statement through connectors to insert rows. The TDengine CLI can also be used to manually insert data. +Application programs can execute `INSERT` statement through client libraries to insert rows. The TDengine CLI can also be used to manually insert data. ### Insert Single Row The below SQL statement is used to insert one row into table "d1001". diff --git a/docs/en/07-develop/03-insert-data/60-high-volume.md b/docs/en/07-develop/03-insert-data/60-high-volume.md index c15b3213bb..8e9a788d22 100644 --- a/docs/en/07-develop/03-insert-data/60-high-volume.md +++ b/docs/en/07-develop/03-insert-data/60-high-volume.md @@ -377,7 +377,7 @@ SQLWriter class encapsulates the logic of composing SQL and writing data. Please - TDengine client driver has been installed - Python3 has been installed, the the version >= 3.8 - - TDengine Python connector `taospy` has been installed + - TDengine Python client library `taospy` has been installed 2. Install faster-fifo to replace python builtin multiprocessing.Queue @@ -434,7 +434,7 @@ SQLWriter class encapsulates the logic of composing SQL and writing data. Please :::note -Don't establish connection to TDengine in the parent process if using Python connector in multi-process way, otherwise all the connections in child processes are blocked always. This is a known issue. +Don't establish connection to TDengine in the parent process if using Python client library in multi-process way, otherwise all the connections in child processes are blocked always. This is a known issue. ::: diff --git a/docs/en/07-develop/04-query-data/_cs_async.mdx b/docs/en/07-develop/04-query-data/_cs_async.mdx deleted file mode 100644 index 19c8e58f32..0000000000 --- a/docs/en/07-develop/04-query-data/_cs_async.mdx +++ /dev/null @@ -1,3 +0,0 @@ -```csharp -{{#include docs/examples/csharp/asyncQuery/Program.cs}} -``` diff --git a/docs/en/07-develop/04-query-data/index.mdx b/docs/en/07-develop/04-query-data/index.mdx index 413baf6b2c..e44161d397 100644 --- a/docs/en/07-develop/04-query-data/index.mdx +++ b/docs/en/07-develop/04-query-data/index.mdx @@ -1,6 +1,6 @@ --- title: Query Data -description: This document describes how to query data in TDengine and how to perform synchronous and asynchronous queries using connectors. +description: This document describes how to query data in TDengine and how to perform synchronous and asynchronous queries using client libraries. --- import Tabs from "@theme/Tabs"; @@ -15,12 +15,11 @@ import CQuery from "./_c.mdx"; import PhpQuery from "./_php.mdx"; import PyAsync from "./_py_async.mdx"; import NodeAsync from "./_js_async.mdx"; -import CsAsync from "./_cs_async.mdx"; import CAsync from "./_c_async.mdx"; ## Introduction -SQL is used by TDengine as its query language. Application programs can send SQL statements to TDengine through REST API or connectors. TDengine's CLI `taos` can also be used to execute ad hoc SQL queries. Here is the list of major query functionalities supported by TDengine: +SQL is used by TDengine as its query language. Application programs can send SQL statements to TDengine through REST API or client libraries. TDengine's CLI `taos` can also be used to execute ad hoc SQL queries. Here is the list of major query functionalities supported by TDengine: - Query on single column or multiple columns - Filter on tags or data columns: >, <, =, <\>, like @@ -174,9 +173,6 @@ Please note that async query can only be used with a native connection. - - - diff --git a/docs/en/07-develop/07-tmq.mdx b/docs/en/07-develop/07-tmq.mdx index 8e7bbf22e9..281e9e6750 100644 --- a/docs/en/07-develop/07-tmq.mdx +++ b/docs/en/07-develop/07-tmq.mdx @@ -23,7 +23,7 @@ By subscribing to a topic, a consumer can obtain the latest data in that topic i To implement these features, TDengine indexes its write-ahead log (WAL) file for fast random access and provides configurable methods for replacing and retaining this file. You can define a retention period and size for this file. For information, see the CREATE DATABASE statement. In this way, the WAL file is transformed into a persistent storage engine that remembers the order in which events occur. However, note that configuring an overly long retention period for your WAL files makes database compression inefficient. TDengine then uses the WAL file instead of the time-series database as its storage engine for queries in the form of topics. TDengine reads the data from the WAL file; uses a unified query engine instance to perform filtering, transformations, and other operations; and finally pushes the data to consumers. -The following are some explanations about data subscription, which require some understanding of the architecture of TDengine and the use of various language linker interfaces. +The following are some explanations about data subscription, which require some understanding of the architecture of TDengine and the use of various language linker interfaces(you can learn it when you need it). - A consumption group consumes all data under the same topic, and different consumption groups are independent of each other; - A consumption group consumes all vgroups of the same topic, which can be composed of multiple consumers, but a vgroup is only consumed by one consumer. If the number of consumers exceeds the number of vgroups, the excess consumers do not consume data; - On the server side, only one offset is saved for each vgroup, and the offsets for each vgroup are monotonically increasing, but not necessarily continuous. There is no correlation between the offsets of various vgroups; @@ -45,12 +45,13 @@ The following are some explanations about data subscription, which require some This document does not provide any further introduction to the knowledge of message queues themselves. If you need to know more, please search for it yourself. +Note: Starting from version 3.2.0.0, data subscription supports vnode migration and splitting. Due to the dependence of data subscription on wal files, wal does not synchronize during vnode migration and splitting. Therefore, after migration or splitting, wal data that has not been consumed before cannot be consumed. So please ensure that all data has been consumed before proceeding with vnode migration or splitting, otherwise data loss may occur during consumption. ## Data Schema and API -The related schemas and APIs in various languages are described as follows: +The related schemas and APIs in various languages are described as follows(Note that the consumer structure is not thread safe. When using a consumer on one thread, do not close the consumer on another thread): @@ -248,23 +249,23 @@ function close() ```csharp +class ConsumerBuilder + ConsumerBuilder(IEnumerable> config) -virtual IConsumer Build() - -Consumer(ConsumerBuilder builder) +public IConsumer Build() void Subscribe(IEnumerable topics) void Subscribe(string topic) -ConsumeResult Consume(int millisecondsTimeout) +ConsumeResult Consume(int millisecondsTimeout) List Subscription() void Unsubscribe() -void Commit(ConsumeResult consumerResult) +List Commit() void Close() ``` @@ -500,25 +501,19 @@ let consumer = taos.consumer({ ```csharp -using TDengineTMQ; - -// Create consumer groups on demand (GourpID) and enable automatic commits (EnableAutoCommit), -// an automatic commit interval (AutoCommitIntervalMs), and a username (TDConnectUser) and password (TDConnectPasswd) -var cfg = new ConsumerConfig - { - EnableAutoCommit = "true" - AutoCommitIntervalMs = "1000" - GourpId = "TDengine-TMQ-C#", - TDConnectUser = "root", - TDConnectPasswd = "taosdata", - AutoOffsetReset = "latest" - MsgWithTableName = "true", - TDConnectIp = "127.0.0.1", - TDConnectPort = "6030" - }; - -var consumer = new ConsumerBuilder(cfg).Build(); - +var cfg = new Dictionary() +{ + { "group.id", "group1" }, + { "auto.offset.reset", "latest" }, + { "td.connect.ip", "127.0.0.1" }, + { "td.connect.user", "root" }, + { "td.connect.pass", "taosdata" }, + { "td.connect.port", "6030" }, + { "client.id", "tmq_example" }, + { "enable.auto.commit", "true" }, + { "msg.with.table.name", "false" }, +}; +var consumer = new ConsumerBuilder>(cfg).Build(); ``` @@ -747,10 +742,12 @@ while(true){ ## Consume data while (true) { - var consumerRes = consumer.Consume(100); - // process ConsumeResult - ProcessMsg(consumerRes); - consumer.Commit(consumerRes); + using (var result = consumer.Consume(500)) + { + if (result == null) continue; + ProcessMsg(result); + consumer.Commit(); + } } ``` diff --git a/docs/en/07-develop/index.md b/docs/en/07-develop/index.md index 4ed5e8c19f..da020d53d5 100644 --- a/docs/en/07-develop/index.md +++ b/docs/en/07-develop/index.md @@ -5,7 +5,7 @@ description: This document describes how to use the various components of TDengi Before creating an application to process time-series data with TDengine, consider the following: -1. Choose the method to connect to TDengine. TDengine offers a REST API that can be used with any programming language. It also has connectors for a variety of languages. +1. Choose the method to connect to TDengine. TDengine offers a REST API that can be used with any programming language. It also has client libraries for a variety of languages. 2. Design the data model based on your own use cases. Consider the main [concepts](../concept/) of TDengine, including "one table per data collection point" and the supertable. Learn about static labels, collected metrics, and subtables. Depending on the characteristics of your data and your requirements, you decide to create one or more databases and design a supertable schema that fit your data. 3. Decide how you will insert data. TDengine supports writing using standard SQL, but also supports schemaless writing, so that data can be written directly without creating tables manually. 4. Based on business requirements, find out what SQL query statements need to be written. You may be able to repurpose any existing SQL. @@ -14,7 +14,7 @@ Before creating an application to process time-series data with TDengine, consid 7. In many use cases (such as fleet management), the application needs to obtain the latest status of each data collection point. It is recommended that you use the cache function of TDengine instead of deploying Redis separately. 8. If you find that the SQL functions of TDengine cannot meet your requirements, then you can use user-defined functions to solve the problem. -This section is organized in the order described above. For ease of understanding, TDengine provides sample code for each supported programming language for each function. If you want to learn more about the use of SQL, please read the [SQL manual](../taos-sql/). For a more in-depth understanding of the use of each connector, please read the [Connector Reference Guide](../reference/connector/). If you also want to integrate TDengine with third-party systems, such as Grafana, please refer to the [third-party tools](../third-party/). +This section is organized in the order described above. For ease of understanding, TDengine provides sample code for each supported programming language for each function. If you want to learn more about the use of SQL, please read the [SQL manual](../taos-sql/). For a more in-depth understanding of the use of each client library, please read the [Client Library Reference Guide](../client-libraries/). If you also want to integrate TDengine with third-party systems, such as Grafana, please refer to the [third-party tools](../third-party/). If you encounter any problems during the development process, please click ["Submit an issue"](https://github.com/taosdata/TDengine/issues/new/choose) at the bottom of each page and submit it on GitHub right away. diff --git a/docs/en/14-reference/03-connector/03-cpp.mdx b/docs/en/08-client-libraries/03-cpp.mdx similarity index 97% rename from docs/en/14-reference/03-connector/03-cpp.mdx rename to docs/en/08-client-libraries/03-cpp.mdx index 27adb58c12..80014ef3bf 100644 --- a/docs/en/14-reference/03-connector/03-cpp.mdx +++ b/docs/en/08-client-libraries/03-cpp.mdx @@ -1,10 +1,10 @@ --- -title: C/C++ Connector +title: C/C++ Client Library sidebar_label: C/C++ -description: This document describes the TDengine C/C++ connector. +description: This document describes the TDengine C/C++ client library. --- -C/C++ developers can use TDengine's client driver and the C/C++ connector, to develop their applications to connect to TDengine clusters for data writing, querying, and other functions. To use the C/C++ connector you must include the TDengine header file _taos.h_, which lists the function prototypes of the provided APIs. The application also needs to link to the corresponding dynamic libraries on the platform where it is located. +C/C++ developers can use TDengine's client driver and the C/C++ client library, to develop their applications to connect to TDengine clusters for data writing, querying, and other functions. To use the C/C++ client library you must include the TDengine header file _taos.h_, which lists the function prototypes of the provided APIs. The application also needs to link to the corresponding dynamic libraries on the platform where it is located. ```c #include @@ -263,7 +263,7 @@ typedef struct taosField { Get the reason for the last API call failure. The return value is the error code. :::note -TDengine version 2.0 and above recommends that each thread of a database application create a separate connection or a connection pool based on threads. It is not recommended to pass the connection (TAOS\*) structure to different threads for shared use in the application. Queries, writes, and other operations issued that are based on TAOS structures are multi-thread safe, but state quantities such as the "USE statement" may interfere between threads. In addition, the C connector can dynamically create new database-oriented connections on demand (this procedure is not visible to the user), and it is recommended that `taos_close()` be called only at the final exit of the program to close the connection. +TDengine version 2.0 and above recommends that each thread of a database application create a separate connection or a connection pool based on threads. It is not recommended to pass the connection (TAOS\*) structure to different threads for shared use in the application. Queries, writes, and other operations issued that are based on TAOS structures are multi-thread safe, but state quantities such as the "USE statement" may interfere between threads. In addition, the C client library can dynamically create new database-oriented connections on demand (this procedure is not visible to the user), and it is recommended that `taos_close()` be called only at the final exit of the program to close the connection. ::: @@ -394,7 +394,7 @@ The specific functions related to the interface are as follows (see also the [pr ### Schemaless Writing API -In addition to writing data using the SQL method or the parameter binding API, writing can also be done using schemaless writing, which eliminates the need to create a super table/data sub-table structure in advance and writes the data directly. The TDengine system automatically creates and maintains the required table structure based on the written data content. The use of schemaless writing is described in the chapter [Schemaless Writing](../../schemaless/), and the C/C++ API used with it is described here. +In addition to writing data using the SQL method or the parameter binding API, writing can also be done using schemaless writing, which eliminates the need to create a super table/data sub-table structure in advance and writes the data directly. The TDengine system automatically creates and maintains the required table structure based on the written data content. The use of schemaless writing is described in the chapter [Schemaless Writing](../../reference/schemaless/), and the C/C++ API used with it is described here. - `TAOS_RES* taos_schemaless_insert(TAOS* taos, const char* lines[], int numLines, int protocol, int precision)` diff --git a/docs/en/14-reference/03-connector/04-java.mdx b/docs/en/08-client-libraries/04-java.mdx similarity index 96% rename from docs/en/14-reference/03-connector/04-java.mdx rename to docs/en/08-client-libraries/04-java.mdx index 039395cc30..9feab378e0 100644 --- a/docs/en/14-reference/03-connector/04-java.mdx +++ b/docs/en/08-client-libraries/04-java.mdx @@ -1,16 +1,16 @@ --- -title: TDengine Java Connector +title: TDengine Java Client Library sidebar_label: Java -description: This document describes the TDengine Java Connector. +description: This document describes the TDengine Java client library. toc_max_heading_level: 4 --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -`taos-jdbcdriver` is the official Java connector for TDengine. Java developers can use it to develop applications that access data in TDengine. `taos-jdbcdriver` implements standard JDBC driver interfaces and two connection methods: One is **native connection**, which connects to TDengine instances natively through the TDengine client driver (taosc), supporting data writing, querying, subscriptions, schemaless writing, and bind interface. The second is **REST connection** which is implemented through taosAdapter. The set of features implemented by the REST connection differs slightly from those implemented by the native connection. +`taos-jdbcdriver` is the official Java client library for TDengine. Java developers can use it to develop applications that access data in TDengine. `taos-jdbcdriver` implements standard JDBC driver interfaces and two connection methods: One is **native connection**, which connects to TDengine instances natively through the TDengine client driver (taosc), supporting data writing, querying, subscriptions, schemaless writing, and bind interface. The second is **REST connection** which is implemented through taosAdapter. The set of features implemented by the REST connection differs slightly from those implemented by the native connection. -![TDengine Database Connector Java](tdengine-jdbc-connector.webp) +![TDengine Java client library](tdengine-jdbc-connector.webp) The preceding figure shows the two ways in which a Java application can access TDengine. @@ -72,7 +72,7 @@ try (Statement statement = connection.createStatement()) { } ``` -There are four types of error codes that the JDBC connector can report: +There are four types of error codes that the JDBC client library can report: - Error code of the JDBC driver itself (error code between 0x2301 and 0x2350), - Error code of the native connection method (error code between 0x2351 and 0x2360) @@ -123,7 +123,7 @@ For specific error codes, please refer to. | 0x2379 | seek offset must not be a negative number | The seek interface parameter cannot be negative. Use the correct parameter | | 0x237a | vGroup not found in result set | subscription is not bound to the VGroup due to the rebalance mechanism | -- [TDengine Java Connector](https://github.com/taosdata/taos-connector-jdbc/blob/main/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java) +- [TDengine Java client library](https://github.com/taosdata/taos-connector-jdbc/blob/main/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java) ## TDengine DataType vs. Java DataType @@ -148,21 +148,21 @@ TDengine currently supports timestamp, number, character, Boolean type, and the **Note**: Only TAG supports JSON types Due to historical reasons, the BINARY type data in TDengine is not truly binary data and is no longer recommended for use. Please use VARBINARY type instead. -GEOMETRY type is binary data in little endian byte order, which complies with the WKB specification. For detailed information, please refer to [Data Type](../../../taos-sql/data-type/) -For WKB specifications, please refer to [Well Known Binary (WKB)]( https://libgeos.org/specifications/wkb/ ) -For Java connector, the jts library can be used to easily create GEOMETRY type objects, serialize them, and write them to TDengine. Here is an example [Geometry example](https://github.com/taosdata/TDengine/blob/3.0/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/GeometryDemo.java) +GEOMETRY type is binary data in little endian byte order, which complies with the WKB specification. For detailed information, please refer to [Data Type](../../taos-sql/data-type/) +For WKB specifications, please refer to [Well Known Binary (WKB)](https://libgeos.org/specifications/wkb/) +For Java connector, the jts library can be used to easily create GEOMETRY type objects, serialize them, and write them to TDengine. Here is an example [Geometry example](https://github.com/taosdata/TDengine/blob/3.0/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/GeometryDemo.java) ## Installation Steps ### Pre-installation preparation -Before using Java Connector to connect to the database, the following conditions are required. +Before using Java client library to connect to the database, the following conditions are required. - Java 1.8 or above runtime environment and Maven 3.6 or above installed - TDengine client driver installed (required for native connections, not required for REST connections), please refer to [Installing Client Driver](../#Install-Client-Driver) -### Install the connectors +### Install the client library @@ -186,7 +186,7 @@ Add following dependency in the `pom.xml` file of your Maven project: -You can build Java connector from source code after cloning the TDengine project: +You can build Java client library from source code after cloning the TDengine project: ```shell git clone https://github.com/taosdata/taos-connector-jdbc.git @@ -269,7 +269,7 @@ In the above example, JDBC uses the client's configuration file to establish a c In TDengine, as long as one node in firstEp and secondEp is valid, the connection to the cluster can be established normally. -The configuration file here refers to the configuration file on the machine where the application that calls the JDBC Connector is located, the default path is `/etc/taos/taos.cfg` on Linux, the default path is `C://TDengine/cfg/taos.cfg` on Windows, and the default path is `/etc/taos/taos.cfg` on macOS. +The configuration file here refers to the configuration file on the machine where the application that calls the JDBC client library is located, the default path is `/etc/taos/taos.cfg` on Linux, the default path is `C://TDengine/cfg/taos.cfg` on Windows, and the default path is `/etc/taos/taos.cfg` on macOS. @@ -368,7 +368,7 @@ The configuration parameters in properties are as follows. - TSDBDriver.PROPERTY_KEY_MESSAGE_WAIT_TIMEOUT: message transmission timeout in milliseconds, the default value is 60000 ms. It only takes effect when using JDBC REST connection and batchfetch is true. - TSDBDriver.PROPERTY_KEY_USE_SSL: connecting Securely Using SSL. true: using SSL connection, false: not using SSL connection. It only takes effect when using JDBC REST connection. - TSDBDriver.HTTP_POOL_SIZE: size of REST concurrent requests. The default value is 20. - For JDBC native connections, you can specify other parameters, such as log level, SQL length, etc., by specifying URL and Properties. For more detailed configuration, please refer to [Client Configuration](../../config/#Client-Only). + For JDBC native connections, you can specify other parameters, such as log level, SQL length, etc., by specifying URL and Properties. For more detailed configuration, please refer to [Client Configuration](../../reference/config/#Client-Only). ### Priority of configuration parameters @@ -977,7 +977,7 @@ public void setTagGeometry(int index, byte[] value) ### Schemaless Writing -TDengine supports schemaless writing. It is compatible with InfluxDB's Line Protocol, OpenTSDB's telnet line protocol, and OpenTSDB's JSON format protocol. For more information, see [Schemaless Writing](../../schemaless). +TDengine supports schemaless writing. It is compatible with InfluxDB's Line Protocol, OpenTSDB's telnet line protocol, and OpenTSDB's JSON format protocol. For more information, see [Schemaless Writing](../../reference/schemaless/). @@ -1057,7 +1057,7 @@ writer.write(lineDemo, SchemalessProtocolType.LINE, SchemalessTimestampType.NANO ### Data Subscription -The TDengine Java Connector supports subscription functionality with the following application API. +The TDengine Java client library supports subscription functionality with the following application API. #### Create a Topic @@ -1094,7 +1094,7 @@ TaosConsumer consumer = new TaosConsumer<>(config); - 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). Note that the default value of auto.offset.reset in data subscription on the TDengine server has changed since version 3.2.0.0. +- For more information, see [Consumer Parameters](../../develop/tmq). Note that the default value of auto.offset.reset in data subscription on the TDengine server has changed since version 3.2.0.0. #### Subscribe to consume data @@ -1172,14 +1172,14 @@ consumer.unsubscribe(); consumer.close() ``` -For more information, see [Data Subscription](../../../develop/tmq). +For more information, see [Data Subscription](../../develop/tmq). #### Full Sample Code -In addition to the native connection, the Java Connector also supports subscribing via websocket. +In addition to the native connection, the Java client library also supports subscribing via websocket. ```java public abstract class ConsumerLoop { @@ -1461,7 +1461,7 @@ The source code of the sample application is under `TDengine/examples/JDBC`: **Solution**: Use taos-jdbcdriver 3.0.2. -For additional troubleshooting, see [FAQ](../../../train-faq/faq). +For additional troubleshooting, see [FAQ](../../train-faq/faq). ## API Reference diff --git a/docs/en/14-reference/03-connector/05-go.mdx b/docs/en/08-client-libraries/05-go.mdx similarity index 97% rename from docs/en/14-reference/03-connector/05-go.mdx rename to docs/en/08-client-libraries/05-go.mdx index 33f7a93439..11930e2429 100644 --- a/docs/en/14-reference/03-connector/05-go.mdx +++ b/docs/en/08-client-libraries/05-go.mdx @@ -1,20 +1,20 @@ --- -title: TDengine Go Connector +title: TDengine Go Client Library sidebar_label: Go -description: This document describes the TDengine Go connector. +description: This document describes the TDengine Go client library. toc_max_heading_level: 4 --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -import GoInsert from "../../07-develop/03-insert-data/_go_sql.mdx" -import GoInfluxLine from "../../07-develop/03-insert-data/_go_line.mdx" -import GoOpenTSDBTelnet from "../../07-develop/03-insert-data/_go_opts_telnet.mdx" -import GoOpenTSDBJson from "../../07-develop/03-insert-data/_go_opts_json.mdx" -import GoQuery from "../../07-develop/04-query-data/_go.mdx" +import GoInsert from "../07-develop/03-insert-data/_go_sql.mdx" +import GoInfluxLine from "../07-develop/03-insert-data/_go_line.mdx" +import GoOpenTSDBTelnet from "../07-develop/03-insert-data/_go_opts_telnet.mdx" +import GoOpenTSDBJson from "../07-develop/03-insert-data/_go_opts_json.mdx" +import GoQuery from "../07-develop/04-query-data/_go.mdx" -`driver-go` is the official Go language connector for TDengine. It implements the [database/sql](https://golang.org/pkg/database/sql/) package, the generic Go language interface to SQL databases. Go developers can use it to develop applications that access TDengine cluster data. +`driver-go` is the official Go language client library for TDengine. It implements the [database/sql](https://golang.org/pkg/database/sql/) package, the generic Go language interface to SQL databases. Go developers can use it to develop applications that access TDengine cluster data. `driver-go` provides two ways to establish connections. One is **native connection**, which connects to TDengine instances natively through the TDengine client driver (taosc), supporting data writing, querying, subscriptions, schemaless writing, and bind interface. The other is the **REST connection**, which connects to TDengine instances via the REST interface provided by taosAdapter. The set of features implemented by the REST connection differs slightly from those implemented by the native connection. @@ -81,7 +81,7 @@ Configure the environment variables and check the command. * ```go env``` * ```gcc -v``` -### Install the connectors +### Install the client library 1. Initialize the project with the `go mod` command. @@ -222,11 +222,11 @@ func main() { ### Specify the URL and Properties to get the connection -The Go connector does not support this feature +The Go client library does not support this feature ### Priority of configuration parameters -The Go connector does not support this feature +The Go client library does not support this feature ## Usage examples @@ -769,7 +769,7 @@ You can get the unique id by `common.GetReqID()`. ### Data Subscription -The TDengine Go Connector supports subscription functionality with the following application API. +The TDengine Go client library supports subscription functionality with the following application API. #### Create a Topic diff --git a/docs/en/14-reference/03-connector/06-rust.mdx b/docs/en/08-client-libraries/06-rust.mdx similarity index 93% rename from docs/en/14-reference/03-connector/06-rust.mdx rename to docs/en/08-client-libraries/06-rust.mdx index 0981df6724..8fa5c946aa 100644 --- a/docs/en/14-reference/03-connector/06-rust.mdx +++ b/docs/en/08-client-libraries/06-rust.mdx @@ -1,7 +1,7 @@ --- -title: TDengine Rust Connector +title: TDengine Rust Client Library sidebar_label: Rust -description: This document describes the TDengine Rust connector. +description: This document describes the TDengine Rust client library. toc_max_heading_level: 4 --- @@ -9,18 +9,18 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import Preparition from "./_preparation.mdx" -import RustInsert from "../../07-develop/03-insert-data/_rust_sql.mdx" -import RustBind from "../../07-develop/03-insert-data/_rust_stmt.mdx" -import RustSml from "../../07-develop/03-insert-data/_rust_schemaless.mdx" -import RustQuery from "../../07-develop/04-query-data/_rust.mdx" +import RustInsert from "../07-develop/03-insert-data/_rust_sql.mdx" +import RustBind from "../07-develop/03-insert-data/_rust_stmt.mdx" +import RustSml from "../07-develop/03-insert-data/_rust_schemaless.mdx" +import RustQuery from "../07-develop/04-query-data/_rust.mdx" [![Crates.io](https://img.shields.io/crates/v/taos)](https://crates.io/crates/taos) ![Crates.io](https://img.shields.io/crates/d/taos) [![docs.rs](https://img.shields.io/docsrs/taos)](https://docs.rs/taos) -`taos` is the official Rust connector for TDengine. Rust developers can develop applications to access the TDengine instance data. +`taos` is the official Rust client library for TDengine. Rust developers can develop applications to access the TDengine instance data. `taos` provides two ways to establish connections. One is the **Native Connection**, which connects to TDengine instances via the TDengine client driver (taosc). The other is the **WebSocket connection**, which connects to TDengine instances via the WebSocket interface provided by taosAdapter. You can specify a connection type with Cargo features. By default, both types are supported. The Websocket connection can be used on any platform. The native connection can be used on any platform that the TDengine Client supports. -The source code for the Rust connectors is located on [GitHub](https://github.com/taosdata/taos-connector-rust). +The source code for the Rust client library is located on [GitHub](https://github.com/taosdata/taos-connector-rust). ## Supported platforms @@ -37,7 +37,7 @@ Websocket connections are supported on all platforms that can run Go. | v0.7.6 | 3.0.3.0 | Support req_id in query. | | v0.6.0 | 3.0.0.0 | Base features. | -The Rust Connector is still under rapid development and is not guaranteed to be backward compatible before 1.0. We recommend using TDengine version 3.0 or higher to avoid known issues. +The Rust client library is still under rapid development and is not guaranteed to be backward compatible before 1.0. We recommend using TDengine version 3.0 or higher to avoid known issues. ## Handling exceptions @@ -82,7 +82,7 @@ Note: Only TAG supports JSON types * Install the Rust development toolchain * If using the native connection, please install the TDengine client driver. Please refer to [install client driver](../#install-client-driver) -### Install the connectors +### Install the client library Depending on the connection method, add the [taos][taos] dependency in your Rust project as follows: @@ -154,8 +154,8 @@ The structure of the DSN description string is as follows: The parameters are described as follows: -- **driver**: Specify a driver name so that the connector can choose which method to use to establish the connection. Supported driver names are as follows: - - **taos**: Table names use the TDengine connector driver. +- **driver**: Specify a driver name so that the client library can choose which method to use to establish the connection. Supported driver names are as follows: + - **taos**: Table names use the TDengine native connection driver. - **tmq**: Use the TMQ to subscribe to data. - **http/ws**: Use Websocket to establish connections. - **https/wss**: Use Websocket to establish connections, and enable SSL/TLS. @@ -327,7 +327,7 @@ Parameter binding details see [API Reference](#stmt-api) ### Schemaless Writing -TDengine supports schemaless writing. It is compatible with InfluxDB's Line Protocol, OpenTSDB's telnet line protocol, and OpenTSDB's JSON format protocol. For more information, see [Schemaless Writing](../../schemaless). +TDengine supports schemaless writing. It is compatible with InfluxDB's Line Protocol, OpenTSDB's telnet line protocol, and OpenTSDB's JSON format protocol. For more information, see [Schemaless Writing](../../reference/schemaless/). @@ -347,7 +347,7 @@ client.put(&sml_data)? ### Data Subscription -TDengine starts subscriptions through [TMQ](../../../taos-sql/tmq/). +TDengine starts subscriptions through [TMQ](../../taos-sql/tmq/). #### Create a Topic @@ -361,7 +361,7 @@ taos.exec_many([ #### Create a Consumer -You create a TMQ connector by using a DSN. +You create a TMQ connection by using a DSN. ```rust let tmq = TmqBuilder::from_dsn("taos://localhost:6030/?group.id=test")?; @@ -442,7 +442,7 @@ The following parameters can be configured for the TMQ DSN. Only `group.id` is m - `group.id`: Within a consumer group, load balancing is implemented by consuming messages on an at-least-once basis. - `client.id`: Subscriber client ID. -- `auto.offset.reset`: Initial point of subscription. *earliest* subscribes from the beginning, and *latest* subscribes from the newest message. The default value varies depending on the TDengine version. For details, see [Data Subscription](https://docs.tdengine.com/develop/tmq/). Note: This parameter is set per consumer group. +- `auto.offset.reset`: Initial point of subscription. *earliest* subscribes from the beginning, and *latest* subscribes from the newest message. The default value varies depending on the TDengine version. For details, see [Data Subscription](../../develop/tmq/). Note: This parameter is set per consumer group. - `enable.auto.commit`: Automatically commits. This can be enabled when data consistency is not essential. - `auto.commit.interval.ms`: Interval for automatic commits. @@ -488,7 +488,7 @@ The source code of the sample application is under `TDengine/examples/rust` : ## Frequently Asked Questions -For additional troubleshooting, see [FAQ](../../../train-faq/faq). +For additional troubleshooting, see [FAQ](../../train-faq/faq). ## API Reference diff --git a/docs/en/14-reference/03-connector/07-python.mdx b/docs/en/08-client-libraries/07-python.mdx similarity index 91% rename from docs/en/14-reference/03-connector/07-python.mdx rename to docs/en/08-client-libraries/07-python.mdx index ccc270d3be..4a06c42c12 100644 --- a/docs/en/14-reference/03-connector/07-python.mdx +++ b/docs/en/08-client-libraries/07-python.mdx @@ -1,20 +1,20 @@ --- -title: TDengine Python Connector +title: TDengine Python Client Library sidebar_label: Python -description: This document describes taospy, the TDengine Python connector. +description: This document describes taospy, the TDengine Python client library. --- import Tabs from "@theme/Tabs"; import TabItem from "@theme/TabItem"; -`taospy` is the official Python connector for TDengine. taospy provides a rich API that makes it easy for Python applications to use TDengine. `taospy` wraps both the [native interface](../cpp) and [REST interface](../../rest-api) of TDengine, which correspond to the `taos` and `taosrest` modules of the `taospy` package, respectively. +`taospy` is the official Python client library for TDengine. taospy provides a rich API that makes it easy for Python applications to use TDengine. `taospy` wraps both the [native interface](../cpp) and [REST interface](../../reference/rest-api) of TDengine, which correspond to the `taos` and `taosrest` modules of the `taospy` package, respectively. In addition to wrapping the native and REST interfaces, `taospy` also provides a set of programming interfaces that conforms to the [Python Data Access Specification (PEP 249)](https://peps.python.org/pep-0249/). It is easy to integrate `taospy` with many third-party tools, such as [SQLAlchemy](https://www.sqlalchemy.org/) and [pandas](https://pandas.pydata.org/). `taos-ws-py` is an optional package to enable using WebSocket to connect TDengine. The direct connection to the server using the native interface provided by the client driver is referred to hereinafter as a "native connection"; the connection to the server using the REST or WebSocket interface provided by taosAdapter is referred to hereinafter as a "REST connection" or "WebSocket connection". -The source code for the Python connector is hosted on [GitHub](https://github.com/taosdata/taos-connector-python). +The source code for the Python client library is hosted on [GitHub](https://github.com/taosdata/taos-connector-python). ## Supported platforms - The [supported platforms](../#supported-platforms) for the native connection are the same as the ones supported by the TDengine client. @@ -29,13 +29,13 @@ The source code for the Python connector is hosted on [GitHub](https://github.co We recommend using the latest version of `taospy`, regardless of the version of TDengine. -|Python Connector Version|major changes| +|Python Client Library Version|major changes| |:-------------------:|:----:| |2.7.12|1. added support for `varbinary` type (STMT does not yet support)
2. improved query performance (thanks to contributor [hadrianl](https://github.com/taosdata/taos-connector-python/pull/209))| |2.7.9|support for getting assignment and seek function on subscription| |2.7.8|add `execute_many` method| -|Python Websocket Connector Version|major changes| +|Python Websocket Connection Version|major changes| |:----------------------------:|:-----:| |0.2.9|bugs fixes| |0.2.5|1. support for getting assignment and seek function on subscription
2. support schemaless
3. support STMT| @@ -43,9 +43,9 @@ We recommend using the latest version of `taospy`, regardless of the version of ## Handling Exceptions -There are 4 types of exception in python connector. +There are 4 types of exception in python client library. -- The exception of Python Connector itself. +- The exception of Python client library itself. - The exception of native library. - The exception of websocket - The exception of subscription. @@ -55,7 +55,7 @@ There are 4 types of exception in python connector. |:--------:|:---------:|:---------------:| |InterfaceError|the native library is too old that it cannot support the function|please check the TDengine client version| |ConnectionError|connection error|please check TDengine's status and the connection params| -|DatabaseError|database error|please upgrade Python connector to latest| +|DatabaseError|database error|please upgrade Python client library to latest| |OperationalError|operation error|| |ProgrammingError||| |StatementError|the exception of stmt|| @@ -65,7 +65,7 @@ There are 4 types of exception in python connector. It usually uses try-expect to handle exceptions in python. For exception handling, please refer to [Python Errors and Exceptions Documentation](https://docs.python.org/3/tutorial/errors.html). -All exceptions from the Python Connector are thrown directly. Applications should handle these exceptions. For example: +All exceptions from the Python client library are thrown directly. Applications should handle these exceptions. For example: ```python {{#include docs/examples/python/handle_exception.py}} @@ -101,14 +101,14 @@ If you use a native connection, you will also need to [Install Client Driver](.. #### Uninstalling an older version -If you have installed an older version of the Python Connector, please uninstall it beforehand. +If you have installed an older version of the Python client library, please uninstall it beforehand. ``` pip3 uninstall taos taospy ``` :::note -Earlier TDengine client software includes the Python connector. If the Python connector is installed from the client package's installation directory, the corresponding Python package name is `taos`. So the above uninstall command includes `taos`, and it doesn't matter if it doesn't exist. +Earlier TDengine client software includes the Python client library. If the Python client library is installed from the client package's installation directory, the corresponding Python package name is `taos`. So the above uninstall command includes `taos`, and it doesn't matter if it doesn't exist. ::: @@ -160,7 +160,7 @@ pip3 install taos-ws-py -For native connection, you need to verify that both the client driver and the Python connector itself are installed correctly. The client driver and Python connector have been installed properly if you can successfully import the `taos` module. In the Python Interactive Shell, you can type. +For native connection, you need to verify that both the client driver and the Python client library itself are installed correctly. The client driver and Python client library have been installed properly if you can successfully import the `taos` module. In the Python Interactive Shell, you can type. ```python import taos @@ -202,7 +202,7 @@ Requirement already satisfied: taospy in c:\users\username\appdata\local\program ### Connectivity testing -Before establishing a connection with the connector, we recommend testing the connectivity of the local TDengine CLI to the TDengine cluster. +Before establishing a connection with the client library, we recommend testing the connectivity of the local TDengine CLI to the TDengine cluster. @@ -444,7 +444,7 @@ The best practice for TaosCursor is to create a cursor at the beginning of a que ##### Use of the RestClient class -The `RestClient` class is a direct wrapper for the [REST API](../../rest-api). It contains only a `sql()` method for executing arbitrary SQL statements and returning the result. +The `RestClient` class is a direct wrapper for the [REST API](../../reference/rest-api). It contains only a `sql()` method for executing arbitrary SQL statements and returning the result. ```python title="Use of RestClient" {{#include docs/examples/python/rest_client_example.py}} @@ -501,7 +501,7 @@ The queried results can only be fetched once. For example, only one of `fetch_al -The `RestClient` class is a direct wrapper for the [REST API](../../rest-api). It contains only a `sql()` method for executing arbitrary SQL statements and returning the result. +The `RestClient` class is a direct wrapper for the [REST API](../../reference/rest-api). It contains only a `sql()` method for executing arbitrary SQL statements and returning the result. ```python {{#include docs/examples/python/rest_client_example.py}} @@ -561,7 +561,7 @@ The `TaosConnection` class and the `TaosResult` class already implement all the ##### Use of the RestClient class -The `RestClient` class is a direct wrapper for the [REST API](../../rest-api). It contains only a `sql()` method for executing arbitrary SQL statements and returning the result. +The `RestClient` class is a direct wrapper for the [REST API](../../reference/rest-api). It contains only a `sql()` method for executing arbitrary SQL statements and returning the result. ```python title="Use of RestClient" {{#include docs/examples/python/rest_client_with_req_id_example.py}} @@ -624,7 +624,7 @@ As the way to connect introduced above but add `req_id` argument. ### Writing data via parameter binding -The Python connector provides a parameter binding api for inserting data. Similar to most databases, TDengine currently only supports the question mark `?` to indicate the parameters to be bound. +The Python client library provides a parameter binding api for inserting data. Similar to most databases, TDengine currently only supports the question mark `?` to indicate the parameters to be bound. @@ -755,7 +755,7 @@ stmt.close() ### Schemaless Writing -Connector support schemaless insert. +Client library support schemaless insert. @@ -817,11 +817,11 @@ There is a optional parameter called `req_id` in `schemaless_insert` and `schema ### Data Subscription -Connector support data subscription. For more information about subscroption, please refer to [Data Subscription](../../../develop/tmq/). +Client library support data subscription. For more information about subscroption, please refer to [Data Subscription](../../develop/tmq/). #### Create a Topic -To create topic, please refer to [Data Subscription](../../../develop/tmq/#create-a-topic). +To create topic, please refer to [Data Subscription](../../develop/tmq/#create-a-topic). #### Create a Consumer @@ -829,7 +829,7 @@ To create topic, please refer to [Data Subscription](../../../develop/tmq/#creat -The consumer in the connector contains the subscription api. The syntax for creating a consumer is consumer = Consumer(configs). For more subscription api parameters, please refer to [Data Subscription](../../../develop/tmq/#create-a-consumer). +The consumer in the client library contains the subscription api. The syntax for creating a consumer is consumer = Consumer(configs). For more subscription api parameters, please refer to [Data Subscription](../../develop/tmq/#create-a-consumer). ```python from taos.tmq import Consumer @@ -840,9 +840,9 @@ consumer = Consumer({"group.id": "local", "td.connect.ip": "127.0.0.1"}) -In addition to native connections, the connector also supports subscriptions via websockets. +In addition to native connections, the client library also supports subscriptions via websockets. -The syntax for creating a consumer is "consumer = consumer = Consumer(conf=configs)". You need to specify that the `td.connect.websocket.scheme` parameter is set to "ws" in the configuration. For more subscription api parameters, please refer to [Data Subscription](../../../develop/tmq/#create-a-consumer). +The syntax for creating a consumer is "consumer = consumer = Consumer(conf=configs)". You need to specify that the `td.connect.websocket.scheme` parameter is set to "ws" in the configuration. For more subscription api parameters, please refer to [Data Subscription](../../develop/tmq/#create-a-consumer). ```python import taosws @@ -1025,7 +1025,7 @@ consumer.close() ### About nanoseconds -Due to the current imperfection of Python's nanosecond support (see link below), the current implementation returns integers at nanosecond precision instead of the `datetime` type produced by `ms` and `us`, which application developers will need to handle on their own. And it is recommended to use pandas' to_datetime(). The Python Connector may modify the interface in the future if Python officially supports nanoseconds in full. +Due to the current imperfection of Python's nanosecond support (see link below), the current implementation returns integers at nanosecond precision instead of the `datetime` type produced by `ms` and `us`, which application developers will need to handle on their own. And it is recommended to use pandas' to_datetime(). The Python client library may modify the interface in the future if Python officially supports nanoseconds in full. 1. https://stackoverflow.com/questions/10611328/parsing-datetime-strings-containing-nanoseconds 2. https://www.python.org/dev/peps/pep-0564/ diff --git a/docs/en/14-reference/03-connector/08-node.mdx b/docs/en/08-client-libraries/08-node.mdx similarity index 83% rename from docs/en/14-reference/03-connector/08-node.mdx rename to docs/en/08-client-libraries/08-node.mdx index bed06477f1..71f360c6d1 100644 --- a/docs/en/14-reference/03-connector/08-node.mdx +++ b/docs/en/08-client-libraries/08-node.mdx @@ -1,7 +1,7 @@ --- -title: TDengine Node.js Connector +title: TDengine Node.js Client Library sidebar_label: Node.js -description: This document describes the TDengine Node.js connector. +description: This document describes the TDengine Node.js client library. toc_max_heading_level: 4 --- @@ -9,22 +9,22 @@ import Tabs from "@theme/Tabs"; import TabItem from "@theme/TabItem"; import Preparition from "./_preparation.mdx"; -import NodeInsert from "../../07-develop/03-insert-data/_js_sql.mdx"; -import NodeInfluxLine from "../../07-develop/03-insert-data/_js_line.mdx"; -import NodeOpenTSDBTelnet from "../../07-develop/03-insert-data/_js_opts_telnet.mdx"; -import NodeOpenTSDBJson from "../../07-develop/03-insert-data/_js_opts_json.mdx"; -import NodeQuery from "../../07-develop/04-query-data/_js.mdx"; +import NodeInsert from "../07-develop/03-insert-data/_js_sql.mdx"; +import NodeInfluxLine from "../07-develop/03-insert-data/_js_line.mdx"; +import NodeOpenTSDBTelnet from "../07-develop/03-insert-data/_js_opts_telnet.mdx"; +import NodeOpenTSDBJson from "../07-develop/03-insert-data/_js_opts_json.mdx"; +import NodeQuery from "../07-develop/04-query-data/_js.mdx"; -`@tdengine/client` and `@tdengine/rest` are the official Node.js connectors. Node.js developers can develop applications to access TDengine instance data. Note: The connectors for TDengine 3.0 are different than those for TDengine 2.x. The new connectors do not support TDengine 2.x. +`@tdengine/client` and `@tdengine/rest` are the official Node.js client libraries. Node.js developers can develop applications to access TDengine instance data. Note: The client libraries for TDengine 3.0 are different than those for TDengine 2.x. The new client libraries do not support TDengine 2.x. -`@tdengine/client` is **native connection**, which connects to TDengine instances natively through the TDengine client driver (taosc), supporting data writing, querying, subscriptions, schemaless writing, and bind interface. `@tdengine/rest` is the **REST connection**, which connects to TDengine instances via the REST interface provided by taosAdapter. The REST connector can run on any platform, but performance is slightly degraded, and the interface implements a somewhat different set of functional features than the native interface. +`@tdengine/client` is **native connection**, which connects to TDengine instances natively through the TDengine client driver (taosc), supporting data writing, querying, subscriptions, schemaless writing, and bind interface. `@tdengine/rest` is the **REST connection**, which connects to TDengine instances via the REST interface provided by taosAdapter. The REST client library can run on any platform, but performance is slightly degraded, and the interface implements a somewhat different set of functional features than the native interface. -The source code for the Node.js connectors is located on [GitHub](https://github.com/taosdata/taos-connector-node/tree/3.0). +The source code for the Node.js client libraries is located on [GitHub](https://github.com/taosdata/taos-connector-node/tree/3.0). ## Supported platforms -The platforms supported by the native connector are the same as those supported by the TDengine client driver. -The REST connector supports all platforms that can run Node.js. +The platforms supported by the native client library are the same as those supported by the TDengine client driver. +The REST client library supports all platforms that can run Node.js. ## Version support @@ -34,7 +34,7 @@ Please refer to [version support list](../#version-support) - + 1. Connection Management 2. General Query @@ -44,7 +44,7 @@ Please refer to [version support list](../#version-support) 6. Schemaless - + 1. Connection Management 2. General Query @@ -58,7 +58,7 @@ Please refer to [version support list](../#version-support) ### Pre-installation preparation - Install the Node.js development environment -- If you are using the REST connector, skip this step. However, if you use the native connector, please install the TDengine client driver. Please refer to [Install Client Driver](../#Install-Client-Driver) for more details. We use [node-gyp](https://github.com/nodejs/node-gyp) to interact with TDengine instances and also need to install some dependencies mentioned below depending on the specific OS. +- If you are using the REST client library, skip this step. However, if you use the native client library, please install the TDengine client driver. Please refer to [Install Client Driver](../#Install-Client-Driver) for more details. We use [node-gyp](https://github.com/nodejs/node-gyp) to interact with TDengine instances and also need to install some dependencies mentioned below depending on the specific OS. @@ -103,14 +103,14 @@ If using ARM64 Node.js on Windows 10 ARM, you must add "Visual C++ compilers and ### Install via npm - + ```bash npm install @tdengine/client ``` - + ```bash npm install @tdengine/rest @@ -122,7 +122,7 @@ npm install @tdengine/rest ### Verify - + After installing the TDengine client, use the `nodejsChecker.js` program to verify that the current environment supports Node.js access to TDengine. @@ -141,7 +141,7 @@ node nodejsChecker.js host=localhost - After executing the above steps, the command-line will output the result of `nodejsChecker.js` connecting to the TDengine instance and performing a simple insert and query. - + After installing the TDengine client, use the `restChecker.js` program to verify that the current environment supports Node.js access to TDengine. @@ -164,7 +164,7 @@ node restChecker.js ## Establishing a connection -Please choose to use one of the connectors. +Please choose to use one of the client libraries. @@ -288,7 +288,7 @@ let cursor = conn.cursor(); | [schemless insert](https://github.com/taosdata/taos-connector-node/blob/3.0/nodejs/examples/schemaless.js) | Schemaless insert | | [TMQ](https://github.com/taosdata/taos-connector-node/blob/3.0/nodejs/examples/tmq.js) | Using data subscription | | [asyncQuery](https://github.com/taosdata/taos-connector-node/blob/3.0/nodejs/examples/asyncQueryExample.js) | Using asynchronous queries | -| [REST](https://github.com/taosdata/taos-connector-node/blob/3.0/typescript-rest/example/example.ts) | Using TypeScript with the REST connector | +| [REST](https://github.com/taosdata/taos-connector-node/blob/3.0/typescript-rest/example/example.ts) | Using TypeScript with the REST client library | ## Usage limitations @@ -316,7 +316,7 @@ let cursor = conn.cursor(); ## Important update records -### Native connectors +### Native client library | package name | version | TDengine version | Description | |------------------|---------|---------------------|------------------------------------------------------------------| @@ -324,7 +324,7 @@ let cursor = conn.cursor(); | td2.0-connector | 2.0.12 | 2.4.x; 2.5.x; 2.6.x | Fixed cursor.close() bug. | | td2.0-connector | 2.0.11 | 2.4.x; 2.5.x; 2.6.x | Supports parameter binding, JSON tags and schemaless interface | | td2.0-connector | 2.0.10 | 2.4.x; 2.5.x; 2.6.x | Supports connection management, standard queries, connection queries, system information, and data subscription | -### REST Connector +### REST client library | package name | version | TDengine version | Description | |----------------------|---------|---------------------|---------------------------------------------------------------------------| @@ -334,6 +334,3 @@ let cursor = conn.cursor(); | td2.0-rest-connector | 1.0.5 | 2.4.x; 2.5.x; 2.6.x | Support cloud token | | td2.0-rest-connector | 1.0.3 | 2.4.x; 2.5.x; 2.6.x | Supports connection management, standard queries, system information, error information, and continuous queries | -## API Reference - -[API Reference](https://docs.taosdata.com/api/td2.0-connector/) diff --git a/docs/en/08-client-libraries/09-csharp.mdx b/docs/en/08-client-libraries/09-csharp.mdx new file mode 100644 index 0000000000..71cbacb515 --- /dev/null +++ b/docs/en/08-client-libraries/09-csharp.mdx @@ -0,0 +1,1188 @@ +--- +title: TDengine C# Client Library +sidebar_label: C# +description: This document describes the TDengine C# client library. +toc_max_heading_level: 4 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +`TDengine.Connector` is the C# language connector provided by TDengine. C# developers can use it to develop C# application software that accesses TDengine cluster data. + +The `TDengine.Connector` connector supports establishing a connection with the TDengine running instance through the TDengine client driver (taosc), and provides functions such as data writing, query, data subscription, schemaless data writing, and parameter binding interface data writing. `TDengine.Connector` also supports WebSocket since v3.0.1, establishes WebSocket connection, and provides functions such as data writing, query, and parameter binding interface data writing. + +This article introduces how to install `TDengine.Connector` in a Linux or Windows environment, and connect to the TDengine cluster through `TDengine.Connector` to perform basic operations such as data writing and querying. + +:::warning +* `TDengine.Connector` version 3.1.0 has been completely refactored and is no longer compatible with 3.0.2 and previous versions. For 3.0.2 documents, please refer to [nuget](https://www.nuget.org/packages/TDengine.Connector/3.0.2) +* `TDengine.Connector` 3.x is not compatible with TDengine 2.x. If you need to use the C# connector in an environment running TDengine 2.x version, please use the 1.x version of TDengine.Connector. +::: + +The source code of `TDengine.Connector` is hosted on [GitHub](https://github.com/taosdata/taos-connector-dotnet/tree/3.0). + +## Supported platforms + +The supported platforms are the same as those supported by the TDengine client driver. + +:::warning +TDengine no longer supports 32-bit Windows platforms. +::: + +## Version support + +| **Connector version** | **TDengine version** | +|-----------------------|----------------------| +| 3.1.0 | 3.2.1.0/3.1.1.18 | + +## Handling exceptions + +`TDengine.Connector` will throw an exception and the application needs to handle the exception. The taosc exception type `TDengineError` contains error code and error information, and the application can handle it based on the error code and error information. + +## TDengine DataType vs. C# DataType + +| TDengine DataType | C# Type | +|-------------------|-------------------------| +| TIMESTAMP | DateTime | +| TINYINT | sbyte | +| SMALLINT | short | +| INT | int | +| BIGINT | long | +| TINYINT UNSIGNED | byte | +| SMALLINT UNSIGNED | ushort | +| INT UNSIGNED | uint | +| BIGINT UNSIGNED | ulong | +| FLOAT | float | +| DOUBLE | double | +| BOOL | bool | +| BINARY | byte[] | +| NCHAR | string (utf-8 encoding) | +| JSON | byte[] | + +**Note**: JSON type is only supported in tag. + +## Installation Steps + +### Pre-installation preparation + +* Install [.NET SDK](https://dotnet.microsoft.com/download) +* [Nuget Client](https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools) (optional installation) +* Install the TDengine client driver. For specific steps, please refer to [Installing the client driver](../#install-client-driver) + +### Install the connectors + +Nuget package `TDengine.Connector` can be added to the current project through dotnet CLI under the path of the current .NET project. + +```bash +dotnet add package TDengine.Connector +``` + +You can also modify the `.csproj` file of the current project and add the following ItemGroup. + +``` XML + + + +``` + +## Establishing a connection + + + + +``` csharp +var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); +using (var client = DbDriver.Open(builder)) +{ + Console.WriteLine("connected") +} +``` + + + + +```csharp +var builder = new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); +using (var client = DbDriver.Open(builder)) +{ + Console.WriteLine("connected") +} +``` + + + + +The parameters supported by `ConnectionStringBuilder` are as follows: +* protocol: connection protocol, optional value is Native or WebSocket, default is Native +* host: the address of the running instance of TDengine or taosadapter, +* port: The port of the running instance of TDengine or taosadapter. + * When using WebSocket without SSL, the default is 6041. + * When using WebSocket with SSL, the default is 443. +* useSSL: Whether to use SSL, the default is false, only valid when the protocol is WebSocket +* token: The token used to connect to TDengine Cloud, only valid when the protocol is WebSocket +* username: username to connect to TDengine +* password: password to connect to TDengine +* db: database connected to TDengine +* timezone: The time zone for parsing time results, the default is `TimeZoneInfo.Local`, use the `TimeZoneInfo.FindSystemTimeZoneById` method to parse the string into a `TimeZoneInfo` object. +* connTimeout: WebSocket connection timeout, only valid when the protocol is WebSocket, the default is 1 minute, use the `TimeSpan.Parse` method to parse the string into a `TimeSpan` object. +* readTimeout: WebSocket read timeout, only valid when the protocol is WebSocket, the default is 5 minutes, use the `TimeSpan.Parse` method to parse the string into a `TimeSpan` object. +* writeTimeout: WebSocket write timeout, only valid when the protocol is WebSocket, the default is 10 seconds, use the `TimeSpan.Parse` method to parse the string into a `TimeSpan` object. + +### Specify the URL and Properties to get the connection + +The C# connector does not support this feature + +### Priority of configuration parameters + +The C# connector does not support this feature + +## Usage examples + +### Create database and tables + + + + +```csharp +using System; +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace NativeQuery +{ + internal class Query + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec("create database power"); + client.Exec("CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + } +} +``` + + + + +```csharp +using System; +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace WSQuery +{ + internal class Query + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec("create database power"); + client.Exec("CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + } +} +``` + + + + +### Insert data + + + + +```csharp +using System; +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace NativeQuery +{ + internal class Query + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + string insertQuery = + "INSERT INTO " + + "power.d1001 USING power.meters TAGS(2,'California.SanFrancisco') " + + "VALUES " + + "('2023-10-03 14:38:05.000', 10.30000, 219, 0.31000) " + + "('2023-10-03 14:38:15.000', 12.60000, 218, 0.33000) " + + "('2023-10-03 14:38:16.800', 12.30000, 221, 0.31000) " + + "power.d1002 USING power.meters TAGS(3, 'California.SanFrancisco') " + + "VALUES " + + "('2023-10-03 14:38:16.650', 10.30000, 218, 0.25000) " + + "power.d1003 USING power.meters TAGS(2,'California.LosAngeles') " + + "VALUES " + + "('2023-10-03 14:38:05.500', 11.80000, 221, 0.28000) " + + "('2023-10-03 14:38:16.600', 13.40000, 223, 0.29000) " + + "power.d1004 USING power.meters TAGS(3,'California.LosAngeles') " + + "VALUES " + + "('2023-10-03 14:38:05.000', 10.80000, 223, 0.29000) " + + "('2023-10-03 14:38:06.500', 11.50000, 221, 0.35000)"; + client.Exec(insertQuery); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + } +} +``` + + + + +```csharp +using System; +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace WSQuery +{ + internal class Query + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + string insertQuery = + "INSERT INTO " + + "power.d1001 USING power.meters TAGS(2,'California.SanFrancisco') " + + "VALUES " + + "('2023-10-03 14:38:05.000', 10.30000, 219, 0.31000) " + + "('2023-10-03 14:38:15.000', 12.60000, 218, 0.33000) " + + "('2023-10-03 14:38:16.800', 12.30000, 221, 0.31000) " + + "power.d1002 USING power.meters TAGS(3, 'California.SanFrancisco') " + + "VALUES " + + "('2023-10-03 14:38:16.650', 10.30000, 218, 0.25000) " + + "power.d1003 USING power.meters TAGS(2,'California.LosAngeles') " + + "VALUES " + + "('2023-10-03 14:38:05.500', 11.80000, 221, 0.28000) " + + "('2023-10-03 14:38:16.600', 13.40000, 223, 0.29000) " + + "power.d1004 USING power.meters TAGS(3,'California.LosAngeles') " + + "VALUES " + + "('2023-10-03 14:38:05.000', 10.80000, 223, 0.29000) " + + "('2023-10-03 14:38:06.500', 11.50000, 221, 0.35000)"; + client.Exec(insertQuery); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + } +} +``` + + + + +### Querying data + + + + +```csharp +using System; +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace NativeQuery +{ + internal class Query + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec("use power"); + string query = "SELECT * FROM meters"; + using (var rows = client.Query(query)) + { + while (rows.Read()) + { + Console.WriteLine($"{((DateTime)rows.GetValue(0)):yyyy-MM-dd HH:mm:ss.fff}, {rows.GetValue(1)}, {rows.GetValue(2)}, {rows.GetValue(3)}, {rows.GetValue(4)}, {Encoding.UTF8.GetString((byte[])rows.GetValue(5))}"); + } + } + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + } +} +``` + + + + +```csharp +using System; +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace WSQuery +{ + internal class Query + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec("use power"); + string query = "SELECT * FROM meters"; + using (var rows = client.Query(query)) + { + while (rows.Read()) + { + Console.WriteLine($"{((DateTime)rows.GetValue(0)):yyyy-MM-dd HH:mm:ss.fff}, {rows.GetValue(1)}, {rows.GetValue(2)}, {rows.GetValue(3)}, {rows.GetValue(4)}, {Encoding.UTF8.GetString((byte[])rows.GetValue(5))}"); + } + } + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + } +} +``` + + + + +### execute SQL with reqId + + + + +```csharp +using System; +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace NativeQueryWithReqID +{ + internal abstract class QueryWithReqID + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec($"create database if not exists test_db",ReqId.GetReqId()); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + } +} +``` + + + + +```csharp +using System; +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace WSQueryWithReqID +{ + internal abstract class QueryWithReqID + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec($"create database if not exists test_db",ReqId.GetReqId()); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + } +} +``` + + + + +### Writing data via parameter binding + + + + +```csharp +using System; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace NativeStmt +{ + internal abstract class NativeStmt + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec("create database power"); + client.Exec( + "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"); + using (var stmt = client.StmtInit()) + { + stmt.Prepare( + "Insert into power.d1001 using power.meters tags(2,'California.SanFrancisco') values(?,?,?,?)"); + var ts = new DateTime(2023, 10, 03, 14, 38, 05, 000); + stmt.BindRow(new object[] { ts, (float)10.30000, (int)219, (float)0.31000 }); + stmt.AddBatch(); + stmt.Exec(); + var affected = stmt.Affected(); + Console.WriteLine($"affected rows: {affected}"); + } + } + catch (Exception e) + { + Console.WriteLine(e); + throw; + } + } + } + } +} +``` + + + + +```csharp +using System; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace WSStmt +{ + internal abstract class WSStmt + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec("create database power"); + client.Exec( + "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"); + using (var stmt = client.StmtInit()) + { + stmt.Prepare( + "Insert into power.d1001 using power.meters tags(2,'California.SanFrancisco') values(?,?,?,?)"); + var ts = new DateTime(2023, 10, 03, 14, 38, 05, 000); + stmt.BindRow(new object[] { ts, (float)10.30000, (int)219, (float)0.31000 }); + stmt.AddBatch(); + stmt.Exec(); + var affected = stmt.Affected(); + Console.WriteLine($"affected rows: {affected}"); + } + } + catch (Exception e) + { + Console.WriteLine(e); + throw; + } + } + } + } +} +``` + + + + +Note: When using BindRow, you need to pay attention to the one-to-one correspondence between the original C# column type and the TDengine column type. For the specific correspondence, please refer to [TDengine DataType and C# DataType](#tdengine-datatype-vs-c-datatype). + +### Schemaless Writing + + + + +```csharp +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace NativeSchemaless +{ + internal class Program + { + public static void Main(string[] args) + { + var builder = + new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + client.Exec("create database sml"); + client.Exec("use sml"); + var influxDBData = + "st,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000"; + client.SchemalessInsert(new string[] { influxDBData }, + TDengineSchemalessProtocol.TSDB_SML_LINE_PROTOCOL, + TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_NANO_SECONDS, 0, ReqId.GetReqId()); + var telnetData = "stb0_0 1626006833 4 host=host0 interface=eth0"; + client.SchemalessInsert(new string[] { telnetData }, + TDengineSchemalessProtocol.TSDB_SML_TELNET_PROTOCOL, + TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_MILLI_SECONDS, 0, ReqId.GetReqId()); + var jsonData = + "{\"metric\": \"meter_current\",\"timestamp\": 1626846400,\"value\": 10.3, \"tags\": {\"groupid\": 2, \"location\": \"California.SanFrancisco\", \"id\": \"d1001\"}}"; + client.SchemalessInsert(new string[] { jsonData }, TDengineSchemalessProtocol.TSDB_SML_JSON_PROTOCOL, + TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_MILLI_SECONDS, 0, ReqId.GetReqId()); + } + } + } +} +``` + + + + +```csharp +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace WSSchemaless +{ + internal class Program + { + public static void Main(string[] args) + { + var builder = + new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + client.Exec("create database sml"); + client.Exec("use sml"); + var influxDBData = + "st,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000"; + client.SchemalessInsert(new string[] { influxDBData }, + TDengineSchemalessProtocol.TSDB_SML_LINE_PROTOCOL, + TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_NANO_SECONDS, 0, ReqId.GetReqId()); + var telnetData = "stb0_0 1626006833 4 host=host0 interface=eth0"; + client.SchemalessInsert(new string[] { telnetData }, + TDengineSchemalessProtocol.TSDB_SML_TELNET_PROTOCOL, + TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_MILLI_SECONDS, 0, ReqId.GetReqId()); + var jsonData = + "{\"metric\": \"meter_current\",\"timestamp\": 1626846400,\"value\": 10.3, \"tags\": {\"groupid\": 2, \"location\": \"California.SanFrancisco\", \"id\": \"d1001\"}}"; + client.SchemalessInsert(new string[] { jsonData }, TDengineSchemalessProtocol.TSDB_SML_JSON_PROTOCOL, + TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_MILLI_SECONDS, 0, ReqId.GetReqId()); + } + } + } +} +``` + + + + +### Schemaless with reqId + +```csharp +public void SchemalessInsert(string[] lines, TDengineSchemalessProtocol protocol, + TDengineSchemalessPrecision precision, + int ttl, long reqId) +``` + +### Data Subscription + +#### Create a Topic + + + + +```csharp +using System; +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace NativeSubscription +{ + internal class Program + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec("create database power"); + client.Exec("CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"); + client.Exec("CREATE TOPIC topic_meters as SELECT * from power.meters"); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + } +} +``` + + + + +```csharp +using System; +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace WSSubscription +{ + internal class Program + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec("create database power"); + client.Exec("CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"); + client.Exec("CREATE TOPIC topic_meters as SELECT * from power.meters"); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + } +} +``` + + + + +#### Create a Consumer + + + + +```csharp +var cfg = new Dictionary() +{ + { "group.id", "group1" }, + { "auto.offset.reset", "latest" }, + { "td.connect.ip", "127.0.0.1" }, + { "td.connect.user", "root" }, + { "td.connect.pass", "taosdata" }, + { "td.connect.port", "6030" }, + { "client.id", "tmq_example" }, + { "enable.auto.commit", "true" }, + { "msg.with.table.name", "false" }, +}; +var consumer = new ConsumerBuilder>(cfg).Build(); +``` + + + + +```csharp +var cfg = new Dictionary() +{ + { "td.connect.type", "WebSocket" }, + { "group.id", "group1" }, + { "auto.offset.reset", "latest" }, + { "td.connect.ip", "localhost" }, + { "td.connect.port","6041"}, + { "useSSL", "false" }, + { "td.connect.user", "root" }, + { "td.connect.pass", "taosdata" }, + { "client.id", "tmq_example" }, + { "enable.auto.commit", "true" }, + { "msg.with.table.name", "false" }, +}; +var consumer = new ConsumerBuilder>(cfg).Build(); +``` + + + + +The configuration parameters supported by consumer are as follows: +* td.connect.type: connection type, optional value is Native or WebSocket, default is Native +* td.connect.ip: The address of the TDengine running instance or taosadapter +* td.connect.port: The port of the running instance of TDengine or taosadapter. + * When using WebSocket without SSL, the default is 6041. + * When using WebSocket with SSL, the default is 443. +* useSSL: Whether to use SSL, the default is false, only valid when the protocol is WebSocket +* token: The token used to connect to TDengine Cloud, only valid when the protocol is WebSocket +* td.connect.user: username to connect to TDengine +* td.connect.pass: Password for connecting to TDengine +* group.id: consumer group ID +* client.id: consumer ID +* enable.auto.commit: Whether to automatically commit offset, the default is true +* auto.commit.interval.ms: The interval for automatically submitting offsets, the default is 5000 milliseconds +* auto.offset.reset: When offset does not exist, where to start consumption, the optional value is earliest or latest, the default is latest +* msg.with.table.name: Whether the message contains the table name + +Supports subscribing to the result set `Dictionary` where the key is the column name and the value is the column value. + +If you use object to receive column values, you need to pay attention to: +* There needs to be a one-to-one correspondence between the original C# column type and the TDengine column type. For specific correspondence, please refer to [TDengine DataType and C# DataType] (#tdengine-datatype-and-c-datatype). +* The column name is consistent with the class attribute name and can be get and set. +* Explicitly set the value parser `ConsumerBuilder.SetValueDeserializer(new ReferenceDeserializer());` + +An example is as follows + +Result class + +```csharp + class Result + { + public DateTime ts { get; set; } + public float current { get; set; } + public int voltage { get; set; } + public float phase { get; set; } + } +``` + +Set up parser + +```csharp +var tmqBuilder = new ConsumerBuilder(cfg); +tmqBuilder.SetValueDeserializer(new ReferenceDeserializer()); +var consumer = tmqBuilder.Build(); +``` + +You can also implement a custom deserializer, implement the `IDeserializer` interface and pass it in through the `ConsumerBuilder.SetValueDeserializer` method. + +```csharp + public interface IDeserializer + { + T Deserialize(ITMQRows data, bool isNull, SerializationContext context); + } +``` + +#### Subscribe to consume data + +```csharp +consumer.Subscribe(new List() { "topic_meters" }); +while (true) +{ + using (var cr = consumer.Consume(500)) + { + if (cr == null) continue; + foreach (var message in cr.Message) + { + Console.WriteLine( + $"message {{{((DateTime)message.Value["ts"]).ToString("yyyy-MM-dd HH:mm:ss.fff")}, " + + $"{message.Value["current"]}, {message.Value["voltage"]}, {message.Value["phase"]}}}"); + } + } +} +``` + +#### Assignment subscription Offset + +```csharp +consumer.Assignment.ForEach(a => +{ + Console.WriteLine($"{a}, seek to 0"); + consumer.Seek(new TopicPartitionOffset(a.Topic, a.Partition, 0)); + Thread.Sleep(TimeSpan.FromSeconds(1)); +}); +``` + +#### Commit offset + +```csharp +public void Commit(ConsumeResult consumerResult) +public List Commit() +public void Commit(IEnumerable offsets) +``` + +#### Close subscriptions + +```csharp +consumer.Unsubscribe(); +consumer.Close(); +``` + +#### Full Sample Code + + + + +```csharp +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using TDengine.Driver; +using TDengine.Driver.Client; +using TDengine.TMQ; + +namespace NativeSubscription +{ + internal class Program + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec("CREATE DATABASE power"); + client.Exec("USE power"); + client.Exec( + "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"); + client.Exec("CREATE TOPIC topic_meters as SELECT * from power.meters"); + var cfg = new Dictionary() + { + { "group.id", "group1" }, + { "auto.offset.reset", "latest" }, + { "td.connect.ip", "127.0.0.1" }, + { "td.connect.user", "root" }, + { "td.connect.pass", "taosdata" }, + { "td.connect.port", "6030" }, + { "client.id", "tmq_example" }, + { "enable.auto.commit", "true" }, + { "msg.with.table.name", "false" }, + }; + var consumer = new ConsumerBuilder>(cfg).Build(); + consumer.Subscribe(new List() { "topic_meters" }); + Task.Run(InsertData); + while (true) + { + using (var cr = consumer.Consume(500)) + { + if (cr == null) continue; + foreach (var message in cr.Message) + { + Console.WriteLine( + $"message {{{((DateTime)message.Value["ts"]).ToString("yyyy-MM-dd HH:mm:ss.fff")}, " + + $"{message.Value["current"]}, {message.Value["voltage"]}, {message.Value["phase"]}}}"); + } + consumer.Commit(); + } + } + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + + static void InsertData() + { + var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + while (true) + { + client.Exec("INSERT into power.d1001 using power.meters tags(2,'California.SanFrancisco') values(now,11.5,219,0.30)"); + Task.Delay(1000).Wait(); + } + } + } + } +} +``` + + + + +```csharp +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using TDengine.Driver; +using TDengine.Driver.Client; +using TDengine.TMQ; + +namespace WSSubscription +{ + internal class Program + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec("CREATE DATABASE power"); + client.Exec("USE power"); + client.Exec( + "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"); + client.Exec("CREATE TOPIC topic_meters as SELECT * from power.meters"); + var cfg = new Dictionary() + { + { "td.connect.type", "WebSocket" }, + { "group.id", "group1" }, + { "auto.offset.reset", "latest" }, + { "td.connect.ip", "localhost" }, + { "td.connect.port","6041"}, + { "useSSL", "false" }, + { "td.connect.user", "root" }, + { "td.connect.pass", "taosdata" }, + { "client.id", "tmq_example" }, + { "enable.auto.commit", "true" }, + { "msg.with.table.name", "false" }, + }; + var consumer = new ConsumerBuilder>(cfg).Build(); + consumer.Subscribe(new List() { "topic_meters" }); + Task.Run(InsertData); + while (true) + { + using (var cr = consumer.Consume(500)) + { + if (cr == null) continue; + foreach (var message in cr.Message) + { + Console.WriteLine( + $"message {{{((DateTime)message.Value["ts"]).ToString("yyyy-MM-dd HH:mm:ss.fff")}, " + + $"{message.Value["current"]}, {message.Value["voltage"]}, {message.Value["phase"]}}}"); + } + consumer.Commit(); + } + } + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + + static void InsertData() + { + var builder = new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + while (true) + { + client.Exec("INSERT into power.d1001 using power.meters tags(2,'California.SanFrancisco') values(now,11.5,219,0.30)"); + Task.Delay(1000).Wait(); + } + } + } + } +} +``` + + + + +### ADO.NET + +The C# connector supports the ADO.NET interface, and you can connect to the TDengine running instance through the ADO.NET interface to perform operations such as data writing and querying. + + + + +```csharp +using System; +using TDengine.Data.Client; + +namespace NativeADO +{ + internal class Program + { + public static void Main(string[] args) + { + const string connectionString = "host=localhost;port=6030;username=root;password=taosdata"; + using (var connection = new TDengineConnection(connectionString)) + { + try + { + connection.Open(); + using (var command = new TDengineCommand(connection)) + { + command.CommandText = "create database power"; + command.ExecuteNonQuery(); + connection.ChangeDatabase("power"); + command.CommandText = + "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"; + command.ExecuteNonQuery(); + command.CommandText = "INSERT INTO " + + "power.d1001 USING power.meters TAGS(2,'California.SanFrancisco') " + + "VALUES " + + "(?,?,?,?)"; + var parameters = command.Parameters; + parameters.Add(new TDengineParameter("@0", new DateTime(2023,10,03,14,38,05,000))); + parameters.Add(new TDengineParameter("@1", (float)10.30000)); + parameters.Add(new TDengineParameter("@2", (int)219)); + parameters.Add(new TDengineParameter("@3", (float)0.31000)); + command.ExecuteNonQuery(); + command.Parameters.Clear(); + command.CommandText = "SELECT * FROM meters"; + using (var reader = command.ExecuteReader()) + { + while (reader.Read()) + { + Console.WriteLine( + $"{((DateTime) reader.GetValue(0)):yyyy-MM-dd HH:mm:ss.fff}, {reader.GetValue(1)}, {reader.GetValue(2)}, {reader.GetValue(3)}, {reader.GetValue(4)}, {System.Text.Encoding.UTF8.GetString((byte[]) reader.GetValue(5))}"); + } + } + } + } + catch (Exception e) + { + Console.WriteLine(e); + throw; + } + } + } + } +} +``` + + + + +```csharp +using System; +using TDengine.Data.Client; + +namespace WSADO +{ + internal class Program + { + public static void Main(string[] args) + { + const string connectionString = "protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"; + using (var connection = new TDengineConnection(connectionString)) + { + try + { + connection.Open(); + using (var command = new TDengineCommand(connection)) + { + command.CommandText = "create database power"; + command.ExecuteNonQuery(); + connection.ChangeDatabase("power"); + command.CommandText = + "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"; + command.ExecuteNonQuery(); + command.CommandText = "INSERT INTO " + + "power.d1001 USING power.meters TAGS(2,'California.SanFrancisco') " + + "VALUES " + + "(?,?,?,?)"; + var parameters = command.Parameters; + parameters.Add(new TDengineParameter("@0", new DateTime(2023,10,03,14,38,05,000))); + parameters.Add(new TDengineParameter("@1", (float)10.30000)); + parameters.Add(new TDengineParameter("@2", (int)219)); + parameters.Add(new TDengineParameter("@3", (float)0.31000)); + command.ExecuteNonQuery(); + command.Parameters.Clear(); + command.CommandText = "SELECT * FROM meters"; + using (var reader = command.ExecuteReader()) + { + while (reader.Read()) + { + Console.WriteLine( + $"{((DateTime) reader.GetValue(0)):yyyy-MM-dd HH:mm:ss.fff}, {reader.GetValue(1)}, {reader.GetValue(2)}, {reader.GetValue(3)}, {reader.GetValue(4)}, {System.Text.Encoding.UTF8.GetString((byte[]) reader.GetValue(5))}"); + } + } + } + } + catch (Exception e) + { + Console.WriteLine(e); + throw; + } + } + } + } +} +``` + + + + +* The connection parameters are consistent with those in [Establishing a connection](#establishing-a-connection). +* The name of TDengineParameter needs to start with @, such as @0, @1, @2, etc. The value needs to have a one-to-one correspondence between the C# column type and the TDengine column type. For the specific correspondence, please refer to [TDengine DataType and C# DataType](#tdengine-datatype-vs-c-datatype). + +### More sample programs + +[sample program](https://github.com/taosdata/taos-connector-dotnet/tree/3.0/examples) \ No newline at end of file diff --git a/docs/en/08-client-libraries/50-odbc.mdx b/docs/en/08-client-libraries/50-odbc.mdx new file mode 100644 index 0000000000..08b2c031c6 --- /dev/null +++ b/docs/en/08-client-libraries/50-odbc.mdx @@ -0,0 +1,75 @@ +--- +sidebar_label: ODBC +title: TDengine ODBC +--- + + +## Introduction + +TDengine ODBC driver is a driver specifically designed for TDengine based on the ODBC standard. It can be used by ODBC based applications on Windows to access a local or remote TDengine cluster or TDengine cloud service, like [PowerBI](https://powerbi.microsoft.com). + +TDengine ODBC provides two kinds of connections, native connection and WebSocket connection. You can choose to use either one for your convenience, WebSocket is recommded choice and you must use WebSocket if you are trying to access TDengine cloud service. + +Note: TDengine ODBC driver can only be run on 64-bit system, and can only be invoked by 64-bit applications. + + +## Install + +1. TDengine ODBC driver supports only Windows platform. To run on Windows, VisualStudio C Runtime library is required. If VisualStudio C Runtime Library is missing on your platform, you can download and install it from [VC Runtime Library](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170). + +2. Install TDengine client package for Windows, the version should be above 3.2.1.0, the client package includes both TDengine ODBC driver and some other necessary libraries that will be used in either native connection or WebSocket connection. + +## Configure Data Source + +### Connection Types + +TDengine ODBC driver supports two kinds of connections to TDengine cluster, native connection and WebSocket connection, here is the major differences between them. + +1. Only WebSocket can connect to TDengine cloud service. + +2. Websocket connection is more compatible with different TDengine server versions, normally you don't need to uupgrade client package with the server side. + +3. Native connection normally has better performance, but you need to keep the version aligned with the server side. + +4. For most users, it's recommended to use **WebSocket** connection, which has much better compatibility and almost same performance as native connection. + +### WebSocket Connection + +1. Click the "Start" Menu, and Search for "ODBC", and choose "ODBC Data Source (64-bit)" (Note: Don't choose 32-bit) + +2. Select "User DSN" tab, and click "Add" to enter the page for "Create Data Source" + +3. Choose the data source to be added, here we choose "TDengine" + +4. Click "Finish", and enter the configuration page for "TDengine ODBC Data Source", fill in required fields + + ![ODBC websocket connection config](./assets/odbc-ws-config-en.webp) + + 4.1 [DSN]: Data Source Name, required field, to name the new ODBC data source + + 4.2 [Connection Type]: required field, we choose "WebSocket" + + 4.3 [URL]: required field, the URL for the ODBC data source, for example, `http://localhost:6041` is the URL for a local TDengine cluster, `https://gw.cloud.taosdata.com?token=your_token` is the URL for a TDengine cloud service. + + 4.4 [Database]: optional field, the default database to access + + 4.5 [User]: optional field, only used for connection testing in step 5; If it's left as blank, "root" user will be used by default. + + 4.6 [Password]: optional field, only used for connection testing in step 5; + +5. Click "Test Connecting" to test whether the data source can be connectted; if successful, it will prompt "connecting success" + +6. Click "OK" to sae the configuration and exit. + +7. You can also select an already configured data source name in step 2 to change existing configuration. + +### Native Connection + +Please be noted that native connection can't be used to access a TDengine client service. + +The steps are exactly same as "WebSocket" connection, except for you choose "Native" in step 4.2. + + +## PowerBI + +As an example, you can use PowerBI, which inovkes TDengine ODBC driver, to access TDengine, please refer to[Power BI](../../third-party/powerbi) for more details. diff --git a/docs/en/14-reference/03-connector/60-r-lang.mdx b/docs/en/08-client-libraries/60-r-lang.mdx similarity index 97% rename from docs/en/14-reference/03-connector/60-r-lang.mdx rename to docs/en/08-client-libraries/60-r-lang.mdx index f1cbb89f7b..881644c7f4 100644 --- a/docs/en/14-reference/03-connector/60-r-lang.mdx +++ b/docs/en/08-client-libraries/60-r-lang.mdx @@ -1,13 +1,13 @@ --- toc_max_heading_level: 4 sidebar_label: R -title: R Language Connector +title: R Language Client Library --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -import Rdemo from "../../07-develop/01-connect/_connect_r.mdx" +import Rdemo from "../07-develop/01-connect/_connect_r.mdx" By using the RJDBC library in R, you can enable R programs to access TDengine data. Here are the installation process, configuration steps, and an example code in R. diff --git a/docs/en/14-reference/03-connector/80-php.mdx b/docs/en/08-client-libraries/80-php.mdx similarity index 89% rename from docs/en/14-reference/03-connector/80-php.mdx rename to docs/en/08-client-libraries/80-php.mdx index bff9e8e5d5..ccaa2f8d55 100644 --- a/docs/en/14-reference/03-connector/80-php.mdx +++ b/docs/en/08-client-libraries/80-php.mdx @@ -1,12 +1,12 @@ --- -title: PHP Connector +title: PHP Client Library sidebar_label: PHP -description: This document describes the TDengine PHP connector. +description: This document describes the TDengine PHP client library. --- -`php-tdengine` is the TDengine PHP connector provided by TDengine community. In particular, it supports Swoole coroutine. +`php-tdengine` is the TDengine PHP client library provided by TDengine community. In particular, it supports Swoole coroutine. -PHP Connector relies on TDengine client driver. +PHP client library relies on TDengine client driver. Project Repository: @@ -81,7 +81,7 @@ Option Two: Use CLI `php -dextension=tdengine test.php`. ## Sample Programs -In this section a few sample programs which use TDengine PHP connector to access TDengine cluster are demonstrated. +In this section a few sample programs which use TDengine PHP client library to access TDengine cluster are demonstrated. > Any error would throw exception: `TDengine\Exception\TDengineException` diff --git a/docs/en/08-client-libraries/_category_.yml b/docs/en/08-client-libraries/_category_.yml new file mode 100644 index 0000000000..a70a33caa6 --- /dev/null +++ b/docs/en/08-client-libraries/_category_.yml @@ -0,0 +1 @@ +label: "Client Libraries" diff --git a/docs/en/14-reference/03-connector/_linux_install.mdx b/docs/en/08-client-libraries/_linux_install.mdx similarity index 100% rename from docs/en/14-reference/03-connector/_linux_install.mdx rename to docs/en/08-client-libraries/_linux_install.mdx diff --git a/docs/en/14-reference/03-connector/_macos_install.mdx b/docs/en/08-client-libraries/_macos_install.mdx similarity index 100% rename from docs/en/14-reference/03-connector/_macos_install.mdx rename to docs/en/08-client-libraries/_macos_install.mdx diff --git a/docs/en/14-reference/03-connector/_preparation.mdx b/docs/en/08-client-libraries/_preparation.mdx similarity index 85% rename from docs/en/14-reference/03-connector/_preparation.mdx rename to docs/en/08-client-libraries/_preparation.mdx index 99887ac36b..ba282b0bfb 100644 --- a/docs/en/14-reference/03-connector/_preparation.mdx +++ b/docs/en/08-client-libraries/_preparation.mdx @@ -2,7 +2,7 @@ :::info -Since the TDengine client driver is written in C, using the native connection requires loading the client driver shared library file, which is usually included in the TDengine installer. You can install either standard TDengine server installation package or [TDengine client installation package](../../get-started/). For Windows development, you need to install the corresponding Windows client, please refer to [Install TDengine](../../get-started/package). +Since the TDengine client driver is written in C, using the native connection requires loading the client driver shared library file, which is usually included in the TDengine installer. You can install either standard TDengine server installation package or [TDengine client installation package](../get-started/). For Windows development, you need to install the corresponding Windows client, please refer to [Install TDengine](../../get-started/package). - libtaos.so: After successful installation of TDengine on a Linux system, the dependent Linux version of the client driver `libtaos.so` file will be automatically linked to `/usr/lib/libtaos.so`, which is included in the Linux scannable path and does not need to be specified separately. - taos.dll: After installing the client on Windows, the dependent Windows version of the client driver taos.dll file will be automatically copied to the system default search path C:/Windows/System32, again without the need to specify it separately. diff --git a/docs/en/14-reference/03-connector/_verify_linux.mdx b/docs/en/08-client-libraries/_verify_linux.mdx similarity index 100% rename from docs/en/14-reference/03-connector/_verify_linux.mdx rename to docs/en/08-client-libraries/_verify_linux.mdx diff --git a/docs/en/14-reference/03-connector/_verify_macos.mdx b/docs/en/08-client-libraries/_verify_macos.mdx similarity index 100% rename from docs/en/14-reference/03-connector/_verify_macos.mdx rename to docs/en/08-client-libraries/_verify_macos.mdx diff --git a/docs/en/14-reference/03-connector/_verify_windows.mdx b/docs/en/08-client-libraries/_verify_windows.mdx similarity index 100% rename from docs/en/14-reference/03-connector/_verify_windows.mdx rename to docs/en/08-client-libraries/_verify_windows.mdx diff --git a/docs/en/14-reference/03-connector/_windows_install.mdx b/docs/en/08-client-libraries/_windows_install.mdx similarity index 100% rename from docs/en/14-reference/03-connector/_windows_install.mdx rename to docs/en/08-client-libraries/_windows_install.mdx diff --git a/docs/en/08-client-libraries/assets/odbc-ws-config-en.webp b/docs/en/08-client-libraries/assets/odbc-ws-config-en.webp new file mode 100644 index 0000000000..aaca2e99b4 Binary files /dev/null and b/docs/en/08-client-libraries/assets/odbc-ws-config-en.webp differ diff --git a/docs/en/14-reference/03-connector/connector.webp b/docs/en/08-client-libraries/connector.webp similarity index 100% rename from docs/en/14-reference/03-connector/connector.webp rename to docs/en/08-client-libraries/connector.webp diff --git a/docs/en/14-reference/03-connector/index.mdx b/docs/en/08-client-libraries/index.mdx similarity index 78% rename from docs/en/14-reference/03-connector/index.mdx rename to docs/en/08-client-libraries/index.mdx index 4a3e9195d6..7cf2839609 100644 --- a/docs/en/14-reference/03-connector/index.mdx +++ b/docs/en/08-client-libraries/index.mdx @@ -1,15 +1,15 @@ --- -title: Connector -description: This document describes the connectors that TDengine provides to interface with various programming languages. +title: Client Libraries +description: This document describes the client libraries that TDengine provides to interface with various programming languages. --- -TDengine provides a rich set of APIs (application development interface). To facilitate users to develop their applications quickly, TDengine supports connectors for multiple programming languages, including official connectors for C/C++, Java, Python, Go, Node.js, C#, and Rust. These connectors support connecting to TDengine clusters using both native interfaces (taosc) and REST interfaces (not supported in a few languages yet). Community developers have also contributed several unofficial connectors, such as the ADO.NET connector, the Lua connector, and the PHP connector. +TDengine provides a rich set of APIs (application development interface). To facilitate users to develop their applications quickly, TDengine supports client libraries for multiple programming languages, including official libraries for C/C++, Java, Python, Go, Node.js, C#, and Rust. These client libraries support connecting to TDengine clusters using both native interfaces (taosc) and REST interfaces (not supported in a few languages yet). Community developers have also contributed several unofficial client libraries, such as the ADO.NET, Lua, and PHP libraries. -![TDengine Database image-connector](./connector.webp) +![TDengine client library connections](./connector.webp) ## Supported platforms -Currently, TDengine's native interface connectors can support platforms such as x64 and ARM hardware platforms and Linux/Windows/macOS development environments. The comparison matrix is as follows. +Currently, TDengine's native interface client libraries can support platforms such as x64 and ARM hardware platforms and Linux/Windows/macOS development environments. The comparison matrix is as follows. | **CPU** | **OS** | **Java** | **Python** | **Go** | **Node.js** | **C#** | **Rust** | C/C++ | | -------------- | --------- | -------- | ---------- | ------ | ----------- | ------ | -------- | ----- | @@ -25,7 +25,7 @@ Using REST connection can support a broader range of operating systems as it doe ## Version support -TDengine version updates often add new features, and the connector versions in the list are the best-fit versions of the connector. +TDengine version updates often add new features, and the client library versions in the list are the best-fit versions of the library. | **TDengine Versions** | **Java** | **Python** | **Go** | **C#** | **Node.js** | **Rust** | | --------------------------- | -------------- | -------------- | -------------- | ------------- | --------------- | --------------- | @@ -37,7 +37,7 @@ TDengine version updates often add new features, and the connector versions in t ## Functional Features -Comparing the connector support for TDengine functional features as follows. +Comparing the client library support for TDengine functional features as follows. ### Using the native interface (taosc) @@ -66,7 +66,7 @@ The different database framework specifications for various programming language :::warning -- Regardless of the programming language chosen for the connector, TDengine versions 2.0 and above recommend that each thread of a database application create a separate connection. Or create a connection pool based on threads to avoid interference between threads with the "USE statement" state within a connection (but the connection's query and write operations are thread-safe). +- Regardless of the programming language chosen for the client library, TDengine versions 2.0 and above recommend that each thread of a database application create a separate connection. Or create a connection pool based on threads to avoid interference between threads with the "USE statement" state within a connection (but the connection's query and write operations are thread-safe). ::: @@ -82,7 +82,7 @@ import VerifyMacOS from "./_verify_macos.mdx"; ## Install Client Driver :::info -The client driver needs to be installed if you use the native interface connector on a system that does not have the TDengine server software installed. +The client driver needs to be installed if you use the native interface connection on a system that does not have the TDengine server software installed. ::: diff --git a/docs/en/14-reference/03-connector/tdengine-jdbc-connector.webp b/docs/en/08-client-libraries/tdengine-jdbc-connector.webp similarity index 100% rename from docs/en/14-reference/03-connector/tdengine-jdbc-connector.webp rename to docs/en/08-client-libraries/tdengine-jdbc-connector.webp diff --git a/docs/en/10-deployment/02-docker.md b/docs/en/10-deployment/02-docker.md index 63153f3033..2a4511c7b1 100644 --- a/docs/en/10-deployment/02-docker.md +++ b/docs/en/10-deployment/02-docker.md @@ -21,6 +21,7 @@ docker run -d --name tdengine \ * /var/lib/taos: TDengine's default data file directory. The location can be changed via [configuration file]. And also you can modify ~/data/taos/dnode/data to your any other local emtpy data directory * /var/log/taos: TDengine's default log file directory. The location can be changed via [configure file]. And also you can modify ~/data/taos/dnode/log to your any other local empty log directory + ::: The above command starts a container named "tdengine" and maps the HTTP service port 6041 to the host port 6041. You can verify that the HTTP service provided in this container is available using the following command. @@ -42,7 +43,7 @@ taos> show databases; Query OK, 2 row(s) in set (0.002843s) ``` -The TDengine server running in the container uses the container's hostname to establish a connection. Using TDengine CLI or various connectors (such as JDBC-JNI) to access the TDengine inside the container from outside the container is more complicated. So the above is the simplest way to access the TDengine service in the container and is suitable for some simple scenarios. Please refer to the next section if you want to access the TDengine service in the container from outside the container using TDengine CLI or various connectors for complex scenarios. +The TDengine server running in the container uses the container's hostname to establish a connection. Using TDengine CLI or various client libraries (such as JDBC-JNI) to access the TDengine inside the container from outside the container is more complicated. So the above is the simplest way to access the TDengine service in the container and is suitable for some simple scenarios. Please refer to the next section if you want to access the TDengine service in the container from outside the container using TDengine CLI or various client libraries for complex scenarios. ## Start TDengine on the host network @@ -83,7 +84,7 @@ Next, ensure the hostname "tdengine" is resolvable in `/etc/hosts`. echo 127.0.0.1 tdengine |sudo tee -a /etc/hosts ``` -Finally, the TDengine service can be accessed from the TDengine CLI or any connector with "tdengine" as the server address. +Finally, the TDengine service can be accessed from the TDengine CLI or any client library with "tdengine" as the server address. ```shell taos -h tdengine -P 6030 @@ -324,6 +325,7 @@ services: - The `VERSION` environment variable is used to set the tdengine image tag - `TAOS_FIRST_EP` must be set on the newly created instance so that it can join the TDengine cluster; if there is a high availability requirement, `TAOS_SECOND_EP` needs to be used at the same time + ::: 2. Start the cluster diff --git a/docs/en/12-taos-sql/02-database.md b/docs/en/12-taos-sql/02-database.md index a0e036664a..ccf340b511 100644 --- a/docs/en/12-taos-sql/02-database.md +++ b/docs/en/12-taos-sql/02-database.md @@ -46,6 +46,7 @@ database_option: { - last_row: The last row of each subtable is cached. This option significantly improves the performance of the LAST_ROW function. - last_value: The last non-null value of each column in each subtable is cached. This option significantly improves the performance of the LAST function under normal circumstances, such as statements including the WHERE, ORDER BY, GROUP BY, and INTERVAL keywords. - both: The last row of each subtable and the last non-null value of each column in each subtable are cached. + Note: If you turn on cachemodel, then turn off, and turn on again, the result of last/last_row may be wrong, don't do like this, it's strongly recommended to always turn on the cache using "both". - CACHESIZE: specifies the amount (in MB) of memory used for subtable caching on each vnode. Enter a value between 1 and 65536. The default value is 1. - COMP: specifies how databases are compressed. The default value is 2. - 0: Compression is disabled. @@ -137,6 +138,10 @@ You can use `show .vgroups;` to check the value of cacheload. If the value of `cacheload` is very close to the value of `cachesize`, then it's very probably that `cachesize` is too small. If the value of `cacheload` is much smaller than the value of `cachesize`, then `cachesize` is big enough. You can use this simple principle to determine. Depending on how much memory is available in your system, you can choose to double `cachesize` or incrase it by even 5 or more times. +4. stt_trigger + +Pleae make sure stopping data writing before trying to alter stt_trigger parameter. + :::note Other parameters cannot be modified after the database has been created. diff --git a/docs/en/12-taos-sql/05-insert.md b/docs/en/12-taos-sql/05-insert.md index e5f502c563..57e15746cc 100644 --- a/docs/en/12-taos-sql/05-insert.md +++ b/docs/en/12-taos-sql/05-insert.md @@ -159,7 +159,7 @@ Automatically creating table and the table name is specified through the `tbname ```sql INSERT INTO meters(tbname, location, groupId, ts, current, phase) values('d31001', 'California.SanFrancisco', 2, '2021-07-13 14:06:34.630', 10.2, 219, 0.32) - values('d31001', 'California.SanFrancisco', 2, '2021-07-13 14:06:35.779', 10.15, 217, 0.33) - values('d31002', NULL, 2, '2021-07-13 14:06:34.255', 10.15, 217, 0.33) + ('d31001', 'California.SanFrancisco', 2, '2021-07-13 14:06:35.779', 10.15, 217, 0.33) + ('d31002', NULL, 2, '2021-07-13 14:06:34.255', 10.15, 217, 0.33) ``` diff --git a/docs/en/12-taos-sql/06-select.md b/docs/en/12-taos-sql/06-select.md index f1e19a5449..2606b183b8 100755 --- a/docs/en/12-taos-sql/06-select.md +++ b/docs/en/12-taos-sql/06-select.md @@ -259,7 +259,11 @@ The GROUP BY clause does not guarantee that the results are ordered. If you want ## PARTITION BY -The PARTITION BY clause is a TDengine-specific extension to standard SQL. This clause partitions data based on the part_list and performs computations per partition. +The PARTITION BY clause is a TDengine-specific extension to standard SQL introduced in TDengine 3.0. This clause partitions data based on the part_list and performs computations per partition. + +PARTITION BY and GROUP BY have similar meanings. They both group data according to a specified list and then perform calculations. The difference is that PARTITION BY does not have various restrictions on the SELECT list of the GROUP BY clause. Any operation can be performed within the group (constants, aggregations, scalars, expressions, etc.). Therefore, PARTITION BY is fully compatible with GROUP BY in terms of usage. All places that use the GROUP BY clause can be replaced with PARTITION BY. + +Because PARTITION BY does not require returning a row of aggregated data, it can also support various window operations after grouping slices. All window operations that need to be grouped can only use the PARTITION BY clause. For more information, see TDengine Extensions. diff --git a/docs/en/12-taos-sql/10-function.md b/docs/en/12-taos-sql/10-function.md index 4f8ccc418b..851ef86b67 100644 --- a/docs/en/12-taos-sql/10-function.md +++ b/docs/en/12-taos-sql/10-function.md @@ -626,9 +626,9 @@ TIMEDIFF(expr1, expr2 [, time_unit]) #### TIMETRUNCATE ```sql -TIMETRUNCATE(expr, time_unit [, ignore_timezone]) +TIMETRUNCATE(expr, time_unit [, use_current_timezone]) -ignore_timezone: { +use_current_timezone: { 0 | 1 } @@ -647,10 +647,11 @@ ignore_timezone: { 1b (nanoseconds), 1u (microseconds), 1a (milliseconds), 1s (seconds), 1m (minutes), 1h (hours), 1d (days), or 1w (weeks) - The precision of the returned timestamp is same as the precision set for the current data base in use - If the input data is not formatted as a timestamp, the returned value is null. -- If `1d` is used as `time_unit` to truncate the timestamp, `ignore_timezone` option can be set to indicate if the returned result is affected by client timezone or not. - For example, if client timezone is set to UTC+0800, TIMETRUNCATE('2020-01-01 23:00:00', 1d, 0) will return '2020-01-01 08:00:00'. - Otherwise, TIMETRUNCATE('2020-01-01 23:00:00', 1d, 1) will return '2020-01-01 00:00:00'. - If `ignore_timezone` option is omitted, the default value is set to 1. +- When using 1d/1w as the time unit to truncate timestamp, you can specify whether to truncate based on the current time zone by setting the use_current_timezone parameter. + Value 0 indicates truncation using the UTC time zone, value 1 indicates truncation using the current time zone. + For example, if the time zone configured by the Client is UTC + 0800, TIMETRUNCATE ('2020-01-01 23:00:00', 1d, 0) returns the result of '2020-01-01 08:00:00'. + When using TIMETRUNCATE ('2020-01-01 23:00:00', 1d, 1), the result is 2020-01-01 00:00:00 '. + When use_current_timezone is not specified, use_current_timezone defaults to 1. #### TIMEZONE diff --git a/docs/en/12-taos-sql/12-distinguished.md b/docs/en/12-taos-sql/12-distinguished.md index 502b7562f3..90237a54f5 100644 --- a/docs/en/12-taos-sql/12-distinguished.md +++ b/docs/en/12-taos-sql/12-distinguished.md @@ -16,7 +16,10 @@ When you query a supertable, you may need to partition the supertable by some di PARTITION BY part_list ``` -part_list can be any scalar expression, such as a column, constant, scalar function, or a combination of the preceding items. +part_list can be any scalar expression, such as a column, constant, scalar function, or a combination of the preceding items. For example, grouping data by label location, taking the average voltage within each group. +```sql +select location, avg(voltage) from meters partition by location +``` A PARTITION BY clause is processed as follows: @@ -25,10 +28,13 @@ A PARTITION BY clause is processed as follows: - The PARTITION BY clause can be used together with a window clause or GROUP BY clause. In this case, the window or GROUP BY clause takes effect on every partition. For example, the following statement partitions the table by the location tag, performs downsampling over a 10 minute window, and returns the maximum value: ```sql -select max(current) from meters partition by location interval(10m) +select _wstart, location, max(current) from meters partition by location interval(10m) ``` -The most common usage of PARTITION BY is partitioning the data in subtables by tags then perform computation when querying data in a supertable. More specifically, `PARTITION BY TBNAME` partitions the data of each subtable into a single timeline, and this method facilitates the statistical analysis in many use cases of processing timeseries data. +The most common usage of PARTITION BY is partitioning the data in subtables by tags then perform computation when querying data in a supertable. More specifically, `PARTITION BY TBNAME` partitions the data of each subtable into a single timeline, and this method facilitates the statistical analysis in many use cases of processing timeseries data. For example, calculate the average voltage of each meter every 10 minutes +```sql +select _wstart, tbname, avg(voltage) from meters partition by tbname interval(10m) +``` ## Windowed Queries diff --git a/docs/en/12-taos-sql/13-tmq.md b/docs/en/12-taos-sql/13-tmq.md index 1a805c76fb..d14b6da2d3 100644 --- a/docs/en/12-taos-sql/13-tmq.md +++ b/docs/en/12-taos-sql/13-tmq.md @@ -41,7 +41,7 @@ The preceding command displays all topics in the current database. ## Create Consumer Group -You can create consumer groups only through the TDengine Client driver or the API provided by a connector. +You can create consumer groups only through the TDengine Client driver or the API provided by a client library. ## Delete Consumer Group diff --git a/docs/en/14-reference/02-rest-api/02-rest-api.mdx b/docs/en/14-reference/02-rest-api/02-rest-api.mdx index 5cb680e34b..76dc3b6b58 100644 --- a/docs/en/14-reference/02-rest-api/02-rest-api.mdx +++ b/docs/en/14-reference/02-rest-api/02-rest-api.mdx @@ -6,7 +6,7 @@ description: This document describes the TDengine REST API. To support the development of various types of applications and platforms, TDengine provides an API that conforms to REST principles; namely REST API. To minimize the learning cost, unlike REST APIs for other database engines, TDengine allows insertion of SQL commands in the BODY of an HTTP POST request, to operate the database. :::note -One difference from the native connector is that the REST interface is stateless and so the `USE db_name` command has no effect. All references to table names and super table names need to specify the database name in the prefix. TDengine supports specification of the db_name in RESTful URL. If the database name prefix is not specified in the SQL command, the `db_name` specified in the URL will be used. +One difference from the native connection is that the REST interface is stateless and so the `USE db_name` command has no effect. All references to table names and super table names need to specify the database name in the prefix. TDengine supports specification of the db_name in RESTful URL. If the database name prefix is not specified in the SQL command, the `db_name` specified in the URL will be used. ::: ## Installation diff --git a/docs/en/14-reference/03-connector/09-csharp.mdx b/docs/en/14-reference/03-connector/09-csharp.mdx deleted file mode 100644 index 282be3af6b..0000000000 --- a/docs/en/14-reference/03-connector/09-csharp.mdx +++ /dev/null @@ -1,315 +0,0 @@ ---- -title: C# Connector -sidebar_label: C# -description: This document describes the TDengine C# connector. -toc_max_heading_level: 4 ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -import Preparition from "./_preparation.mdx" -import CSInsert from "../../07-develop/03-insert-data/_cs_sql.mdx" -import CSInfluxLine from "../../07-develop/03-insert-data/_cs_line.mdx" -import CSOpenTSDBTelnet from "../../07-develop/03-insert-data/_cs_opts_telnet.mdx" -import CSOpenTSDBJson from "../../07-develop/03-insert-data/_cs_opts_json.mdx" -import CSQuery from "../../07-develop/04-query-data/_cs.mdx" -import CSAsyncQuery from "../../07-develop/04-query-data/_cs_async.mdx" - -`TDengine.Connector` is a C# language connector provided by TDengine that allows C# developers to develop C# applications that access TDengine cluster data. - -The `TDengine.Connector` connector supports connect to TDengine instances via the TDengine client driver (taosc), providing data writing, querying, subscription, schemaless writing, bind interface, etc.The `TDengine.Connector` also supports WebSocket from v3.0.1 and developers can build connection through DSN, which supports data writing, querying, and parameter binding, etc. - -This article describes how to install `TDengine.Connector` in a Linux or Windows environment and connect to TDengine clusters via `TDengine.Connector` to perform basic operations such as data writing and querying. - -Note: TDengine Connector 3.x is not compatible with TDengine 2.x. In an environment with TDengine 2.x, you must use TDengine.Connector 1.x for the C# connector. - -The source code of `TDengine.Connector` is hosted on [GitHub](https://github.com/taosdata/taos-connector-dotnet/tree/3.0). - -## Supported platforms - -The supported platforms are the same as those supported by the TDengine client driver. - -:::note -Please note TDengine does not support 32bit Windows any more. -::: - -## Version support - -Please refer to [version support list](../#version-support) - -## Supported features - - - - - -1. Connection Management -2. General Query -3. Continuous Query -4. Parameter Binding -5. Subscription -6. Schemaless - - - - - -1. Connection Management -2. General Query -3. Continuous Query -4. Parameter Binding - - - - -## Installation Steps - -### Pre-installation preparation - -* Install the [.NET SDK](https://dotnet.microsoft.com/download) -* [Nuget Client](https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools) (optional installation) -* Install TDengine client driver, please refer to [Install client driver](../#install-client-driver) for details - -### Install `TDengine.Connector` - - - - -You can reference the `TDengine.Connector` published in Nuget to the current project via the `dotnet` CLI under the path of the existing .NET project. - -``` bash -dotnet add package TDengine.Connector -``` - -You may also modify the current.NET project file. You can include the following 'ItemGroup' in your project file (.csproj). - -``` XML - - - -``` - - - - -In this scenario, modifying your project file is required in order to copy the WebSocket dependency dynamic library from the nuget package into your project. -```XML - - - - - - - - - -``` - -Notice: `TDengine.Connector` only version>= 3.0.2 includes the dynamic library for WebSocket. - - - - -## Establish a Connection - - - - - - -``` csharp -using TDengineDriver; - -namespace TDengineExample -{ - - internal class EstablishConnection - { - static void Main(String[] args) - { - string host = "localhost"; - short port = 6030; - string username = "root"; - string password = "taosdata"; - string dbname = ""; - - var conn = TDengine.Connect(host, username, password, dbname, port); - if (conn == IntPtr.Zero) - { - Console.WriteLine("Connect to TDengine failed"); - } - else - { - Console.WriteLine("Connect to TDengine success"); - } - TDengine.Close(conn); - TDengine.Cleanup(); - } - } -} - -``` - - - - - -The structure of the DSN description string is as follows: - -```text -[]://[[:@]:][/][?=[&=]] -|------------|---|-----------|-----------|------|------|------------|-----------------------| -| protocol | | username | password | host | port | database | params | -``` - -The parameters are described as follows: - -* **protocol**: Specify which connection method to use (support http/ws). For example, `ws://localhost:6041` uses Websocket to establish connections. -* **username/password**: Username and password used to create connections. -* **host/port**: Specifies the server and port to establish a connection. Websocket connections default to `localhost:6041`. -* **database**: Specify the default database to connect to. It's optional. -* **params**: Optional parameters. - -A sample DSN description string is as follows: - -```text -ws://localhost:6041/test -``` - -``` csharp -{{#include docs/examples/csharp/wsConnect/Program.cs}} -``` - - - - -## Usage examples - -### Write data - -#### SQL Write - - - - - - - - - - - -```csharp -{{#include docs/examples/csharp/wsInsert/Program.cs}} -``` - - - - -#### InfluxDB line protocol write - - - -#### OpenTSDB Telnet line protocol write - - - -#### OpenTSDB JSON line protocol write - - - -#### Parameter Binding - - - - - -``` csharp -{{#include docs/examples/csharp/stmtInsert/Program.cs}} -``` - - - - - -```csharp -{{#include docs/examples/csharp/wsStmt/Program.cs}} -``` - - - - -### Query data - -#### Synchronous Query - - - - - - - - - - - -```csharp -{{#include docs/examples/csharp/wsQuery/Program.cs}} -``` - - - - -#### Asynchronous query - - - -### More sample programs - -|Sample program |Sample program description | -|--------------------------------------------------------------------------------------------------------------------|--------------------------------------------| -| [CURD](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/NET6Examples/Query/Query.cs) | Table creation, data insertion, and query examples with TDengine.Connector | -| [JSON Tag](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/NET6Examples/JSONTag) | Writing and querying JSON tag data with TDengine Connector | -| [stmt](https://github.com/taosdata/taos-connector-dotnet/tree/3.0/examples/NET6Examples/Stmt) | Parameter binding with TDengine Connector | -| [schemaless](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/NET6Examples/schemaless) | Schemaless writes with TDengine Connector | -| [async query](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/NET6Examples/AsyncQuery/QueryAsync.cs) | Asynchronous queries with TDengine Connector | -| [Subscription](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/NET6Examples/TMQ/TMQ.cs) | Subscription example with TDengine Connector | -| [Basic WebSocket Usage](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/FrameWork45/WS/WebSocketSample.cs) | WebSocket basic data in and out with TDengine connector | -| [WebSocket Parameter Binding](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/FrameWork45/WS/WebSocketSTMT.cs) | WebSocket parameter binding example | - -## Important update records - -| TDengine.Connector | Description | -|--------------------|--------------------------------| -| 3.0.2 | Support .NET Framework 4.5 and above. Support .Net standard 2.0. Nuget package includes dynamic library for WebSocket.| -| 3.0.1 | Support WebSocket and Cloud, With function query, insert, and parameter binding| -| 3.0.0 | Supports TDengine 3.0.0.0. TDengine 2.x is not supported. Added `TDengine.Impl.GetData()` interface to deserialize query results. | -| 1.0.7 | Fixed TDengine.Query() memory leak. | -| 1.0.6 | Fix schemaless bug in 1.0.4 and 1.0.5. | -| 1.0.5 | Fix Windows sync query Chinese error bug. | 1.0.4 | Fix schemaless bug. | -| 1.0.4 | Add asynchronous query, subscription, and other functions. Fix the binding parameter bug. | -| 1.0.3 | Add parameter binding, schemaless, JSON tag, etc. | -| 1.0.2 | Add connection management, synchronous query, error messages, etc. | - -## Other descriptions - -### Third-party driver - -`Taos` is an ADO.NET connector for TDengine, supporting Linux and Windows platforms. Community contributor `Maikebing@@maikebing contributes the connector`. Please refer to: - -* Interface download: - -## Frequently Asked Questions - -1. "Unable to establish connection", "Unable to resolve FQDN" - - Usually, it's caused by an incorrect FQDN configuration. Please refer to this section in the [FAQ](https://docs.tdengine.com/2.4/train-faq/faq/#2-how-to-handle-unable-to-establish-connection) to troubleshoot. - -2. Unhandled exception. System.DllNotFoundException: Unable to load DLL 'taos' or one of its dependencies: The specified module cannot be found. - - This is usually because the program did not find the dependent client driver. The solution is to copy `C:\TDengine\driver\taos.dll` to the `C:\Windows\System32\` directory on Windows, and create the following soft link on Linux `ln -s /usr/local/taos/driver/libtaos.so.x.x .x.x /usr/lib/libtaos.so` will work. - -## API Reference - -[API Reference](https://docs.taosdata.com/api/connector-csharp/html/860d2ac1-dd52-39c9-e460-0829c4e5a40b.htm) diff --git a/docs/en/14-reference/03-connector/_category_.yml b/docs/en/14-reference/03-connector/_category_.yml deleted file mode 100644 index 6a766e9657..0000000000 --- a/docs/en/14-reference/03-connector/_category_.yml +++ /dev/null @@ -1 +0,0 @@ -label: "Connector" diff --git a/docs/en/14-reference/08-taos-shell.md b/docs/en/14-reference/08-taos-shell.md index 8512f5b59d..d69f3876d4 100644 --- a/docs/en/14-reference/08-taos-shell.md +++ b/docs/en/14-reference/08-taos-shell.md @@ -8,7 +8,7 @@ The TDengine command-line interface (hereafter referred to as `TDengine CLI`) is ## Installation -If executed on the TDengine server-side, there is no need for additional installation steps to install TDengine CLI as it is already included and installed automatically. To run TDengine CLI in an environment where no TDengine server is running, the TDengine client installation package needs to be installed first. For details, please refer to [Connector](../connector/). +If executed on the TDengine server-side, there is no need for additional installation steps to install TDengine CLI as it is already included and installed automatically. To run TDengine CLI in an environment where no TDengine server is running, the TDengine client installation package needs to be installed first. For details, please refer to [Install Client Driver](../../client-libraries/#install-client-driver). ## Execution diff --git a/docs/en/14-reference/09-support-platform/index.md b/docs/en/14-reference/09-support-platform/index.md index 779882f582..bc1133b9a7 100644 --- a/docs/en/14-reference/09-support-platform/index.md +++ b/docs/en/14-reference/09-support-platform/index.md @@ -1,6 +1,6 @@ --- title: List of supported platforms -description: This document describes the supported platforms for the TDengine server, client, and connectors. +description: This document describes the supported platforms for the TDengine server, client, and client libraries. --- ## List of supported platforms for TDengine server @@ -12,9 +12,9 @@ description: This document describes the supported platforms for the TDengine se Note: 1) ● means officially tested and verified, ○ means unofficially tested and verified, E means only supported by the enterprise edition. 2) The community edition only supports newer versions of mainstream operating systems, including Ubuntu 18+/CentOS 7+/RetHat/Debian/CoreOS/FreeBSD/OpenSUSE/SUSE Linux/Fedora/macOS, etc. If you have requirements for other operating systems and editions, please contact support of the enterprise edition. -## List of supported platforms for TDengine clients and connectors +## List of supported platforms for TDengine clients and client libraries -TDengine's connector can support a wide range of platforms, including X64/X86/ARM64/ARM32/MIPS/Alpha/LoongArch64 hardware platforms and Linux/Win64/Win32/macOS development environments. +TDengine's client libraries can support a wide range of platforms, including X64/X86/ARM64/ARM32/MIPS/Alpha/LoongArch64 hardware platforms and Linux/Win64/Win32/macOS development environments. The comparison matrix is as follows. diff --git a/docs/en/14-reference/index.md b/docs/en/14-reference/index.md index bc8ec69965..d57eee512a 100644 --- a/docs/en/14-reference/index.md +++ b/docs/en/14-reference/index.md @@ -1,9 +1,9 @@ --- title: Reference -description: This document describes TDengine connectors and utilities. +description: This document describes TDengine utilities. --- -This section describes the TDengine connectors and utilities. +This section describes the TDengine utilities. ```mdx-code-block import DocCardList from '@theme/DocCardList'; diff --git a/docs/en/20-third-party/11-kafka.md b/docs/en/20-third-party/11-kafka.md index cac4f5f604..42266d232c 100644 --- a/docs/en/20-third-party/11-kafka.md +++ b/docs/en/20-third-party/11-kafka.md @@ -94,7 +94,7 @@ The output as bellow: The role of the TDengine Sink Connector is to synchronize the data of the specified topic to TDengine. Users do not need to create databases and super tables in advance. The name of the target database can be specified manually (see the configuration parameter connection.database), or it can be generated according to specific rules (see the configuration parameter connection.database.prefix). -TDengine Sink Connector internally uses TDengine [modeless write interface](../../reference/connector/cpp#modeless write-api) to write data to TDengine, currently supports data in three formats: [InfluxDB line protocol format](../../develop/insert-data/influxdb-line), [OpenTSDB Telnet protocol format](../../develop/insert-data/opentsdb-telnet), and [OpenTSDB JSON protocol format](../../develop/insert-data/opentsdb-json). +TDengine Sink Connector internally uses TDengine [modeless write interface](../../client-libraries/cpp#modeless write-api) to write data to TDengine, currently supports data in three formats: [InfluxDB line protocol format](../../develop/insert-data/influxdb-line), [OpenTSDB Telnet protocol format](../../develop/insert-data/opentsdb-telnet), and [OpenTSDB JSON protocol format](../../develop/insert-data/opentsdb-json). The following example synchronizes the data of the topic meters to the target database power. The data format is the InfluxDB Line protocol format. diff --git a/docs/en/20-third-party/13-Jupyter.md b/docs/en/20-third-party/13-Jupyter.md index 1ac9df1da4..79636cd504 100644 --- a/docs/en/20-third-party/13-Jupyter.md +++ b/docs/en/20-third-party/13-Jupyter.md @@ -4,7 +4,7 @@ sidebar_label: JupyterLab description: This document describes how to integrate TDengine with JupyterLab. --- -JupyterLab is the next generation of the ubiquitous Jupyter Notebook. In this note we show you how to install the TDengine Python connector to connect to TDengine in JupyterLab. You can then insert data and perform queries against the TDengine instance within JupyterLab. +JupyterLab is the next generation of the ubiquitous Jupyter Notebook. In this note we show you how to install the TDengine Python client library to connect to TDengine in JupyterLab. You can then insert data and perform queries against the TDengine instance within JupyterLab. ## Install JupyterLab Installing JupyterLab is very easy. Installation instructions can be found at: @@ -36,8 +36,8 @@ jupyter lab ```` This will automatically launch your default browser and connect to your JupyterLab instance, usually on port 8888. -## Install the TDengine Python connector -You can now install the TDengine Python connector as follows. +## Install the TDengine Python client library +You can now install the TDengine Python client library as follows. Start a new Python kernel in JupyterLab. @@ -55,8 +55,8 @@ import sys ```` ## Connect to TDengine -You can find detailed examples to use the Python connector, in the TDengine documentation here. -Once you have installed the TDengine Python connector in your JupyterLab kernel, the process of connecting to TDengine is the same as that you would use if you weren't using JupyterLab. +You can find detailed examples to use the Python client library, in the TDengine documentation here. +Once you have installed the TDengine Python client library in your JupyterLab kernel, the process of connecting to TDengine is the same as that you would use if you weren't using JupyterLab. Each TDengine instance, has a database called "log" which has monitoring information about the TDengine instance. In the "log" database there is a [supertable](https://docs.tdengine.com/taos-sql/stable/) called "disks_info". @@ -96,4 +96,4 @@ result = sqlQuery(conn) print(result) ```` -TDengine has connectors for various languages including Node.js, Go, PHP and there are kernels for these languages which can be found [here](https://github.com/jupyter/jupyter/wiki/Jupyter-kernels). +TDengine has client libraries for various languages including Node.js, Go, PHP and there are kernels for these languages which can be found [here](https://github.com/jupyter/jupyter/wiki/Jupyter-kernels). diff --git a/docs/en/20-third-party/14-dbeaver.md b/docs/en/20-third-party/14-dbeaver.md index fd0a0672f2..c949987705 100644 --- a/docs/en/20-third-party/14-dbeaver.md +++ b/docs/en/20-third-party/14-dbeaver.md @@ -19,7 +19,7 @@ To use DBeaver to manage TDengine, you need to prepare the following: ![Connect TDengine with DBeaver](./dbeaver/dbeaver-connect-tdengine-en.webp) -2. Configure the TDengine connection by filling in the host address, port number, username, and password. If TDengine is deployed on the local machine, you are only required to fill in the username and password. The default username is root and the default password is taosdata. Click **Test Connection** to check whether the connection is workable. If you do not have the TDengine Java connector installed on the local machine, DBeaver will prompt you to download and install it. +2. Configure the TDengine connection by filling in the host address, port number, username, and password. If TDengine is deployed on the local machine, you are only required to fill in the username and password. The default username is root and the default password is taosdata. Click **Test Connection** to check whether the connection is workable. If you do not have the TDengine Java client library installed on the local machine, DBeaver will prompt you to download and install it. ![Configure the TDengine connection](./dbeaver/dbeaver-config-tdengine-en.webp)) diff --git a/docs/en/20-third-party/50-qstudio.md b/docs/en/20-third-party/50-qstudio.md index 8339678a0e..4140f87775 100644 --- a/docs/en/20-third-party/50-qstudio.md +++ b/docs/en/20-third-party/50-qstudio.md @@ -19,7 +19,7 @@ To connect TDengine using qStudio, you need to complete the following preparatio ![qConnecting TDengine with qStudio](./qstudio/qstudio-connect-tdengine.webp) -2. Configure the TDengine connection by entering the host address, port number, username, and password. If TDengine is deployed on the local machine, you can fill in the username and password only. The default username is "root," and the default password is "taosdata." Click "Test" to test the connection's availability. If the TDengine Java connector is not installed on the local machine, qStudio will prompt you to download and install it. +2. Configure the TDengine connection by entering the host address, port number, username, and password. If TDengine is deployed on the local machine, you can fill in the username and password only. The default username is "root," and the default password is "taosdata." Click "Test" to test the connection's availability. If the TDengine Java client library is not installed on the local machine, qStudio will prompt you to download and install it. ![Download Java Connector](./qstudio/qstudio-jdbc-connector-download.webp) diff --git a/docs/en/20-third-party/70-seeq.md b/docs/en/20-third-party/70-seeq.md index e42204dd5d..43c3e79b72 100644 --- a/docs/en/20-third-party/70-seeq.md +++ b/docs/en/20-third-party/70-seeq.md @@ -10,20 +10,20 @@ description: How to use Seeq and TDengine to perform time series data analysis Seeq is an advanced analytics software for the manufacturing industry and the Industrial Internet of Things (IIoT). Seeq supports the use of machine learning innovations within process manufacturing organizations. These capabilities enable organizations to deploy their own or third-party machine learning algorithms into advanced analytics applications used by frontline process engineers and subject matter experts, thus extending the efforts of a single data scientist to many frontline workers. -TDengine can be added as a data source into Seeq via JDBC connector. Once data source is configured, Seeq can read data from TDengine and offers functionalities such as data visualization, analysis, and forecasting. +TDengine can be added as a data source into Seeq via JDBC client library. Once data source is configured, Seeq can read data from TDengine and offers functionalities such as data visualization, analysis, and forecasting. ## Prerequisite 1. Install Seeq Server and Seeq Data Lab software 2. Install TDengine or register TDengine Cloud service -## Install TDengine JDBC connector +## Install TDengine JDBC client library 1. Get Seeq data location configuration ``` sudo seeq config get Folders/Data ``` -2. Download the latest TDengine Java connector from maven.org (current is version is [3.2.5](https://repo1.maven.org/maven2/com/taosdata/jdbc/taos-jdbcdriver/3.2.5/taos-jdbcdriver-3.2.5-dist.jar)), and copy the JAR file into the_directory_found_in_step_1/plugins/lib/ +2. Download the latest TDengine Java client library from maven.org (current is version is [3.2.5](https://repo1.maven.org/maven2/com/taosdata/jdbc/taos-jdbcdriver/3.2.5/taos-jdbcdriver-3.2.5-dist.jar)), and copy the JAR file into the_directory_found_in_step_1/plugins/lib/ 3. Restart Seeq server ``` sudo seeq restart diff --git a/docs/en/20-third-party/75-powerbi.md b/docs/en/20-third-party/75-powerbi.md new file mode 100644 index 0000000000..4744467f30 --- /dev/null +++ b/docs/en/20-third-party/75-powerbi.md @@ -0,0 +1,65 @@ +--- +sidebar_label: Power BI +title: Power BI +description: Use PowerBI and TDengine to analyze time series data +--- + +## Introduction + +With TDengine ODBC driver, PowerBI can access time series data stored in TDengine. You can import tag data, original time series data, or aggregated data into PowerBI from TDengine, to create reports or dashboard without any coding effort. + +## Steps +![Power BI use step](./powerbi-step-en.webp) + +### Prerequisites + +1. TDengine server has been installed and running well. +2. Power BI Desktop has been installed and running. (If not, please download and install latest Windows X64 version from [PowerBI](https://www.microsoft.com/download/details.aspx?id=58494). + + +## Install Driver + +Depending on your TDengine server version, download appropriate version of TDengine client package from TDengine website [Download Link](https://docs.taosdata.com/get-started/package/), or TDengine explorer if you are using a local TDengine cluster. Install the TDengine client package on same Windows machine where PowerBI is running. + +### Configure Data Source + +Please refer to [ODBC](../../client-libraries/odbc) to configure TDengine ODBC Driver with WebSocket connection. + +### Import Data from TDengine to Power BI + +1. Open Power BI and logon, add data source following steps "Home Page" -> "Get Data" -> "Others" -> "ODBC" -> "Connect" + +2. Choose data source name, connect to configured data source, go to the nativator, browse tables of the selected database and load data + +3. If you want to input some specific SQL, click "Advanced Options", and input your SQL in the open dialogue box and load the data. + + +To better use Power BI to analyze the data stored in TDengine, you need to understand the concepts of dimention, metric, time serie, correlation, and use your own SQL to import data. + +1. Dimention: it's normally category (text) data to describe such information as device, collection point, model. In the supertable template of TDengine, we use tag columns to store the dimention information. You can use SQL like `select distinct tbname, tag1, tag2 from supertable` to get dimentions. + +2. Metric: quantitive (numeric) fileds that can be calculated, like SUM, AVERAGE, MINIMUM. If the collecting frequency is 1 second, then there are 31,536,000 records in one year, it will be too low efficient to import so big data into Power BI. In TDengine, you can use data partition query, window partition query, in combination with pseudo columns related to window, to import downsampled data into Power BI. For more details, please refer to [TDengine Specialized Queries](https://docs.taosdata.com/taos-sql/distinguished/)。 + + - Window partition query: for example, thermal meters collect one data per second, but you need to query the average temperature every 10 minutes, you can use window subclause to get the downsampling data you need. The corresponding SQL is like `select tbname, _wstart date,avg(temperature) temp from table interval(10m)`, in which _wstart is a pseudo column indicting the start time of a widow, 10m is the duration of the window, `avg(temperature)` indicates the aggregate value inside a window. + + - Data partition query: If you want to get the aggregate value of a lot of thermal meters, you can first partition the data and then perform a series of calculation in the partitioned data spaces. The SQL you need to use is `partition by part_list`. The most common of data partition usage is that when querying a supertable, you can partition data by subtable according to tags to form the data of each subtable into a single time serie to facilitate analytical processing of time series data. + +3. Time Serie: When curve plotting or aggregating data based on time lines, date is normally required. Data or time can be imported from Excel, or retrieved from TDengine using SQL statement like `select _wstart date, count(*) cnt from test.meters where ts between A and B interval(1d) fill(0)`, in which the fill() subclause indicates the fill mode when there is data missing, pseudo column _wstart indicates the date to retrieve. + +4. Correlation: Indicates how to correlate data. Dimentions and Metrics can be correlated by tbname, dates and metrics can be correlated by date. All these can cooperate to form visual reports. + +### Example - Meters + +TDengine has its own specific data model, which uses supertable as template and creates a specific table for each device. Each table can have maximum 4,096 data columns and 128 tags. In the example of meters, assume each meter generates one record per second, then there will be 86,400 records each day and 31,536,000 records every year, then only 1,000 meters will occupy 500GB disk space. So, the common usage of Power BI should be mapping tags to dimention columns, mapping the aggregation of data columns to metric columns, to provide indicators for decision makers. + +1. Import Dimentions + +Import the tags of tables in PowerBI, and name as "tags", the SQL is like `select distinct tbname, groupid, location from test.meters;`. + +2. Import Metrics + +In Power BI, import the average current, average voltage, average phase with 1 hour window, and name it as "data", the SQL is like `select tbname, _wstart ws, avg(current), avg(voltage), avg(phase) from test.meters PARTITION by tbname interval(1h)` . + +3. Correlate Dimentions and Metrics + +In Power BI, open model view, correlate "tags" and "data", and set "tabname" as the correlation column, then you can use the data in histogram, pie chart, etc. For more information about building visual reports in PowerBI, please refer to [Power BI](https://learn.microsoft.com/power-bi/)。 \ No newline at end of file diff --git a/docs/en/20-third-party/powerbi-step-en.webp b/docs/en/20-third-party/powerbi-step-en.webp new file mode 100644 index 0000000000..5d6eff1ac2 Binary files /dev/null and b/docs/en/20-third-party/powerbi-step-en.webp differ diff --git a/docs/en/25-application/_03-immigrate.md b/docs/en/25-application/_03-immigrate.md index cdb3d5591c..4dc7ee711c 100644 --- a/docs/en/25-application/_03-immigrate.md +++ b/docs/en/25-application/_03-immigrate.md @@ -176,7 +176,7 @@ After completing the query, if the data written does not differ from what is exp TDengine does not support querying, or data fetching using the OpenTSDB query syntax but does provide a counterpart for each of the OpenTSDB queries. The corresponding query processing can be adapted and applied in a manner obtained by examining Appendix 1. To fully understand the types of queries supported by TDengine, refer to the TDengine user manual. -TDengine supports the standard JDBC 3.0 interface for manipulating databases, but you can also use other types of high-level language connectors for querying and reading data to suit your application. Please read the user manual for specific operations and usage. +TDengine supports the standard JDBC 3.0 interface for manipulating databases, but you can also use other types of high-level language client libraries for querying and reading data to suit your application. Please read the user manual for specific operations and usage. ## Historical Data Migration diff --git a/docs/en/27-train-faq/01-faq.md b/docs/en/27-train-faq/01-faq.md index 715704a0c3..e8e1386197 100644 --- a/docs/en/27-train-faq/01-faq.md +++ b/docs/en/27-train-faq/01-faq.md @@ -54,7 +54,7 @@ This error indicates that the client could not connect to the server. Perform th 6. Verify that your firewall settings allow all hosts in the cluster to communicate on ports 6030 and 6041 (TCP and UDP). You can run `ufw status` (Ubuntu) or `firewall-cmd --list-port` (CentOS) to check the configuration. -7. If you are using the Python, Java, Go, Rust, C#, or Node.js connector on Linux to connect to the server, verify that `libtaos.so` is in the `/usr/local/taos/driver` directory and `/usr/local/taos/driver` is in the `LD_LIBRARY_PATH` environment variable. +7. If you are using the Python, Java, Go, Rust, C#, or Node.js client library on Linux to connect to the server, verify that `libtaos.so` is in the `/usr/local/taos/driver` directory and `/usr/local/taos/driver` is in the `LD_LIBRARY_PATH` environment variable. 8. If you are using macOS, verify that `libtaos.dylib` is in the `/usr/local/lib` directory and `/usr/local/lib` is in the `DYLD_LIBRARY_PATH` environment variable.. @@ -142,7 +142,7 @@ Timestamps are processed as follows: 1. The client uses its system timezone unless it has been configured otherwise. 2. A timezone configured in `taos.cfg` takes precedence over the system timezone. -3. A timezone explicitly specified when establishing a connection to TDengine through a connector takes precedence over `taos.cfg` and the system timezone. For example, the Java connector allows you to specify a timezone in the JDBC URL. +3. A timezone explicitly specified when establishing a connection to TDengine through a client library takes precedence over `taos.cfg` and the system timezone. For example, the Java client library allows you to specify a timezone in the JDBC URL. 4. If you use an RFC 3339 timestamp (2013-04-12T15:52:01.123+08:00), or an ISO 8601 timestamp (2013-04-12T15:52:01.123+0800), the timezone specified in the timestamp is used instead of the timestamps configured using any other method. ### 11. Which network ports are required by TDengine? diff --git a/docs/examples/csharp/.gitignore b/docs/examples/csharp/.gitignore index c228f1be2a..b0df020f44 100644 --- a/docs/examples/csharp/.gitignore +++ b/docs/examples/csharp/.gitignore @@ -1,5 +1,5 @@ .vs -asyncQuery/bin +.idea connect/bin influxdbLine/bin optsJSON/bin @@ -12,7 +12,6 @@ wsConnect/bin wsInsert/bin wsQuery/bin wsStmt/bin -asyncQuery/obj connect/obj influxdbLine/obj optsJSON/obj diff --git a/docs/examples/csharp/asyncQuery/Program.cs b/docs/examples/csharp/asyncQuery/Program.cs deleted file mode 100644 index 864f06a15e..0000000000 --- a/docs/examples/csharp/asyncQuery/Program.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System; -using System.Collections.Generic; -using TDengineDriver; -using TDengineDriver.Impl; -using System.Runtime.InteropServices; - -namespace TDengineExample -{ - public class AsyncQueryExample - { - static void Main() - { - IntPtr conn = GetConnection(); - try - { - QueryAsyncCallback queryAsyncCallback = new QueryAsyncCallback(QueryCallback); - TDengine.QueryAsync(conn, "select * from meters", queryAsyncCallback, IntPtr.Zero); - Thread.Sleep(2000); - } - finally - { - TDengine.Close(conn); - } - - } - - static void QueryCallback(IntPtr param, IntPtr taosRes, int code) - { - if (code == 0 && taosRes != IntPtr.Zero) - { - FetchRawBlockAsyncCallback fetchRowAsyncCallback = new FetchRawBlockAsyncCallback(FetchRawBlockCallback); - TDengine.FetchRawBlockAsync(taosRes, fetchRowAsyncCallback, param); - } - else - { - throw new Exception($"async query data failed,code:{code},reason:{TDengine.Error(taosRes)}"); - } - } - - // Iteratively call this interface until "numOfRows" is no greater than 0. - static void FetchRawBlockCallback(IntPtr param, IntPtr taosRes, int numOfRows) - { - if (numOfRows > 0) - { - Console.WriteLine($"{numOfRows} rows async retrieved"); - IntPtr pdata = TDengine.GetRawBlock(taosRes); - List metaList = TDengine.FetchFields(taosRes); - List dataList = LibTaos.ReadRawBlock(pdata, metaList, numOfRows); - - for (int i = 0; i < dataList.Count; i++) - { - if (i != 0 && (i + 1) % metaList.Count == 0) - { - Console.WriteLine("{0}\t|", dataList[i]); - } - else - { - Console.Write("{0}\t|", dataList[i]); - } - } - Console.WriteLine(""); - TDengine.FetchRawBlockAsync(taosRes, FetchRawBlockCallback, param); - } - else - { - if (numOfRows == 0) - { - Console.WriteLine("async retrieve complete."); - } - else - { - throw new Exception($"FetchRawBlockCallback callback error, error code {numOfRows}"); - } - TDengine.FreeResult(taosRes); - } - } - - static IntPtr GetConnection() - { - string host = "localhost"; - short port = 6030; - string username = "root"; - string password = "taosdata"; - string dbname = "power"; - var conn = TDengine.Connect(host, username, password, dbname, port); - if (conn == IntPtr.Zero) - { - throw new Exception("Connect to TDengine failed"); - } - else - { - Console.WriteLine("Connect to TDengine success"); - } - return conn; - } - } -} - -// //output: -// // Connect to TDengine success -// // 8 rows async retrieved - -// // 1538548685500 | 11.8 | 221 | 0.28 | california.losangeles | 2 | -// // 1538548696600 | 13.4 | 223 | 0.29 | california.losangeles | 2 | -// // 1538548685000 | 10.8 | 223 | 0.29 | california.losangeles | 3 | -// // 1538548686500 | 11.5 | 221 | 0.35 | california.losangeles | 3 | -// // 1538548685000 | 10.3 | 219 | 0.31 | california.sanfrancisco | 2 | -// // 1538548695000 | 12.6 | 218 | 0.33 | california.sanfrancisco | 2 | -// // 1538548696800 | 12.3 | 221 | 0.31 | california.sanfrancisco | 2 | -// // 1538548696650 | 10.3 | 218 | 0.25 | california.sanfrancisco | 3 | -// // async retrieve complete. \ No newline at end of file diff --git a/docs/examples/csharp/asyncQuery/asyncquery.csproj b/docs/examples/csharp/asyncQuery/asyncquery.csproj deleted file mode 100644 index 7c5b693f28..0000000000 --- a/docs/examples/csharp/asyncQuery/asyncquery.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - Exe - net6.0 - enable - enable - TDengineExample.AsyncQueryExample - - - - - - - diff --git a/docs/examples/csharp/connect/Program.cs b/docs/examples/csharp/connect/Program.cs index 955db40c7c..0152b61b03 100644 --- a/docs/examples/csharp/connect/Program.cs +++ b/docs/examples/csharp/connect/Program.cs @@ -1,4 +1,5 @@ -using TDengineDriver; +using TDengine.Driver; +using TDengine.Driver.Client; namespace TDengineExample { @@ -7,23 +8,11 @@ namespace TDengineExample { static void Main(String[] args) { - string host = "localhost"; - short port = 6030; - string username = "root"; - string password = "taosdata"; - string dbname = ""; - - var conn = TDengine.Connect(host, username, password, dbname, port); - if (conn == IntPtr.Zero) + var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) { - throw new Exception("Connect to TDengine failed"); + Console.WriteLine("connected"); } - else - { - Console.WriteLine("Connect to TDengine success"); - } - TDengine.Close(conn); - TDengine.Cleanup(); } } } diff --git a/docs/examples/csharp/connect/connect.csproj b/docs/examples/csharp/connect/connect.csproj index a08e86d4b4..e4412a68db 100644 --- a/docs/examples/csharp/connect/connect.csproj +++ b/docs/examples/csharp/connect/connect.csproj @@ -9,7 +9,7 @@ - + diff --git a/docs/examples/csharp/csharp.sln b/docs/examples/csharp/csharp.sln index 560dde55cb..59c198b4c9 100644 --- a/docs/examples/csharp/csharp.sln +++ b/docs/examples/csharp/csharp.sln @@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.30114.105 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "asyncquery", "asyncQuery\asyncquery.csproj", "{E2A5F00C-14E7-40E1-A2DE-6AB2975616D3}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "connect", "connect\connect.csproj", "{CCC5042D-93FC-4AE0-B2F6-7E692FD476B7}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "influxdbline", "influxdbLine\influxdbline.csproj", "{6A24FB80-1E3C-4E2D-A5AB-914FA583874D}" @@ -38,10 +36,6 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E2A5F00C-14E7-40E1-A2DE-6AB2975616D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E2A5F00C-14E7-40E1-A2DE-6AB2975616D3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E2A5F00C-14E7-40E1-A2DE-6AB2975616D3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E2A5F00C-14E7-40E1-A2DE-6AB2975616D3}.Release|Any CPU.Build.0 = Release|Any CPU {CCC5042D-93FC-4AE0-B2F6-7E692FD476B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CCC5042D-93FC-4AE0-B2F6-7E692FD476B7}.Debug|Any CPU.Build.0 = Debug|Any CPU {CCC5042D-93FC-4AE0-B2F6-7E692FD476B7}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/docs/examples/csharp/influxdbLine/Program.cs b/docs/examples/csharp/influxdbLine/Program.cs index a620c01609..fcf2928f0c 100644 --- a/docs/examples/csharp/influxdbLine/Program.cs +++ b/docs/examples/csharp/influxdbLine/Program.cs @@ -1,4 +1,5 @@ -using TDengineDriver; +using TDengine.Driver; +using TDengine.Driver.Client; namespace TDengineExample { @@ -6,60 +7,23 @@ namespace TDengineExample { static void Main() { - IntPtr conn = GetConnection(); - PrepareDatabase(conn); - string[] lines = { - "meters,location=California.LosAngeles,groupid=2 current=11.8,voltage=221,phase=0.28 1648432611249", - "meters,location=California.LosAngeles,groupid=2 current=13.4,voltage=223,phase=0.29 1648432611250", - "meters,location=California.LosAngeles,groupid=3 current=10.8,voltage=223,phase=0.29 1648432611249", - "meters,location=California.LosAngeles,groupid=3 current=11.3,voltage=221,phase=0.35 1648432611250" - }; - IntPtr res = TDengine.SchemalessInsert(conn, lines, lines.Length, (int)TDengineSchemalessProtocol.TSDB_SML_LINE_PROTOCOL, (int)TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_MILLI_SECONDS); - if (TDengine.ErrorNo(res) != 0) + var builder = + new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) { - throw new Exception("SchemalessInsert failed since " + TDengine.Error(res)); - } - else - { - int affectedRows = TDengine.AffectRows(res); - Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows"); - } - TDengine.FreeResult(res); - - } - static IntPtr GetConnection() - { - string host = "localhost"; - short port = 6030; - string username = "root"; - string password = "taosdata"; - string dbname = ""; - var conn = TDengine.Connect(host, username, password, dbname, port); - if (conn == IntPtr.Zero) - { - throw new Exception("Connect to TDengine failed"); - } - else - { - Console.WriteLine("Connect to TDengine success"); - } - return conn; - } - - static void PrepareDatabase(IntPtr conn) - { - IntPtr res = TDengine.Query(conn, "CREATE DATABASE test WAL_RETENTION_PERIOD 3600"); - if (TDengine.ErrorNo(res) != 0) - { - throw new Exception("failed to create database, reason: " + TDengine.Error(res)); - } - res = TDengine.Query(conn, "USE test"); - if (TDengine.ErrorNo(res) != 0) - { - throw new Exception("failed to change database, reason: " + TDengine.Error(res)); + client.Exec("CREATE DATABASE test WAL_RETENTION_PERIOD 3600"); + client.Exec("use test"); + string[] lines = { + "meters,location=California.LosAngeles,groupid=2 current=11.8,voltage=221,phase=0.28 1648432611249", + "meters,location=California.LosAngeles,groupid=2 current=13.4,voltage=223,phase=0.29 1648432611250", + "meters,location=California.LosAngeles,groupid=3 current=10.8,voltage=223,phase=0.29 1648432611249", + "meters,location=California.LosAngeles,groupid=3 current=11.3,voltage=221,phase=0.35 1648432611250" + }; + client.SchemalessInsert(lines, + TDengineSchemalessProtocol.TSDB_SML_LINE_PROTOCOL, + TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_MILLI_SECONDS, 0, ReqId.GetReqId()); } } - } } diff --git a/docs/examples/csharp/influxdbLine/influxdbline.csproj b/docs/examples/csharp/influxdbLine/influxdbline.csproj index 4889f8fde9..4fe883b6cb 100644 --- a/docs/examples/csharp/influxdbLine/influxdbline.csproj +++ b/docs/examples/csharp/influxdbLine/influxdbline.csproj @@ -9,7 +9,7 @@ - + diff --git a/docs/examples/csharp/optsJSON/Program.cs b/docs/examples/csharp/optsJSON/Program.cs index 8dcc1dce92..a93c4dad0f 100644 --- a/docs/examples/csharp/optsJSON/Program.cs +++ b/docs/examples/csharp/optsJSON/Program.cs @@ -1,69 +1,28 @@ -using TDengineDriver; +using TDengine.Driver; +using TDengine.Driver.Client; namespace TDengineExample { internal class OptsJsonExample { - static void Main() + public static void Main(string[] args) { - IntPtr conn = GetConnection(); - try + var builder = + new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) { - PrepareDatabase(conn); - string[] lines = { "[{\"metric\": \"meters.current\", \"timestamp\": 1648432611249, \"value\": 10.3, \"tags\": {\"location\": \"California.SanFrancisco\", \"groupid\": 2}}," + - " {\"metric\": \"meters.voltage\", \"timestamp\": 1648432611249, \"value\": 219, \"tags\": {\"location\": \"California.LosAngeles\", \"groupid\": 1}}, " + - "{\"metric\": \"meters.current\", \"timestamp\": 1648432611250, \"value\": 12.6, \"tags\": {\"location\": \"California.SanFrancisco\", \"groupid\": 2}}," + - " {\"metric\": \"meters.voltage\", \"timestamp\": 1648432611250, \"value\": 221, \"tags\": {\"location\": \"California.LosAngeles\", \"groupid\": 1}}]" - }; - - IntPtr res = TDengine.SchemalessInsert(conn, lines, 1, (int)TDengineSchemalessProtocol.TSDB_SML_JSON_PROTOCOL, (int)TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_NOT_CONFIGURED); - if (TDengine.ErrorNo(res) != 0) + client.Exec("CREATE DATABASE test WAL_RETENTION_PERIOD 3600"); + client.Exec("use test"); + string[] lines = { - throw new Exception("SchemalessInsert failed since " + TDengine.Error(res)); - } - else - { - int affectedRows = TDengine.AffectRows(res); - Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows"); - } - TDengine.FreeResult(res); - } - finally - { - TDengine.Close(conn); - } - } - static IntPtr GetConnection() - { - string host = "localhost"; - short port = 6030; - string username = "root"; - string password = "taosdata"; - string dbname = ""; - var conn = TDengine.Connect(host, username, password, dbname, port); - if (conn == IntPtr.Zero) - { - throw new Exception("Connect to TDengine failed"); - } - else - { - Console.WriteLine("Connect to TDengine success"); - } - return conn; - } - - static void PrepareDatabase(IntPtr conn) - { - IntPtr res = TDengine.Query(conn, "CREATE DATABASE test WAL_RETENTION_PERIOD 3600"); - if (TDengine.ErrorNo(res) != 0) - { - throw new Exception("failed to create database, reason: " + TDengine.Error(res)); - } - res = TDengine.Query(conn, "USE test"); - if (TDengine.ErrorNo(res) != 0) - { - throw new Exception("failed to change database, reason: " + TDengine.Error(res)); + "[{\"metric\": \"meters.current\", \"timestamp\": 1648432611249, \"value\": 10.3, \"tags\": {\"location\": \"California.SanFrancisco\", \"groupid\": 2}}," + + " {\"metric\": \"meters.voltage\", \"timestamp\": 1648432611249, \"value\": 219, \"tags\": {\"location\": \"California.LosAngeles\", \"groupid\": 1}}, " + + "{\"metric\": \"meters.current\", \"timestamp\": 1648432611250, \"value\": 12.6, \"tags\": {\"location\": \"California.SanFrancisco\", \"groupid\": 2}}," + + " {\"metric\": \"meters.voltage\", \"timestamp\": 1648432611250, \"value\": 221, \"tags\": {\"location\": \"California.LosAngeles\", \"groupid\": 1}}]" + }; + client.SchemalessInsert(lines, TDengineSchemalessProtocol.TSDB_SML_JSON_PROTOCOL, + TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_MILLI_SECONDS, 0, ReqId.GetReqId()); } } } -} +} \ No newline at end of file diff --git a/docs/examples/csharp/optsJSON/optsJSON.csproj b/docs/examples/csharp/optsJSON/optsJSON.csproj index 208f04c82d..9c3edf53e3 100644 --- a/docs/examples/csharp/optsJSON/optsJSON.csproj +++ b/docs/examples/csharp/optsJSON/optsJSON.csproj @@ -9,7 +9,7 @@ - + diff --git a/docs/examples/csharp/optsTelnet/Program.cs b/docs/examples/csharp/optsTelnet/Program.cs index ccd29d0cfc..b64aa9fe2d 100644 --- a/docs/examples/csharp/optsTelnet/Program.cs +++ b/docs/examples/csharp/optsTelnet/Program.cs @@ -1,72 +1,31 @@ -using TDengineDriver; +using TDengine.Driver; +using TDengine.Driver.Client; namespace TDengineExample { internal class OptsTelnetExample { - static void Main() + public static void Main(string[] args) { - IntPtr conn = GetConnection(); - try + var builder = + new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) { - PrepareDatabase(conn); + client.Exec("CREATE DATABASE test WAL_RETENTION_PERIOD 3600"); + client.Exec("USE test"); string[] lines = { - "meters.current 1648432611249 10.3 location=California.SanFrancisco groupid=2", - "meters.current 1648432611250 12.6 location=California.SanFrancisco groupid=2", - "meters.current 1648432611249 10.8 location=California.LosAngeles groupid=3", - "meters.current 1648432611250 11.3 location=California.LosAngeles groupid=3", - "meters.voltage 1648432611249 219 location=California.SanFrancisco groupid=2", - "meters.voltage 1648432611250 218 location=California.SanFrancisco groupid=2", - "meters.voltage 1648432611249 221 location=California.LosAngeles groupid=3", - "meters.voltage 1648432611250 217 location=California.LosAngeles groupid=3", - }; - IntPtr res = TDengine.SchemalessInsert(conn, lines, lines.Length, (int)TDengineSchemalessProtocol.TSDB_SML_TELNET_PROTOCOL, (int)TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_NOT_CONFIGURED); - if (TDengine.ErrorNo(res) != 0) - { - throw new Exception("SchemalessInsert failed since " + TDengine.Error(res)); - } - else - { - int affectedRows = TDengine.AffectRows(res); - Console.WriteLine($"SchemalessInsert success, affected {affectedRows} rows"); - } - TDengine.FreeResult(res); - } - catch - { - TDengine.Close(conn); - } - } - static IntPtr GetConnection() - { - string host = "localhost"; - short port = 6030; - string username = "root"; - string password = "taosdata"; - string dbname = ""; - var conn = TDengine.Connect(host, username, password, dbname, port); - if (conn == IntPtr.Zero) - { - throw new Exception("Connect to TDengine failed"); - } - else - { - Console.WriteLine("Connect to TDengine success"); - } - return conn; - } - - static void PrepareDatabase(IntPtr conn) - { - IntPtr res = TDengine.Query(conn, "CREATE DATABASE test WAL_RETENTION_PERIOD 3600"); - if (TDengine.ErrorNo(res) != 0) - { - throw new Exception("failed to create database, reason: " + TDengine.Error(res)); - } - res = TDengine.Query(conn, "USE test"); - if (TDengine.ErrorNo(res) != 0) - { - throw new Exception("failed to change database, reason: " + TDengine.Error(res)); + "meters.current 1648432611249 10.3 location=California.SanFrancisco groupid=2", + "meters.current 1648432611250 12.6 location=California.SanFrancisco groupid=2", + "meters.current 1648432611249 10.8 location=California.LosAngeles groupid=3", + "meters.current 1648432611250 11.3 location=California.LosAngeles groupid=3", + "meters.voltage 1648432611249 219 location=California.SanFrancisco groupid=2", + "meters.voltage 1648432611250 218 location=California.SanFrancisco groupid=2", + "meters.voltage 1648432611249 221 location=California.LosAngeles groupid=3", + "meters.voltage 1648432611250 217 location=California.LosAngeles groupid=3", + }; + client.SchemalessInsert(lines, + TDengineSchemalessProtocol.TSDB_SML_TELNET_PROTOCOL, + TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_MILLI_SECONDS, 0, ReqId.GetReqId()); } } } diff --git a/docs/examples/csharp/optsTelnet/optstelnet.csproj b/docs/examples/csharp/optsTelnet/optstelnet.csproj index 32c76ec418..4d6941e962 100644 --- a/docs/examples/csharp/optsTelnet/optstelnet.csproj +++ b/docs/examples/csharp/optsTelnet/optstelnet.csproj @@ -9,7 +9,7 @@ - + diff --git a/docs/examples/csharp/query/Program.cs b/docs/examples/csharp/query/Program.cs index 84c7f9db1f..4c354d9a5e 100644 --- a/docs/examples/csharp/query/Program.cs +++ b/docs/examples/csharp/query/Program.cs @@ -1,80 +1,35 @@ -using TDengineDriver; -using TDengineDriver.Impl; -using System.Runtime.InteropServices; +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; namespace TDengineExample { internal class QueryExample { - static void Main() + public static void Main(string[] args) { - IntPtr conn = GetConnection(); - try + var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) { - // run query - IntPtr res = TDengine.Query(conn, "SELECT * FROM meters LIMIT 2"); - if (TDengine.ErrorNo(res) != 0) + try { - throw new Exception("Failed to query since: " + TDengine.Error(res)); - } - - // get filed count - int fieldCount = TDengine.FieldCount(res); - Console.WriteLine("fieldCount=" + fieldCount); - - // print column names - List metas = LibTaos.GetMeta(res); - for (int i = 0; i < metas.Count; i++) - { - Console.Write(metas[i].name + "\t"); - } - Console.WriteLine(); - - // print values - List resData = LibTaos.GetData(res); - for (int i = 0; i < resData.Count; i++) - { - Console.Write($"|{resData[i].ToString()} \t"); - if (((i + 1) % metas.Count == 0)) + client.Exec("use power"); + string query = "SELECT * FROM meters"; + using (var rows = client.Query(query)) { - Console.WriteLine(""); + while (rows.Read()) + { + Console.WriteLine( + $"{((DateTime)rows.GetValue(0)):yyyy-MM-dd HH:mm:ss.fff}, {rows.GetValue(1)}, {rows.GetValue(2)}, {rows.GetValue(3)}, {rows.GetValue(4)}, {Encoding.UTF8.GetString((byte[])rows.GetValue(5))}"); + } } } - Console.WriteLine(); - - // Free result after use - TDengine.FreeResult(res); + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } } - finally - { - TDengine.Close(conn); - } - - } - static IntPtr GetConnection() - { - string host = "localhost"; - short port = 6030; - string username = "root"; - string password = "taosdata"; - string dbname = "power"; - var conn = TDengine.Connect(host, username, password, dbname, port); - if (conn == IntPtr.Zero) - { - throw new Exception("Connect to TDengine failed"); - } - else - { - Console.WriteLine("Connect to TDengine success"); - } - return conn; } } -} - -// output: -// Connect to TDengine success -// fieldCount=6 -// ts current voltage phase location groupid -// 1648432611249 10.3 219 0.31 California.SanFrancisco 2 -// 1648432611749 12.6 218 0.33 California.SanFrancisco 2 \ No newline at end of file +} \ No newline at end of file diff --git a/docs/examples/csharp/query/query.csproj b/docs/examples/csharp/query/query.csproj index 360d73b2c0..9924d331af 100644 --- a/docs/examples/csharp/query/query.csproj +++ b/docs/examples/csharp/query/query.csproj @@ -9,7 +9,7 @@ - + diff --git a/docs/examples/csharp/sqlInsert/Program.cs b/docs/examples/csharp/sqlInsert/Program.cs index 25a945a459..c3c700aba2 100644 --- a/docs/examples/csharp/sqlInsert/Program.cs +++ b/docs/examples/csharp/sqlInsert/Program.cs @@ -1,69 +1,47 @@ -using TDengineDriver; - +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; namespace TDengineExample { internal class SQLInsertExample { - static void Main() + public static void Main(string[] args) { - IntPtr conn = GetConnection(); - try + var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) { - IntPtr res = TDengine.Query(conn, "CREATE DATABASE power WAL_RETENTION_PERIOD 3600"); - CheckRes(conn, res, "failed to create database"); - res = TDengine.Query(conn, "USE power"); - CheckRes(conn, res, "failed to change database"); - res = TDengine.Query(conn, "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT)"); - CheckRes(conn, res, "failed to create stable"); - var sql = "INSERT INTO d1001 USING meters TAGS('California.SanFrancisco', 2) VALUES ('2018-10-03 14:38:05.000', 10.30000, 219, 0.31000) ('2018-10-03 14:38:15.000', 12.60000, 218, 0.33000) ('2018-10-03 14:38:16.800', 12.30000, 221, 0.31000) " + - "d1002 USING power.meters TAGS('California.SanFrancisco', 3) VALUES('2018-10-03 14:38:16.650', 10.30000, 218, 0.25000) " + - "d1003 USING power.meters TAGS('California.LosAngeles', 2) VALUES('2018-10-03 14:38:05.500', 11.80000, 221, 0.28000)('2018-10-03 14:38:16.600', 13.40000, 223, 0.29000) " + - "d1004 USING power.meters TAGS('California.LosAngeles', 3) VALUES('2018-10-03 14:38:05.000', 10.80000, 223, 0.29000)('2018-10-03 14:38:06.500', 11.50000, 221, 0.35000)"; - res = TDengine.Query(conn, sql); - CheckRes(conn, res, "failed to insert data"); - int affectedRows = TDengine.AffectRows(res); - Console.WriteLine("affectedRows " + affectedRows); - TDengine.FreeResult(res); - } - finally - { - TDengine.Close(conn); - } - - } - - static IntPtr GetConnection() - { - string host = "localhost"; - short port = 6030; - string username = "root"; - string password = "taosdata"; - string dbname = ""; - var conn = TDengine.Connect(host, username, password, dbname, port); - if (conn == IntPtr.Zero) - { - throw new Exception("Connect to TDengine failed"); - } - else - { - Console.WriteLine("Connect to TDengine success"); - } - return conn; - } - - static void CheckRes(IntPtr conn, IntPtr res, String errorMsg) - { - if (TDengine.ErrorNo(res) != 0) - { - throw new Exception($"{errorMsg} since: {TDengine.Error(res)}"); + try + { + client.Exec("create database power"); + client.Exec("CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"); + string insertQuery = + "INSERT INTO " + + "power.d1001 USING power.meters TAGS(2,'California.SanFrancisco') " + + "VALUES " + + "('2023-10-03 14:38:05.000', 10.30000, 219, 0.31000) " + + "('2023-10-03 14:38:15.000', 12.60000, 218, 0.33000) " + + "('2023-10-03 14:38:16.800', 12.30000, 221, 0.31000) " + + "power.d1002 USING power.meters TAGS(3, 'California.SanFrancisco') " + + "VALUES " + + "('2023-10-03 14:38:16.650', 10.30000, 218, 0.25000) " + + "power.d1003 USING power.meters TAGS(2,'California.LosAngeles') " + + "VALUES " + + "('2023-10-03 14:38:05.500', 11.80000, 221, 0.28000) " + + "('2023-10-03 14:38:16.600', 13.40000, 223, 0.29000) " + + "power.d1004 USING power.meters TAGS(3,'California.LosAngeles') " + + "VALUES " + + "('2023-10-03 14:38:05.000', 10.80000, 223, 0.29000) " + + "('2023-10-03 14:38:06.500', 11.50000, 221, 0.35000)"; + client.Exec(insertQuery); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } } } - } } - -// output: -// Connect to TDengine success -// affectedRows 8 diff --git a/docs/examples/csharp/sqlInsert/sqlinsert.csproj b/docs/examples/csharp/sqlInsert/sqlinsert.csproj index 1b6f745c82..aa8e1402ae 100644 --- a/docs/examples/csharp/sqlInsert/sqlinsert.csproj +++ b/docs/examples/csharp/sqlInsert/sqlinsert.csproj @@ -9,7 +9,7 @@ - + diff --git a/docs/examples/csharp/stmtInsert/Program.cs b/docs/examples/csharp/stmtInsert/Program.cs index 2e856a49bb..e6b11a63e4 100644 --- a/docs/examples/csharp/stmtInsert/Program.cs +++ b/docs/examples/csharp/stmtInsert/Program.cs @@ -1,109 +1,38 @@ -using TDengineDriver; +using TDengine.Driver; +using TDengine.Driver.Client; namespace TDengineExample { internal class StmtInsertExample { - private static IntPtr conn; - private static IntPtr stmt; - static void Main() + public static void Main(string[] args) { - conn = GetConnection(); - try + var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) { - PrepareSTable(); - // 1. init and prepare - stmt = TDengine.StmtInit(conn); - if (stmt == IntPtr.Zero) + try { - throw new Exception("failed to init stmt."); + client.Exec($"create database power"); + client.Exec( + "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"); + using (var stmt = client.StmtInit()) + { + stmt.Prepare( + "Insert into power.d1001 using power.meters tags(2,'California.SanFrancisco') values(?,?,?,?)"); + var ts = new DateTime(2023, 10, 03, 14, 38, 05, 000); + stmt.BindRow(new object[] { ts, (float)10.30000, (int)219, (float)0.31000 }); + stmt.AddBatch(); + stmt.Exec(); + var affected = stmt.Affected(); + Console.WriteLine($"affected rows: {affected}"); + } } - int res = TDengine.StmtPrepare(stmt, "INSERT INTO ? USING meters TAGS(?, ?) VALUES(?, ?, ?, ?)"); - CheckStmtRes(res, "failed to prepare stmt"); - - // 2. bind table name and tags - TAOS_MULTI_BIND[] tags = new TAOS_MULTI_BIND[2] { TaosMultiBind.MultiBindBinary(new string[] { "California.SanFrancisco" }), TaosMultiBind.MultiBindInt(new int?[] { 2 }) }; - res = TDengine.StmtSetTbnameTags(stmt, "d1001", tags); - CheckStmtRes(res, "failed to bind table name and tags"); - - // 3. bind values - TAOS_MULTI_BIND[] values = new TAOS_MULTI_BIND[4] { - TaosMultiBind.MultiBindTimestamp(new long[2] { 1648432611249, 1648432611749}), - TaosMultiBind.MultiBindFloat(new float?[2] { 10.3f, 12.6f}), - TaosMultiBind.MultiBindInt(new int?[2] { 219, 218}), - TaosMultiBind.MultiBindFloat(new float?[2]{ 0.31f, 0.33f}) - }; - res = TDengine.StmtBindParamBatch(stmt, values); - CheckStmtRes(res, "failed to bind params"); - - // 4. add batch - res = TDengine.StmtAddBatch(stmt); - CheckStmtRes(res, "failed to add batch"); - - // 5. execute - res = TDengine.StmtExecute(stmt); - CheckStmtRes(res, "failed to execute"); - - // 6. free - TaosMultiBind.FreeTaosBind(tags); - TaosMultiBind.FreeTaosBind(values); - } - finally - { - TDengine.Close(conn); - } - - } - - static IntPtr GetConnection() - { - string host = "localhost"; - short port = 6030; - string username = "root"; - string password = "taosdata"; - string dbname = ""; - var conn = TDengine.Connect(host, username, password, dbname, port); - if (conn == IntPtr.Zero) - { - throw new Exception("Connect to TDengine failed"); - } - else - { - Console.WriteLine("Connect to TDengine success"); - } - return conn; - } - - static void PrepareSTable() - { - IntPtr res = TDengine.Query(conn, "CREATE DATABASE power WAL_RETENTION_PERIOD 3600"); - CheckResPtr(res, "failed to create database"); - res = TDengine.Query(conn, "USE power"); - CheckResPtr(res, "failed to change database"); - res = TDengine.Query(conn, "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT)"); - CheckResPtr(res, "failed to create stable"); - } - - static void CheckStmtRes(int res, string errorMsg) - { - if (res != 0) - { - Console.WriteLine(errorMsg + ", " + TDengine.StmtErrorStr(stmt)); - int code = TDengine.StmtClose(stmt); - if (code != 0) + catch (Exception e) { - throw new Exception($"failed to close stmt, {code} reason: {TDengine.StmtErrorStr(stmt)} "); + Console.WriteLine(e); + throw; } } } - - static void CheckResPtr(IntPtr res, string errorMsg) - { - if (TDengine.ErrorNo(res) != 0) - { - throw new Exception(errorMsg + " since:" + TDengine.Error(res)); - } - } - } -} +} \ No newline at end of file diff --git a/docs/examples/csharp/stmtInsert/stmtinsert.csproj b/docs/examples/csharp/stmtInsert/stmtinsert.csproj index f5b2b67397..9fa3109b80 100644 --- a/docs/examples/csharp/stmtInsert/stmtinsert.csproj +++ b/docs/examples/csharp/stmtInsert/stmtinsert.csproj @@ -9,7 +9,7 @@ - + diff --git a/docs/examples/csharp/subscribe/Program.cs b/docs/examples/csharp/subscribe/Program.cs index 1fba209f22..d7c1a52117 100644 --- a/docs/examples/csharp/subscribe/Program.cs +++ b/docs/examples/csharp/subscribe/Program.cs @@ -1,95 +1,72 @@ -using System; -using TDengineTMQ; -using TDengineDriver; -using System.Runtime.InteropServices; + +using TDengine.Driver; +using TDengine.Driver.Client; +using TDengine.TMQ; namespace TMQExample { internal class SubscribeDemo { - static void Main(string[] args) + public static void Main(string[] args) { - IntPtr conn = GetConnection(); - string topic = "topic_example"; - //create topic - IntPtr res = TDengine.Query(conn, $"create topic if not exists {topic} as select * from meters"); - - if (TDengine.ErrorNo(res) != 0 ) + var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) { - throw new Exception($"create topic failed, reason:{TDengine.Error(res)}"); - } - - var cfg = new ConsumerConfig - { - GourpId = "group_1", - TDConnectUser = "root", - TDConnectPasswd = "taosdata", - MsgWithTableName = "true", - TDConnectIp = "127.0.0.1", - }; - - // create consumer - var consumer = new ConsumerBuilder(cfg) - .Build(); - - // subscribe - consumer.Subscribe(topic); - - // consume - for (int i = 0; i < 5; i++) - { - var consumeRes = consumer.Consume(300); - // print consumeResult - foreach (KeyValuePair kv in consumeRes.Message) + try { - Console.WriteLine("topic partitions:\n{0}", kv.Key.ToString()); - - kv.Value.Metas.ForEach(meta => + client.Exec("CREATE DATABASE power"); + client.Exec("USE power"); + client.Exec( + "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"); + client.Exec("CREATE TOPIC topic_meters as SELECT * from power.meters"); + var cfg = new Dictionary() { - Console.Write("{0} {1}({2}) \t|", meta.name, meta.TypeName(), meta.size); - }); - Console.WriteLine(""); - kv.Value.Datas.ForEach(data => + { "group.id", "group1" }, + { "auto.offset.reset", "latest" }, + { "td.connect.ip", "127.0.0.1" }, + { "td.connect.user", "root" }, + { "td.connect.pass", "taosdata" }, + { "td.connect.port", "6030" }, + { "client.id", "tmq_example" }, + { "enable.auto.commit", "true" }, + { "msg.with.table.name", "false" }, + }; + var consumer = new ConsumerBuilder>(cfg).Build(); + consumer.Subscribe(new List() { "topic_meters" }); + Task.Run(InsertData); + while (true) { - Console.WriteLine(data.ToString()); - }); + using (var cr = consumer.Consume(500)) + { + if (cr == null) continue; + foreach (var message in cr.Message) + { + Console.WriteLine( + $"message {{{((DateTime)message.Value["ts"]).ToString("yyyy-MM-dd HH:mm:ss.fff")}, " + + $"{message.Value["current"]}, {message.Value["voltage"]}, {message.Value["phase"]}}}"); + } + } + } + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; } - - consumer.Commit(consumeRes); - Console.WriteLine("\n================ {0} done ", i); - } - - // retrieve topic list - List topics = consumer.Subscription(); - topics.ForEach(t => Console.WriteLine("topic name:{0}", t)); - - // unsubscribe - consumer.Unsubscribe(); - - // close consumer after use.Otherwise will lead memory leak. - consumer.Close(); - TDengine.Close(conn); - } - static IntPtr GetConnection() + static void InsertData() { - string host = "localhost"; - short port = 6030; - string username = "root"; - string password = "taosdata"; - string dbname = "power"; - var conn = TDengine.Connect(host, username, password, dbname, port); - if (conn == IntPtr.Zero) + var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) { - throw new Exception("Connect to TDengine failed"); + while (true) + { + client.Exec("INSERT into power.d1001 using power.meters tags(2,'California.SanFrancisco') values(now,11.5,219,0.30)"); + Task.Delay(1000).Wait(); + } } - else - { - Console.WriteLine("Connect to TDengine success"); - } - return conn; } } diff --git a/docs/examples/csharp/subscribe/subscribe.csproj b/docs/examples/csharp/subscribe/subscribe.csproj index 191b3f9e9b..df6618d214 100644 --- a/docs/examples/csharp/subscribe/subscribe.csproj +++ b/docs/examples/csharp/subscribe/subscribe.csproj @@ -9,7 +9,7 @@ - + diff --git a/docs/examples/csharp/wsConnect/Program.cs b/docs/examples/csharp/wsConnect/Program.cs index a534bb8a65..edf0eb31e6 100644 --- a/docs/examples/csharp/wsConnect/Program.cs +++ b/docs/examples/csharp/wsConnect/Program.cs @@ -1,28 +1,18 @@ using System; -using TDengineWS.Impl; +using TDengine.Driver; +using TDengine.Driver.Client; namespace Examples { public class WSConnExample { - static int Main(string[] args) + static void Main(string[] args) { - string DSN = "ws://root:taosdata@127.0.0.1:6041/test"; - IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN); - - if (wsConn == IntPtr.Zero) + var builder = new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) { - Console.WriteLine("get WS connection failed"); - return -1; + Console.WriteLine("connected"); } - else - { - Console.WriteLine("Establish connect success."); - // close connection. - LibTaosWS.WSClose(wsConn); - } - - return 0; } } } diff --git a/docs/examples/csharp/wsConnect/wsConnect.csproj b/docs/examples/csharp/wsConnect/wsConnect.csproj index c7988b6e9c..01ab149af5 100644 --- a/docs/examples/csharp/wsConnect/wsConnect.csproj +++ b/docs/examples/csharp/wsConnect/wsConnect.csproj @@ -6,7 +6,7 @@ - + diff --git a/docs/examples/csharp/wsInsert/Program.cs b/docs/examples/csharp/wsInsert/Program.cs index 7fa6af805c..73136477e7 100644 --- a/docs/examples/csharp/wsInsert/Program.cs +++ b/docs/examples/csharp/wsInsert/Program.cs @@ -1,61 +1,46 @@ using System; -using TDengineWS.Impl; +using TDengine.Driver; +using TDengine.Driver.Client; namespace Examples { public class WSInsertExample { - static int Main(string[] args) + public static void Main(string[] args) { - string DSN = "ws://root:taosdata@127.0.0.1:6041/test"; - IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN); - - // Assert if connection is validate - if (wsConn == IntPtr.Zero) + var builder = new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) { - Console.WriteLine("get WS connection failed"); - return -1; - } - else - { - Console.WriteLine("Establish connect success."); - } - - string createTable = "CREATE STABLE test.meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupId int);"; - string insert = "INSERT INTO test.d1001 USING test.meters TAGS('California.SanFrancisco', 2) VALUES ('2018-10-03 14:38:05.000', 10.30000, 219, 0.31000) ('2018-10-03 14:38:15.000', 12.60000, 218, 0.33000) ('2018-10-03 14:38:16.800', 12.30000, 221, 0.31000)" + - "test.d1002 USING test.meters TAGS('California.SanFrancisco', 3) VALUES('2018-10-03 14:38:16.650', 10.30000, 218, 0.25000)" + - "test.d1003 USING test.meters TAGS('California.LosAngeles', 2) VALUES('2018-10-03 14:38:05.500', 11.80000, 221, 0.28000)('2018-10-03 14:38:16.600', 13.40000, 223, 0.29000) " + - "test.d1004 USING test.meters TAGS('California.LosAngeles', 3) VALUES('2018-10-03 14:38:05.000', 10.80000, 223, 0.29000)('2018-10-03 14:38:06.500', 11.50000, 221, 0.35000)"; - - IntPtr wsRes = LibTaosWS.WSQuery(wsConn, createTable); - ValidInsert("create table", wsRes); - LibTaosWS.WSFreeResult(wsRes); - - wsRes = LibTaosWS.WSQuery(wsConn, insert); - ValidInsert("insert data", wsRes); - LibTaosWS.WSFreeResult(wsRes); - - // close connection. - LibTaosWS.WSClose(wsConn); - - return 0; - } - - static void ValidInsert(string desc, IntPtr wsRes) - { - int code = LibTaosWS.WSErrorNo(wsRes); - if (code != 0) - { - Console.WriteLine($"execute SQL failed: reason: {LibTaosWS.WSErrorStr(wsRes)}, code:{code}"); - } - else - { - Console.WriteLine("{0} success affect {2} rows, cost {1} nanoseconds", desc, LibTaosWS.WSTakeTiming(wsRes), LibTaosWS.WSAffectRows(wsRes)); + try + { + client.Exec("create database power"); + client.Exec("CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"); + string insertQuery = + "INSERT INTO " + + "power.d1001 USING power.meters TAGS(2,'California.SanFrancisco') " + + "VALUES " + + "('2023-10-03 14:38:05.000', 10.30000, 219, 0.31000) " + + "('2023-10-03 14:38:15.000', 12.60000, 218, 0.33000) " + + "('2023-10-03 14:38:16.800', 12.30000, 221, 0.31000) " + + "power.d1002 USING power.meters TAGS(3, 'California.SanFrancisco') " + + "VALUES " + + "('2023-10-03 14:38:16.650', 10.30000, 218, 0.25000) " + + "power.d1003 USING power.meters TAGS(2,'California.LosAngeles') " + + "VALUES " + + "('2023-10-03 14:38:05.500', 11.80000, 221, 0.28000) " + + "('2023-10-03 14:38:16.600', 13.40000, 223, 0.29000) " + + "power.d1004 USING power.meters TAGS(3,'California.LosAngeles') " + + "VALUES " + + "('2023-10-03 14:38:05.000', 10.80000, 223, 0.29000) " + + "('2023-10-03 14:38:06.500', 11.50000, 221, 0.35000)"; + client.Exec(insertQuery); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } } } } - } -// Establish connect success. -// create table success affect 0 rows, cost 3717542 nanoseconds -// insert data success affect 8 rows, cost 2613637 nanoseconds diff --git a/docs/examples/csharp/wsInsert/wsInsert.csproj b/docs/examples/csharp/wsInsert/wsInsert.csproj index 5aa419b2c8..0459e8e38b 100644 --- a/docs/examples/csharp/wsInsert/wsInsert.csproj +++ b/docs/examples/csharp/wsInsert/wsInsert.csproj @@ -6,7 +6,7 @@ enable - + diff --git a/docs/examples/csharp/wsQuery/Program.cs b/docs/examples/csharp/wsQuery/Program.cs index 8ee900a05a..40aac24597 100644 --- a/docs/examples/csharp/wsQuery/Program.cs +++ b/docs/examples/csharp/wsQuery/Program.cs @@ -1,79 +1,36 @@ using System; -using TDengineWS.Impl; -using System.Collections.Generic; -using TDengineDriver; +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; namespace Examples { public class WSQueryExample { - static int Main(string[] args) + public static void Main(string[] args) { - string DSN = "ws://root:taosdata@127.0.0.1:6041/test"; - IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN); - if (wsConn == IntPtr.Zero) + var builder = new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) { - Console.WriteLine("get WS connection failed"); - return -1; - } - else - { - Console.WriteLine("Establish connect success."); - } - - string select = "select * from test.meters"; - - // optional:wsRes = LibTaosWS.WSQuery(wsConn, select); - IntPtr wsRes = LibTaosWS.WSQueryTimeout(wsConn, select, 1); - // Assert if query execute success. - int code = LibTaosWS.WSErrorNo(wsRes); - if (code != 0) - { - Console.WriteLine($"execute SQL failed: reason: {LibTaosWS.WSErrorStr(wsRes)}, code:{code}"); - LibTaosWS.WSFreeResult(wsRes); - return -1; - } - - // get meta data - List metas = LibTaosWS.WSGetFields(wsRes); - // get retrieved data - List dataSet = LibTaosWS.WSGetData(wsRes); - - // do something with result. - foreach (var meta in metas) - { - Console.Write("{0} {1}({2}) \t|\t", meta.name, meta.TypeName(), meta.size); - } - Console.WriteLine(""); - - for (int i = 0; i < dataSet.Count;) - { - for (int j = 0; j < metas.Count; j++) + try { - Console.Write("{0}\t|\t", dataSet[i]); - i++; + client.Exec("use power"); + string query = "SELECT * FROM meters"; + using (var rows = client.Query(query)) + { + while (rows.Read()) + { + Console.WriteLine( + $"{((DateTime)rows.GetValue(0)):yyyy-MM-dd HH:mm:ss.fff}, {rows.GetValue(1)}, {rows.GetValue(2)}, {rows.GetValue(3)}, {rows.GetValue(4)}, {Encoding.UTF8.GetString((byte[])rows.GetValue(5))}"); + } + } + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; } - Console.WriteLine(""); } - - // Free result after use. - LibTaosWS.WSFreeResult(wsRes); - - // close connection. - LibTaosWS.WSClose(wsConn); - - return 0; } } -} - -// Establish connect success. -// ts TIMESTAMP(8) | current FLOAT(4) | voltage INT(4) | phase FLOAT(4) | location BINARY(64) | groupid INT(4) | -// 1538548685000 | 10.8 | 223 | 0.29 | California.LosAngeles | 3 | -// 1538548686500 | 11.5 | 221 | 0.35 | California.LosAngeles | 3 | -// 1538548685500 | 11.8 | 221 | 0.28 | California.LosAngeles | 2 | -// 1538548696600 | 13.4 | 223 | 0.29 | California.LosAngeles | 2 | -// 1538548685000 | 10.3 | 219 | 0.31 | California.SanFrancisco | 2 | -// 1538548695000 | 12.6 | 218 | 0.33 | California.SanFrancisco | 2 | -// 1538548696800 | 12.3 | 221 | 0.31 | California.SanFrancisco | 2 | -// 1538548696650 | 10.3 | 218 | 0.25 | California.SanFrancisco | 3 | +} \ No newline at end of file diff --git a/docs/examples/csharp/wsQuery/wsQuery.csproj b/docs/examples/csharp/wsQuery/wsQuery.csproj index bcc7c19a59..ff283947b4 100644 --- a/docs/examples/csharp/wsQuery/wsQuery.csproj +++ b/docs/examples/csharp/wsQuery/wsQuery.csproj @@ -7,7 +7,7 @@ - + diff --git a/docs/examples/csharp/wsStmt/Program.cs b/docs/examples/csharp/wsStmt/Program.cs index f8673357db..5166dfea92 100644 --- a/docs/examples/csharp/wsStmt/Program.cs +++ b/docs/examples/csharp/wsStmt/Program.cs @@ -1,98 +1,41 @@ using System; -using TDengineWS.Impl; -using TDengineDriver; -using System.Runtime.InteropServices; +using TDengine.Driver; +using TDengine.Driver.Client; namespace Examples { public class WSStmtExample { - static int Main(string[] args) + public static void Main(string[] args) { - const string DSN = "ws://root:taosdata@127.0.0.1:6041/test"; - const string table = "meters"; - const string database = "test"; - const string childTable = "d1005"; - string insert = $"insert into ? using {database}.{table} tags(?,?) values(?,?,?,?)"; - const int numOfTags = 2; - const int numOfColumns = 4; - - // Establish connection - IntPtr wsConn = LibTaosWS.WSConnectWithDSN(DSN); - if (wsConn == IntPtr.Zero) + var builder = + new ConnectionStringBuilder( + "protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) { - Console.WriteLine($"get WS connection failed"); - return -1; - } - else - { - Console.WriteLine("Establish connect success..."); - } - - // init stmt - IntPtr wsStmt = LibTaosWS.WSStmtInit(wsConn); - if (wsStmt != IntPtr.Zero) - { - int code = LibTaosWS.WSStmtPrepare(wsStmt, insert); - ValidStmtStep(code, wsStmt, "WSStmtPrepare"); - - TAOS_MULTI_BIND[] wsTags = new TAOS_MULTI_BIND[] { WSMultiBind.WSBindNchar(new string[] { "California.SanDiego" }), WSMultiBind.WSBindInt(new int?[] { 4 }) }; - code = LibTaosWS.WSStmtSetTbnameTags(wsStmt, $"{database}.{childTable}", wsTags, numOfTags); - ValidStmtStep(code, wsStmt, "WSStmtSetTbnameTags"); - - TAOS_MULTI_BIND[] data = new TAOS_MULTI_BIND[4]; - data[0] = WSMultiBind.WSBindTimestamp(new long[] { 1538548687000, 1538548688000, 1538548689000, 1538548690000, 1538548691000 }); - data[1] = WSMultiBind.WSBindFloat(new float?[] { 10.30F, 10.40F, 10.50F, 10.60F, 10.70F }); - data[2] = WSMultiBind.WSBindInt(new int?[] { 223, 221, 222, 220, 219 }); - data[3] = WSMultiBind.WSBindFloat(new float?[] { 0.31F, 0.32F, 0.33F, 0.35F, 0.28F }); - code = LibTaosWS.WSStmtBindParamBatch(wsStmt, data, numOfColumns); - ValidStmtStep(code, wsStmt, "WSStmtBindParamBatch"); - - code = LibTaosWS.WSStmtAddBatch(wsStmt); - ValidStmtStep(code, wsStmt, "WSStmtAddBatch"); - - IntPtr stmtAffectRowPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Int32))); - code = LibTaosWS.WSStmtExecute(wsStmt, stmtAffectRowPtr); - ValidStmtStep(code, wsStmt, "WSStmtExecute"); - Console.WriteLine("WS STMT insert {0} rows...", Marshal.ReadInt32(stmtAffectRowPtr)); - Marshal.FreeHGlobal(stmtAffectRowPtr); - - LibTaosWS.WSStmtClose(wsStmt); - - // Free unmanaged memory - WSMultiBind.WSFreeTaosBind(wsTags); - WSMultiBind.WSFreeTaosBind(data); - - //check result with SQL "SELECT * FROM test.d1005;" - } - else - { - Console.WriteLine("Init STMT failed..."); - } - - // close connection. - LibTaosWS.WSClose(wsConn); - - return 0; - } - - static void ValidStmtStep(int code, IntPtr wsStmt, string desc) - { - if (code != 0) - { - Console.WriteLine($"{desc} failed,reason: {LibTaosWS.WSErrorStr(wsStmt)}, code: {code}"); - } - else - { - Console.WriteLine("{0} success...", desc); + try + { + client.Exec($"create database power"); + client.Exec( + "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"); + using (var stmt = client.StmtInit()) + { + stmt.Prepare( + "Insert into power.d1001 using power.meters tags(2,'California.SanFrancisco') values(?,?,?,?)"); + var ts = new DateTime(2023, 10, 03, 14, 38, 05, 000); + stmt.BindRow(new object[] { ts, (float)10.30000, (int)219, (float)0.31000 }); + stmt.AddBatch(); + stmt.Exec(); + var affected = stmt.Affected(); + Console.WriteLine($"affected rows: {affected}"); + } + } + catch (Exception e) + { + Console.WriteLine(e); + throw; + } } } } -} - -// WSStmtPrepare success... -// WSStmtSetTbnameTags success... -// WSStmtBindParamBatch success... -// WSStmtAddBatch success... -// WSStmtExecute success... -// WS STMT insert 5 rows... +} \ No newline at end of file diff --git a/docs/examples/csharp/wsStmt/wsStmt.csproj b/docs/examples/csharp/wsStmt/wsStmt.csproj index bcc7c19a59..ff283947b4 100644 --- a/docs/examples/csharp/wsStmt/wsStmt.csproj +++ b/docs/examples/csharp/wsStmt/wsStmt.csproj @@ -7,7 +7,7 @@ - + diff --git a/docs/zh/07-develop/01-connect/index.md b/docs/zh/07-develop/01-connect/index.md index 83032067d9..9d954f78ce 100644 --- a/docs/zh/07-develop/01-connect/index.md +++ b/docs/zh/07-develop/01-connect/index.md @@ -176,7 +176,7 @@ npm install @tdengine/rest - + diff --git a/docs/zh/07-develop/04-query-data/_cs_async.mdx b/docs/zh/07-develop/04-query-data/_cs_async.mdx deleted file mode 100644 index 19c8e58f32..0000000000 --- a/docs/zh/07-develop/04-query-data/_cs_async.mdx +++ /dev/null @@ -1,3 +0,0 @@ -```csharp -{{#include docs/examples/csharp/asyncQuery/Program.cs}} -``` diff --git a/docs/zh/07-develop/04-query-data/index.mdx b/docs/zh/07-develop/04-query-data/index.mdx index d4d6d8192d..e892f9fc8d 100644 --- a/docs/zh/07-develop/04-query-data/index.mdx +++ b/docs/zh/07-develop/04-query-data/index.mdx @@ -16,7 +16,6 @@ import CQuery from "./_c.mdx"; import PhpQuery from "./_php.mdx"; import PyAsync from "./_py_async.mdx"; import NodeAsync from "./_js_async.mdx"; -import CsAsync from "./_cs_async.mdx"; import CAsync from "./_c_async.mdx"; ## 主要查询功能 @@ -175,9 +174,6 @@ Query OK, 6 rows in database (0.005515s) - - - diff --git a/docs/zh/07-develop/07-tmq.mdx b/docs/zh/07-develop/07-tmq.mdx index d3b27fedc3..50913e87c8 100644 --- a/docs/zh/07-develop/07-tmq.mdx +++ b/docs/zh/07-develop/07-tmq.mdx @@ -23,7 +23,7 @@ import CDemo from "./_sub_c.mdx"; 为了实现上述功能,TDengine 会为 WAL (Write-Ahead-Log) 文件自动创建索引以支持快速随机访问,并提供了灵活可配置的文件切换与保留机制:用户可以按需指定 WAL 文件保留的时间以及大小(详见 create database 语句)。通过以上方式将 WAL 改造成了一个保留事件到达顺序的、可持久化的存储引擎(但由于 TSDB 具有远比 WAL 更高的压缩率,我们不推荐保留太长时间,一般来说,不超过几天)。 对于以 topic 形式创建的查询,TDengine 将对接 WAL 而不是 TSDB 作为其存储引擎。在消费时,TDengine 根据当前消费进度从 WAL 直接读取数据,并使用统一的查询引擎实现过滤、变换等操作,将数据推送给消费者。 -下面为关于数据订阅的一些说明,需要对TDengine的架构有一些了解,结合各个语言链接器的接口使用。 +下面为关于数据订阅的一些说明,需要对TDengine的架构有一些了解,结合各个语言链接器的接口使用。(可使用时再了解) - 一个消费组消费同一个topic下的所有数据,不同消费组之间相互独立; - 一个消费组消费同一个topic所有的vgroup,消费组可由多个消费者组成,但一个vgroup仅被一个消费者消费,如果消费者数量超过了vgroup数量,多余的消费者不消费数据; - 在服务端每个vgroup仅保存一个offset,每个vgroup的offset是单调递增的,但不一定连续。各个vgroup的offset之间没有关联; @@ -45,12 +45,13 @@ import CDemo from "./_sub_c.mdx"; 本文档不对消息队列本身的知识做更多的介绍,如果需要了解,请自行搜索。 +说明: 从3.2.0.0版本开始,数据订阅支持vnode迁移和分裂。 由于数据订阅依赖wal文件,而在vnode迁移和分裂的过程中,wal并不会同步过去,所以迁移或分裂后,之前没消费完的wal数据后消费不到。所以请保证之前把数据全部消费完后,再进行vnode迁移或分裂,否则,消费会丢失数据。 ## 主要数据结构和 API -不同语言下, TMQ 订阅相关的 API 及数据结构如下: +不同语言下, TMQ 订阅相关的 API 及数据结构如下(注意consumer结构不是线程安全的,在一个线程使用consumer时,不要在另一个线程close这个consumer): @@ -248,23 +249,23 @@ function close() ```csharp +class ConsumerBuilder + ConsumerBuilder(IEnumerable> config) -virtual IConsumer Build() - -Consumer(ConsumerBuilder builder) +public IConsumer Build() void Subscribe(IEnumerable topics) void Subscribe(string topic) -ConsumeResult Consume(int millisecondsTimeout) +ConsumeResult Consume(int millisecondsTimeout) List Subscription() void Unsubscribe() -void Commit(ConsumeResult consumerResult) +List Commit() void Close() ``` @@ -501,25 +502,19 @@ let consumer = taos.consumer({ ```csharp -using TDengineTMQ; - -// 根据需要,设置消费组 (GourpId)、自动提交 (EnableAutoCommit)、 -// 自动提交时间间隔 (AutoCommitIntervalMs)、用户名 (TDConnectUser)、密码 (TDConnectPasswd) 等参数 -var cfg = new ConsumerConfig - { - EnableAutoCommit = "true" - AutoCommitIntervalMs = "1000" - GourpId = "TDengine-TMQ-C#", - TDConnectUser = "root", - TDConnectPasswd = "taosdata", - AutoOffsetReset = "latest" - MsgWithTableName = "true", - TDConnectIp = "127.0.0.1", - TDConnectPort = "6030" - }; - -var consumer = new ConsumerBuilder(cfg).Build(); - +var cfg = new Dictionary() +{ + { "group.id", "group1" }, + { "auto.offset.reset", "latest" }, + { "td.connect.ip", "127.0.0.1" }, + { "td.connect.user", "root" }, + { "td.connect.pass", "taosdata" }, + { "td.connect.port", "6030" }, + { "client.id", "tmq_example" }, + { "enable.auto.commit", "true" }, + { "msg.with.table.name", "false" }, +}; +var consumer = new ConsumerBuilder>(cfg).Build(); ``` @@ -748,10 +743,12 @@ while(true){ // 消费数据 while (true) { - var consumerRes = consumer.Consume(100); - // process ConsumeResult - ProcessMsg(consumerRes); - consumer.Commit(consumerRes); + using (var result = consumer.Consume(500)) + { + if (result == null) continue; + ProcessMsg(result); + consumer.Commit(); + } } ``` diff --git a/docs/zh/08-connector/40-csharp.mdx b/docs/zh/08-connector/40-csharp.mdx index 325c71da88..f88002d3dc 100644 --- a/docs/zh/08-connector/40-csharp.mdx +++ b/docs/zh/08-connector/40-csharp.mdx @@ -1,27 +1,22 @@ --- toc_max_heading_level: 4 sidebar_label: C# -title: C# Connector +title: TDengine C# Connector --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -import Preparation from "./_preparation.mdx" -import CSInsert from "../07-develop/03-insert-data/_cs_sql.mdx" -import CSInfluxLine from "../07-develop/03-insert-data/_cs_line.mdx" -import CSOpenTSDBTelnet from "../07-develop/03-insert-data/_cs_opts_telnet.mdx" -import CSOpenTSDBJson from "../07-develop/03-insert-data/_cs_opts_json.mdx" -import CSQuery from "../07-develop/04-query-data/_cs.mdx" -import CSAsyncQuery from "../07-develop/04-query-data/_cs_async.mdx" - `TDengine.Connector` 是 TDengine 提供的 C# 语言连接器。C# 开发人员可以通过它开发存取 TDengine 集群数据的 C# 应用软件。 -`TDengine.Connector` 连接器支持通过 TDengine 客户端驱动(taosc)建立与 TDengine 运行实例的连接,提供数据写入、查询、数据订阅、schemaless 数据写入、参数绑定接口数据写入等功能。 `TDengine.Connector` 自 v3.0.1 起还支持 WebSocket,通过 DSN 建立 WebSocket 连接,提供数据写入、查询、参数绑定接口数据写入等功能。 +`TDengine.Connector` 连接器支持通过 TDengine 客户端驱动(taosc)建立与 TDengine 运行实例的连接,提供数据写入、查询、数据订阅、schemaless 数据写入、参数绑定接口数据写入等功能。 `TDengine.Connector` 自 v3.0.1 起还支持 WebSocket 连接,提供数据写入、查询、参数绑定接口数据写入等功能。 本文介绍如何在 Linux 或 Windows 环境中安装 `TDengine.Connector`,并通过 `TDengine.Connector` 连接 TDengine 集群,进行数据写入、查询等基本操作。 -注意:`TDengine.Connector` 3.x 不兼容 TDengine 2.x,如果在运行 TDengine 2.x 版本的环境下需要使用 C# 连接器请使用 TDengine.Connector 的 1.x 版本 。 +:::warning +* `TDengine.Connector` 3.1.0 版本进行了完整的重构,不再兼容 3.0.2 及以前版本。3.0.2 文档请参考 [nuget](https://www.nuget.org/packages/TDengine.Connector/3.0.2) +* `TDengine.Connector` 3.x 不兼容 TDengine 2.x,如果在运行 TDengine 2.x 版本的环境下需要使用 C# 连接器请使用 TDengine.Connector 的 1.x 版本。 +::: `TDengine.Connector` 的源码托管在 [GitHub](https://github.com/taosdata/taos-connector-dotnet/tree/3.0)。 @@ -29,39 +24,43 @@ import CSAsyncQuery from "../07-develop/04-query-data/_cs_async.mdx" 支持的平台和 TDengine 客户端驱动支持的平台一致。 -:::note -注意 TDengine 不再支持 32 位 Windows 平台。 +:::warning +TDengine 不再支持 32 位 Windows 平台。 ::: ## 版本支持 -请参考[版本支持列表](../#版本支持) +| **Connector version** | **TDengine version** | +|-----------------------|----------------------| +| 3.1.0 | 3.2.1.0/3.1.1.18 | -## 支持的功能特性 +## 处理异常 - +`TDengine.Connector` 会抛出异常,应用程序需要处理异常。taosc 异常类型 `TDengineError`,包含错误码和错误信息,应用程序可以根据错误码和错误信息进行处理。 - +## TDengine DataType 和 C# DataType -1. 连接管理 -2. 普通查询 -3. 连续查询 -4. 参数绑定 -5. 数据订阅(TMQ) -6. Schemaless - - +| TDengine DataType | C# Type | +|-------------------|------------------| +| TIMESTAMP | DateTime | +| TINYINT | sbyte | +| SMALLINT | short | +| INT | int | +| BIGINT | long | +| TINYINT UNSIGNED | byte | +| SMALLINT UNSIGNED | ushort | +| INT UNSIGNED | uint | +| BIGINT UNSIGNED | ulong | +| FLOAT | float | +| DOUBLE | double | +| BOOL | bool | +| BINARY | byte[] | +| NCHAR | string (utf-8编码) | +| JSON | byte[] | - - -1. 连接管理 -2. 普通查询 -3. 连续查询 -4. 参数绑定 - - - - +:::note +JSON 类型仅在 tag 中支持。 +::: ## 安装步骤 @@ -71,10 +70,7 @@ import CSAsyncQuery from "../07-develop/04-query-data/_cs_async.mdx" * [Nuget 客户端](https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools) (可选安装) * 安装 TDengine 客户端驱动,具体步骤请参考[安装客户端驱动](../#安装客户端驱动) -### 安装 TDengine.Connector - - - +### 安装连接器 可以在当前 .NET 项目的路径下,通过 dotnet CLI 添加 Nuget package `TDengine.Connector` 到当前项目。 @@ -86,234 +82,1109 @@ dotnet add package TDengine.Connector ``` XML - + ``` - - - - -需要修改目标项目的 `.csproj` 项目文件,将 `.nupkg` 中的 `runtimes` 目录中的动态库复制到当前项目的 `$(OutDir)` 目录下。 - -```XML - - - - - - - - - -``` - -注意:`TDengine.Connector` 自 version>= 3.0.2 的 nuget package 中才会有动态库( taosws.dll,libtaows.so )。 - - - - ## 建立连接 - - + -使用 host、username、password、port 等信息建立连接。 - ``` csharp -using TDengineDriver; - -namespace TDengineExample +var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); +using (var client = DbDriver.Open(builder)) { + Console.WriteLine("connected"); +} +``` - internal class EstablishConnection + + + +```csharp +var builder = new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); +using (var client = DbDriver.Open(builder)) +{ + Console.WriteLine("connected"); +} +``` + + + +ConnectionStringBuilder 支持的参数如下: +* protocol: 连接协议,可选值为 Native 或 WebSocket,默认为 Native +* host: TDengine 或 taosadapter 运行实例的地址 +* port: TDengine 或 taosadapter 运行实例的端口 + * 当 protocol 为 WebSocket 时 useSSL 为 false 时,port 默认为 6041 + * 当 protocol 为 WebSocket 时 useSSL 为 true 时,port 默认为 443 +* useSSL: 是否使用 SSL 连接,仅当 protocol 为 WebSocket 时有效,默认为 false +* token: 连接 TDengine cloud 的 token,仅当 protocol 为 WebSocket 时有效 +* username: 连接 TDengine 的用户名 +* password: 连接 TDengine 的密码 +* db: 连接 TDengine 的数据库 +* timezone: 解析时间结果的时区,默认为 `TimeZoneInfo.Local`,使用 `TimeZoneInfo.FindSystemTimeZoneById` 方法解析字符串为 `TimeZoneInfo` 对象。 +* connTimeout: WebSocket 连接超时时间,仅当 protocol 为 WebSocket 时有效,默认为 1 分钟,使用 `TimeSpan.Parse` 方法解析字符串为 `TimeSpan` 对象。 +* readTimeout: WebSocket 读超时时间,仅当 protocol 为 WebSocket 时有效,默认为 5 分钟,使用 `TimeSpan.Parse` 方法解析字符串为 `TimeSpan` 对象。 +* writeTimeout: WebSocket 写超时时间,仅当 protocol 为 WebSocket 时有效,默认为 10 秒,使用 `TimeSpan.Parse` 方法解析字符串为 `TimeSpan` 对象。 + +### 指定 URL 和 Properties 获取连接 + +C# 连接器不支持此功能 + +### 配置参数的优先级 + +C# 连接器不支持此功能 + +## 使用示例 + +### 创建数据库和表 + + + + +```csharp +using System; +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace NativeQuery +{ + internal class Query { - static void Main(String[] args) + public static void Main(string[] args) { - string host = "localhost"; - short port = 6030; - string username = "root"; - string password = "taosdata"; - string dbname = ""; - - var conn = TDengine.Connect(host, username, password, dbname, port); - if (conn == IntPtr.Zero) + var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) { - Console.WriteLine("Connect to TDengine failed"); + try + { + client.Exec("create database power"); + client.Exec("CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } } - else - { - Console.WriteLine("Connect to TDengine success"); - } - TDengine.Close(conn); - TDengine.Cleanup(); } } } ``` + - +```csharp +using System; +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; -使用 DSN 建立 WebSocket 连接 DSN 连接。 描述字符串基本结构如下: - -```text -[]://[[:@]:][/][?=[&=]] -|------------|---|-----------|-----------|------|------|------------|-----------------------| -| protocol | | username | password | host | port | database | params | -``` - -各部分意义见下表: - -* **protocol**: 显示指定以何种方式建立连接,例如:`ws://localhost:6041` 指定以 Websocket 方式建立连接(支持 http/ws )。 - -* **username/password**: 用于创建连接的用户名及密码(默认 `root/taosdata` )。 - -* **host/port**: 指定创建连接的服务器及端口,WebSocket 连接默认为 `localhost:6041` 。 - -* **database**: 指定默认连接的数据库名,可选参数。 - -* **params**:其他可选参数。 - -``` csharp -{{#include docs/examples/csharp/wsConnect/Program.cs}} +namespace WSQuery +{ + internal class Query + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec("create database power"); + client.Exec("CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + } +} ``` -## 使用示例 - -### 写入数据 - -#### SQL 写入 - - +### 插入数据 + - +```csharp +using System; +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace NativeQuery +{ + internal class Query + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + string insertQuery = + "INSERT INTO " + + "power.d1001 USING power.meters TAGS(2,'California.SanFrancisco') " + + "VALUES " + + "('2023-10-03 14:38:05.000', 10.30000, 219, 0.31000) " + + "('2023-10-03 14:38:15.000', 12.60000, 218, 0.33000) " + + "('2023-10-03 14:38:16.800', 12.30000, 221, 0.31000) " + + "power.d1002 USING power.meters TAGS(3, 'California.SanFrancisco') " + + "VALUES " + + "('2023-10-03 14:38:16.650', 10.30000, 218, 0.25000) " + + "power.d1003 USING power.meters TAGS(2,'California.LosAngeles') " + + "VALUES " + + "('2023-10-03 14:38:05.500', 11.80000, 221, 0.28000) " + + "('2023-10-03 14:38:16.600', 13.40000, 223, 0.29000) " + + "power.d1004 USING power.meters TAGS(3,'California.LosAngeles') " + + "VALUES " + + "('2023-10-03 14:38:05.000', 10.80000, 223, 0.29000) " + + "('2023-10-03 14:38:06.500', 11.50000, 221, 0.35000)"; + client.Exec(insertQuery); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + } +} +``` - - + ```csharp -{{#include docs/examples/csharp/wsInsert/Program.cs}} +using System; +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace WSQuery +{ + internal class Query + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + string insertQuery = + "INSERT INTO " + + "power.d1001 USING power.meters TAGS(2,'California.SanFrancisco') " + + "VALUES " + + "('2023-10-03 14:38:05.000', 10.30000, 219, 0.31000) " + + "('2023-10-03 14:38:15.000', 12.60000, 218, 0.33000) " + + "('2023-10-03 14:38:16.800', 12.30000, 221, 0.31000) " + + "power.d1002 USING power.meters TAGS(3, 'California.SanFrancisco') " + + "VALUES " + + "('2023-10-03 14:38:16.650', 10.30000, 218, 0.25000) " + + "power.d1003 USING power.meters TAGS(2,'California.LosAngeles') " + + "VALUES " + + "('2023-10-03 14:38:05.500', 11.80000, 221, 0.28000) " + + "('2023-10-03 14:38:16.600', 13.40000, 223, 0.29000) " + + "power.d1004 USING power.meters TAGS(3,'California.LosAngeles') " + + "VALUES " + + "('2023-10-03 14:38:05.000', 10.80000, 223, 0.29000) " + + "('2023-10-03 14:38:06.500', 11.50000, 221, 0.35000)"; + client.Exec(insertQuery); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + } +} ``` - - - -#### InfluxDB 行协议写入 - - - -#### OpenTSDB Telnet 行协议写入 - - - -#### OpenTSDB JSON 行协议写入 - - - -#### 参数绑定 - - - - - -``` csharp -{{#include docs/examples/csharp/stmtInsert/Program.cs}} -``` - - - - - -```csharp -{{#include docs/examples/csharp/wsStmt/Program.cs}} -``` - - - ### 查询数据 -#### 同步查询 - - - + - - - - - - ```csharp -{{#include docs/examples/csharp/wsQuery/Program.cs}} +using System; +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace NativeQuery +{ + internal class Query + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec("use power"); + string query = "SELECT * FROM meters"; + using (var rows = client.Query(query)) + { + while (rows.Read()) + { + Console.WriteLine($"{((DateTime)rows.GetValue(0)):yyyy-MM-dd HH:mm:ss.fff}, {rows.GetValue(1)}, {rows.GetValue(2)}, {rows.GetValue(3)}, {rows.GetValue(4)}, {Encoding.UTF8.GetString((byte[])rows.GetValue(5))}"); + } + } + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + } +} ``` + +```csharp +using System; +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace WSQuery +{ + internal class Query + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec("use power"); + string query = "SELECT * FROM meters"; + using (var rows = client.Query(query)) + { + while (rows.Read()) + { + Console.WriteLine($"{((DateTime)rows.GetValue(0)):yyyy-MM-dd HH:mm:ss.fff}, {rows.GetValue(1)}, {rows.GetValue(2)}, {rows.GetValue(3)}, {rows.GetValue(4)}, {Encoding.UTF8.GetString((byte[])rows.GetValue(5))}"); + } + } + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + } +} +``` + + -#### 异步查询 +### 执行带有 reqId 的 SQL - + + + +```csharp +using System; +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace NativeQueryWithReqID +{ + internal abstract class QueryWithReqID + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec($"create database if not exists test_db",ReqId.GetReqId()); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + } +} +``` + + + + +```csharp +using System; +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace WSQueryWithReqID +{ + internal abstract class QueryWithReqID + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec($"create database if not exists test_db",ReqId.GetReqId()); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + } +} +``` + + + + +### 通过参数绑定写入数据 + + + + +```csharp +using System; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace NativeStmt +{ + internal abstract class NativeStmt + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec("create database power"); + client.Exec( + "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"); + using (var stmt = client.StmtInit()) + { + stmt.Prepare( + "Insert into power.d1001 using power.meters tags(2,'California.SanFrancisco') values(?,?,?,?)"); + var ts = new DateTime(2023, 10, 03, 14, 38, 05, 000); + stmt.BindRow(new object[] { ts, (float)10.30000, (int)219, (float)0.31000 }); + stmt.AddBatch(); + stmt.Exec(); + var affected = stmt.Affected(); + Console.WriteLine($"affected rows: {affected}"); + } + } + catch (Exception e) + { + Console.WriteLine(e); + throw; + } + } + } + } +} +``` + + + + +```csharp +using System; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace WSStmt +{ + internal abstract class WSStmt + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec("create database power"); + client.Exec( + "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"); + using (var stmt = client.StmtInit()) + { + stmt.Prepare( + "Insert into power.d1001 using power.meters tags(2,'California.SanFrancisco') values(?,?,?,?)"); + var ts = new DateTime(2023, 10, 03, 14, 38, 05, 000); + stmt.BindRow(new object[] { ts, (float)10.30000, (int)219, (float)0.31000 }); + stmt.AddBatch(); + stmt.Exec(); + var affected = stmt.Affected(); + Console.WriteLine($"affected rows: {affected}"); + } + } + catch (Exception e) + { + Console.WriteLine(e); + throw; + } + } + } + } +} +``` + + + + +注意:使用 BindRow 需要注意原始 C# 列类型与 TDengine 列类型的需要一一对应,具体对应关系请参考 [TDengine DataType 和 C# DataType](#tdengine-datatype-和-c-datatype)。 + +### 无模式写入 + + + + +```csharp +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace NativeSchemaless +{ + internal class Program + { + public static void Main(string[] args) + { + var builder = + new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + client.Exec("create database sml"); + client.Exec("use sml"); + var influxDBData = + "st,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000"; + client.SchemalessInsert(new string[] { influxDBData }, + TDengineSchemalessProtocol.TSDB_SML_LINE_PROTOCOL, + TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_NANO_SECONDS, 0, ReqId.GetReqId()); + var telnetData = "stb0_0 1626006833 4 host=host0 interface=eth0"; + client.SchemalessInsert(new string[] { telnetData }, + TDengineSchemalessProtocol.TSDB_SML_TELNET_PROTOCOL, + TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_MILLI_SECONDS, 0, ReqId.GetReqId()); + var jsonData = + "{\"metric\": \"meter_current\",\"timestamp\": 1626846400,\"value\": 10.3, \"tags\": {\"groupid\": 2, \"location\": \"California.SanFrancisco\", \"id\": \"d1001\"}}"; + client.SchemalessInsert(new string[] { jsonData }, TDengineSchemalessProtocol.TSDB_SML_JSON_PROTOCOL, + TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_MILLI_SECONDS, 0, ReqId.GetReqId()); + } + } + } +} +``` + + + + +```csharp +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace WSSchemaless +{ + internal class Program + { + public static void Main(string[] args) + { + var builder = + new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + client.Exec("create database sml"); + client.Exec("use sml"); + var influxDBData = + "st,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000"; + client.SchemalessInsert(new string[] { influxDBData }, + TDengineSchemalessProtocol.TSDB_SML_LINE_PROTOCOL, + TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_NANO_SECONDS, 0, ReqId.GetReqId()); + var telnetData = "stb0_0 1626006833 4 host=host0 interface=eth0"; + client.SchemalessInsert(new string[] { telnetData }, + TDengineSchemalessProtocol.TSDB_SML_TELNET_PROTOCOL, + TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_MILLI_SECONDS, 0, ReqId.GetReqId()); + var jsonData = + "{\"metric\": \"meter_current\",\"timestamp\": 1626846400,\"value\": 10.3, \"tags\": {\"groupid\": 2, \"location\": \"California.SanFrancisco\", \"id\": \"d1001\"}}"; + client.SchemalessInsert(new string[] { jsonData }, TDengineSchemalessProtocol.TSDB_SML_JSON_PROTOCOL, + TDengineSchemalessPrecision.TSDB_SML_TIMESTAMP_MILLI_SECONDS, 0, ReqId.GetReqId()); + } + } + } +} +``` + + + + +### 执行带有 reqId 的无模式写入 + +```csharp +public void SchemalessInsert(string[] lines, TDengineSchemalessProtocol protocol, + TDengineSchemalessPrecision precision, + int ttl, long reqId) +``` + +### 数据订阅 + +#### 创建 Topic + + + + +```csharp +using System; +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace NativeSubscription +{ + internal class Program + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec("create database power"); + client.Exec("CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"); + client.Exec("CREATE TOPIC topic_meters as SELECT * from power.meters"); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + } +} +``` + + + + +```csharp +using System; +using System.Text; +using TDengine.Driver; +using TDengine.Driver.Client; + +namespace WSSubscription +{ + internal class Program + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec("create database power"); + client.Exec("CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"); + client.Exec("CREATE TOPIC topic_meters as SELECT * from power.meters"); + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + } +} +``` + + + + +#### 创建 Consumer + + + + +```csharp +var cfg = new Dictionary() +{ + { "group.id", "group1" }, + { "auto.offset.reset", "latest" }, + { "td.connect.ip", "127.0.0.1" }, + { "td.connect.user", "root" }, + { "td.connect.pass", "taosdata" }, + { "td.connect.port", "6030" }, + { "client.id", "tmq_example" }, + { "enable.auto.commit", "true" }, + { "msg.with.table.name", "false" }, +}; +var consumer = new ConsumerBuilder>(cfg).Build(); +``` + + + + +```csharp +var cfg = new Dictionary() +{ + { "td.connect.type", "WebSocket" }, + { "group.id", "group1" }, + { "auto.offset.reset", "latest" }, + { "td.connect.ip", "localhost" }, + { "td.connect.port", "6041" }, + { "useSSL", "false" }, + { "td.connect.user", "root" }, + { "td.connect.pass", "taosdata" }, + { "client.id", "tmq_example" }, + { "enable.auto.commit", "true" }, + { "msg.with.table.name", "false" }, +}; +var consumer = new ConsumerBuilder>(cfg).Build(); +``` + + + + +consumer 支持的配置参数如下: +* td.connect.type: 连接类型,可选值为 Native 或 WebSocket,默认为 Native +* td.connect.ip: TDengine 或 taosadapter 运行实例的地址 +* td.connect.port: TDengine 或 taosadapter 运行实例的端口 + * 当 td.connect.type 为 WebSocket 且 useSSL 为 false 时,td.connect.port 默认为 6041 + * 当 td.connect.type 为 WebSocket 且 useSSL 为 true 时,td.connect.port 默认为 443 +* useSSL: 是否使用 SSL 连接,仅当 td.connect.type 为 WebSocket 时有效,默认为 false +* token: 连接 TDengine cloud 的 token,仅当 td.connect.type 为 WebSocket 时有效 + +* td.connect.user: 连接 TDengine 的用户名 +* td.connect.pass: 连接 TDengine 的密码 +* group.id: 消费者组 ID +* client.id: 消费者 ID +* enable.auto.commit: 是否自动提交 offset,默认为 true +* auto.commit.interval.ms: 自动提交 offset 的间隔时间,默认为 5000 毫秒 +* auto.offset.reset: 当 offset 不存在时,从哪里开始消费,可选值为 earliest 或 latest,默认为 latest +* msg.with.table.name: 消息是否包含表名 + + +支持订阅结果集 `Dictionary` key 为列名,value 为列值。 + +如果使用 object 接收列值,需要注意: +* 原始 C# 列类型与 TDengine 列类型的需要一一对应,具体对应关系请参考 [TDengine DataType 和 C# DataType](#tdengine-datatype-和-c-datatype)。 +* 列名与 class 属性名一致,并可读写。 +* 明确设置 value 解析器`ConsumerBuilder.SetValueDeserializer(new ReferenceDeserializer());` + +样例如下 + +结果 class + +```csharp + class Result + { + public DateTime ts { get; set; } + public float current { get; set; } + public int voltage { get; set; } + public float phase { get; set; } + } +``` + +设置解析器 + +```csharp +var tmqBuilder = new ConsumerBuilder(cfg); +tmqBuilder.SetValueDeserializer(new ReferenceDeserializer()); +var consumer = tmqBuilder.Build(); +``` + +也可实现自定义解析器,实现 `IDeserializer` 接口并通过`ConsumerBuilder.SetValueDeserializer`方法传入。 + +```csharp + public interface IDeserializer + { + T Deserialize(ITMQRows data, bool isNull, SerializationContext context); + } +``` + +#### 订阅消费数据 + +```csharp +consumer.Subscribe(new List() { "topic_meters" }); +while (true) +{ + using (var cr = consumer.Consume(500)) + { + if (cr == null) continue; + foreach (var message in cr.Message) + { + Console.WriteLine( + $"message {{{((DateTime)message.Value["ts"]).ToString("yyyy-MM-dd HH:mm:ss.fff")}, " + + $"{message.Value["current"]}, {message.Value["voltage"]}, {message.Value["phase"]}}}"); + } + } +} +``` + +#### 指定订阅 Offset + +```csharp +consumer.Assignment.ForEach(a => +{ + Console.WriteLine($"{a}, seek to 0"); + consumer.Seek(new TopicPartitionOffset(a.Topic, a.Partition, 0)); + Thread.Sleep(TimeSpan.FromSeconds(1)); +}); +``` + +#### 提交 Offset + +```csharp +public void Commit(ConsumeResult consumerResult) +public List Commit() +public void Commit(IEnumerable offsets) +``` + +#### 关闭订阅 + +```csharp +consumer.Unsubscribe(); +consumer.Close(); +``` + +#### 完整示例 + + + + +```csharp +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using TDengine.Driver; +using TDengine.Driver.Client; +using TDengine.TMQ; + +namespace NativeSubscription +{ + internal class Program + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec("CREATE DATABASE power"); + client.Exec("USE power"); + client.Exec( + "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"); + client.Exec("CREATE TOPIC topic_meters as SELECT * from power.meters"); + var cfg = new Dictionary() + { + { "group.id", "group1" }, + { "auto.offset.reset", "latest" }, + { "td.connect.ip", "127.0.0.1" }, + { "td.connect.user", "root" }, + { "td.connect.pass", "taosdata" }, + { "td.connect.port", "6030" }, + { "client.id", "tmq_example" }, + { "enable.auto.commit", "true" }, + { "msg.with.table.name", "false" }, + }; + var consumer = new ConsumerBuilder>(cfg).Build(); + consumer.Subscribe(new List() { "topic_meters" }); + Task.Run(InsertData); + while (true) + { + using (var cr = consumer.Consume(500)) + { + if (cr == null) continue; + foreach (var message in cr.Message) + { + Console.WriteLine( + $"message {{{((DateTime)message.Value["ts"]).ToString("yyyy-MM-dd HH:mm:ss.fff")}, " + + $"{message.Value["current"]}, {message.Value["voltage"]}, {message.Value["phase"]}}}"); + } + consumer.Commit(); + } + } + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + + static void InsertData() + { + var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + while (true) + { + client.Exec("INSERT into power.d1001 using power.meters tags(2,'California.SanFrancisco') values(now,11.5,219,0.30)"); + Task.Delay(1000).Wait(); + } + } + } + } +} +``` + + + + +```csharp +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using TDengine.Driver; +using TDengine.Driver.Client; +using TDengine.TMQ; + +namespace WSSubscription +{ + internal class Program + { + public static void Main(string[] args) + { + var builder = new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + try + { + client.Exec("CREATE DATABASE power"); + client.Exec("USE power"); + client.Exec( + "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"); + client.Exec("CREATE TOPIC topic_meters as SELECT * from power.meters"); + var cfg = new Dictionary() + { + { "td.connect.type", "WebSocket" }, + { "group.id", "group1" }, + { "auto.offset.reset", "latest" }, + { "td.connect.ip", "localhost" }, + { "td.connect.port", "6041" }, + { "useSSL", "false" }, + { "td.connect.user", "root" }, + { "td.connect.pass", "taosdata" }, + { "client.id", "tmq_example" }, + { "enable.auto.commit", "true" }, + { "msg.with.table.name", "false" }, + }; + var consumer = new ConsumerBuilder>(cfg).Build(); + consumer.Subscribe(new List() { "topic_meters" }); + Task.Run(InsertData); + while (true) + { + using (var cr = consumer.Consume(500)) + { + if (cr == null) continue; + foreach (var message in cr.Message) + { + Console.WriteLine( + $"message {{{((DateTime)message.Value["ts"]).ToString("yyyy-MM-dd HH:mm:ss.fff")}, " + + $"{message.Value["current"]}, {message.Value["voltage"]}, {message.Value["phase"]}}}"); + } + consumer.Commit(); + } + } + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + } + + static void InsertData() + { + var builder = new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"); + using (var client = DbDriver.Open(builder)) + { + while (true) + { + client.Exec("INSERT into power.d1001 using power.meters tags(2,'California.SanFrancisco') values(now,11.5,219,0.30)"); + Task.Delay(1000).Wait(); + } + } + } + } +} +``` + + + + +### ADO.NET + +C# 连接器支持 ADO.NET 接口,可以通过 ADO.NET 接口连接 TDengine 运行实例,进行数据写入、查询等操作。 + + + + +```csharp +using System; +using TDengine.Data.Client; + +namespace NativeADO +{ + internal class Program + { + public static void Main(string[] args) + { + const string connectionString = "host=localhost;port=6030;username=root;password=taosdata"; + using (var connection = new TDengineConnection(connectionString)) + { + try + { + connection.Open(); + using (var command = new TDengineCommand(connection)) + { + command.CommandText = "create database power"; + command.ExecuteNonQuery(); + connection.ChangeDatabase("power"); + command.CommandText = + "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"; + command.ExecuteNonQuery(); + command.CommandText = "INSERT INTO " + + "power.d1001 USING power.meters TAGS(2,'California.SanFrancisco') " + + "VALUES " + + "(?,?,?,?)"; + var parameters = command.Parameters; + parameters.Add(new TDengineParameter("@0", new DateTime(2023,10,03,14,38,05,000))); + parameters.Add(new TDengineParameter("@1", (float)10.30000)); + parameters.Add(new TDengineParameter("@2", (int)219)); + parameters.Add(new TDengineParameter("@3", (float)0.31000)); + command.ExecuteNonQuery(); + command.Parameters.Clear(); + command.CommandText = "SELECT * FROM meters"; + using (var reader = command.ExecuteReader()) + { + while (reader.Read()) + { + Console.WriteLine( + $"{((DateTime) reader.GetValue(0)):yyyy-MM-dd HH:mm:ss.fff}, {reader.GetValue(1)}, {reader.GetValue(2)}, {reader.GetValue(3)}, {reader.GetValue(4)}, {System.Text.Encoding.UTF8.GetString((byte[]) reader.GetValue(5))}"); + } + } + } + } + catch (Exception e) + { + Console.WriteLine(e); + throw; + } + } + } + } +} +``` + + + + +```csharp +using System; +using TDengine.Data.Client; + +namespace WSADO +{ + internal class Program + { + public static void Main(string[] args) + { + const string connectionString = "protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata"; + using (var connection = new TDengineConnection(connectionString)) + { + try + { + connection.Open(); + using (var command = new TDengineCommand(connection)) + { + command.CommandText = "create database power"; + command.ExecuteNonQuery(); + connection.ChangeDatabase("power"); + command.CommandText = + "CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))"; + command.ExecuteNonQuery(); + command.CommandText = "INSERT INTO " + + "power.d1001 USING power.meters TAGS(2,'California.SanFrancisco') " + + "VALUES " + + "(?,?,?,?)"; + var parameters = command.Parameters; + parameters.Add(new TDengineParameter("@0", new DateTime(2023,10,03,14,38,05,000))); + parameters.Add(new TDengineParameter("@1", (float)10.30000)); + parameters.Add(new TDengineParameter("@2", (int)219)); + parameters.Add(new TDengineParameter("@3", (float)0.31000)); + command.ExecuteNonQuery(); + command.Parameters.Clear(); + command.CommandText = "SELECT * FROM meters"; + using (var reader = command.ExecuteReader()) + { + while (reader.Read()) + { + Console.WriteLine( + $"{((DateTime) reader.GetValue(0)):yyyy-MM-dd HH:mm:ss.fff}, {reader.GetValue(1)}, {reader.GetValue(2)}, {reader.GetValue(3)}, {reader.GetValue(4)}, {System.Text.Encoding.UTF8.GetString((byte[]) reader.GetValue(5))}"); + } + } + } + } + catch (Exception e) + { + Console.WriteLine(e); + throw; + } + } + } + } +} +``` + + + + +* 连接参数与[建立连接](#建立连接)中的连接参数一致。 +* TDengineParameter 的 name 需要以 @ 开头,如 @0、@1、@2 等,value 需要 C# 列类型与 TDengine 列类型一一对应,具体对应关系请参考 [TDengine DataType 和 C# DataType](#tdengine-datatype-和-c-datatype)。 ### 更多示例程序 -|示例程序 | 示例程序描述 | -|--------------------------------------------------------------------------------------------------------------------|--------------------------------------------| -| [CURD](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/NET6Examples/Query/Query.cs) | 使用 TDengine.Connector 实现的建表、插入、查询示例 | -| [JSON Tag](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/NET6Examples/JSONTag) | 使用 TDengine.Connector 实现的写入和查询 JSON tag 类型数据的示例 | -| [stmt](https://github.com/taosdata/taos-connector-dotnet/tree/3.0/examples/NET6Examples/Stmt) | 使用 TDengine.Connector 实现的参数绑定插入和查询的示例 | -| [schemaless](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/NET6Examples/schemaless) | 使用 TDengine.Connector 实现的使用 schemaless 写入的示例 | -| [async query](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/NET6Examples/AsyncQuery/QueryAsync.cs) | 使用 TDengine.Connector 实现的异步查询的示例 | -| [数据订阅(TMQ)](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/NET6Examples/TMQ/TMQ.cs) | 使用 TDengine.Connector 实现的订阅数据的示例 | -| [Basic WebSocket Usage](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/FrameWork45/WS/WebSocketSample.cs) | 使用 TDengine.Connector 的 WebSocket 基本的示例 | -| [Basic WebSocket STMT](https://github.com/taosdata/taos-connector-dotnet/blob/3.0/examples/FrameWork45/WS/WebSocketSTMT.cs) | 使用 TDengine.Connector 的 WebSocket STMT 基本的示例 | - -## 重要更新记录 - -| TDengine.Connector | 说明 | -|--------------------|--------------------------------| -| 3.0.2 | 支持 .NET Framework 4.5 及以上,支持 .NET standard 2.0。Nuget Package 包含 WebSocket 动态库。 | -| 3.0.1 | 支持 WebSocket 和 Cloud,查询,插入,参数绑定。 | -| 3.0.0 | 支持 TDengine 3.0.0.0,不兼容 2.x。新增接口TDengine.Impl.GetData(),解析查询结果。 | -| 1.0.7 | 修复 TDengine.Query()内存泄露。 | -| 1.0.6 | 修复 schemaless 在 1.0.4 和 1.0.5 中失效 bug。 | -| 1.0.5 | 修复 Windows 同步查询中文报错 bug。 | -| 1.0.4 | 新增异步查询,订阅等功能。修复绑定参数 bug。 | -| 1.0.3 | 新增参数绑定、schemaless、 json tag等功能。 | -| 1.0.2 | 新增连接管理、同步查询、错误信息等功能。 | - -## 其他说明 - -### 第三方驱动 - -[`IoTSharp.Data.Taos`](https://github.com/IoTSharp/EntityFrameworkCore.Taos) 是一个 TDengine 的 ADO.NET 连接器,其中包含了用于EntityFrameworkCore 的提供程序 IoTSharp.EntityFrameworkCore.Taos 和健康检查组件 IoTSharp.HealthChecks.Taos ,支持 Linux,Windows 平台。该连接器由社区贡献者`麦壳饼@@maikebing` 提供,具体请参考: - -* 接口下载: -* 用法说明: - -## 常见问题 - -1. "Unable to establish connection","Unable to resolve FQDN" - - 一般是因为 FQDN 配置不正确。可以参考[如何彻底搞懂 TDengine 的 FQDN](https://www.taosdata.com/blog/2021/07/29/2741.html)解决。 - -2. Unhandled exception. System.DllNotFoundException: Unable to load DLL 'taos' or one of its dependencies: 找不到指定的模块。 - - 一般是因为程序没有找到依赖的客户端驱动。解决方法为:Windows 下可以将 `C:\TDengine\driver\taos.dll` 拷贝到 `C:\Windows\System32\ ` 目录下,Linux 下建立如下软链接 `ln -s /usr/local/taos/driver/libtaos.so.x.x.x.x /usr/lib/libtaos.so` 即可。 - -## API 参考 - -[API 参考](https://docs.taosdata.com/api/connector-csharp/html/860d2ac1-dd52-39c9-e460-0829c4e5a40b.htm) +[示例程序](https://github.com/taosdata/taos-connector-dotnet/tree/3.0/examples) \ No newline at end of file diff --git a/docs/zh/08-connector/50-odbc.mdx b/docs/zh/08-connector/50-odbc.mdx new file mode 100644 index 0000000000..0668aed7df --- /dev/null +++ b/docs/zh/08-connector/50-odbc.mdx @@ -0,0 +1,99 @@ +--- +sidebar_label: ODBC +title: TDengine ODBC +--- + + +## 简介 + +TDengine ODBC 是为 TDengine 实现的 ODBC 驱动程序,支持 Windows 系统的应用(如 [PowerBI](https://powerbi.microsoft.com/zh-cn/) 等)通过 ODBC 标准接口访问本地、远程和云服务的 TDengine 数据库。 + +TDengine ODBC 提供基于 WebSocket(推荐)和 原生连接两种方式连接 TDengine 数据库,使用时可以为 TDengine 数据源设置不同的连接方式。访问云服务时必须使用 WebSocket 连接方式。 + +注意:TDengine ODBC 只支持 64 位系统,调用 TDengine ODBC 必须通过 64 位的 ODBC 驱动管理器进行。因此调用 ODBC 的程序不能使用 32 位版本。 + +想更多了解 TDengine 时序时序数据库的使用,可访问 [TDengine官方文档](https://docs.taosdata.com/intro/)。 + +## 安装 + +1. 仅支持 Windows 平台。Windows 上需要安装过 VC 运行时库,可在此下载安装 [VC运行时库](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170) 如果已经安装VS开发工具可忽略。 + +2. 安装 TDengine Windows 客户端,版本在 3.2.1.0 或以上,都会包含 TDengine 的 ODBC 驱动。 + +## 配置数据源 + +### 数据源连接类型与区别 + +TDengine ODBC 支持两种连接 TDengine 数据库方式:Websocket 连接与 Native 连接,其区别如下: + +1. 只有 Websocket 支持连接云服务 + +2. Websocket 连接的兼容性更好,一般不需要随着 TDengine 数据库服务端升级而升级客户端的库。 + +3. Native 连接通常性能更好一点,但是必须与 TDengine 数据库服务端的版本保持一致。 + +4. 对于一般用户,建议使用 **Websocket** 连接方式,性能与 Native 差别不大,兼容性更好。 + +### WebSocket 连接 + +1. 【开始】菜单搜索打开【ODBC 数据源(64 位)】管理工具(注意不要选择ODBC 数据源(32 位)) + +2. 选中【用户 DSN】标签页,通过【添加(D)】按钮进入"创建数据源"界面 + +3. 选择想要添加的数据源,这里我们选择【TDengine】 + +4. 点击完成,进入 TDengine ODBC 数据源配置页面,填写如下必要信息 + + ![ODBC websocket connection config](./assets/odbc-ws-config-zh.webp) + + 4.1 【DSN】:Data Source Name 必填,为新添加的 ODBC 数据源命名 + + 4.2【Connection Type】 : 必选,选择连接类型,这里选择 【Websocket】 + + 4.3【URL】必填,ODBC 数据源 URL,example: `http://localhost:6041`, 云服务的 url 示例: `https://gw.cloud.taosdata.com?token=your_token` + + 4.4【Database】选填,需要连接的默认数据库 + + 4.5【User】仅供第5步测试连接使用,选填,数据库用户名,如果不填,TDengine 默认 root + + 4.6【Password】仅供第5步测试连接使用,选填,数据库用户密码,如果不填,TDengine 默认 taosdata + +5. 点【Test Connecting...】测试连接情况,如果成功,提示"connecting success" + +6. 点【确定】,即可保存配置并退出 + +7. 也可以在第2步选择已经配置好的数据源名通过【配置】按钮进入配置页面,修改已有配置 + +### 原生连接(不支持云服务) + +1. 【开始】菜单搜索打开【ODBC 数据源(64 位)】管理工具(注意不要选择ODBC 数据源(32 位)) + +2. 选中【用户 DSN】标签页,通过【添加(D)】按钮进入"创建数据源"界面 + +3. 选择想要添加的数据源,这里我们选择【TDengine】 + +4. 点击完成,进入 TDengine ODBC 数据源配置页面,填写如下必要信息 + + ![ODBC native connection config](./assets/odbc-native-config-zh.webp) + + 4.1 【DSN】:Data Source Name 必填,为新添加的 ODBC 数据源命名 + + 4.2 【Connection Type】 : 必选,选择连接类型,这里选择 【Native】 原生连接; + + 4.3 【Server】必填,ODBC 数据源 Server 地址,example: `localhost:6030` + + 4.4 【Database】选填,需要连接的默认数据库 + + 4.5 【User】仅供第5步测试连接使用,选填,数据库用户名,如果不填,TDengine 默认 root + + 4.6 【Password】仅供第5步测试连接使用,选填,数据库用户密码,如果不填,TDengine 默认 taosdata + +5. 点【Test Connecting...】测试连接情况,如果成功,提示"connecting success" + +6. 点【确定】,即可保存配置并退出 + +7. 也可以在第2步选择已经配置好的数据源名通过【配置】按钮进入配置页面,修改已有配置 + +## 与第三方集成 + +作为使用 TDengine ODBC driver 的一个示例,你可以使用 Power BI 与 TDengine 分析时序数据。更多细节请参考 [Power BI](../../third-party/powerbi) diff --git a/docs/zh/08-connector/assets/odbc-check-data.webp b/docs/zh/08-connector/assets/odbc-check-data.webp new file mode 100644 index 0000000000..bc7867c089 Binary files /dev/null and b/docs/zh/08-connector/assets/odbc-check-data.webp differ diff --git a/docs/zh/08-connector/assets/odbc-native-config-zh.webp b/docs/zh/08-connector/assets/odbc-native-config-zh.webp new file mode 100644 index 0000000000..ed9005f2a1 Binary files /dev/null and b/docs/zh/08-connector/assets/odbc-native-config-zh.webp differ diff --git a/docs/zh/08-connector/assets/odbc-ws-config-zh.webp b/docs/zh/08-connector/assets/odbc-ws-config-zh.webp new file mode 100644 index 0000000000..c8a6e11011 Binary files /dev/null and b/docs/zh/08-connector/assets/odbc-ws-config-zh.webp differ diff --git a/docs/zh/12-taos-sql/02-database.md b/docs/zh/12-taos-sql/02-database.md index c3e0e9a07a..58625d22e2 100644 --- a/docs/zh/12-taos-sql/02-database.md +++ b/docs/zh/12-taos-sql/02-database.md @@ -46,6 +46,7 @@ database_option: { - last_row:表示缓存子表最近一行数据。这将显著改善 LAST_ROW 函数的性能表现。 - last_value:表示缓存子表每一列的最近的非 NULL 值。这将显著改善无特殊影响(WHERE、ORDER BY、GROUP BY、INTERVAL)下的 LAST 函数的性能表现。 - both:表示同时打开缓存最近行和列功能。 + Note:CacheModel 值来回切换有可能导致 last/last_row 的查询结果不准确,请谨慎操作。推荐保持打开。 - CACHESIZE:表示每个 vnode 中用于缓存子表最近数据的内存大小。默认为 1 ,范围是[1, 65536],单位是 MB。 - COMP:表示数据库文件压缩标志位,缺省值为 2,取值范围为 [0, 2]。 - 0:表示不压缩。 @@ -137,6 +138,10 @@ alter_database_option: { 如果 cacheload 非常接近 cachesize,则 cachesize 可能过小。 如果 cacheload 明显小于 cachesize 则 cachesize 是够用的。可以根据这个原则判断是否需要修改 cachesize 。具体修改值可以根据系统可用内存情况来决定是加倍或者是提高几倍。 +4. stt_trigger + +在修改 stt_trigger 参数之前请先停止数据库写入。 + :::note 其它参数在 3.0.0.0 中暂不支持修改 diff --git a/docs/zh/12-taos-sql/05-insert.md b/docs/zh/12-taos-sql/05-insert.md index efcd5dd962..1f31698d88 100644 --- a/docs/zh/12-taos-sql/05-insert.md +++ b/docs/zh/12-taos-sql/05-insert.md @@ -159,6 +159,6 @@ INSERT INTO d21001 USING meters TAGS ('California.SanFrancisco', 2) FILE '/tmp/c ```sql INSERT INTO meters(tbname, location, groupId, ts, current, phase) values('d31001', 'California.SanFrancisco', 2, '2021-07-13 14:06:34.630', 10.2, 219, 0.32) - values('d31001', 'California.SanFrancisco', 2, '2021-07-13 14:06:35.779', 10.15, 217, 0.33) - values('d31002', NULL, 2, '2021-07-13 14:06:34.255', 10.15, 217, 0.33) + ('d31001', 'California.SanFrancisco', 2, '2021-07-13 14:06:35.779', 10.15, 217, 0.33) + ('d31002', NULL, 2, '2021-07-13 14:06:34.255', 10.15, 217, 0.33) ``` diff --git a/docs/zh/12-taos-sql/06-select.md b/docs/zh/12-taos-sql/06-select.md index 04508ceede..23ae025610 100755 --- a/docs/zh/12-taos-sql/06-select.md +++ b/docs/zh/12-taos-sql/06-select.md @@ -259,7 +259,12 @@ GROUP BY 子句中的表达式可以包含表或视图中的任何列,这些 ## PARTITION BY -PARTITION BY 子句是 TDengine 特色语法,按 part_list 对数据进行切分,在每个切分的分片中进行计算。 +PARTITION BY 子句是 TDengine 3.0版本引入的特色语法,用于根据 part_list 对数据进行切分,在每个切分的分片中可以进行各种计算。 + +PARTITION BY 与 GROUP BY 基本含义相似,都是按照指定列表进行数据分组然后进行计算,不同点在于 PARTITION BY 没有 GROUP BY 子句的 SELECT 列表的各种限制,组内可以进行任意运算(常量、聚合、标量、表达式等),因此在使用上 PARTITION BY 完全兼容 GROUP BY,所有使用 GROUP BY 子句的地方都可以替换为 PARTITION BY。 + +因为 PARTITION BY 没有返回一行聚合数据的要求,因此还可以支持在分组切片后的各种窗口运算,所有需要分组进行的窗口运算都只能使用 PARTITION BY 子句。 + 详见 [TDengine 特色查询](../distinguished) diff --git a/docs/zh/12-taos-sql/10-function.md b/docs/zh/12-taos-sql/10-function.md index 26313390a6..66322d55f1 100644 --- a/docs/zh/12-taos-sql/10-function.md +++ b/docs/zh/12-taos-sql/10-function.md @@ -1,1499 +1,1500 @@ ---- -sidebar_label: 函数 -title: 函数 -description: TDengine 支持的函数列表 -toc_max_heading_level: 4 ---- - -## 单行函数 - -单行函数为查询结果中的每一行返回一个结果行。 - -### 数学函数 - -#### ABS - -```sql -ABS(expr) -``` - -**功能说明**:获得指定字段的绝对值。 - -**返回结果类型**:与指定字段的原始数据类型一致。 - -**适用数据类型**:数值类型。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**: 表和超级表。 - -**使用说明**:只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。 - -#### ACOS - -```sql -ACOS(expr) -``` - -**功能说明**:获得指定字段的反余弦结果。 - -**返回结果类型**:DOUBLE。 - -**适用数据类型**:数值类型。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**: 表和超级表。 - -**使用说明**:只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。 - -#### ASIN - -```sql -ASIN(expr) -``` - -**功能说明**:获得指定字段的反正弦结果。 - -**返回结果类型**:DOUBLE。 - -**适用数据类型**:数值类型。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**: 表和超级表。 - -**使用说明**:只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。 - - -#### ATAN - -```sql -ATAN(expr) -``` - -**功能说明**:获得指定字段的反正切结果。 - -**返回结果类型**:DOUBLE。 - -**适用数据类型**:数值类型。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**: 表和超级表。 - -**使用说明**:只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。 - - -#### CEIL - -```sql -CEIL(expr) -``` - -**功能说明**:获得指定字段的向上取整数的结果。 - -**返回结果类型**:与指定字段的原始数据类型一致。 - -**适用数据类型**:数值类型。 - -**适用于**: 表和超级表。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**使用说明**: 只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。 - -#### COS - -```sql -COS(expr) -``` - -**功能说明**:获得指定字段的余弦结果。 - -**返回结果类型**:DOUBLE。 - -**适用数据类型**:数值类型。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**: 表和超级表。 - -**使用说明**:只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。 - -#### FLOOR - -```sql -FLOOR(expr) -``` - -**功能说明**:获得指定字段的向下取整数的结果。 - 其他使用说明参见 CEIL 函数描述。 - -#### LOG - -```sql -LOG(expr1[, expr2]) -``` - -**功能说明**:获得 expr1 对于底数 expr2 的对数。如果 expr2 参数省略,则返回指定字段的自然对数值。 - -**返回结果类型**:DOUBLE。 - -**适用数据类型**:数值类型。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**: 表和超级表。 - -**使用说明**:只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。 - - -#### POW - -```sql -POW(expr1, expr2) -``` - -**功能说明**:获得 expr1 的指数为 expr2 的幂。 - -**返回结果类型**:DOUBLE。 - -**适用数据类型**:数值类型。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**: 表和超级表。 - -**使用说明**:只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。 - - -#### ROUND - -```sql -ROUND(expr) -``` - -**功能说明**:获得指定字段的四舍五入的结果。 - 其他使用说明参见 CEIL 函数描述。 - - -#### SIN - -```sql -SIN(expr) -``` - -**功能说明**:获得指定字段的正弦结果。 - -**返回结果类型**:DOUBLE。 - -**适用数据类型**:数值类型。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**: 表和超级表。 - -**使用说明**:只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。 - -#### SQRT - -```sql -SQRT(expr) -``` - -**功能说明**:获得指定字段的平方根。 - -**返回结果类型**:DOUBLE。 - -**适用数据类型**:数值类型。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**: 表和超级表。 - -**使用说明**:只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。 - -#### TAN - -```sql -TAN(expr) -``` - -**功能说明**:获得指定字段的正切结果。 - -**返回结果类型**:DOUBLE。 - -**适用数据类型**:数值类型。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**: 表和超级表。 - -**使用说明**:只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。 - -### 字符串函数 - -字符串函数的输入参数为字符串类型,返回结果为数值类型或字符串类型。 - -#### CHAR_LENGTH - -```sql -CHAR_LENGTH(expr) -``` - -**功能说明**:以字符计数的字符串长度。 - -**返回结果类型**:BIGINT。 - -**适用数据类型**:VARCHAR, NCHAR。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**: 表和超级表。 - -#### CONCAT - -```sql -CONCAT(expr1, expr2 [, expr] ... ) -``` - -**功能说明**:字符串连接函数。 - -**返回结果类型**:如果所有参数均为 VARCHAR 类型,则结果类型为 VARCHAR。如果参数包含NCHAR类型,则结果类型为NCHAR。如果参数包含NULL值,则输出值为NULL。 - -**适用数据类型**:VARCHAR, NCHAR。 该函数最小参数个数为2个,最大参数个数为8个。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**: 表和超级表。 - - -#### CONCAT_WS - -```sql -CONCAT_WS(separator_expr, expr1, expr2 [, expr] ...) -``` - -**功能说明**:带分隔符的字符串连接函数。 - -**返回结果类型**:如果所有参数均为VARCHAR类型,则结果类型为VARCHAR。如果参数包含NCHAR类型,则结果类型为NCHAR。如果参数包含NULL值,则输出值为NULL。 - -**适用数据类型**:VARCHAR, NCHAR。 该函数最小参数个数为3个,最大参数个数为9个。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**: 表和超级表。 - - -#### LENGTH - -```sql -LENGTH(expr) -``` - -**功能说明**:以字节计数的长度。 - -**返回结果类型**:BIGINT。 - -**适用数据类型**:VARCHAR, NCHAR, VARBINARY。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**: 表和超级表。 - - -#### LOWER - -```sql -LOWER(expr) -``` - -**功能说明**:将字符串参数值转换为全小写字母。 - -**返回结果类型**:与输入字段的原始类型相同。 - -**适用数据类型**:VARCHAR, NCHAR。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**: 表和超级表。 - - -#### LTRIM - -```sql -LTRIM(expr) -``` - -**功能说明**:返回清除左边空格后的字符串。 - -**返回结果类型**:与输入字段的原始类型相同。 - -**适用数据类型**:VARCHAR, NCHAR。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**: 表和超级表。 - - -#### RTRIM - -```sql -RTRIM(expr) -``` - -**功能说明**:返回清除右边空格后的字符串。 - -**返回结果类型**:与输入字段的原始类型相同。 - -**适用数据类型**:VARCHAR, NCHAR。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**: 表和超级表。 - - -#### SUBSTR - -```sql -SUBSTR(expr, pos [,len]) -``` - -**功能说明**:从源字符串 str 中的指定位置 pos 开始取一个长度为 len 的子串并返回。如果输入参数 len 被忽略,返回的子串包含从 pos 开始的整个字串。 - -**返回结果类型**:与输入字段的原始类型相同。 - -**适用数据类型**:VARCHAR, NCHAR。输入参数 pos 可以为正数,也可以为负数。如果 pos 是正数,表示开始位置从字符串开头正数计算。如果 pos 为负数,表示开始位置从字符串结尾倒数计算。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**: 表和超级表。 - - -#### UPPER - -```sql -UPPER(expr) -``` - -**功能说明**:将字符串参数值转换为全大写字母。 - -**返回结果类型**:与输入字段的原始类型相同。 - -**适用数据类型**:VARCHAR, NCHAR。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**: 表和超级表。 - - -### 转换函数 - -转换函数将值从一种数据类型转换为另一种数据类型。 - -#### CAST - -```sql -CAST(expr AS type_name) -``` - -**功能说明**:数据类型转换函数,返回 expr 转换为 type_name 指定的类型后的结果。只适用于 select 子句中。 - -**返回结果类型**:CAST 中指定的类型(type_name)。 - -**适用数据类型**:输入参数 expr 的类型可以是除JSON和VARBINARY外的所有类型。如果 type_name 为 VARBINARY,则 expr 只能是 VARCHAR 类型。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**: 表和超级表。 - -**使用说明**: - -- 对于不能支持的类型转换会直接报错。 -- 对于类型支持但某些值无法正确转换的情况,对应的转换后的值以转换函数输出为准。目前可能遇到的几种情况: - 1)字符串类型转换数值类型时可能出现的无效字符情况,例如"a"可能转为0,但不会报错。 - 2)转换到数值类型时,数值大于type_name可表示的范围时,则会溢出,但不会报错。 - 3)转换到字符串类型时,如果转换后长度超过type_name中指定的长度,则会截断,但不会报错。 - -#### TO_ISO8601 - -```sql -TO_ISO8601(expr [, timezone]) -``` - -**功能说明**:将 UNIX 时间戳转换成为 ISO8601 标准的日期时间格式,并附加时区信息。timezone 参数允许用户为输出结果指定附带任意时区信息。如果 timezone 参数省略,输出结果则附带当前客户端的系统时区信息。 - -**返回结果数据类型**:VARCHAR 类型。 - -**适用数据类型**:INTEGER, TIMESTAMP。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**: 表和超级表。 - -**使用说明**: - -- timezone 参数允许输入的时区格式为: [z/Z, +/-hhmm, +/-hh, +/-hh:mm]。例如,TO_ISO8601(1, "+00:00")。 -- 如果输入是表示 UNIX 时间戳的整形,返回格式精度由时间戳的位数决定; -- 如果输入是 TIMESTAMP 类型的列,返回格式的时间戳精度与当前 DATABASE 设置的时间精度一致。 - - -#### TO_JSON - -```sql -TO_JSON(str_literal) -``` - -**功能说明**: 将字符串常量转换为 JSON 类型。 - -**返回结果数据类型**: JSON。 - -**适用数据类型**: JSON 字符串,形如 '{ "literal" : literal }'。'{}'表示空值。键必须为字符串字面量,值可以为数值字面量、字符串字面量、布尔字面量或空值字面量。str_literal中不支持转义符。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**: 表和超级表。 - - -#### TO_UNIXTIMESTAMP - -```sql -TO_UNIXTIMESTAMP(expr [, return_timestamp]) - -return_timestamp: { - 0 - | 1 -} -``` - -**功能说明**:将日期时间格式的字符串转换成为 UNIX 时间戳。 - -**返回结果数据类型**:BIGINT, TIMESTAMP。 - -**应用字段**:VARCHAR, NCHAR。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**适用于**:表和超级表。 - -**使用说明**: - -- 输入的日期时间字符串须符合 ISO8601/RFC3339 标准,无法转换的字符串格式将返回 NULL。 -- 返回的时间戳精度与当前 DATABASE 设置的时间精度一致。 -- return_timestamp 指定函数返回值是否为时间戳类型,设置为1时返回 TIMESTAMP 类型,设置为0时返回 BIGINT 类型。如不指定缺省返回 BIGINT 类型。 - -#### TO_CHAR - -```sql -TO_CHAR(ts, format_str_literal) -``` - -**功能说明**: 将timestamp类型按照指定格式转换为字符串 - -**返回结果数据类型**: VARCHAR - -**应用字段**: TIMESTAMP - -**嵌套子查询支持**: 适用于内层查询和外层查询 - -**适用于**: 表和超级表 - -**支持的格式** - -| **格式** | **说明**| **例子** | -| --- | --- | --- | -|AM,am,PM,pm| 无点分隔的上午下午 | 07:00:00am| -|A.M.,a.m.,P.M.,p.m.| 有点分隔的上午下午| 07:00:00a.m.| -|YYYY,yyyy|年, 4个及以上数字| 2023-10-10| -|YYY,yyy| 年, 最后3位数字| 023-10-10| -|YY,yy| 年, 最后2位数字| 23-10-10| -|Y,y|年, 最后一位数字| 3-10-10| -|MONTH|月, 全大写| 2023-JANUARY-01| -|Month|月, 首字母大写| 2023-January-01| -|month|月, 全小写| 2023-january-01| -|MON| 月, 缩写, 全大写(三个字符)| JAN, SEP| -|Mon| 月, 缩写, 首字母大写| Jan, Sep| -|mon|月, 缩写, 全小写| jan, sep| -|MM,mm|月, 数字 01-12|2023-01-01| -|DD,dd|月日, 01-31|| -|DAY|周日, 全大写|MONDAY| -|Day|周日, 首字符大写|Monday| -|day|周日, 全小写|monday| -|DY|周日, 缩写, 全大写|MON| -|Dy|周日, 缩写, 首字符大写|Mon| -|dy|周日, 缩写, 全小写|mon| -|DDD|年日, 001-366|| -|D,d|周日, 数字, 1-7, Sunday(1) to Saturday(7)|| -|HH24,hh24|小时, 00-23|2023-01-30 23:59:59| -|hh12,HH12, hh, HH| 小时, 01-12|2023-01-30 12:59:59PM| -|MI,mi|分钟, 00-59|| -|SS,ss|秒, 00-59|| -|MS,ms|毫秒, 000-999|| -|US,us|微秒, 000000-999999|| -|NS,ns|纳秒, 000000000-999999999|| -|TZH,tzh|时区小时|2023-01-30 11:59:59PM +08| - -**使用说明**: -- `Month`, `Day`等的输出格式是左对齐的, 右侧添加空格, 如`2023-OCTOBER -01`, `2023-SEPTEMBER-01`, 9月是月份中英文字母数最长的, 因此9月没有空格. 星期类似. -- 使用`ms`, `us`, `ns`时, 以上三种格式的输出只在精度上不同, 比如ts为 `1697182085123`, `ms` 的输出为 `123`, `us` 的输出为 `123000`, `ns` 的输出为 `123000000`. -- 时间格式中无法匹配规则的内容会直接输出. 如果想要在格式串中指定某些能够匹配规则的部分不做转换, 可以使用双引号, 如`to_char(ts, 'yyyy-mm-dd "is formated by yyyy-mm-dd"')`. 如果想要输出双引号, 那么在双引号之前加一个反斜杠, 如 `to_char(ts, '\"yyyy-mm-dd\"')` 将会输出 `"2023-10-10"`. -- 那些输出是数字的格式, 如`YYYY`, `DD`, 大写与小写意义相同, 即`yyyy` 和 `YYYY` 可以互换. -- 推荐在时间格式中带时区信息,如果不带则默认输出的时区为服务端或客户端所配置的时区. -- 输入时间戳的精度由所查询表的精度确定, 若未指定表, 则精度为毫秒. - -#### TO_TIMESTAMP - -```sql -TO_TIMESTAMP(ts_str_literal, format_str_literal) -``` - -**功能说明**: 将字符串按照指定格式转化为时间戳. - -**返回结果数据类型**: TIMESTAMP - -**应用字段**: VARCHAR - -**嵌套子查询支持**: 适用于内层查询和外层查询 - -**适用于**: 表和超级表 - -**支持的格式**: 与`to_char`相同 - -**使用说明**: -- 若`ms`, `us`, `ns`同时指定, 那么结果时间戳包含上述三个字段的和. 如 `to_timestamp('2023-10-10 10:10:10.123.000456.000000789', 'yyyy-mm-dd hh:mi:ss.ms.us.ns')` 输出为 `2023-10-10 10:10:10.123456789`对应的时间戳. -- `MONTH`, `MON`, `DAY`, `DY` 以及其他输出为数字的格式的大小写意义相同, 如 `to_timestamp('2023-JANUARY-01', 'YYYY-month-dd')`, `month`可以被替换为`MONTH` 或者`Month`. -- 如果同一字段被指定了多次, 那么前面的指定将会被覆盖. 如 `to_timestamp('2023-22-10-10', 'yyyy-yy-MM-dd')`, 输出年份是`2022`. -- 为避免转换时使用了非预期的时区,推荐在时间中携带时区信息,例如'2023-10-10 10:10:10+08',如果未指定时区则默认时区为服务端或客户端指定的时区。 -- 如果没有指定完整的时间,那么默认时间值为指定或默认时区的 `1970-01-01 00:00:00`, 未指定部分使用该默认值中的对应部分. 暂不支持只指定年日而不指定月日的格式, 如'yyyy-mm-DDD', 支持'yyyy-mm-DD'. -- 如果格式串中有`AM`, `PM`等, 那么小时必须是12小时制, 范围必须是01-12. -- `to_timestamp`转换具有一定的容错机制, 在格式串和时间戳串不完全对应时, 有时也可转换, 如: `to_timestamp('200101/2', 'yyyyMM1/dd')`, 格式串中多出来的1会被丢弃. 格式串与时间戳串中多余的空格字符(空格, tab等)也会被 自动忽略. 如`to_timestamp(' 23 年 - 1 月 - 01 日 ', 'yy 年-MM月-dd日')` 可以被成功转换. 虽然`MM`等字段需要两个数字对应(只有一位时前面补0), 在`to_timestamp`时, 一个数字也可以成功转换. -- 输出时间戳的精度与查询表的精度相同, 若查询未指定表, 则输出精度为毫秒. 如`select to_timestamp('2023-08-1 10:10:10.123456789', 'yyyy-mm-dd hh:mi:ss.ns')`的输出将会把微妙和纳秒进行截断. 如果指定一张纳秒表, 那么就不会发生截断, 如`select to_timestamp('2023-08-1 10:10:10.123456789', 'yyyy-mm-dd hh:mi:ss.ns') from db_ns.table_ns limit 1`. - - -### 时间和日期函数 - -时间和日期函数对时间戳类型进行操作。 - -所有返回当前时间的函数,如NOW、TODAY和TIMEZONE,在一条SQL语句中不论出现多少次都只会被计算一次。 - -#### NOW - -```sql -NOW() -``` - -**功能说明**:返回客户端当前系统时间。 - -**返回结果数据类型**:TIMESTAMP。 - -**应用字段**:在 WHERE 或 INSERT 语句中使用时只能作用于 TIMESTAMP 类型的字段。 - -**适用于**:表和超级表。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**使用说明**: - -- 支持时间加减操作,如 NOW() + 1s, 支持的时间单位如下: - b(纳秒)、u(微秒)、a(毫秒)、s(秒)、m(分)、h(小时)、d(天)、w(周)。 -- 返回的时间戳精度与当前 DATABASE 设置的时间精度一致。 - - -#### TIMEDIFF - -```sql -TIMEDIFF(expr1, expr2 [, time_unit]) -``` - -**功能说明**:计算两个时间戳之间的差值,并近似到时间单位 time_unit 指定的精度。 - -**返回结果数据类型**:BIGINT。 - -**应用字段**:表示 UNIX 时间戳的 BIGINT, TIMESTAMP 类型,或符合日期时间格式的 VARCHAR, NCHAR 类型。 - -**适用于**:表和超级表。 - -**嵌套子查询支持**:适用于内层查询和外层查询。 - -**使用说明**: -- 支持的时间单位 time_unit 如下: - 1b(纳秒), 1u(微秒),1a(毫秒),1s(秒),1m(分),1h(小时),1d(天), 1w(周)。 -- 如果时间单位 time_unit 未指定, 返回的时间差值精度与当前 DATABASE 设置的时间精度一致。 -- 输入包含不符合时间日期格式的字符串则返回 NULL。 - - -#### TIMETRUNCATE - -```sql -TIMETRUNCATE(expr, time_unit [, ignore_timezone]) - -ignore_timezone: { - 0 - | 1 -} -``` - -**功能说明**:将时间戳按照指定时间单位 time_unit 进行截断。 - -**返回结果数据类型**:TIMESTAMP。 - -**应用字段**:表示 UNIX 时间戳的 BIGINT, TIMESTAMP 类型,或符合日期时间格式的 VARCHAR, NCHAR 类型。 - -**适用于**:表和超级表。 - -**使用说明**: -- 支持的时间单位 time_unit 如下: - 1b(纳秒), 1u(微秒),1a(毫秒),1s(秒),1m(分),1h(小时),1d(天), 1w(周)。 -- 返回的时间戳精度与当前 DATABASE 设置的时间精度一致。 -- 输入包含不符合时间日期格式的字符串则返回 NULL。 -- 当使用 1d 作为时间单位对时间戳进行截断时, 可通过设置 ignore_timezone 参数指定返回结果的显示是否忽略客户端时区的影响。 - 例如客户端所配置时区为 UTC+0800, 则 TIMETRUNCATE('2020-01-01 23:00:00', 1d, 0) 返回结果为 '2020-01-01 08:00:00'。 - 而使用 TIMETRUNCATE('2020-01-01 23:00:00', 1d, 1) 设置忽略时区时,返回结果为 '2020-01-01 00:00:00' - ignore_timezone 如果忽略的话,则默认值为 1 。 - - - -#### TIMEZONE - -```sql -TIMEZONE() -``` - -**功能说明**:返回客户端当前时区信息。 - -**返回结果数据类型**:VARCHAR。 - -**应用字段**:无 - -**适用于**:表和超级表。 - - -#### TODAY - -```sql -TODAY() -``` - -**功能说明**:返回客户端当日零时的系统时间。 - -**返回结果数据类型**:TIMESTAMP。 - -**应用字段**:在 WHERE 或 INSERT 语句中使用时只能作用于 TIMESTAMP 类型的字段。 - -**适用于**:表和超级表。 - -**使用说明**: - -- 支持时间加减操作,如 TODAY() + 1s, 支持的时间单位如下: - b(纳秒),u(微秒),a(毫秒),s(秒),m(分),h(小时),d(天),w(周)。 -- 返回的时间戳精度与当前 DATABASE 设置的时间精度一致。 - - -## 聚合函数 - -聚合函数为查询结果集的每一个分组返回单个结果行。可以由 GROUP BY 或窗口切分子句指定分组,如果没有,则整个查询结果集视为一个分组。 - -TDengine 支持针对数据的聚合查询。提供如下聚合函数。 - -### APERCENTILE - -```sql -APERCENTILE(expr, p [, algo_type]) - -algo_type: { - "default" - | "t-digest" -} -``` - -**功能说明**:统计表/超级表中指定列的值的近似百分比分位数,与 PERCENTILE 函数相似,但是返回近似结果。 - -**返回数据类型**: DOUBLE。 - -**适用数据类型**:数值类型。 - -**适用于**:表和超级表。 - -**说明**: -- p值范围是[0,100],当为0时等同于MIN,为100时等同于MAX。 -- algo_type 取值为 "default" 或 "t-digest"。 输入为 "default" 时函数使用基于直方图算法进行计算。输入为 "t-digest" 时使用t-digest算法计算分位数的近似结果。如果不指定 algo_type 则使用 "default" 算法。 -- "t-digest"算法的近似结果对于输入数据顺序敏感,对超级表查询时不同的输入排序结果可能会有微小的误差。 - -### AVG - -```sql -AVG(expr) -``` - -**功能说明**:统计指定字段的平均值。 - -**返回数据类型**:DOUBLE。 - -**适用数据类型**:数值类型。 - -**适用于**:表和超级表。 - - -### COUNT - -```sql -COUNT({* | expr}) -``` - -**功能说明**:统计指定字段的记录行数。 - -**返回数据类型**:BIGINT。 - -**适用数据类型**:全部类型字段。 - -**适用于**:表和超级表。 - -**使用说明**: - -- 可以使用星号(\*)来替代具体的字段,使用星号(\*)返回全部记录数量。 -- 如果统计字段是具体的列,则返回该列中非 NULL 值的记录数量。 - - -### ELAPSED - -```sql -ELAPSED(ts_primary_key [, time_unit]) -``` - -**功能说明**:elapsed函数表达了统计周期内连续的时间长度,和twa函数配合使用可以计算统计曲线下的面积。在通过INTERVAL子句指定窗口的情况下,统计在给定时间范围内的每个窗口内有数据覆盖的时间范围;如果没有INTERVAL子句,则返回整个给定时间范围内的有数据覆盖的时间范围。注意,ELAPSED返回的并不是时间范围的绝对值,而是绝对值除以time_unit所得到的单位个数。 - -**返回结果类型**:DOUBLE。 - -**适用数据类型**:TIMESTAMP。 - -**适用于**: 表,超级表,嵌套查询的外层查询 - -**说明**: -- ts_primary_key参数只能是表的第一列,即 TIMESTAMP 类型的主键列。 -- 按time_unit参数指定的时间单位返回,最小是数据库的时间分辨率。time_unit 参数未指定时,以数据库的时间分辨率为时间单位。支持的时间单位 time_unit 如下: - 1b(纳秒), 1u(微秒),1a(毫秒),1s(秒),1m(分),1h(小时),1d(天), 1w(周)。 -- 可以和interval组合使用,返回每个时间窗口的时间戳差值。需要特别注意的是,除第一个时间窗口和最后一个时间窗口外,中间窗口的时间戳差值均为窗口长度。 -- order by asc/desc不影响差值的计算结果。 -- 对于超级表,需要和group by tbname子句组合使用,不可以直接使用。 -- 对于普通表,不支持和group by子句组合使用。 -- 对于嵌套查询,仅当内层查询会输出隐式时间戳列时有效。例如select elapsed(ts) from (select diff(value) from sub1)语句,diff函数会让内层查询输出隐式时间戳列,此为主键列,可以用于elapsed函数的第一个参数。相反,例如select elapsed(ts) from (select * from sub1) 语句,ts列输出到外层时已经没有了主键列的含义,无法使用elapsed函数。此外,elapsed函数作为一个与时间线强依赖的函数,形如select elapsed(ts) from (select diff(value) from st group by tbname)尽管会返回一条计算结果,但并无实际意义,这种用法后续也将被限制。 -- 不支持与leastsquares、diff、derivative、top、bottom、last_row、interp等函数混合使用。 - - -### LEASTSQUARES - -```sql -LEASTSQUARES(expr, start_val, step_val) -``` - -**功能说明**:统计表中某列的值的拟合直线方程。start_val 是自变量初始值,step_val 是自变量的步长值。 - -**返回数据类型**:字符串表达式(斜率, 截距)。 - -**适用数据类型**:expr 必须是数值类型。 - -**适用于**:表。 - - -### SPREAD - -```sql -SPREAD(expr) -``` - -**功能说明**:统计表中某列的最大值和最小值之差。 - -**返回数据类型**:DOUBLE。 - -**适用数据类型**:INTEGER, TIMESTAMP。 - -**适用于**:表和超级表。 - - -### STDDEV - -```sql -STDDEV(expr) -``` - -**功能说明**:统计表中某列的均方差。 - -**返回数据类型**:DOUBLE。 - -**适用数据类型**:数值类型。 - -**适用于**:表和超级表。 - - -### SUM - -```sql -SUM(expr) -``` - -**功能说明**:统计表/超级表中某列的和。 - -**返回数据类型**:DOUBLE, BIGINT。 - -**适用数据类型**:数值类型。 - -**适用于**:表和超级表。 - - -### HYPERLOGLOG - -```sql -HYPERLOGLOG(expr) -``` - -**功能说明**: - - 采用 hyperloglog 算法,返回某列的基数。该算法在数据量很大的情况下,可以明显降低内存的占用,求出来的基数是个估算值,标准误差(标准误差是多次实验,每次的平均数的标准差,不是与真实结果的误差)为 0.81%。 - - 在数据量较少的时候该算法不是很准确,可以使用 select count(data) from (select unique(col) as data from table) 的方法。 - -**返回结果类型**:INTEGER。 - -**适用数据类型**:任何类型。 - -**适用于**:表和超级表。 - - -### HISTOGRAM - -```sql -HISTOGRAM(expr,bin_type, bin_description, normalized) -``` - -**功能说明**:统计数据按照用户指定区间的分布。 - -**返回结果类型**:如归一化参数 normalized 设置为 1,返回结果为 DOUBLE 类型,否则为 BIGINT 类型。 - -**适用数据类型**:数值型字段。 - -**适用于**: 表和超级表。 - -**详细说明**: -- bin_type 用户指定的分桶类型, 有效输入类型为"user_input“, ”linear_bin", "log_bin"。 -- bin_description 描述如何生成分桶区间,针对三种桶类型,分别为以下描述格式(均为 JSON 格式字符串): - - "user_input": "[1, 3, 5, 7]" - 用户指定 bin 的具体数值。 - - - "linear_bin": "{"start": 0.0, "width": 5.0, "count": 5, "infinity": true}" - "start" 表示数据起始点,"width" 表示每次 bin 偏移量, "count" 为 bin 的总数,"infinity" 表示是否添加(-inf, inf)作为区间起点和终点, - 生成区间为[-inf, 0.0, 5.0, 10.0, 15.0, 20.0, +inf]。 - - - "log_bin": "{"start":1.0, "factor": 2.0, "count": 5, "infinity": true}" - "start" 表示数据起始点,"factor" 表示按指数递增的因子,"count" 为 bin 的总数,"infinity" 表示是否添加(-inf, inf)作为区间起点和终点, - 生成区间为[-inf, 1.0, 2.0, 4.0, 8.0, 16.0, +inf]。 -- normalized 是否将返回结果归一化到 0~1 之间 。有效输入为 0 和 1。 - - -### PERCENTILE - -```sql -PERCENTILE(expr, p [, p1] ... ) -``` - -**功能说明**:统计表中某列的值百分比分位数。 - -**返回数据类型**: 该函数最小参数个数为 2 个,最大参数个数为 11 个。可以最多同时返回 10 个百分比分位数。当参数个数为 2 时, 返回一个分位数, 类型为DOUBLE,当参数个数大于 2 时,返回类型为VARCHAR, 格式为包含多个返回值的JSON数组。 - -**应用字段**:数值类型。 - -**适用于**:表。 - -**使用说明**: - -- *P*值取值范围 0≤*P*≤100,为 0 的时候等同于 MIN,为 100 的时候等同于 MAX; -- 同时计算针对同一列的多个分位数时,建议使用一个PERCENTILE函数和多个参数的方式,能很大程度上降低查询的响应时间。 - 比如,使用查询SELECT percentile(col, 90, 95, 99) FROM table, 性能会优于SELECT percentile(col, 90), percentile(col, 95), percentile(col, 99) from table。 - - -## 选择函数 - -选择函数根据语义在查询结果集中选择一行或多行结果返回。用户可以同时指定输出 ts 列或其他列(包括 tbname 和标签列),这样就可以方便地知道被选出的值是源于哪个数据行的。 - -### BOTTOM - -```sql -BOTTOM(expr, k) -``` - -**功能说明**:统计表/超级表中某列的值最小 _k_ 个非 NULL 值。如果多条数据取值一样,全部取用又会超出 k 条限制时,系统会从相同值中随机选取符合要求的数量返回。 - -**返回数据类型**:同应用的字段。 - -**适用数据类型**:数值类型。 - -**适用于**:表和超级表。 - -**使用说明**: - -- *k*值取值范围 1≤*k*≤100; -- 系统同时返回该记录关联的时间戳列; -- 限制:BOTTOM 函数不支持 FILL 子句。 - -### FIRST - -```sql -FIRST(expr) -``` - -**功能说明**:统计表/超级表中某列的值最先写入的非 NULL 值。 - -**返回数据类型**:同应用的字段。 - -**适用数据类型**:所有字段。 - -**适用于**:表和超级表。 - -**使用说明**: - -- 如果要返回各个列的首个(时间戳最小)非 NULL 值,可以使用 FIRST(\*); -- 如果结果集中的某列全部为 NULL 值,则该列的返回结果也是 NULL; -- 如果结果集中所有列全部为 NULL 值,则不返回结果。 - -### INTERP - -```sql -INTERP(expr [, ignore_null_values]) - -ignore_null_values: { - 0 - | 1 -} -``` - -**功能说明**:返回指定时间截面指定列的记录值或插值。ignore_null_values 参数的值可以是 0 或 1,为 1 时表示忽略 NULL 值, 缺省值为0。 - -**返回数据类型**:同字段类型。 - -**适用数据类型**:数值类型。 - -**适用于**:表和超级表。 - -**使用说明** - -- INTERP 用于在指定时间断面获取指定列的记录值,如果该时间断面不存在符合条件的行数据,那么会根据 FILL 参数的设定进行插值。 -- INTERP 的输入数据为指定列的数据,可以通过条件语句(where 子句)来对原始列数据进行过滤,如果没有指定过滤条件则输入为全部数据。 -- INTERP 需要同时与 RANGE,EVERY 和 FILL 关键字一起使用。 -- INTERP 的输出时间范围根据 RANGE(timestamp1, timestamp2)字段来指定,需满足 timestamp1 <= timestamp2。其中 timestamp1 为输出时间范围的起始值,即如果 timestamp1 时刻符合插值条件则 timestamp1 为输出的第一条记录,timestamp2 为输出时间范围的结束值,即输出的最后一条记录的 timestamp 不能大于 timestamp2。 -- INTERP 根据 EVERY(time_unit) 字段来确定输出时间范围内的结果条数,即从 timestamp1 开始每隔固定长度的时间(time_unit 值)进行插值,time_unit 可取值时间单位:1a(毫秒),1s(秒),1m(分),1h(小时),1d(天),1w(周)。例如 EVERY(500a) 将对于指定数据每500毫秒间隔进行一次插值. -- INTERP 根据 FILL 字段来决定在每个符合输出条件的时刻如何进行插值。关于 FILL 子句如何使用请参考 [FILL 子句](../distinguished/#fill-子句) -- INTERP 可以在 RANGE 字段中只指定唯一的时间戳对单个时间点进行插值,在这种情况下,EVERY 字段可以省略。例如:SELECT INTERP(col) FROM tb RANGE('2023-01-01 00:00:00') FILL(linear). -- INTERP 作用于超级表时, 会将该超级表下的所有子表数据按照主键列排序后进行插值计算,也可以搭配 PARTITION BY tbname 使用,将结果强制规约到单个时间线。 -- INTERP 可以与伪列 _irowts 一起使用,返回插值点所对应的时间戳(3.0.2.0版本以后支持)。 -- INTERP 可以与伪列 _isfilled 一起使用,显示返回结果是否为原始记录或插值算法产生的数据(3.0.3.0版本以后支持)。 - -### LAST - -```sql -LAST(expr) -``` - -**功能说明**:统计表/超级表中某列的值最后写入的非 NULL 值。 - -**返回数据类型**:同应用的字段。 - -**适用数据类型**:所有字段。 - -**适用于**:表和超级表。 - -**使用说明**: - -- 如果要返回各个列的最后(时间戳最大)一个非 NULL 值,可以使用 LAST(\*); -- 如果结果集中的某列全部为 NULL 值,则该列的返回结果也是 NULL;如果结果集中所有列全部为 NULL 值,则不返回结果。 -- 在用于超级表时,时间戳完全一样且同为最大的数据行可能有多个,那么会从中随机返回一条,而并不保证多次运行所挑选的数据行必然一致。 - - -### LAST_ROW - -```sql -LAST_ROW(expr) -``` - -**功能说明**:返回表/超级表的最后一条记录。 - -**返回数据类型**:同应用的字段。 - -**适用数据类型**:所有字段。 - -**适用于**:表和超级表。 - -**使用说明**: - -- 在用于超级表时,时间戳完全一样且同为最大的数据行可能有多个,那么会从中随机返回一条,而并不保证多次运行所挑选的数据行必然一致。 -- 不能与 INTERVAL 一起使用。 - -### MAX - -```sql -MAX(expr) -``` - -**功能说明**:统计表/超级表中某列的值最大值。 - -**返回数据类型**:同应用的字段。 - -**适用数据类型**:数值类型。 - -**适用于**:表和超级表。 - - -### MIN - -```sql -MIN(expr) -``` - -**功能说明**:统计表/超级表中某列的值最小值。 - -**返回数据类型**:同应用的字段。 - -**适用数据类型**:数值类型。 - -**适用于**:表和超级表。 - - -### MODE - -```sql -MODE(expr) -``` - -**功能说明**:返回出现频率最高的值,若存在多个频率相同的最高值,则随机输出其中某个值。 - -**返回数据类型**:与输入数据类型一致。 - -**适用数据类型**:全部类型字段。 - -**适用于**:表和超级表。 - - -### SAMPLE - -```sql -SAMPLE(expr, k) -``` - -**功能说明**: 获取数据的 k 个采样值。参数 k 的合法输入范围是 1≤ k ≤ 1000。 - -**返回结果类型**: 同原始数据类型。 - -**适用数据类型**: 全部类型字段。 - -**嵌套子查询支持**: 适用于内层查询和外层查询。 - -**适用于**:表和超级表。 - - -### TAIL - -```sql -TAIL(expr, k [, offset_rows]) -``` - -**功能说明**:返回跳过最后 offset_val 个,然后取连续 k 个记录,不忽略 NULL 值。offset_val 可以不输入。此时返回最后的 k 个记录。当有 offset_val 输入的情况下,该函数功能等效于 `order by ts desc LIMIT k OFFSET offset_val`。 - -**参数范围**:k: [1,100] offset_val: [0,100]。 - -**返回数据类型**:同应用的字段。 - -**适用数据类型**:适合于除时间主键列外的任何类型。 - -**适用于**:表、超级表。 - - -### TOP - -```sql -TOP(expr, k) -``` - -**功能说明**: 统计表/超级表中某列的值最大 _k_ 个非 NULL 值。如果多条数据取值一样,全部取用又会超出 k 条限制时,系统会从相同值中随机选取符合要求的数量返回。 - -**返回数据类型**:同应用的字段。 - -**适用数据类型**:数值类型。 - -**适用于**:表和超级表。 - -**使用说明**: - -- *k*值取值范围 1≤*k*≤100; -- 系统同时返回该记录关联的时间戳列; -- 限制:TOP 函数不支持 FILL 子句。 - -### UNIQUE - -```sql -UNIQUE(expr) -``` - -**功能说明**:返回该列数据首次出现的值。该函数功能与 distinct 相似。 - -**返回数据类型**:同应用的字段。 - -**适用数据类型**:全部类型字段。 - -**适用于**: 表和超级表。 - - -## 时序数据特有函数 - -时序数据特有函数是 TDengine 为了满足时序数据的查询场景而量身定做出来的。在通用数据库中,实现类似功能通常需要复杂的查询语法,且效率很低。TDengine 以函数的方式内置了这些功能,最大程度的减轻了用户的使用成本。 - -### CSUM - -```sql -CSUM(expr) -``` - -**功能说明**:累加和(Cumulative sum),输出行与输入行数相同。 - -**返回结果类型**: 输入列如果是整数类型返回值为长整型 (int64_t),浮点数返回值为双精度浮点数(Double)。无符号整数类型返回值为无符号长整型(uint64_t)。 - -**适用数据类型**:数值类型。 - -**嵌套子查询支持**: 适用于内层查询和外层查询。 - -**适用于**:表和超级表。 - -**使用说明**: - -- 不支持 +、-、*、/ 运算,如 csum(col1) + csum(col2)。 -- 只能与聚合(Aggregation)函数一起使用。 该函数可以应用在普通表和超级表上。 - - -### DERIVATIVE - -```sql -DERIVATIVE(expr, time_interval, ignore_negative) - -ignore_negative: { - 0 - | 1 -} -``` - -**功能说明**:统计表中某列数值的单位变化率。其中单位时间区间的长度可以通过 time_interval 参数指定,最小可以是 1 秒(1s);ignore_negative 参数的值可以是 0 或 1,为 1 时表示忽略负值。 - -**返回数据类型**:DOUBLE。 - -**适用数据类型**:数值类型。 - -**适用于**:表和超级表。 - -**使用说明**: - -- 可以与选择相关联的列一起使用。 例如: select \_rowts, DERIVATIVE() from。 - -### DIFF - -```sql -DIFF(expr [, ignore_negative]) - -ignore_negative: { - 0 - | 1 -} -``` - -**功能说明**:统计表中某列的值与前一行对应值的差。 ignore_negative 取值为 0|1 , 可以不填,默认值为 0. 不忽略负值。ignore_negative 为 1 时表示忽略负数。 - -**返回数据类型**:同应用字段。 - -**适用数据类型**:数值类型。 - -**适用于**:表和超级表。 - -**使用说明**: - -- 输出结果行数是范围内总行数减一,第一行没有结果输出。 -- 可以与选择相关联的列一起使用。 例如: select \_rowts, DIFF() from。 - - -### IRATE - -```sql -IRATE(expr) -``` - -**功能说明**:计算瞬时增长率。使用时间区间中最后两个样本数据来计算瞬时增长速率;如果这两个值呈递减关系,那么只取最后一个数用于计算,而不是使用二者差值。 - -**返回数据类型**:DOUBLE。 - -**适用数据类型**:数值类型。 - -**适用于**:表和超级表。 - - -### MAVG - -```sql -MAVG(expr, k) -``` - -**功能说明**: 计算连续 k 个值的移动平均数(moving average)。如果输入行数小于 k,则无结果输出。参数 k 的合法输入范围是 1≤ k ≤ 1000。 - -**返回结果类型**: DOUBLE。 - -**适用数据类型**: 数值类型。 - -**嵌套子查询支持**: 适用于内层查询和外层查询。 - -**适用于**:表和超级表。 - -**使用说明**: - -- 不支持 +、-、*、/ 运算,如 mavg(col1, k1) + mavg(col2, k1); -- 只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用; - - -### STATECOUNT - -```sql -STATECOUNT(expr, oper, val) -``` - -**功能说明**:返回满足某个条件的连续记录的个数,结果作为新的一列追加在每行后面。条件根据参数计算,如果条件为 true 则加 1,条件为 false 则重置为-1,如果数据为 NULL,跳过该条数据。 - -**参数范围**: - -- oper : "LT" (小于)、"GT"(大于)、"LE"(小于等于)、"GE"(大于等于)、"NE"(不等于)、"EQ"(等于),不区分大小写。 -- val : 数值型 - -**返回结果类型**:INTEGER。 - -**适用数据类型**:数值类型。 - -**嵌套子查询支持**:不支持应用在子查询上。 - -**适用于**:表和超级表。 - -**使用说明**: - -- 不能和窗口操作一起使用,例如 interval/state_window/session_window。 - - -### STATEDURATION - -```sql -STATEDURATION(expr, oper, val, unit) -``` - -**功能说明**:返回满足某个条件的连续记录的时间长度,结果作为新的一列追加在每行后面。条件根据参数计算,如果条件为 true 则加上两个记录之间的时间长度(第一个满足条件的记录时间长度记为 0),条件为 false 则重置为-1,如果数据为 NULL,跳过该条数据。 - -**参数范围**: - -- oper : `'LT'` (小于)、`'GT'`(大于)、`'LE'`(小于等于)、`'GE'`(大于等于)、`'NE'`(不等于)、`'EQ'`(等于),不区分大小写,但需要用`''`包括。 -- val : 数值型 -- unit : 时间长度的单位,可取值时间单位: 1b(纳秒), 1u(微秒),1a(毫秒),1s(秒),1m(分),1h(小时),1d(天), 1w(周)。如果省略,默认为当前数据库精度。 - -**返回结果类型**:INTEGER。 - -**适用数据类型**:数值类型。 - -**嵌套子查询支持**:不支持应用在子查询上。 - -**适用于**:表和超级表。 - -**使用说明**: - -- 不能和窗口操作一起使用,例如 interval/state_window/session_window。 - - -### TWA - -```sql -TWA(expr) -``` - -**功能说明**:时间加权平均函数。统计表中某列在一段时间内的时间加权平均。 - -**返回数据类型**:DOUBLE。 - -**适用数据类型**:数值类型。 - -**适用于**:表和超级表。 - - -## 系统信息函数 - -### DATABASE - -```sql -SELECT DATABASE(); -``` - -**说明**:返回当前登录的数据库。如果登录的时候没有指定默认数据库,且没有使用USE命令切换数据库,则返回NULL。 - - -### CLIENT_VERSION - -```sql -SELECT CLIENT_VERSION(); -``` - -**说明**:返回客户端版本。 - -### SERVER_VERSION - -```sql -SELECT SERVER_VERSION(); -``` - -**说明**:返回服务端版本。 - -### SERVER_STATUS - -```sql -SELECT SERVER_STATUS(); -``` - -**说明**:检测服务端是否所有 dnode 都在线,如果是则返回成功,否则返回无法建立连接的错误。 - -### CURRENT_USER - -```sql -SELECT CURRENT_USER(); -``` - -**说明**:获取当前用户。 - - -## Geometry 函数 - -### Geometry 输入函数: - -#### ST_GeomFromText - -```sql -ST_GeomFromText(VARCHAR WKT expr) -``` - -**功能说明**:根据 Well-Known Text (WKT) 表示从指定的几何值创建几何数据。 - -**返回值类型**:GEOMETRY - -**适用数据类型**:VARCHAR - -**适用表类型**:标准表和超表 - -**使用说明**:输入可以是 WKT 字符串之一,例如点(POINT)、线串(LINESTRING)、多边形(POLYGON)、多点集(MULTIPOINT)、多线串(MULTILINESTRING)、多多边形(MULTIPOLYGON)、几何集合(GEOMETRYCOLLECTION)。输出是以二进制字符串形式定义的 GEOMETRY 数据类型。 - -### Geometry 输出函数: - -#### ST_AsText - -```sql -ST_AsText(GEOMETRY geom) -``` - -**功能说明**:从几何数据中返回指定的 Well-Known Text (WKT) 表示。 - -**返回值类型**:VARCHAR - -**适用数据类型**:GEOMETRY - -**适用表类型**:标准表和超表 - -**使用说明**:输出可以是 WKT 字符串之一,例如点(POINT)、线串(LINESTRING)、多边形(POLYGON)、多点集(MULTIPOINT)、多线串(MULTILINESTRING)、多多边形(MULTIPOLYGON)、几何集合(GEOMETRYCOLLECTION)。 - -### Geometry 关系函数: - -#### ST_Intersects - -```sql -ST_Intersects(GEOMETRY geomA, GEOMETRY geomB) -``` - -##功能说明**:比较两个几何对象,并在它们相交时返回 true。 - -**返回值类型**:BOOL - -**适用数据类型**:GEOMETRY,GEOMETRY - -**适用表类型**:标准表和超表 - -**使用说明**:如果两个几何对象有任何一个共享点,则它们相交。 - -#### ST_Equals - -```sql -ST_Equals(GEOMETRY geomA, GEOMETRY geomB) -``` - -**功能说明**:如果给定的几何对象是"空间相等"的,则返回 TRUE。 - -**返回值类型**:BOOL - -**适用数据类型**:GEOMETRY,GEOMETRY - -**适用表类型**:标准表和超表 - -**使用说明**:"空间相等"意味着 ST_Contains(A,B) = true 和 ST_Contains(B,A) = true,并且点的顺序可能不同,但表示相同的几何结构。 - -#### ST_Touches - -```sql -ST_Touches(GEOMETRY geomA, GEOMETRY geomB) -``` - -**功能说明**:如果 A 和 B 相交,但它们的内部不相交,则返回 TRUE。 - -**返回值类型**:BOOL - -**适用数据类型**:GEOMETRY,GEOMETRY - -**适用表类型**:标准表和超表 - -**使用说明**:A 和 B 至少有一个公共点,并且这些公共点位于至少一个边界中。对于点/点输入,关系始终为 FALSE,因为点没有边界。 - -#### ST_Covers - -```sql -ST_Covers(GEOMETRY geomA, GEOMETRY geomB) -``` - -**功能说明**:如果 B 中的每个点都位于几何形状 A 内部(与内部或边界相交),则返回 TRUE。 - -**返回值类型**:BOOL - -**适用数据类型**:GEOMETRY,GEOMETRY - -**适用表类型**:标准表和超表 - -**使用说明**:A 包含 B 意味着 B 中的没有点位于 A 的外部(在外部)。 - -#### ST_Contains - -```sql -ST_Contains(GEOMETRY geomA, GEOMETRY geomB) -``` - -**功能说明**:如果 A 包含 B,描述:如果几何形状 A 包含几何形状 B,则返回 TRUE。 - -**返回值类型**:BOOL - -**适用数据类型**:GEOMETRY,GEOMETRY - -**适用表类型**:标准表和超表 - -**使用说明**:A 包含 B 当且仅当 B 的所有点位于 A 的内部(即位于内部或边界上)(或等效地,B 的没有点位于 A 的外部),并且 A 和 B 的内部至少有一个公共点。 - -#### ST_ContainsProperly - -```sql -ST_ContainsProperly(GEOMETRY geomA, GEOMETRY geomB) -``` - -**功能说明**:如果 B 的每个点都位于 A 内部,则返回 TRUE。 - -**返回值类型**:BOOL - -**适用数据类型**:GEOMETRY,GEOMETRY - -**适用表类型**:标准表和超表 - -**使用说明**:B 的没有点位于 A 的边界或外部。 +--- +sidebar_label: 函数 +title: 函数 +description: TDengine 支持的函数列表 +toc_max_heading_level: 4 +--- + +## 单行函数 + +单行函数为查询结果中的每一行返回一个结果行。 + +### 数学函数 + +#### ABS + +```sql +ABS(expr) +``` + +**功能说明**:获得指定字段的绝对值。 + +**返回结果类型**:与指定字段的原始数据类型一致。 + +**适用数据类型**:数值类型。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**: 表和超级表。 + +**使用说明**:只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。 + +#### ACOS + +```sql +ACOS(expr) +``` + +**功能说明**:获得指定字段的反余弦结果。 + +**返回结果类型**:DOUBLE。 + +**适用数据类型**:数值类型。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**: 表和超级表。 + +**使用说明**:只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。 + +#### ASIN + +```sql +ASIN(expr) +``` + +**功能说明**:获得指定字段的反正弦结果。 + +**返回结果类型**:DOUBLE。 + +**适用数据类型**:数值类型。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**: 表和超级表。 + +**使用说明**:只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。 + + +#### ATAN + +```sql +ATAN(expr) +``` + +**功能说明**:获得指定字段的反正切结果。 + +**返回结果类型**:DOUBLE。 + +**适用数据类型**:数值类型。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**: 表和超级表。 + +**使用说明**:只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。 + + +#### CEIL + +```sql +CEIL(expr) +``` + +**功能说明**:获得指定字段的向上取整数的结果。 + +**返回结果类型**:与指定字段的原始数据类型一致。 + +**适用数据类型**:数值类型。 + +**适用于**: 表和超级表。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**使用说明**: 只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。 + +#### COS + +```sql +COS(expr) +``` + +**功能说明**:获得指定字段的余弦结果。 + +**返回结果类型**:DOUBLE。 + +**适用数据类型**:数值类型。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**: 表和超级表。 + +**使用说明**:只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。 + +#### FLOOR + +```sql +FLOOR(expr) +``` + +**功能说明**:获得指定字段的向下取整数的结果。 + 其他使用说明参见 CEIL 函数描述。 + +#### LOG + +```sql +LOG(expr1[, expr2]) +``` + +**功能说明**:获得 expr1 对于底数 expr2 的对数。如果 expr2 参数省略,则返回指定字段的自然对数值。 + +**返回结果类型**:DOUBLE。 + +**适用数据类型**:数值类型。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**: 表和超级表。 + +**使用说明**:只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。 + + +#### POW + +```sql +POW(expr1, expr2) +``` + +**功能说明**:获得 expr1 的指数为 expr2 的幂。 + +**返回结果类型**:DOUBLE。 + +**适用数据类型**:数值类型。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**: 表和超级表。 + +**使用说明**:只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。 + + +#### ROUND + +```sql +ROUND(expr) +``` + +**功能说明**:获得指定字段的四舍五入的结果。 + 其他使用说明参见 CEIL 函数描述。 + + +#### SIN + +```sql +SIN(expr) +``` + +**功能说明**:获得指定字段的正弦结果。 + +**返回结果类型**:DOUBLE。 + +**适用数据类型**:数值类型。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**: 表和超级表。 + +**使用说明**:只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。 + +#### SQRT + +```sql +SQRT(expr) +``` + +**功能说明**:获得指定字段的平方根。 + +**返回结果类型**:DOUBLE。 + +**适用数据类型**:数值类型。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**: 表和超级表。 + +**使用说明**:只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。 + +#### TAN + +```sql +TAN(expr) +``` + +**功能说明**:获得指定字段的正切结果。 + +**返回结果类型**:DOUBLE。 + +**适用数据类型**:数值类型。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**: 表和超级表。 + +**使用说明**:只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。 + +### 字符串函数 + +字符串函数的输入参数为字符串类型,返回结果为数值类型或字符串类型。 + +#### CHAR_LENGTH + +```sql +CHAR_LENGTH(expr) +``` + +**功能说明**:以字符计数的字符串长度。 + +**返回结果类型**:BIGINT。 + +**适用数据类型**:VARCHAR, NCHAR。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**: 表和超级表。 + +#### CONCAT + +```sql +CONCAT(expr1, expr2 [, expr] ... ) +``` + +**功能说明**:字符串连接函数。 + +**返回结果类型**:如果所有参数均为 VARCHAR 类型,则结果类型为 VARCHAR。如果参数包含NCHAR类型,则结果类型为NCHAR。如果参数包含NULL值,则输出值为NULL。 + +**适用数据类型**:VARCHAR, NCHAR。 该函数最小参数个数为2个,最大参数个数为8个。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**: 表和超级表。 + + +#### CONCAT_WS + +```sql +CONCAT_WS(separator_expr, expr1, expr2 [, expr] ...) +``` + +**功能说明**:带分隔符的字符串连接函数。 + +**返回结果类型**:如果所有参数均为VARCHAR类型,则结果类型为VARCHAR。如果参数包含NCHAR类型,则结果类型为NCHAR。如果参数包含NULL值,则输出值为NULL。 + +**适用数据类型**:VARCHAR, NCHAR。 该函数最小参数个数为3个,最大参数个数为9个。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**: 表和超级表。 + + +#### LENGTH + +```sql +LENGTH(expr) +``` + +**功能说明**:以字节计数的长度。 + +**返回结果类型**:BIGINT。 + +**适用数据类型**:VARCHAR, NCHAR, VARBINARY。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**: 表和超级表。 + + +#### LOWER + +```sql +LOWER(expr) +``` + +**功能说明**:将字符串参数值转换为全小写字母。 + +**返回结果类型**:与输入字段的原始类型相同。 + +**适用数据类型**:VARCHAR, NCHAR。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**: 表和超级表。 + + +#### LTRIM + +```sql +LTRIM(expr) +``` + +**功能说明**:返回清除左边空格后的字符串。 + +**返回结果类型**:与输入字段的原始类型相同。 + +**适用数据类型**:VARCHAR, NCHAR。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**: 表和超级表。 + + +#### RTRIM + +```sql +RTRIM(expr) +``` + +**功能说明**:返回清除右边空格后的字符串。 + +**返回结果类型**:与输入字段的原始类型相同。 + +**适用数据类型**:VARCHAR, NCHAR。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**: 表和超级表。 + + +#### SUBSTR + +```sql +SUBSTR(expr, pos [,len]) +``` + +**功能说明**:从源字符串 str 中的指定位置 pos 开始取一个长度为 len 的子串并返回。如果输入参数 len 被忽略,返回的子串包含从 pos 开始的整个字串。 + +**返回结果类型**:与输入字段的原始类型相同。 + +**适用数据类型**:VARCHAR, NCHAR。输入参数 pos 可以为正数,也可以为负数。如果 pos 是正数,表示开始位置从字符串开头正数计算。如果 pos 为负数,表示开始位置从字符串结尾倒数计算。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**: 表和超级表。 + + +#### UPPER + +```sql +UPPER(expr) +``` + +**功能说明**:将字符串参数值转换为全大写字母。 + +**返回结果类型**:与输入字段的原始类型相同。 + +**适用数据类型**:VARCHAR, NCHAR。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**: 表和超级表。 + + +### 转换函数 + +转换函数将值从一种数据类型转换为另一种数据类型。 + +#### CAST + +```sql +CAST(expr AS type_name) +``` + +**功能说明**:数据类型转换函数,返回 expr 转换为 type_name 指定的类型后的结果。只适用于 select 子句中。 + +**返回结果类型**:CAST 中指定的类型(type_name)。 + +**适用数据类型**:输入参数 expr 的类型可以是除JSON和VARBINARY外的所有类型。如果 type_name 为 VARBINARY,则 expr 只能是 VARCHAR 类型。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**: 表和超级表。 + +**使用说明**: + +- 对于不能支持的类型转换会直接报错。 +- 对于类型支持但某些值无法正确转换的情况,对应的转换后的值以转换函数输出为准。目前可能遇到的几种情况: + 1)字符串类型转换数值类型时可能出现的无效字符情况,例如"a"可能转为0,但不会报错。 + 2)转换到数值类型时,数值大于type_name可表示的范围时,则会溢出,但不会报错。 + 3)转换到字符串类型时,如果转换后长度超过type_name中指定的长度,则会截断,但不会报错。 + +#### TO_ISO8601 + +```sql +TO_ISO8601(expr [, timezone]) +``` + +**功能说明**:将 UNIX 时间戳转换成为 ISO8601 标准的日期时间格式,并附加时区信息。timezone 参数允许用户为输出结果指定附带任意时区信息。如果 timezone 参数省略,输出结果则附带当前客户端的系统时区信息。 + +**返回结果数据类型**:VARCHAR 类型。 + +**适用数据类型**:INTEGER, TIMESTAMP。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**: 表和超级表。 + +**使用说明**: + +- timezone 参数允许输入的时区格式为: [z/Z, +/-hhmm, +/-hh, +/-hh:mm]。例如,TO_ISO8601(1, "+00:00")。 +- 如果输入是表示 UNIX 时间戳的整形,返回格式精度由时间戳的位数决定; +- 如果输入是 TIMESTAMP 类型的列,返回格式的时间戳精度与当前 DATABASE 设置的时间精度一致。 + + +#### TO_JSON + +```sql +TO_JSON(str_literal) +``` + +**功能说明**: 将字符串常量转换为 JSON 类型。 + +**返回结果数据类型**: JSON。 + +**适用数据类型**: JSON 字符串,形如 '{ "literal" : literal }'。'{}'表示空值。键必须为字符串字面量,值可以为数值字面量、字符串字面量、布尔字面量或空值字面量。str_literal中不支持转义符。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**: 表和超级表。 + + +#### TO_UNIXTIMESTAMP + +```sql +TO_UNIXTIMESTAMP(expr [, return_timestamp]) + +return_timestamp: { + 0 + | 1 +} +``` + +**功能说明**:将日期时间格式的字符串转换成为 UNIX 时间戳。 + +**返回结果数据类型**:BIGINT, TIMESTAMP。 + +**应用字段**:VARCHAR, NCHAR。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**适用于**:表和超级表。 + +**使用说明**: + +- 输入的日期时间字符串须符合 ISO8601/RFC3339 标准,无法转换的字符串格式将返回 NULL。 +- 返回的时间戳精度与当前 DATABASE 设置的时间精度一致。 +- return_timestamp 指定函数返回值是否为时间戳类型,设置为1时返回 TIMESTAMP 类型,设置为0时返回 BIGINT 类型。如不指定缺省返回 BIGINT 类型。 + +#### TO_CHAR + +```sql +TO_CHAR(ts, format_str_literal) +``` + +**功能说明**: 将timestamp类型按照指定格式转换为字符串 + +**返回结果数据类型**: VARCHAR + +**应用字段**: TIMESTAMP + +**嵌套子查询支持**: 适用于内层查询和外层查询 + +**适用于**: 表和超级表 + +**支持的格式** + +| **格式** | **说明**| **例子** | +| --- | --- | --- | +|AM,am,PM,pm| 无点分隔的上午下午 | 07:00:00am| +|A.M.,a.m.,P.M.,p.m.| 有点分隔的上午下午| 07:00:00a.m.| +|YYYY,yyyy|年, 4个及以上数字| 2023-10-10| +|YYY,yyy| 年, 最后3位数字| 023-10-10| +|YY,yy| 年, 最后2位数字| 23-10-10| +|Y,y|年, 最后一位数字| 3-10-10| +|MONTH|月, 全大写| 2023-JANUARY-01| +|Month|月, 首字母大写| 2023-January-01| +|month|月, 全小写| 2023-january-01| +|MON| 月, 缩写, 全大写(三个字符)| JAN, SEP| +|Mon| 月, 缩写, 首字母大写| Jan, Sep| +|mon|月, 缩写, 全小写| jan, sep| +|MM,mm|月, 数字 01-12|2023-01-01| +|DD,dd|月日, 01-31|| +|DAY|周日, 全大写|MONDAY| +|Day|周日, 首字符大写|Monday| +|day|周日, 全小写|monday| +|DY|周日, 缩写, 全大写|MON| +|Dy|周日, 缩写, 首字符大写|Mon| +|dy|周日, 缩写, 全小写|mon| +|DDD|年日, 001-366|| +|D,d|周日, 数字, 1-7, Sunday(1) to Saturday(7)|| +|HH24,hh24|小时, 00-23|2023-01-30 23:59:59| +|hh12,HH12, hh, HH| 小时, 01-12|2023-01-30 12:59:59PM| +|MI,mi|分钟, 00-59|| +|SS,ss|秒, 00-59|| +|MS,ms|毫秒, 000-999|| +|US,us|微秒, 000000-999999|| +|NS,ns|纳秒, 000000000-999999999|| +|TZH,tzh|时区小时|2023-01-30 11:59:59PM +08| + +**使用说明**: +- `Month`, `Day`等的输出格式是左对齐的, 右侧添加空格, 如`2023-OCTOBER -01`, `2023-SEPTEMBER-01`, 9月是月份中英文字母数最长的, 因此9月没有空格. 星期类似. +- 使用`ms`, `us`, `ns`时, 以上三种格式的输出只在精度上不同, 比如ts为 `1697182085123`, `ms` 的输出为 `123`, `us` 的输出为 `123000`, `ns` 的输出为 `123000000`. +- 时间格式中无法匹配规则的内容会直接输出. 如果想要在格式串中指定某些能够匹配规则的部分不做转换, 可以使用双引号, 如`to_char(ts, 'yyyy-mm-dd "is formated by yyyy-mm-dd"')`. 如果想要输出双引号, 那么在双引号之前加一个反斜杠, 如 `to_char(ts, '\"yyyy-mm-dd\"')` 将会输出 `"2023-10-10"`. +- 那些输出是数字的格式, 如`YYYY`, `DD`, 大写与小写意义相同, 即`yyyy` 和 `YYYY` 可以互换. +- 推荐在时间格式中带时区信息,如果不带则默认输出的时区为服务端或客户端所配置的时区. +- 输入时间戳的精度由所查询表的精度确定, 若未指定表, 则精度为毫秒. + +#### TO_TIMESTAMP + +```sql +TO_TIMESTAMP(ts_str_literal, format_str_literal) +``` + +**功能说明**: 将字符串按照指定格式转化为时间戳. + +**返回结果数据类型**: TIMESTAMP + +**应用字段**: VARCHAR + +**嵌套子查询支持**: 适用于内层查询和外层查询 + +**适用于**: 表和超级表 + +**支持的格式**: 与`to_char`相同 + +**使用说明**: +- 若`ms`, `us`, `ns`同时指定, 那么结果时间戳包含上述三个字段的和. 如 `to_timestamp('2023-10-10 10:10:10.123.000456.000000789', 'yyyy-mm-dd hh:mi:ss.ms.us.ns')` 输出为 `2023-10-10 10:10:10.123456789`对应的时间戳. +- `MONTH`, `MON`, `DAY`, `DY` 以及其他输出为数字的格式的大小写意义相同, 如 `to_timestamp('2023-JANUARY-01', 'YYYY-month-dd')`, `month`可以被替换为`MONTH` 或者`Month`. +- 如果同一字段被指定了多次, 那么前面的指定将会被覆盖. 如 `to_timestamp('2023-22-10-10', 'yyyy-yy-MM-dd')`, 输出年份是`2022`. +- 为避免转换时使用了非预期的时区,推荐在时间中携带时区信息,例如'2023-10-10 10:10:10+08',如果未指定时区则默认时区为服务端或客户端指定的时区。 +- 如果没有指定完整的时间,那么默认时间值为指定或默认时区的 `1970-01-01 00:00:00`, 未指定部分使用该默认值中的对应部分. 暂不支持只指定年日而不指定月日的格式, 如'yyyy-mm-DDD', 支持'yyyy-mm-DD'. +- 如果格式串中有`AM`, `PM`等, 那么小时必须是12小时制, 范围必须是01-12. +- `to_timestamp`转换具有一定的容错机制, 在格式串和时间戳串不完全对应时, 有时也可转换, 如: `to_timestamp('200101/2', 'yyyyMM1/dd')`, 格式串中多出来的1会被丢弃. 格式串与时间戳串中多余的空格字符(空格, tab等)也会被 自动忽略. 如`to_timestamp(' 23 年 - 1 月 - 01 日 ', 'yy 年-MM月-dd日')` 可以被成功转换. 虽然`MM`等字段需要两个数字对应(只有一位时前面补0), 在`to_timestamp`时, 一个数字也可以成功转换. +- 输出时间戳的精度与查询表的精度相同, 若查询未指定表, 则输出精度为毫秒. 如`select to_timestamp('2023-08-1 10:10:10.123456789', 'yyyy-mm-dd hh:mi:ss.ns')`的输出将会把微妙和纳秒进行截断. 如果指定一张纳秒表, 那么就不会发生截断, 如`select to_timestamp('2023-08-1 10:10:10.123456789', 'yyyy-mm-dd hh:mi:ss.ns') from db_ns.table_ns limit 1`. + + +### 时间和日期函数 + +时间和日期函数对时间戳类型进行操作。 + +所有返回当前时间的函数,如NOW、TODAY和TIMEZONE,在一条SQL语句中不论出现多少次都只会被计算一次。 + +#### NOW + +```sql +NOW() +``` + +**功能说明**:返回客户端当前系统时间。 + +**返回结果数据类型**:TIMESTAMP。 + +**应用字段**:在 WHERE 或 INSERT 语句中使用时只能作用于 TIMESTAMP 类型的字段。 + +**适用于**:表和超级表。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**使用说明**: + +- 支持时间加减操作,如 NOW() + 1s, 支持的时间单位如下: + b(纳秒)、u(微秒)、a(毫秒)、s(秒)、m(分)、h(小时)、d(天)、w(周)。 +- 返回的时间戳精度与当前 DATABASE 设置的时间精度一致。 + + +#### TIMEDIFF + +```sql +TIMEDIFF(expr1, expr2 [, time_unit]) +``` + +**功能说明**:计算两个时间戳之间的差值,并近似到时间单位 time_unit 指定的精度。 + +**返回结果数据类型**:BIGINT。 + +**应用字段**:表示 UNIX 时间戳的 BIGINT, TIMESTAMP 类型,或符合日期时间格式的 VARCHAR, NCHAR 类型。 + +**适用于**:表和超级表。 + +**嵌套子查询支持**:适用于内层查询和外层查询。 + +**使用说明**: +- 支持的时间单位 time_unit 如下: + 1b(纳秒), 1u(微秒),1a(毫秒),1s(秒),1m(分),1h(小时),1d(天), 1w(周)。 +- 如果时间单位 time_unit 未指定, 返回的时间差值精度与当前 DATABASE 设置的时间精度一致。 +- 输入包含不符合时间日期格式的字符串则返回 NULL。 + + +#### TIMETRUNCATE + +```sql +TIMETRUNCATE(expr, time_unit [, use_current_timezone]) + +use_current_timezone: { + 0 + | 1 +} +``` + +**功能说明**:将时间戳按照指定时间单位 time_unit 进行截断。 + +**返回结果数据类型**:TIMESTAMP。 + +**应用字段**:表示 UNIX 时间戳的 BIGINT, TIMESTAMP 类型,或符合日期时间格式的 VARCHAR, NCHAR 类型。 + +**适用于**:表和超级表。 + +**使用说明**: +- 支持的时间单位 time_unit 如下: + 1b(纳秒), 1u(微秒),1a(毫秒),1s(秒),1m(分),1h(小时),1d(天), 1w(周)。 +- 返回的时间戳精度与当前 DATABASE 设置的时间精度一致。 +- 输入包含不符合时间日期格式的字符串则返回 NULL。 +- 当使用 1d/1w 作为时间单位对时间戳进行截断时, 可通过设置 use_current_timezone 参数指定是否根据当前时区进行截断处理。 + 值 0 表示使用 UTC 时区进行截断,值 1 表示使用当前时区进行截断。 + 例如客户端所配置时区为 UTC+0800, 则 TIMETRUNCATE('2020-01-01 23:00:00', 1d, 0) 返回结果为东八区时间 '2020-01-01 08:00:00'。 + 而使用 TIMETRUNCATE('2020-01-01 23:00:00', 1d, 1) 时,返回结果为东八区时间 '2020-01-01 00:00:00'。 + 当不指定 use_current_timezone 时,use_current_timezone 默认值为 1 。 + + + +#### TIMEZONE + +```sql +TIMEZONE() +``` + +**功能说明**:返回客户端当前时区信息。 + +**返回结果数据类型**:VARCHAR。 + +**应用字段**:无 + +**适用于**:表和超级表。 + + +#### TODAY + +```sql +TODAY() +``` + +**功能说明**:返回客户端当日零时的系统时间。 + +**返回结果数据类型**:TIMESTAMP。 + +**应用字段**:在 WHERE 或 INSERT 语句中使用时只能作用于 TIMESTAMP 类型的字段。 + +**适用于**:表和超级表。 + +**使用说明**: + +- 支持时间加减操作,如 TODAY() + 1s, 支持的时间单位如下: + b(纳秒),u(微秒),a(毫秒),s(秒),m(分),h(小时),d(天),w(周)。 +- 返回的时间戳精度与当前 DATABASE 设置的时间精度一致。 + + +## 聚合函数 + +聚合函数为查询结果集的每一个分组返回单个结果行。可以由 GROUP BY 或窗口切分子句指定分组,如果没有,则整个查询结果集视为一个分组。 + +TDengine 支持针对数据的聚合查询。提供如下聚合函数。 + +### APERCENTILE + +```sql +APERCENTILE(expr, p [, algo_type]) + +algo_type: { + "default" + | "t-digest" +} +``` + +**功能说明**:统计表/超级表中指定列的值的近似百分比分位数,与 PERCENTILE 函数相似,但是返回近似结果。 + +**返回数据类型**: DOUBLE。 + +**适用数据类型**:数值类型。 + +**适用于**:表和超级表。 + +**说明**: +- p值范围是[0,100],当为0时等同于MIN,为100时等同于MAX。 +- algo_type 取值为 "default" 或 "t-digest"。 输入为 "default" 时函数使用基于直方图算法进行计算。输入为 "t-digest" 时使用t-digest算法计算分位数的近似结果。如果不指定 algo_type 则使用 "default" 算法。 +- "t-digest"算法的近似结果对于输入数据顺序敏感,对超级表查询时不同的输入排序结果可能会有微小的误差。 + +### AVG + +```sql +AVG(expr) +``` + +**功能说明**:统计指定字段的平均值。 + +**返回数据类型**:DOUBLE。 + +**适用数据类型**:数值类型。 + +**适用于**:表和超级表。 + + +### COUNT + +```sql +COUNT({* | expr}) +``` + +**功能说明**:统计指定字段的记录行数。 + +**返回数据类型**:BIGINT。 + +**适用数据类型**:全部类型字段。 + +**适用于**:表和超级表。 + +**使用说明**: + +- 可以使用星号(\*)来替代具体的字段,使用星号(\*)返回全部记录数量。 +- 如果统计字段是具体的列,则返回该列中非 NULL 值的记录数量。 + + +### ELAPSED + +```sql +ELAPSED(ts_primary_key [, time_unit]) +``` + +**功能说明**:elapsed函数表达了统计周期内连续的时间长度,和twa函数配合使用可以计算统计曲线下的面积。在通过INTERVAL子句指定窗口的情况下,统计在给定时间范围内的每个窗口内有数据覆盖的时间范围;如果没有INTERVAL子句,则返回整个给定时间范围内的有数据覆盖的时间范围。注意,ELAPSED返回的并不是时间范围的绝对值,而是绝对值除以time_unit所得到的单位个数。 + +**返回结果类型**:DOUBLE。 + +**适用数据类型**:TIMESTAMP。 + +**适用于**: 表,超级表,嵌套查询的外层查询 + +**说明**: +- ts_primary_key参数只能是表的第一列,即 TIMESTAMP 类型的主键列。 +- 按time_unit参数指定的时间单位返回,最小是数据库的时间分辨率。time_unit 参数未指定时,以数据库的时间分辨率为时间单位。支持的时间单位 time_unit 如下: + 1b(纳秒), 1u(微秒),1a(毫秒),1s(秒),1m(分),1h(小时),1d(天), 1w(周)。 +- 可以和interval组合使用,返回每个时间窗口的时间戳差值。需要特别注意的是,除第一个时间窗口和最后一个时间窗口外,中间窗口的时间戳差值均为窗口长度。 +- order by asc/desc不影响差值的计算结果。 +- 对于超级表,需要和group by tbname子句组合使用,不可以直接使用。 +- 对于普通表,不支持和group by子句组合使用。 +- 对于嵌套查询,仅当内层查询会输出隐式时间戳列时有效。例如select elapsed(ts) from (select diff(value) from sub1)语句,diff函数会让内层查询输出隐式时间戳列,此为主键列,可以用于elapsed函数的第一个参数。相反,例如select elapsed(ts) from (select * from sub1) 语句,ts列输出到外层时已经没有了主键列的含义,无法使用elapsed函数。此外,elapsed函数作为一个与时间线强依赖的函数,形如select elapsed(ts) from (select diff(value) from st group by tbname)尽管会返回一条计算结果,但并无实际意义,这种用法后续也将被限制。 +- 不支持与leastsquares、diff、derivative、top、bottom、last_row、interp等函数混合使用。 + + +### LEASTSQUARES + +```sql +LEASTSQUARES(expr, start_val, step_val) +``` + +**功能说明**:统计表中某列的值的拟合直线方程。start_val 是自变量初始值,step_val 是自变量的步长值。 + +**返回数据类型**:字符串表达式(斜率, 截距)。 + +**适用数据类型**:expr 必须是数值类型。 + +**适用于**:表。 + + +### SPREAD + +```sql +SPREAD(expr) +``` + +**功能说明**:统计表中某列的最大值和最小值之差。 + +**返回数据类型**:DOUBLE。 + +**适用数据类型**:INTEGER, TIMESTAMP。 + +**适用于**:表和超级表。 + + +### STDDEV + +```sql +STDDEV(expr) +``` + +**功能说明**:统计表中某列的均方差。 + +**返回数据类型**:DOUBLE。 + +**适用数据类型**:数值类型。 + +**适用于**:表和超级表。 + + +### SUM + +```sql +SUM(expr) +``` + +**功能说明**:统计表/超级表中某列的和。 + +**返回数据类型**:DOUBLE, BIGINT。 + +**适用数据类型**:数值类型。 + +**适用于**:表和超级表。 + + +### HYPERLOGLOG + +```sql +HYPERLOGLOG(expr) +``` + +**功能说明**: + - 采用 hyperloglog 算法,返回某列的基数。该算法在数据量很大的情况下,可以明显降低内存的占用,求出来的基数是个估算值,标准误差(标准误差是多次实验,每次的平均数的标准差,不是与真实结果的误差)为 0.81%。 + - 在数据量较少的时候该算法不是很准确,可以使用 select count(data) from (select unique(col) as data from table) 的方法。 + +**返回结果类型**:INTEGER。 + +**适用数据类型**:任何类型。 + +**适用于**:表和超级表。 + + +### HISTOGRAM + +```sql +HISTOGRAM(expr,bin_type, bin_description, normalized) +``` + +**功能说明**:统计数据按照用户指定区间的分布。 + +**返回结果类型**:如归一化参数 normalized 设置为 1,返回结果为 DOUBLE 类型,否则为 BIGINT 类型。 + +**适用数据类型**:数值型字段。 + +**适用于**: 表和超级表。 + +**详细说明**: +- bin_type 用户指定的分桶类型, 有效输入类型为"user_input“, ”linear_bin", "log_bin"。 +- bin_description 描述如何生成分桶区间,针对三种桶类型,分别为以下描述格式(均为 JSON 格式字符串): + - "user_input": "[1, 3, 5, 7]" + 用户指定 bin 的具体数值。 + + - "linear_bin": "{"start": 0.0, "width": 5.0, "count": 5, "infinity": true}" + "start" 表示数据起始点,"width" 表示每次 bin 偏移量, "count" 为 bin 的总数,"infinity" 表示是否添加(-inf, inf)作为区间起点和终点, + 生成区间为[-inf, 0.0, 5.0, 10.0, 15.0, 20.0, +inf]。 + + - "log_bin": "{"start":1.0, "factor": 2.0, "count": 5, "infinity": true}" + "start" 表示数据起始点,"factor" 表示按指数递增的因子,"count" 为 bin 的总数,"infinity" 表示是否添加(-inf, inf)作为区间起点和终点, + 生成区间为[-inf, 1.0, 2.0, 4.0, 8.0, 16.0, +inf]。 +- normalized 是否将返回结果归一化到 0~1 之间 。有效输入为 0 和 1。 + + +### PERCENTILE + +```sql +PERCENTILE(expr, p [, p1] ... ) +``` + +**功能说明**:统计表中某列的值百分比分位数。 + +**返回数据类型**: 该函数最小参数个数为 2 个,最大参数个数为 11 个。可以最多同时返回 10 个百分比分位数。当参数个数为 2 时, 返回一个分位数, 类型为DOUBLE,当参数个数大于 2 时,返回类型为VARCHAR, 格式为包含多个返回值的JSON数组。 + +**应用字段**:数值类型。 + +**适用于**:表。 + +**使用说明**: + +- *P*值取值范围 0≤*P*≤100,为 0 的时候等同于 MIN,为 100 的时候等同于 MAX; +- 同时计算针对同一列的多个分位数时,建议使用一个PERCENTILE函数和多个参数的方式,能很大程度上降低查询的响应时间。 + 比如,使用查询SELECT percentile(col, 90, 95, 99) FROM table, 性能会优于SELECT percentile(col, 90), percentile(col, 95), percentile(col, 99) from table。 + + +## 选择函数 + +选择函数根据语义在查询结果集中选择一行或多行结果返回。用户可以同时指定输出 ts 列或其他列(包括 tbname 和标签列),这样就可以方便地知道被选出的值是源于哪个数据行的。 + +### BOTTOM + +```sql +BOTTOM(expr, k) +``` + +**功能说明**:统计表/超级表中某列的值最小 _k_ 个非 NULL 值。如果多条数据取值一样,全部取用又会超出 k 条限制时,系统会从相同值中随机选取符合要求的数量返回。 + +**返回数据类型**:同应用的字段。 + +**适用数据类型**:数值类型。 + +**适用于**:表和超级表。 + +**使用说明**: + +- *k*值取值范围 1≤*k*≤100; +- 系统同时返回该记录关联的时间戳列; +- 限制:BOTTOM 函数不支持 FILL 子句。 + +### FIRST + +```sql +FIRST(expr) +``` + +**功能说明**:统计表/超级表中某列的值最先写入的非 NULL 值。 + +**返回数据类型**:同应用的字段。 + +**适用数据类型**:所有字段。 + +**适用于**:表和超级表。 + +**使用说明**: + +- 如果要返回各个列的首个(时间戳最小)非 NULL 值,可以使用 FIRST(\*); +- 如果结果集中的某列全部为 NULL 值,则该列的返回结果也是 NULL; +- 如果结果集中所有列全部为 NULL 值,则不返回结果。 + +### INTERP + +```sql +INTERP(expr [, ignore_null_values]) + +ignore_null_values: { + 0 + | 1 +} +``` + +**功能说明**:返回指定时间截面指定列的记录值或插值。ignore_null_values 参数的值可以是 0 或 1,为 1 时表示忽略 NULL 值, 缺省值为0。 + +**返回数据类型**:同字段类型。 + +**适用数据类型**:数值类型。 + +**适用于**:表和超级表。 + +**使用说明** + +- INTERP 用于在指定时间断面获取指定列的记录值,如果该时间断面不存在符合条件的行数据,那么会根据 FILL 参数的设定进行插值。 +- INTERP 的输入数据为指定列的数据,可以通过条件语句(where 子句)来对原始列数据进行过滤,如果没有指定过滤条件则输入为全部数据。 +- INTERP 需要同时与 RANGE,EVERY 和 FILL 关键字一起使用。 +- INTERP 的输出时间范围根据 RANGE(timestamp1, timestamp2)字段来指定,需满足 timestamp1 <= timestamp2。其中 timestamp1 为输出时间范围的起始值,即如果 timestamp1 时刻符合插值条件则 timestamp1 为输出的第一条记录,timestamp2 为输出时间范围的结束值,即输出的最后一条记录的 timestamp 不能大于 timestamp2。 +- INTERP 根据 EVERY(time_unit) 字段来确定输出时间范围内的结果条数,即从 timestamp1 开始每隔固定长度的时间(time_unit 值)进行插值,time_unit 可取值时间单位:1a(毫秒),1s(秒),1m(分),1h(小时),1d(天),1w(周)。例如 EVERY(500a) 将对于指定数据每500毫秒间隔进行一次插值. +- INTERP 根据 FILL 字段来决定在每个符合输出条件的时刻如何进行插值。关于 FILL 子句如何使用请参考 [FILL 子句](../distinguished/#fill-子句) +- INTERP 可以在 RANGE 字段中只指定唯一的时间戳对单个时间点进行插值,在这种情况下,EVERY 字段可以省略。例如:SELECT INTERP(col) FROM tb RANGE('2023-01-01 00:00:00') FILL(linear). +- INTERP 作用于超级表时, 会将该超级表下的所有子表数据按照主键列排序后进行插值计算,也可以搭配 PARTITION BY tbname 使用,将结果强制规约到单个时间线。 +- INTERP 可以与伪列 _irowts 一起使用,返回插值点所对应的时间戳(3.0.2.0版本以后支持)。 +- INTERP 可以与伪列 _isfilled 一起使用,显示返回结果是否为原始记录或插值算法产生的数据(3.0.3.0版本以后支持)。 + +### LAST + +```sql +LAST(expr) +``` + +**功能说明**:统计表/超级表中某列的值最后写入的非 NULL 值。 + +**返回数据类型**:同应用的字段。 + +**适用数据类型**:所有字段。 + +**适用于**:表和超级表。 + +**使用说明**: + +- 如果要返回各个列的最后(时间戳最大)一个非 NULL 值,可以使用 LAST(\*); +- 如果结果集中的某列全部为 NULL 值,则该列的返回结果也是 NULL;如果结果集中所有列全部为 NULL 值,则不返回结果。 +- 在用于超级表时,时间戳完全一样且同为最大的数据行可能有多个,那么会从中随机返回一条,而并不保证多次运行所挑选的数据行必然一致。 + + +### LAST_ROW + +```sql +LAST_ROW(expr) +``` + +**功能说明**:返回表/超级表的最后一条记录。 + +**返回数据类型**:同应用的字段。 + +**适用数据类型**:所有字段。 + +**适用于**:表和超级表。 + +**使用说明**: + +- 在用于超级表时,时间戳完全一样且同为最大的数据行可能有多个,那么会从中随机返回一条,而并不保证多次运行所挑选的数据行必然一致。 +- 不能与 INTERVAL 一起使用。 + +### MAX + +```sql +MAX(expr) +``` + +**功能说明**:统计表/超级表中某列的值最大值。 + +**返回数据类型**:同应用的字段。 + +**适用数据类型**:数值类型。 + +**适用于**:表和超级表。 + + +### MIN + +```sql +MIN(expr) +``` + +**功能说明**:统计表/超级表中某列的值最小值。 + +**返回数据类型**:同应用的字段。 + +**适用数据类型**:数值类型。 + +**适用于**:表和超级表。 + + +### MODE + +```sql +MODE(expr) +``` + +**功能说明**:返回出现频率最高的值,若存在多个频率相同的最高值,则随机输出其中某个值。 + +**返回数据类型**:与输入数据类型一致。 + +**适用数据类型**:全部类型字段。 + +**适用于**:表和超级表。 + + +### SAMPLE + +```sql +SAMPLE(expr, k) +``` + +**功能说明**: 获取数据的 k 个采样值。参数 k 的合法输入范围是 1≤ k ≤ 1000。 + +**返回结果类型**: 同原始数据类型。 + +**适用数据类型**: 全部类型字段。 + +**嵌套子查询支持**: 适用于内层查询和外层查询。 + +**适用于**:表和超级表。 + + +### TAIL + +```sql +TAIL(expr, k [, offset_rows]) +``` + +**功能说明**:返回跳过最后 offset_val 个,然后取连续 k 个记录,不忽略 NULL 值。offset_val 可以不输入。此时返回最后的 k 个记录。当有 offset_val 输入的情况下,该函数功能等效于 `order by ts desc LIMIT k OFFSET offset_val`。 + +**参数范围**:k: [1,100] offset_val: [0,100]。 + +**返回数据类型**:同应用的字段。 + +**适用数据类型**:适合于除时间主键列外的任何类型。 + +**适用于**:表、超级表。 + + +### TOP + +```sql +TOP(expr, k) +``` + +**功能说明**: 统计表/超级表中某列的值最大 _k_ 个非 NULL 值。如果多条数据取值一样,全部取用又会超出 k 条限制时,系统会从相同值中随机选取符合要求的数量返回。 + +**返回数据类型**:同应用的字段。 + +**适用数据类型**:数值类型。 + +**适用于**:表和超级表。 + +**使用说明**: + +- *k*值取值范围 1≤*k*≤100; +- 系统同时返回该记录关联的时间戳列; +- 限制:TOP 函数不支持 FILL 子句。 + +### UNIQUE + +```sql +UNIQUE(expr) +``` + +**功能说明**:返回该列数据首次出现的值。该函数功能与 distinct 相似。 + +**返回数据类型**:同应用的字段。 + +**适用数据类型**:全部类型字段。 + +**适用于**: 表和超级表。 + + +## 时序数据特有函数 + +时序数据特有函数是 TDengine 为了满足时序数据的查询场景而量身定做出来的。在通用数据库中,实现类似功能通常需要复杂的查询语法,且效率很低。TDengine 以函数的方式内置了这些功能,最大程度的减轻了用户的使用成本。 + +### CSUM + +```sql +CSUM(expr) +``` + +**功能说明**:累加和(Cumulative sum),输出行与输入行数相同。 + +**返回结果类型**: 输入列如果是整数类型返回值为长整型 (int64_t),浮点数返回值为双精度浮点数(Double)。无符号整数类型返回值为无符号长整型(uint64_t)。 + +**适用数据类型**:数值类型。 + +**嵌套子查询支持**: 适用于内层查询和外层查询。 + +**适用于**:表和超级表。 + +**使用说明**: + +- 不支持 +、-、*、/ 运算,如 csum(col1) + csum(col2)。 +- 只能与聚合(Aggregation)函数一起使用。 该函数可以应用在普通表和超级表上。 + + +### DERIVATIVE + +```sql +DERIVATIVE(expr, time_interval, ignore_negative) + +ignore_negative: { + 0 + | 1 +} +``` + +**功能说明**:统计表中某列数值的单位变化率。其中单位时间区间的长度可以通过 time_interval 参数指定,最小可以是 1 秒(1s);ignore_negative 参数的值可以是 0 或 1,为 1 时表示忽略负值。 + +**返回数据类型**:DOUBLE。 + +**适用数据类型**:数值类型。 + +**适用于**:表和超级表。 + +**使用说明**: + +- 可以与选择相关联的列一起使用。 例如: select \_rowts, DERIVATIVE() from。 + +### DIFF + +```sql +DIFF(expr [, ignore_negative]) + +ignore_negative: { + 0 + | 1 +} +``` + +**功能说明**:统计表中某列的值与前一行对应值的差。 ignore_negative 取值为 0|1 , 可以不填,默认值为 0. 不忽略负值。ignore_negative 为 1 时表示忽略负数。 + +**返回数据类型**:同应用字段。 + +**适用数据类型**:数值类型。 + +**适用于**:表和超级表。 + +**使用说明**: + +- 输出结果行数是范围内总行数减一,第一行没有结果输出。 +- 可以与选择相关联的列一起使用。 例如: select \_rowts, DIFF() from。 + + +### IRATE + +```sql +IRATE(expr) +``` + +**功能说明**:计算瞬时增长率。使用时间区间中最后两个样本数据来计算瞬时增长速率;如果这两个值呈递减关系,那么只取最后一个数用于计算,而不是使用二者差值。 + +**返回数据类型**:DOUBLE。 + +**适用数据类型**:数值类型。 + +**适用于**:表和超级表。 + + +### MAVG + +```sql +MAVG(expr, k) +``` + +**功能说明**: 计算连续 k 个值的移动平均数(moving average)。如果输入行数小于 k,则无结果输出。参数 k 的合法输入范围是 1≤ k ≤ 1000。 + +**返回结果类型**: DOUBLE。 + +**适用数据类型**: 数值类型。 + +**嵌套子查询支持**: 适用于内层查询和外层查询。 + +**适用于**:表和超级表。 + +**使用说明**: + +- 不支持 +、-、*、/ 运算,如 mavg(col1, k1) + mavg(col2, k1); +- 只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用; + + +### STATECOUNT + +```sql +STATECOUNT(expr, oper, val) +``` + +**功能说明**:返回满足某个条件的连续记录的个数,结果作为新的一列追加在每行后面。条件根据参数计算,如果条件为 true 则加 1,条件为 false 则重置为-1,如果数据为 NULL,跳过该条数据。 + +**参数范围**: + +- oper : "LT" (小于)、"GT"(大于)、"LE"(小于等于)、"GE"(大于等于)、"NE"(不等于)、"EQ"(等于),不区分大小写。 +- val : 数值型 + +**返回结果类型**:INTEGER。 + +**适用数据类型**:数值类型。 + +**嵌套子查询支持**:不支持应用在子查询上。 + +**适用于**:表和超级表。 + +**使用说明**: + +- 不能和窗口操作一起使用,例如 interval/state_window/session_window。 + + +### STATEDURATION + +```sql +STATEDURATION(expr, oper, val, unit) +``` + +**功能说明**:返回满足某个条件的连续记录的时间长度,结果作为新的一列追加在每行后面。条件根据参数计算,如果条件为 true 则加上两个记录之间的时间长度(第一个满足条件的记录时间长度记为 0),条件为 false 则重置为-1,如果数据为 NULL,跳过该条数据。 + +**参数范围**: + +- oper : `'LT'` (小于)、`'GT'`(大于)、`'LE'`(小于等于)、`'GE'`(大于等于)、`'NE'`(不等于)、`'EQ'`(等于),不区分大小写,但需要用`''`包括。 +- val : 数值型 +- unit : 时间长度的单位,可取值时间单位: 1b(纳秒), 1u(微秒),1a(毫秒),1s(秒),1m(分),1h(小时),1d(天), 1w(周)。如果省略,默认为当前数据库精度。 + +**返回结果类型**:INTEGER。 + +**适用数据类型**:数值类型。 + +**嵌套子查询支持**:不支持应用在子查询上。 + +**适用于**:表和超级表。 + +**使用说明**: + +- 不能和窗口操作一起使用,例如 interval/state_window/session_window。 + + +### TWA + +```sql +TWA(expr) +``` + +**功能说明**:时间加权平均函数。统计表中某列在一段时间内的时间加权平均。 + +**返回数据类型**:DOUBLE。 + +**适用数据类型**:数值类型。 + +**适用于**:表和超级表。 + + +## 系统信息函数 + +### DATABASE + +```sql +SELECT DATABASE(); +``` + +**说明**:返回当前登录的数据库。如果登录的时候没有指定默认数据库,且没有使用USE命令切换数据库,则返回NULL。 + + +### CLIENT_VERSION + +```sql +SELECT CLIENT_VERSION(); +``` + +**说明**:返回客户端版本。 + +### SERVER_VERSION + +```sql +SELECT SERVER_VERSION(); +``` + +**说明**:返回服务端版本。 + +### SERVER_STATUS + +```sql +SELECT SERVER_STATUS(); +``` + +**说明**:检测服务端是否所有 dnode 都在线,如果是则返回成功,否则返回无法建立连接的错误。 + +### CURRENT_USER + +```sql +SELECT CURRENT_USER(); +``` + +**说明**:获取当前用户。 + + +## Geometry 函数 + +### Geometry 输入函数: + +#### ST_GeomFromText + +```sql +ST_GeomFromText(VARCHAR WKT expr) +``` + +**功能说明**:根据 Well-Known Text (WKT) 表示从指定的几何值创建几何数据。 + +**返回值类型**:GEOMETRY + +**适用数据类型**:VARCHAR + +**适用表类型**:标准表和超表 + +**使用说明**:输入可以是 WKT 字符串之一,例如点(POINT)、线串(LINESTRING)、多边形(POLYGON)、多点集(MULTIPOINT)、多线串(MULTILINESTRING)、多多边形(MULTIPOLYGON)、几何集合(GEOMETRYCOLLECTION)。输出是以二进制字符串形式定义的 GEOMETRY 数据类型。 + +### Geometry 输出函数: + +#### ST_AsText + +```sql +ST_AsText(GEOMETRY geom) +``` + +**功能说明**:从几何数据中返回指定的 Well-Known Text (WKT) 表示。 + +**返回值类型**:VARCHAR + +**适用数据类型**:GEOMETRY + +**适用表类型**:标准表和超表 + +**使用说明**:输出可以是 WKT 字符串之一,例如点(POINT)、线串(LINESTRING)、多边形(POLYGON)、多点集(MULTIPOINT)、多线串(MULTILINESTRING)、多多边形(MULTIPOLYGON)、几何集合(GEOMETRYCOLLECTION)。 + +### Geometry 关系函数: + +#### ST_Intersects + +```sql +ST_Intersects(GEOMETRY geomA, GEOMETRY geomB) +``` + +##功能说明**:比较两个几何对象,并在它们相交时返回 true。 + +**返回值类型**:BOOL + +**适用数据类型**:GEOMETRY,GEOMETRY + +**适用表类型**:标准表和超表 + +**使用说明**:如果两个几何对象有任何一个共享点,则它们相交。 + +#### ST_Equals + +```sql +ST_Equals(GEOMETRY geomA, GEOMETRY geomB) +``` + +**功能说明**:如果给定的几何对象是"空间相等"的,则返回 TRUE。 + +**返回值类型**:BOOL + +**适用数据类型**:GEOMETRY,GEOMETRY + +**适用表类型**:标准表和超表 + +**使用说明**:"空间相等"意味着 ST_Contains(A,B) = true 和 ST_Contains(B,A) = true,并且点的顺序可能不同,但表示相同的几何结构。 + +#### ST_Touches + +```sql +ST_Touches(GEOMETRY geomA, GEOMETRY geomB) +``` + +**功能说明**:如果 A 和 B 相交,但它们的内部不相交,则返回 TRUE。 + +**返回值类型**:BOOL + +**适用数据类型**:GEOMETRY,GEOMETRY + +**适用表类型**:标准表和超表 + +**使用说明**:A 和 B 至少有一个公共点,并且这些公共点位于至少一个边界中。对于点/点输入,关系始终为 FALSE,因为点没有边界。 + +#### ST_Covers + +```sql +ST_Covers(GEOMETRY geomA, GEOMETRY geomB) +``` + +**功能说明**:如果 B 中的每个点都位于几何形状 A 内部(与内部或边界相交),则返回 TRUE。 + +**返回值类型**:BOOL + +**适用数据类型**:GEOMETRY,GEOMETRY + +**适用表类型**:标准表和超表 + +**使用说明**:A 包含 B 意味着 B 中的没有点位于 A 的外部(在外部)。 + +#### ST_Contains + +```sql +ST_Contains(GEOMETRY geomA, GEOMETRY geomB) +``` + +**功能说明**:如果 A 包含 B,描述:如果几何形状 A 包含几何形状 B,则返回 TRUE。 + +**返回值类型**:BOOL + +**适用数据类型**:GEOMETRY,GEOMETRY + +**适用表类型**:标准表和超表 + +**使用说明**:A 包含 B 当且仅当 B 的所有点位于 A 的内部(即位于内部或边界上)(或等效地,B 的没有点位于 A 的外部),并且 A 和 B 的内部至少有一个公共点。 + +#### ST_ContainsProperly + +```sql +ST_ContainsProperly(GEOMETRY geomA, GEOMETRY geomB) +``` + +**功能说明**:如果 B 的每个点都位于 A 内部,则返回 TRUE。 + +**返回值类型**:BOOL + +**适用数据类型**:GEOMETRY,GEOMETRY + +**适用表类型**:标准表和超表 + +**使用说明**:B 的没有点位于 A 的边界或外部。 diff --git a/docs/zh/12-taos-sql/12-distinguished.md b/docs/zh/12-taos-sql/12-distinguished.md index 98bfd3567a..8ae3f900f4 100755 --- a/docs/zh/12-taos-sql/12-distinguished.md +++ b/docs/zh/12-taos-sql/12-distinguished.md @@ -16,7 +16,11 @@ TDengine 提供的特色查询包括数据切分查询和时间窗口切分查 PARTITION BY part_list ``` -part_list 可以是任意的标量表达式,包括列、常量、标量函数和它们的组合。 +part_list 可以是任意的标量表达式,包括列、常量、标量函数和它们的组合。例如,将数据按标签 location 进行分组,取每个分组内的电压平均值: +```sql +select location, avg(voltage) from meters partition by location +``` + TDengine 按如下方式处理数据切分子句: @@ -25,9 +29,13 @@ TDengine 按如下方式处理数据切分子句: - 数据切分子句可以和窗口切分子句(或 GROUP BY 子句)一起使用,此时后面的子句作用在每个切分的分片上。例如,将数据按标签 location 进行分组,并对每个组按 10 分钟进行降采样,取其最大值。 ```sql -select max(current) from meters partition by location interval(10m) +select _wstart, location, max(current) from meters partition by location interval(10m) ``` -数据切分子句最常见的用法就是在超级表查询中,按标签将子表数据进行切分,然后分别进行计算。特别是 PARTITION BY TBNAME 用法,它将每个子表的数据独立出来,形成一条条独立的时间序列,极大的方便了各种时序场景的统计分析。 +数据切分子句最常见的用法就是在超级表查询中,按标签将子表数据进行切分,然后分别进行计算。特别是 PARTITION BY TBNAME 用法,它将每个子表的数据独立出来,形成一条条独立的时间序列,极大的方便了各种时序场景的统计分析。例如,统计每个电表每 10 分钟内的电压平均值: +```sql +select _wstart, tbname, avg(voltage) from meters partition by tbname interval(10m) +``` + ## 窗口切分查询 diff --git a/docs/zh/14-reference/05-taosbenchmark.md b/docs/zh/14-reference/05-taosbenchmark.md index 597c188c11..bb88c2dede 100644 --- a/docs/zh/14-reference/05-taosbenchmark.md +++ b/docs/zh/14-reference/05-taosbenchmark.md @@ -81,13 +81,13 @@ taosBenchmark -f -#### 订阅场景 JSON 配置文件示例 +#### 订阅场景 JSON 配置文件示例
-subscribe.json +tmq.json ```json -{{#include /taos-tools/example/subscribe.json}} +{{#include /taos-tools/example/tmq.json}} ```
diff --git a/docs/zh/20-third-party/75-powerbi.md b/docs/zh/20-third-party/75-powerbi.md new file mode 100644 index 0000000000..255b23402b --- /dev/null +++ b/docs/zh/20-third-party/75-powerbi.md @@ -0,0 +1,50 @@ +--- +sidebar_label: Power BI +title: Power BI +description: 如何使用 Power BI 和 TDengine 进行时序数据分析 +--- + +# 如何使用 Power BI 和 TDengine 进行时序数据分析 + +## 方案介绍 + +使用 ODBC 连接器,Power BI 可以快速的访问 TDengine。您可以将标签数据、原始时序数据或按时间聚合后的时序数据从 TDengine 导入到 Power BI,制作报表或仪表盘,整个过程不需要任何的代码编写过程。 + +### 整体步骤 +![Power BI use step](./powerbi-step-zh.webp) + +### 前置要求 +1. TDengine 服务端软件已经安装并运行 +2. Power BI Desktop 软件已经安装并运行(如未安装,请从[官方地址](https://www.microsoft.com/zh-cn/download/details.aspx?id=58494)下载最新的 Windows X64 版本)。 + + +### 安装驱动 +从 TDengine 官网下载最新的 Windows X64 客户端驱动程序 [下载地址](https://docs.taosdata.com/get-started/package/),并安装在 Power BI 运行的机器上 + +### 配置数据源 +请参考 [ODBC](../../connector/odbc) 配置Websocket数据源。 + +### 导入 TDengine 数据到 Power BI +1. 打开 Power BI 并登录后,通过如下步骤添加数据源,“主页” -> “获取数据” -> “其他” -> “ODBC” -> “连接” +2. 选择数据源名称后,连接到配置好的数据源,进入导航器,浏览对应数据库的数据表并加载 +3. 如果需要输入 SQL 语句,可以点击“高级选项”,在展开的对话框中输入并加载数据 + + +为了更好的使用 Power BI 分析 TDengine 中的数据,您需要理解维度、度量、时序、相关性的概念,然后通过自定义的 SQL 语句导入数据。 +1. 维度:通常是分类(文本)数据,描述设备、测点、型号等类别信息。在 TDengine 的超级表中,使用标签列存储数据的维度信息,可以通过形如 `select distinct tbname, tag1, tag2 from supertable` 的 SQL 语法快速获得维度信息。 +2. 度量:可以用于进行计算的定量(数值)字段, 常见计算有求和、平均值和最小值等。如果测点的采集频率为秒,那么一年就有 31,536,000 条记录,把这些数据全部导入 Power BI 会严重影响其执行效率。在 TDengine 中,您可以使用数据切分查询、窗口切分查询等语法,结合与窗口相关的伪列,把降采样后的数据导入到 Power BI 中,具体语法参考 [TDengine 特色查询功能介绍](https://docs.taosdata.com/taos-sql/distinguished/)。 + - 窗口切分查询:比如温度传感器每秒采集一次数据,但需查询每隔 10 分钟的温度平均值,这种场景下可以使用窗口子句来获得需要的降采样查询结果,对应的 SQL 语句形如 `select tbname, _wstart date,avg(temperature) temp from table interval(10m)` ,其中 _wstart 是伪列,表示时间窗口起始时间,10m 表示时间窗口的持续时间,`avg(temperature)` 表示时间窗口内的聚合值。 + - 数据切分查询:如果需要同时获取很多温度传感器的聚合数值,可对数据进行切分然后在切分出的数据空间内再进行一系列的计算,对应的 SQL 语法参考 `partition by part_list`。数据切分子句最常见的用法就是在超级表查询中,按标签将子表数据进行切分,将每个子表的数据独立出来,形成一条条独立的时间序列,方便各种时序场景的统计分析。 +3. 时序:在绘制曲线或者按照时间聚合数据时,通常需要引入日期表。日期表可以从 Excel 表格中导入,也可以在 TDengine 中执行 SQL 语句获取,例如 `select _wstart date, count(*) cnt from test.meters where ts between A and B interval(1d) fill(0)`,其中 fill 字句表示数据缺失情况下的填充模式,伪列_wstart 则为要获取的日期列。 +4. 相关性:告诉数据之间如何关联,度量和维度可以通过 tbname 列关联在一起,日期表和度量则可以通过 date 列关联,配合形成可视化报表。 + +### 智能电表样例 +TDengine 有自己独特的数据模型,它使用超级表作为模板,为每个设备创建一个表,每个表最多可创建 4096 个数据列和 128 个标签列。在智能电表样例中,假如一个电表每秒产生一条记录,一天就有 86,400 条记录,一年就有 31,536,000 条记录,1000 个电表将占用 600 GB 原始磁盘空间。因此,Power BI 更多的应用方式是将标签列映射为维度列,数据列的聚合结果导入为度量列,最终为关键决策制定者提供所需的指标。 +1. 导入维度数据 +在 Power BI 中导入表的标签列,取名为 tags,SQL 如下 +select distinct tbname, groupid, location from test.meters; +2. 导入度量数据 +在 Power BI 中,按照 1 小时的时间窗口,导入每个电表的电流均值、电压均值、相位均值,取名为 data,SQL 如下 +`select tbname, _wstart ws, avg(current), avg(voltage), avg(phase) from test.meters PARTITION by tbname interval(1h)` ; +3. 建立维度和度量的关联关系 +在 Power BI 中,打开模型视图,建立表 tags 和 data 的关联关系,将 tbname 设置为关联数据列。之后,就可以在柱状图、饼图等控件中使用这些数据。更多有关 Power BI 构建视觉效果的信息,请查询 [Power BI 文档](https://learn.microsoft.com/zh-cn/power-bi/)。 \ No newline at end of file diff --git a/docs/zh/20-third-party/powerbi-step-zh.webp b/docs/zh/20-third-party/powerbi-step-zh.webp new file mode 100644 index 0000000000..16e48e8aaa Binary files /dev/null and b/docs/zh/20-third-party/powerbi-step-zh.webp differ diff --git a/include/common/systable.h b/include/common/systable.h index b44d8ce1d6..92e7915424 100644 --- a/include/common/systable.h +++ b/include/common/systable.h @@ -50,6 +50,8 @@ extern "C" { #define TSDB_INS_TABLE_STREAM_TASKS "ins_stream_tasks" #define TSDB_INS_TABLE_USER_PRIVILEGES "ins_user_privileges" #define TSDB_INS_TABLE_VIEWS "ins_views" +#define TSDB_INS_TABLE_COMPACTS "ins_compacts" +#define TSDB_INS_TABLE_COMPACT_DETAILS "ins_compact_details" #define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema" #define TSDB_PERFS_TABLE_SMAS "perf_smas" diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 91f8bbc7f3..887f4cb6dc 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -196,6 +196,7 @@ extern int64_t tsWalFsyncDataSizeLimit; // internal extern int32_t tsTransPullupInterval; +extern int32_t tsCompactPullupInterval; extern int32_t tsMqRebalanceInterval; extern int32_t tsStreamCheckpointInterval; extern float tsSinkDataRate; @@ -214,6 +215,7 @@ extern int32_t tsMaxStreamBackendCache; extern int32_t tsPQSortMemThreshold; extern int32_t tsResolveFQDNRetryTime; +extern bool tsExperimental; // #define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize) int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDir, const char **envCmd, diff --git a/include/common/tmsg.h b/include/common/tmsg.h index aff1bd55e4..bafe7583b7 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -32,6 +32,7 @@ extern "C" { #endif /* ------------------------ MESSAGE DEFINITIONS ------------------------ */ + #define TD_MSG_NUMBER_ #undef TD_MSG_DICT_ #undef TD_MSG_INFO_ @@ -144,6 +145,8 @@ typedef enum _mgmt_table { TSDB_MGMT_TABLE_STREAM_TASKS, TSDB_MGMT_TABLE_PRIVILEGES, TSDB_MGMT_TABLE_VIEWS, + TSDB_MGMT_TABLE_COMPACT, + TSDB_MGMT_TABLE_COMPACT_DETAIL, TSDB_MGMT_TABLE_MAX, } EShowType; @@ -307,6 +310,7 @@ typedef enum ENodeType { QUERY_NODE_KILL_CONNECTION_STMT, QUERY_NODE_KILL_QUERY_STMT, QUERY_NODE_KILL_TRANSACTION_STMT, + QUERY_NODE_KILL_COMPACT_STMT, QUERY_NODE_DELETE_STMT, QUERY_NODE_INSERT_STMT, QUERY_NODE_QUERY, @@ -353,6 +357,8 @@ typedef enum ENodeType { QUERY_NODE_SHOW_VNODES_STMT, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT, QUERY_NODE_SHOW_VIEWS_STMT, + QUERY_NODE_SHOW_COMPACTS_STMT, + QUERY_NODE_SHOW_COMPACT_DETAILS_STMT, // logic plan node QUERY_NODE_LOGIC_PLAN_SCAN = 1000, @@ -1384,6 +1390,24 @@ int32_t tSerializeSCompactDbReq(void* buf, int32_t bufLen, SCompactDbReq* pReq); int32_t tDeserializeSCompactDbReq(void* buf, int32_t bufLen, SCompactDbReq* pReq); void tFreeSCompactDbReq(SCompactDbReq* pReq); +typedef struct { + int32_t compactId; + int8_t bAccepted; +} SCompactDbRsp; + +int32_t tSerializeSCompactDbRsp(void* buf, int32_t bufLen, SCompactDbRsp* pRsp); +int32_t tDeserializeSCompactDbRsp(void* buf, int32_t bufLen, SCompactDbRsp* pRsp); + +typedef struct { + int32_t compactId; + int32_t sqlLen; + char* sql; +} SKillCompactReq; + +int32_t tSerializeSKillCompactReq(void* buf, int32_t bufLen, SKillCompactReq* pReq); +int32_t tDeserializeSKillCompactReq(void* buf, int32_t bufLen, SKillCompactReq* pReq); +void tFreeSKillCompactReq(SKillCompactReq *pReq); + typedef struct { char name[TSDB_FUNC_NAME_LEN]; int8_t igExists; @@ -1662,6 +1686,26 @@ int32_t tSerializeSCreateVnodeReq(void* buf, int32_t bufLen, SCreateVnodeReq* pR int32_t tDeserializeSCreateVnodeReq(void* buf, int32_t bufLen, SCreateVnodeReq* pReq); int32_t tFreeSCreateVnodeReq(SCreateVnodeReq* pReq); +typedef struct { + int32_t compactId; + int32_t vgId; + int32_t dnodeId; +} SQueryCompactProgressReq; + +int32_t tSerializeSQueryCompactProgressReq(void* buf, int32_t bufLen, SQueryCompactProgressReq* pReq); +int32_t tDeserializeSQueryCompactProgressReq(void* buf, int32_t bufLen, SQueryCompactProgressReq* pReq); + +typedef struct { + int32_t compactId; + int32_t vgId; + int32_t dnodeId; + int32_t numberFileset; + int32_t finished; +} SQueryCompactProgressRsp; + +int32_t tSerializeSQueryCompactProgressRsp(void* buf, int32_t bufLen, SQueryCompactProgressRsp* pReq); +int32_t tDeserializeSQueryCompactProgressRsp(void* buf, int32_t bufLen, SQueryCompactProgressRsp* pReq); + typedef struct { int32_t vgId; int32_t dnodeId; @@ -1689,11 +1733,21 @@ typedef struct { char db[TSDB_DB_FNAME_LEN]; int64_t compactStartTime; STimeWindow tw; + int32_t compactId; } SCompactVnodeReq; int32_t tSerializeSCompactVnodeReq(void* buf, int32_t bufLen, SCompactVnodeReq* pReq); int32_t tDeserializeSCompactVnodeReq(void* buf, int32_t bufLen, SCompactVnodeReq* pReq); +typedef struct { + int32_t compactId; + int32_t vgId; + int32_t dnodeId; +} SVKillCompactReq; + +int32_t tSerializeSVKillCompactReq(void* buf, int32_t bufLen, SVKillCompactReq* pReq); +int32_t tDeserializeSVKillCompactReq(void* buf, int32_t bufLen, SVKillCompactReq* pReq); + typedef struct { int32_t vgVersion; int32_t buffer; @@ -1889,8 +1943,9 @@ typedef struct { char db[TSDB_DB_FNAME_LEN]; char tb[TSDB_TABLE_NAME_LEN]; char user[TSDB_USER_LEN]; - char filterTb[TSDB_TABLE_NAME_LEN]; + char filterTb[TSDB_TABLE_NAME_LEN]; // for ins_columns int64_t showId; + int64_t compactId; // for compact } SRetrieveTableReq; typedef struct SSysTableSchema { diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h index a2f9a5c475..24ad5abded 100644 --- a/include/common/tmsgdef.h +++ b/include/common/tmsgdef.h @@ -38,7 +38,7 @@ #undef TD_NEW_MSG_SEG #undef TD_DEF_MSG_TYPE #undef TD_CLOSE_MSG_SEG - #define TD_NEW_MSG_SEG(TYPE) + #define TD_NEW_MSG_SEG(TYPE) #define TD_DEF_MSG_TYPE(TYPE, MSG, REQ, RSP) #define TD_CLOSE_MSG_SEG(TYPE) TYPE, int32_t tMsgRangeDict[] = { @@ -76,9 +76,7 @@ #define TD_CLOSE_MSG_SEG(TYPE) enum { - - -#else +#else #undef TD_NEW_MSG_SEG #undef TD_DEF_MSG_TYPE @@ -109,7 +107,7 @@ TD_DEF_MSG_TYPE(TDMT_DND_ALTER_VNODE_TYPE, "dnode-alter-vnode-type", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_DND_CHECK_VNODE_LEARNER_CATCHUP, "dnode-check-vnode-learner-catchup", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_DND_MAX_MSG, "dnd-max", NULL, NULL) - TD_CLOSE_MSG_SEG(TDMT_END_DND_MSG) + TD_CLOSE_MSG_SEG(TDMT_END_DND_MSG) TD_NEW_MSG_SEG(TDMT_MND_MSG) // 1<<8 TD_DEF_MSG_TYPE(TDMT_MND_CONNECT, "connect", NULL, NULL) @@ -217,8 +215,10 @@ TD_DEF_MSG_TYPE(TDMT_MND_CREATE_VIEW, "create-view", SCMCreateViewReq, NULL) TD_DEF_MSG_TYPE(TDMT_MND_DROP_VIEW, "drop-view", SCMDropViewReq, NULL) TD_DEF_MSG_TYPE(TDMT_MND_VIEW_META, "view-meta", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_KILL_COMPACT, "kill-compact", SKillCompactReq, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_COMPACT_TIMER, "compact-tmr", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_MAX_MSG, "mnd-max", NULL, NULL) - TD_CLOSE_MSG_SEG(TDMT_END_MND_MSG) + TD_CLOSE_MSG_SEG(TDMT_END_MND_MSG) TD_NEW_MSG_SEG(TDMT_VND_MSG) // 2<<8 TD_DEF_MSG_TYPE(TDMT_VND_SUBMIT, "submit", SSubmitReq, SSubmitRsp) @@ -256,7 +256,7 @@ TD_DEF_MSG_TYPE(TDMT_VND_EXEC_RSMA, "vnode-exec-rsma", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_DELETE, "delete-data", SVDeleteReq, SVDeleteRsp) TD_DEF_MSG_TYPE(TDMT_VND_BATCH_DEL, "batch-delete", SBatchDeleteReq, NULL) -TD_DEF_MSG_TYPE(TDMT_VND_ALTER_CONFIG, "alter-config", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_VND_ALTER_CONFIG, "alter-config", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_ALTER_REPLICA, "alter-replica", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_ALTER_CONFIRM, "alter-confirm", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_ALTER_HASHRANGE, "alter-hashrange", NULL, NULL) @@ -267,8 +267,10 @@ TD_DEF_MSG_TYPE(TDMT_VND_ALTER_CONFIG, "alter-config", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_CREATE_INDEX, "vnode-create-index", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_DROP_INDEX, "vnode-drop-index", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_DISABLE_WRITE, "vnode-disable-write", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_VND_QUERY_COMPACT_PROGRESS, "vnode-query-compact-progress", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_VND_KILL_COMPACT, "kill-compact", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_MAX_MSG, "vnd-max", NULL, NULL) - TD_CLOSE_MSG_SEG(TDMT_END_VND_MSG) + TD_CLOSE_MSG_SEG(TDMT_END_VND_MSG) TD_NEW_MSG_SEG(TDMT_SCH_MSG) // 3<<8 TD_DEF_MSG_TYPE(TDMT_SCH_QUERY, "query", NULL, NULL) @@ -283,7 +285,7 @@ TD_DEF_MSG_TYPE(TDMT_VND_ALTER_CONFIG, "alter-config", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SCH_LINK_BROKEN, "link-broken", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SCH_TASK_NOTIFY, "task-notify", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SCH_MAX_MSG, "sch-max", NULL, NULL) - TD_CLOSE_MSG_SEG(TDMT_END_SCH_MSG) + TD_CLOSE_MSG_SEG(TDMT_END_SCH_MSG) TD_NEW_MSG_SEG(TDMT_STREAM_MSG) //4 << 8 @@ -301,11 +303,11 @@ TD_DEF_MSG_TYPE(TDMT_VND_ALTER_CONFIG, "alter-config", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_STOP, "stream-task-stop", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_STREAM_HTASK_DROP, "stream-htask-drop", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_STREAM_MAX_MSG, "stream-max", NULL, NULL) - TD_CLOSE_MSG_SEG(TDMT_END_STREAM_MSG) + TD_CLOSE_MSG_SEG(TDMT_END_STREAM_MSG) TD_NEW_MSG_SEG(TDMT_MON_MSG) //5 << 8 TD_DEF_MSG_TYPE(TDMT_MON_MAX_MSG, "monitor-max", NULL, NULL) - TD_CLOSE_MSG_SEG(TDMT_END_MON_MSG) + TD_CLOSE_MSG_SEG(TDMT_END_MON_MSG) TD_NEW_MSG_SEG(TDMT_SYNC_MSG) //6 << 8 TD_DEF_MSG_TYPE(TDMT_SYNC_TIMEOUT, "sync-timer", NULL, NULL) @@ -337,8 +339,7 @@ TD_DEF_MSG_TYPE(TDMT_VND_ALTER_CONFIG, "alter-config", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SYNC_PREP_SNAPSHOT_REPLY, "sync-prep-snapshot-reply", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SYNC_MAX_MSG, "sync-max", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SYNC_FORCE_FOLLOWER, "sync-force-become-follower", NULL, NULL) - TD_CLOSE_MSG_SEG(TDMT_END_SYNC_MSG) - + TD_CLOSE_MSG_SEG(TDMT_END_SYNC_MSG) TD_NEW_MSG_SEG(TDMT_VND_STREAM_MSG) //7 << 8 TD_DEF_MSG_TYPE(TDMT_VND_STREAM_SCAN_HISTORY, "vnode-stream-scan-history", NULL, NULL) @@ -348,7 +349,7 @@ TD_DEF_MSG_TYPE(TDMT_VND_ALTER_CONFIG, "alter-config", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_STREAM_TASK_RESET, "vnode-stream-reset", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_STREAM_TASK_CHECK, "vnode-stream-task-check", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_STREAM_MAX_MSG, "vnd-stream-max", NULL, NULL) - TD_CLOSE_MSG_SEG(TDMT_END_VND_STREAM_MSG) + TD_CLOSE_MSG_SEG(TDMT_END_VND_STREAM_MSG) TD_NEW_MSG_SEG(TDMT_VND_TMQ_MSG) //8 << 8 TD_DEF_MSG_TYPE(TDMT_VND_TMQ_SUBSCRIBE, "vnode-tmq-subscribe", SMqRebVgReq, SMqRebVgRsp) @@ -362,13 +363,10 @@ TD_DEF_MSG_TYPE(TDMT_VND_ALTER_CONFIG, "alter-config", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_TMQ_VG_WALINFO, "vnode-tmq-vg-walinfo", SMqPollReq, SMqDataBlkRsp) TD_DEF_MSG_TYPE(TDMT_VND_TMQ_VG_COMMITTEDINFO, "vnode-tmq-committedinfo", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_TMQ_MAX_MSG, "vnd-tmq-max", NULL, NULL) - TD_CLOSE_MSG_SEG(TDMT_END_TMQ_MSG) + TD_CLOSE_MSG_SEG(TDMT_END_TMQ_MSG) TD_NEW_MSG_SEG(TDMT_MAX_MSG) // msg end mark - TD_CLOSE_MSG_SEG(TDMT_END_MAX_MSG) - - - + TD_CLOSE_MSG_SEG(TDMT_END_MAX_MSG) #if defined(TD_MSG_NUMBER_) TDMT_MAX diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index cb080ab118..bdee3934fe 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -189,184 +189,180 @@ #define TK_ALIVE 170 #define TK_VIEWS 171 #define TK_VIEW 172 -#define TK_NORMAL 173 -#define TK_CHILD 174 -#define TK_LIKE 175 -#define TK_TBNAME 176 -#define TK_QTAGS 177 -#define TK_AS 178 -#define TK_SYSTEM 179 -#define TK_INDEX 180 -#define TK_FUNCTION 181 -#define TK_INTERVAL 182 -#define TK_COUNT 183 -#define TK_LAST_ROW 184 -#define TK_META 185 -#define TK_ONLY 186 -#define TK_TOPIC 187 -#define TK_CONSUMER 188 -#define TK_GROUP 189 -#define TK_DESC 190 -#define TK_DESCRIBE 191 -#define TK_RESET 192 -#define TK_QUERY 193 -#define TK_CACHE 194 -#define TK_EXPLAIN 195 -#define TK_ANALYZE 196 -#define TK_VERBOSE 197 -#define TK_NK_BOOL 198 -#define TK_RATIO 199 -#define TK_NK_FLOAT 200 -#define TK_OUTPUTTYPE 201 -#define TK_AGGREGATE 202 -#define TK_BUFSIZE 203 -#define TK_LANGUAGE 204 -#define TK_REPLACE 205 -#define TK_STREAM 206 -#define TK_INTO 207 -#define TK_PAUSE 208 -#define TK_RESUME 209 -#define TK_TRIGGER 210 -#define TK_AT_ONCE 211 -#define TK_WINDOW_CLOSE 212 -#define TK_IGNORE 213 -#define TK_EXPIRED 214 -#define TK_FILL_HISTORY 215 -#define TK_UPDATE 216 -#define TK_SUBTABLE 217 -#define TK_UNTREATED 218 -#define TK_KILL 219 -#define TK_CONNECTION 220 -#define TK_TRANSACTION 221 -#define TK_BALANCE 222 -#define TK_VGROUP 223 -#define TK_LEADER 224 -#define TK_MERGE 225 -#define TK_REDISTRIBUTE 226 -#define TK_SPLIT 227 -#define TK_DELETE 228 -#define TK_INSERT 229 -#define TK_NULL 230 -#define TK_NK_QUESTION 231 -#define TK_NK_ALIAS 232 -#define TK_NK_ARROW 233 -#define TK_ROWTS 234 -#define TK_QSTART 235 -#define TK_QEND 236 -#define TK_QDURATION 237 -#define TK_WSTART 238 -#define TK_WEND 239 -#define TK_WDURATION 240 -#define TK_IROWTS 241 -#define TK_ISFILLED 242 -#define TK_CAST 243 -#define TK_NOW 244 -#define TK_TODAY 245 -#define TK_TIMEZONE 246 -#define TK_CLIENT_VERSION 247 -#define TK_SERVER_VERSION 248 -#define TK_SERVER_STATUS 249 -#define TK_CURRENT_USER 250 -#define TK_CASE 251 -#define TK_WHEN 252 -#define TK_THEN 253 -#define TK_ELSE 254 -#define TK_BETWEEN 255 -#define TK_IS 256 -#define TK_NK_LT 257 -#define TK_NK_GT 258 -#define TK_NK_LE 259 -#define TK_NK_GE 260 -#define TK_NK_NE 261 -#define TK_MATCH 262 -#define TK_NMATCH 263 -#define TK_CONTAINS 264 -#define TK_IN 265 -#define TK_JOIN 266 -#define TK_INNER 267 -#define TK_SELECT 268 -#define TK_NK_HINT 269 -#define TK_DISTINCT 270 -#define TK_WHERE 271 -#define TK_PARTITION 272 -#define TK_BY 273 -#define TK_SESSION 274 -#define TK_STATE_WINDOW 275 -#define TK_EVENT_WINDOW 276 -#define TK_SLIDING 277 -#define TK_FILL 278 -#define TK_VALUE 279 -#define TK_VALUE_F 280 -#define TK_NONE 281 -#define TK_PREV 282 -#define TK_NULL_F 283 -#define TK_LINEAR 284 -#define TK_NEXT 285 -#define TK_HAVING 286 -#define TK_RANGE 287 -#define TK_EVERY 288 -#define TK_ORDER 289 -#define TK_SLIMIT 290 -#define TK_SOFFSET 291 -#define TK_LIMIT 292 -#define TK_OFFSET 293 -#define TK_ASC 294 -#define TK_NULLS 295 -#define TK_ABORT 296 -#define TK_AFTER 297 -#define TK_ATTACH 298 -#define TK_BEFORE 299 -#define TK_BEGIN 300 -#define TK_BITAND 301 -#define TK_BITNOT 302 -#define TK_BITOR 303 -#define TK_BLOCKS 304 -#define TK_CHANGE 305 -#define TK_COMMA 306 -#define TK_CONCAT 307 -#define TK_CONFLICT 308 -#define TK_COPY 309 -#define TK_DEFERRED 310 -#define TK_DELIMITERS 311 -#define TK_DETACH 312 -#define TK_DIVIDE 313 -#define TK_DOT 314 -#define TK_EACH 315 -#define TK_FAIL 316 -#define TK_FILE 317 -#define TK_FOR 318 -#define TK_GLOB 319 -#define TK_ID 320 -#define TK_IMMEDIATE 321 -#define TK_IMPORT 322 -#define TK_INITIALLY 323 -#define TK_INSTEAD 324 -#define TK_ISNULL 325 -#define TK_KEY 326 -#define TK_MODULES 327 -#define TK_NK_BITNOT 328 -#define TK_NK_SEMI 329 -#define TK_NOTNULL 330 -#define TK_OF 331 -#define TK_PLUS 332 -#define TK_PRIVILEGE 333 -#define TK_RAISE 334 -#define TK_RESTRICT 335 -#define TK_ROW 336 -#define TK_SEMI 337 -#define TK_STAR 338 -#define TK_STATEMENT 339 -#define TK_STRICT 340 -#define TK_STRING 341 -#define TK_TIMES 342 -#define TK_VALUES 343 -#define TK_VARIABLE 344 -#define TK_WAL 345 - - - - - +#define TK_COMPACTS 173 +#define TK_NORMAL 174 +#define TK_CHILD 175 +#define TK_LIKE 176 +#define TK_TBNAME 177 +#define TK_QTAGS 178 +#define TK_AS 179 +#define TK_SYSTEM 180 +#define TK_INDEX 181 +#define TK_FUNCTION 182 +#define TK_INTERVAL 183 +#define TK_COUNT 184 +#define TK_LAST_ROW 185 +#define TK_META 186 +#define TK_ONLY 187 +#define TK_TOPIC 188 +#define TK_CONSUMER 189 +#define TK_GROUP 190 +#define TK_DESC 191 +#define TK_DESCRIBE 192 +#define TK_RESET 193 +#define TK_QUERY 194 +#define TK_CACHE 195 +#define TK_EXPLAIN 196 +#define TK_ANALYZE 197 +#define TK_VERBOSE 198 +#define TK_NK_BOOL 199 +#define TK_RATIO 200 +#define TK_NK_FLOAT 201 +#define TK_OUTPUTTYPE 202 +#define TK_AGGREGATE 203 +#define TK_BUFSIZE 204 +#define TK_LANGUAGE 205 +#define TK_REPLACE 206 +#define TK_STREAM 207 +#define TK_INTO 208 +#define TK_PAUSE 209 +#define TK_RESUME 210 +#define TK_TRIGGER 211 +#define TK_AT_ONCE 212 +#define TK_WINDOW_CLOSE 213 +#define TK_IGNORE 214 +#define TK_EXPIRED 215 +#define TK_FILL_HISTORY 216 +#define TK_UPDATE 217 +#define TK_SUBTABLE 218 +#define TK_UNTREATED 219 +#define TK_KILL 220 +#define TK_CONNECTION 221 +#define TK_TRANSACTION 222 +#define TK_BALANCE 223 +#define TK_VGROUP 224 +#define TK_LEADER 225 +#define TK_MERGE 226 +#define TK_REDISTRIBUTE 227 +#define TK_SPLIT 228 +#define TK_DELETE 229 +#define TK_INSERT 230 +#define TK_NULL 231 +#define TK_NK_QUESTION 232 +#define TK_NK_ALIAS 233 +#define TK_NK_ARROW 234 +#define TK_ROWTS 235 +#define TK_QSTART 236 +#define TK_QEND 237 +#define TK_QDURATION 238 +#define TK_WSTART 239 +#define TK_WEND 240 +#define TK_WDURATION 241 +#define TK_IROWTS 242 +#define TK_ISFILLED 243 +#define TK_CAST 244 +#define TK_NOW 245 +#define TK_TODAY 246 +#define TK_TIMEZONE 247 +#define TK_CLIENT_VERSION 248 +#define TK_SERVER_VERSION 249 +#define TK_SERVER_STATUS 250 +#define TK_CURRENT_USER 251 +#define TK_CASE 252 +#define TK_WHEN 253 +#define TK_THEN 254 +#define TK_ELSE 255 +#define TK_BETWEEN 256 +#define TK_IS 257 +#define TK_NK_LT 258 +#define TK_NK_GT 259 +#define TK_NK_LE 260 +#define TK_NK_GE 261 +#define TK_NK_NE 262 +#define TK_MATCH 263 +#define TK_NMATCH 264 +#define TK_CONTAINS 265 +#define TK_IN 266 +#define TK_JOIN 267 +#define TK_INNER 268 +#define TK_SELECT 269 +#define TK_NK_HINT 270 +#define TK_DISTINCT 271 +#define TK_WHERE 272 +#define TK_PARTITION 273 +#define TK_BY 274 +#define TK_SESSION 275 +#define TK_STATE_WINDOW 276 +#define TK_EVENT_WINDOW 277 +#define TK_SLIDING 278 +#define TK_FILL 279 +#define TK_VALUE 280 +#define TK_VALUE_F 281 +#define TK_NONE 282 +#define TK_PREV 283 +#define TK_NULL_F 284 +#define TK_LINEAR 285 +#define TK_NEXT 286 +#define TK_HAVING 287 +#define TK_RANGE 288 +#define TK_EVERY 289 +#define TK_ORDER 290 +#define TK_SLIMIT 291 +#define TK_SOFFSET 292 +#define TK_LIMIT 293 +#define TK_OFFSET 294 +#define TK_ASC 295 +#define TK_NULLS 296 +#define TK_ABORT 297 +#define TK_AFTER 298 +#define TK_ATTACH 299 +#define TK_BEFORE 300 +#define TK_BEGIN 301 +#define TK_BITAND 302 +#define TK_BITNOT 303 +#define TK_BITOR 304 +#define TK_BLOCKS 305 +#define TK_CHANGE 306 +#define TK_COMMA 307 +#define TK_CONCAT 308 +#define TK_CONFLICT 309 +#define TK_COPY 310 +#define TK_DEFERRED 311 +#define TK_DELIMITERS 312 +#define TK_DETACH 313 +#define TK_DIVIDE 314 +#define TK_DOT 315 +#define TK_EACH 316 +#define TK_FAIL 317 +#define TK_FILE 318 +#define TK_FOR 319 +#define TK_GLOB 320 +#define TK_ID 321 +#define TK_IMMEDIATE 322 +#define TK_IMPORT 323 +#define TK_INITIALLY 324 +#define TK_INSTEAD 325 +#define TK_ISNULL 326 +#define TK_KEY 327 +#define TK_MODULES 328 +#define TK_NK_BITNOT 329 +#define TK_NK_SEMI 330 +#define TK_NOTNULL 331 +#define TK_OF 332 +#define TK_PLUS 333 +#define TK_PRIVILEGE 334 +#define TK_RAISE 335 +#define TK_RESTRICT 336 +#define TK_ROW 337 +#define TK_SEMI 338 +#define TK_STAR 339 +#define TK_STATEMENT 340 +#define TK_STRICT 341 +#define TK_STRING 342 +#define TK_TIMES 343 +#define TK_VALUES 344 +#define TK_VARIABLE 345 +#define TK_WAL 346 #define TK_NK_SPACE 600 #define TK_NK_COMMENT 601 diff --git a/include/libs/executor/storageapi.h b/include/libs/executor/storageapi.h index 712ae7c95b..1dbc8f2f76 100644 --- a/include/libs/executor/storageapi.h +++ b/include/libs/executor/storageapi.h @@ -38,8 +38,8 @@ extern "C" { #define META_READER_NOLOCK 0x1 -#define STREAM_STATE_BUFF_HASH 1 -#define STREAM_STATE_BUFF_SORT 2 +#define STREAM_STATE_BUFF_HASH 1 +#define STREAM_STATE_BUFF_SORT 2 typedef struct SMeta SMeta; typedef TSKEY (*GetTsFun)(void*); @@ -102,14 +102,14 @@ typedef struct SMTbCursor { } SMTbCursor; typedef struct SMCtbCursor { - SMeta *pMeta; - void *pCur; + SMeta* pMeta; + void* pCur; tb_uid_t suid; - void *pKey; - void *pVal; + void* pKey; + void* pVal; int kLen; int vLen; - int8_t paused; + int8_t paused; int lock; } SMCtbCursor; @@ -153,7 +153,8 @@ typedef struct { // clang-format off /*-------------------------------------------------new api format---------------------------------------------------*/ typedef enum { - TSD_READER_NOTIFY_DURATION_START + TSD_READER_NOTIFY_DURATION_START, + TSD_READER_NOTIFY_NEXT_DURATION_BLOCK, } ETsdReaderNotifyType; typedef union { @@ -262,22 +263,23 @@ typedef struct SStoreMeta { void* (*storeGetIndexInfo)(); void* (*getInvertIndex)(void* pVnode); // support filter and non-filter cases. [vnodeGetCtbIdList & vnodeGetCtbIdListByFilter] - int32_t (*getChildTableList)( void* pVnode, int64_t suid, SArray* list); + int32_t (*getChildTableList)(void* pVnode, int64_t suid, SArray* list); int32_t (*storeGetTableList)(void* pVnode, int8_t type, SArray* pList); void* storeGetVersionRange; void* storeGetLastTimestamp; int32_t (*getTableSchema)(void* pVnode, int64_t uid, STSchema** pSchema, int64_t* suid); // tsdbGetTableSchema - int32_t (*getNumOfChildTables)( void* pVnode, int64_t uid, int64_t* numOfTables, int32_t* numOfCols); - void (*getBasicInfo)(void* pVnode, const char** dbname, int32_t* vgId, int64_t* numOfTables, int64_t* numOfNormalTables); + int32_t (*getNumOfChildTables)(void* pVnode, int64_t uid, int64_t* numOfTables, int32_t* numOfCols); + void (*getBasicInfo)(void* pVnode, const char** dbname, int32_t* vgId, int64_t* numOfTables, + int64_t* numOfNormalTables); int64_t (*getNumOfRowsInMem)(void* pVnode); - SMCtbCursor* (*openCtbCursor)(void *pVnode, tb_uid_t uid, int lock); - int32_t (*resumeCtbCursor)(SMCtbCursor* pCtbCur, int8_t first); - void (*pauseCtbCursor)(SMCtbCursor* pCtbCur); - void (*closeCtbCursor)(SMCtbCursor *pCtbCur); - tb_uid_t (*ctbCursorNext)(SMCtbCursor* pCur); + SMCtbCursor* (*openCtbCursor)(void* pVnode, tb_uid_t uid, int lock); + int32_t (*resumeCtbCursor)(SMCtbCursor* pCtbCur, int8_t first); + void (*pauseCtbCursor)(SMCtbCursor* pCtbCur); + void (*closeCtbCursor)(SMCtbCursor* pCtbCur); + tb_uid_t (*ctbCursorNext)(SMCtbCursor* pCur); } SStoreMeta; typedef struct SStoreMetaReader { @@ -362,14 +364,14 @@ typedef struct SStateStore { const SSessionKey* pKey, void** pVal, int32_t* pVLen); SUpdateInfo* (*updateInfoInit)(int64_t interval, int32_t precision, int64_t watermark, bool igUp); - TSKEY (*updateInfoFillBlockData)(SUpdateInfo* pInfo, SSDataBlock* pBlock, int32_t primaryTsCol); - bool (*updateInfoIsUpdated)(SUpdateInfo* pInfo, uint64_t tableId, TSKEY ts); - bool (*updateInfoIsTableInserted)(SUpdateInfo* pInfo, int64_t tbUid); - bool (*isIncrementalTimeStamp)(SUpdateInfo *pInfo, uint64_t tableId, TSKEY ts); + TSKEY (*updateInfoFillBlockData)(SUpdateInfo* pInfo, SSDataBlock* pBlock, int32_t primaryTsCol); + bool (*updateInfoIsUpdated)(SUpdateInfo* pInfo, uint64_t tableId, TSKEY ts); + bool (*updateInfoIsTableInserted)(SUpdateInfo* pInfo, int64_t tbUid); + bool (*isIncrementalTimeStamp)(SUpdateInfo* pInfo, uint64_t tableId, TSKEY ts); void (*updateInfoDestroy)(SUpdateInfo* pInfo); - void (*windowSBfDelete)(SUpdateInfo *pInfo, uint64_t count); - void (*windowSBfAdd)(SUpdateInfo *pInfo, uint64_t count); + void (*windowSBfDelete)(SUpdateInfo* pInfo, uint64_t count); + void (*windowSBfAdd)(SUpdateInfo* pInfo, uint64_t count); SUpdateInfo* (*updateInfoInitP)(SInterval* pInterval, int64_t watermark, bool igUp); void (*updateInfoAddCloseWindowSBF)(SUpdateInfo* pInfo); @@ -396,6 +398,7 @@ typedef struct SStateStore { void (*streamStateDestroy)(SStreamState* pState, bool remove); int32_t (*streamStateDeleteCheckPoint)(SStreamState* pState, TSKEY mark); void (*streamStateReloadInfo)(SStreamState* pState, TSKEY ts); + void (*streamStateCopyBackend)(SStreamState* src, SStreamState* dst); } SStateStore; typedef struct SStorageAPI { diff --git a/include/libs/function/function.h b/include/libs/function/function.h index 49435a6317..003e9b900a 100644 --- a/include/libs/function/function.h +++ b/include/libs/function/function.h @@ -171,6 +171,7 @@ typedef struct { int32_t taskId; int64_t streamId; int64_t streamBackendRid; + int8_t dump; } SStreamState; typedef struct SFunctionStateStore { diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index ac4f5bea0e..6aa1796963 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -46,6 +46,10 @@ extern "C" { #define SHOW_LOCAL_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE) #define SHOW_LOCAL_VARIABLES_RESULT_FIELD3_LEN (TSDB_CONFIG_SCOPE_LEN + VARSTR_HEADER_SIZE) +#define COMPACT_DB_RESULT_COLS 3 +#define COMPACT_DB_RESULT_FIELD1_LEN 32 +#define COMPACT_DB_RESULT_FIELD3_LEN 128 + #define SHOW_ALIVE_RESULT_COLS 1 #define BIT_FLAG_MASK(n) (1 << n) @@ -335,6 +339,15 @@ typedef struct SShowTableTagsStmt { SNodeList* pTags; } SShowTableTagsStmt; +typedef struct SShowCompactsStmt { + ENodeType type; +} SShowCompactsStmt; + +typedef struct SShowCompactDetailsStmt { + ENodeType type; + SNode* pCompactId; +} SShowCompactDetailsStmt; + typedef enum EIndexType { INDEX_TYPE_SMA = 1, INDEX_TYPE_FULLTEXT, INDEX_TYPE_NORMAL } EIndexType; typedef struct SIndexOptions { diff --git a/include/libs/stream/streamState.h b/include/libs/stream/streamState.h index ba90c0dc7a..24222677a4 100644 --- a/include/libs/stream/streamState.h +++ b/include/libs/stream/streamState.h @@ -50,7 +50,7 @@ void streamStateSetNumber(SStreamState* pState, int32_t number); int32_t streamStateSaveInfo(SStreamState* pState, void* pKey, int32_t keyLen, void* pVal, int32_t vLen); int32_t streamStateGetInfo(SStreamState* pState, void* pKey, int32_t keyLen, void** pVal, int32_t* pLen); -//session window +// session window int32_t streamStateSessionAddIfNotExist(SStreamState* pState, SSessionKey* key, TSKEY gap, void** pVal, int32_t* pVLen); int32_t streamStateSessionPut(SStreamState* pState, const SSessionKey* key, void* value, int32_t vLen); int32_t streamStateSessionGet(SStreamState* pState, SSessionKey* key, void** pVal, int32_t* pVLen); @@ -65,7 +65,7 @@ SStreamStateCur* streamStateSessionSeekKeyNext(SStreamState* pState, const SSess SStreamStateCur* streamStateSessionSeekKeyCurrentPrev(SStreamState* pState, const SSessionKey* key); SStreamStateCur* streamStateSessionSeekKeyCurrentNext(SStreamState* pState, const SSessionKey* key); -//state window +// state window int32_t streamStateStateAddIfNotExist(SStreamState* pState, SSessionKey* key, char* pKeyData, int32_t keyDataLen, state_key_cmpr_fn fn, void** pVal, int32_t* pVLen); @@ -96,6 +96,9 @@ int32_t streamStatePutParName(SStreamState* pState, int64_t groupId, const char* int32_t streamStateGetParName(SStreamState* pState, int64_t groupId, void** pVal); void streamStateReloadInfo(SStreamState* pState, TSKEY ts); + +void streamStateCopyBackend(SStreamState* src, SStreamState* dst); + SStreamStateCur* createStreamStateCursor(); /***compare func **/ diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h index f6737b4e27..918e50a9d0 100644 --- a/include/libs/stream/tstream.h +++ b/include/libs/stream/tstream.h @@ -323,7 +323,6 @@ typedef struct SStreamStatus { int8_t schedStatus; int8_t keepTaskStatus; bool appendTranstateBlock; // has append the transfer state data block already, todo: remove it - int8_t pauseAllowed; // allowed task status to be set to be paused int32_t timerActive; // timer is active int32_t inScanHistorySentinel; } SStreamStatus; @@ -692,6 +691,7 @@ typedef struct SStreamHbMsg { int32_t tEncodeStreamHbMsg(SEncoder* pEncoder, const SStreamHbMsg* pRsp); int32_t tDecodeStreamHbMsg(SDecoder* pDecoder, SStreamHbMsg* pRsp); +void streamMetaClearHbMsg(SStreamHbMsg* pMsg); typedef struct { int64_t streamId; diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 6ab06d06a3..06e6b8d041 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -427,6 +427,9 @@ int32_t* taosGetErrno(); #define TSDB_CODE_MND_VIEW_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x04A0) #define TSDB_CODE_MND_VIEW_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x04A1) +//mnode-compact +#define TSDB_CODE_MND_INVALID_COMPACT_ID TAOS_DEF_ERROR_CODE(0, 0x04B1) + // vnode // #define TSDB_CODE_VND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0500) // 2.x diff --git a/packaging/deb/makedeb.sh b/packaging/deb/makedeb.sh index eca75ce71a..c029b1871a 100755 --- a/packaging/deb/makedeb.sh +++ b/packaging/deb/makedeb.sh @@ -87,6 +87,7 @@ cp ${compile_dir}/../packaging/tools/taosd-dump-cfg.gdb ${pkg_dir}${install_h cp ${compile_dir}/build/bin/taosd ${pkg_dir}${install_home_path}/bin cp ${compile_dir}/build/bin/udfd ${pkg_dir}${install_home_path}/bin cp ${compile_dir}/build/bin/taosBenchmark ${pkg_dir}${install_home_path}/bin +cp ${compile_dir}/build/bin/taosdump ${pkg_dir}${install_home_path}/bin if [ -f "${compile_dir}/build/bin/taosadapter" ]; then cp ${compile_dir}/build/bin/taosadapter ${pkg_dir}${install_home_path}/bin ||: diff --git a/packaging/docker/Dockerfile b/packaging/docker/Dockerfile index 7d90beac1c..99a10e0285 100644 --- a/packaging/docker/Dockerfile +++ b/packaging/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:18.04 +FROM ubuntu:latest WORKDIR /root diff --git a/packaging/rpm/tdengine.spec b/packaging/rpm/tdengine.spec index e93af2470a..b846cd447b 100644 --- a/packaging/rpm/tdengine.spec +++ b/packaging/rpm/tdengine.spec @@ -82,6 +82,7 @@ cp %{_compiledir}/build/bin/taos %{buildroot}%{homepath}/bin cp %{_compiledir}/build/bin/taosd %{buildroot}%{homepath}/bin cp %{_compiledir}/build/bin/udfd %{buildroot}%{homepath}/bin cp %{_compiledir}/build/bin/taosBenchmark %{buildroot}%{homepath}/bin +cp %{_compiledir}/build/bin/taosdump %{buildroot}%{homepath}/bin if [ -f %{_compiledir}/../build-taoskeeper/taoskeeper ]; then cp %{_compiledir}/../build-taoskeeper/taoskeeper %{buildroot}%{homepath}/bin diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index 02ebb182fa..ae774a3289 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -621,8 +621,7 @@ function install_share_etc() { ${csudo} cp ${script_dir}/share/srv/* ${service_config_dir} ||: } -function install_log() { - ${csudo}rm -rf ${log_dir} || : +function install_log() { ${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir} ${csudo}ln -sf ${log_dir} ${install_main_dir}/log @@ -935,7 +934,9 @@ function updateProduct() { install_adapter_service install_adapter_config install_keeper_service - install_keeper_config + if [ "${verMode}" != "cloud" ]; then + install_keeper_config + fi openresty_work=false @@ -1036,8 +1037,9 @@ function installProduct() { install_adapter_service install_adapter_config install_keeper_service - install_keeper_config - + if [ "${verMode}" != "cloud" ]; then + install_keeper_config + fi openresty_work=false diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh index 1ec83b7b0d..36298a291e 100755 --- a/packaging/tools/remove.sh +++ b/packaging/tools/remove.sh @@ -401,7 +401,14 @@ echo echo "Do you want to remove all the data, log and configuration files? [y/n]" read answer if [ X$answer == X"y" ] || [ X$answer == X"Y" ]; then + confirmMsg="I confirm that I would like to delete all data, log and configuration files" + echo "Please enter '${confirmMsg}' to continue" + read answer + if [ X"$answer" == X"${confirmMsg}" ]; then remove_data_and_config + else + echo "answer doesn't match, skip this step" + fi fi echo diff --git a/packaging/tools/tdengine.iss b/packaging/tools/tdengine.iss index 8676fa2c51..ca6b5a3e5f 100644 --- a/packaging/tools/tdengine.iss +++ b/packaging/tools/tdengine.iss @@ -39,6 +39,8 @@ Compression=lzma SolidCompression=yes DisableDirPage=yes Uninstallable=yes +ArchitecturesAllowed=x64 +ArchitecturesInstallIn64BitMode=x64 [Languages] Name: "chinesesimp"; MessagesFile: "compiler:Default.isl" @@ -53,6 +55,7 @@ Source: favicon.ico; DestDir: "{app}\include"; Flags: igNoreversion; Source: {#MyAppSourceDir}{#MyAppDLLName}; DestDir: "{win}\System32"; Flags: igNoreversion recursesubdirs createallsubdirs 64bit;Check:IsWin64; Source: {#MyAppSourceDir}{#MyAppCfgName}; DestDir: "{app}\cfg"; Flags: igNoreversion recursesubdirs createallsubdirs onlyifdoesntexist uninsneveruninstall Source: {#MyAppSourceDir}{#MyAppDriverName}; DestDir: "{app}\driver"; Flags: igNoreversion recursesubdirs createallsubdirs +Source: {#MyAppSourceDir}\taos_odbc\*; DestDir: "{app}\taos_odbc\"; Flags: igNoreversion recursesubdirs createallsubdirs ;Source: {#MyAppSourceDir}{#MyAppConnectorName}; DestDir: "{app}\connector"; Flags: igNoreversion recursesubdirs createallsubdirs ;Source: {#MyAppSourceDir}{#MyAppExamplesName}; DestDir: "{app}\examples"; Flags: igNoreversion recursesubdirs createallsubdirs Source: {#MyAppSourceDir}{#MyAppIncludeName}; DestDir: "{app}\include"; Flags: igNoreversion recursesubdirs createallsubdirs @@ -66,6 +69,7 @@ Source: {#MyAppSourceDir}\taosdump.exe; DestDir: "{app}"; DestName: "{#CusPrompt [run] Filename: {sys}\sc.exe; Parameters: "create taosd start= DEMAND binPath= ""C:\\TDengine\\taosd.exe --win_service""" ; Flags: runhidden Filename: {sys}\sc.exe; Parameters: "create taosadapter start= DEMAND binPath= ""C:\\TDengine\\taosadapter.exe""" ; Flags: runhidden +Filename: "{cmd}"; Parameters: "/c odbcconf /F ""C:\TDengine\taos_odbc\win_odbcinst.in"""; WorkingDir: "{app}"; Flags: runhidden; StatusMsg: "Configuring ODBC" [UninstallRun] RunOnceId: "stoptaosd"; Filename: {sys}\sc.exe; Parameters: "stop taosd" ; Flags: runhidden @@ -95,6 +99,43 @@ begin Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0; end; +function DeleteOdbcDsnRegistry: Boolean; +var + Names: TArrayOfString; + I: Integer; + Value: String; +begin + if RegGetValueNames(HKCU64, 'SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources', Names) then + begin + for I := 0 to GetArrayLength(Names) - 1 do + begin + if RegQueryStringValue(HKCU64, 'SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources', Names[I], Value) then + begin + if Value = 'TDengine' then + begin + RegDeleteKeyIncludingSubkeys(HKCU64, 'SOFTWARE\ODBC\ODBC.INI\' + Names[I]); + RegDeleteValue(HKCU64, 'SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources\', Names[I]); + end; + end; + end; + end; + Result := True; +end; + +function DeleteOdbcDriverRegistry: Boolean; +begin + RegDeleteKeyIncludingSubkeys(HKLM64, 'SOFTWARE\ODBC\ODBCINST.INI\TDengine'); + RegDeleteValue(HKLM64, 'SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers', 'TDengine'); + Result := True; +end; + + +procedure DeinitializeUninstall(); +begin + DeleteOdbcDsnRegistry(); + DeleteOdbcDriverRegistry(); +end; + [UninstallDelete] Name: {app}\driver; Type: filesandordirs Name: {app}\connector; Type: filesandordirs diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 1ce7c02dcf..bb79146f7d 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -1309,6 +1309,10 @@ void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) { } SRequestObj *pRequest = res; + if (TSDB_SQL_RETRIEVE_EMPTY_RESULT == pRequest->type) { + fp(param, res, 0); + return; + } taosAsyncFetchImpl(pRequest, fp, param); } diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c index 5b0b59cc2c..e0cedb9924 100644 --- a/source/client/src/clientMsgHandler.c +++ b/source/client/src/clientMsgHandler.c @@ -16,6 +16,7 @@ #include "catalog.h" #include "clientInt.h" #include "clientLog.h" +#include "cmdnodes.h" #include "os.h" #include "query.h" #include "systable.h" @@ -542,6 +543,118 @@ int32_t processShowVariablesRsp(void* param, SDataBuf* pMsg, int32_t code) { return code; } +static int32_t buildCompactDbBlock(SCompactDbRsp* pRsp, SSDataBlock** block) { + SSDataBlock* pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock)); + pBlock->info.hasVarCol = true; + + pBlock->pDataBlock = taosArrayInit(COMPACT_DB_RESULT_COLS, sizeof(SColumnInfoData)); + + SColumnInfoData infoData = {0}; + infoData.info.type = TSDB_DATA_TYPE_VARCHAR; + infoData.info.bytes = COMPACT_DB_RESULT_FIELD1_LEN; + taosArrayPush(pBlock->pDataBlock, &infoData); + + infoData.info.type = TSDB_DATA_TYPE_INT; + infoData.info.bytes = tDataTypes[TSDB_DATA_TYPE_INT].bytes; + taosArrayPush(pBlock->pDataBlock, &infoData); + + infoData.info.type = TSDB_DATA_TYPE_VARCHAR; + infoData.info.bytes = COMPACT_DB_RESULT_FIELD3_LEN; + taosArrayPush(pBlock->pDataBlock, &infoData); + + blockDataEnsureCapacity(pBlock, 1); + + SColumnInfoData* pResultCol = taosArrayGet(pBlock->pDataBlock, 0); + SColumnInfoData* pIdCol = taosArrayGet(pBlock->pDataBlock, 1); + SColumnInfoData* pReasonCol = taosArrayGet(pBlock->pDataBlock, 2); + char result[COMPACT_DB_RESULT_FIELD1_LEN] = {0}; + char reason[COMPACT_DB_RESULT_FIELD3_LEN] = {0}; + if (pRsp->bAccepted) { + STR_TO_VARSTR(result, "accepted"); + colDataSetVal(pResultCol, 0, result, false); + colDataSetVal(pIdCol, 0, (void*)&pRsp->compactId, false); + STR_TO_VARSTR(reason, "success"); + colDataSetVal(pReasonCol, 0, reason, false); + } else { + STR_TO_VARSTR(result, "rejected"); + colDataSetVal(pResultCol, 0, result, false); + colDataSetNULL(pIdCol, 0); + STR_TO_VARSTR(reason, "compaction is ongoing"); + colDataSetVal(pReasonCol, 0, reason, false); + } + pBlock->info.rows = 1; + + *block = pBlock; + + return TSDB_CODE_SUCCESS; +} + +static int32_t buildRetriveTableRspForCompactDb(SCompactDbRsp* pCompactDb, SRetrieveTableRsp** pRsp) { + SSDataBlock* pBlock = NULL; + int32_t code = buildCompactDbBlock(pCompactDb, &pBlock); + if (code) { + return code; + } + + size_t rspSize = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock); + *pRsp = taosMemoryCalloc(1, rspSize); + if (NULL == *pRsp) { + blockDataDestroy(pBlock); + return TSDB_CODE_OUT_OF_MEMORY; + } + + (*pRsp)->useconds = 0; + (*pRsp)->completed = 1; + (*pRsp)->precision = 0; + (*pRsp)->compressed = 0; + (*pRsp)->compLen = 0; + (*pRsp)->numOfRows = htobe64((int64_t)pBlock->info.rows); + (*pRsp)->numOfCols = htonl(COMPACT_DB_RESULT_COLS); + + int32_t len = blockEncode(pBlock, (*pRsp)->data, COMPACT_DB_RESULT_COLS); + blockDataDestroy(pBlock); + + if (len != rspSize - sizeof(SRetrieveTableRsp)) { + uError("buildRetriveTableRspForCompactDb error, len:%d != rspSize - sizeof(SRetrieveTableRsp):%" PRIu64, len, + (uint64_t)(rspSize - sizeof(SRetrieveTableRsp))); + return TSDB_CODE_TSC_INVALID_INPUT; + } + + return TSDB_CODE_SUCCESS; +} + + +int32_t processCompactDbRsp(void* param, SDataBuf* pMsg, int32_t code) { + SRequestObj* pRequest = param; + if (code != TSDB_CODE_SUCCESS) { + setErrno(pRequest, code); + } else { + SCompactDbRsp rsp = {0}; + SRetrieveTableRsp* pRes = NULL; + code = tDeserializeSCompactDbRsp(pMsg->pData, pMsg->len, &rsp); + if (TSDB_CODE_SUCCESS == code) { + code = buildRetriveTableRspForCompactDb(&rsp, &pRes); + } + if (TSDB_CODE_SUCCESS == code) { + code = setQueryResultFromRsp(&pRequest->body.resInfo, pRes, false, true); + } + + if (code != 0) { + taosMemoryFree(pRes); + } + } + + taosMemoryFree(pMsg->pData); + taosMemoryFree(pMsg->pEpSet); + + if (pRequest->body.queryFp != NULL) { + pRequest->body.queryFp(((SSyncQueryParam *)pRequest->body.interParam)->userParam, pRequest, code); + } else { + tsem_post(&pRequest->body.rspSem); + } + return code; +} + __async_send_cb_fn_t getMsgRspHandle(int32_t msgType) { switch (msgType) { case TDMT_MND_CONNECT: @@ -558,6 +671,8 @@ __async_send_cb_fn_t getMsgRspHandle(int32_t msgType) { return processAlterStbRsp; case TDMT_MND_SHOW_VARIABLES: return processShowVariablesRsp; + case TDMT_MND_COMPACT_DB: + return processCompactDbRsp; default: return genericRspCallback; } diff --git a/source/common/src/systable.c b/source/common/src/systable.c index 1623d9f062..2e52c77080 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -334,6 +334,20 @@ static const SSysDbTableSchema userViewsSchema[] = { // {.name = "column_list", .bytes = 2048 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, }; +static const SSysDbTableSchema userCompactsSchema[] = { + {.name = "compact_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false}, + {.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, + {.name = "start_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false}, +}; + +static const SSysDbTableSchema userCompactsDetailSchema[] = { + {.name = "compact_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false}, + {.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false}, + {.name = "dnode_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false}, + {.name = "number_fileset", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false}, + {.name = "finished", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false}, + {.name = "start_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false}, +}; static const SSysTableMeta infosMeta[] = { {TSDB_INS_TABLE_DNODES, dnodesSchema, tListLen(dnodesSchema), true}, @@ -362,6 +376,8 @@ static const SSysTableMeta infosMeta[] = { {TSDB_INS_TABLE_VNODES, vnodesSchema, tListLen(vnodesSchema), true}, {TSDB_INS_TABLE_USER_PRIVILEGES, userUserPrivilegesSchema, tListLen(userUserPrivilegesSchema), true}, {TSDB_INS_TABLE_VIEWS, userViewsSchema, tListLen(userViewsSchema), false}, + {TSDB_INS_TABLE_COMPACTS, userCompactsSchema, tListLen(userCompactsSchema), false}, + {TSDB_INS_TABLE_COMPACT_DETAILS, userCompactsDetailSchema, tListLen(userCompactsDetailSchema), false}, }; static const SSysDbTableSchema connectionsSchema[] = { diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 2b7ad21cc7..fd88098b03 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -97,7 +97,7 @@ bool tsMonitorComp = false; // audit bool tsEnableAudit = true; bool tsEnableAuditCreateTable = true; -int32_t tsAuditInterval = 500; +int32_t tsAuditInterval = 5000; // telem #ifdef TD_ENTERPRISE @@ -248,6 +248,7 @@ int32_t tsTtlBatchDropNum = 10000; // number of tables dropped per batch // internal int32_t tsTransPullupInterval = 2; +int32_t tsCompactPullupInterval = 10; int32_t tsMqRebalanceInterval = 2; int32_t tsStreamCheckpointInterval = 60; float tsSinkDataRate = 2.0; @@ -281,6 +282,8 @@ int32_t tsS3BlockCacheSize = 16; // number of blocks int32_t tsS3PageCacheSize = 4096; // number of pages int32_t tsS3UploadDelaySec = 60 * 60 * 24; +bool tsExperimental = true; + #ifndef _STORAGE int32_t taosSetTfsCfg(SConfig *pCfg) { SConfigItem *pItem = cfgGetItem(pCfg, "dataDir"); @@ -528,6 +531,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) { } if (cfgAddInt32(pCfg, "numOfTaskQueueThreads", tsNumOfTaskQueueThreads, 4, 1024, CFG_SCOPE_CLIENT, CFG_DYN_NONE) != 0) return -1; + if (cfgAddBool(pCfg, "experimental", tsExperimental, CFG_SCOPE_BOTH, CFG_DYN_BOTH) != 0) return -1; return 0; } @@ -707,6 +711,9 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddInt32(pCfg, "transPullupInterval", tsTransPullupInterval, 1, 10000, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER) != 0) return -1; + if (cfgAddInt32(pCfg, "compactPullupInterval", tsCompactPullupInterval, 1, 10000, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER) != + 0) + return -1; if (cfgAddInt32(pCfg, "mqRebalanceInterval", tsMqRebalanceInterval, 1, 10000, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER) != 0) return -1; @@ -792,6 +799,8 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { return -1; if (cfgAddBool(pCfg, "enableWhiteList", tsEnableWhiteList, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER) != 0) return -1; + if (cfgAddBool(pCfg, "experimental", tsExperimental, CFG_SCOPE_BOTH, CFG_DYN_BOTH) != 0) return -1; + GRANT_CFG_ADD; return 0; } @@ -1077,6 +1086,8 @@ static int32_t taosSetClientCfg(SConfig *pCfg) { tsTimeToGetAvailableConn = cfgGetItem(pCfg, "timeToGetAvailableConn")->i32; tsKeepAliveIdle = cfgGetItem(pCfg, "keepAliveIdle")->i32; + + tsExperimental = cfgGetItem(pCfg, "experimental")->bval; return 0; } @@ -1156,6 +1167,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tmqMaxTopicNum = cfgGetItem(pCfg, "tmqMaxTopicNum")->i32; tsTransPullupInterval = cfgGetItem(pCfg, "transPullupInterval")->i32; + tsCompactPullupInterval = cfgGetItem(pCfg, "compactPullupInterval")->i32; tsMqRebalanceInterval = cfgGetItem(pCfg, "mqRebalanceInterval")->i32; tsTtlUnit = cfgGetItem(pCfg, "ttlUnit")->i32; tsTtlPushIntervalSec = cfgGetItem(pCfg, "ttlPushInterval")->i32; @@ -1210,6 +1222,8 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsS3PageCacheSize = cfgGetItem(pCfg, "s3PageCacheSize")->i32; tsS3UploadDelaySec = cfgGetItem(pCfg, "s3UploadDelaySec")->i32; + tsExperimental = cfgGetItem(pCfg, "experimental")->bval; + GRANT_CFG_GET; return 0; } @@ -1470,6 +1484,7 @@ static int32_t taosCfgDynamicOptionsForServer(SConfig *pCfg, char *name) { {"timeseriesThreshold", &tsTimeSeriesThreshold}, {"tmqMaxTopicNum", &tmqMaxTopicNum}, {"transPullupInterval", &tsTransPullupInterval}, + {"compactPullupInterval", &tsCompactPullupInterval}, {"trimVDbIntervalSec", &tsTrimVDbIntervalSec}, {"ttlBatchDropNum", &tsTtlBatchDropNum}, {"ttlFlushThreshold", &tsTtlFlushThreshold}, @@ -1479,6 +1494,7 @@ static int32_t taosCfgDynamicOptionsForServer(SConfig *pCfg, char *name) { {"s3PageCacheSize", &tsS3PageCacheSize}, {"s3UploadDelaySec", &tsS3UploadDelaySec}, {"supportVnodes", &tsNumOfSupportVnodes}, + {"experimental", &tsExperimental} }; if (taosCfgSetOption(debugOptions, tListLen(debugOptions), pItem, true) != 0) { @@ -1702,6 +1718,7 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, char *name) { {"shellActivityTimer", &tsShellActivityTimer}, {"slowLogThreshold", &tsSlowLogThreshold}, {"useAdapter", &tsUseAdapter}, + {"experimental", &tsExperimental} }; if (taosCfgSetOption(debugOptions, tListLen(debugOptions), pItem, true) != 0) { diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index d69542c98b..8cf48d41dc 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -3424,6 +3424,66 @@ int32_t tDeserializeSCompactDbReq(void *buf, int32_t bufLen, SCompactDbReq *pReq void tFreeSCompactDbReq(SCompactDbReq *pReq) { FREESQL(); } +int32_t tSerializeSCompactDbRsp(void *buf, int32_t bufLen, SCompactDbRsp *pRsp) { + SEncoder encoder = {0}; + tEncoderInit(&encoder, buf, bufLen); + + if (tStartEncode(&encoder) < 0) return -1; + if (tEncodeI32(&encoder, pRsp->compactId) < 0) return -1; + if (tEncodeI8(&encoder, pRsp->bAccepted) < 0) return -1; + tEndEncode(&encoder); + + int32_t tlen = encoder.pos; + tEncoderClear(&encoder); + return tlen; +} + +int32_t tDeserializeSCompactDbRsp(void *buf, int32_t bufLen, SCompactDbRsp *pRsp) { + SDecoder decoder = {0}; + tDecoderInit(&decoder, buf, bufLen); + + if (tStartDecode(&decoder) < 0) return -1; + if (tDecodeI32(&decoder, &pRsp->compactId) < 0) return -1; + if (tDecodeI8(&decoder, &pRsp->bAccepted) < 0) return -1; + tEndDecode(&decoder); + + tDecoderClear(&decoder); + return 0; +} + +int32_t tSerializeSKillCompactReq(void *buf, int32_t bufLen, SKillCompactReq *pReq) { + SEncoder encoder = {0}; + tEncoderInit(&encoder, buf, bufLen); + + if (tStartEncode(&encoder) < 0) return -1; + + if (tEncodeI32(&encoder, pReq->compactId) < 0) return -1; + ENCODESQL(); + + tEndEncode(&encoder); + + int32_t tlen = encoder.pos; + tEncoderClear(&encoder); + return tlen; +} + +int32_t tDeserializeSKillCompactReq(void *buf, int32_t bufLen, SKillCompactReq *pReq) { + SDecoder decoder = {0}; + tDecoderInit(&decoder, buf, bufLen); + + if (tStartDecode(&decoder) < 0) return -1; + + if (tDecodeI32(&decoder, &pReq->compactId) < 0) return -1; + DECODESQL(); + + tEndDecode(&decoder); + + tDecoderClear(&decoder); + return 0; +} + +void tFreeSKillCompactReq(SKillCompactReq *pReq) { FREESQL(); } + int32_t tSerializeSUseDbRspImp(SEncoder *pEncoder, const SUseDbRsp *pRsp) { if (tEncodeCStr(pEncoder, pRsp->db) < 0) return -1; if (tEncodeI64(pEncoder, pRsp->uid) < 0) return -1; @@ -4259,6 +4319,7 @@ int32_t tSerializeSRetrieveTableReq(void *buf, int32_t bufLen, SRetrieveTableReq if (tEncodeCStr(&encoder, pReq->tb) < 0) return -1; if (tEncodeCStr(&encoder, pReq->filterTb) < 0) return -1; if (tEncodeCStr(&encoder, pReq->user) < 0) return -1; + if (tEncodeI64(&encoder, pReq->compactId) < 0) return -1; tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -4276,6 +4337,11 @@ int32_t tDeserializeSRetrieveTableReq(void *buf, int32_t bufLen, SRetrieveTableR if (tDecodeCStrTo(&decoder, pReq->tb) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->filterTb) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->user) < 0) return -1; + if (!tDecodeIsEnd(&decoder)) { + if (tDecodeI64(&decoder, &pReq->compactId) < 0) return -1; + } else { + pReq->compactId = -1; + } tEndDecode(&decoder); tDecoderClear(&decoder); @@ -5051,6 +5117,75 @@ int32_t tFreeSCreateVnodeReq(SCreateVnodeReq *pReq) { return 0; } +int32_t tSerializeSQueryCompactProgressReq(void *buf, int32_t bufLen, SQueryCompactProgressReq *pReq) { + SEncoder encoder = {0}; + tEncoderInit(&encoder, buf, bufLen); + + if (tStartEncode(&encoder) < 0) return -1; + + if (tEncodeI32(&encoder, pReq->compactId) < 0) return -1; + if (tEncodeI32(&encoder, pReq->vgId) < 0) return -1; + if (tEncodeI32(&encoder, pReq->dnodeId) < 0) return -1; + + tEndEncode(&encoder); + + int32_t tlen = encoder.pos; + tEncoderClear(&encoder); + return tlen; +} + +int32_t tDeserializeSQueryCompactProgressReq(void *buf, int32_t bufLen, SQueryCompactProgressReq *pReq) { + int32_t headLen = sizeof(SMsgHead); + + SDecoder decoder = {0}; + tDecoderInit(&decoder, ((uint8_t *)buf) + headLen, bufLen - headLen); + + if (tStartDecode(&decoder) < 0) return -1; + + if (tDecodeI32(&decoder, &pReq->compactId) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->vgId) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) return -1; + + tEndDecode(&decoder); + tDecoderClear(&decoder); + return 0; +} + +int32_t tSerializeSQueryCompactProgressRsp(void *buf, int32_t bufLen, SQueryCompactProgressRsp *pReq) { + SEncoder encoder = {0}; + tEncoderInit(&encoder, buf, bufLen); + + if (tStartEncode(&encoder) < 0) return -1; + + if (tEncodeI32(&encoder, pReq->compactId) < 0) return -1; + if (tEncodeI32(&encoder, pReq->vgId) < 0) return -1; + if (tEncodeI32(&encoder, pReq->dnodeId) < 0) return -1; + if (tEncodeI32(&encoder, pReq->numberFileset) < 0) return -1; + if (tEncodeI32(&encoder, pReq->finished) < 0) return -1; + + tEndEncode(&encoder); + + int32_t tlen = encoder.pos; + tEncoderClear(&encoder); + return tlen; +} +int32_t tDeserializeSQueryCompactProgressRsp(void *buf, int32_t bufLen, SQueryCompactProgressRsp *pReq) { + SDecoder decoder = {0}; + tDecoderInit(&decoder, buf, bufLen); + + if (tStartDecode(&decoder) < 0) return -1; + + if (tDecodeI32(&decoder, &pReq->compactId) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->vgId) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->numberFileset) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->finished) < 0) return -1; + + tEndDecode(&decoder); + tDecoderClear(&decoder); + return 0; +} + int32_t tSerializeSDropVnodeReq(void *buf, int32_t bufLen, SDropVnodeReq *pReq) { SEncoder encoder = {0}; tEncoderInit(&encoder, buf, bufLen); @@ -5139,6 +5274,8 @@ int32_t tSerializeSCompactVnodeReq(void *buf, int32_t bufLen, SCompactVnodeReq * if (tEncodeI64(&encoder, pReq->tw.skey) < 0) return -1; if (tEncodeI64(&encoder, pReq->tw.ekey) < 0) return -1; + if (tEncodeI32(&encoder, pReq->compactId) < 0) return -1; + tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -5165,6 +5302,42 @@ int32_t tDeserializeSCompactVnodeReq(void *buf, int32_t bufLen, SCompactVnodeReq if (tDecodeI64(&decoder, &pReq->tw.ekey) < 0) return -1; } + if (!tDecodeIsEnd(&decoder)) { + if (tDecodeI32(&decoder, &pReq->compactId) < 0) return -1; + } + + tEndDecode(&decoder); + tDecoderClear(&decoder); + return 0; +} + +int32_t tSerializeSVKillCompactReq(void *buf, int32_t bufLen, SVKillCompactReq *pReq) { + SEncoder encoder = {0}; + tEncoderInit(&encoder, buf, bufLen); + + if (tStartEncode(&encoder) < 0) return -1; + + if (tEncodeI32(&encoder, pReq->compactId) < 0) return -1; + if (tEncodeI32(&encoder, pReq->vgId) < 0) return -1; + if (tEncodeI32(&encoder, pReq->dnodeId) < 0) return -1; + + tEndEncode(&encoder); + + int32_t tlen = encoder.pos; + tEncoderClear(&encoder); + return tlen; +} + +int32_t tDeserializeSVKillCompactReq(void *buf, int32_t bufLen, SVKillCompactReq *pReq) { + SDecoder decoder = {0}; + tDecoderInit(&decoder, buf, bufLen); + + if (tStartDecode(&decoder) < 0) return -1; + + if (tDecodeI32(&decoder, &pReq->compactId) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->vgId) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) return -1; + tEndDecode(&decoder); tDecoderClear(&decoder); return 0; diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c index 737a0338ef..d6de406987 100644 --- a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c +++ b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c @@ -192,6 +192,8 @@ SArray *mmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_VIEW, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_VIEW, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_VIEW_META, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_MND_KILL_COMPACT, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY_COMPACT_PROGRESS_RSP, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY, mmPutMsgToQueryQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_MERGE_QUERY, mmPutMsgToQueryQueue, 1) == NULL) goto _OVER; @@ -221,6 +223,7 @@ SArray *mmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_VND_STREAM_TASK_UPDATE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_STREAM_TASK_RESET_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_STREAM_HEARTBEAT, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_VND_KILL_COMPACT_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_CONFIG_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_REPLICA_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index a535ab17d7..9438f953a9 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -818,6 +818,8 @@ SArray *vmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_HEARTBEAT, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_CREATE_INDEX, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_INDEX, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY_COMPACT_PROGRESS, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_VND_KILL_COMPACT, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DEPLOY, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DROP, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h b/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h index a2326138b6..c646bb4bdd 100644 --- a/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h +++ b/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h @@ -113,8 +113,12 @@ int32_t dmMarkWrapper(SMgmtWrapper *pWrapper); void dmReleaseWrapper(SMgmtWrapper *pWrapper); int32_t dmInitVars(SDnode *pDnode); void dmClearVars(SDnode *pDnode); -int32_t dmInitModule(SDnode *pDnode, SMgmtWrapper *wrappers); -bool dmRequireNode(SDnode *pDnode, SMgmtWrapper *pWrapper); +#ifdef TD_MODULE_OPTIMIZE +int32_t dmInitModule(SDnode *pDnode, SMgmtWrapper *wrappers); +bool dmRequireNode(SDnode *pDnode, SMgmtWrapper *pWrapper); +#else +int32_t dmInitModule(SDnode *pDnode); +#endif SMgmtInputOpt dmBuildMgmtInputOpt(SMgmtWrapper *pWrapper); void dmSetStatus(SDnode *pDnode, EDndRunStatus stype); void dmProcessServerStartupStatus(SDnode *pDnode, SRpcMsg *pMsg); @@ -135,7 +139,11 @@ int32_t dmInitStatusClient(SDnode *pDnode); void dmCleanupClient(SDnode *pDnode); void dmCleanupStatusClient(SDnode *pDnode); SMsgCb dmGetMsgcb(SDnode *pDnode); +#ifdef TD_MODULE_OPTIMIZE int32_t dmInitMsgHandle(SDnode *pDnode, SMgmtWrapper *wrappers); +#else +int32_t dmInitMsgHandle(SDnode *pDnode); +#endif int32_t dmProcessNodeMsg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg); // dmMonitor.c diff --git a/source/dnode/mgmt/node_mgmt/src/dmMgmt.c b/source/dnode/mgmt/node_mgmt/src/dmMgmt.c index 409ee45cd3..84465640c0 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmMgmt.c +++ b/source/dnode/mgmt/node_mgmt/src/dmMgmt.c @@ -24,6 +24,22 @@ #include "tglobal.h" #endif +#ifndef TD_MODULE_OPTIMIZE +static bool dmRequireNode(SDnode *pDnode, SMgmtWrapper *pWrapper) { + SMgmtInputOpt input = dmBuildMgmtInputOpt(pWrapper); + + bool required = false; + int32_t code = (*pWrapper->func.requiredFp)(&input, &required); + if (!required) { + dDebug("node:%s, does not require startup", pWrapper->name); + } else { + dDebug("node:%s, required to startup", pWrapper->name); + } + + return required; +} +#endif + int32_t dmInitDnode(SDnode *pDnode) { dDebug("start to create dnode"); int32_t code = -1; @@ -65,11 +81,15 @@ int32_t dmInitDnode(SDnode *pDnode) { if (pDnode->lockfile == NULL) { goto _OVER; } - +#ifdef TD_MODULE_OPTIMIZE if (dmInitModule(pDnode, pDnode->wrappers) != 0) { goto _OVER; } - +#else + if (dmInitModule(pDnode) != 0) { + goto _OVER; + } +#endif indexInit(tsNumOfCommitThreads); streamMetaInit(); diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index ad5ca2cecf..1ea61f0e93 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -251,6 +251,7 @@ _OVER: dmReleaseWrapper(pWrapper); } +#ifdef TD_MODULE_OPTIMIZE int32_t dmInitMsgHandle(SDnode *pDnode, SMgmtWrapper *wrappers) { SDnodeTrans *pTrans = &pDnode->trans; @@ -276,6 +277,33 @@ int32_t dmInitMsgHandle(SDnode *pDnode, SMgmtWrapper *wrappers) { return 0; } +#else +int32_t dmInitMsgHandle(SDnode *pDnode) { + SDnodeTrans *pTrans = &pDnode->trans; + + for (EDndNodeType ntype = DNODE; ntype < NODE_END; ++ntype) { + SMgmtWrapper *pWrapper = &pDnode->wrappers[ntype]; + SArray *pArray = (*pWrapper->func.getHandlesFp)(); + if (pArray == NULL) return -1; + + for (int32_t i = 0; i < taosArrayGetSize(pArray); ++i) { + SMgmtHandle *pMgmt = taosArrayGet(pArray, i); + SDnodeHandle *pHandle = &pTrans->msgHandles[TMSG_INDEX(pMgmt->msgType)]; + if (pMgmt->needCheckVgId) { + pHandle->needCheckVgId = pMgmt->needCheckVgId; + } + if (!pMgmt->needCheckVgId) { + pHandle->defaultNtype = ntype; + } + pWrapper->msgFps[TMSG_INDEX(pMgmt->msgType)] = pMgmt->msgFp; + } + + taosArrayDestroy(pArray); + } + + return 0; +} +#endif static inline int32_t dmSendReq(const SEpSet *pEpSet, SRpcMsg *pMsg) { SDnode *pDnode = dmInstance(); diff --git a/source/dnode/mgmt/test/snode/CMakeLists.txt b/source/dnode/mgmt/test/snode/CMakeLists.txt index 70f3054381..5de3e55b0a 100644 --- a/source/dnode/mgmt/test/snode/CMakeLists.txt +++ b/source/dnode/mgmt/test/snode/CMakeLists.txt @@ -5,7 +5,7 @@ target_link_libraries( PUBLIC sut ) -add_test( - NAME dsnodeTest - COMMAND dsnodeTest -) +#add_test( +# NAME dsnodeTest +# COMMAND dsnodeTest +#) diff --git a/source/dnode/mnode/impl/inc/mndCompact.h b/source/dnode/mnode/impl/inc/mndCompact.h new file mode 100644 index 0000000000..43cf78a90e --- /dev/null +++ b/source/dnode/mnode/impl/inc/mndCompact.h @@ -0,0 +1,56 @@ +/* + * 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_MND_COMPACT_H_ +#define _TD_MND_COMPACT_H_ + +#include "mndInt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int32_t mndInitCompact(SMnode *pMnode); +void mndCleanupCompact(SMnode *pMnode); + +void tFreeCompactObj(SCompactObj *pCompact); +int32_t tSerializeSCompactObj(void *buf, int32_t bufLen, const SCompactObj *pObj); +int32_t tDeserializeSCompactObj(void *buf, int32_t bufLen, SCompactObj *pObj); + +SSdbRaw* mndCompactActionEncode(SCompactObj *pCompact); +SSdbRow* mndCompactActionDecode(SSdbRaw *pRaw); + +int32_t mndCompactActionInsert(SSdb *pSdb, SCompactObj *pCompact); +int32_t mndCompactActionDelete(SSdb *pSdb, SCompactObj *pCompact); +int32_t mndCompactActionUpdate(SSdb *pSdb, SCompactObj *pOldCompact, SCompactObj *pNewCompact); + +int32_t mndAddCompactToTran(SMnode *pMnode, STrans *pTrans, SCompactObj* pCompact, SDbObj *pDb, SCompactDbRsp *rsp); + +int32_t mndRetrieveCompact(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); + +int32_t mndProcessKillCompactReq(SRpcMsg *pReq); + +int32_t mndProcessQueryCompactRsp(SRpcMsg *pReq); + +SCompactObj *mndAcquireCompact(SMnode *pMnode, int64_t compactId); +void mndReleaseCompact(SMnode *pMnode, SCompactObj *pCompact); + +void mndCompactSendProgressReq(SMnode *pMnode, SCompactObj *pCompact); + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_MND_COMPACT_H_*/ diff --git a/source/dnode/mnode/impl/inc/mndCompactDetail.h b/source/dnode/mnode/impl/inc/mndCompactDetail.h new file mode 100644 index 0000000000..601af3b64b --- /dev/null +++ b/source/dnode/mnode/impl/inc/mndCompactDetail.h @@ -0,0 +1,48 @@ +/* + * 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_MND_COMPACT_DETAIL_H_ +#define _TD_MND_COMPACT_DETAIL_H_ + +#include "mndInt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int32_t mndInitCompactDetail(SMnode *pMnode); +void mndCleanupCompactDetail(SMnode *pMnode); + +void tFreeCompactDetailObj(SCompactDetailObj *pCompact); +int32_t tSerializeSCompactDetailObj(void *buf, int32_t bufLen, const SCompactDetailObj *pObj); +int32_t tDeserializeSCompactDetailObj(void *buf, int32_t bufLen, SCompactDetailObj *pObj); + +SSdbRaw* mndCompactDetailActionEncode(SCompactDetailObj *pCompact); +SSdbRow* mndCompactDetailActionDecode(SSdbRaw *pRaw); + +int32_t mndCompactDetailActionInsert(SSdb *pSdb, SCompactDetailObj *pCompact); +int32_t mndCompactDetailActionDelete(SSdb *pSdb, SCompactDetailObj *pCompact); +int32_t mndCompactDetailActionUpdate(SSdb *pSdb, SCompactDetailObj *pOldCompact, SCompactDetailObj *pNewCompact); + +int32_t mndAddCompactDetailToTran(SMnode *pMnode, STrans *pTrans, SCompactObj* pCompact, SVgObj *pVgroup, + SVnodeGid *pVgid, int32_t index); + +int32_t mndRetrieveCompactDetail(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_MND_COMPACT_DETAIL_H_*/ diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index 08c0aec46a..8dfd03622f 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -741,6 +741,25 @@ int32_t tEncodeSViewObj(SEncoder* pEncoder, const SViewObj* pObj); int32_t tDecodeSViewObj(SDecoder* pDecoder, SViewObj* pObj, int32_t sver); void tFreeSViewObj(SViewObj* pObj); +typedef struct { + int32_t compactDetailId; + int32_t compactId; + int32_t vgId; + int32_t dnodeId; + int32_t numberFileset; + int32_t finished; + int64_t startTime; + int32_t newNumberFileset; + int32_t newFinished; +} SCompactDetailObj; + +typedef struct { + int32_t compactId; + char dbname[TSDB_TABLE_FNAME_LEN]; + int64_t startTime; + SArray* compactDetail; +} SCompactObj; + #ifdef __cplusplus } #endif diff --git a/source/dnode/mnode/impl/inc/mndStream.h b/source/dnode/mnode/impl/inc/mndStream.h index e3ac4fd6fc..b0f6273acc 100644 --- a/source/dnode/mnode/impl/inc/mndStream.h +++ b/source/dnode/mnode/impl/inc/mndStream.h @@ -24,8 +24,9 @@ extern "C" { typedef struct SStreamTransInfo { int64_t startTime; - int32_t transId; + int64_t streamUid; const char *name; + int32_t transId; } SStreamTransInfo; // time to generated the checkpoint, if now() - checkpointTs >= tsCheckpointInterval, this checkpoint will be discard @@ -52,6 +53,14 @@ typedef struct SStreamExecInfo { TdThreadMutex lock; } SStreamExecInfo; +#define MND_STREAM_CREATE_NAME "stream-create" +#define MND_STREAM_CHECKPOINT_NAME "stream-checkpoint" +#define MND_STREAM_PAUSE_NAME "stream-pause" +#define MND_STREAM_RESUME_NAME "stream-resume" +#define MND_STREAM_DROP_NAME "stream-drop" +#define MND_STREAM_TASK_RESET_NAME "stream-task-reset" +#define MND_STREAM_TASK_UPDATE_NAME "stream-task-update" + extern SStreamExecInfo execInfo; int32_t mndInitStream(SMnode *pMnode); @@ -61,9 +70,9 @@ void mndReleaseStream(SMnode *pMnode, SStreamObj *pStream); int32_t mndDropStreamByDb(SMnode *pMnode, STrans *pTrans, SDbObj *pDb); int32_t mndPersistStream(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream); -int32_t mndStreamRegisterTrans(STrans *pTrans, const char *pName, const char *pSrcDb, const char *pDstDb); +int32_t mndStreamRegisterTrans(STrans* pTrans, const char* pTransName, int64_t streamUid); int32_t mndAddtoCheckpointWaitingList(SStreamObj *pStream, int64_t checkpointId); -bool streamTransConflictOtherTrans(SMnode *pMnode, const char *pSrcDb, const char *pDstDb, bool lock); +bool streamTransConflictOtherTrans(SMnode *pMnode, int64_t streamUid, const char *pTransName, bool lock); // for sma // TODO refactor diff --git a/source/dnode/mnode/impl/src/mndCompact.c b/source/dnode/mnode/impl/src/mndCompact.c new file mode 100644 index 0000000000..9b35343ed2 --- /dev/null +++ b/source/dnode/mnode/impl/src/mndCompact.c @@ -0,0 +1,748 @@ +/* + * 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 "mndCompact.h" +#include "mndTrans.h" +#include "mndShow.h" +#include "mndDb.h" +#include "mndCompactDetail.h" +#include "mndVgroup.h" +#include "tmsgcb.h" +#include "mndDnode.h" +#include "tmisce.h" +#include "audit.h" +#include "mndPrivilege.h" +#include "mndTrans.h" + +#define MND_COMPACT_VER_NUMBER 1 + +static int32_t mndProcessCompactTimer(SRpcMsg *pReq); + +int32_t mndInitCompact(SMnode *pMnode) { + mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_COMPACT, mndRetrieveCompact); + mndSetMsgHandle(pMnode, TDMT_MND_KILL_COMPACT, mndProcessKillCompactReq); + mndSetMsgHandle(pMnode, TDMT_VND_QUERY_COMPACT_PROGRESS_RSP, mndProcessQueryCompactRsp); + mndSetMsgHandle(pMnode, TDMT_MND_COMPACT_TIMER, mndProcessCompactTimer); + mndSetMsgHandle(pMnode, TDMT_VND_KILL_COMPACT_RSP, mndTransProcessRsp); + + SSdbTable table = { + .sdbType = SDB_COMPACT, + .keyType = SDB_KEY_INT32, + .encodeFp = (SdbEncodeFp)mndCompactActionEncode, + .decodeFp = (SdbDecodeFp)mndCompactActionDecode, + .insertFp = (SdbInsertFp)mndCompactActionInsert, + .updateFp = (SdbUpdateFp)mndCompactActionUpdate, + .deleteFp = (SdbDeleteFp)mndCompactActionDelete, + }; + + return sdbSetTable(pMnode->pSdb, table); +} + +void mndCleanupCompact(SMnode *pMnode) { + mDebug("mnd compact cleanup"); +} + +void tFreeCompactObj(SCompactObj *pCompact) { +} + +int32_t tSerializeSCompactObj(void *buf, int32_t bufLen, const SCompactObj *pObj) { + SEncoder encoder = {0}; + tEncoderInit(&encoder, buf, bufLen); + + if (tStartEncode(&encoder) < 0) return -1; + + if (tEncodeI32(&encoder, pObj->compactId) < 0) return -1; + if (tEncodeCStr(&encoder, pObj->dbname) < 0) return -1; + if (tEncodeI64(&encoder, pObj->startTime) < 0) return -1; + + tEndEncode(&encoder); + + int32_t tlen = encoder.pos; + tEncoderClear(&encoder); + return tlen; +} + +int32_t tDeserializeSCompactObj(void *buf, int32_t bufLen, SCompactObj *pObj) { + int8_t ex = 0; + SDecoder decoder = {0}; + tDecoderInit(&decoder, buf, bufLen); + + if (tStartDecode(&decoder) < 0) return -1; + + if (tDecodeI32(&decoder, &pObj->compactId) < 0) return -1; + if (tDecodeCStrTo(&decoder, pObj->dbname) < 0) return -1; + if (tDecodeI64(&decoder, &pObj->startTime) < 0) return -1; + + tEndDecode(&decoder); + + tDecoderClear(&decoder); + return 0; +} + +SSdbRaw *mndCompactActionEncode(SCompactObj *pCompact) { + terrno = TSDB_CODE_SUCCESS; + + void *buf = NULL; + SSdbRaw *pRaw = NULL; + + int32_t tlen = tSerializeSCompactObj(NULL, 0, pCompact); + if (tlen < 0) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto OVER; + } + + int32_t size = sizeof(int32_t) + tlen; + pRaw = sdbAllocRaw(SDB_COMPACT, MND_COMPACT_VER_NUMBER, size); + if (pRaw == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto OVER; + } + + buf = taosMemoryMalloc(tlen); + if (buf == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto OVER; + } + + tlen = tSerializeSCompactObj(buf, tlen, pCompact); + if (tlen < 0) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto OVER; + } + + int32_t dataPos = 0; + SDB_SET_INT32(pRaw, dataPos, tlen, OVER); + SDB_SET_BINARY(pRaw, dataPos, buf, tlen, OVER); + SDB_SET_DATALEN(pRaw, dataPos, OVER); + + +OVER: + taosMemoryFreeClear(buf); + if (terrno != TSDB_CODE_SUCCESS) { + mError("compact:%" PRId32 ", failed to encode to raw:%p since %s", pCompact->compactId, pRaw, terrstr()); + sdbFreeRaw(pRaw); + return NULL; + } + + mTrace("compact:%" PRId32 ", encode to raw:%p, row:%p", pCompact->compactId, pRaw, pCompact); + return pRaw; +} + +SSdbRow *mndCompactActionDecode(SSdbRaw *pRaw) { + SSdbRow *pRow = NULL; + SCompactObj *pCompact = NULL; + void *buf = NULL; + terrno = TSDB_CODE_SUCCESS; + + int8_t sver = 0; + if (sdbGetRawSoftVer(pRaw, &sver) != 0) { + goto OVER; + } + + if (sver != MND_COMPACT_VER_NUMBER) { + terrno = TSDB_CODE_SDB_INVALID_DATA_VER; + mError("compact read invalid ver, data ver: %d, curr ver: %d", sver, MND_COMPACT_VER_NUMBER); + goto OVER; + } + + pRow = sdbAllocRow(sizeof(SCompactObj)); + if (pRow == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto OVER; + } + + pCompact = sdbGetRowObj(pRow); + if (pCompact == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto OVER; + } + + int32_t tlen; + int32_t dataPos = 0; + SDB_GET_INT32(pRaw, dataPos, &tlen, OVER); + buf = taosMemoryMalloc(tlen + 1); + if (buf == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto OVER; + } + SDB_GET_BINARY(pRaw, dataPos, buf, tlen, OVER); + + if (tDeserializeSCompactObj(buf, tlen, pCompact) < 0) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto OVER; + } + + //taosInitRWLatch(&pView->lock); + +OVER: + taosMemoryFreeClear(buf); + if (terrno != TSDB_CODE_SUCCESS) { + mError("compact:%" PRId32 ", failed to decode from raw:%p since %s", pCompact->compactId, pRaw, terrstr()); + taosMemoryFreeClear(pRow); + return NULL; + } + + mTrace("compact:%" PRId32 ", decode from raw:%p, row:%p", pCompact->compactId, pRaw, pCompact); + return pRow; +} + +int32_t mndCompactActionInsert(SSdb *pSdb, SCompactObj *pCompact) { + mTrace("compact:%" PRId32 ", perform insert action", pCompact->compactId); + return 0; +} + +int32_t mndCompactActionDelete(SSdb *pSdb, SCompactObj *pCompact) { + mTrace("compact:%" PRId32 ", perform insert action", pCompact->compactId); + tFreeCompactObj(pCompact); + return 0; +} + +int32_t mndCompactActionUpdate(SSdb *pSdb, SCompactObj *pOldCompact, SCompactObj *pNewCompact) { + mTrace("compact:%" PRId32 ", perform update action, old row:%p new row:%p", + pOldCompact->compactId, pOldCompact, pNewCompact); + + return 0; +} + +SCompactObj *mndAcquireCompact(SMnode *pMnode, int64_t compactId) { + SSdb *pSdb = pMnode->pSdb; + SCompactObj *pCompact = sdbAcquire(pSdb, SDB_COMPACT, &compactId); + if (pCompact == NULL && terrno == TSDB_CODE_SDB_OBJ_NOT_THERE) { + terrno = TSDB_CODE_SUCCESS; + } + return pCompact; +} + +void mndReleaseCompact(SMnode *pMnode, SCompactObj *pCompact) { + SSdb *pSdb = pMnode->pSdb; + sdbRelease(pSdb, pCompact); +} + +//compact db +int32_t mndAddCompactToTran(SMnode *pMnode, STrans *pTrans, SCompactObj* pCompact, SDbObj *pDb, SCompactDbRsp *rsp){ + pCompact->compactId = tGenIdPI32(); + + strcpy(pCompact->dbname, pDb->name); + + pCompact->startTime = taosGetTimestampMs(); + + SSdbRaw *pVgRaw = mndCompactActionEncode(pCompact); + if (pVgRaw == NULL) return -1; + if (mndTransAppendRedolog(pTrans, pVgRaw) != 0) { + sdbFreeRaw(pVgRaw); + return -1; + } + (void)sdbSetRawStatus(pVgRaw, SDB_STATUS_READY); + + rsp->compactId = pCompact->compactId; + + return 0; +} + +//retrieve compact +int32_t mndRetrieveCompact(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows){ + SMnode *pMnode = pReq->info.node; + SSdb *pSdb = pMnode->pSdb; + int32_t numOfRows = 0; + SCompactObj *pCompact = NULL; + char *sep = NULL; + SDbObj *pDb = NULL; + + if (strlen(pShow->db) > 0) { + sep = strchr(pShow->db, '.'); + if (sep && ((0 == strcmp(sep + 1, TSDB_INFORMATION_SCHEMA_DB) || (0 == strcmp(sep + 1, TSDB_PERFORMANCE_SCHEMA_DB))))) { + sep++; + } else { + pDb = mndAcquireDb(pMnode, pShow->db); + if (pDb == NULL) return terrno; + } + } + + while (numOfRows < rows) { + pShow->pIter = sdbFetch(pSdb, SDB_COMPACT, pShow->pIter, (void **)&pCompact); + if (pShow->pIter == NULL) break; + + SColumnInfoData *pColInfo; + SName n; + int32_t cols = 0; + + char tmpBuf[TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE] = {0}; + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)&pCompact->compactId, false); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + if (pDb != NULL || !IS_SYS_DBNAME(pCompact->dbname)) { + SName name = {0}; + tNameFromString(&name, pCompact->dbname, T_NAME_ACCT | T_NAME_DB); + tNameGetDbName(&name, varDataVal(tmpBuf)); + } else { + strncpy(varDataVal(tmpBuf), pCompact->dbname, strlen(pCompact->dbname) + 1); + } + varDataSetLen(tmpBuf, strlen(varDataVal(tmpBuf))); + colDataSetVal(pColInfo, numOfRows, (const char *)tmpBuf, false); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)&pCompact->startTime, false); + + numOfRows++; + sdbRelease(pSdb, pCompact); + } + + pShow->numOfRows += numOfRows; + mndReleaseDb(pMnode, pDb); + return numOfRows; +} + +//kill compact +static void *mndBuildKillCompactReq(SMnode *pMnode, SVgObj *pVgroup, int32_t *pContLen, + int32_t compactId, int32_t dnodeid) { + SVKillCompactReq req = {0}; + req.compactId = compactId; + req.vgId = pVgroup->vgId; + req.dnodeId = dnodeid; + + mInfo("vgId:%d, build compact vnode config req", pVgroup->vgId); + int32_t contLen = tSerializeSVKillCompactReq(NULL, 0, &req); + if (contLen < 0) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + contLen += sizeof(SMsgHead); + + void *pReq = taosMemoryMalloc(contLen); + if (pReq == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + + SMsgHead *pHead = pReq; + pHead->contLen = htonl(contLen); + pHead->vgId = htonl(pVgroup->vgId); + + tSerializeSVKillCompactReq((char *)pReq + sizeof(SMsgHead), contLen, &req); + *pContLen = contLen; + return pReq; +} + +static int32_t mndAddKillCompactAction(SMnode *pMnode, STrans *pTrans, SVgObj *pVgroup, + int32_t compactId, int32_t dnodeid) { + STransAction action = {0}; + + SDnodeObj *pDnode = mndAcquireDnode(pMnode, dnodeid); + if (pDnode == NULL) return -1; + action.epSet = mndGetDnodeEpset(pDnode); + mndReleaseDnode(pMnode, pDnode); + + int32_t contLen = 0; + void *pReq = mndBuildKillCompactReq(pMnode, pVgroup, &contLen, compactId, dnodeid); + if (pReq == NULL) return -1; + + action.pCont = pReq; + action.contLen = contLen; + action.msgType = TDMT_VND_KILL_COMPACT; + + if (mndTransAppendRedoAction(pTrans, &action) != 0) { + taosMemoryFree(pReq); + return -1; + } + + return 0; +} + +static int32_t mndKillCompact(SMnode *pMnode, SRpcMsg *pReq, SCompactObj *pCompact) { + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "kill-compact"); + if (pTrans == NULL) { + mError("compact:%" PRId32 ", failed to drop since %s" , pCompact->compactId, terrstr()); + return -1; + } + mInfo("trans:%d, used to kill compact:%" PRId32, pTrans->id, pCompact->compactId); + + SSdbRaw *pCommitRaw = mndCompactActionEncode(pCompact); + if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) { + mError("trans:%d, failed to append commit log since %s", pTrans->id, terrstr()); + mndTransDrop(pTrans); + return -1; + } + (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); + + void *pIter = NULL; + while (1) { + SCompactDetailObj *pDetail = NULL; + pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT_DETAIL, pIter, (void **)&pDetail); + if (pIter == NULL) break; + + if (pDetail->compactId == pCompact->compactId) { + SVgObj *pVgroup = mndAcquireVgroup(pMnode, pDetail->vgId); + if(pVgroup == NULL){ + mError("trans:%d, failed to append redo action since %s", pTrans->id, terrstr()); + mndTransDrop(pTrans); + return -1; + } + + if(mndAddKillCompactAction(pMnode, pTrans, pVgroup, pCompact->compactId, pDetail->dnodeId) != 0){ + mError("trans:%d, failed to append redo action since %s", pTrans->id, terrstr()); + mndTransDrop(pTrans); + return -1; + } + + mndReleaseVgroup(pMnode, pVgroup); + + /* + SSdbRaw *pCommitRaw = mndCompactDetailActionEncode(pDetail); + if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) { + mError("trans:%d, failed to append commit log since %s", pTrans->id, terrstr()); + mndTransDrop(pTrans); + return -1; + } + (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED); + */ + } + + sdbRelease(pMnode->pSdb, pDetail); + } + + if (mndTransPrepare(pMnode, pTrans) != 0) { + mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr()); + mndTransDrop(pTrans); + return -1; + } + + mndTransDrop(pTrans); + return 0; +} + +int32_t mndProcessKillCompactReq(SRpcMsg *pReq){ + SKillCompactReq killCompactReq = {0}; + if (tDeserializeSKillCompactReq(pReq->pCont, pReq->contLen, &killCompactReq) != 0) { + terrno = TSDB_CODE_INVALID_MSG; + return -1; + } + + mInfo("start to kill compact:%" PRId32, killCompactReq.compactId); + + SMnode *pMnode = pReq->info.node; + int32_t code = -1; + SCompactObj *pCompact = mndAcquireCompact(pMnode, killCompactReq.compactId); + if(pCompact == NULL){ + terrno = TSDB_CODE_MND_INVALID_COMPACT_ID; + tFreeSKillCompactReq(&killCompactReq); + return -1; + } + + if (0 != mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_COMPACT_DB)) { + goto _OVER; + } + + if (mndKillCompact(pMnode, pReq, pCompact) < 0) { + goto _OVER; + } + + code = TSDB_CODE_ACTION_IN_PROGRESS; + + char obj[10] = {0}; + sprintf(obj, "%d", pCompact->compactId); + + auditRecord(pReq, pMnode->clusterId, "killCompact", pCompact->dbname, obj, killCompactReq.sql, killCompactReq.sqlLen); + +_OVER: + if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) { + mError("failed to kill compact %" PRId32 " since %s", killCompactReq.compactId, terrstr()); + } + + tFreeSKillCompactReq(&killCompactReq); + sdbRelease(pMnode->pSdb, pCompact); + + return code; +} + +//update progress +static int32_t mndUpdateCompactProgress(SMnode *pMnode, SRpcMsg *pReq, int32_t compactId, SQueryCompactProgressRsp* rsp) { + void* pIter = NULL; + while (1) { + SCompactDetailObj *pDetail = NULL; + pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT_DETAIL, pIter, (void **)&pDetail); + if (pIter == NULL) break; + + if (pDetail->compactId == compactId && pDetail->vgId == rsp->vgId && pDetail->dnodeId == rsp->dnodeId) { + pDetail->newNumberFileset = rsp->numberFileset; + pDetail->newFinished = rsp->finished; + + sdbRelease(pMnode->pSdb, pDetail); + + return 0; + } + + sdbRelease(pMnode->pSdb, pDetail); + } + + return -1; +} + +int32_t mndProcessQueryCompactRsp(SRpcMsg *pReq){ + SQueryCompactProgressRsp req = {0}; + if (tDeserializeSQueryCompactProgressRsp(pReq->pCont, pReq->contLen, &req) != 0) { + terrno = TSDB_CODE_INVALID_MSG; + return -1; + } + + mDebug("compact:%d, receive query response, vgId:%d, dnodeId:%d, numberFileset:%d, finished:%d", + req.compactId, req.vgId, req.dnodeId, req.numberFileset, req.finished); + + SMnode *pMnode = pReq->info.node; + int32_t code = -1; + + + if(mndUpdateCompactProgress(pMnode, pReq, req.compactId, &req) != 0){ + mError("compact:%d, failed to update progress, vgId:%d, dnodeId:%d, numberFileset:%d, finished:%d", + req.compactId, req.vgId, req.dnodeId, req.numberFileset, req.finished); + return -1; + } + + return 0; +} + +//timer +void mndCompactSendProgressReq(SMnode *pMnode, SCompactObj *pCompact){ + void *pIter = NULL; + + while (1) { + SCompactDetailObj *pDetail = NULL; + pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT_DETAIL, pIter, (void **)&pDetail); + if (pIter == NULL) break; + + if (pDetail->compactId == pCompact->compactId) { + SEpSet epSet = {0}; + + SDnodeObj *pDnode = mndAcquireDnode(pMnode, pDetail->dnodeId); + if(pDnode == NULL) break; + addEpIntoEpSet(&epSet, pDnode->fqdn, pDnode->port); + mndReleaseDnode(pMnode, pDnode); + + SQueryCompactProgressReq req; + req.compactId = pDetail->compactId; + req.vgId = pDetail->vgId; + req.dnodeId = pDetail->dnodeId; + + int32_t contLen = tSerializeSQueryCompactProgressReq(NULL, 0, &req); + if (contLen < 0) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + continue; + } + + contLen += sizeof(SMsgHead); + + SMsgHead *pHead = rpcMallocCont(contLen); + if (pHead == NULL) { + sdbCancelFetch(pMnode->pSdb, pDetail); + sdbRelease(pMnode->pSdb, pDetail); + continue; + } + + pHead->contLen = htonl(contLen); + pHead->vgId = htonl(pDetail->vgId); + + tSerializeSQueryCompactProgressReq((char *)pHead + sizeof(SMsgHead), contLen - sizeof(SMsgHead), &req); + + SRpcMsg rpcMsg = {.msgType = TDMT_VND_QUERY_COMPACT_PROGRESS, + .contLen = contLen}; + + //rpcMsg.pCont = rpcMallocCont(contLen); + //if (rpcMsg.pCont == NULL) { + // return; + //} + + //memcpy(rpcMsg.pCont, pHead, contLen); + + rpcMsg.pCont = pHead; + + char detail[1024] = {0}; + int32_t len = snprintf(detail, sizeof(detail), "msgType:%s numOfEps:%d inUse:%d", TMSG_INFO(TDMT_VND_QUERY_COMPACT_PROGRESS), + epSet.numOfEps, epSet.inUse); + for (int32_t i = 0; i < epSet.numOfEps; ++i) { + len += snprintf(detail + len, sizeof(detail) - len, " ep:%d-%s:%u", i, epSet.eps[i].fqdn, + epSet.eps[i].port); + } + + mDebug("compact:%d, send update progress msg to %s", pDetail->compactId, detail); + + tmsgSendReq(&epSet, &rpcMsg); + } + + sdbRelease(pMnode->pSdb, pDetail); + } +} + +static int32_t mndSaveCompactProgress(SMnode *pMnode, int32_t compactId) { + bool needSave = false; + void* pIter = NULL; + while (1) { + SCompactDetailObj *pDetail = NULL; + pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT_DETAIL, pIter, (void **)&pDetail); + if (pIter == NULL) break; + + if (pDetail->compactId == compactId) { + mDebug("compact:%d, check save progress, vgId:%d, dnodeId:%d, numberFileset:%d, finished:%d, " + "newNumberFileset:%d, newFinished:%d", + pDetail->compactId, pDetail->vgId, pDetail->dnodeId, pDetail->numberFileset, pDetail->finished, + pDetail->newNumberFileset, pDetail->newFinished); + + if(pDetail->numberFileset < pDetail->newNumberFileset || pDetail->finished < pDetail->newFinished) + needSave = true; + } + + sdbRelease(pMnode->pSdb, pDetail); + } + + if(!needSave) { + mDebug("compact:%" PRId32 ", no need to save" , compactId); + return 0; + } + + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, NULL, "update-compact-progress"); + if (pTrans == NULL) { + mError("trans:%" PRId32 ", failed to create since %s" , pTrans->id, terrstr()); + return -1; + } + mInfo("compact:%d, trans:%d, used to update compact progress.", compactId, pTrans->id); + + SCompactObj *pCompact = mndAcquireCompact(pMnode, compactId); + + pIter = NULL; + while (1) { + SCompactDetailObj *pDetail = NULL; + pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT_DETAIL, pIter, (void **)&pDetail); + if (pIter == NULL) break; + + if (pDetail->compactId == compactId) { + mInfo("compact:%d, trans:%d, check compact progress, vgId:%d, dnodeId:%d, numberFileset:%d, finished:%d, " + "newNumberFileset:%d, newFinished:%d", + pDetail->compactId, pTrans->id, pDetail->vgId, pDetail->dnodeId, pDetail->numberFileset, pDetail->finished, + pDetail->newNumberFileset, pDetail->newFinished); + + pDetail->numberFileset = pDetail->newNumberFileset; + pDetail->finished = pDetail->newFinished; + + SSdbRaw *pCommitRaw = mndCompactDetailActionEncode(pDetail); + if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) { + mError("compact:%d, trans:%d, failed to append commit log since %s", pDetail->compactId, pTrans->id, terrstr()); + mndTransDrop(pTrans); + return -1; + } + (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); + } + + sdbRelease(pMnode->pSdb, pDetail); + } + + bool allFinished = true; + while (1) { + SCompactDetailObj *pDetail = NULL; + pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT_DETAIL, pIter, (void **)&pDetail); + if (pIter == NULL) break; + + if(pDetail->compactId == compactId){ + mInfo("compact:%d, trans:%d, check compact finished, vgId:%d, dnodeId:%d, numberFileset:%d, finished:%d", + pDetail->compactId, pTrans->id, pDetail->vgId, pDetail->dnodeId, pDetail->numberFileset, pDetail->finished); + + if(pDetail->numberFileset == -1 && pDetail->finished == -1){ + allFinished = false; + sdbRelease(pMnode->pSdb, pDetail); + break; + } + if (pDetail->numberFileset != -1 && pDetail->finished != -1 && + pDetail->numberFileset != pDetail->finished) { + allFinished = false; + sdbRelease(pMnode->pSdb, pDetail); + break; + } + } + + sdbRelease(pMnode->pSdb, pDetail); + } + + if(allFinished){ + mInfo("compact:%d, all finished", pCompact->compactId); + while (1) { + SCompactDetailObj *pDetail = NULL; + pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT_DETAIL, pIter, (void **)&pDetail); + if (pIter == NULL) break; + + if (pDetail->compactId == pCompact->compactId) { + SSdbRaw *pCommitRaw = mndCompactDetailActionEncode(pDetail); + if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) { + mError("compact:%d, trans:%d, failed to append commit log since %s", pDetail->compactId, pTrans->id, terrstr()); + mndTransDrop(pTrans); + return -1; + } + (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED); + } + + sdbRelease(pMnode->pSdb, pDetail); + } + + SSdbRaw *pCommitRaw = mndCompactActionEncode(pCompact); + if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) { + mError("compact:%d, trans:%d, failed to append commit log since %s", compactId, pTrans->id, terrstr()); + mndTransDrop(pTrans); + return -1; + } + (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED); + } + + if (mndTransPrepare(pMnode, pTrans) != 0) { + mError("compact:%d, trans:%d, failed to prepare since %s", compactId, pTrans->id, terrstr()); + mndTransDrop(pTrans); + sdbRelease(pMnode->pSdb, pCompact); + return -1; + } + + sdbRelease(pMnode->pSdb, pCompact); + mndTransDrop(pTrans); + return 0; +} + +void mndCompactPullup(SMnode *pMnode) { + SSdb *pSdb = pMnode->pSdb; + SArray *pArray = taosArrayInit(sdbGetSize(pSdb, SDB_COMPACT), sizeof(int32_t)); + if (pArray == NULL) return; + + void *pIter = NULL; + while (1) { + SCompactObj *pCompact = NULL; + pIter = sdbFetch(pMnode->pSdb, SDB_COMPACT, pIter, (void **)&pCompact); + if (pIter == NULL) break; + taosArrayPush(pArray, &pCompact->compactId); + sdbRelease(pSdb, pCompact); + } + + for (int32_t i = 0; i < taosArrayGetSize(pArray); ++i) { + mInfo("begin to pull up"); + int32_t *pCompactId = taosArrayGet(pArray, i); + SCompactObj *pCompact = mndAcquireCompact(pMnode, *pCompactId); + if (pCompact != NULL) { + mInfo("compact:%d, begin to pull up", pCompact->compactId); + mndCompactSendProgressReq(pMnode, pCompact); + mndSaveCompactProgress(pMnode, pCompact->compactId); + } + mndReleaseCompact(pMnode, pCompact); + } + taosArrayDestroy(pArray); +} + +static int32_t mndProcessCompactTimer(SRpcMsg *pReq) { + mTrace("start to process compact timer"); + mndCompactPullup(pReq->info.node); + return 0; +} diff --git a/source/dnode/mnode/impl/src/mndCompactDetail.c b/source/dnode/mnode/impl/src/mndCompactDetail.c new file mode 100644 index 0000000000..a1c0e95c20 --- /dev/null +++ b/source/dnode/mnode/impl/src/mndCompactDetail.c @@ -0,0 +1,300 @@ +/* + * 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 "mndCompactDetail.h" +#include "mndTrans.h" +#include "mndShow.h" +#include "mndDb.h" + +#define MND_COMPACT_VER_NUMBER 1 + +int32_t mndInitCompactDetail(SMnode *pMnode) { + mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_COMPACT_DETAIL, mndRetrieveCompactDetail); + + SSdbTable table = { + .sdbType = SDB_COMPACT_DETAIL, + .keyType = SDB_KEY_INT64, + .encodeFp = (SdbEncodeFp)mndCompactDetailActionEncode, + .decodeFp = (SdbDecodeFp)mndCompactDetailActionDecode, + .insertFp = (SdbInsertFp)mndCompactDetailActionInsert, + .updateFp = (SdbUpdateFp)mndCompactDetailActionUpdate, + .deleteFp = (SdbDeleteFp)mndCompactDetailActionDelete, + }; + + return sdbSetTable(pMnode->pSdb, table); +} + +void mndCleanupCompactDetail(SMnode *pMnode) { + mDebug("mnd compact detail cleanup"); +} + +int32_t mndRetrieveCompactDetail(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows){ + SMnode *pMnode = pReq->info.node; + SSdb *pSdb = pMnode->pSdb; + int32_t numOfRows = 0; + SCompactDetailObj *pCompactDetail = NULL; + char *sep = NULL; + SDbObj *pDb = NULL; + + if (strlen(pShow->db) > 0) { + sep = strchr(pShow->db, '.'); + if (sep && ((0 == strcmp(sep + 1, TSDB_INFORMATION_SCHEMA_DB) || (0 == strcmp(sep + 1, TSDB_PERFORMANCE_SCHEMA_DB))))) { + sep++; + } else { + pDb = mndAcquireDb(pMnode, pShow->db); + if (pDb == NULL) return terrno; + } + } + + while(numOfRows < rows){ + pShow->pIter = sdbFetch(pSdb, SDB_COMPACT_DETAIL, pShow->pIter, (void **)&pCompactDetail); + if (pShow->pIter == NULL) break; + + SColumnInfoData *pColInfo; + SName n; + int32_t cols = 0; + + char tmpBuf[TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE] = {0}; + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)&pCompactDetail->compactId, false); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)&pCompactDetail->vgId, false); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)&pCompactDetail->dnodeId, false); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)&pCompactDetail->numberFileset, false); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)&pCompactDetail->finished, false); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)&pCompactDetail->startTime, false); + + numOfRows++; + sdbRelease(pSdb, pCompactDetail); + } + + pShow->numOfRows += numOfRows; + mndReleaseDb(pMnode, pDb); + return numOfRows; +} + +void tFreeCompactDetailObj(SCompactDetailObj *pCompact) { +} + +int32_t tSerializeSCompactDetailObj(void *buf, int32_t bufLen, const SCompactDetailObj *pObj) { + SEncoder encoder = {0}; + tEncoderInit(&encoder, buf, bufLen); + + if (tStartEncode(&encoder) < 0) return -1; + + if (tEncodeI32(&encoder, pObj->compactDetailId) < 0) return -1; + if (tEncodeI32(&encoder, pObj->compactId) < 0) return -1; + if (tEncodeI32(&encoder, pObj->vgId) < 0) return -1; + if (tEncodeI32(&encoder, pObj->dnodeId) < 0) return -1; + if (tEncodeI32(&encoder, pObj->numberFileset) < 0) return -1; + if (tEncodeI32(&encoder, pObj->finished) < 0) return -1; + if (tEncodeI64(&encoder, pObj->startTime) < 0) return -1; + if (tEncodeI32(&encoder, pObj->newNumberFileset) < 0) return -1; + if (tEncodeI32(&encoder, pObj->newFinished) < 0) return -1; + + tEndEncode(&encoder); + + int32_t tlen = encoder.pos; + tEncoderClear(&encoder); + return tlen; +} + +int32_t tDeserializeSCompactDetailObj(void *buf, int32_t bufLen, SCompactDetailObj *pObj) { + int8_t ex = 0; + SDecoder decoder = {0}; + tDecoderInit(&decoder, buf, bufLen); + + if (tStartDecode(&decoder) < 0) return -1; + + if (tDecodeI32(&decoder, &pObj->compactDetailId) < 0) return -1; + if (tDecodeI32(&decoder, &pObj->compactId) < 0) return -1; + if (tDecodeI32(&decoder, &pObj->vgId) < 0) return -1; + if (tDecodeI32(&decoder, &pObj->dnodeId) < 0) return -1; + if (tDecodeI32(&decoder, &pObj->numberFileset) < 0) return -1; + if (tDecodeI32(&decoder, &pObj->finished) < 0) return -1; + if (tDecodeI64(&decoder, &pObj->startTime) < 0) return -1; + if (tDecodeI32(&decoder, &pObj->newNumberFileset) < 0) return -1; + if (tDecodeI32(&decoder, &pObj->newFinished) < 0) return -1; + + tEndDecode(&decoder); + + tDecoderClear(&decoder); + return 0; +} + +SSdbRaw *mndCompactDetailActionEncode(SCompactDetailObj *pCompact) { + terrno = TSDB_CODE_SUCCESS; + + void *buf = NULL; + SSdbRaw *pRaw = NULL; + + int32_t tlen = tSerializeSCompactDetailObj(NULL, 0, pCompact); + if (tlen < 0) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto OVER; + } + + int32_t size = sizeof(int32_t) + tlen; + pRaw = sdbAllocRaw(SDB_COMPACT_DETAIL, MND_COMPACT_VER_NUMBER, size); + if (pRaw == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto OVER; + } + + buf = taosMemoryMalloc(tlen); + if (buf == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto OVER; + } + + tlen = tSerializeSCompactDetailObj(buf, tlen, pCompact); + if (tlen < 0) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto OVER; + } + + int32_t dataPos = 0; + SDB_SET_INT32(pRaw, dataPos, tlen, OVER); + SDB_SET_BINARY(pRaw, dataPos, buf, tlen, OVER); + SDB_SET_DATALEN(pRaw, dataPos, OVER); + + +OVER: + taosMemoryFreeClear(buf); + if (terrno != TSDB_CODE_SUCCESS) { + mError("compact detail:%" PRId32 ", failed to encode to raw:%p since %s", pCompact->compactId, pRaw, terrstr()); + sdbFreeRaw(pRaw); + return NULL; + } + + mTrace("compact detail:%" PRId32 ", encode to raw:%p, row:%p", pCompact->compactId, pRaw, pCompact); + return pRaw; +} + +SSdbRow *mndCompactDetailActionDecode(SSdbRaw *pRaw) { + SSdbRow *pRow = NULL; + SCompactDetailObj *pCompact = NULL; + void *buf = NULL; + terrno = TSDB_CODE_SUCCESS; + + int8_t sver = 0; + if (sdbGetRawSoftVer(pRaw, &sver) != 0) { + goto OVER; + } + + if (sver != MND_COMPACT_VER_NUMBER) { + terrno = TSDB_CODE_SDB_INVALID_DATA_VER; + mError("compact detail read invalid ver, data ver: %d, curr ver: %d", sver, MND_COMPACT_VER_NUMBER); + goto OVER; + } + + pRow = sdbAllocRow(sizeof(SCompactObj)); + if (pRow == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto OVER; + } + + pCompact = sdbGetRowObj(pRow); + if (pCompact == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto OVER; + } + + int32_t tlen; + int32_t dataPos = 0; + SDB_GET_INT32(pRaw, dataPos, &tlen, OVER); + buf = taosMemoryMalloc(tlen + 1); + if (buf == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto OVER; + } + SDB_GET_BINARY(pRaw, dataPos, buf, tlen, OVER); + + if (tDeserializeSCompactDetailObj(buf, tlen, pCompact) < 0) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto OVER; + } + + //taosInitRWLatch(&pView->lock); + +OVER: + taosMemoryFreeClear(buf); + if (terrno != TSDB_CODE_SUCCESS) { + mError("compact detail:%" PRId32 ", failed to decode from raw:%p since %s", pCompact->compactId, pRaw, terrstr()); + taosMemoryFreeClear(pRow); + return NULL; + } + + mTrace("compact detail:%" PRId32 ", decode from raw:%p, row:%p", pCompact->compactId, pRaw, pCompact); + return pRow; +} + +int32_t mndCompactDetailActionInsert(SSdb *pSdb, SCompactDetailObj *pCompact) { + mTrace("compact detail:%" PRId32 ", perform insert action", pCompact->compactId); + return 0; +} + +int32_t mndCompactDetailActionDelete(SSdb *pSdb, SCompactDetailObj *pCompact) { + mTrace("compact detail:%" PRId32 ", perform insert action", pCompact->compactId); + tFreeCompactDetailObj(pCompact); + return 0; +} + +int32_t mndCompactDetailActionUpdate(SSdb *pSdb, SCompactDetailObj *pOldCompact, SCompactDetailObj *pNewCompact) { + mTrace("compact detail:%" PRId32 ", perform update action, old row:%p new row:%p", + pOldCompact->compactId, pOldCompact, pNewCompact); + + + pOldCompact->numberFileset = pNewCompact->numberFileset; + pOldCompact->finished = pNewCompact->finished; + + return 0; +} + +int32_t mndAddCompactDetailToTran(SMnode *pMnode, STrans *pTrans, SCompactObj* pCompact, SVgObj *pVgroup, + SVnodeGid *pVgid, int32_t index){ + SCompactDetailObj compactDetail = {0}; + compactDetail.compactDetailId = index; + compactDetail.compactId = pCompact->compactId; + compactDetail.vgId = pVgroup->vgId; + compactDetail.dnodeId = pVgid->dnodeId; + compactDetail.startTime = taosGetTimestampMs(); + compactDetail.numberFileset = -1; + compactDetail.finished = -1; + compactDetail.newNumberFileset = -1; + compactDetail.newFinished = -1; + + mInfo("compact:%d, add compact detail to trans, index:%d, vgId:%d, dnodeId:%d", + compactDetail.compactId, compactDetail.compactDetailId, compactDetail.vgId, compactDetail.dnodeId); + + SSdbRaw *pVgRaw = mndCompactDetailActionEncode(&compactDetail); + if (pVgRaw == NULL) return -1; + if (mndTransAppendRedolog(pTrans, pVgRaw) != 0) { + sdbFreeRaw(pVgRaw); + return -1; + } + (void)sdbSetRawStatus(pVgRaw, SDB_STATUS_READY); + + return 0; +} \ No newline at end of file diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index fdfec610d9..38a92b43e7 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -42,6 +42,8 @@ #include "mndUser.h" #include "mndVgroup.h" #include "mndView.h" +#include "mndCompact.h" +#include "mndCompactDetail.h" static inline int32_t mndAcquireRpc(SMnode *pMnode) { int32_t code = 0; @@ -112,6 +114,16 @@ static void mndPullupTrans(SMnode *pMnode) { } } +static void mndPullupCompacts(SMnode *pMnode) { + mTrace("pullup compact timer msg"); + int32_t contLen = 0; + void *pReq = mndBuildTimerMsg(&contLen); + if (pReq != NULL) { + SRpcMsg rpcMsg = {.msgType = TDMT_MND_COMPACT_TIMER, .pCont = pReq, .contLen = contLen}; + tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg); + } +} + static void mndPullupTtl(SMnode *pMnode) { mTrace("pullup ttl"); int32_t contLen = 0; @@ -287,6 +299,10 @@ static void *mndThreadFp(void *param) { mndPullupTrans(pMnode); } + if (sec % tsCompactPullupInterval == 0) { + mndPullupCompacts(pMnode); + } + if (sec % tsMqRebalanceInterval == 0) { mndCalMqRebalance(pMnode); } @@ -462,6 +478,8 @@ static int32_t mndInitSteps(SMnode *pMnode) { if (mndAllocStep(pMnode, "mnode-db", mndInitDb, mndCleanupDb) != 0) return -1; if (mndAllocStep(pMnode, "mnode-func", mndInitFunc, mndCleanupFunc) != 0) return -1; if (mndAllocStep(pMnode, "mnode-view", mndInitView, mndCleanupView) != 0) return -1; + if (mndAllocStep(pMnode, "mnode-compact", mndInitCompact, mndCleanupCompact) != 0) return -1; + if (mndAllocStep(pMnode, "mnode-compact-detail", mndInitCompactDetail, mndCleanupCompactDetail) != 0) return -1; if (mndAllocStep(pMnode, "mnode-sdb", mndOpenSdb, NULL) != 0) return -1; if (mndAllocStep(pMnode, "mnode-profile", mndInitProfile, mndCleanupProfile) != 0) return -1; if (mndAllocStep(pMnode, "mnode-show", mndInitShow, mndCleanupShow) != 0) return -1; @@ -693,7 +711,8 @@ static int32_t mndCheckMnodeState(SRpcMsg *pMsg) { _OVER: if (pMsg->msgType == TDMT_MND_TMQ_TIMER || pMsg->msgType == TDMT_MND_TELEM_TIMER || pMsg->msgType == TDMT_MND_TRANS_TIMER || pMsg->msgType == TDMT_MND_TTL_TIMER || - pMsg->msgType == TDMT_MND_TRIM_DB_TIMER || pMsg->msgType == TDMT_MND_UPTIME_TIMER) { + pMsg->msgType == TDMT_MND_TRIM_DB_TIMER || pMsg->msgType == TDMT_MND_UPTIME_TIMER || + pMsg->msgType == TDMT_MND_COMPACT_TIMER) { mTrace("timer not process since mnode restored:%d stopped:%d, sync restored:%d role:%s ", pMnode->restored, pMnode->stopped, state.restored, syncStr(state.state)); return -1; diff --git a/source/dnode/mnode/impl/src/mndShow.c b/source/dnode/mnode/impl/src/mndShow.c index bdf7df25e1..8e7e72aa0e 100644 --- a/source/dnode/mnode/impl/src/mndShow.c +++ b/source/dnode/mnode/impl/src/mndShow.c @@ -17,6 +17,7 @@ #include "mndShow.h" #include "mndPrivilege.h" #include "systable.h" +#include "mndUser.h" #define SHOW_STEP_SIZE 100 #define SHOW_COLS_STEP_SIZE 4096 @@ -118,6 +119,10 @@ static int32_t convertToRetrieveType(char *name, int32_t len) { type = TSDB_MGMT_TABLE_PRIVILEGES; } else if (strncasecmp(name, TSDB_INS_TABLE_VIEWS, len) == 0) { type = TSDB_MGMT_TABLE_VIEWS; + } else if (strncasecmp(name, TSDB_INS_TABLE_COMPACTS, len) == 0) { + type = TSDB_MGMT_TABLE_COMPACT; + } else if (strncasecmp(name, TSDB_INS_TABLE_COMPACT_DETAILS, len) == 0) { + type = TSDB_MGMT_TABLE_COMPACT_DETAIL; } else { mError("invalid show name:%s len:%d", name, len); } @@ -206,7 +211,7 @@ static int32_t mndProcessRetrieveSysTableReq(SRpcMsg *pReq) { return -1; } - mDebug("mndProcessRetrieveSysTableReq tb:%s", retrieveReq.tb); + mDebug("process to retrieve systable req db:%s, tb:%s", retrieveReq.db, retrieveReq.tb); if (retrieveReq.showId == 0) { STableMetaRsp *pMeta = taosHashGet(pMnode->infosMeta, retrieveReq.tb, strlen(retrieveReq.tb)); diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index bd67af712a..62840f7e1f 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -16,12 +16,9 @@ #include "mndStream.h" #include "audit.h" #include "mndDb.h" -#include "mndDnode.h" -#include "mndMnode.h" #include "mndPrivilege.h" #include "mndScheduler.h" #include "mndShow.h" -#include "mndSnode.h" #include "mndStb.h" #include "mndTrans.h" #include "mndVgroup.h" @@ -34,13 +31,6 @@ #define MND_STREAM_RESERVE_SIZE 64 #define MND_STREAM_MAX_NUM 60 -#define MND_STREAM_CHECKPOINT_NAME "stream-checkpoint" -#define MND_STREAM_PAUSE_NAME "stream-pause" -#define MND_STREAM_RESUME_NAME "stream-resume" -#define MND_STREAM_DROP_NAME "stream-drop" -#define MND_STREAM_TASK_RESET_NAME "stream-task-reset" -#define MND_STREAM_TASK_UPDATE_NAME "stream-task-update" - typedef struct SNodeEntry { int32_t nodeId; bool stageUpdated; // the stage has been updated due to the leader/follower change or node reboot. @@ -103,6 +93,9 @@ static int32_t mndStreamSeqActionInsert(SSdb *pSdb, SStreamSeq *pStream); static int32_t mndStreamSeqActionDelete(SSdb *pSdb, SStreamSeq *pStream); static int32_t mndStreamSeqActionUpdate(SSdb *pSdb, SStreamSeq *pOldStream, SStreamSeq *pNewStream); +static SSdbRaw *mndStreamActionEncode(SStreamObj *pStream); +static SSdbRow *mndStreamActionDecode(SSdbRaw *pRaw); + int32_t mndInitStream(SMnode *pMnode) { SSdbTable table = { .sdbType = SDB_STREAM, @@ -839,7 +832,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) { goto _OVER; } - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq, "create-stream"); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, MND_STREAM_CREATE_NAME); if (pTrans == NULL) { mError("stream:%s, failed to create since %s", createStreamReq.name, terrstr()); goto _OVER; @@ -847,11 +840,12 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) { mInfo("trans:%d, used to create stream:%s", pTrans->id, createStreamReq.name); - mndTransSetDbName(pTrans, createStreamReq.sourceDB, streamObj.targetDb); + mndTransSetDbName(pTrans, createStreamReq.sourceDB, streamObj.targetSTbName); if (mndTransCheckConflict(pMnode, pTrans) != 0) { mndTransDrop(pTrans); goto _OVER; } + // create stb for stream if (createStreamReq.createStb == STREAM_CREATE_STABLE_TRUE && mndCreateStbForStream(pMnode, pTrans, &streamObj, pReq->info.conn.user) < 0) { @@ -938,7 +932,8 @@ int64_t mndStreamGenChkpId(SMnode *pMnode) { if (pIter == NULL) break; maxChkpId = TMAX(maxChkpId, pStream->checkpointId); - mDebug("stream %p checkpoint %" PRId64 "", pStream, pStream->checkpointId); + mDebug("stream:%p, %s id:%" PRIx64 "checkpoint %" PRId64 "", pStream, pStream->name, pStream->uid, + pStream->checkpointId); sdbRelease(pSdb, pStream); } @@ -1028,7 +1023,7 @@ static int32_t mndProcessStreamCheckpointTrans(SMnode *pMnode, SStreamObj *pStre return -1; } - bool conflict = streamTransConflictOtherTrans(pMnode, pStream->sourceDb, pStream->targetDb, true); + bool conflict = streamTransConflictOtherTrans(pMnode, pStream->uid, MND_STREAM_CHECKPOINT_NAME, true); if (conflict) { mndAddtoCheckpointWaitingList(pStream, checkpointId); mWarn("checkpoint conflict with other trans in %s, ignore the checkpoint for stream:%s %" PRIx64, pStream->sourceDb, @@ -1036,14 +1031,14 @@ static int32_t mndProcessStreamCheckpointTrans(SMnode *pMnode, SStreamObj *pStre return -1; } - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, NULL, MND_STREAM_CHECKPOINT_NAME); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, NULL, MND_STREAM_CHECKPOINT_NAME); if (pTrans == NULL) { return -1; } - mndStreamRegisterTrans(pTrans, MND_STREAM_CHECKPOINT_NAME, pStream->sourceDb, pStream->targetDb); + mndStreamRegisterTrans(pTrans, MND_STREAM_CHECKPOINT_NAME, pStream->uid); - mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetDb); + mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetSTbName); if (mndTrancCheckConflict(pMnode, pTrans) != 0) { mError("failed to checkpoint of stream name%s, checkpointId: %" PRId64 ", reason:%s", pStream->name, checkpointId, tstrerror(TSDB_CODE_MND_TRANS_CONFLICT)); @@ -1380,14 +1375,14 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) { } // check if it is conflict with other trans in both sourceDb and targetDb. - bool conflict = streamTransConflictOtherTrans(pMnode, pStream->sourceDb, pStream->targetDb, true); + bool conflict = streamTransConflictOtherTrans(pMnode, pStream->uid, MND_STREAM_DROP_NAME, true); if (conflict) { sdbRelease(pMnode->pSdb, pStream); tFreeMDropStreamReq(&dropReq); return -1; } - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq, MND_STREAM_DROP_NAME); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, MND_STREAM_DROP_NAME); if (pTrans == NULL) { mError("stream:%s, failed to drop since %s", dropReq.name, terrstr()); sdbRelease(pMnode->pSdb, pStream); @@ -1397,7 +1392,7 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) { mInfo("trans:%d used to drop stream:%s", pTrans->id, dropReq.name); - mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetDb); + mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetSTbName); if (mndTransCheckConflict(pMnode, pTrans) != 0) { sdbRelease(pMnode->pSdb, pStream); mndTransDrop(pTrans); @@ -1405,7 +1400,7 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) { return -1; } - int32_t code = mndStreamRegisterTrans(pTrans, MND_STREAM_DROP_NAME, pStream->sourceDb, pStream->targetDb); + int32_t code = mndStreamRegisterTrans(pTrans, MND_STREAM_DROP_NAME, pStream->uid); // drop all tasks if (mndDropStreamTasks(pMnode, pTrans, pStream) < 0) { @@ -1864,7 +1859,7 @@ static int32_t mndProcessPauseStreamReq(SRpcMsg *pReq) { } // check if it is conflict with other trans in both sourceDb and targetDb. - bool conflict = streamTransConflictOtherTrans(pMnode, pStream->sourceDb, pStream->targetDb, true); + bool conflict = streamTransConflictOtherTrans(pMnode, pStream->uid, MND_STREAM_PAUSE_NAME, true); if (conflict) { sdbRelease(pMnode->pSdb, pStream); return -1; @@ -1876,7 +1871,7 @@ static int32_t mndProcessPauseStreamReq(SRpcMsg *pReq) { return -1; } - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq, "pause-stream"); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, MND_STREAM_PAUSE_NAME); if (pTrans == NULL) { mError("stream:%s failed to pause stream since %s", pauseReq.name, terrstr()); sdbRelease(pMnode->pSdb, pStream); @@ -1885,14 +1880,14 @@ static int32_t mndProcessPauseStreamReq(SRpcMsg *pReq) { mInfo("trans:%d, used to pause stream:%s", pTrans->id, pauseReq.name); - mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetDb); + mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetSTbName); if (mndTransCheckConflict(pMnode, pTrans) != 0) { sdbRelease(pMnode->pSdb, pStream); mndTransDrop(pTrans); return -1; } - int32_t code = mndStreamRegisterTrans(pTrans, MND_STREAM_PAUSE_NAME, pStream->sourceDb, pStream->targetDb); + int32_t code = mndStreamRegisterTrans(pTrans, MND_STREAM_PAUSE_NAME, pStream->uid); // if nodeUpdate happened, not send pause trans if (mndPauseAllStreamTasks(pMnode, pTrans, pStream) < 0) { @@ -1999,13 +1994,13 @@ static int32_t mndProcessResumeStreamReq(SRpcMsg *pReq) { } // check if it is conflict with other trans in both sourceDb and targetDb. - bool conflict = streamTransConflictOtherTrans(pMnode, pStream->sourceDb, pStream->targetDb, true); + bool conflict = streamTransConflictOtherTrans(pMnode, pStream->uid, MND_STREAM_RESUME_NAME, true); if (conflict) { sdbRelease(pMnode->pSdb, pStream); return -1; } - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq, MND_STREAM_RESUME_NAME); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, MND_STREAM_RESUME_NAME); if (pTrans == NULL) { mError("stream:%s, failed to resume stream since %s", pauseReq.name, terrstr()); sdbRelease(pMnode->pSdb, pStream); @@ -2014,14 +2009,14 @@ static int32_t mndProcessResumeStreamReq(SRpcMsg *pReq) { mInfo("trans:%d used to resume stream:%s", pTrans->id, pauseReq.name); - mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetDb); + mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetSTbName); if (mndTransCheckConflict(pMnode, pTrans) != 0) { sdbRelease(pMnode->pSdb, pStream); mndTransDrop(pTrans); return -1; } - int32_t code = mndStreamRegisterTrans(pTrans, MND_STREAM_RESUME_NAME, pStream->sourceDb, pStream->targetDb); + int32_t code = mndStreamRegisterTrans(pTrans, MND_STREAM_RESUME_NAME, pStream->uid); // resume all tasks if (mndResumeAllStreamTasks(pTrans, pMnode, pStream, pauseReq.igUntreated) < 0) { @@ -2658,7 +2653,7 @@ void removeStreamTasksInBuf(SStreamObj *pStream, SStreamExecInfo *pExecNode) { } STrans *doCreateTrans(SMnode *pMnode, SStreamObj *pStream, SRpcMsg *pReq, const char *name, const char *pMsg) { - STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq, name); + STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, name); if (pTrans == NULL) { mError("failed to build trans:%s, reason: %s", name, tstrerror(TSDB_CODE_OUT_OF_MEMORY)); terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -2667,7 +2662,7 @@ STrans *doCreateTrans(SMnode *pMnode, SStreamObj *pStream, SRpcMsg *pReq, const mDebug("s-task:0x%" PRIx64 " start to build trans %s", pStream->uid, pMsg); - mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetDb); + mndTransSetDbName(pTrans, pStream->sourceDb, pStream->targetSTbName); if (mndTransCheckConflict(pMnode, pTrans) != 0) { terrno = TSDB_CODE_MND_TRANS_CONFLICT; mError("failed to build trans:%s for stream:0x%" PRIx64 " code:%s", name, pStream->uid, tstrerror(terrno)); @@ -2760,7 +2755,10 @@ int32_t killActiveCheckpointTrans(SMnode *pMnode, const char *pDBName, size_t le STrans *pTrans = mndAcquireTrans(pMnode, pTransInfo->transId); if (pTrans != NULL) { - mInfo("kill checkpoint transId:%d in Db:%s", pTransInfo->transId, pDBName); + char* pDupDBName = strndup(pDBName, len); + mInfo("kill checkpoint transId:%d in Db:%s", pTransInfo->transId, pDupDBName); + taosMemoryFree(pDupDBName); + mndKillTrans(pMnode, pTrans); mndReleaseTrans(pMnode, pTrans); } @@ -2786,7 +2784,7 @@ static int32_t mndResetStatusFromCheckpoint(SMnode *pMnode, int32_t transId) { break; } - bool conflict = streamTransConflictOtherTrans(pMnode, pStream->sourceDb, pStream->targetDb, false); + bool conflict = streamTransConflictOtherTrans(pMnode, pStream->uid, MND_STREAM_TASK_RESET_NAME, false); if (conflict) { mError("stream:%s other trans exists in DB:%s & %s failed to start reset-status trans", pStream->name, pStream->sourceDb, pStream->targetDb); @@ -2937,6 +2935,7 @@ int32_t mndProcessStreamHb(SRpcMsg *pReq) { tDecoderInit(&decoder, pReq->pCont, pReq->contLen); if (tDecodeStreamHbMsg(&decoder, &req) < 0) { + streamMetaClearHbMsg(&req); tDecoderClear(&decoder); terrno = TSDB_CODE_INVALID_MSG; return -1; @@ -3044,9 +3043,8 @@ int32_t mndProcessStreamHb(SRpcMsg *pReq) { } taosThreadMutexUnlock(&execInfo.lock); + streamMetaClearHbMsg(&req); - taosArrayDestroy(req.pTaskStatus); - taosArrayDestroy(req.pUpdateNodes); return TSDB_CODE_SUCCESS; } diff --git a/source/dnode/mnode/impl/src/mndStreamTrans.c b/source/dnode/mnode/impl/src/mndStreamTrans.c index 43e85a9405..0db3cb0a8a 100644 --- a/source/dnode/mnode/impl/src/mndStreamTrans.c +++ b/source/dnode/mnode/impl/src/mndStreamTrans.c @@ -23,21 +23,17 @@ typedef struct SKeyInfo { static int32_t clearFinishedTrans(SMnode* pMnode); -int32_t mndStreamRegisterTrans(STrans* pTrans, const char* pName, const char* pSrcDb, const char* pDstDb) { - SStreamTransInfo info = {.transId = pTrans->id, .startTime = taosGetTimestampMs(), .name = pName}; - taosHashPut(execInfo.transMgmt.pDBTrans, pSrcDb, strlen(pSrcDb), &info, sizeof(SStreamTransInfo)); - - if (strcmp(pSrcDb, pDstDb) != 0) { - taosHashPut(execInfo.transMgmt.pDBTrans, pDstDb, strlen(pDstDb), &info, sizeof(SStreamTransInfo)); - } - +int32_t mndStreamRegisterTrans(STrans* pTrans, const char* pTransName, int64_t streamUid) { + SStreamTransInfo info = { + .transId = pTrans->id, .startTime = taosGetTimestampMs(), .name = pTransName, .streamUid = streamUid}; + taosHashPut(execInfo.transMgmt.pDBTrans, &streamUid, sizeof(streamUid), &info, sizeof(SStreamTransInfo)); return 0; } int32_t clearFinishedTrans(SMnode* pMnode) { size_t keyLen = 0; - SArray* pList = taosArrayInit(4, sizeof(SKeyInfo)); void* pIter = NULL; + SArray* pList = taosArrayInit(4, sizeof(SKeyInfo)); while ((pIter = taosHashIterate(execInfo.transMgmt.pDBTrans, pIter)) != NULL) { SStreamTransInfo* pEntry = (SStreamTransInfo*)pIter; @@ -69,7 +65,7 @@ int32_t clearFinishedTrans(SMnode* pMnode) { return 0; } -bool streamTransConflictOtherTrans(SMnode* pMnode, const char* pSrcDb, const char* pDstDb, bool lock) { +bool streamTransConflictOtherTrans(SMnode* pMnode, int64_t streamUid, const char* pTransName, bool lock) { if (lock) { taosThreadMutexLock(&execInfo.lock); } @@ -84,22 +80,26 @@ bool streamTransConflictOtherTrans(SMnode* pMnode, const char* pSrcDb, const cha clearFinishedTrans(pMnode); - SStreamTransInfo *pEntry = taosHashGet(execInfo.transMgmt.pDBTrans, pSrcDb, strlen(pSrcDb)); + SStreamTransInfo *pEntry = taosHashGet(execInfo.transMgmt.pDBTrans, &streamUid, sizeof(streamUid)); if (pEntry != NULL) { - if (lock) { - taosThreadMutexUnlock(&execInfo.lock); - } - mWarn("conflict with other transId:%d in Db:%s, trans:%s", pEntry->transId, pSrcDb, pEntry->name); - return true; - } + SStreamTransInfo tInfo = *pEntry; - pEntry = taosHashGet(execInfo.transMgmt.pDBTrans, pDstDb, strlen(pDstDb)); - if (pEntry != NULL) { if (lock) { taosThreadMutexUnlock(&execInfo.lock); } - mWarn("conflict with other transId:%d in Db:%s, trans:%s", pEntry->transId, pSrcDb, pEntry->name); - return true; + + if (strcmp(tInfo.name, MND_STREAM_CHECKPOINT_NAME) == 0) { + if (strcmp(pTransName, MND_STREAM_DROP_NAME) != 0) { + mWarn("conflict with other transId:%d streamUid:%" PRIx64 ", trans:%s", tInfo.transId, tInfo.streamUid, + tInfo.name); + return true; + } + } else if ((strcmp(tInfo.name, MND_STREAM_CREATE_NAME) == 0) || + (strcmp(tInfo.name, MND_STREAM_DROP_NAME) == 0)) { + mWarn("conflict with other transId:%d streamUid:%" PRIx64 ", trans:%s", tInfo.transId, tInfo.streamUid, + tInfo.name); + return true; + } } if (lock) { diff --git a/source/dnode/mnode/sdb/inc/sdb.h b/source/dnode/mnode/sdb/inc/sdb.h index 0a20dcfd09..e1beaaa910 100644 --- a/source/dnode/mnode/sdb/inc/sdb.h +++ b/source/dnode/mnode/sdb/inc/sdb.h @@ -150,7 +150,9 @@ typedef enum { SDB_IDX = 21, SDB_VIEW = 22, SDB_STREAM_SEQ = 23, - SDB_MAX = 24 + SDB_COMPACT = 24, + SDB_COMPACT_DETAIL = 25, + SDB_MAX = 26 } ESdbType; typedef struct SSdbRaw { @@ -170,11 +172,11 @@ typedef struct SSdbRow { } SSdbRow; typedef struct SSdb { - SMnode * pMnode; - SWal * pWal; + SMnode *pMnode; + SWal *pWal; int64_t sync; - char * currDir; - char * tmpDir; + char *currDir; + char *tmpDir; int64_t commitIndex; int64_t commitTerm; int64_t commitConfig; @@ -184,7 +186,7 @@ typedef struct SSdb { int64_t tableVer[SDB_MAX]; int64_t maxId[SDB_MAX]; EKeyType keyTypes[SDB_MAX]; - SHashObj * hashObjs[SDB_MAX]; + SHashObj *hashObjs[SDB_MAX]; TdThreadRwlock locks[SDB_MAX]; SdbInsertFp insertFps[SDB_MAX]; SdbUpdateFp updateFps[SDB_MAX]; @@ -199,7 +201,7 @@ typedef struct SSdb { typedef struct SSdbIter { TdFilePtr file; int64_t total; - char * name; + char *name; } SSdbIter; typedef struct { @@ -216,8 +218,8 @@ typedef struct { typedef struct SSdbOpt { const char *path; - SMnode * pMnode; - SWal * pWal; + SMnode *pMnode; + SWal *pWal; int64_t sync; } SSdbOpt; @@ -394,7 +396,7 @@ int32_t sdbGetRawSoftVer(SSdbRaw *pRaw, int8_t *sver); int32_t sdbGetRawTotalSize(SSdbRaw *pRaw); SSdbRow *sdbAllocRow(int32_t objSize); -void * sdbGetRowObj(SSdbRow *pRow); +void *sdbGetRowObj(SSdbRow *pRow); void sdbFreeRow(SSdb *pSdb, SSdbRow *pRow, bool callFunc); int32_t sdbStartRead(SSdb *pSdb, SSdbIter **ppIter, int64_t *index, int64_t *term, int64_t *config); diff --git a/source/dnode/mnode/sdb/src/sdbHash.c b/source/dnode/mnode/sdb/src/sdbHash.c index df5c399da8..109a3ca211 100644 --- a/source/dnode/mnode/sdb/src/sdbHash.c +++ b/source/dnode/mnode/sdb/src/sdbHash.c @@ -64,7 +64,11 @@ const char *sdbTableName(ESdbType type) { return "idx"; case SDB_VIEW: return "view"; - default: + case SDB_COMPACT: + return "compact"; + case SDB_COMPACT_DETAIL: + return "compact_detail"; + default: return "undefine"; } } diff --git a/source/dnode/snode/src/snode.c b/source/dnode/snode/src/snode.c index 380be1dd38..21d813c7c0 100644 --- a/source/dnode/snode/src/snode.c +++ b/source/dnode/snode/src/snode.c @@ -66,6 +66,7 @@ int32_t sndExpandTask(SSnode *pSnode, SStreamTask *pTask, int64_t nextProcessVer } else { sndDebug("s-task:%s state:%p", pTask->id.idStr, pTask->pState); } + int32_t numOfVgroups = (int32_t)taosArrayGetSize(pTask->upstreamInfo.pList); SReadHandle handle = { diff --git a/source/dnode/snode/src/snodeInitApi.c b/source/dnode/snode/src/snodeInitApi.c index d1e0aefca0..c605a8373e 100644 --- a/source/dnode/snode/src/snodeInitApi.c +++ b/source/dnode/snode/src/snodeInitApi.c @@ -14,8 +14,8 @@ */ #include "storageapi.h" -#include "tstreamUpdate.h" #include "streamState.h" +#include "tstreamUpdate.h" static void initStateStoreAPI(SStateStore* pStore); static void initFunctionStateStore(SFunctionStateStore* pStore); @@ -100,9 +100,10 @@ void initStateStoreAPI(SStateStore* pStore) { pStore->streamStateClose = streamStateClose; pStore->streamStateBegin = streamStateBegin; pStore->streamStateCommit = streamStateCommit; - pStore->streamStateDestroy= streamStateDestroy; + pStore->streamStateDestroy = streamStateDestroy; pStore->streamStateDeleteCheckPoint = streamStateDeleteCheckPoint; pStore->streamStateReloadInfo = streamStateReloadInfo; + pStore->streamStateCopyBackend = streamStateCopyBackend; } void initFunctionStateStore(SFunctionStateStore* pStore) { diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index 114051f02b..2c57eb3cb5 100644 --- a/source/dnode/vnode/CMakeLists.txt +++ b/source/dnode/vnode/CMakeLists.txt @@ -93,6 +93,7 @@ IF (TD_VNODE_PLUGINS) vnode PRIVATE ${TD_ENTERPRISE_DIR}/src/plugins/vnode/src/tsdbCompact.c + ${TD_ENTERPRISE_DIR}/src/plugins/vnode/src/tsdbCompactMonitor.c ${TD_ENTERPRISE_DIR}/src/plugins/vnode/src/vnodeCompact.c ) ENDIF () diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index 4a98439375..d347ce30d8 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -74,6 +74,7 @@ typedef struct SDiskDataBuilder SDiskDataBuilder; typedef struct SBlkInfo SBlkInfo; typedef struct STsdbDataIter2 STsdbDataIter2; typedef struct STsdbFilterInfo STsdbFilterInfo; +typedef struct STFileSystem STFileSystem; #define TSDBROW_ROW_FMT ((int8_t)0x0) #define TSDBROW_COL_FMT ((int8_t)0x1) @@ -392,6 +393,8 @@ struct STsdb { TdThreadMutex pgMutex; struct STFileSystem *pFS; // new SRocksCache rCache; + // compact monitor + struct SCompMonitor *pCompMonitor; }; struct TSDBKEY { diff --git a/source/dnode/vnode/src/tq/tqOffset.c b/source/dnode/vnode/src/tq/tqOffset.c index 5e67f3c3ac..f8bf61d4e7 100644 --- a/source/dnode/vnode/src/tq/tqOffset.c +++ b/source/dnode/vnode/src/tq/tqOffset.c @@ -47,6 +47,7 @@ int32_t tqOffsetRestoreFromFile(STqOffsetStore* pStore, const char* fname) { } } + size = htonl(size); void* pMemBuf = taosMemoryCalloc(1, size); if (pMemBuf == NULL) { tqError("vgId:%d failed to restore offset from file, since out of memory, malloc size:%d", vgId, size); @@ -119,6 +120,7 @@ STqOffsetStore* tqOffsetOpen(STQ* pTq) { } void tqOffsetClose(STqOffsetStore* pStore) { + if(pStore == NULL) return; tqOffsetCommitFile(pStore); taosHashCleanup(pStore->pHash); taosMemoryFree(pStore); @@ -176,7 +178,7 @@ int32_t tqOffsetCommitFile(STqOffsetStore* pStore) { void* buf = taosMemoryCalloc(1, totLen); void* abuf = POINTER_SHIFT(buf, INT_BYTES); - *(int32_t*)buf = bodyLen; + *(int32_t*)buf = htonl(bodyLen); SEncoder encoder; tEncoderInit(&encoder, abuf, bodyLen); tEncodeSTqOffset(&encoder, pOffset); diff --git a/source/dnode/vnode/src/tqCommon/tqCommon.c b/source/dnode/vnode/src/tqCommon/tqCommon.c index a106fe148b..2140b80eef 100644 --- a/source/dnode/vnode/src/tqCommon/tqCommon.c +++ b/source/dnode/vnode/src/tqCommon/tqCommon.c @@ -13,9 +13,9 @@ * along with this program. If not, see . */ -#include "tstream.h" #include "tmsgcb.h" #include "tq.h" +#include "tstream.h" typedef struct STaskUpdateEntry { int64_t streamId; @@ -24,7 +24,7 @@ typedef struct STaskUpdateEntry { } STaskUpdateEntry; int32_t tqStreamTaskStartAsync(SStreamMeta* pMeta, SMsgCb* cb, bool restart) { - int32_t vgId = pMeta->vgId; + int32_t vgId = pMeta->vgId; int32_t numOfTasks = taosArrayGetSize(pMeta->pTaskList); if (numOfTasks == 0) { @@ -42,7 +42,7 @@ int32_t tqStreamTaskStartAsync(SStreamMeta* pMeta, SMsgCb* cb, bool restart) { tqDebug("vgId:%d start all %d stream task(s) async", vgId, numOfTasks); pRunReq->head.vgId = vgId; pRunReq->streamId = 0; - pRunReq->taskId = restart? STREAM_EXEC_RESTART_ALL_TASKS_ID:STREAM_EXEC_START_ALL_TASKS_ID; + pRunReq->taskId = restart ? STREAM_EXEC_RESTART_ALL_TASKS_ID : STREAM_EXEC_START_ALL_TASKS_ID; SRpcMsg msg = {.msgType = TDMT_STREAM_TASK_RUN, .pCont = pRunReq, .contLen = sizeof(SStreamTaskRunReq)}; tmsgPutToQueue(cb, STREAM_QUEUE, &msg); @@ -50,10 +50,10 @@ int32_t tqStreamTaskStartAsync(SStreamMeta* pMeta, SMsgCb* cb, bool restart) { } int32_t tqStreamTaskProcessUpdateReq(SStreamMeta* pMeta, SMsgCb* cb, SRpcMsg* pMsg, bool restored) { - int32_t vgId = pMeta->vgId; - char* msg = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)); - int32_t len = pMsg->contLen - sizeof(SMsgHead); - SRpcMsg rsp = {.info = pMsg->info, .code = TSDB_CODE_SUCCESS}; + int32_t vgId = pMeta->vgId; + char* msg = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)); + int32_t len = pMsg->contLen - sizeof(SMsgHead); + SRpcMsg rsp = {.info = pMsg->info, .code = TSDB_CODE_SUCCESS}; SStreamTaskNodeUpdateMsg req = {0}; @@ -72,7 +72,7 @@ int32_t tqStreamTaskProcessUpdateReq(SStreamMeta* pMeta, SMsgCb* cb, SRpcMsg* pM streamMetaWLock(pMeta); // the task epset may be updated again and again, when replaying the WAL, the task may be in stop status. - STaskId id = {.streamId = req.streamId, .taskId = req.taskId}; + STaskId id = {.streamId = req.streamId, .taskId = req.taskId}; SStreamTask** ppTask = (SStreamTask**)taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); if (ppTask == NULL || *ppTask == NULL) { tqError("vgId:%d failed to acquire task:0x%x when handling update, it may have been dropped already", pMeta->vgId, @@ -96,7 +96,7 @@ int32_t tqStreamTaskProcessUpdateReq(SStreamMeta* pMeta, SMsgCb* cb, SRpcMsg* pM } STaskUpdateEntry entry = {.streamId = req.streamId, .taskId = req.taskId, .transId = req.transId}; - void* exist = taosHashGet(pMeta->updateInfo.pTasks, &entry, sizeof(STaskUpdateEntry)); + void* exist = taosHashGet(pMeta->updateInfo.pTasks, &entry, sizeof(STaskUpdateEntry)); if (exist != NULL) { tqDebug("s-task:%s (vgId:%d) already update in trans:%d, discard the nodeEp update msg", pTask->id.idStr, vgId, req.transId); @@ -166,7 +166,8 @@ int32_t tqStreamTaskProcessUpdateReq(SStreamMeta* pMeta, SMsgCb* cb, SRpcMsg* pM streamMetaWUnLock(pMeta); } else { if (!restored) { - tqDebug("vgId:%d vnode restore not completed, not restart the tasks, clear the start after nodeUpdate flag", vgId); + tqDebug("vgId:%d vnode restore not completed, not restart the tasks, clear the start after nodeUpdate flag", + vgId); pMeta->startInfo.tasksWillRestart = 0; streamMetaWUnLock(pMeta); } else { @@ -238,7 +239,7 @@ int32_t tqStreamTaskProcessDispatchReq(SStreamMeta* pMeta, SRpcMsg* pMsg) { SStreamDispatchReq req = {0}; - SDecoder decoder; + SDecoder decoder; tDecoderInit(&decoder, (uint8_t*)msgBody, msgLen); if (tDecodeStreamDispatchReq(&decoder, &req) < 0) { tDecoderClear(&decoder); @@ -251,7 +252,7 @@ int32_t tqStreamTaskProcessDispatchReq(SStreamMeta* pMeta, SRpcMsg* pMsg) { SStreamTask* pTask = streamMetaAcquireTask(pMeta, req.streamId, req.taskId); if (pTask) { SRpcMsg rsp = {.info = pMsg->info, .code = 0}; - if (streamProcessDispatchMsg(pTask, &req, &rsp) != 0){ + if (streamProcessDispatchMsg(pTask, &req, &rsp) != 0) { return -1; } tDeleteStreamDispatchReq(&req); @@ -355,8 +356,8 @@ int32_t tqStreamTaskProcessScanHistoryFinishReq(SStreamMeta* pMeta, SRpcMsg* pMs SStreamTask* pTask = streamMetaAcquireTask(pMeta, req.streamId, req.downstreamTaskId); if (pTask == NULL) { - tqError("vgId:%d process scan history finish msg, failed to find task:0x%x, it may be destroyed", - pMeta->vgId, req.downstreamTaskId); + tqError("vgId:%d process scan history finish msg, failed to find task:0x%x, it may be destroyed", pMeta->vgId, + req.downstreamTaskId); return -1; } @@ -368,6 +369,7 @@ int32_t tqStreamTaskProcessScanHistoryFinishReq(SStreamMeta* pMeta, SRpcMsg* pMs } int32_t tqStreamTaskProcessScanHistoryFinishRsp(SStreamMeta* pMeta, SRpcMsg* pMsg) { + int32_t code = TSDB_CODE_SUCCESS; char* msg = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)); int32_t msgLen = pMsg->contLen - sizeof(SMsgHead); @@ -379,10 +381,16 @@ int32_t tqStreamTaskProcessScanHistoryFinishRsp(SStreamMeta* pMeta, SRpcMsg* pMs tDecodeCompleteHistoryDataMsg(&decoder, &req); tDecoderClear(&decoder); + if (pMeta->role == NODE_ROLE_FOLLOWER) { + tqError("s-task:0x%x (vgId:%d) not handle the scan-history finish rsp, since it becomes follower", + req.upstreamTaskId, pMeta->vgId); + return TASK_DOWNSTREAM_NOT_LEADER; + } + SStreamTask* pTask = streamMetaAcquireTask(pMeta, req.streamId, req.upstreamTaskId); if (pTask == NULL) { - tqError("vgId:%d process scan history finish rsp, failed to find task:0x%x, it may be destroyed", - pMeta->vgId, req.upstreamTaskId); + tqError("vgId:%d process scan history finish rsp, failed to find task:0x%x, it may be destroyed", pMeta->vgId, + req.upstreamTaskId); return -1; } @@ -395,11 +403,11 @@ int32_t tqStreamTaskProcessScanHistoryFinishRsp(SStreamMeta* pMeta, SRpcMsg* pMs "s-task:%s scan-history finish rsp received from downstream task:0x%x, all downstream tasks rsp scan-history " "completed msg", pTask->id.idStr, req.downstreamId); - streamProcessScanHistoryFinishRsp(pTask); + code = streamProcessScanHistoryFinishRsp(pTask); } streamMetaReleaseTask(pMeta, pTask); - return 0; + return code; } int32_t tqStreamTaskProcessCheckReq(SStreamMeta* pMeta, SRpcMsg* pMsg) { @@ -428,8 +436,9 @@ int32_t tqStreamTaskProcessCheckReq(SStreamMeta* pMeta, SRpcMsg* pMsg) { // only the leader node handle the check request if (pMeta->role == NODE_ROLE_FOLLOWER) { - tqError("s-task:0x%x invalid check msg from upstream:0x%x(vgId:%d), vgId:%d is follower, not handle check status msg", - taskId, req.upstreamTaskId, req.upstreamNodeId, pMeta->vgId); + tqError( + "s-task:0x%x invalid check msg from upstream:0x%x(vgId:%d), vgId:%d is follower, not handle check status msg", + taskId, req.upstreamTaskId, req.upstreamNodeId, pMeta->vgId); rsp.status = TASK_DOWNSTREAM_NOT_LEADER; } else { SStreamTask* pTask = streamMetaAcquireTask(pMeta, req.streamId, taskId); @@ -439,13 +448,14 @@ int32_t tqStreamTaskProcessCheckReq(SStreamMeta* pMeta, SRpcMsg* pMsg) { char* p = NULL; streamTaskGetStatus(pTask, &p); - tqDebug("s-task:%s status:%s, stage:%"PRId64" recv task check req(reqId:0x%" PRIx64 ") task:0x%x (vgId:%d), check_status:%d", - pTask->id.idStr, p, rsp.oldStage, rsp.reqId, rsp.upstreamTaskId, rsp.upstreamNodeId, rsp.status); + tqDebug("s-task:%s status:%s, stage:%" PRId64 " recv task check req(reqId:0x%" PRIx64 + ") task:0x%x (vgId:%d), check_status:%d", + pTask->id.idStr, p, rsp.oldStage, rsp.reqId, rsp.upstreamTaskId, rsp.upstreamNodeId, rsp.status); } else { rsp.status = TASK_DOWNSTREAM_NOT_READY; tqDebug("tq recv task check(taskId:0x%" PRIx64 "-0x%x not built yet) req(reqId:0x%" PRIx64 - ") from task:0x%x (vgId:%d), rsp check_status %d", - req.streamId, taskId, rsp.reqId, rsp.upstreamTaskId, rsp.upstreamNodeId, rsp.status); + ") from task:0x%x (vgId:%d), rsp check_status %d", + req.streamId, taskId, rsp.reqId, rsp.upstreamTaskId, rsp.upstreamNodeId, rsp.status); } } @@ -472,7 +482,7 @@ int32_t tqStreamTaskProcessCheckRsp(SStreamMeta* pMeta, SRpcMsg* pMsg, bool isLe tDecoderClear(&decoder); tqDebug("tq task:0x%x (vgId:%d) recv check rsp(reqId:0x%" PRIx64 ") from 0x%x (vgId:%d) status %d", - rsp.upstreamTaskId, rsp.upstreamNodeId, rsp.reqId, rsp.downstreamTaskId, rsp.downstreamNodeId, rsp.status); + rsp.upstreamTaskId, rsp.upstreamNodeId, rsp.reqId, rsp.downstreamTaskId, rsp.downstreamNodeId, rsp.status); if (!isLeader) { streamMetaUpdateTaskDownstreamStatus(pMeta, rsp.streamId, rsp.upstreamTaskId, 0, taosGetTimestampMs(), false); @@ -485,7 +495,7 @@ int32_t tqStreamTaskProcessCheckRsp(SStreamMeta* pMeta, SRpcMsg* pMsg, bool isLe if (pTask == NULL) { streamMetaUpdateTaskDownstreamStatus(pMeta, rsp.streamId, rsp.upstreamTaskId, 0, taosGetTimestampMs(), false); tqError("tq failed to locate the stream task:0x%" PRIx64 "-0x%x (vgId:%d), it may have been destroyed or stopped", - rsp.streamId, rsp.upstreamTaskId, vgId); + rsp.streamId, rsp.upstreamTaskId, vgId); terrno = TSDB_CODE_STREAM_TASK_NOT_EXIST; return -1; } @@ -496,10 +506,10 @@ int32_t tqStreamTaskProcessCheckRsp(SStreamMeta* pMeta, SRpcMsg* pMsg, bool isLe } int32_t tqStreamTaskProcessCheckpointReadyMsg(SStreamMeta* pMeta, SRpcMsg* pMsg) { - int32_t vgId = pMeta->vgId; - char* msg = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)); - int32_t len = pMsg->contLen - sizeof(SMsgHead); - int32_t code = 0; + int32_t vgId = pMeta->vgId; + char* msg = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)); + int32_t len = pMsg->contLen - sizeof(SMsgHead); + int32_t code = 0; SStreamCheckpointReadyMsg req = {0}; @@ -526,7 +536,8 @@ int32_t tqStreamTaskProcessCheckpointReadyMsg(SStreamMeta* pMeta, SRpcMsg* pMsg) return code; } -int32_t tqStreamTaskProcessDeployReq(SStreamMeta* pMeta, int64_t sversion, char* msg, int32_t msgLen, bool isLeader, bool restored) { +int32_t tqStreamTaskProcessDeployReq(SStreamMeta* pMeta, int64_t sversion, char* msg, int32_t msgLen, bool isLeader, + bool restored) { int32_t code = 0; int32_t vgId = pMeta->vgId; @@ -538,7 +549,7 @@ int32_t tqStreamTaskProcessDeployReq(SStreamMeta* pMeta, int64_t sversion, char* tqDebug("vgId:%d receive new stream task deploy msg, start to build stream task", vgId); // 1.deserialize msg and build task - int32_t size = sizeof(SStreamTask); + int32_t size = sizeof(SStreamTask); SStreamTask* pTask = taosMemoryCalloc(1, size); if (pTask == NULL) { tqError("vgId:%d failed to create stream task due to out of memory, alloc size:%d", vgId, size); @@ -566,7 +577,8 @@ int32_t tqStreamTaskProcessDeployReq(SStreamMeta* pMeta, int64_t sversion, char* streamMetaWUnLock(pMeta); if (code < 0) { - tqError("failed to add s-task:0x%x into vgId:%d meta, total:%d, code:%s", vgId, taskId, numOfTasks, tstrerror(code)); + tqError("failed to add s-task:0x%x into vgId:%d meta, total:%d, code:%s", vgId, taskId, numOfTasks, + tstrerror(code)); tFreeStreamTask(pTask); return code; } @@ -603,7 +615,7 @@ int32_t tqStreamTaskProcessDeployReq(SStreamMeta* pMeta, int64_t sversion, char* int32_t tqStreamTaskProcessDropReq(SStreamMeta* pMeta, char* msg, int32_t msgLen) { SVDropStreamTaskReq* pReq = (SVDropStreamTaskReq*)msg; - int32_t vgId = pMeta->vgId; + int32_t vgId = pMeta->vgId; tqDebug("vgId:%d receive msg to drop s-task:0x%x", vgId, pReq->taskId); SStreamTask* pTask = streamMetaAcquireTask(pMeta, pReq->streamId, pReq->taskId); @@ -628,14 +640,14 @@ int32_t tqStreamTaskProcessDropReq(SStreamMeta* pMeta, char* msg, int32_t msgLen if (streamMetaCommit(pMeta) < 0) { // persist to disk } - streamMetaWUnLock(pMeta); + streamMetaWUnLock(pMeta); return 0; } int32_t startStreamTasks(SStreamMeta* pMeta) { - int32_t code = TSDB_CODE_SUCCESS; - int32_t vgId = pMeta->vgId; + int32_t code = TSDB_CODE_SUCCESS; + int32_t vgId = pMeta->vgId; int32_t numOfTasks = taosArrayGetSize(pMeta->pTaskList); tqDebug("vgId:%d start to check all %d stream task(s) downstream status", vgId, numOfTasks); @@ -679,7 +691,7 @@ int32_t startStreamTasks(SStreamMeta* pMeta) { } EStreamTaskEvent event = (HAS_RELATED_FILLHISTORY_TASK(pTask)) ? TASK_EVENT_INIT_STREAM_SCANHIST : TASK_EVENT_INIT; - int32_t ret = streamTaskHandleEvent(pTask->status.pSM, event); + int32_t ret = streamTaskHandleEvent(pTask->status.pSM, event); if (ret != TSDB_CODE_SUCCESS) { code = ret; } @@ -692,8 +704,8 @@ int32_t startStreamTasks(SStreamMeta* pMeta) { } int32_t resetStreamTaskStatus(SStreamMeta* pMeta) { - int32_t vgId = pMeta->vgId; - int32_t numOfTasks = taosArrayGetSize(pMeta->pTaskList); + int32_t vgId = pMeta->vgId; + int32_t numOfTasks = taosArrayGetSize(pMeta->pTaskList); tqDebug("vgId:%d reset all %d stream task(s) status to be uninit", vgId, numOfTasks); if (numOfTasks == 0) { @@ -703,7 +715,7 @@ int32_t resetStreamTaskStatus(SStreamMeta* pMeta) { for (int32_t i = 0; i < numOfTasks; ++i) { SStreamTaskId* pTaskId = taosArrayGet(pMeta->pTaskList, i); - STaskId id = {.streamId = pTaskId->streamId, .taskId = pTaskId->taskId}; + STaskId id = {.streamId = pTaskId->streamId, .taskId = pTaskId->taskId}; SStreamTask** pTask = taosHashGet(pMeta->pTasksMap, &id, sizeof(id)); streamTaskResetStatus(*pTask); } @@ -716,7 +728,7 @@ static int32_t restartStreamTasks(SStreamMeta* pMeta, bool isLeader) { int32_t code = 0; int64_t st = taosGetTimestampMs(); - while(1) { + while (1) { int32_t startVal = atomic_val_compare_exchange_32(&pMeta->startInfo.taskStarting, 0, 1); if (startVal == 0) { break; @@ -739,7 +751,7 @@ static int32_t restartStreamTasks(SStreamMeta* pMeta, bool isLeader) { streamMetaClear(pMeta); int64_t el = taosGetTimestampMs() - st; - tqInfo("vgId:%d close&reload state elapsed time:%.3fs", vgId, el/1000.); + tqInfo("vgId:%d close&reload state elapsed time:%.3fs", vgId, el / 1000.); code = streamMetaLoadAllTasks(pMeta); if (code != TSDB_CODE_SUCCESS) { @@ -780,11 +792,11 @@ int32_t tqStreamTaskProcessRunReq(SStreamMeta* pMeta, SRpcMsg* pMsg, bool isLead } SStreamTask* pTask = streamMetaAcquireTask(pMeta, pReq->streamId, taskId); - if (pTask != NULL) { // even in halt status, the data in inputQ must be processed + if (pTask != NULL) { // even in halt status, the data in inputQ must be processed char* p = NULL; if (streamTaskReadyToRun(pTask, &p)) { tqDebug("vgId:%d s-task:%s start to process block from inputQ, next checked ver:%" PRId64, vgId, pTask->id.idStr, - pTask->chkInfo.nextProcessVer); + pTask->chkInfo.nextProcessVer); streamExecTask(pTask); } else { int8_t status = streamTaskSetSchedStatusInactive(pTask); @@ -800,5 +812,3 @@ int32_t tqStreamTaskProcessRunReq(SStreamMeta* pMeta, SRpcMsg* pMsg, bool isLead return -1; } } - - diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 1799823011..3ca2846d07 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -1031,6 +1031,7 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA taosMemoryFree(values_list_sizes); if (TARRAY_SIZE(remainCols) > 0) { + // tsdbTrace("tsdb/cache: vgId: %d, load %" PRId64 " from raw", TD_VID(pTsdb->pVnode), uid); code = tsdbCacheLoadFromRaw(pTsdb, uid, pLastArray, remainCols, pr, ltype); } @@ -1090,6 +1091,7 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache } } + // tsdbTrace("tsdb/cache: vgId: %d, load %" PRId64 " from rocks", TD_VID(pTsdb->pVnode), uid); code = tsdbCacheLoadFromRocks(pTsdb, uid, pLastArray, remainCols, pr, ltype); taosThreadMutexUnlock(&pTsdb->lruMutex); @@ -1866,7 +1868,7 @@ static int32_t lastIterOpen(SFSLastIter *iter, STFileSet *pFileSet, STsdb *pTsdb .suid = suid, .pTsdb = pTsdb, .timewindow = (STimeWindow){.skey = lastTs, .ekey = TSKEY_MAX}, - .verRange = (SVersionRange){.minVer = 0, .maxVer = UINT64_MAX}, + .verRange = (SVersionRange){.minVer = 0, .maxVer = INT64_MAX}, .strictTimeRange = false, .pSchema = pTSchema, .pCurrentFileset = pFileSet, @@ -2743,6 +2745,13 @@ static int32_t mergeLastCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SC break; } SLastCol *pCol = taosArrayGet(pColArray, iCol); + if (slotIds[iCol] > pTSchema->numOfCols - 1) { + if (!setNoneCol) { + noneCol = iCol; + setNoneCol = true; + } + continue; + } if (pCol->colVal.cid != pTSchema->columns[slotIds[iCol]].colId) { continue; } @@ -2917,6 +2926,9 @@ static int32_t mergeLastRowCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, break; } SLastCol *pCol = taosArrayGet(pColArray, iCol); + if (slotIds[iCol] > pTSchema->numOfCols - 1) { + continue; + } if (pCol->colVal.cid != pTSchema->columns[slotIds[iCol]].colId) { continue; } diff --git a/source/dnode/vnode/src/tsdb/tsdbFS2.c b/source/dnode/vnode/src/tsdb/tsdbFS2.c index 2511fa443b..b2ccc3e859 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS2.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS2.c @@ -747,6 +747,7 @@ _exit: } static int32_t tsdbFSSetBlockCommit(STFileSet *fset, bool block); +extern int32_t tsdbStopAllCompTask(STsdb *tsdb); int32_t tsdbDisableAndCancelAllBgTask(STsdb *pTsdb) { STFileSystem *fs = pTsdb->pFS; @@ -774,6 +775,10 @@ int32_t tsdbDisableAndCancelAllBgTask(STsdb *pTsdb) { int64_t channel; TARRAY2_FOREACH(&channelArr, channel) { vnodeAChannelDestroy(vnodeAsyncHandle[1], channel, true); } TARRAY2_DESTROY(&channelArr, NULL); + +#ifdef TD_ENTERPRISE + tsdbStopAllCompTask(pTsdb); +#endif return 0; } diff --git a/source/dnode/vnode/src/tsdb/tsdbFSet2.h b/source/dnode/vnode/src/tsdb/tsdbFSet2.h index 0951a28f4e..86db3b01c7 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFSet2.h +++ b/source/dnode/vnode/src/tsdb/tsdbFSet2.h @@ -27,7 +27,6 @@ typedef struct SSttLvl SSttLvl; typedef TARRAY2(STFileObj *) TFileObjArray; typedef TARRAY2(SSttLvl *) TSttLvlArray; typedef TARRAY2(STFileOp) TFileOpArray; -typedef struct STFileSystem STFileSystem; typedef enum { TSDB_FOP_NONE = 0, diff --git a/source/dnode/vnode/src/tsdb/tsdbOpen.c b/source/dnode/vnode/src/tsdb/tsdbOpen.c index a1f864814f..ea3d285880 100644 --- a/source/dnode/vnode/src/tsdb/tsdbOpen.c +++ b/source/dnode/vnode/src/tsdb/tsdbOpen.c @@ -16,6 +16,9 @@ #include "tsdb.h" #include "tsdbFS2.h" +extern int32_t tsdbOpenCompMonitor(STsdb *tsdb); +extern int32_t tsdbCloseCompMonitor(STsdb *tsdb); + int32_t tsdbSetKeepCfg(STsdb *pTsdb, STsdbCfg *pCfg) { STsdbKeepCfg *pKeepCfg = &pTsdb->keepCfg; pKeepCfg->precision = pCfg->precision; @@ -81,6 +84,12 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee goto _err; } +#ifdef TD_ENTERPRISE + if (tsdbOpenCompMonitor(pTsdb) < 0) { + goto _err; + } +#endif + tsdbDebug("vgId:%d, tsdb is opened at %s, days:%d, keep:%d,%d,%d, keepTimeoffset:%d", TD_VID(pVnode), pTsdb->path, pTsdb->keepCfg.days, pTsdb->keepCfg.keep0, pTsdb->keepCfg.keep1, pTsdb->keepCfg.keep2, pTsdb->keepCfg.keepTimeOffset); @@ -108,6 +117,9 @@ int tsdbClose(STsdb **pTsdb) { tsdbCloseFS(&(*pTsdb)->pFS); tsdbCloseCache(*pTsdb); +#ifdef TD_ENTERPRISE + tsdbCloseCompMonitor(*pTsdb); +#endif taosThreadMutexDestroy(&(*pTsdb)->mutex); taosMemoryFreeClear(*pTsdb); } diff --git a/source/dnode/vnode/src/tsdb/tsdbRead2.c b/source/dnode/vnode/src/tsdb/tsdbRead2.c index 52ee6d0b14..fd179dba2e 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead2.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead2.c @@ -76,6 +76,8 @@ static void updateComposedBlockInfo(STsdbReader* pReader, double el, ST static bool outOfTimeWindow(int64_t ts, STimeWindow* pWindow) { return (ts > pWindow->ekey) || (ts < pWindow->skey); } +static void resetPreFilesetMemTableListIndex(SReaderStatus* pStatus); + static int32_t setColumnIdSlotList(SBlockLoadSuppInfo* pSupInfo, SColumnInfo* pCols, const int32_t* pSlotIdList, int32_t numOfCols) { pSupInfo->smaValid = true; @@ -2347,53 +2349,50 @@ void updateComposedBlockInfo(STsdbReader* pReader, double el, STableBlockScanInf } static int32_t buildComposedDataBlock(STsdbReader* pReader) { - int32_t code = TSDB_CODE_SUCCESS; - bool asc = ASCENDING_TRAVERSE(pReader->info.order); - int64_t st = taosGetTimestampUs(); - int32_t step = asc ? 1 : -1; - double el = 0; - + int32_t code = TSDB_CODE_SUCCESS; + bool asc = ASCENDING_TRAVERSE(pReader->info.order); + int64_t st = taosGetTimestampUs(); + int32_t step = asc ? 1 : -1; + double el = 0; SSDataBlock* pResBlock = pReader->resBlockInfo.pResBlock; SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(&pReader->status.blockIter); SSttBlockReader* pSttBlockReader = pReader->status.fileIter.pSttBlockReader; - SBrinRecord* pRecord = &pBlockInfo->record; SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo; + SBrinRecord* pRecord = NULL; STableBlockScanInfo* pBlockScanInfo = NULL; - if (pBlockInfo != NULL) { - if (pReader->pIgnoreTables && taosHashGet(*pReader->pIgnoreTables, &pBlockInfo->uid, sizeof(pBlockInfo->uid))) { - setBlockAllDumped(pDumpInfo, pRecord->lastKey, pReader->info.order); - return code; - } + if (pBlockInfo == NULL) { + return 0; + } - pBlockScanInfo = getTableBlockScanInfo(pReader->status.pTableMap, pBlockInfo->uid, pReader->idStr); - if (pBlockScanInfo == NULL) { - goto _end; - } + pRecord = &pBlockInfo->record; - pRecord = &pBlockInfo->record; - TSDBKEY keyInBuf = getCurrentKeyInBuf(pBlockScanInfo, pReader); + if (pReader->pIgnoreTables && taosHashGet(*pReader->pIgnoreTables, &pBlockInfo->uid, sizeof(pBlockInfo->uid))) { + setBlockAllDumped(pDumpInfo, pRecord->lastKey, pReader->info.order); + return code; + } - // it is a clean block, load it directly - int64_t cap = pReader->resBlockInfo.capacity; - if (isCleanFileDataBlock(pReader, pBlockInfo, pBlockScanInfo, keyInBuf) && (pRecord->numRow <= cap)) { - if (asc || (pBlockScanInfo->sttKeyInfo.status == STT_FILE_NO_DATA)) { - code = copyBlockDataToSDataBlock(pReader); - if (code) { - goto _end; - } + pBlockScanInfo = getTableBlockScanInfo(pReader->status.pTableMap, pBlockInfo->uid, pReader->idStr); + if (pBlockScanInfo == NULL) { + goto _end; + } - // record the last key value - pBlockScanInfo->lastProcKey = asc ? pRecord->lastKey : pRecord->firstKey; + pRecord = &pBlockInfo->record; + TSDBKEY keyInBuf = getCurrentKeyInBuf(pBlockScanInfo, pReader); + + // it is a clean block, load it directly + int64_t cap = pReader->resBlockInfo.capacity; + if (isCleanFileDataBlock(pReader, pBlockInfo, pBlockScanInfo, keyInBuf) && (pRecord->numRow <= cap)) { + if (((asc && (pRecord->firstKey < keyInBuf.ts)) || (!asc && (pRecord->lastKey > keyInBuf.ts))) && + (pBlockScanInfo->sttKeyInfo.status == STT_FILE_NO_DATA)) { + code = copyBlockDataToSDataBlock(pReader); + if (code) { goto _end; } - } - } else { // file blocks not exist - ASSERT(0); - pBlockScanInfo = *pReader->status.pTableIter; - if (pReader->pIgnoreTables && - taosHashGet(*pReader->pIgnoreTables, &pBlockScanInfo->uid, sizeof(pBlockScanInfo->uid))) { - return code; + + // record the last key value + pBlockScanInfo->lastProcKey = asc ? pRecord->lastKey : pRecord->firstKey; + goto _end; } } @@ -2565,7 +2564,9 @@ static void prepareDurationForNextFileSet(STsdbReader* pReader) { } if (pReader->status.bProcMemPreFileset) { - resetTableListIndex(&pReader->status); + tsdbDebug("will start pre-fileset %d buffer processing. %s", fid, pReader->idStr); + pReader->status.procMemUidList.tableUidList = pReader->status.uidList.tableUidList; + resetPreFilesetMemTableListIndex(&pReader->status); } if (!pReader->status.bProcMemPreFileset) { @@ -2573,6 +2574,7 @@ static void prepareDurationForNextFileSet(STsdbReader* pReader) { STsdReaderNotifyInfo info = {0}; info.duration.filesetId = fid; pReader->notifyFn(TSD_READER_NOTIFY_DURATION_START, &info, pReader->notifyParam); + tsdbDebug("new duration %d start notification when no buffer preceeding fileset, %s", fid, pReader->idStr); } } @@ -2643,6 +2645,14 @@ static void resetTableListIndex(SReaderStatus* pStatus) { pStatus->pTableIter = tSimpleHashGet(pStatus->pTableMap, &uid, sizeof(uid)); } +static void resetPreFilesetMemTableListIndex(SReaderStatus* pStatus) { + STableUidList* pList = &pStatus->procMemUidList; + + pList->currentIndex = 0; + uint64_t uid = pList->tableUidList[0]; + pStatus->pProcMemTableIter = tSimpleHashGet(pStatus->pTableMap, &uid, sizeof(uid)); +} + static bool moveToNextTable(STableUidList* pOrderedCheckInfo, SReaderStatus* pStatus) { pOrderedCheckInfo->currentIndex += 1; if (pOrderedCheckInfo->currentIndex >= tSimpleHashGetSize(pStatus->pTableMap)) { @@ -2655,6 +2665,19 @@ static bool moveToNextTable(STableUidList* pOrderedCheckInfo, SReaderStatus* pSt return (pStatus->pTableIter != NULL); } +static bool moveToNextTableForPreFileSetMem(SReaderStatus* pStatus) { + STableUidList* pUidList = &pStatus->procMemUidList; + pUidList->currentIndex += 1; + if (pUidList->currentIndex >= tSimpleHashGetSize(pStatus->pTableMap)) { + pStatus->pProcMemTableIter = NULL; + return false; + } + + uint64_t uid = pUidList->tableUidList[pUidList->currentIndex]; + pStatus->pProcMemTableIter = tSimpleHashGet(pStatus->pTableMap, &uid, sizeof(uid)); + return (pStatus->pProcMemTableIter != NULL); +} + static int32_t doLoadSttBlockSequentially(STsdbReader* pReader) { SReaderStatus* pStatus = &pReader->status; SSttBlockReader* pSttBlockReader = pStatus->fileIter.pSttBlockReader; @@ -2889,6 +2912,47 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) { return (pReader->code != TSDB_CODE_SUCCESS) ? pReader->code : code; } +static int32_t buildBlockFromBufferSeqForPreFileset(STsdbReader* pReader, int64_t endKey) { + SReaderStatus* pStatus = &pReader->status; + + tsdbDebug("seq load data blocks from cache that preceeds fileset %d, %s", pReader->status.pCurrentFileset->fid, pReader->idStr); + + while (1) { + if (pReader->code != TSDB_CODE_SUCCESS) { + tsdbWarn("tsdb reader is stopped ASAP, code:%s, %s", strerror(pReader->code), pReader->idStr); + return pReader->code; + } + + STableBlockScanInfo** pBlockScanInfo = pStatus->pProcMemTableIter; + if (pReader->pIgnoreTables && + taosHashGet(*pReader->pIgnoreTables, &(*pBlockScanInfo)->uid, sizeof((*pBlockScanInfo)->uid))) { + bool hasNexTable = moveToNextTableForPreFileSetMem(pStatus); + if (!hasNexTable) { + return TSDB_CODE_SUCCESS; + } + continue; + } + + initMemDataIterator(*pBlockScanInfo, pReader); + initDelSkylineIterator(*pBlockScanInfo, pReader->info.order, &pReader->cost); + + int32_t code = buildDataBlockFromBuf(pReader, *pBlockScanInfo, endKey); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + if (pReader->resBlockInfo.pResBlock->info.rows > 0) { + return TSDB_CODE_SUCCESS; + } + + // current table is exhausted, let's try next table + bool hasNexTable = moveToNextTableForPreFileSetMem(pStatus); + if (!hasNexTable) { + return TSDB_CODE_SUCCESS; + } + } +} + static int32_t buildBlockFromBufferSequentially(STsdbReader* pReader, int64_t endKey) { SReaderStatus* pStatus = &pReader->status; STableUidList* pUidList = &pStatus->uidList; @@ -4120,6 +4184,8 @@ int32_t tsdbReaderSuspend2(STsdbReader* pReader) { SReaderStatus* pStatus = &pReader->status; STableBlockScanInfo* pBlockScanInfo = NULL; + pReader->status.suspendInvoked = true; // record the suspend status + if (pStatus->loadFromFile) { SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(&pReader->status.blockIter); if (pBlockInfo != NULL) { @@ -4244,6 +4310,33 @@ _err: return code; } +static int32_t buildFromPreFilesetBuffer(STsdbReader* pReader) { + int32_t code = TSDB_CODE_SUCCESS; + SReaderStatus* pStatus = &pReader->status; + + SSDataBlock* pBlock = pReader->resBlockInfo.pResBlock; + + int32_t fid = pReader->status.pCurrentFileset->fid; + STimeWindow win = {0}; + tsdbFidKeyRange(fid, pReader->pTsdb->keepCfg.days, pReader->pTsdb->keepCfg.precision, &win.skey, &win.ekey); + + int64_t endKey = (ASCENDING_TRAVERSE(pReader->info.order)) ? win.skey : win.ekey; + code = buildBlockFromBufferSeqForPreFileset(pReader, endKey); + if (code != TSDB_CODE_SUCCESS || pBlock->info.rows > 0) { + return code; + } else { + tsdbDebug("finished pre-fileset %d buffer processing. %s", fid, pReader->idStr); + pStatus->bProcMemPreFileset = false; + if (pReader->notifyFn) { + STsdReaderNotifyInfo info = {0}; + info.duration.filesetId = fid; + pReader->notifyFn(TSD_READER_NOTIFY_DURATION_START, &info, pReader->notifyParam); + tsdbDebug("new duration %d start notification when buffer pre-fileset, %s", fid, pReader->idStr); + } + } + return code; +} + static int32_t doTsdbNextDataBlockFilesetDelimited(STsdbReader* pReader) { SReaderStatus* pStatus = &pReader->status; int32_t code = TSDB_CODE_SUCCESS; @@ -4251,22 +4344,9 @@ static int32_t doTsdbNextDataBlockFilesetDelimited(STsdbReader* pReader) { if (pStatus->loadFromFile) { if (pStatus->bProcMemPreFileset) { - int32_t fid = pReader->status.pCurrentFileset->fid; - STimeWindow win = {0}; - tsdbFidKeyRange(fid, pReader->pTsdb->keepCfg.days, pReader->pTsdb->keepCfg.precision, &win.skey, &win.ekey); - - int64_t endKey = (ASCENDING_TRAVERSE(pReader->info.order)) ? win.skey : win.ekey; - code = buildBlockFromBufferSequentially(pReader, endKey); + code = buildFromPreFilesetBuffer(pReader); if (code != TSDB_CODE_SUCCESS || pBlock->info.rows > 0) { return code; - } else { - pStatus->bProcMemPreFileset = false; - if (pReader->notifyFn) { - STsdReaderNotifyInfo info = {0}; - info.duration.filesetId = fid; - pReader->notifyFn(TSD_READER_NOTIFY_DURATION_START, &info, pReader->notifyParam); - } - resetTableListIndex(pStatus); } } @@ -4275,6 +4355,21 @@ static int32_t doTsdbNextDataBlockFilesetDelimited(STsdbReader* pReader) { return code; } + tsdbTrace("block from file rows: %"PRId64", will process pre-file set buffer: %d. %s", + pBlock->info.rows, pStatus->bProcMemFirstFileset, pReader->idStr); + if (pStatus->bProcMemPreFileset) { + if (pBlock->info.rows > 0) { + if (pReader->notifyFn) { + int32_t fid = pReader->status.pCurrentFileset->fid; + STsdReaderNotifyInfo info = {0}; + info.duration.filesetId = fid; + pReader->notifyFn(TSD_READER_NOTIFY_NEXT_DURATION_BLOCK, &info, pReader->notifyParam); + } + } else { + pStatus->bProcMemPreFileset = false; + } + } + if (pBlock->info.rows <= 0) { resetTableListIndex(&pReader->status); int64_t endKey = (ASCENDING_TRAVERSE(pReader->info.order)) ? INT64_MAX : INT64_MIN; @@ -4720,14 +4815,13 @@ static int32_t getBucketIndex(int32_t startRow, int32_t bucketRange, int32_t num } int32_t tsdbGetFileBlocksDistInfo2(STsdbReader* pReader, STableBlockDistInfo* pTableBlockInfo) { - int32_t code = TSDB_CODE_SUCCESS; + int32_t code = TSDB_CODE_SUCCESS; + const int32_t numOfBuckets = 20.0; + pTableBlockInfo->totalSize = 0; pTableBlockInfo->totalRows = 0; pTableBlockInfo->numOfVgroups = 1; - const int32_t numOfBuckets = 20.0; - const int32_t defaultRows = 4096; - // find the start data block in file tsdbAcquireReader(pReader); if (pReader->flag == READER_STATUS_SUSPEND) { diff --git a/source/dnode/vnode/src/tsdb/tsdbReadUtil.h b/source/dnode/vnode/src/tsdb/tsdbReadUtil.h index 43cd499aca..39e65f22b1 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReadUtil.h +++ b/source/dnode/vnode/src/tsdb/tsdbReadUtil.h @@ -197,6 +197,7 @@ typedef struct SFileBlockDumpInfo { } SFileBlockDumpInfo; typedef struct SReaderStatus { + bool suspendInvoked; bool loadFromFile; // check file stage bool composedDataBlock; // the returned data block is a composed block or not SSHashObj* pTableMap; // SHash @@ -210,12 +211,16 @@ typedef struct SReaderStatus { SArray* pLDataIterArray; SRowMerger merger; SColumnInfoData* pPrimaryTsCol; // primary time stamp output col info data + // the following for preceeds fileset memory processing + // TODO: refactor into seperate struct bool bProcMemPreFileset; int64_t memTableMaxKey; int64_t memTableMinKey; int64_t prevFilesetStartKey; int64_t prevFilesetEndKey; bool bProcMemFirstFileset; + STableUidList procMemUidList; + STableBlockScanInfo** pProcMemTableIter; } SReaderStatus; struct STsdbReader { diff --git a/source/dnode/vnode/src/vnd/vnodeAsync.c b/source/dnode/vnode/src/vnd/vnodeAsync.c index c6bf60fa76..66668b60df 100644 --- a/source/dnode/vnode/src/vnd/vnodeAsync.c +++ b/source/dnode/vnode/src/vnd/vnodeAsync.c @@ -591,7 +591,7 @@ int32_t vnodeACancel(SVAsync *async, int64_t taskId) { task->prev->next = task->next; vnodeAsyncTaskDone(async, task); } else { - ret = 0; // task is running, should return code TSDB_CODE_BUSY ?? + ret = TSDB_CODE_FAILED; } } diff --git a/source/dnode/vnode/src/vnd/vnodeHash.c b/source/dnode/vnode/src/vnd/vnodeHash.c index 33602f6581..093b5056ed 100644 --- a/source/dnode/vnode/src/vnd/vnodeHash.c +++ b/source/dnode/vnode/src/vnd/vnodeHash.c @@ -24,14 +24,6 @@ struct SVHashEntry { void* obj; }; -struct SVHashTable { - uint32_t (*hash)(const void*); - int32_t (*compare)(const void*, const void*); - int32_t numEntries; - uint32_t numBuckets; - SVHashEntry** buckets; -}; - static int32_t vHashRehash(SVHashTable* ht, uint32_t newNumBuckets) { SVHashEntry** newBuckets = (SVHashEntry**)taosMemoryCalloc(newNumBuckets, sizeof(SVHashEntry*)); if (newBuckets == NULL) { diff --git a/source/dnode/vnode/src/vnd/vnodeHash.h b/source/dnode/vnode/src/vnd/vnodeHash.h index 86f6f9ac87..0181ca748d 100644 --- a/source/dnode/vnode/src/vnd/vnodeHash.h +++ b/source/dnode/vnode/src/vnd/vnodeHash.h @@ -24,6 +24,15 @@ extern "C" { typedef struct SVHashTable SVHashTable; +struct SVHashTable { + uint32_t (*hash)(const void*); + int32_t (*compare)(const void*, const void*); + int32_t numEntries; + uint32_t numBuckets; + struct SVHashEntry** buckets; +}; + +#define vHashNumEntries(ht) ((ht)->numEntries) int32_t vHashInit(SVHashTable** ht, uint32_t (*hash)(const void*), int32_t (*compare)(const void*, const void*)); int32_t vHashDestroy(SVHashTable** ht); int32_t vHashPut(SVHashTable* ht, void* obj); diff --git a/source/dnode/vnode/src/vnd/vnodeInitApi.c b/source/dnode/vnode/src/vnd/vnodeInitApi.c index 9ba585caac..c323a81093 100644 --- a/source/dnode/vnode/src/vnd/vnodeInitApi.c +++ b/source/dnode/vnode/src/vnd/vnodeInitApi.c @@ -215,6 +215,7 @@ void initStateStoreAPI(SStateStore* pStore) { pStore->streamStateDestroy = streamStateDestroy; pStore->streamStateDeleteCheckPoint = streamStateDeleteCheckPoint; pStore->streamStateReloadInfo = streamStateReloadInfo; + pStore->streamStateCopyBackend = streamStateCopyBackend; } void initMetaReaderAPI(SStoreMetaReader* pMetaReader) { diff --git a/source/dnode/vnode/src/vnd/vnodeQuery.c b/source/dnode/vnode/src/vnd/vnodeQuery.c index e9dbc5e659..b6a9360afd 100644 --- a/source/dnode/vnode/src/vnd/vnodeQuery.c +++ b/source/dnode/vnode/src/vnd/vnodeQuery.c @@ -423,9 +423,9 @@ void vnodeResetLoad(SVnode *pVnode, SVnodeLoad *pLoad) { "nBatchInsertSuccess"); } -void vnodeGetInfo(void *pVnode, const char **dbname, int32_t *vgId, int64_t* numOfTables, int64_t* numOfNormalTables) { - SVnode* pVnodeObj = pVnode; - SVnodeCfg* pConf = &pVnodeObj->config; +void vnodeGetInfo(void *pVnode, const char **dbname, int32_t *vgId, int64_t *numOfTables, int64_t *numOfNormalTables) { + SVnode *pVnodeObj = pVnode; + SVnodeCfg *pConf = &pVnodeObj->config; if (dbname) { *dbname = pConf->dbname; @@ -444,7 +444,7 @@ void vnodeGetInfo(void *pVnode, const char **dbname, int32_t *vgId, int64_t* num } } -int32_t vnodeGetTableList(void* pVnode, int8_t type, SArray* pList) { +int32_t vnodeGetTableList(void *pVnode, int8_t type, SArray *pList) { if (type == TSDB_SUPER_TABLE) { return vnodeGetStbIdList(pVnode, 0, pList); } else { @@ -694,12 +694,12 @@ void *vnodeGetIdx(void *pVnode) { return NULL; } - return metaGetIdx(((SVnode*)pVnode)->pMeta); + return metaGetIdx(((SVnode *)pVnode)->pMeta); } void *vnodeGetIvtIdx(void *pVnode) { if (pVnode == NULL) { return NULL; } - return metaGetIvtIdx(((SVnode*)pVnode)->pMeta); + return metaGetIvtIdx(((SVnode *)pVnode)->pMeta); } diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index f77dbc5eee..afb8f962b3 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -14,24 +14,22 @@ */ #include "audit.h" +#include "cos.h" #include "tencode.h" #include "tmsg.h" #include "tstrbuild.h" #include "vnd.h" -#include "cos.h" #include "vnode.h" #include "vnodeInt.h" -#include "audit.h" -#include "tstrbuild.h" static int32_t vnodeProcessCreateStbReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp); static int32_t vnodeProcessAlterStbReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp); static int32_t vnodeProcessDropStbReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp); -static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp, - SRpcMsg *pOriginRpc); +static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp, + SRpcMsg *pOriginRpc); static int32_t vnodeProcessAlterTbReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp); -static int32_t vnodeProcessDropTbReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp, - SRpcMsg *pOriginRpc); +static int32_t vnodeProcessDropTbReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp, + SRpcMsg *pOriginRpc); static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp); static int32_t vnodeProcessCreateTSmaReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp); static int32_t vnodeProcessAlterConfirmReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp); @@ -45,6 +43,9 @@ static int32_t vnodeProcessDropIndexReq(SVnode *pVnode, int64_t ver, void *pReq, static int32_t vnodeProcessCompactVnodeReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp); static int32_t vnodeProcessConfigChangeReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp); +extern int32_t vnodeProcessKillCompactReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp); +extern int32_t vnodeQueryCompactProgress(SVnode *pVnode, SRpcMsg *pMsg); + static int32_t vnodePreprocessCreateTableReq(SVnode *pVnode, SDecoder *pCoder, int64_t btime, int64_t *pUid) { int32_t code = 0; int32_t lino = 0; @@ -629,6 +630,11 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t ver, SRpcMsg case TDMT_SYNC_CONFIG_CHANGE: vnodeProcessConfigChangeReq(pVnode, ver, pReq, len, pRsp); break; +#ifdef TD_ENTERPRISE + case TDMT_VND_KILL_COMPACT: + vnodeProcessKillCompactReq(pVnode, ver, pReq, len, pRsp); + break; +#endif default: vError("vgId:%d, unprocessed msg, %d", TD_VID(pVnode), pMsg->msgType); return -1; @@ -738,6 +744,10 @@ int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) { return vnodeGetTableCfg(pVnode, pMsg, true); case TDMT_VND_BATCH_META: return vnodeGetBatchMeta(pVnode, pMsg); +#ifdef TD_ENTERPRISE + case TDMT_VND_QUERY_COMPACT_PROGRESS: + return vnodeQueryCompactProgress(pVnode, pMsg); +#endif // case TDMT_VND_TMQ_CONSUME: // return tqProcessPollReq(pVnode->pTq, pMsg); case TDMT_VND_TMQ_VG_WALINFO: @@ -886,8 +896,8 @@ _err: return -1; } -static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp, - SRpcMsg *pOriginRpc) { +static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp, + SRpcMsg *pOriginRpc) { SDecoder decoder = {0}; SEncoder encoder = {0}; int32_t rcode = 0; @@ -937,8 +947,8 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t ver, void *pReq, goto _exit; } - if(tsEnableAudit && tsEnableAuditCreateTable){ - char* str = taosMemoryCalloc(1, TSDB_TABLE_FNAME_LEN); + if (tsEnableAudit && tsEnableAuditCreateTable) { + char *str = taosMemoryCalloc(1, TSDB_TABLE_FNAME_LEN); if (str == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; rcode = -1; @@ -992,26 +1002,26 @@ static int32_t vnodeProcessCreateTbReq(SVnode *pVnode, int64_t ver, void *pReq, tEncoderInit(&encoder, pRsp->pCont, pRsp->contLen); tEncodeSVCreateTbBatchRsp(&encoder, &rsp); - if(tsEnableAudit && tsEnableAuditCreateTable){ + if (tsEnableAudit && tsEnableAuditCreateTable) { int64_t clusterId = pVnode->config.syncCfg.nodeInfo[0].clusterId; SName name = {0}; tNameFromString(&name, pVnode->config.dbname, T_NAME_ACCT | T_NAME_DB); SStringBuilder sb = {0}; - for(int32_t i = 0; i < tbNames->size; i++){ - char** key = (char**)taosArrayGet(tbNames, i); + for (int32_t i = 0; i < tbNames->size; i++) { + char **key = (char **)taosArrayGet(tbNames, i); taosStringBuilderAppendStringLen(&sb, *key, strlen(*key)); - if(i < tbNames->size - 1){ + if (i < tbNames->size - 1) { taosStringBuilderAppendChar(&sb, ','); } taosMemoryFreeClear(*key); } - size_t len = 0; - char* keyJoined = taosStringBuilderGetResult(&sb, &len); + size_t len = 0; + char *keyJoined = taosStringBuilderGetResult(&sb, &len); - if(pOriginRpc->info.conn.user != NULL && strlen(pOriginRpc->info.conn.user) > 0){ + if (pOriginRpc->info.conn.user != NULL && strlen(pOriginRpc->info.conn.user) > 0) { auditAddRecord(pOriginRpc, clusterId, "createTable", name.dbname, "", keyJoined, len); } @@ -1023,7 +1033,7 @@ _exit: pCreateReq = req.pReqs + iReq; taosMemoryFree(pCreateReq->sql); taosMemoryFree(pCreateReq->comment); - taosArrayDestroy(pCreateReq->ctb.tagName); + taosArrayDestroy(pCreateReq->ctb.tagName); } taosArrayDestroyEx(rsp.pArray, tFreeSVCreateTbRsp); taosArrayDestroy(tbUids); @@ -1156,7 +1166,7 @@ _exit: } static int32_t vnodeProcessDropTbReq(SVnode *pVnode, int64_t ver, void *pReq, int32_t len, SRpcMsg *pRsp, - SRpcMsg *pOriginRpc) { + SRpcMsg *pOriginRpc) { SVDropTbBatchReq req = {0}; SVDropTbBatchRsp rsp = {0}; SDecoder decoder = {0}; @@ -1235,13 +1245,13 @@ static int32_t vnodeProcessDropTbReq(SVnode *pVnode, int64_t ver, void *pReq, in size_t len = 0; char *keyJoined = taosStringBuilderGetResult(&sb, &len); - if(pOriginRpc->info.conn.user != NULL && strlen(pOriginRpc->info.conn.user) > 0){ + if (pOriginRpc->info.conn.user != NULL && strlen(pOriginRpc->info.conn.user) > 0) { auditAddRecord(pOriginRpc, clusterId, "dropTable", name.dbname, "", keyJoined, len); } taosStringBuilderDestroy(&sb); } - + _exit: taosArrayDestroy(tbUids); tdUidStoreFree(pStore); diff --git a/source/libs/audit/src/auditMain.c b/source/libs/audit/src/auditMain.c index 7616617ff0..19dc771c56 100644 --- a/source/libs/audit/src/auditMain.c +++ b/source/libs/audit/src/auditMain.c @@ -24,6 +24,7 @@ #include "tglobal.h" #include "mnode.h" #include "audit.h" +#include "osMemory.h" SAudit tsAudit = {0}; char* tsAuditUri = "/audit"; @@ -36,9 +37,18 @@ int32_t auditInit(const SAuditCfg *pCfg) { return 0; } +static FORCE_INLINE void auditDeleteRecord(SAuditRecord * record) { + if (record) { + taosMemoryFree(record->detail); + taosMemoryFree(record); + } +} + void auditCleanup() { tsLogFp = NULL; - taosArrayDestroy(tsAudit.records); + taosThreadMutexLock(&tsAudit.lock); + taosArrayDestroyP(tsAudit.records, (FDelete)auditDeleteRecord); + taosThreadMutexUnlock(&tsAudit.lock); tsAudit.records = NULL; taosThreadMutexDestroy(&tsAudit.lock); } diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h index f7e55b71be..e3e504cdbc 100644 --- a/source/libs/executor/inc/executorInt.h +++ b/source/libs/executor/inc/executorInt.h @@ -298,9 +298,14 @@ typedef struct STableMergeScanInfo { SHashObj* mSkipTables; int64_t mergeLimit; SSortExecInfo sortExecInfo; - bool bNewFileset; - bool bOnlyRetrieveBlock; + bool filesetDelimited; + bool bNewFilesetEvent; + bool bNextDurationBlockEvent; + int32_t numNextDurationBlocks; + SSDataBlock* nextDurationBlocks[2]; + bool rtnNextDurationBlocks; + int32_t nextDurationBlocksIdx; } STableMergeScanInfo; typedef struct STagScanFilterContext { diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index ea73f60468..ef2a99d1d1 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -3240,6 +3240,52 @@ static int32_t tableMergeScanDoSkipTable(STableMergeScanInfo* pInfo, SSDataBlock return TSDB_CODE_SUCCESS; } +static void doGetBlockForTableMergeScan(SOperatorInfo* pOperator, bool* pFinished, bool* pSkipped) { + STableMergeScanInfo* pInfo = pOperator->info; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + SStorageAPI* pAPI = &pTaskInfo->storageAPI; + + SSDataBlock* pBlock = pInfo->pReaderBlock; + int32_t code = 0; + bool hasNext = false; + STsdbReader* reader = pInfo->base.dataReader; + + code = pAPI->tsdReader.tsdNextDataBlock(reader, &hasNext); + if (code != 0) { + pAPI->tsdReader.tsdReaderReleaseDataBlock(reader); + qError("table merge scan fetch next data block error code: %d, %s", code, GET_TASKID(pTaskInfo)); + T_LONG_JMP(pTaskInfo->env, code); + } + + if (!hasNext || isTaskKilled(pTaskInfo)) { + if (isTaskKilled(pTaskInfo)) { + qInfo("table merge scan fetch next data block found task killed. %s", GET_TASKID(pTaskInfo)); + pAPI->tsdReader.tsdReaderReleaseDataBlock(reader); + } + *pFinished = true; + return; + } + + uint32_t status = 0; + code = loadDataBlock(pOperator, &pInfo->base, pBlock, &status); + if (code != TSDB_CODE_SUCCESS) { + qInfo("table merge scan load datablock code %d, %s", code, GET_TASKID(pTaskInfo)); + T_LONG_JMP(pTaskInfo->env, code); + } + + if (status == FUNC_DATA_REQUIRED_ALL_FILTEROUT) { + *pFinished = true; + return; + } + + // current block is filter out according to filter condition, continue load the next block + if (status == FUNC_DATA_REQUIRED_FILTEROUT || pBlock->info.rows == 0) { + *pSkipped = true; + return; + } + return; +} + static SSDataBlock* getBlockForTableMergeScan(void* param) { STableMergeScanSortSourceParam* source = param; SOperatorInfo* pOperator = source->pOperator; @@ -3247,7 +3293,7 @@ static SSDataBlock* getBlockForTableMergeScan(void* param) { SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; SStorageAPI* pAPI = &pTaskInfo->storageAPI; - SSDataBlock* pBlock = pInfo->pReaderBlock; + SSDataBlock* pBlock = NULL; int32_t code = 0; int64_t st = taosGetTimestampUs(); @@ -3255,53 +3301,56 @@ static SSDataBlock* getBlockForTableMergeScan(void* param) { STsdbReader* reader = pInfo->base.dataReader; while (true) { - if (!pInfo->bOnlyRetrieveBlock) { - code = pAPI->tsdReader.tsdNextDataBlock(reader, &hasNext); - if (code != 0) { - pAPI->tsdReader.tsdReaderReleaseDataBlock(reader); - qError("table merge scan fetch next data block error code: %d, %s", code, GET_TASKID(pTaskInfo)); - T_LONG_JMP(pTaskInfo->env, code); - } - - if (!hasNext || isTaskKilled(pTaskInfo)) { - pInfo->bNewFileset = false; - if (isTaskKilled(pTaskInfo)) { - qInfo("table merge scan fetch next data block found task killed. %s", GET_TASKID(pTaskInfo)); - pAPI->tsdReader.tsdReaderReleaseDataBlock(reader); + if (pInfo->rtnNextDurationBlocks) { + qDebug("%s table merge scan return already fetched new duration blocks. index %d num of blocks %d", + GET_TASKID(pTaskInfo), pInfo->nextDurationBlocksIdx, pInfo->numNextDurationBlocks); + if (pInfo->nextDurationBlocksIdx < pInfo->numNextDurationBlocks) { + pBlock = pInfo->nextDurationBlocks[pInfo->nextDurationBlocksIdx]; + ++pInfo->nextDurationBlocksIdx; + } else { + for (int32_t i = 0; i < pInfo->numNextDurationBlocks; ++i) { + blockDataDestroy(pInfo->nextDurationBlocks[i]); + pInfo->nextDurationBlocks[i] = NULL; } + pInfo->rtnNextDurationBlocks = false; + pInfo->nextDurationBlocksIdx = 0; + pInfo->numNextDurationBlocks = 0; + continue; + } + } else { + + bool bFinished = false; + bool bSkipped = false; + doGetBlockForTableMergeScan(pOperator, &bFinished, &bSkipped); + pBlock = pInfo->pReaderBlock; + qDebug("%s table merge scan fetch block. finished %d skipped %d next-duration-block %d new-fileset %d", + GET_TASKID(pTaskInfo), bFinished, bSkipped, pInfo->bNextDurationBlockEvent, pInfo->bNewFilesetEvent); + if (bFinished) { + pInfo->bNewFilesetEvent = false; break; } - if (pInfo->bNewFileset) { - pInfo->bOnlyRetrieveBlock = true; - return NULL; + if (pInfo->bNextDurationBlockEvent || pInfo->bNewFilesetEvent) { + if (!bSkipped) { + pInfo->nextDurationBlocks[pInfo->numNextDurationBlocks] = createOneDataBlock(pBlock, true); + ++pInfo->numNextDurationBlocks; + if (pInfo->numNextDurationBlocks > 2) { + qError("%s table merge scan prefetch %d next duration blocks. end early.", GET_TASKID(pTaskInfo), pInfo->numNextDurationBlocks); + pInfo->bNewFilesetEvent = false; + break; + } + } + if (pInfo->bNewFilesetEvent) { + pInfo->rtnNextDurationBlocks = true; + return NULL; + } + if (pInfo->bNextDurationBlockEvent) { + pInfo->bNextDurationBlockEvent = false; + continue; + } } + if (bSkipped) continue; } - // process this data block based on the probabilities - bool processThisBlock = processBlockWithProbability(&pInfo->sample); - if (!processThisBlock) { - continue; - } - - uint32_t status = 0; - code = loadDataBlock(pOperator, &pInfo->base, pBlock, &status); - if (pInfo->bOnlyRetrieveBlock) { - pInfo->bOnlyRetrieveBlock = false; - } - if (code != TSDB_CODE_SUCCESS) { - qInfo("table merge scan load datablock code %d, %s", code, GET_TASKID(pTaskInfo)); - T_LONG_JMP(pTaskInfo->env, code); - } - - if (status == FUNC_DATA_REQUIRED_ALL_FILTEROUT) { - break; - } - - // current block is filter out according to filter condition, continue load the next block - if (status == FUNC_DATA_REQUIRED_FILTEROUT || pBlock->info.rows == 0) { - continue; - } - pBlock->info.id.groupId = tableListGetTableGroupId(pInfo->base.pTableListInfo, pBlock->info.id.uid); if (pInfo->mergeLimit != -1) { @@ -3310,13 +3359,13 @@ static SSDataBlock* getBlockForTableMergeScan(void* param) { pOperator->resultInfo.totalRows += pBlock->info.rows; pInfo->base.readRecorder.elapsedTime += (taosGetTimestampUs() - st) / 1000.0; - return pBlock; } return NULL; } + SArray* generateSortByTsInfo(SArray* colMatchInfo, int32_t order) { int32_t tsTargetSlotId = 0; for (int32_t i = 0; i < taosArrayGetSize(colMatchInfo); ++i) { @@ -3348,7 +3397,13 @@ int32_t dumpQueryTableCond(const SQueryTableDataCond* src, SQueryTableDataCond* void tableMergeScanTsdbNotifyCb(ETsdReaderNotifyType type, STsdReaderNotifyInfo* info, void* param) { STableMergeScanInfo* pTmsInfo = param; - pTmsInfo->bNewFileset = true; + if (type == TSD_READER_NOTIFY_DURATION_START) { + pTmsInfo->bNewFilesetEvent = true; + } else if (type == TSD_READER_NOTIFY_NEXT_DURATION_BLOCK) { + pTmsInfo->bNextDurationBlockEvent = true; + } + qDebug("table merge scan receive notification. type %d, fileset %d", type, info->duration.filesetId); + return; } @@ -3358,7 +3413,9 @@ int32_t startDurationForGroupTableMergeScan(SOperatorInfo* pOperator) { int32_t code = TSDB_CODE_SUCCESS; int32_t numOfTable = pInfo->tableEndIndex - pInfo->tableStartIndex + 1; - pInfo->bNewFileset = false; + qDebug("%s table merge scan start duration ", GET_TASKID(pTaskInfo)); + pInfo->bNewFilesetEvent = false; + pInfo->bNextDurationBlockEvent = false; pInfo->sortBufSize = 2048 * pInfo->bufPageSize; int32_t numOfBufPage = pInfo->sortBufSize / pInfo->bufPageSize; @@ -3388,6 +3445,8 @@ int32_t startDurationForGroupTableMergeScan(SOperatorInfo* pOperator) { void stopDurationForGroupTableMergeScan(SOperatorInfo* pOperator) { STableMergeScanInfo* pInfo = pOperator->info; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + qDebug("%s table merge scan stop duration ", GET_TASKID(pTaskInfo)); SSortExecInfo sortExecInfo = tsortGetSortExecInfo(pInfo->pSortHandle); pInfo->sortExecInfo.sortMethod = sortExecInfo.sortMethod; @@ -3405,6 +3464,7 @@ int32_t startGroupTableMergeScan(SOperatorInfo* pOperator) { SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; SReadHandle* pHandle = &pInfo->base.readHandle; SStorageAPI* pAPI = &pTaskInfo->storageAPI; + qDebug("%s table merge scan start group %"PRIu64, GET_TASKID(pTaskInfo), pInfo->groupId); { size_t numOfTables = tableListGetSize(pInfo->base.pTableListInfo); @@ -3452,10 +3512,19 @@ int32_t stopGroupTableMergeScan(SOperatorInfo* pOperator) { pAPI->tsdReader.tsdReaderClose(pInfo->base.dataReader); pInfo->base.dataReader = NULL; } - + for (int32_t i = 0; i < pInfo->numNextDurationBlocks; ++i) { + if (pInfo->nextDurationBlocks[i]) { + blockDataDestroy(pInfo->nextDurationBlocks[i]); + pInfo->nextDurationBlocks[i] = NULL; + } + pInfo->numNextDurationBlocks = 0; + pInfo->nextDurationBlocksIdx = 0; + } resetLimitInfoForNextGroup(&pInfo->limitInfo); taosHashCleanup(pInfo->mSkipTables); pInfo->mSkipTables = NULL; + qDebug("%s table merge scan stop group %"PRIu64, GET_TASKID(pTaskInfo), pInfo->groupId); + return TSDB_CODE_SUCCESS; } @@ -3535,7 +3604,7 @@ SSDataBlock* doTableMergeScan(SOperatorInfo* pOperator) { pOperator->resultInfo.totalRows += pBlock->info.rows; return pBlock; } else { - if (pInfo->bNewFileset) { + if (pInfo->bNewFilesetEvent) { stopDurationForGroupTableMergeScan(pOperator); startDurationForGroupTableMergeScan(pOperator); } else { @@ -3566,6 +3635,13 @@ void destroyTableMergeScanOperatorInfo(void* param) { pTableScanInfo->base.readerAPI.tsdReaderClose(pTableScanInfo->base.dataReader); pTableScanInfo->base.dataReader = NULL; + for (int32_t i = 0; i < pTableScanInfo->numNextDurationBlocks; ++i) { + if (pTableScanInfo->nextDurationBlocks[i] != NULL) { + blockDataDestroy(pTableScanInfo->nextDurationBlocks[i]); + pTableScanInfo->nextDurationBlocks[i] = NULL; + } + } + taosArrayDestroy(pTableScanInfo->sortSourceParams); tsortDestroySortHandle(pTableScanInfo->pSortHandle); pTableScanInfo->pSortHandle = NULL; @@ -3675,8 +3751,11 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN int32_t rowSize = pInfo->pResBlock->info.rowSize; uint32_t nCols = taosArrayGetSize(pInfo->pResBlock->pDataBlock); pInfo->bufPageSize = getProperSortPageSize(rowSize, nCols); - - pInfo->filesetDelimited = pTableScanNode->filesetDelimited; + if (!tsExperimental) { + pInfo->filesetDelimited = false; + } else { + pInfo->filesetDelimited = pTableScanNode->filesetDelimited; + } setOperatorInfo(pOperator, "TableMergeScanOperator", QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN, false, OP_NOT_OPENED, pInfo, pTaskInfo); pOperator->exprSupp.numOfExprs = numOfCols; diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c index ef3a4d6f90..7b68b65c17 100644 --- a/source/libs/executor/src/streamtimewindowoperator.c +++ b/source/libs/executor/src/streamtimewindowoperator.c @@ -408,6 +408,11 @@ void destroyStreamFinalIntervalOperatorInfo(void* param) { taosArrayDestroy(pInfo->pDelWins); blockDataDestroy(pInfo->pDelRes); pInfo->stateStore.streamFileStateDestroy(pInfo->pState->pFileState); + + if (pInfo->pState->dump == 1) { + taosMemoryFreeClear(pInfo->pState->pTdbState->pOwner); + taosMemoryFreeClear(pInfo->pState->pTdbState); + } taosMemoryFreeClear(pInfo->pState); nodesDestroyNode((SNode*)pInfo->pPhyNode); @@ -431,6 +436,18 @@ static bool allInvertible(SqlFunctionCtx* pFCtx, int32_t numOfCols) { return true; } +void reloadFromDownStream(SOperatorInfo* downstream, SStreamIntervalOperatorInfo* pInfo) { + SStateStore* pAPI = &downstream->pTaskInfo->storageAPI.stateStore; + + if (downstream->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { + reloadFromDownStream(downstream->pDownstream[0], pInfo); + return; + } + + SStreamScanInfo* pScanInfo = downstream->info; + pInfo->pUpdateInfo = pScanInfo->pUpdateInfo; +} + void initIntervalDownStream(SOperatorInfo* downstream, uint16_t type, SStreamIntervalOperatorInfo* pInfo) { SStateStore* pAPI = &downstream->pTaskInfo->storageAPI.stateStore; @@ -1396,8 +1413,8 @@ static void streamIntervalReleaseState(SOperatorInfo* pOperator) { } void streamIntervalReloadState(SOperatorInfo* pOperator) { + SStreamIntervalOperatorInfo* pInfo = pOperator->info; if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL) { - SStreamIntervalOperatorInfo* pInfo = pOperator->info; int32_t size = 0; void* pBuf = NULL; int32_t code = pInfo->stateStore.streamStateGetInfo(pInfo->pState, STREAM_INTERVAL_OP_STATE_NAME, @@ -1413,6 +1430,7 @@ void streamIntervalReloadState(SOperatorInfo* pOperator) { if (downstream->fpSet.reloadStreamStateFn) { downstream->fpSet.reloadStreamStateFn(downstream); } + reloadFromDownStream(downstream, pInfo); } SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, @@ -1462,7 +1480,11 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, initBasicInfo(&pInfo->binfo, pResBlock); pInfo->pState = taosMemoryCalloc(1, sizeof(SStreamState)); - *(pInfo->pState) = *(pTaskInfo->streamInfo.pState); + qInfo("open state %p", pInfo->pState); + pAPI->stateStore.streamStateCopyBackend(pTaskInfo->streamInfo.pState, pInfo->pState); + //*(pInfo->pState) = *(pTaskInfo->streamInfo.pState); + + qInfo("copy state %p to %p", pTaskInfo->streamInfo.pState, pInfo->pState); pAPI->stateStore.streamStateSetNumber(pInfo->pState, -1); int32_t code = initAggSup(&pOperator->exprSupp, &pInfo->aggSup, pExprInfo, numOfCols, keyBufSize, pTaskInfo->id.str, @@ -3338,7 +3360,8 @@ static void doStreamStateAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl SColumnInfoData* pKeyColInfo = taosArrayGet(pSDataBlock->pDataBlock, pInfo->stateCol.slotId); for (int32_t i = 0; i < rows; i += winRows) { if (pInfo->ignoreExpiredData && checkExpiredData(&pInfo->streamAggSup.stateStore, pInfo->streamAggSup.pUpdateInfo, - &pInfo->twAggSup, pSDataBlock->info.id.uid, tsCols[i]) || colDataIsNull_s(pKeyColInfo, i)) { + &pInfo->twAggSup, pSDataBlock->info.id.uid, tsCols[i]) || + colDataIsNull_s(pKeyColInfo, i)) { i++; continue; } diff --git a/source/libs/executor/src/sysscanoperator.c b/source/libs/executor/src/sysscanoperator.c index ac4b8e88c7..76de204cab 100644 --- a/source/libs/executor/src/sysscanoperator.c +++ b/source/libs/executor/src/sysscanoperator.c @@ -1610,7 +1610,10 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) { const char* name = tNameGetTableName(&pInfo->name); if (pInfo->showRewrite) { getDBNameFromCondition(pInfo->pCondition, dbName); - sprintf(pInfo->req.db, "%d.%s", pInfo->accountId, dbName); + if (strncasecmp(name, TSDB_INS_TABLE_COMPACTS, TSDB_TABLE_FNAME_LEN) != 0 && + strncasecmp(name, TSDB_INS_TABLE_COMPACT_DETAILS, TSDB_TABLE_FNAME_LEN) != 0) { + sprintf(pInfo->req.db, "%d.%s", pInfo->accountId, dbName); + } } else if (strncasecmp(name, TSDB_INS_TABLE_COLS, TSDB_TABLE_FNAME_LEN) == 0) { getDBNameFromCondition(pInfo->pCondition, dbName); if (dbName[0]) sprintf(pInfo->req.db, "%d.%s", pInfo->accountId, dbName); diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 93f3b6c109..8a2e118fe7 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -5634,7 +5634,7 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { double factor = pData->numOfBlocks / 80.0; int32_t numOfBuckets = sizeof(pData->blockRowsHisto) / sizeof(pData->blockRowsHisto[0]); - int32_t bucketRange = (pData->defMaxRows - pData->defMinRows) / numOfBuckets; + int32_t bucketRange = ceil(((double) (pData->defMaxRows - pData->defMinRows)) / numOfBuckets); for (int32_t i = 0; i < tListLen(pData->blockRowsHisto); ++i) { len = sprintf(st + VARSTR_HEADER_SIZE, "%04d |", pData->defMinRows + bucketRange * (i + 1)); @@ -5649,7 +5649,7 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { len += x; } - if (num > 0) { + if (pData->blockRowsHisto[i] > 0) { double v = pData->blockRowsHisto[i] * 100.0 / pData->numOfBlocks; len += sprintf(st + VARSTR_HEADER_SIZE + len, " %d (%.2f%c)", pData->blockRowsHisto[i], v, '%'); } diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index d26cdcf401..c445af61cc 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -259,6 +259,10 @@ const char* nodesNodeName(ENodeType type) { return "ShowLocalVariablesStmt"; case QUERY_NODE_SHOW_TABLE_TAGS_STMT: return "ShowTableTagsStmt"; + case QUERY_NODE_SHOW_COMPACTS_STMT: + return "ShowCompactsStmt"; + case QUERY_NODE_SHOW_COMPACT_DETAILS_STMT: + return "ShowCompactDetailsStmt"; case QUERY_NODE_DELETE_STMT: return "DeleteStmt"; case QUERY_NODE_INSERT_STMT: diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index e730ccf21b..8f2e82385b 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -456,10 +456,15 @@ SNode* nodesMakeNode(ENodeType type) { return makeNode(type, sizeof(SShowCreateViewStmt)); case QUERY_NODE_SHOW_TABLE_DISTRIBUTED_STMT: return makeNode(type, sizeof(SShowTableDistributedStmt)); + case QUERY_NODE_SHOW_COMPACTS_STMT: + return makeNode(type, sizeof(SShowCompactsStmt)); + case QUERY_NODE_SHOW_COMPACT_DETAILS_STMT: + return makeNode(type, sizeof(SShowCompactDetailsStmt)); case QUERY_NODE_KILL_QUERY_STMT: return makeNode(type, sizeof(SKillQueryStmt)); case QUERY_NODE_KILL_TRANSACTION_STMT: case QUERY_NODE_KILL_CONNECTION_STMT: + case QUERY_NODE_KILL_COMPACT_STMT: return makeNode(type, sizeof(SKillStmt)); case QUERY_NODE_DELETE_STMT: return makeNode(type, sizeof(SDeleteStmt)); @@ -1085,6 +1090,13 @@ void nodesDestroyNode(SNode* pNode) { nodesDestroyNode(((SShowDnodeVariablesStmt*)pNode)->pDnodeId); nodesDestroyNode(((SShowDnodeVariablesStmt*)pNode)->pLikePattern); break; + case QUERY_NODE_SHOW_COMPACTS_STMT: + break; + case QUERY_NODE_SHOW_COMPACT_DETAILS_STMT: { + SShowCompactDetailsStmt* pStmt = (SShowCompactDetailsStmt*)pNode; + nodesDestroyNode(pStmt->pCompactId); + break; + } case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: taosMemoryFreeClear(((SShowCreateDatabaseStmt*)pNode)->pCfg); break; @@ -1098,6 +1110,7 @@ void nodesDestroyNode(SNode* pNode) { case QUERY_NODE_KILL_CONNECTION_STMT: // no pointer field case QUERY_NODE_KILL_QUERY_STMT: // no pointer field case QUERY_NODE_KILL_TRANSACTION_STMT: // no pointer field + case QUERY_NODE_KILL_COMPACT_STMT: // no pointer field break; case QUERY_NODE_DELETE_STMT: { SDeleteStmt* pStmt = (SDeleteStmt*)pNode; diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index c863c1e0ee..c3f2a53f7b 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -260,7 +260,8 @@ SNode* createDeleteStmt(SAstCreateContext* pCxt, SNode* pTable, SNode* pWhere); SNode* createInsertStmt(SAstCreateContext* pCxt, SNode* pTable, SNodeList* pCols, SNode* pQuery); SNode* createCreateViewStmt(SAstCreateContext* pCxt, bool orReplace, SNode* pView, const SToken* pAs, SNode* pQuery); SNode* createDropViewStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SNode* pView); - +SNode* createShowCompactDetailsStmt(SAstCreateContext* pCxt, SNode* pCompactIdNode); +SNode* createShowCompactsStmt(SAstCreateContext* pCxt, ENodeType type); #ifdef __cplusplus } #endif diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 9bcf65dbbe..0479fce255 100755 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -511,6 +511,8 @@ cmd ::= SHOW db_name_cond_opt(A) ALIVE. cmd ::= SHOW CLUSTER ALIVE. { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } cmd ::= SHOW db_name_cond_opt(A) VIEWS. { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, A, NULL, OP_TYPE_LIKE); } cmd ::= SHOW CREATE VIEW full_table_name(A). { pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, A); } +cmd ::= SHOW COMPACTS. { pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); } +cmd ::= SHOW COMPACT NK_INTEGER(A). { pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &A)); } %type table_kind_db_name_cond_opt { SShowTablesOption } %destructor table_kind_db_name_cond_opt { } @@ -700,6 +702,7 @@ ignore_opt(A) ::= IGNORE UNTREATED. cmd ::= KILL CONNECTION NK_INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &A); } cmd ::= KILL QUERY NK_STRING(A). { pCxt->pRootNode = createKillQueryStmt(pCxt, &A); } cmd ::= KILL TRANSACTION NK_INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &A); } +cmd ::= KILL COMPACT NK_INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_COMPACT_STMT, &A); } /************************************************ merge/redistribute/ vgroup ******************************************/ cmd ::= BALANCE VGROUP. { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 3ae82c3615..eb866c99aa 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1638,6 +1638,13 @@ SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type) { return (SNode*)pStmt; } +SNode* createShowCompactsStmt(SAstCreateContext* pCxt, ENodeType type) { + CHECK_PARSER_STATUS(pCxt); + SShowCompactsStmt* pStmt = (SShowCompactsStmt*)nodesMakeNode(type); + CHECK_OUT_OF_MEM(pStmt); + return (SNode*)pStmt; +} + SNode* setShowKind(SAstCreateContext* pCxt, SNode* pStmt, EShowKind showKind) { if (pStmt == NULL) { return NULL; @@ -1783,6 +1790,13 @@ SNode* createShowTableTagsStmt(SAstCreateContext* pCxt, SNode* pTbName, SNode* p return (SNode*)pStmt; } +SNode* createShowCompactDetailsStmt(SAstCreateContext* pCxt, SNode* pCompactId) { + CHECK_PARSER_STATUS(pCxt); + SShowCompactDetailsStmt* pStmt = (SShowCompactDetailsStmt*)nodesMakeNode(QUERY_NODE_SHOW_COMPACT_DETAILS_STMT); + pStmt->pCompactId = pCompactId; + return (SNode*)pStmt; +} + static int32_t getIpV4RangeFromWhitelistItem(char* ipRange, SIpV4Range* pIpRange) { int32_t code = TSDB_CODE_SUCCESS; char* ipCopy = taosStrdup(ipRange); diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index 91625defd0..be272228fe 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -607,6 +607,17 @@ static int32_t collectMetaKeyFromShowViews(SCollectMetaKeyCxt* pCxt, SShowStmt* return code; } +static int32_t collectMetaKeyFromShowCompacts(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) { + int32_t code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_COMPACTS, + pCxt->pMetaCache); + return code; +} + +static int32_t collectMetaKeyFromShowCompactDetails(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) { + int32_t code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_COMPACT_DETAILS, + pCxt->pMetaCache); + return code; +} static int32_t collectMetaKeyFromShowCreateDatabase(SCollectMetaKeyCxt* pCxt, SShowCreateDatabaseStmt* pStmt) { return reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache); @@ -824,6 +835,10 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) { return collectMetaKeyFromShowUserPrivileges(pCxt, (SShowStmt*)pStmt); case QUERY_NODE_SHOW_VIEWS_STMT: return collectMetaKeyFromShowViews(pCxt, (SShowStmt*)pStmt); + case QUERY_NODE_SHOW_COMPACTS_STMT: + return collectMetaKeyFromShowCompacts(pCxt, (SShowStmt*)pStmt); + case QUERY_NODE_SHOW_COMPACT_DETAILS_STMT: + return collectMetaKeyFromShowCompactDetails(pCxt, (SShowStmt*)pStmt); case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: return collectMetaKeyFromShowCreateDatabase(pCxt, (SShowCreateDatabaseStmt*)pStmt); case QUERY_NODE_SHOW_CREATE_TABLE_STMT: diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 5988c68e17..03a5317cd3 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -64,6 +64,7 @@ static SKeyword keywordTable[] = { {"COMMENT", TK_COMMENT}, {"COMP", TK_COMP}, {"COMPACT", TK_COMPACT}, + {"COMPACTS", TK_COMPACTS}, {"CONNECTION", TK_CONNECTION}, {"CONNECTIONS", TK_CONNECTIONS}, {"CONNS", TK_CONNS}, diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index c5ac8a3dd6..3bb24566c2 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -257,6 +257,18 @@ static const SSysTableShowAdapter sysTableShowAdapter[] = { .numOfShowCols = 1, .pShowCols = {"*"} }, + { .showType = QUERY_NODE_SHOW_COMPACTS_STMT, + .pDbName = TSDB_INFORMATION_SCHEMA_DB, + .pTableName = TSDB_INS_TABLE_COMPACTS, + .numOfShowCols = 1, + .pShowCols = {"*"} + }, + { .showType = QUERY_NODE_SHOW_COMPACT_DETAILS_STMT, + .pDbName = TSDB_INFORMATION_SCHEMA_DB, + .pTableName = TSDB_INS_TABLE_COMPACT_DETAILS, + .numOfShowCols = 1, + .pShowCols = {"*"} + }, }; // clang-format on @@ -7118,6 +7130,12 @@ static int32_t translateKillConnection(STranslateContext* pCxt, SKillStmt* pStmt return buildCmdMsg(pCxt, TDMT_MND_KILL_CONN, (FSerializeFunc)tSerializeSKillConnReq, &killReq); } +static int32_t translateKillCompact(STranslateContext* pCxt, SKillStmt* pStmt) { + SKillCompactReq killReq = {0}; + killReq.compactId = pStmt->targetId; + return buildCmdMsg(pCxt, TDMT_MND_KILL_COMPACT, (FSerializeFunc)tSerializeSKillCompactReq, &killReq); +} + static int32_t translateKillQuery(STranslateContext* pCxt, SKillQueryStmt* pStmt) { SKillQueryReq killReq = {0}; strcpy(killReq.queryStrId, pStmt->queryId); @@ -8511,6 +8529,9 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { case QUERY_NODE_KILL_CONNECTION_STMT: code = translateKillConnection(pCxt, (SKillStmt*)pNode); break; + case QUERY_NODE_KILL_COMPACT_STMT: + code = translateKillCompact(pCxt, (SKillStmt*)pNode); + break; case QUERY_NODE_KILL_QUERY_STMT: code = translateKillQuery(pCxt, (SKillQueryStmt*)pNode); break; @@ -8761,6 +8782,28 @@ static int32_t extractShowVariablesResultSchema(int32_t* numOfCols, SSchema** pS return TSDB_CODE_SUCCESS; } +static int32_t extractCompactDbResultSchema(int32_t* numOfCols, SSchema** pSchema) { + *numOfCols = COMPACT_DB_RESULT_COLS; + *pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema)); + if (NULL == (*pSchema)) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + (*pSchema)[0].type = TSDB_DATA_TYPE_BINARY; + (*pSchema)[0].bytes = COMPACT_DB_RESULT_FIELD1_LEN; + strcpy((*pSchema)[0].name, "name"); + + (*pSchema)[1].type = TSDB_DATA_TYPE_INT; + (*pSchema)[1].bytes = tDataTypes[TSDB_DATA_TYPE_INT].bytes; + strcpy((*pSchema)[1].name, "id"); + + (*pSchema)[2].type = TSDB_DATA_TYPE_BINARY; + (*pSchema)[2].bytes = COMPACT_DB_RESULT_FIELD3_LEN; + strcpy((*pSchema)[2].name, "reason"); + + return TSDB_CODE_SUCCESS; +} + int32_t extractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pSchema) { if (NULL == pRoot) { return TSDB_CODE_SUCCESS; @@ -8787,6 +8830,8 @@ int32_t extractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pS case QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT: case QUERY_NODE_SHOW_VARIABLES_STMT: return extractShowVariablesResultSchema(numOfCols, pSchema); + case QUERY_NODE_COMPACT_DATABASE_STMT: + return extractCompactDbResultSchema(numOfCols, pSchema); default: break; } @@ -10268,6 +10313,37 @@ static int32_t rewriteFlushDatabase(STranslateContext* pCxt, SQuery* pQuery) { return code; } +static int32_t rewriteShowCompacts(STranslateContext* pCxt, SQuery* pQuery) { + SShowCompactsStmt* pShow = (SShowCompactsStmt*)(pQuery->pRoot); + SSelectStmt* pStmt = NULL; + int32_t code = createSelectStmtForShow(QUERY_NODE_SHOW_COMPACTS_STMT, &pStmt); + if (TSDB_CODE_SUCCESS == code) { + pCxt->showRewrite = true; + pQuery->showRewrite = true; + nodesDestroyNode(pQuery->pRoot); + pQuery->pRoot = (SNode*)pStmt; + } + return code; +} + +static int32_t rewriteShowCompactDetailsStmt(STranslateContext* pCxt, SQuery* pQuery) { + SShowCompactDetailsStmt* pShow = (SShowCompactDetailsStmt*)(pQuery->pRoot); + SSelectStmt* pStmt = NULL; + int32_t code = createSelectStmtForShow(QUERY_NODE_SHOW_COMPACT_DETAILS_STMT, &pStmt); + if (TSDB_CODE_SUCCESS == code) { + if (NULL != pShow->pCompactId) { + code = createOperatorNode(OP_TYPE_EQUAL, "compact_id", pShow->pCompactId, &pStmt->pWhere); + } + } + if (TSDB_CODE_SUCCESS == code) { + pCxt->showRewrite = true; + pQuery->showRewrite = true; + nodesDestroyNode(pQuery->pRoot); + pQuery->pRoot = (SNode*)pStmt; + } + return code; +} + static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) { int32_t code = TSDB_CODE_SUCCESS; switch (nodeType(pQuery->pRoot)) { @@ -10330,6 +10406,12 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) { case QUERY_NODE_FLUSH_DATABASE_STMT: code = rewriteFlushDatabase(pCxt, pQuery); break; + case QUERY_NODE_SHOW_COMPACTS_STMT: + code = rewriteShowCompacts(pCxt, pQuery); + break; + case QUERY_NODE_SHOW_COMPACT_DETAILS_STMT: + code = rewriteShowCompactDetailsStmt(pCxt, pQuery); + break; default: break; } @@ -10435,6 +10517,7 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) { pQuery->execMode = QUERY_EXEC_MODE_LOCAL; break; case QUERY_NODE_SHOW_VARIABLES_STMT: + case QUERY_NODE_COMPACT_DATABASE_STMT: pQuery->haveResultSet = true; pQuery->execMode = QUERY_EXEC_MODE_RPC; if (NULL != pCxt->pCmdMsg) { diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index f012b90941..66258ba3a9 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -1,3 +1,5 @@ +/* This file is automatically generated by Lemon from input grammar +** source file "sql.y". */ /* ** 2000-05-29 ** @@ -22,9 +24,8 @@ ** The following is the concatenation of all %include directives from the ** input grammar file: */ -#include -#include /************ Begin %include sections from the grammar ************************/ +#line 11 "sql.y" #include #include @@ -41,12 +42,359 @@ #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 -** "lemon" is run with the "-m" command-line option. -***************** Begin makeheaders token definitions *************************/ -/**************** End makeheaders token definitions ***************************/ +/* These constants specify the various numeric values for terminal symbols. +***************** Begin token definitions *************************************/ +#ifndef TK_OR +#define TK_OR 1 +#define TK_AND 2 +#define TK_UNION 3 +#define TK_ALL 4 +#define TK_MINUS 5 +#define TK_EXCEPT 6 +#define TK_INTERSECT 7 +#define TK_NK_BITAND 8 +#define TK_NK_BITOR 9 +#define TK_NK_LSHIFT 10 +#define TK_NK_RSHIFT 11 +#define TK_NK_PLUS 12 +#define TK_NK_MINUS 13 +#define TK_NK_STAR 14 +#define TK_NK_SLASH 15 +#define TK_NK_REM 16 +#define TK_NK_CONCAT 17 +#define TK_CREATE 18 +#define TK_ACCOUNT 19 +#define TK_NK_ID 20 +#define TK_PASS 21 +#define TK_NK_STRING 22 +#define TK_ALTER 23 +#define TK_PPS 24 +#define TK_TSERIES 25 +#define TK_STORAGE 26 +#define TK_STREAMS 27 +#define TK_QTIME 28 +#define TK_DBS 29 +#define TK_USERS 30 +#define TK_CONNS 31 +#define TK_STATE 32 +#define TK_NK_COMMA 33 +#define TK_HOST 34 +#define TK_USER 35 +#define TK_ENABLE 36 +#define TK_NK_INTEGER 37 +#define TK_SYSINFO 38 +#define TK_ADD 39 +#define TK_DROP 40 +#define TK_GRANT 41 +#define TK_ON 42 +#define TK_TO 43 +#define TK_REVOKE 44 +#define TK_FROM 45 +#define TK_SUBSCRIBE 46 +#define TK_READ 47 +#define TK_WRITE 48 +#define TK_NK_DOT 49 +#define TK_WITH 50 +#define TK_DNODE 51 +#define TK_PORT 52 +#define TK_DNODES 53 +#define TK_RESTORE 54 +#define TK_NK_IPTOKEN 55 +#define TK_FORCE 56 +#define TK_UNSAFE 57 +#define TK_LOCAL 58 +#define TK_QNODE 59 +#define TK_BNODE 60 +#define TK_SNODE 61 +#define TK_MNODE 62 +#define TK_VNODE 63 +#define TK_DATABASE 64 +#define TK_USE 65 +#define TK_FLUSH 66 +#define TK_TRIM 67 +#define TK_COMPACT 68 +#define TK_IF 69 +#define TK_NOT 70 +#define TK_EXISTS 71 +#define TK_BUFFER 72 +#define TK_CACHEMODEL 73 +#define TK_CACHESIZE 74 +#define TK_COMP 75 +#define TK_DURATION 76 +#define TK_NK_VARIABLE 77 +#define TK_MAXROWS 78 +#define TK_MINROWS 79 +#define TK_KEEP 80 +#define TK_PAGES 81 +#define TK_PAGESIZE 82 +#define TK_TSDB_PAGESIZE 83 +#define TK_PRECISION 84 +#define TK_REPLICA 85 +#define TK_VGROUPS 86 +#define TK_SINGLE_STABLE 87 +#define TK_RETENTIONS 88 +#define TK_SCHEMALESS 89 +#define TK_WAL_LEVEL 90 +#define TK_WAL_FSYNC_PERIOD 91 +#define TK_WAL_RETENTION_PERIOD 92 +#define TK_WAL_RETENTION_SIZE 93 +#define TK_WAL_ROLL_PERIOD 94 +#define TK_WAL_SEGMENT_SIZE 95 +#define TK_STT_TRIGGER 96 +#define TK_TABLE_PREFIX 97 +#define TK_TABLE_SUFFIX 98 +#define TK_KEEP_TIME_OFFSET 99 +#define TK_NK_COLON 100 +#define TK_BWLIMIT 101 +#define TK_START 102 +#define TK_TIMESTAMP 103 +#define TK_END 104 +#define TK_TABLE 105 +#define TK_NK_LP 106 +#define TK_NK_RP 107 +#define TK_STABLE 108 +#define TK_COLUMN 109 +#define TK_MODIFY 110 +#define TK_RENAME 111 +#define TK_TAG 112 +#define TK_SET 113 +#define TK_NK_EQ 114 +#define TK_USING 115 +#define TK_TAGS 116 +#define TK_BOOL 117 +#define TK_TINYINT 118 +#define TK_SMALLINT 119 +#define TK_INT 120 +#define TK_INTEGER 121 +#define TK_BIGINT 122 +#define TK_FLOAT 123 +#define TK_DOUBLE 124 +#define TK_BINARY 125 +#define TK_NCHAR 126 +#define TK_UNSIGNED 127 +#define TK_JSON 128 +#define TK_VARCHAR 129 +#define TK_MEDIUMBLOB 130 +#define TK_BLOB 131 +#define TK_VARBINARY 132 +#define TK_GEOMETRY 133 +#define TK_DECIMAL 134 +#define TK_COMMENT 135 +#define TK_MAX_DELAY 136 +#define TK_WATERMARK 137 +#define TK_ROLLUP 138 +#define TK_TTL 139 +#define TK_SMA 140 +#define TK_DELETE_MARK 141 +#define TK_FIRST 142 +#define TK_LAST 143 +#define TK_SHOW 144 +#define TK_PRIVILEGES 145 +#define TK_DATABASES 146 +#define TK_TABLES 147 +#define TK_STABLES 148 +#define TK_MNODES 149 +#define TK_QNODES 150 +#define TK_FUNCTIONS 151 +#define TK_INDEXES 152 +#define TK_ACCOUNTS 153 +#define TK_APPS 154 +#define TK_CONNECTIONS 155 +#define TK_LICENCES 156 +#define TK_GRANTS 157 +#define TK_QUERIES 158 +#define TK_SCORES 159 +#define TK_TOPICS 160 +#define TK_VARIABLES 161 +#define TK_CLUSTER 162 +#define TK_BNODES 163 +#define TK_SNODES 164 +#define TK_TRANSACTIONS 165 +#define TK_DISTRIBUTED 166 +#define TK_CONSUMERS 167 +#define TK_SUBSCRIPTIONS 168 +#define TK_VNODES 169 +#define TK_ALIVE 170 +#define TK_VIEWS 171 +#define TK_VIEW 172 +#define TK_COMPACTS 173 +#define TK_NORMAL 174 +#define TK_CHILD 175 +#define TK_LIKE 176 +#define TK_TBNAME 177 +#define TK_QTAGS 178 +#define TK_AS 179 +#define TK_SYSTEM 180 +#define TK_INDEX 181 +#define TK_FUNCTION 182 +#define TK_INTERVAL 183 +#define TK_COUNT 184 +#define TK_LAST_ROW 185 +#define TK_META 186 +#define TK_ONLY 187 +#define TK_TOPIC 188 +#define TK_CONSUMER 189 +#define TK_GROUP 190 +#define TK_DESC 191 +#define TK_DESCRIBE 192 +#define TK_RESET 193 +#define TK_QUERY 194 +#define TK_CACHE 195 +#define TK_EXPLAIN 196 +#define TK_ANALYZE 197 +#define TK_VERBOSE 198 +#define TK_NK_BOOL 199 +#define TK_RATIO 200 +#define TK_NK_FLOAT 201 +#define TK_OUTPUTTYPE 202 +#define TK_AGGREGATE 203 +#define TK_BUFSIZE 204 +#define TK_LANGUAGE 205 +#define TK_REPLACE 206 +#define TK_STREAM 207 +#define TK_INTO 208 +#define TK_PAUSE 209 +#define TK_RESUME 210 +#define TK_TRIGGER 211 +#define TK_AT_ONCE 212 +#define TK_WINDOW_CLOSE 213 +#define TK_IGNORE 214 +#define TK_EXPIRED 215 +#define TK_FILL_HISTORY 216 +#define TK_UPDATE 217 +#define TK_SUBTABLE 218 +#define TK_UNTREATED 219 +#define TK_KILL 220 +#define TK_CONNECTION 221 +#define TK_TRANSACTION 222 +#define TK_BALANCE 223 +#define TK_VGROUP 224 +#define TK_LEADER 225 +#define TK_MERGE 226 +#define TK_REDISTRIBUTE 227 +#define TK_SPLIT 228 +#define TK_DELETE 229 +#define TK_INSERT 230 +#define TK_NULL 231 +#define TK_NK_QUESTION 232 +#define TK_NK_ALIAS 233 +#define TK_NK_ARROW 234 +#define TK_ROWTS 235 +#define TK_QSTART 236 +#define TK_QEND 237 +#define TK_QDURATION 238 +#define TK_WSTART 239 +#define TK_WEND 240 +#define TK_WDURATION 241 +#define TK_IROWTS 242 +#define TK_ISFILLED 243 +#define TK_CAST 244 +#define TK_NOW 245 +#define TK_TODAY 246 +#define TK_TIMEZONE 247 +#define TK_CLIENT_VERSION 248 +#define TK_SERVER_VERSION 249 +#define TK_SERVER_STATUS 250 +#define TK_CURRENT_USER 251 +#define TK_CASE 252 +#define TK_WHEN 253 +#define TK_THEN 254 +#define TK_ELSE 255 +#define TK_BETWEEN 256 +#define TK_IS 257 +#define TK_NK_LT 258 +#define TK_NK_GT 259 +#define TK_NK_LE 260 +#define TK_NK_GE 261 +#define TK_NK_NE 262 +#define TK_MATCH 263 +#define TK_NMATCH 264 +#define TK_CONTAINS 265 +#define TK_IN 266 +#define TK_JOIN 267 +#define TK_INNER 268 +#define TK_SELECT 269 +#define TK_NK_HINT 270 +#define TK_DISTINCT 271 +#define TK_WHERE 272 +#define TK_PARTITION 273 +#define TK_BY 274 +#define TK_SESSION 275 +#define TK_STATE_WINDOW 276 +#define TK_EVENT_WINDOW 277 +#define TK_SLIDING 278 +#define TK_FILL 279 +#define TK_VALUE 280 +#define TK_VALUE_F 281 +#define TK_NONE 282 +#define TK_PREV 283 +#define TK_NULL_F 284 +#define TK_LINEAR 285 +#define TK_NEXT 286 +#define TK_HAVING 287 +#define TK_RANGE 288 +#define TK_EVERY 289 +#define TK_ORDER 290 +#define TK_SLIMIT 291 +#define TK_SOFFSET 292 +#define TK_LIMIT 293 +#define TK_OFFSET 294 +#define TK_ASC 295 +#define TK_NULLS 296 +#define TK_ABORT 297 +#define TK_AFTER 298 +#define TK_ATTACH 299 +#define TK_BEFORE 300 +#define TK_BEGIN 301 +#define TK_BITAND 302 +#define TK_BITNOT 303 +#define TK_BITOR 304 +#define TK_BLOCKS 305 +#define TK_CHANGE 306 +#define TK_COMMA 307 +#define TK_CONCAT 308 +#define TK_CONFLICT 309 +#define TK_COPY 310 +#define TK_DEFERRED 311 +#define TK_DELIMITERS 312 +#define TK_DETACH 313 +#define TK_DIVIDE 314 +#define TK_DOT 315 +#define TK_EACH 316 +#define TK_FAIL 317 +#define TK_FILE 318 +#define TK_FOR 319 +#define TK_GLOB 320 +#define TK_ID 321 +#define TK_IMMEDIATE 322 +#define TK_IMPORT 323 +#define TK_INITIALLY 324 +#define TK_INSTEAD 325 +#define TK_ISNULL 326 +#define TK_KEY 327 +#define TK_MODULES 328 +#define TK_NK_BITNOT 329 +#define TK_NK_SEMI 330 +#define TK_NOTNULL 331 +#define TK_OF 332 +#define TK_PLUS 333 +#define TK_PRIVILEGE 334 +#define TK_RAISE 335 +#define TK_RESTRICT 336 +#define TK_ROW 337 +#define TK_SEMI 338 +#define TK_STAR 339 +#define TK_STATEMENT 340 +#define TK_STRICT 341 +#define TK_STRING 342 +#define TK_TIMES 343 +#define TK_VALUES 344 +#define TK_VARIABLE 345 +#define TK_WAL 346 +#endif +/**************** End token definitions ***************************************/ /* The next sections is a series of control #defines. ** various aspects of the generated parser. @@ -104,29 +452,29 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 507 +#define YYNOCODE 508 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - EFillMode yy36; - SNode* yy80; - SNodeList* yy106; - SDataType yy292; - EOperatorType yy428; - int8_t yy431; - SAlterOption yy455; - EShowKind yy459; - STokenPair yy573; - SShowTablesOption yy709; - ENullOrder yy763; - SToken yy785; - EOrder yy812; - EJoinType yy828; - bool yy923; - int32_t yy982; - int64_t yy987; + SNodeList* yy88; + int32_t yy92; + SAlterOption yy117; + SShowTablesOption yy133; + ENullOrder yy153; + int64_t yy221; + SNode* yy232; + STokenPair yy241; + EFillMode yy246; + int8_t yy279; + EShowKind yy281; + SDataType yy400; + EJoinType yy436; + EOperatorType yy708; + EOrder yy834; + bool yy985; + SToken yy993; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -142,18 +490,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 835 -#define YYNRULE 639 -#define YYNRULE_WITH_ACTION 639 -#define YYNTOKEN 346 -#define YY_MAX_SHIFT 834 -#define YY_MIN_SHIFTREDUCE 1237 -#define YY_MAX_SHIFTREDUCE 1875 -#define YY_ERROR_ACTION 1876 -#define YY_ACCEPT_ACTION 1877 -#define YY_NO_ACTION 1878 -#define YY_MIN_REDUCE 1879 -#define YY_MAX_REDUCE 2517 +#define YYNSTATE 840 +#define YYNRULE 642 +#define YYNRULE_WITH_ACTION 642 +#define YYNTOKEN 347 +#define YY_MAX_SHIFT 839 +#define YY_MIN_SHIFTREDUCE 1242 +#define YY_MAX_SHIFTREDUCE 1883 +#define YY_ERROR_ACTION 1884 +#define YY_ACCEPT_ACTION 1885 +#define YY_NO_ACTION 1886 +#define YY_MIN_REDUCE 1887 +#define YY_MAX_REDUCE 2528 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -220,895 +568,874 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (3178) +#define YY_ACTTAB_COUNT (3071) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 173, 409, 462, 418, 2278, 720, 2067, 461, 2006, 171, - /* 10 */ 2007, 168, 48, 46, 1799, 424, 423, 2069, 397, 2069, - /* 20 */ 415, 1669, 1640, 41, 40, 137, 2118, 47, 45, 44, - /* 30 */ 43, 42, 599, 475, 2176, 1725, 1963, 1638, 41, 40, - /* 40 */ 1647, 694, 47, 45, 44, 43, 42, 2319, 1665, 720, - /* 50 */ 2067, 2120, 662, 469, 662, 2488, 681, 2488, 381, 789, - /* 60 */ 702, 184, 2028, 30, 1720, 1880, 2118, 719, 556, 208, - /* 70 */ 19, 557, 1922, 2494, 203, 2494, 203, 1646, 2489, 688, - /* 80 */ 2489, 688, 219, 383, 2337, 2180, 127, 719, 2337, 126, - /* 90 */ 125, 124, 123, 122, 121, 120, 119, 118, 523, 521, - /* 100 */ 2285, 364, 736, 831, 786, 217, 15, 1665, 806, 805, - /* 110 */ 804, 803, 427, 719, 802, 801, 151, 796, 795, 794, - /* 120 */ 793, 792, 791, 790, 150, 784, 783, 782, 426, 425, - /* 130 */ 779, 778, 777, 183, 182, 776, 687, 1842, 573, 2488, - /* 140 */ 561, 2318, 1727, 1728, 2356, 680, 558, 114, 2320, 740, - /* 150 */ 2322, 2323, 735, 51, 730, 2424, 2200, 686, 203, 186, - /* 160 */ 2200, 2409, 2489, 688, 687, 411, 2405, 2488, 788, 720, - /* 170 */ 2067, 408, 699, 146, 2197, 707, 1700, 1710, 2198, 707, - /* 180 */ 205, 2421, 1665, 1726, 1729, 686, 203, 1382, 2439, 137, - /* 190 */ 2489, 688, 1439, 682, 574, 2193, 604, 1877, 1641, 51, - /* 200 */ 1639, 677, 2295, 1650, 2306, 1872, 1430, 765, 764, 763, - /* 210 */ 1434, 762, 1436, 1437, 761, 758, 2303, 1445, 755, 1447, - /* 220 */ 1448, 752, 749, 746, 481, 2176, 2299, 1384, 389, 388, - /* 230 */ 1644, 1645, 1697, 1670, 1699, 1702, 1703, 1704, 1705, 1706, - /* 240 */ 1707, 1708, 1709, 732, 728, 1718, 1719, 1721, 1722, 1723, - /* 250 */ 1724, 2, 48, 46, 509, 2176, 576, 363, 63, 1663, - /* 260 */ 415, 2308, 1640, 1540, 1541, 2319, 507, 184, 63, 526, - /* 270 */ 2301, 412, 95, 221, 525, 1725, 430, 1638, 734, 95, - /* 280 */ 730, 429, 300, 2417, 698, 68, 138, 697, 1668, 2488, - /* 290 */ 489, 2181, 527, 683, 678, 671, 385, 491, 2063, 387, - /* 300 */ 386, 695, 601, 226, 1720, 2062, 2337, 686, 203, 1871, - /* 310 */ 19, 1666, 2489, 688, 618, 617, 616, 1646, 2285, 2424, - /* 320 */ 736, 608, 143, 612, 603, 1822, 662, 611, 602, 2488, - /* 330 */ 720, 2067, 610, 615, 391, 390, 1803, 645, 609, 634, - /* 340 */ 1823, 605, 1665, 831, 384, 2420, 15, 2494, 203, 460, - /* 350 */ 56, 459, 2489, 688, 632, 477, 630, 269, 268, 2318, - /* 360 */ 564, 304, 2356, 557, 1922, 356, 2320, 740, 2322, 2323, - /* 370 */ 735, 733, 730, 721, 2374, 47, 45, 44, 43, 42, - /* 380 */ 1821, 458, 1727, 1728, 63, 2187, 2166, 63, 514, 513, - /* 390 */ 512, 511, 506, 505, 504, 503, 502, 497, 496, 495, - /* 400 */ 494, 367, 486, 485, 484, 1697, 479, 478, 382, 172, - /* 410 */ 38, 320, 1528, 1529, 341, 34, 1700, 1710, 1547, 223, - /* 420 */ 304, 41, 40, 1726, 1729, 47, 45, 44, 43, 42, - /* 430 */ 304, 338, 74, 1474, 1475, 73, 646, 775, 1641, 420, - /* 440 */ 1639, 1966, 2113, 2115, 517, 365, 302, 41, 40, 52, - /* 450 */ 691, 47, 45, 44, 43, 42, 235, 538, 536, 533, - /* 460 */ 90, 41, 40, 89, 1902, 47, 45, 44, 43, 42, - /* 470 */ 1644, 1645, 1697, 1669, 1699, 1702, 1703, 1704, 1705, 1706, - /* 480 */ 1707, 1708, 1709, 732, 728, 1718, 1719, 1721, 1722, 1723, - /* 490 */ 1724, 2, 12, 48, 46, 159, 553, 63, 1701, 720, - /* 500 */ 2067, 415, 2248, 1640, 551, 644, 227, 547, 543, 375, - /* 510 */ 566, 2239, 572, 618, 617, 616, 1725, 2285, 1638, 466, - /* 520 */ 608, 143, 612, 834, 699, 146, 611, 88, 516, 515, - /* 530 */ 1735, 610, 615, 391, 390, 64, 1665, 609, 237, 327, - /* 540 */ 605, 284, 559, 1830, 1930, 1720, 304, 1669, 2319, 304, - /* 550 */ 196, 19, 661, 1754, 1698, 193, 274, 1756, 1646, 720, - /* 560 */ 2067, 702, 2107, 822, 818, 814, 810, 127, 324, 55, - /* 570 */ 126, 125, 124, 123, 122, 121, 120, 119, 118, 467, - /* 580 */ 9, 84, 83, 465, 831, 100, 216, 15, 12, 2337, - /* 590 */ 10, 1640, 674, 673, 1828, 1829, 1831, 1832, 1833, 457, - /* 600 */ 455, 2285, 643, 736, 112, 2493, 1638, 720, 2067, 113, - /* 610 */ 366, 304, 318, 446, 1755, 1666, 443, 439, 435, 432, - /* 620 */ 458, 147, 1668, 1727, 1728, 2044, 1303, 483, 1302, 2059, - /* 630 */ 174, 199, 1891, 701, 201, 2417, 2418, 35, 144, 2422, - /* 640 */ 699, 146, 2318, 142, 716, 2356, 1646, 1761, 114, 2320, - /* 650 */ 740, 2322, 2323, 735, 1901, 730, 2120, 1700, 1710, 304, - /* 660 */ 186, 1304, 2409, 36, 1726, 1729, 411, 2405, 106, 41, - /* 670 */ 40, 706, 831, 47, 45, 44, 43, 42, 2043, 1641, - /* 680 */ 61, 1639, 699, 146, 307, 1670, 720, 2067, 659, 2440, - /* 690 */ 606, 306, 1701, 2060, 37, 413, 1749, 1750, 1751, 1752, - /* 700 */ 1753, 1757, 1758, 1759, 1760, 194, 498, 2285, 692, 1865, - /* 710 */ 277, 1644, 1645, 1697, 1379, 1699, 1702, 1703, 1704, 1705, - /* 720 */ 1706, 1707, 1708, 1709, 732, 728, 1718, 1719, 1721, 1722, - /* 730 */ 1723, 1724, 2, 48, 46, 1730, 2319, 1560, 1561, 1286, - /* 740 */ 239, 415, 1900, 1640, 559, 1664, 1930, 775, 1698, 737, - /* 750 */ 202, 2417, 2418, 603, 144, 2422, 1725, 602, 1638, 1670, - /* 760 */ 773, 161, 160, 770, 769, 768, 158, 1641, 2319, 1639, - /* 770 */ 773, 161, 160, 770, 769, 768, 158, 2337, 1559, 1562, - /* 780 */ 302, 737, 1899, 1932, 727, 1720, 1879, 720, 2067, 2285, - /* 790 */ 1669, 736, 204, 2417, 2418, 2285, 144, 2422, 1646, 1644, - /* 800 */ 1645, 2114, 2115, 1898, 646, 1788, 2319, 499, 2424, 2337, - /* 810 */ 136, 135, 134, 133, 132, 131, 130, 129, 128, 737, - /* 820 */ 1665, 2285, 99, 736, 831, 720, 2067, 49, 1665, 623, - /* 830 */ 2318, 720, 2067, 2356, 2419, 2285, 114, 2320, 740, 2322, - /* 840 */ 2323, 735, 1897, 730, 635, 500, 149, 2337, 156, 2380, - /* 850 */ 2409, 575, 1588, 272, 411, 2405, 2285, 271, 418, 2285, - /* 860 */ 270, 736, 2318, 1727, 1728, 2356, 171, 2151, 114, 2320, - /* 870 */ 740, 2322, 2323, 735, 2069, 730, 626, 2042, 648, 2239, - /* 880 */ 2508, 2120, 2409, 620, 2120, 12, 411, 2405, 396, 267, - /* 890 */ 1646, 405, 720, 2067, 1896, 2285, 2118, 1700, 1710, 2118, - /* 900 */ 2318, 595, 594, 2356, 1726, 1729, 114, 2320, 740, 2322, - /* 910 */ 2323, 735, 2064, 730, 2295, 722, 255, 2381, 2384, 1641, - /* 920 */ 2409, 1639, 1895, 98, 411, 2405, 370, 1894, 2058, 395, - /* 930 */ 72, 636, 178, 71, 2120, 1277, 614, 613, 2299, 766, - /* 940 */ 593, 589, 585, 581, 1746, 254, 1893, 2285, 198, 715, - /* 950 */ 2279, 1644, 1645, 1697, 1284, 1699, 1702, 1703, 1704, 1705, - /* 960 */ 1706, 1707, 1708, 1709, 732, 728, 1718, 1719, 1721, 1722, - /* 970 */ 1723, 1724, 2, 48, 46, 2285, 1701, 1279, 1282, 1283, - /* 980 */ 2285, 415, 2301, 1640, 720, 2067, 96, 720, 2067, 252, - /* 990 */ 2120, 2492, 730, 325, 2120, 2319, 1725, 410, 1638, 2285, - /* 1000 */ 662, 419, 1670, 2488, 275, 2118, 1284, 283, 737, 2118, - /* 1010 */ 2447, 2056, 773, 161, 160, 770, 769, 768, 158, 720, - /* 1020 */ 2067, 2494, 203, 720, 2067, 1720, 2489, 688, 493, 2319, - /* 1030 */ 1282, 1283, 1698, 421, 720, 2067, 2337, 492, 1646, 705, - /* 1040 */ 1698, 171, 737, 315, 2460, 720, 2067, 2052, 2285, 2069, - /* 1050 */ 736, 41, 40, 242, 717, 47, 45, 44, 43, 42, - /* 1060 */ 1796, 251, 244, 450, 831, 718, 2161, 49, 249, 570, - /* 1070 */ 2337, 41, 40, 720, 2067, 47, 45, 44, 43, 42, - /* 1080 */ 1306, 1307, 2285, 1933, 736, 720, 2067, 241, 1337, 2318, - /* 1090 */ 452, 448, 2356, 321, 2054, 114, 2320, 740, 2322, 2323, - /* 1100 */ 735, 641, 730, 1727, 1728, 422, 2266, 2508, 473, 2409, - /* 1110 */ 647, 41, 40, 411, 2405, 47, 45, 44, 43, 42, - /* 1120 */ 1303, 1890, 1302, 2318, 800, 798, 2356, 1889, 1338, 114, - /* 1130 */ 2320, 740, 2322, 2323, 735, 824, 730, 1700, 1710, 597, - /* 1140 */ 596, 2508, 273, 2409, 1726, 1729, 2050, 411, 2405, 2493, - /* 1150 */ 1841, 662, 2488, 148, 2488, 1304, 2380, 311, 312, 1641, - /* 1160 */ 662, 1639, 310, 2488, 724, 2295, 2381, 1888, 1394, 703, - /* 1170 */ 1815, 2492, 2494, 203, 2285, 2489, 2491, 2489, 688, 2304, - /* 1180 */ 2285, 2494, 203, 1393, 14, 13, 2489, 688, 638, 2299, - /* 1190 */ 637, 1644, 1645, 1697, 1887, 1699, 1702, 1703, 1704, 1705, - /* 1200 */ 1706, 1707, 1708, 1709, 732, 728, 1718, 1719, 1721, 1722, - /* 1210 */ 1723, 1724, 2, 48, 46, 2319, 197, 1609, 1610, 662, - /* 1220 */ 2285, 415, 2488, 1640, 1398, 44, 43, 42, 737, 1886, - /* 1230 */ 669, 2493, 767, 2301, 2488, 2111, 1725, 2120, 1638, 1397, - /* 1240 */ 2494, 203, 1885, 730, 1884, 2489, 688, 2285, 2319, 528, - /* 1250 */ 1649, 171, 2119, 2492, 2071, 1883, 2337, 2489, 2490, 2070, - /* 1260 */ 1882, 737, 1648, 2481, 771, 1720, 334, 2111, 2285, 2097, - /* 1270 */ 736, 772, 1907, 826, 2111, 2429, 1788, 690, 1646, 41, - /* 1280 */ 40, 170, 2285, 47, 45, 44, 43, 42, 2269, 2337, - /* 1290 */ 1768, 2045, 1950, 280, 3, 2285, 76, 2285, 139, 260, - /* 1300 */ 159, 2285, 258, 736, 831, 530, 54, 15, 2285, 2318, - /* 1310 */ 86, 2453, 2356, 2285, 619, 114, 2320, 740, 2322, 2323, - /* 1320 */ 735, 731, 730, 607, 152, 262, 1795, 2508, 261, 2409, - /* 1330 */ 210, 424, 423, 411, 2405, 264, 1941, 266, 263, 437, - /* 1340 */ 265, 1654, 2318, 1727, 1728, 2356, 87, 1377, 114, 2320, - /* 1350 */ 740, 2322, 2323, 735, 1725, 730, 1647, 1939, 621, 297, - /* 1360 */ 2508, 1892, 2409, 1874, 1875, 675, 411, 2405, 14, 13, - /* 1370 */ 141, 291, 2338, 2004, 1604, 2319, 780, 1700, 1710, 624, - /* 1380 */ 159, 50, 50, 1720, 1726, 1729, 187, 159, 737, 50, - /* 1390 */ 2428, 309, 75, 111, 157, 781, 1646, 159, 2003, 1641, - /* 1400 */ 1356, 1639, 108, 672, 2185, 1923, 2443, 401, 679, 398, - /* 1410 */ 709, 66, 50, 1652, 50, 428, 2337, 744, 157, 1354, - /* 1420 */ 1929, 159, 726, 140, 157, 1651, 2108, 2186, 2285, 655, - /* 1430 */ 736, 1644, 1645, 1697, 2444, 1699, 1702, 1703, 1704, 1705, - /* 1440 */ 1706, 1707, 1708, 1709, 732, 728, 1718, 1719, 1721, 1722, - /* 1450 */ 1723, 1724, 2, 2454, 1607, 1827, 1826, 700, 299, 296, - /* 1460 */ 289, 704, 2029, 1557, 303, 313, 712, 5, 317, 2318, - /* 1470 */ 431, 1424, 2356, 436, 379, 114, 2320, 740, 2322, 2323, - /* 1480 */ 735, 444, 730, 2319, 445, 1762, 1711, 2508, 333, 2409, - /* 1490 */ 1673, 1452, 1456, 411, 2405, 1463, 737, 1461, 162, 454, - /* 1500 */ 212, 211, 453, 214, 456, 1581, 328, 1663, 470, 1664, - /* 1510 */ 474, 225, 476, 480, 519, 482, 487, 1655, 501, 1650, - /* 1520 */ 508, 2178, 510, 518, 2337, 520, 532, 531, 529, 229, - /* 1530 */ 230, 534, 232, 535, 537, 539, 2285, 1671, 736, 554, - /* 1540 */ 4, 2319, 555, 562, 563, 240, 565, 92, 1666, 1658, - /* 1550 */ 1660, 243, 1672, 567, 737, 1674, 568, 246, 569, 1675, - /* 1560 */ 571, 248, 2194, 728, 1718, 1719, 1721, 1722, 1723, 1724, - /* 1570 */ 93, 577, 598, 94, 253, 97, 642, 2318, 2319, 627, - /* 1580 */ 2356, 2257, 2337, 114, 2320, 740, 2322, 2323, 735, 600, - /* 1590 */ 730, 737, 116, 628, 2285, 2382, 736, 2409, 2057, 257, - /* 1600 */ 360, 411, 2405, 640, 2053, 259, 153, 164, 2254, 165, - /* 1610 */ 2055, 2319, 2051, 166, 167, 329, 276, 1667, 2240, 2337, - /* 1620 */ 650, 649, 651, 281, 737, 657, 2459, 279, 676, 710, - /* 1630 */ 8, 2285, 2253, 736, 2431, 2318, 654, 685, 2356, 666, - /* 1640 */ 2458, 114, 2320, 740, 2322, 2323, 735, 290, 730, 179, - /* 1650 */ 667, 292, 2337, 723, 2319, 2409, 286, 665, 288, 411, - /* 1660 */ 2405, 656, 2487, 402, 2285, 664, 736, 737, 295, 696, - /* 1670 */ 2511, 298, 2318, 693, 1788, 2356, 145, 1668, 115, 2320, - /* 1680 */ 740, 2322, 2323, 735, 1793, 730, 190, 2425, 1791, 293, - /* 1690 */ 294, 2319, 2409, 1, 305, 2337, 2408, 2405, 154, 330, - /* 1700 */ 708, 2208, 2207, 2206, 737, 2318, 331, 2285, 2356, 736, - /* 1710 */ 407, 115, 2320, 740, 2322, 2323, 735, 713, 730, 206, - /* 1720 */ 714, 332, 62, 155, 2390, 2409, 107, 2068, 105, 725, - /* 1730 */ 2405, 742, 2337, 2112, 335, 1261, 825, 323, 828, 371, - /* 1740 */ 53, 359, 372, 830, 2285, 339, 736, 163, 738, 2319, - /* 1750 */ 344, 2356, 2277, 2276, 115, 2320, 740, 2322, 2323, 735, - /* 1760 */ 358, 730, 737, 337, 348, 2275, 2319, 81, 2409, 2270, - /* 1770 */ 433, 434, 374, 2405, 1631, 1632, 209, 438, 2268, 737, - /* 1780 */ 440, 441, 442, 1630, 2267, 2318, 380, 2319, 2356, 2265, - /* 1790 */ 2337, 175, 2320, 740, 2322, 2323, 735, 447, 730, 2264, - /* 1800 */ 737, 449, 2285, 451, 736, 2263, 1620, 2337, 2244, 213, - /* 1810 */ 2243, 215, 1584, 82, 2221, 1583, 2220, 2219, 463, 2285, - /* 1820 */ 464, 736, 2218, 2217, 2168, 468, 1527, 2160, 2337, 471, - /* 1830 */ 2157, 472, 218, 663, 2450, 2156, 85, 2155, 2154, 2159, - /* 1840 */ 2285, 2158, 736, 2318, 220, 2153, 2356, 2152, 2150, 176, - /* 1850 */ 2320, 740, 2322, 2323, 735, 2149, 730, 2148, 222, 2147, - /* 1860 */ 2318, 488, 490, 2356, 2163, 2146, 115, 2320, 740, 2322, - /* 1870 */ 2323, 735, 2145, 730, 2144, 2143, 2142, 2165, 2141, 2140, - /* 1880 */ 2409, 2318, 2139, 2138, 2356, 2406, 2319, 175, 2320, 740, - /* 1890 */ 2322, 2323, 735, 2137, 730, 2136, 2135, 2134, 2133, 737, - /* 1900 */ 2132, 224, 2131, 689, 2509, 91, 2130, 2129, 2128, 2164, - /* 1910 */ 2162, 2127, 2126, 2319, 1533, 2125, 2124, 228, 522, 2123, - /* 1920 */ 524, 2122, 2121, 1395, 1969, 1399, 737, 2337, 1391, 1968, - /* 1930 */ 2451, 368, 399, 231, 369, 233, 1967, 234, 1965, 2285, - /* 1940 */ 1962, 736, 540, 1961, 2319, 541, 542, 1954, 1943, 1918, - /* 1950 */ 544, 1285, 1917, 2242, 2337, 2238, 185, 737, 2228, 400, - /* 1960 */ 546, 2216, 548, 552, 2215, 545, 2285, 2192, 736, 550, - /* 1970 */ 247, 549, 78, 236, 238, 2046, 79, 1964, 1960, 578, - /* 1980 */ 2318, 2319, 2305, 2356, 195, 2337, 357, 2320, 740, 2322, - /* 1990 */ 2323, 735, 245, 730, 737, 560, 579, 2285, 580, 736, - /* 2000 */ 250, 1958, 582, 1330, 584, 583, 1956, 2318, 586, 1953, - /* 2010 */ 2356, 587, 588, 357, 2320, 740, 2322, 2323, 735, 590, - /* 2020 */ 730, 592, 2337, 591, 1938, 1936, 1937, 1935, 1914, 2048, - /* 2030 */ 1468, 65, 1467, 2047, 2285, 1951, 736, 1381, 2318, 1380, - /* 2040 */ 1378, 2356, 1376, 1942, 350, 2320, 740, 2322, 2323, 735, - /* 2050 */ 1375, 730, 1374, 256, 2319, 1373, 1372, 1369, 1368, 1367, - /* 2060 */ 1366, 392, 393, 797, 799, 622, 1940, 737, 394, 625, - /* 2070 */ 1913, 1912, 1911, 629, 1910, 2318, 1909, 633, 2356, 2319, - /* 2080 */ 117, 176, 2320, 740, 2322, 2323, 735, 631, 730, 1614, - /* 2090 */ 684, 1616, 734, 1613, 1618, 2337, 29, 2241, 69, 2237, - /* 2100 */ 406, 1590, 278, 1592, 1594, 2227, 652, 2285, 2214, 736, - /* 2110 */ 2493, 20, 6, 17, 31, 668, 21, 57, 2213, 7, - /* 2120 */ 2337, 22, 2319, 1844, 287, 189, 200, 33, 285, 2306, - /* 2130 */ 67, 23, 2285, 24, 736, 737, 2510, 2319, 282, 18, - /* 2140 */ 670, 58, 301, 1859, 653, 169, 1569, 1568, 2318, 1825, - /* 2150 */ 737, 2356, 2319, 177, 357, 2320, 740, 2322, 2323, 735, - /* 2160 */ 1858, 730, 403, 2337, 188, 737, 1814, 32, 414, 658, - /* 2170 */ 660, 80, 1863, 2318, 1864, 2285, 2356, 736, 2337, 356, - /* 2180 */ 2320, 740, 2322, 2323, 735, 1862, 730, 404, 2375, 1865, - /* 2190 */ 2285, 60, 736, 2337, 1785, 180, 1784, 2212, 416, 2191, - /* 2200 */ 2190, 101, 102, 308, 25, 2285, 103, 736, 1820, 191, - /* 2210 */ 314, 319, 26, 13, 316, 70, 2318, 2319, 104, 2356, - /* 2220 */ 1737, 1736, 357, 2320, 740, 2322, 2323, 735, 108, 730, - /* 2230 */ 737, 639, 1656, 711, 2356, 2319, 11, 352, 2320, 740, - /* 2240 */ 2322, 2323, 735, 2359, 730, 1715, 2318, 729, 737, 2356, - /* 2250 */ 1713, 39, 357, 2320, 740, 2322, 2323, 735, 2337, 730, - /* 2260 */ 59, 1712, 181, 16, 192, 27, 1690, 741, 1682, 28, - /* 2270 */ 2285, 1747, 736, 1453, 743, 417, 2337, 739, 745, 747, - /* 2280 */ 1450, 748, 750, 1449, 751, 753, 756, 1446, 2285, 754, - /* 2290 */ 736, 1440, 757, 759, 1438, 760, 1444, 1443, 1442, 109, - /* 2300 */ 322, 1441, 110, 1462, 77, 1458, 1363, 1328, 1360, 774, - /* 2310 */ 1389, 2318, 1359, 1358, 2356, 1357, 1355, 342, 2320, 740, - /* 2320 */ 2322, 2323, 735, 1353, 730, 1352, 1351, 785, 1388, 2318, - /* 2330 */ 2319, 787, 2356, 207, 1349, 340, 2320, 740, 2322, 2323, - /* 2340 */ 735, 1348, 730, 737, 1347, 1346, 1345, 2319, 1344, 1343, - /* 2350 */ 1383, 1385, 1340, 1339, 1336, 1335, 1334, 1333, 1959, 807, - /* 2360 */ 737, 808, 1957, 2319, 811, 812, 809, 813, 1955, 815, - /* 2370 */ 816, 2337, 1952, 817, 819, 821, 737, 820, 1934, 823, - /* 2380 */ 1274, 1908, 1262, 2285, 827, 736, 326, 829, 2337, 1642, - /* 2390 */ 833, 336, 832, 1878, 1878, 1878, 1878, 1878, 1878, 1878, - /* 2400 */ 2285, 1878, 736, 1878, 2337, 1878, 1878, 1878, 1878, 1878, - /* 2410 */ 1878, 1878, 1878, 1878, 1878, 1878, 2285, 1878, 736, 1878, - /* 2420 */ 1878, 1878, 1878, 1878, 2318, 1878, 1878, 2356, 1878, 1878, - /* 2430 */ 343, 2320, 740, 2322, 2323, 735, 1878, 730, 1878, 1878, - /* 2440 */ 2319, 2318, 1878, 1878, 2356, 1878, 1878, 349, 2320, 740, - /* 2450 */ 2322, 2323, 735, 737, 730, 1878, 1878, 2318, 1878, 2319, - /* 2460 */ 2356, 1878, 1878, 353, 2320, 740, 2322, 2323, 735, 1878, - /* 2470 */ 730, 1878, 737, 1878, 1878, 1878, 1878, 1878, 1878, 1878, - /* 2480 */ 1878, 2337, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, - /* 2490 */ 1878, 1878, 1878, 2285, 1878, 736, 1878, 1878, 1878, 1878, - /* 2500 */ 2337, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, - /* 2510 */ 1878, 1878, 2285, 1878, 736, 1878, 1878, 1878, 1878, 1878, - /* 2520 */ 1878, 1878, 1878, 1878, 1878, 1878, 2319, 1878, 1878, 1878, - /* 2530 */ 1878, 1878, 1878, 1878, 2318, 1878, 1878, 2356, 1878, 737, - /* 2540 */ 345, 2320, 740, 2322, 2323, 735, 1878, 730, 1878, 1878, - /* 2550 */ 1878, 1878, 1878, 2318, 1878, 2319, 2356, 1878, 1878, 354, - /* 2560 */ 2320, 740, 2322, 2323, 735, 1878, 730, 2337, 737, 1878, - /* 2570 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 2285, - /* 2580 */ 1878, 736, 1878, 1878, 2319, 1878, 1878, 1878, 1878, 1878, - /* 2590 */ 1878, 1878, 1878, 1878, 1878, 1878, 2337, 737, 1878, 1878, - /* 2600 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 2285, 1878, - /* 2610 */ 736, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, - /* 2620 */ 2318, 1878, 2319, 2356, 1878, 2337, 346, 2320, 740, 2322, - /* 2630 */ 2323, 735, 1878, 730, 1878, 737, 1878, 2285, 1878, 736, - /* 2640 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 2318, - /* 2650 */ 1878, 1878, 2356, 1878, 1878, 355, 2320, 740, 2322, 2323, - /* 2660 */ 735, 1878, 730, 2337, 1878, 1878, 1878, 1878, 1878, 1878, - /* 2670 */ 1878, 1878, 1878, 1878, 1878, 2285, 1878, 736, 2318, 2319, - /* 2680 */ 1878, 2356, 1878, 1878, 347, 2320, 740, 2322, 2323, 735, - /* 2690 */ 1878, 730, 737, 1878, 1878, 1878, 1878, 2319, 1878, 1878, - /* 2700 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, - /* 2710 */ 737, 1878, 1878, 1878, 1878, 1878, 2318, 1878, 1878, 2356, - /* 2720 */ 2337, 1878, 361, 2320, 740, 2322, 2323, 735, 1878, 730, - /* 2730 */ 1878, 1878, 2285, 1878, 736, 1878, 1878, 1878, 2337, 1878, - /* 2740 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, - /* 2750 */ 2285, 1878, 736, 1878, 2319, 1878, 1878, 1878, 1878, 1878, - /* 2760 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 737, 1878, 1878, - /* 2770 */ 1878, 1878, 1878, 2318, 2319, 1878, 2356, 1878, 1878, 362, - /* 2780 */ 2320, 740, 2322, 2323, 735, 1878, 730, 737, 1878, 1878, - /* 2790 */ 2319, 2318, 1878, 1878, 2356, 2337, 1878, 2331, 2320, 740, - /* 2800 */ 2322, 2323, 735, 737, 730, 1878, 1878, 2285, 1878, 736, - /* 2810 */ 1878, 1878, 1878, 1878, 1878, 2337, 1878, 1878, 1878, 1878, - /* 2820 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 2285, 1878, 736, - /* 2830 */ 1878, 2337, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, - /* 2840 */ 1878, 1878, 1878, 2285, 1878, 736, 1878, 1878, 2318, 1878, - /* 2850 */ 1878, 2356, 1878, 1878, 2330, 2320, 740, 2322, 2323, 735, - /* 2860 */ 1878, 730, 1878, 1878, 1878, 1878, 1878, 1878, 2318, 1878, - /* 2870 */ 1878, 2356, 1878, 1878, 2329, 2320, 740, 2322, 2323, 735, - /* 2880 */ 1878, 730, 1878, 1878, 2318, 1878, 1878, 2356, 1878, 2319, - /* 2890 */ 376, 2320, 740, 2322, 2323, 735, 1878, 730, 1878, 1878, - /* 2900 */ 1878, 1878, 737, 1878, 1878, 2319, 1878, 1878, 1878, 1878, - /* 2910 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 737, 1878, - /* 2920 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, - /* 2930 */ 2337, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, - /* 2940 */ 1878, 1878, 2285, 1878, 736, 1878, 2337, 1878, 1878, 1878, - /* 2950 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 2285, 1878, - /* 2960 */ 736, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, - /* 2970 */ 1878, 1878, 2319, 1878, 1878, 1878, 1878, 1878, 1878, 1878, - /* 2980 */ 1878, 1878, 1878, 2318, 1878, 737, 2356, 2319, 1878, 377, - /* 2990 */ 2320, 740, 2322, 2323, 735, 1878, 730, 1878, 1878, 2318, - /* 3000 */ 737, 1878, 2356, 1878, 1878, 373, 2320, 740, 2322, 2323, - /* 3010 */ 735, 1878, 730, 2337, 1878, 1878, 1878, 1878, 1878, 1878, - /* 3020 */ 1878, 1878, 1878, 1878, 1878, 2285, 1878, 736, 2337, 1878, - /* 3030 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, - /* 3040 */ 2285, 1878, 736, 1878, 1878, 1878, 1878, 1878, 1878, 1878, - /* 3050 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, - /* 3060 */ 1878, 1878, 1878, 1878, 1878, 1878, 2318, 1878, 1878, 2356, - /* 3070 */ 2319, 1878, 378, 2320, 740, 2322, 2323, 735, 1878, 730, - /* 3080 */ 1878, 738, 1878, 737, 2356, 1878, 1878, 352, 2320, 740, - /* 3090 */ 2322, 2323, 735, 1878, 730, 1878, 1878, 1878, 1878, 1878, - /* 3100 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, - /* 3110 */ 1878, 2337, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, - /* 3120 */ 1878, 1878, 1878, 2285, 1878, 736, 1878, 1878, 1878, 1878, - /* 3130 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, - /* 3140 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, - /* 3150 */ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, - /* 3160 */ 1878, 1878, 1878, 1878, 2318, 1878, 1878, 2356, 1878, 1878, - /* 3170 */ 351, 2320, 740, 2322, 2323, 735, 1878, 730, + /* 0 */ 409, 561, 197, 418, 562, 1930, 569, 2064, 171, 562, + /* 10 */ 1930, 168, 48, 46, 1807, 2210, 2077, 34, 397, 2077, + /* 20 */ 415, 471, 1648, 41, 40, 1673, 2126, 47, 45, 44, + /* 30 */ 43, 42, 36, 2208, 712, 1733, 1971, 1646, 41, 40, + /* 40 */ 38, 320, 47, 45, 44, 43, 42, 2330, 41, 40, + /* 50 */ 480, 2186, 47, 45, 44, 43, 42, 704, 146, 1674, + /* 60 */ 707, 184, 2122, 2123, 1728, 1888, 528, 526, 420, 365, + /* 70 */ 19, 2121, 2123, 217, 41, 40, 173, 1654, 47, 45, + /* 80 */ 44, 43, 42, 383, 2014, 2190, 127, 95, 2348, 126, + /* 90 */ 125, 124, 123, 122, 121, 120, 119, 118, 1673, 219, + /* 100 */ 2296, 237, 741, 836, 385, 564, 15, 1938, 811, 810, + /* 110 */ 809, 808, 427, 2070, 807, 806, 151, 801, 800, 799, + /* 120 */ 798, 797, 796, 795, 150, 789, 788, 787, 426, 425, + /* 130 */ 784, 783, 782, 183, 182, 781, 692, 486, 2186, 2499, + /* 140 */ 1648, 2329, 1735, 1736, 2367, 686, 184, 114, 2331, 745, + /* 150 */ 2333, 2334, 740, 148, 735, 1646, 2391, 691, 203, 186, + /* 160 */ 581, 2420, 2500, 693, 1282, 411, 2416, 300, 2428, 703, + /* 170 */ 2191, 138, 702, 2348, 2499, 704, 146, 1708, 1718, 2435, + /* 180 */ 205, 1479, 1480, 1289, 1734, 1737, 221, 724, 2450, 2128, + /* 190 */ 1674, 724, 691, 203, 2210, 1654, 381, 2500, 693, 1649, + /* 200 */ 174, 1647, 1899, 2504, 2126, 2432, 1284, 1287, 1288, 408, + /* 210 */ 41, 40, 2207, 712, 47, 45, 44, 43, 42, 127, + /* 220 */ 1676, 836, 126, 125, 124, 123, 122, 121, 120, 119, + /* 230 */ 118, 1652, 1653, 1705, 685, 1707, 1710, 1711, 1712, 1713, + /* 240 */ 1714, 1715, 1716, 1717, 737, 733, 1726, 1727, 1729, 1730, + /* 250 */ 1731, 1732, 2, 48, 46, 1547, 1548, 1880, 364, 682, + /* 260 */ 1671, 415, 1308, 1648, 1307, 514, 2186, 512, 1830, 2330, + /* 270 */ 531, 724, 375, 51, 692, 530, 1733, 2499, 1646, 142, + /* 280 */ 2306, 650, 742, 1831, 706, 201, 2428, 2429, 272, 144, + /* 290 */ 2433, 494, 271, 532, 2066, 691, 203, 1309, 496, 2504, + /* 300 */ 2500, 693, 2499, 112, 2310, 1728, 1887, 1873, 474, 566, + /* 310 */ 2348, 19, 1567, 1568, 226, 563, 1762, 1649, 1654, 1647, + /* 320 */ 147, 2503, 2296, 1829, 741, 2500, 2502, 2330, 2067, 196, + /* 330 */ 136, 135, 134, 133, 132, 131, 130, 129, 128, 608, + /* 340 */ 742, 2115, 1940, 607, 836, 384, 687, 15, 2312, 1652, + /* 350 */ 1653, 688, 683, 676, 1566, 1569, 482, 51, 735, 98, + /* 360 */ 578, 1879, 370, 2329, 2051, 395, 2367, 641, 2348, 175, + /* 370 */ 2331, 745, 2333, 2334, 740, 577, 735, 666, 1763, 302, + /* 380 */ 2296, 106, 741, 1735, 1736, 1910, 2197, 2176, 1958, 519, + /* 390 */ 518, 517, 516, 511, 510, 509, 508, 507, 502, 501, + /* 400 */ 500, 499, 367, 491, 490, 489, 2068, 484, 483, 382, + /* 410 */ 624, 668, 2461, 475, 1535, 1536, 579, 2203, 1708, 1718, + /* 420 */ 1554, 2329, 1673, 648, 2367, 1734, 1737, 114, 2331, 745, + /* 430 */ 2333, 2334, 740, 780, 735, 1676, 304, 639, 2296, 2519, + /* 440 */ 1649, 2420, 1647, 41, 40, 411, 2416, 47, 45, 44, + /* 450 */ 43, 42, 637, 1654, 635, 269, 268, 2289, 37, 413, + /* 460 */ 1757, 1758, 1759, 1760, 1761, 1765, 1766, 1767, 1768, 780, + /* 470 */ 311, 312, 1652, 1653, 1705, 310, 1707, 1710, 1711, 1712, + /* 480 */ 1713, 1714, 1715, 1716, 1717, 737, 733, 1726, 1727, 1729, + /* 490 */ 1730, 1731, 1732, 2, 12, 48, 46, 255, 239, 2330, + /* 500 */ 1673, 1399, 564, 415, 1938, 1648, 61, 667, 63, 1909, + /* 510 */ 2499, 63, 742, 178, 664, 12, 1398, 68, 1733, 558, + /* 520 */ 1646, 598, 594, 590, 586, 223, 254, 556, 2505, 203, + /* 530 */ 552, 548, 1908, 2500, 693, 2330, 159, 623, 622, 621, + /* 540 */ 2348, 651, 1849, 522, 613, 143, 617, 1728, 707, 651, + /* 550 */ 616, 2052, 2296, 19, 741, 615, 620, 391, 390, 1705, + /* 560 */ 1654, 614, 2296, 3, 610, 2504, 90, 96, 2499, 89, + /* 570 */ 252, 1311, 1312, 41, 40, 54, 2348, 47, 45, 44, + /* 580 */ 43, 42, 533, 424, 423, 2296, 836, 2503, 2296, 15, + /* 590 */ 741, 2500, 2501, 2329, 302, 1308, 2367, 1307, 30, 114, + /* 600 */ 2331, 745, 2333, 2334, 740, 227, 735, 2306, 1655, 149, + /* 610 */ 55, 156, 2391, 2420, 1811, 571, 2249, 411, 2416, 63, + /* 620 */ 1673, 2315, 771, 653, 2249, 1735, 1736, 521, 520, 2329, + /* 630 */ 1309, 2310, 2367, 88, 242, 114, 2331, 745, 2333, 2334, + /* 640 */ 740, 2128, 735, 251, 244, 600, 599, 186, 396, 2420, + /* 650 */ 249, 575, 325, 411, 2416, 2435, 2126, 1709, 41, 40, + /* 660 */ 1708, 1718, 47, 45, 44, 43, 42, 1734, 1737, 241, + /* 670 */ 699, 304, 1850, 1743, 304, 2312, 2451, 1974, 2159, 1673, + /* 680 */ 1444, 2431, 1649, 2060, 1647, 735, 778, 161, 160, 775, + /* 690 */ 774, 773, 158, 52, 1435, 770, 769, 768, 1439, 767, + /* 700 */ 1441, 1442, 766, 763, 171, 1450, 760, 1452, 1453, 757, + /* 710 */ 754, 751, 2078, 1706, 1652, 1653, 1705, 99, 1707, 1710, + /* 720 */ 1711, 1712, 1713, 1714, 1715, 1716, 1717, 737, 733, 1726, + /* 730 */ 1727, 1729, 1730, 1731, 1732, 2, 48, 46, 1738, 2062, + /* 740 */ 2330, 44, 43, 42, 415, 2128, 1648, 1907, 1595, 623, + /* 750 */ 622, 621, 405, 742, 1838, 2458, 613, 143, 617, 1733, + /* 760 */ 2126, 1646, 616, 725, 2075, 725, 2075, 615, 620, 391, + /* 770 */ 390, 2330, 1658, 614, 725, 2075, 610, 1709, 1885, 2050, + /* 780 */ 9, 2348, 304, 137, 742, 137, 2471, 2058, 1728, 12, + /* 790 */ 604, 10, 609, 2296, 208, 741, 602, 601, 448, 2435, + /* 800 */ 2296, 1654, 1906, 679, 678, 1836, 1837, 1839, 1840, 1841, + /* 810 */ 464, 2079, 2348, 41, 40, 463, 2128, 47, 45, 44, + /* 820 */ 43, 42, 1291, 410, 2296, 2430, 741, 836, 1672, 170, + /* 830 */ 49, 2126, 280, 1706, 2329, 1905, 1709, 2367, 2330, 498, + /* 840 */ 114, 2331, 745, 2333, 2334, 740, 2128, 735, 497, 725, + /* 850 */ 2075, 739, 2519, 419, 2420, 2296, 304, 430, 411, 2416, + /* 860 */ 667, 2126, 429, 2499, 2503, 2329, 1735, 1736, 2367, 56, + /* 870 */ 736, 114, 2331, 745, 2333, 2334, 740, 2290, 735, 2348, + /* 880 */ 95, 2505, 203, 2519, 1904, 2420, 2500, 693, 2296, 411, + /* 890 */ 2416, 2296, 1706, 741, 778, 161, 160, 775, 774, 773, + /* 900 */ 158, 1708, 1718, 704, 146, 418, 2071, 667, 1734, 1737, + /* 910 */ 2499, 2128, 1823, 171, 778, 161, 160, 775, 774, 773, + /* 920 */ 158, 2077, 2317, 1649, 452, 1647, 711, 667, 2505, 203, + /* 930 */ 2499, 700, 2329, 2500, 693, 2367, 1949, 2296, 356, 2331, + /* 940 */ 745, 2333, 2334, 740, 738, 735, 726, 2385, 2505, 203, + /* 950 */ 1764, 454, 450, 2500, 693, 1652, 1653, 1705, 626, 1707, + /* 960 */ 1710, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 737, 733, + /* 970 */ 1726, 1727, 1729, 1730, 1731, 1732, 2, 48, 46, 2319, + /* 980 */ 2330, 725, 2075, 1403, 646, 415, 1387, 1648, 1903, 649, + /* 990 */ 725, 2075, 727, 742, 2392, 674, 725, 2075, 1402, 273, + /* 1000 */ 1733, 468, 1646, 421, 725, 2075, 1796, 839, 619, 618, + /* 1010 */ 469, 171, 2330, 202, 2428, 2429, 488, 144, 2433, 2077, + /* 1020 */ 2169, 2348, 2306, 327, 275, 742, 1389, 2492, 1657, 1728, + /* 1030 */ 35, 725, 2075, 2296, 667, 741, 2314, 2499, 1804, 193, + /* 1040 */ 1769, 2296, 1654, 725, 2075, 284, 2310, 827, 823, 819, + /* 1050 */ 815, 503, 324, 2348, 791, 2505, 203, 2258, 725, 2075, + /* 1060 */ 2500, 693, 478, 504, 535, 2296, 2015, 741, 836, 704, + /* 1070 */ 146, 49, 1902, 628, 2329, 1616, 1617, 2367, 505, 1677, + /* 1080 */ 114, 2331, 745, 2333, 2334, 740, 652, 735, 640, 100, + /* 1090 */ 2312, 412, 2519, 113, 2420, 1677, 318, 1673, 411, 2416, + /* 1100 */ 735, 725, 2075, 2277, 270, 1900, 2329, 1735, 1736, 2367, + /* 1110 */ 1289, 274, 114, 2331, 745, 2333, 2334, 740, 793, 735, + /* 1120 */ 631, 580, 1677, 696, 2519, 2296, 2420, 625, 721, 794, + /* 1130 */ 411, 2416, 2036, 267, 1287, 1288, 667, 805, 803, 2499, + /* 1140 */ 41, 40, 1708, 1718, 47, 45, 44, 43, 42, 1734, + /* 1150 */ 1737, 695, 1677, 389, 388, 725, 2075, 2505, 203, 729, + /* 1160 */ 159, 2392, 2500, 693, 1649, 772, 1647, 2128, 2119, 307, + /* 1170 */ 1901, 725, 2075, 2128, 72, 2072, 306, 71, 111, 204, + /* 1180 */ 2428, 2429, 720, 144, 2433, 14, 13, 108, 2127, 708, + /* 1190 */ 63, 283, 1660, 1898, 1897, 277, 1652, 1653, 1705, 1896, + /* 1200 */ 1707, 1710, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 737, + /* 1210 */ 733, 1726, 1727, 1729, 1730, 1731, 1732, 2, 48, 46, + /* 1220 */ 725, 2075, 2330, 2296, 387, 386, 415, 606, 1648, 47, + /* 1230 */ 45, 44, 43, 42, 1611, 742, 1895, 2439, 194, 667, + /* 1240 */ 710, 1733, 2499, 1646, 725, 2075, 2296, 2296, 1894, 608, + /* 1250 */ 1893, 1892, 2296, 607, 725, 2075, 725, 2075, 725, 2075, + /* 1260 */ 2505, 203, 2280, 2348, 315, 2500, 693, 725, 2075, 776, + /* 1270 */ 1728, 76, 2119, 732, 722, 2296, 723, 741, 321, 1891, + /* 1280 */ 1890, 198, 462, 1654, 461, 777, 2464, 422, 2119, 2296, + /* 1290 */ 334, 1776, 1678, 2105, 1915, 831, 260, 2440, 1796, 258, + /* 1300 */ 643, 2296, 642, 2296, 2296, 1803, 139, 50, 1678, 836, + /* 1310 */ 1706, 199, 15, 437, 460, 1656, 2329, 2330, 86, 2367, + /* 1320 */ 611, 87, 114, 2331, 745, 2333, 2334, 740, 210, 735, + /* 1330 */ 742, 2053, 2296, 2296, 2519, 1678, 2420, 424, 423, 262, + /* 1340 */ 411, 2416, 261, 264, 1384, 612, 263, 1662, 1735, 1736, + /* 1350 */ 680, 266, 1947, 304, 265, 785, 159, 1342, 2348, 50, + /* 1360 */ 1733, 786, 1655, 297, 152, 1678, 50, 1882, 1883, 1382, + /* 1370 */ 2296, 141, 741, 2349, 629, 291, 14, 13, 2012, 1361, + /* 1380 */ 1941, 1719, 697, 1708, 1718, 1359, 2011, 187, 159, 1728, + /* 1390 */ 1734, 1737, 50, 309, 75, 2195, 157, 1343, 159, 66, + /* 1400 */ 50, 749, 1654, 157, 159, 1649, 140, 1647, 1931, 2454, + /* 1410 */ 157, 2329, 677, 401, 2367, 684, 714, 114, 2331, 745, + /* 1420 */ 2333, 2334, 740, 398, 735, 2196, 428, 1937, 731, 2395, + /* 1430 */ 1614, 2420, 829, 1835, 1754, 411, 2416, 1652, 1653, 1705, + /* 1440 */ 1834, 1707, 1710, 1711, 1712, 1713, 1714, 1715, 1716, 1717, + /* 1450 */ 737, 733, 1726, 1727, 1729, 1730, 1731, 1732, 2, 2116, + /* 1460 */ 172, 289, 709, 705, 660, 341, 1564, 313, 717, 2455, + /* 1470 */ 317, 2465, 1429, 1770, 333, 1457, 299, 1461, 1468, 1659, + /* 1480 */ 1466, 296, 338, 74, 162, 303, 73, 2037, 5, 431, + /* 1490 */ 436, 379, 444, 445, 1681, 455, 366, 211, 1588, 456, + /* 1500 */ 2330, 212, 214, 458, 1671, 328, 472, 235, 543, 541, + /* 1510 */ 538, 1672, 479, 742, 225, 485, 481, 487, 492, 524, + /* 1520 */ 506, 523, 513, 2188, 1663, 515, 1658, 525, 536, 537, + /* 1530 */ 534, 229, 230, 539, 232, 540, 542, 544, 1679, 4, + /* 1540 */ 559, 2348, 560, 567, 240, 568, 570, 92, 63, 1674, + /* 1550 */ 572, 243, 1680, 2296, 573, 741, 1666, 1668, 1682, 576, + /* 1560 */ 246, 574, 248, 1683, 93, 2204, 582, 94, 253, 603, + /* 1570 */ 733, 1726, 1727, 1729, 1730, 1731, 1732, 632, 360, 633, + /* 1580 */ 116, 2267, 2264, 605, 2263, 2065, 64, 645, 97, 257, + /* 1590 */ 2061, 259, 164, 165, 2329, 647, 2063, 2367, 2059, 166, + /* 1600 */ 114, 2331, 745, 2333, 2334, 740, 167, 735, 153, 329, + /* 1610 */ 276, 1675, 2393, 655, 2420, 654, 659, 656, 411, 2416, + /* 1620 */ 281, 662, 671, 681, 2470, 715, 2330, 2469, 8, 2442, + /* 1630 */ 690, 290, 293, 84, 83, 467, 402, 292, 216, 742, + /* 1640 */ 661, 286, 288, 179, 279, 672, 2250, 669, 294, 295, + /* 1650 */ 670, 459, 457, 1796, 145, 2522, 1676, 701, 1801, 1, + /* 1660 */ 2330, 2498, 363, 698, 1799, 446, 298, 2348, 443, 439, + /* 1670 */ 435, 432, 460, 742, 305, 190, 2436, 154, 330, 2296, + /* 1680 */ 713, 741, 2218, 2217, 331, 2216, 407, 718, 719, 332, + /* 1690 */ 155, 105, 206, 2076, 62, 2401, 107, 2120, 747, 335, + /* 1700 */ 1266, 2348, 833, 323, 830, 163, 835, 359, 371, 372, + /* 1710 */ 2288, 304, 344, 2296, 53, 741, 337, 2287, 2286, 81, + /* 1720 */ 2329, 358, 2281, 2367, 348, 433, 114, 2331, 745, 2333, + /* 1730 */ 2334, 740, 434, 735, 2330, 339, 1639, 1640, 728, 209, + /* 1740 */ 2420, 438, 2279, 440, 411, 2416, 441, 742, 442, 1638, + /* 1750 */ 2278, 2276, 380, 447, 2329, 2275, 449, 2367, 2274, 451, + /* 1760 */ 115, 2331, 745, 2333, 2334, 740, 2273, 735, 2330, 453, + /* 1770 */ 1627, 2254, 213, 2253, 2420, 2348, 215, 1591, 2419, 2416, + /* 1780 */ 82, 742, 1590, 2231, 2230, 2229, 466, 2296, 465, 741, + /* 1790 */ 2228, 2227, 2178, 470, 1534, 2175, 473, 2174, 2168, 476, + /* 1800 */ 477, 2330, 2165, 218, 2164, 85, 2163, 2162, 2167, 2348, + /* 1810 */ 220, 2166, 2161, 2160, 742, 2158, 2157, 2156, 222, 493, + /* 1820 */ 2155, 2296, 495, 741, 2171, 2154, 2153, 2152, 2329, 224, + /* 1830 */ 2139, 2367, 2151, 2150, 115, 2331, 745, 2333, 2334, 740, + /* 1840 */ 2173, 735, 2348, 2149, 2148, 2147, 2146, 2145, 2420, 527, + /* 1850 */ 91, 2138, 730, 2416, 2296, 2144, 741, 2143, 2142, 2141, + /* 1860 */ 2140, 2137, 743, 2136, 2172, 2367, 2170, 2135, 115, 2331, + /* 1870 */ 745, 2333, 2334, 740, 2134, 735, 1540, 2330, 2133, 2132, + /* 1880 */ 228, 2131, 2420, 529, 2130, 2129, 374, 2416, 368, 369, + /* 1890 */ 742, 1400, 1404, 1977, 1976, 2329, 1975, 1973, 2367, 231, + /* 1900 */ 233, 176, 2331, 745, 2333, 2334, 740, 2330, 735, 1970, + /* 1910 */ 1396, 1969, 234, 545, 549, 1962, 546, 547, 2348, 550, + /* 1920 */ 742, 1951, 551, 553, 1926, 555, 557, 1290, 185, 1925, + /* 1930 */ 2296, 2252, 741, 554, 78, 236, 2248, 2316, 2238, 2226, + /* 1940 */ 195, 2225, 238, 79, 245, 2202, 247, 565, 2348, 250, + /* 1950 */ 2054, 1972, 1968, 583, 584, 694, 2520, 1966, 588, 585, + /* 1960 */ 2296, 589, 741, 587, 1964, 591, 1961, 593, 1946, 592, + /* 1970 */ 595, 2329, 597, 596, 2367, 1335, 1944, 115, 2331, 745, + /* 1980 */ 2333, 2334, 740, 1945, 735, 2330, 1943, 1922, 2056, 1472, + /* 1990 */ 1473, 2420, 2055, 1386, 802, 1385, 2417, 1383, 742, 1381, + /* 2000 */ 1380, 2329, 2330, 804, 2367, 1959, 1379, 175, 2331, 745, + /* 2010 */ 2333, 2334, 740, 1372, 735, 742, 1378, 256, 1377, 2330, + /* 2020 */ 392, 1374, 65, 1950, 393, 627, 2348, 1373, 1948, 394, + /* 2030 */ 1371, 399, 742, 630, 1921, 1920, 1919, 634, 2296, 1918, + /* 2040 */ 741, 636, 1917, 2348, 638, 117, 1621, 1623, 400, 1620, + /* 2050 */ 2462, 1625, 29, 2251, 69, 2296, 1601, 741, 2247, 1599, + /* 2060 */ 2348, 1597, 278, 2237, 169, 657, 2224, 2223, 2504, 6, + /* 2070 */ 17, 20, 2296, 21, 741, 23, 7, 31, 673, 2329, + /* 2080 */ 1852, 285, 2367, 22, 2330, 357, 2331, 745, 2333, 2334, + /* 2090 */ 740, 57, 735, 58, 189, 177, 2329, 742, 200, 2367, + /* 2100 */ 2317, 287, 357, 2331, 745, 2333, 2334, 740, 675, 735, + /* 2110 */ 1833, 658, 33, 2329, 2330, 1822, 2367, 282, 1872, 350, + /* 2120 */ 2331, 745, 2333, 2334, 740, 2348, 735, 742, 1576, 663, + /* 2130 */ 67, 24, 1867, 1575, 1873, 188, 32, 2296, 80, 741, + /* 2140 */ 1866, 665, 403, 1871, 1870, 18, 404, 60, 1793, 301, + /* 2150 */ 180, 1792, 2222, 2201, 101, 2348, 2200, 102, 25, 103, + /* 2160 */ 406, 308, 1828, 191, 26, 689, 314, 2296, 716, 741, + /* 2170 */ 70, 108, 319, 1745, 104, 1744, 316, 59, 2329, 2330, + /* 2180 */ 13, 2367, 1664, 2370, 176, 2331, 745, 2333, 2334, 740, + /* 2190 */ 1755, 735, 739, 1723, 11, 734, 181, 1721, 39, 2330, + /* 2200 */ 1720, 1690, 16, 192, 1698, 27, 748, 746, 2329, 1458, + /* 2210 */ 28, 2367, 742, 417, 357, 2331, 745, 2333, 2334, 740, + /* 2220 */ 2348, 735, 2330, 1455, 750, 752, 753, 755, 1454, 1451, + /* 2230 */ 756, 744, 2296, 758, 741, 742, 759, 2330, 761, 2521, + /* 2240 */ 2348, 1445, 762, 764, 1443, 414, 1449, 765, 109, 322, + /* 2250 */ 742, 110, 2296, 1448, 741, 1447, 2330, 1467, 1463, 1446, + /* 2260 */ 1333, 77, 779, 2348, 1368, 1365, 1364, 1363, 416, 742, + /* 2270 */ 1394, 1362, 1360, 2329, 1358, 2296, 2367, 741, 2348, 356, + /* 2280 */ 2331, 745, 2333, 2334, 740, 1357, 735, 1356, 2386, 1393, + /* 2290 */ 2296, 790, 741, 2329, 792, 207, 2367, 2348, 1354, 357, + /* 2300 */ 2331, 745, 2333, 2334, 740, 1353, 735, 1352, 1351, 2296, + /* 2310 */ 1350, 741, 1349, 1967, 1348, 1390, 2329, 1388, 1345, 2367, + /* 2320 */ 1344, 1341, 357, 2331, 745, 2333, 2334, 740, 1339, 735, + /* 2330 */ 2330, 644, 1340, 1338, 2367, 812, 813, 352, 2331, 745, + /* 2340 */ 2333, 2334, 740, 742, 735, 814, 1965, 816, 817, 2330, + /* 2350 */ 2329, 818, 1963, 2367, 820, 821, 342, 2331, 745, 2333, + /* 2360 */ 2334, 740, 742, 735, 822, 2330, 1960, 824, 826, 825, + /* 2370 */ 1942, 2348, 828, 1279, 1916, 1267, 832, 326, 742, 834, + /* 2380 */ 1886, 1650, 336, 2296, 837, 741, 1886, 838, 1886, 1886, + /* 2390 */ 2348, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, + /* 2400 */ 1886, 1886, 2296, 1886, 741, 1886, 2348, 1886, 1886, 1886, + /* 2410 */ 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 2296, 1886, + /* 2420 */ 741, 1886, 1886, 2330, 2329, 1886, 1886, 2367, 1886, 1886, + /* 2430 */ 340, 2331, 745, 2333, 2334, 740, 742, 735, 1886, 1886, + /* 2440 */ 1886, 1886, 1886, 2329, 1886, 1886, 2367, 2330, 1886, 343, + /* 2450 */ 2331, 745, 2333, 2334, 740, 1886, 735, 1886, 1886, 2329, + /* 2460 */ 742, 1886, 2367, 1886, 2348, 349, 2331, 745, 2333, 2334, + /* 2470 */ 740, 1886, 735, 1886, 1886, 1886, 2296, 1886, 741, 1886, + /* 2480 */ 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 2348, 1886, + /* 2490 */ 2330, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, + /* 2500 */ 2296, 1886, 741, 742, 1886, 1886, 1886, 1886, 1886, 1886, + /* 2510 */ 1886, 1886, 1886, 1886, 1886, 1886, 2330, 2329, 1886, 1886, + /* 2520 */ 2367, 1886, 1886, 353, 2331, 745, 2333, 2334, 740, 742, + /* 2530 */ 735, 2348, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, + /* 2540 */ 1886, 2329, 1886, 2296, 2367, 741, 1886, 345, 2331, 745, + /* 2550 */ 2333, 2334, 740, 1886, 735, 1886, 1886, 2348, 1886, 2330, + /* 2560 */ 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 2296, + /* 2570 */ 1886, 741, 742, 1886, 1886, 1886, 1886, 1886, 1886, 1886, + /* 2580 */ 1886, 1886, 1886, 2330, 2329, 1886, 1886, 2367, 1886, 1886, + /* 2590 */ 354, 2331, 745, 2333, 2334, 740, 742, 735, 1886, 1886, + /* 2600 */ 2348, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, + /* 2610 */ 2329, 1886, 2296, 2367, 741, 1886, 346, 2331, 745, 2333, + /* 2620 */ 2334, 740, 1886, 735, 2348, 1886, 2330, 1886, 1886, 1886, + /* 2630 */ 1886, 1886, 1886, 1886, 1886, 1886, 2296, 1886, 741, 742, + /* 2640 */ 1886, 2330, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, + /* 2650 */ 1886, 1886, 1886, 2329, 742, 1886, 2367, 2330, 1886, 355, + /* 2660 */ 2331, 745, 2333, 2334, 740, 1886, 735, 2348, 1886, 1886, + /* 2670 */ 742, 1886, 1886, 1886, 1886, 1886, 1886, 2329, 1886, 2296, + /* 2680 */ 2367, 741, 2348, 347, 2331, 745, 2333, 2334, 740, 1886, + /* 2690 */ 735, 1886, 1886, 1886, 2296, 1886, 741, 1886, 2348, 1886, + /* 2700 */ 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, + /* 2710 */ 2296, 1886, 741, 1886, 1886, 1886, 1886, 1886, 1886, 1886, + /* 2720 */ 2329, 1886, 1886, 2367, 1886, 1886, 361, 2331, 745, 2333, + /* 2730 */ 2334, 740, 1886, 735, 2330, 2329, 1886, 1886, 2367, 1886, + /* 2740 */ 1886, 362, 2331, 745, 2333, 2334, 740, 742, 735, 1886, + /* 2750 */ 1886, 2329, 1886, 2330, 2367, 1886, 1886, 2342, 2331, 745, + /* 2760 */ 2333, 2334, 740, 1886, 735, 1886, 742, 1886, 1886, 2330, + /* 2770 */ 1886, 1886, 1886, 1886, 1886, 2348, 1886, 1886, 1886, 1886, + /* 2780 */ 1886, 1886, 742, 1886, 1886, 1886, 1886, 2296, 1886, 741, + /* 2790 */ 1886, 1886, 1886, 1886, 2348, 1886, 1886, 1886, 1886, 1886, + /* 2800 */ 1886, 1886, 1886, 1886, 1886, 1886, 2296, 1886, 741, 1886, + /* 2810 */ 2348, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, + /* 2820 */ 1886, 1886, 2296, 1886, 741, 1886, 1886, 2330, 2329, 1886, + /* 2830 */ 1886, 2367, 1886, 1886, 2341, 2331, 745, 2333, 2334, 740, + /* 2840 */ 742, 735, 1886, 1886, 1886, 1886, 1886, 2329, 1886, 1886, + /* 2850 */ 2367, 2330, 1886, 2340, 2331, 745, 2333, 2334, 740, 1886, + /* 2860 */ 735, 1886, 1886, 2329, 742, 1886, 2367, 1886, 2348, 376, + /* 2870 */ 2331, 745, 2333, 2334, 740, 1886, 735, 1886, 1886, 1886, + /* 2880 */ 2296, 1886, 741, 1886, 1886, 1886, 1886, 1886, 1886, 1886, + /* 2890 */ 1886, 1886, 2348, 1886, 2330, 1886, 1886, 1886, 1886, 1886, + /* 2900 */ 1886, 1886, 1886, 1886, 2296, 1886, 741, 742, 1886, 1886, + /* 2910 */ 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, + /* 2920 */ 2330, 2329, 1886, 1886, 2367, 1886, 1886, 377, 2331, 745, + /* 2930 */ 2333, 2334, 740, 742, 735, 2348, 1886, 1886, 1886, 1886, + /* 2940 */ 1886, 1886, 1886, 1886, 1886, 2329, 1886, 2296, 2367, 741, + /* 2950 */ 1886, 373, 2331, 745, 2333, 2334, 740, 1886, 735, 1886, + /* 2960 */ 1886, 2348, 1886, 2330, 1886, 1886, 1886, 1886, 1886, 1886, + /* 2970 */ 1886, 1886, 1886, 2296, 1886, 741, 742, 1886, 1886, 1886, + /* 2980 */ 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 2329, 1886, + /* 2990 */ 1886, 2367, 1886, 1886, 378, 2331, 745, 2333, 2334, 740, + /* 3000 */ 1886, 735, 1886, 1886, 2348, 1886, 1886, 1886, 1886, 1886, + /* 3010 */ 1886, 1886, 1886, 1886, 743, 1886, 2296, 2367, 741, 1886, + /* 3020 */ 352, 2331, 745, 2333, 2334, 740, 1886, 735, 1886, 1886, + /* 3030 */ 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, + /* 3040 */ 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, + /* 3050 */ 1886, 1886, 1886, 1886, 1886, 1886, 1886, 2329, 1886, 1886, + /* 3060 */ 2367, 1886, 1886, 351, 2331, 745, 2333, 2334, 740, 1886, + /* 3070 */ 735, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 371, 382, 425, 382, 425, 361, 362, 430, 379, 390, - /* 10 */ 379, 390, 12, 13, 14, 12, 13, 398, 397, 398, - /* 20 */ 20, 20, 22, 8, 9, 381, 405, 12, 13, 14, - /* 30 */ 15, 16, 388, 361, 362, 35, 0, 37, 8, 9, - /* 40 */ 37, 33, 12, 13, 14, 15, 16, 349, 20, 361, - /* 50 */ 362, 390, 475, 361, 475, 478, 362, 478, 397, 377, - /* 60 */ 362, 390, 380, 33, 64, 0, 405, 20, 356, 381, - /* 70 */ 70, 359, 360, 496, 497, 496, 497, 77, 501, 502, - /* 80 */ 501, 502, 410, 412, 390, 414, 21, 20, 390, 24, - /* 90 */ 25, 26, 27, 28, 29, 30, 31, 32, 406, 407, - /* 100 */ 402, 409, 404, 103, 13, 413, 106, 20, 72, 73, - /* 110 */ 74, 75, 76, 20, 78, 79, 80, 81, 82, 83, + /* 0 */ 383, 357, 432, 383, 360, 361, 357, 392, 391, 360, + /* 10 */ 361, 391, 12, 13, 14, 405, 399, 2, 398, 399, + /* 20 */ 20, 362, 22, 8, 9, 20, 406, 12, 13, 14, + /* 30 */ 15, 16, 2, 423, 424, 35, 0, 37, 8, 9, + /* 40 */ 465, 466, 12, 13, 14, 15, 16, 350, 8, 9, + /* 50 */ 362, 363, 12, 13, 14, 15, 16, 362, 363, 20, + /* 60 */ 363, 391, 404, 405, 64, 0, 407, 408, 401, 410, + /* 70 */ 70, 404, 405, 414, 8, 9, 372, 77, 12, 13, + /* 80 */ 14, 15, 16, 413, 380, 415, 21, 371, 391, 24, + /* 90 */ 25, 26, 27, 28, 29, 30, 31, 32, 20, 411, + /* 100 */ 403, 358, 405, 103, 388, 362, 106, 364, 72, 73, + /* 110 */ 74, 75, 76, 397, 78, 79, 80, 81, 82, 83, /* 120 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - /* 130 */ 94, 95, 96, 97, 98, 99, 475, 107, 361, 478, - /* 140 */ 14, 443, 142, 143, 446, 451, 20, 449, 450, 451, - /* 150 */ 452, 453, 454, 106, 456, 448, 404, 496, 497, 461, - /* 160 */ 404, 463, 501, 502, 475, 467, 468, 478, 77, 361, - /* 170 */ 362, 419, 361, 362, 422, 423, 176, 177, 422, 423, - /* 180 */ 482, 474, 20, 183, 184, 496, 497, 37, 490, 381, - /* 190 */ 501, 502, 103, 20, 417, 418, 388, 346, 198, 106, - /* 200 */ 200, 182, 378, 200, 49, 190, 117, 118, 119, 120, - /* 210 */ 121, 122, 123, 124, 125, 126, 392, 128, 129, 130, - /* 220 */ 131, 132, 133, 134, 361, 362, 402, 77, 39, 40, - /* 230 */ 230, 231, 232, 232, 234, 235, 236, 237, 238, 239, + /* 130 */ 94, 95, 96, 97, 98, 99, 476, 362, 363, 479, + /* 140 */ 22, 444, 142, 143, 447, 363, 391, 450, 451, 452, + /* 150 */ 453, 454, 455, 460, 457, 37, 463, 497, 498, 462, + /* 160 */ 69, 464, 502, 503, 4, 468, 469, 472, 473, 474, + /* 170 */ 415, 476, 477, 391, 479, 362, 363, 177, 178, 449, + /* 180 */ 483, 142, 143, 23, 184, 185, 411, 20, 491, 391, + /* 190 */ 20, 20, 497, 498, 405, 77, 398, 502, 503, 199, + /* 200 */ 349, 201, 351, 3, 406, 475, 46, 47, 48, 420, + /* 210 */ 8, 9, 423, 424, 12, 13, 14, 15, 16, 21, + /* 220 */ 20, 103, 24, 25, 26, 27, 28, 29, 30, 31, + /* 230 */ 32, 231, 232, 233, 452, 235, 236, 237, 238, 239, /* 240 */ 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - /* 250 */ 250, 251, 12, 13, 361, 362, 69, 18, 106, 20, - /* 260 */ 20, 106, 22, 176, 177, 349, 27, 390, 106, 30, - /* 270 */ 446, 447, 370, 410, 35, 35, 425, 37, 362, 370, - /* 280 */ 456, 430, 471, 472, 473, 4, 475, 476, 20, 478, - /* 290 */ 51, 414, 53, 274, 275, 276, 387, 58, 396, 110, - /* 300 */ 111, 293, 113, 410, 64, 396, 390, 496, 497, 294, - /* 310 */ 70, 20, 501, 502, 72, 73, 74, 77, 402, 448, - /* 320 */ 404, 79, 80, 81, 135, 22, 475, 85, 139, 478, - /* 330 */ 361, 362, 90, 91, 92, 93, 14, 20, 96, 21, - /* 340 */ 37, 99, 20, 103, 105, 474, 106, 496, 497, 197, - /* 350 */ 381, 199, 501, 502, 36, 116, 38, 39, 40, 443, - /* 360 */ 356, 268, 446, 359, 360, 449, 450, 451, 452, 453, - /* 370 */ 454, 455, 456, 457, 458, 12, 13, 14, 15, 16, - /* 380 */ 77, 229, 142, 143, 106, 146, 147, 106, 149, 150, - /* 390 */ 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - /* 400 */ 161, 162, 163, 164, 165, 232, 167, 168, 169, 18, - /* 410 */ 464, 465, 173, 174, 23, 2, 176, 177, 179, 64, - /* 420 */ 268, 8, 9, 183, 184, 12, 13, 14, 15, 16, - /* 430 */ 268, 40, 41, 142, 143, 44, 361, 69, 198, 400, - /* 440 */ 200, 0, 403, 404, 86, 54, 178, 8, 9, 106, - /* 450 */ 33, 12, 13, 14, 15, 16, 65, 66, 67, 68, - /* 460 */ 105, 8, 9, 108, 349, 12, 13, 14, 15, 16, - /* 470 */ 230, 231, 232, 20, 234, 235, 236, 237, 238, 239, - /* 480 */ 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - /* 490 */ 250, 251, 252, 12, 13, 33, 51, 106, 176, 361, - /* 500 */ 362, 20, 386, 22, 59, 1, 148, 62, 63, 70, - /* 510 */ 435, 436, 20, 72, 73, 74, 35, 402, 37, 381, - /* 520 */ 79, 80, 81, 19, 361, 362, 85, 172, 170, 171, - /* 530 */ 14, 90, 91, 92, 93, 144, 20, 96, 357, 35, - /* 540 */ 99, 64, 361, 230, 363, 64, 268, 20, 349, 268, - /* 550 */ 389, 70, 50, 114, 232, 51, 440, 175, 77, 361, - /* 560 */ 362, 362, 401, 59, 60, 61, 62, 21, 64, 107, - /* 570 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 381, - /* 580 */ 42, 190, 191, 192, 103, 108, 195, 106, 252, 390, - /* 590 */ 254, 22, 279, 280, 281, 282, 283, 284, 285, 208, - /* 600 */ 209, 402, 116, 404, 368, 3, 37, 361, 362, 105, - /* 610 */ 219, 268, 108, 222, 175, 20, 225, 226, 227, 228, - /* 620 */ 229, 385, 20, 142, 143, 0, 20, 381, 22, 393, - /* 630 */ 348, 178, 350, 470, 471, 472, 473, 255, 475, 476, - /* 640 */ 361, 362, 443, 37, 140, 446, 77, 265, 449, 450, - /* 650 */ 451, 452, 453, 454, 349, 456, 390, 176, 177, 268, - /* 660 */ 461, 55, 463, 2, 183, 184, 467, 468, 368, 8, - /* 670 */ 9, 405, 103, 12, 13, 14, 15, 16, 0, 198, - /* 680 */ 178, 200, 361, 362, 180, 232, 361, 362, 186, 490, - /* 690 */ 13, 187, 176, 393, 255, 256, 257, 258, 259, 260, - /* 700 */ 261, 262, 263, 264, 265, 178, 381, 402, 291, 107, - /* 710 */ 206, 230, 231, 232, 37, 234, 235, 236, 237, 238, - /* 720 */ 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, - /* 730 */ 249, 250, 251, 12, 13, 14, 349, 142, 143, 14, - /* 740 */ 357, 20, 349, 22, 361, 20, 363, 69, 232, 362, - /* 750 */ 471, 472, 473, 135, 475, 476, 35, 139, 37, 232, - /* 760 */ 135, 136, 137, 138, 139, 140, 141, 198, 349, 200, - /* 770 */ 135, 136, 137, 138, 139, 140, 141, 390, 183, 184, - /* 780 */ 178, 362, 349, 364, 70, 64, 0, 361, 362, 402, - /* 790 */ 20, 404, 471, 472, 473, 402, 475, 476, 77, 230, - /* 800 */ 231, 403, 404, 349, 361, 267, 349, 381, 448, 390, - /* 810 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 362, - /* 820 */ 20, 402, 172, 404, 103, 361, 362, 106, 20, 4, - /* 830 */ 443, 361, 362, 446, 474, 402, 449, 450, 451, 452, - /* 840 */ 453, 454, 349, 456, 19, 381, 459, 390, 461, 462, - /* 850 */ 463, 381, 202, 137, 467, 468, 402, 141, 382, 402, - /* 860 */ 35, 404, 443, 142, 143, 446, 390, 0, 449, 450, - /* 870 */ 451, 452, 453, 454, 398, 456, 51, 0, 435, 436, - /* 880 */ 461, 390, 463, 58, 390, 252, 467, 468, 397, 64, - /* 890 */ 77, 397, 361, 362, 349, 402, 405, 176, 177, 405, - /* 900 */ 443, 366, 367, 446, 183, 184, 449, 450, 451, 452, - /* 910 */ 453, 454, 381, 456, 378, 460, 35, 462, 461, 198, - /* 920 */ 463, 200, 349, 207, 467, 468, 210, 349, 392, 213, - /* 930 */ 105, 215, 51, 108, 390, 4, 375, 376, 402, 116, - /* 940 */ 59, 60, 61, 62, 230, 64, 349, 402, 178, 405, - /* 950 */ 425, 230, 231, 232, 23, 234, 235, 236, 237, 238, - /* 960 */ 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, - /* 970 */ 249, 250, 251, 12, 13, 402, 176, 46, 47, 48, - /* 980 */ 402, 20, 446, 22, 361, 362, 105, 361, 362, 108, - /* 990 */ 390, 3, 456, 34, 390, 349, 35, 397, 37, 402, - /* 1000 */ 475, 397, 232, 478, 381, 405, 23, 381, 362, 405, - /* 1010 */ 364, 391, 135, 136, 137, 138, 139, 140, 141, 361, - /* 1020 */ 362, 496, 497, 361, 362, 64, 501, 502, 161, 349, - /* 1030 */ 47, 48, 232, 382, 361, 362, 390, 170, 77, 381, - /* 1040 */ 232, 390, 362, 381, 364, 361, 362, 391, 402, 398, - /* 1050 */ 404, 8, 9, 172, 381, 12, 13, 14, 15, 16, - /* 1060 */ 4, 180, 181, 193, 103, 381, 0, 106, 187, 188, - /* 1070 */ 390, 8, 9, 361, 362, 12, 13, 14, 15, 16, - /* 1080 */ 56, 57, 402, 0, 404, 361, 362, 206, 37, 443, - /* 1090 */ 220, 221, 446, 381, 391, 449, 450, 451, 452, 453, - /* 1100 */ 454, 425, 456, 142, 143, 381, 0, 461, 42, 463, - /* 1110 */ 425, 8, 9, 467, 468, 12, 13, 14, 15, 16, - /* 1120 */ 20, 349, 22, 443, 375, 376, 446, 349, 77, 449, - /* 1130 */ 450, 451, 452, 453, 454, 52, 456, 176, 177, 366, - /* 1140 */ 367, 461, 136, 463, 183, 184, 391, 467, 468, 475, - /* 1150 */ 107, 475, 478, 459, 478, 55, 462, 136, 137, 198, - /* 1160 */ 475, 200, 141, 478, 460, 378, 462, 349, 22, 425, - /* 1170 */ 107, 497, 496, 497, 402, 501, 502, 501, 502, 392, - /* 1180 */ 402, 496, 497, 37, 1, 2, 501, 502, 214, 402, - /* 1190 */ 216, 230, 231, 232, 349, 234, 235, 236, 237, 238, - /* 1200 */ 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, - /* 1210 */ 249, 250, 251, 12, 13, 349, 431, 211, 212, 475, - /* 1220 */ 402, 20, 478, 22, 22, 14, 15, 16, 362, 349, - /* 1230 */ 364, 475, 399, 446, 478, 402, 35, 390, 37, 37, - /* 1240 */ 496, 497, 349, 456, 349, 501, 502, 402, 349, 103, - /* 1250 */ 37, 390, 405, 497, 391, 349, 390, 501, 502, 398, - /* 1260 */ 349, 362, 37, 364, 399, 64, 383, 402, 402, 386, - /* 1270 */ 404, 399, 352, 353, 402, 266, 267, 289, 77, 8, - /* 1280 */ 9, 178, 402, 12, 13, 14, 15, 16, 0, 390, - /* 1290 */ 107, 0, 0, 391, 33, 402, 116, 402, 33, 109, - /* 1300 */ 33, 402, 112, 404, 103, 103, 45, 106, 402, 443, - /* 1310 */ 45, 415, 446, 402, 22, 449, 450, 451, 452, 453, - /* 1320 */ 454, 391, 456, 13, 33, 109, 270, 461, 112, 463, - /* 1330 */ 224, 12, 13, 467, 468, 109, 0, 109, 112, 51, - /* 1340 */ 112, 22, 443, 142, 143, 446, 166, 37, 449, 450, - /* 1350 */ 451, 452, 453, 454, 35, 456, 37, 0, 22, 505, - /* 1360 */ 461, 350, 463, 142, 143, 494, 467, 468, 1, 2, - /* 1370 */ 365, 487, 390, 378, 107, 349, 13, 176, 177, 22, - /* 1380 */ 33, 33, 33, 64, 183, 184, 33, 33, 362, 33, - /* 1390 */ 364, 33, 33, 106, 33, 13, 77, 33, 378, 198, - /* 1400 */ 37, 200, 115, 493, 415, 360, 415, 493, 493, 424, - /* 1410 */ 493, 33, 33, 200, 33, 365, 390, 33, 33, 37, - /* 1420 */ 362, 33, 103, 33, 33, 200, 401, 415, 402, 432, - /* 1430 */ 404, 230, 231, 232, 415, 234, 235, 236, 237, 238, - /* 1440 */ 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, - /* 1450 */ 249, 250, 251, 415, 107, 107, 107, 477, 498, 469, - /* 1460 */ 107, 107, 380, 107, 480, 107, 107, 271, 107, 443, - /* 1470 */ 426, 107, 446, 51, 445, 449, 450, 451, 452, 453, - /* 1480 */ 454, 42, 456, 349, 444, 107, 107, 461, 107, 463, - /* 1490 */ 20, 107, 107, 467, 468, 107, 362, 107, 107, 437, - /* 1500 */ 370, 442, 213, 370, 437, 196, 428, 20, 361, 20, - /* 1510 */ 362, 45, 411, 362, 175, 411, 408, 198, 361, 200, - /* 1520 */ 362, 361, 411, 408, 390, 408, 374, 104, 102, 373, - /* 1530 */ 361, 101, 361, 372, 361, 361, 402, 20, 404, 354, - /* 1540 */ 50, 349, 358, 354, 358, 370, 437, 370, 20, 230, - /* 1550 */ 231, 370, 20, 404, 362, 20, 363, 370, 427, 20, - /* 1560 */ 363, 370, 418, 244, 245, 246, 247, 248, 249, 250, - /* 1570 */ 370, 361, 354, 370, 370, 106, 441, 443, 349, 352, - /* 1580 */ 446, 402, 390, 449, 450, 451, 452, 453, 454, 390, - /* 1590 */ 456, 362, 361, 352, 402, 461, 404, 463, 390, 390, - /* 1600 */ 354, 467, 468, 217, 390, 390, 439, 390, 402, 390, - /* 1610 */ 390, 349, 390, 390, 390, 437, 368, 20, 436, 390, - /* 1620 */ 204, 203, 434, 368, 362, 361, 486, 433, 278, 277, - /* 1630 */ 286, 402, 402, 404, 489, 443, 404, 189, 446, 402, - /* 1640 */ 486, 449, 450, 451, 452, 453, 454, 488, 456, 486, - /* 1650 */ 288, 485, 390, 461, 349, 463, 420, 287, 420, 467, - /* 1660 */ 468, 426, 500, 295, 402, 272, 404, 362, 426, 292, - /* 1670 */ 506, 499, 443, 290, 267, 446, 362, 20, 449, 450, - /* 1680 */ 451, 452, 453, 454, 116, 456, 363, 448, 269, 484, - /* 1690 */ 483, 349, 463, 481, 368, 390, 467, 468, 368, 420, - /* 1700 */ 402, 402, 402, 402, 362, 443, 420, 402, 446, 404, - /* 1710 */ 402, 449, 450, 451, 452, 453, 454, 181, 456, 479, - /* 1720 */ 416, 386, 106, 368, 466, 463, 106, 362, 368, 467, - /* 1730 */ 468, 394, 390, 402, 361, 22, 38, 368, 351, 421, - /* 1740 */ 429, 438, 421, 354, 402, 347, 404, 355, 443, 349, - /* 1750 */ 384, 446, 0, 0, 449, 450, 451, 452, 453, 454, - /* 1760 */ 384, 456, 362, 369, 384, 0, 349, 45, 463, 0, - /* 1770 */ 37, 223, 467, 468, 37, 37, 37, 223, 0, 362, - /* 1780 */ 37, 37, 223, 37, 0, 443, 223, 349, 446, 0, - /* 1790 */ 390, 449, 450, 451, 452, 453, 454, 37, 456, 0, - /* 1800 */ 362, 22, 402, 37, 404, 0, 218, 390, 0, 206, - /* 1810 */ 0, 206, 200, 207, 0, 198, 0, 0, 194, 402, - /* 1820 */ 193, 404, 0, 0, 147, 49, 49, 0, 390, 37, - /* 1830 */ 0, 51, 49, 491, 492, 0, 45, 0, 0, 0, - /* 1840 */ 402, 0, 404, 443, 49, 0, 446, 0, 0, 449, - /* 1850 */ 450, 451, 452, 453, 454, 0, 456, 0, 161, 0, - /* 1860 */ 443, 37, 161, 446, 0, 0, 449, 450, 451, 452, - /* 1870 */ 453, 454, 0, 456, 0, 0, 0, 0, 0, 0, - /* 1880 */ 463, 443, 0, 0, 446, 468, 349, 449, 450, 451, - /* 1890 */ 452, 453, 454, 0, 456, 0, 0, 0, 0, 362, - /* 1900 */ 0, 49, 0, 503, 504, 45, 0, 0, 0, 0, - /* 1910 */ 0, 0, 0, 349, 22, 0, 0, 147, 146, 0, - /* 1920 */ 145, 0, 0, 22, 0, 22, 362, 390, 37, 0, - /* 1930 */ 492, 50, 395, 64, 50, 64, 0, 64, 0, 402, - /* 1940 */ 0, 404, 37, 0, 349, 51, 42, 0, 0, 0, - /* 1950 */ 37, 14, 0, 0, 390, 0, 33, 362, 0, 395, - /* 1960 */ 42, 0, 37, 37, 0, 51, 402, 0, 404, 42, - /* 1970 */ 189, 51, 42, 45, 43, 0, 42, 0, 0, 37, - /* 1980 */ 443, 349, 49, 446, 49, 390, 449, 450, 451, 452, - /* 1990 */ 453, 454, 42, 456, 362, 49, 51, 402, 42, 404, - /* 2000 */ 49, 0, 37, 71, 42, 51, 0, 443, 37, 0, - /* 2010 */ 446, 51, 42, 449, 450, 451, 452, 453, 454, 37, - /* 2020 */ 456, 42, 390, 51, 0, 0, 0, 0, 0, 0, - /* 2030 */ 37, 114, 22, 0, 402, 0, 404, 37, 443, 37, - /* 2040 */ 37, 446, 37, 0, 449, 450, 451, 452, 453, 454, - /* 2050 */ 37, 456, 37, 112, 349, 37, 37, 37, 37, 22, - /* 2060 */ 37, 22, 22, 33, 33, 53, 0, 362, 22, 37, - /* 2070 */ 0, 0, 0, 37, 0, 443, 0, 22, 446, 349, - /* 2080 */ 20, 449, 450, 451, 452, 453, 454, 37, 456, 37, - /* 2090 */ 495, 37, 362, 37, 107, 390, 106, 0, 106, 0, - /* 2100 */ 395, 37, 49, 22, 205, 0, 22, 402, 0, 404, - /* 2110 */ 3, 33, 50, 273, 106, 104, 33, 178, 0, 50, - /* 2120 */ 390, 33, 349, 107, 107, 33, 49, 33, 106, 49, - /* 2130 */ 3, 273, 402, 33, 404, 362, 504, 349, 181, 273, - /* 2140 */ 102, 178, 49, 37, 178, 201, 178, 178, 443, 107, - /* 2150 */ 362, 446, 349, 106, 449, 450, 451, 452, 453, 454, - /* 2160 */ 37, 456, 37, 390, 106, 362, 107, 106, 395, 185, - /* 2170 */ 185, 106, 37, 443, 107, 402, 446, 404, 390, 449, - /* 2180 */ 450, 451, 452, 453, 454, 37, 456, 37, 458, 107, - /* 2190 */ 402, 33, 404, 390, 107, 49, 107, 0, 395, 0, - /* 2200 */ 0, 106, 42, 107, 106, 402, 42, 404, 107, 106, - /* 2210 */ 106, 49, 33, 2, 180, 106, 443, 349, 106, 446, - /* 2220 */ 104, 104, 449, 450, 451, 452, 453, 454, 115, 456, - /* 2230 */ 362, 443, 22, 182, 446, 349, 253, 449, 450, 451, - /* 2240 */ 452, 453, 454, 106, 456, 107, 443, 106, 362, 446, - /* 2250 */ 107, 106, 449, 450, 451, 452, 453, 454, 390, 456, - /* 2260 */ 266, 107, 49, 106, 49, 106, 22, 116, 107, 106, - /* 2270 */ 402, 230, 404, 107, 37, 37, 390, 233, 106, 37, - /* 2280 */ 107, 106, 37, 107, 106, 37, 37, 107, 402, 106, - /* 2290 */ 404, 107, 106, 37, 107, 106, 127, 127, 127, 106, - /* 2300 */ 33, 127, 106, 37, 106, 22, 37, 71, 37, 70, - /* 2310 */ 77, 443, 37, 37, 446, 37, 37, 449, 450, 451, - /* 2320 */ 452, 453, 454, 37, 456, 37, 37, 100, 77, 443, - /* 2330 */ 349, 100, 446, 33, 37, 449, 450, 451, 452, 453, - /* 2340 */ 454, 37, 456, 362, 37, 22, 37, 349, 37, 37, - /* 2350 */ 37, 77, 37, 37, 37, 37, 22, 37, 0, 37, - /* 2360 */ 362, 51, 0, 349, 37, 51, 42, 42, 0, 37, - /* 2370 */ 51, 390, 0, 42, 37, 42, 362, 51, 0, 37, - /* 2380 */ 37, 0, 22, 402, 33, 404, 22, 21, 390, 22, - /* 2390 */ 20, 22, 21, 507, 507, 507, 507, 507, 507, 507, - /* 2400 */ 402, 507, 404, 507, 390, 507, 507, 507, 507, 507, - /* 2410 */ 507, 507, 507, 507, 507, 507, 402, 507, 404, 507, - /* 2420 */ 507, 507, 507, 507, 443, 507, 507, 446, 507, 507, - /* 2430 */ 449, 450, 451, 452, 453, 454, 507, 456, 507, 507, - /* 2440 */ 349, 443, 507, 507, 446, 507, 507, 449, 450, 451, - /* 2450 */ 452, 453, 454, 362, 456, 507, 507, 443, 507, 349, - /* 2460 */ 446, 507, 507, 449, 450, 451, 452, 453, 454, 507, - /* 2470 */ 456, 507, 362, 507, 507, 507, 507, 507, 507, 507, - /* 2480 */ 507, 390, 507, 507, 507, 507, 507, 507, 507, 507, - /* 2490 */ 507, 507, 507, 402, 507, 404, 507, 507, 507, 507, - /* 2500 */ 390, 507, 507, 507, 507, 507, 507, 507, 507, 507, - /* 2510 */ 507, 507, 402, 507, 404, 507, 507, 507, 507, 507, - /* 2520 */ 507, 507, 507, 507, 507, 507, 349, 507, 507, 507, - /* 2530 */ 507, 507, 507, 507, 443, 507, 507, 446, 507, 362, - /* 2540 */ 449, 450, 451, 452, 453, 454, 507, 456, 507, 507, - /* 2550 */ 507, 507, 507, 443, 507, 349, 446, 507, 507, 449, - /* 2560 */ 450, 451, 452, 453, 454, 507, 456, 390, 362, 507, - /* 2570 */ 507, 507, 507, 507, 507, 507, 507, 507, 507, 402, - /* 2580 */ 507, 404, 507, 507, 349, 507, 507, 507, 507, 507, - /* 2590 */ 507, 507, 507, 507, 507, 507, 390, 362, 507, 507, - /* 2600 */ 507, 507, 507, 507, 507, 507, 507, 507, 402, 507, - /* 2610 */ 404, 507, 507, 507, 507, 507, 507, 507, 507, 507, - /* 2620 */ 443, 507, 349, 446, 507, 390, 449, 450, 451, 452, - /* 2630 */ 453, 454, 507, 456, 507, 362, 507, 402, 507, 404, - /* 2640 */ 507, 507, 507, 507, 507, 507, 507, 507, 507, 443, - /* 2650 */ 507, 507, 446, 507, 507, 449, 450, 451, 452, 453, - /* 2660 */ 454, 507, 456, 390, 507, 507, 507, 507, 507, 507, - /* 2670 */ 507, 507, 507, 507, 507, 402, 507, 404, 443, 349, - /* 2680 */ 507, 446, 507, 507, 449, 450, 451, 452, 453, 454, - /* 2690 */ 507, 456, 362, 507, 507, 507, 507, 349, 507, 507, - /* 2700 */ 507, 507, 507, 507, 507, 507, 507, 507, 507, 507, - /* 2710 */ 362, 507, 507, 507, 507, 507, 443, 507, 507, 446, - /* 2720 */ 390, 507, 449, 450, 451, 452, 453, 454, 507, 456, - /* 2730 */ 507, 507, 402, 507, 404, 507, 507, 507, 390, 507, - /* 2740 */ 507, 507, 507, 507, 507, 507, 507, 507, 507, 507, - /* 2750 */ 402, 507, 404, 507, 349, 507, 507, 507, 507, 507, - /* 2760 */ 507, 507, 507, 507, 507, 507, 507, 362, 507, 507, - /* 2770 */ 507, 507, 507, 443, 349, 507, 446, 507, 507, 449, - /* 2780 */ 450, 451, 452, 453, 454, 507, 456, 362, 507, 507, - /* 2790 */ 349, 443, 507, 507, 446, 390, 507, 449, 450, 451, - /* 2800 */ 452, 453, 454, 362, 456, 507, 507, 402, 507, 404, - /* 2810 */ 507, 507, 507, 507, 507, 390, 507, 507, 507, 507, - /* 2820 */ 507, 507, 507, 507, 507, 507, 507, 402, 507, 404, - /* 2830 */ 507, 390, 507, 507, 507, 507, 507, 507, 507, 507, - /* 2840 */ 507, 507, 507, 402, 507, 404, 507, 507, 443, 507, - /* 2850 */ 507, 446, 507, 507, 449, 450, 451, 452, 453, 454, - /* 2860 */ 507, 456, 507, 507, 507, 507, 507, 507, 443, 507, - /* 2870 */ 507, 446, 507, 507, 449, 450, 451, 452, 453, 454, - /* 2880 */ 507, 456, 507, 507, 443, 507, 507, 446, 507, 349, - /* 2890 */ 449, 450, 451, 452, 453, 454, 507, 456, 507, 507, - /* 2900 */ 507, 507, 362, 507, 507, 349, 507, 507, 507, 507, - /* 2910 */ 507, 507, 507, 507, 507, 507, 507, 507, 362, 507, - /* 2920 */ 507, 507, 507, 507, 507, 507, 507, 507, 507, 507, - /* 2930 */ 390, 507, 507, 507, 507, 507, 507, 507, 507, 507, - /* 2940 */ 507, 507, 402, 507, 404, 507, 390, 507, 507, 507, - /* 2950 */ 507, 507, 507, 507, 507, 507, 507, 507, 402, 507, - /* 2960 */ 404, 507, 507, 507, 507, 507, 507, 507, 507, 507, - /* 2970 */ 507, 507, 349, 507, 507, 507, 507, 507, 507, 507, - /* 2980 */ 507, 507, 507, 443, 507, 362, 446, 349, 507, 449, - /* 2990 */ 450, 451, 452, 453, 454, 507, 456, 507, 507, 443, - /* 3000 */ 362, 507, 446, 507, 507, 449, 450, 451, 452, 453, - /* 3010 */ 454, 507, 456, 390, 507, 507, 507, 507, 507, 507, - /* 3020 */ 507, 507, 507, 507, 507, 402, 507, 404, 390, 507, - /* 3030 */ 507, 507, 507, 507, 507, 507, 507, 507, 507, 507, - /* 3040 */ 402, 507, 404, 507, 507, 507, 507, 507, 507, 507, - /* 3050 */ 507, 507, 507, 507, 507, 507, 507, 507, 507, 507, - /* 3060 */ 507, 507, 507, 507, 507, 507, 443, 507, 507, 446, - /* 3070 */ 349, 507, 449, 450, 451, 452, 453, 454, 507, 456, - /* 3080 */ 507, 443, 507, 362, 446, 507, 507, 449, 450, 451, - /* 3090 */ 452, 453, 454, 507, 456, 507, 507, 507, 507, 507, - /* 3100 */ 507, 507, 507, 507, 507, 507, 507, 507, 507, 507, - /* 3110 */ 507, 390, 507, 507, 507, 507, 507, 507, 507, 507, - /* 3120 */ 507, 507, 507, 402, 507, 404, 507, 507, 507, 507, - /* 3130 */ 507, 507, 507, 507, 507, 507, 507, 507, 507, 507, - /* 3140 */ 507, 507, 507, 507, 507, 507, 507, 507, 507, 507, - /* 3150 */ 507, 507, 507, 507, 507, 507, 507, 507, 507, 507, - /* 3160 */ 507, 507, 507, 507, 443, 507, 507, 446, 507, 507, - /* 3170 */ 449, 450, 451, 452, 453, 454, 507, 456, 346, 346, - /* 3180 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3190 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3200 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3210 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3220 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3230 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3240 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3250 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3260 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3270 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3280 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3290 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3300 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3310 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3320 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3330 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3340 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3350 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3360 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3370 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3380 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3390 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3400 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3410 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3420 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3430 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3440 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3450 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3460 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3470 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3480 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3490 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3500 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3510 */ 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, - /* 3520 */ 346, 346, 346, 346, + /* 250 */ 250, 251, 252, 12, 13, 177, 178, 191, 18, 183, + /* 260 */ 20, 20, 20, 22, 22, 362, 363, 27, 22, 350, + /* 270 */ 30, 20, 70, 106, 476, 35, 35, 479, 37, 37, + /* 280 */ 379, 20, 363, 37, 471, 472, 473, 474, 137, 476, + /* 290 */ 477, 51, 141, 53, 393, 497, 498, 55, 58, 476, + /* 300 */ 502, 503, 479, 369, 403, 64, 0, 107, 68, 14, + /* 310 */ 391, 70, 142, 143, 411, 20, 114, 199, 77, 201, + /* 320 */ 386, 498, 403, 77, 405, 502, 503, 350, 394, 390, + /* 330 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 135, + /* 340 */ 363, 402, 365, 139, 103, 105, 20, 106, 447, 231, + /* 350 */ 232, 275, 276, 277, 184, 185, 116, 106, 457, 208, + /* 360 */ 362, 295, 211, 444, 0, 214, 447, 216, 391, 450, + /* 370 */ 451, 452, 453, 454, 455, 20, 457, 50, 176, 179, + /* 380 */ 403, 369, 405, 142, 143, 350, 146, 147, 0, 149, + /* 390 */ 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + /* 400 */ 160, 161, 162, 163, 164, 165, 394, 167, 168, 169, + /* 410 */ 22, 492, 493, 173, 174, 175, 418, 419, 177, 178, + /* 420 */ 180, 444, 20, 116, 447, 184, 185, 450, 451, 452, + /* 430 */ 453, 454, 455, 69, 457, 20, 269, 21, 403, 462, + /* 440 */ 199, 464, 201, 8, 9, 468, 469, 12, 13, 14, + /* 450 */ 15, 16, 36, 77, 38, 39, 40, 426, 256, 257, + /* 460 */ 258, 259, 260, 261, 262, 263, 264, 265, 266, 69, + /* 470 */ 136, 137, 231, 232, 233, 141, 235, 236, 237, 238, + /* 480 */ 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + /* 490 */ 249, 250, 251, 252, 253, 12, 13, 35, 358, 350, + /* 500 */ 20, 22, 362, 20, 364, 22, 179, 476, 106, 350, + /* 510 */ 479, 106, 363, 51, 187, 253, 37, 4, 35, 51, + /* 520 */ 37, 59, 60, 61, 62, 64, 64, 59, 497, 498, + /* 530 */ 62, 63, 350, 502, 503, 350, 33, 72, 73, 74, + /* 540 */ 391, 362, 107, 86, 79, 80, 81, 64, 363, 362, + /* 550 */ 85, 0, 403, 70, 405, 90, 91, 92, 93, 233, + /* 560 */ 77, 96, 403, 33, 99, 476, 105, 105, 479, 108, + /* 570 */ 108, 56, 57, 8, 9, 45, 391, 12, 13, 14, + /* 580 */ 15, 16, 103, 12, 13, 403, 103, 498, 403, 106, + /* 590 */ 405, 502, 503, 444, 179, 20, 447, 22, 33, 450, + /* 600 */ 451, 452, 453, 454, 455, 148, 457, 379, 37, 460, + /* 610 */ 107, 462, 463, 464, 14, 436, 437, 468, 469, 106, + /* 620 */ 20, 393, 116, 436, 437, 142, 143, 170, 171, 444, + /* 630 */ 55, 403, 447, 172, 172, 450, 451, 452, 453, 454, + /* 640 */ 455, 391, 457, 181, 182, 367, 368, 462, 398, 464, + /* 650 */ 188, 189, 34, 468, 469, 449, 406, 177, 8, 9, + /* 660 */ 177, 178, 12, 13, 14, 15, 16, 184, 185, 207, + /* 670 */ 33, 269, 107, 14, 269, 447, 491, 0, 0, 20, + /* 680 */ 103, 475, 199, 392, 201, 457, 135, 136, 137, 138, + /* 690 */ 139, 140, 141, 106, 117, 118, 119, 120, 121, 122, + /* 700 */ 123, 124, 125, 126, 391, 128, 129, 130, 131, 132, + /* 710 */ 133, 134, 399, 233, 231, 232, 233, 172, 235, 236, + /* 720 */ 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + /* 730 */ 247, 248, 249, 250, 251, 252, 12, 13, 14, 392, + /* 740 */ 350, 14, 15, 16, 20, 391, 22, 350, 203, 72, + /* 750 */ 73, 74, 398, 363, 231, 365, 79, 80, 81, 35, + /* 760 */ 406, 37, 85, 362, 363, 362, 363, 90, 91, 92, + /* 770 */ 93, 350, 201, 96, 362, 363, 99, 177, 347, 0, + /* 780 */ 42, 391, 269, 382, 363, 382, 365, 392, 64, 253, + /* 790 */ 389, 255, 389, 403, 382, 405, 367, 368, 68, 449, + /* 800 */ 403, 77, 350, 280, 281, 282, 283, 284, 285, 286, + /* 810 */ 426, 392, 391, 8, 9, 431, 391, 12, 13, 14, + /* 820 */ 15, 16, 14, 398, 403, 475, 405, 103, 20, 179, + /* 830 */ 106, 406, 392, 233, 444, 350, 177, 447, 350, 161, + /* 840 */ 450, 451, 452, 453, 454, 455, 391, 457, 170, 362, + /* 850 */ 363, 363, 462, 398, 464, 403, 269, 426, 468, 469, + /* 860 */ 476, 406, 431, 479, 3, 444, 142, 143, 447, 382, + /* 870 */ 392, 450, 451, 452, 453, 454, 455, 426, 457, 391, + /* 880 */ 371, 497, 498, 462, 350, 464, 502, 503, 403, 468, + /* 890 */ 469, 403, 233, 405, 135, 136, 137, 138, 139, 140, + /* 900 */ 141, 177, 178, 362, 363, 383, 397, 476, 184, 185, + /* 910 */ 479, 391, 107, 391, 135, 136, 137, 138, 139, 140, + /* 920 */ 141, 399, 49, 199, 194, 201, 406, 476, 497, 498, + /* 930 */ 479, 294, 444, 502, 503, 447, 0, 403, 450, 451, + /* 940 */ 452, 453, 454, 455, 456, 457, 458, 459, 497, 498, + /* 950 */ 176, 221, 222, 502, 503, 231, 232, 233, 22, 235, + /* 960 */ 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + /* 970 */ 246, 247, 248, 249, 250, 251, 252, 12, 13, 106, + /* 980 */ 350, 362, 363, 22, 426, 20, 37, 22, 350, 1, + /* 990 */ 362, 363, 461, 363, 463, 365, 362, 363, 37, 136, + /* 1000 */ 35, 382, 37, 383, 362, 363, 268, 19, 376, 377, + /* 1010 */ 382, 391, 350, 472, 473, 474, 382, 476, 477, 399, + /* 1020 */ 0, 391, 379, 35, 382, 363, 77, 365, 37, 64, + /* 1030 */ 256, 362, 363, 403, 476, 405, 393, 479, 4, 51, + /* 1040 */ 266, 403, 77, 362, 363, 64, 403, 59, 60, 61, + /* 1050 */ 62, 382, 64, 391, 13, 497, 498, 387, 362, 363, + /* 1060 */ 502, 503, 42, 382, 103, 403, 380, 405, 103, 362, + /* 1070 */ 363, 106, 350, 4, 444, 212, 213, 447, 382, 20, + /* 1080 */ 450, 451, 452, 453, 454, 455, 426, 457, 19, 108, + /* 1090 */ 447, 448, 462, 105, 464, 20, 108, 20, 468, 469, + /* 1100 */ 457, 362, 363, 0, 35, 351, 444, 142, 143, 447, + /* 1110 */ 23, 441, 450, 451, 452, 453, 454, 455, 77, 457, + /* 1120 */ 51, 382, 20, 33, 462, 403, 464, 58, 140, 378, + /* 1130 */ 468, 469, 381, 64, 47, 48, 476, 376, 377, 479, + /* 1140 */ 8, 9, 177, 178, 12, 13, 14, 15, 16, 184, + /* 1150 */ 185, 290, 20, 39, 40, 362, 363, 497, 498, 461, + /* 1160 */ 33, 463, 502, 503, 199, 400, 201, 391, 403, 181, + /* 1170 */ 350, 362, 363, 391, 105, 382, 188, 108, 106, 472, + /* 1180 */ 473, 474, 406, 476, 477, 1, 2, 115, 406, 426, + /* 1190 */ 106, 382, 201, 350, 350, 207, 231, 232, 233, 350, + /* 1200 */ 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, + /* 1210 */ 245, 246, 247, 248, 249, 250, 251, 252, 12, 13, + /* 1220 */ 362, 363, 350, 403, 110, 111, 20, 113, 22, 12, + /* 1230 */ 13, 14, 15, 16, 107, 363, 350, 365, 179, 476, + /* 1240 */ 382, 35, 479, 37, 362, 363, 403, 403, 350, 135, + /* 1250 */ 350, 350, 403, 139, 362, 363, 362, 363, 362, 363, + /* 1260 */ 497, 498, 0, 391, 382, 502, 503, 362, 363, 400, + /* 1270 */ 64, 116, 403, 70, 382, 403, 382, 405, 382, 350, + /* 1280 */ 350, 179, 198, 77, 200, 400, 416, 382, 403, 403, + /* 1290 */ 384, 107, 233, 387, 353, 354, 109, 267, 268, 112, + /* 1300 */ 215, 403, 217, 403, 403, 271, 33, 33, 233, 103, + /* 1310 */ 233, 179, 106, 51, 230, 37, 444, 350, 45, 447, + /* 1320 */ 13, 166, 450, 451, 452, 453, 454, 455, 225, 457, + /* 1330 */ 363, 0, 403, 403, 462, 233, 464, 12, 13, 109, + /* 1340 */ 468, 469, 112, 109, 37, 13, 112, 22, 142, 143, + /* 1350 */ 495, 109, 0, 269, 112, 13, 33, 37, 391, 33, + /* 1360 */ 35, 13, 37, 506, 33, 233, 33, 142, 143, 37, + /* 1370 */ 403, 366, 405, 391, 22, 488, 1, 2, 379, 37, + /* 1380 */ 0, 107, 292, 177, 178, 37, 379, 33, 33, 64, + /* 1390 */ 184, 185, 33, 33, 33, 416, 33, 77, 33, 33, + /* 1400 */ 33, 33, 77, 33, 33, 199, 33, 201, 361, 416, + /* 1410 */ 33, 444, 494, 494, 447, 494, 494, 450, 451, 452, + /* 1420 */ 453, 454, 455, 425, 457, 416, 366, 363, 103, 462, + /* 1430 */ 107, 464, 52, 107, 231, 468, 469, 231, 232, 233, + /* 1440 */ 107, 235, 236, 237, 238, 239, 240, 241, 242, 243, + /* 1450 */ 244, 245, 246, 247, 248, 249, 250, 251, 252, 402, + /* 1460 */ 18, 107, 107, 478, 433, 23, 107, 107, 107, 416, + /* 1470 */ 107, 416, 107, 107, 107, 107, 499, 107, 107, 201, + /* 1480 */ 107, 470, 40, 41, 107, 481, 44, 381, 272, 427, + /* 1490 */ 51, 446, 42, 445, 20, 214, 54, 443, 197, 438, + /* 1500 */ 350, 371, 371, 438, 20, 429, 362, 65, 66, 67, + /* 1510 */ 68, 20, 363, 363, 45, 363, 412, 412, 409, 176, + /* 1520 */ 362, 409, 363, 362, 199, 412, 201, 409, 104, 375, + /* 1530 */ 102, 374, 362, 101, 362, 373, 362, 362, 20, 50, + /* 1540 */ 355, 391, 359, 355, 371, 359, 438, 371, 106, 20, + /* 1550 */ 405, 371, 20, 403, 364, 405, 231, 232, 20, 364, + /* 1560 */ 371, 428, 371, 20, 371, 419, 362, 371, 371, 355, + /* 1570 */ 245, 246, 247, 248, 249, 250, 251, 353, 355, 353, + /* 1580 */ 362, 403, 403, 391, 403, 391, 144, 218, 106, 391, + /* 1590 */ 391, 391, 391, 391, 444, 442, 391, 447, 391, 391, + /* 1600 */ 450, 451, 452, 453, 454, 455, 391, 457, 440, 438, + /* 1610 */ 369, 20, 462, 205, 464, 204, 405, 435, 468, 469, + /* 1620 */ 369, 362, 403, 279, 487, 278, 350, 487, 287, 490, + /* 1630 */ 190, 489, 485, 191, 192, 193, 296, 486, 196, 363, + /* 1640 */ 427, 421, 421, 487, 434, 289, 437, 273, 484, 427, + /* 1650 */ 288, 209, 210, 268, 363, 507, 20, 293, 116, 482, + /* 1660 */ 350, 501, 220, 291, 270, 223, 500, 391, 226, 227, + /* 1670 */ 228, 229, 230, 363, 369, 364, 449, 369, 421, 403, + /* 1680 */ 403, 405, 403, 403, 421, 403, 403, 182, 417, 387, + /* 1690 */ 369, 369, 480, 363, 106, 467, 106, 403, 395, 362, + /* 1700 */ 22, 391, 352, 369, 38, 356, 355, 439, 422, 422, + /* 1710 */ 0, 269, 385, 403, 430, 405, 370, 0, 0, 45, + /* 1720 */ 444, 385, 0, 447, 385, 37, 450, 451, 452, 453, + /* 1730 */ 454, 455, 224, 457, 350, 348, 37, 37, 462, 37, + /* 1740 */ 464, 224, 0, 37, 468, 469, 37, 363, 224, 37, + /* 1750 */ 0, 0, 224, 37, 444, 0, 37, 447, 0, 22, + /* 1760 */ 450, 451, 452, 453, 454, 455, 0, 457, 350, 37, + /* 1770 */ 219, 0, 207, 0, 464, 391, 207, 201, 468, 469, + /* 1780 */ 208, 363, 199, 0, 0, 0, 194, 403, 195, 405, + /* 1790 */ 0, 0, 147, 49, 49, 0, 37, 0, 0, 37, + /* 1800 */ 51, 350, 0, 49, 0, 45, 0, 0, 0, 391, + /* 1810 */ 49, 0, 0, 0, 363, 0, 0, 0, 161, 37, + /* 1820 */ 0, 403, 161, 405, 0, 0, 0, 0, 444, 49, + /* 1830 */ 0, 447, 0, 0, 450, 451, 452, 453, 454, 455, + /* 1840 */ 0, 457, 391, 0, 0, 0, 0, 0, 464, 146, + /* 1850 */ 45, 0, 468, 469, 403, 0, 405, 0, 0, 0, + /* 1860 */ 0, 0, 444, 0, 0, 447, 0, 0, 450, 451, + /* 1870 */ 452, 453, 454, 455, 0, 457, 22, 350, 0, 0, + /* 1880 */ 147, 0, 464, 145, 0, 0, 468, 469, 50, 50, + /* 1890 */ 363, 22, 22, 0, 0, 444, 0, 0, 447, 64, + /* 1900 */ 64, 450, 451, 452, 453, 454, 455, 350, 457, 0, + /* 1910 */ 37, 0, 64, 37, 37, 0, 51, 42, 391, 51, + /* 1920 */ 363, 0, 42, 37, 0, 42, 37, 14, 33, 0, + /* 1930 */ 403, 0, 405, 51, 42, 45, 0, 49, 0, 0, + /* 1940 */ 49, 0, 43, 42, 42, 0, 190, 49, 391, 49, + /* 1950 */ 0, 0, 0, 37, 51, 504, 505, 0, 51, 42, + /* 1960 */ 403, 42, 405, 37, 0, 37, 0, 42, 0, 51, + /* 1970 */ 37, 444, 42, 51, 447, 71, 0, 450, 451, 452, + /* 1980 */ 453, 454, 455, 0, 457, 350, 0, 0, 0, 22, + /* 1990 */ 37, 464, 0, 37, 33, 37, 469, 37, 363, 37, + /* 2000 */ 37, 444, 350, 33, 447, 0, 37, 450, 451, 452, + /* 2010 */ 453, 454, 455, 22, 457, 363, 37, 112, 37, 350, + /* 2020 */ 22, 37, 114, 0, 22, 53, 391, 37, 0, 22, + /* 2030 */ 37, 396, 363, 37, 0, 0, 0, 37, 403, 0, + /* 2040 */ 405, 37, 0, 391, 22, 20, 37, 37, 396, 37, + /* 2050 */ 493, 107, 106, 0, 106, 403, 206, 405, 0, 22, + /* 2060 */ 391, 37, 49, 0, 202, 22, 0, 0, 3, 50, + /* 2070 */ 274, 33, 403, 33, 405, 274, 50, 106, 104, 444, + /* 2080 */ 107, 106, 447, 33, 350, 450, 451, 452, 453, 454, + /* 2090 */ 455, 179, 457, 179, 33, 106, 444, 363, 49, 447, + /* 2100 */ 49, 107, 450, 451, 452, 453, 454, 455, 102, 457, + /* 2110 */ 107, 179, 33, 444, 350, 107, 447, 182, 107, 450, + /* 2120 */ 451, 452, 453, 454, 455, 391, 457, 363, 179, 186, + /* 2130 */ 3, 33, 37, 179, 107, 106, 106, 403, 106, 405, + /* 2140 */ 37, 186, 37, 37, 37, 274, 37, 33, 107, 49, + /* 2150 */ 49, 107, 0, 0, 106, 391, 0, 42, 106, 42, + /* 2160 */ 396, 107, 107, 106, 33, 496, 106, 403, 183, 405, + /* 2170 */ 106, 115, 49, 104, 106, 104, 181, 267, 444, 350, + /* 2180 */ 2, 447, 22, 106, 450, 451, 452, 453, 454, 455, + /* 2190 */ 231, 457, 363, 107, 254, 106, 49, 107, 106, 350, + /* 2200 */ 107, 107, 106, 49, 22, 106, 37, 116, 444, 107, + /* 2210 */ 106, 447, 363, 37, 450, 451, 452, 453, 454, 455, + /* 2220 */ 391, 457, 350, 107, 106, 37, 106, 37, 107, 107, + /* 2230 */ 106, 234, 403, 37, 405, 363, 106, 350, 37, 505, + /* 2240 */ 391, 107, 106, 37, 107, 396, 127, 106, 106, 33, + /* 2250 */ 363, 106, 403, 127, 405, 127, 350, 37, 22, 127, + /* 2260 */ 71, 106, 70, 391, 37, 37, 37, 37, 396, 363, + /* 2270 */ 77, 37, 37, 444, 37, 403, 447, 405, 391, 450, + /* 2280 */ 451, 452, 453, 454, 455, 37, 457, 37, 459, 77, + /* 2290 */ 403, 100, 405, 444, 100, 33, 447, 391, 37, 450, + /* 2300 */ 451, 452, 453, 454, 455, 37, 457, 37, 22, 403, + /* 2310 */ 37, 405, 37, 0, 37, 77, 444, 37, 37, 447, + /* 2320 */ 37, 37, 450, 451, 452, 453, 454, 455, 22, 457, + /* 2330 */ 350, 444, 37, 37, 447, 37, 51, 450, 451, 452, + /* 2340 */ 453, 454, 455, 363, 457, 42, 0, 37, 51, 350, + /* 2350 */ 444, 42, 0, 447, 37, 51, 450, 451, 452, 453, + /* 2360 */ 454, 455, 363, 457, 42, 350, 0, 37, 42, 51, + /* 2370 */ 0, 391, 37, 37, 0, 22, 33, 22, 363, 21, + /* 2380 */ 508, 22, 22, 403, 21, 405, 508, 20, 508, 508, + /* 2390 */ 391, 508, 508, 508, 508, 508, 508, 508, 508, 508, + /* 2400 */ 508, 508, 403, 508, 405, 508, 391, 508, 508, 508, + /* 2410 */ 508, 508, 508, 508, 508, 508, 508, 508, 403, 508, + /* 2420 */ 405, 508, 508, 350, 444, 508, 508, 447, 508, 508, + /* 2430 */ 450, 451, 452, 453, 454, 455, 363, 457, 508, 508, + /* 2440 */ 508, 508, 508, 444, 508, 508, 447, 350, 508, 450, + /* 2450 */ 451, 452, 453, 454, 455, 508, 457, 508, 508, 444, + /* 2460 */ 363, 508, 447, 508, 391, 450, 451, 452, 453, 454, + /* 2470 */ 455, 508, 457, 508, 508, 508, 403, 508, 405, 508, + /* 2480 */ 508, 508, 508, 508, 508, 508, 508, 508, 391, 508, + /* 2490 */ 350, 508, 508, 508, 508, 508, 508, 508, 508, 508, + /* 2500 */ 403, 508, 405, 363, 508, 508, 508, 508, 508, 508, + /* 2510 */ 508, 508, 508, 508, 508, 508, 350, 444, 508, 508, + /* 2520 */ 447, 508, 508, 450, 451, 452, 453, 454, 455, 363, + /* 2530 */ 457, 391, 508, 508, 508, 508, 508, 508, 508, 508, + /* 2540 */ 508, 444, 508, 403, 447, 405, 508, 450, 451, 452, + /* 2550 */ 453, 454, 455, 508, 457, 508, 508, 391, 508, 350, + /* 2560 */ 508, 508, 508, 508, 508, 508, 508, 508, 508, 403, + /* 2570 */ 508, 405, 363, 508, 508, 508, 508, 508, 508, 508, + /* 2580 */ 508, 508, 508, 350, 444, 508, 508, 447, 508, 508, + /* 2590 */ 450, 451, 452, 453, 454, 455, 363, 457, 508, 508, + /* 2600 */ 391, 508, 508, 508, 508, 508, 508, 508, 508, 508, + /* 2610 */ 444, 508, 403, 447, 405, 508, 450, 451, 452, 453, + /* 2620 */ 454, 455, 508, 457, 391, 508, 350, 508, 508, 508, + /* 2630 */ 508, 508, 508, 508, 508, 508, 403, 508, 405, 363, + /* 2640 */ 508, 350, 508, 508, 508, 508, 508, 508, 508, 508, + /* 2650 */ 508, 508, 508, 444, 363, 508, 447, 350, 508, 450, + /* 2660 */ 451, 452, 453, 454, 455, 508, 457, 391, 508, 508, + /* 2670 */ 363, 508, 508, 508, 508, 508, 508, 444, 508, 403, + /* 2680 */ 447, 405, 391, 450, 451, 452, 453, 454, 455, 508, + /* 2690 */ 457, 508, 508, 508, 403, 508, 405, 508, 391, 508, + /* 2700 */ 508, 508, 508, 508, 508, 508, 508, 508, 508, 508, + /* 2710 */ 403, 508, 405, 508, 508, 508, 508, 508, 508, 508, + /* 2720 */ 444, 508, 508, 447, 508, 508, 450, 451, 452, 453, + /* 2730 */ 454, 455, 508, 457, 350, 444, 508, 508, 447, 508, + /* 2740 */ 508, 450, 451, 452, 453, 454, 455, 363, 457, 508, + /* 2750 */ 508, 444, 508, 350, 447, 508, 508, 450, 451, 452, + /* 2760 */ 453, 454, 455, 508, 457, 508, 363, 508, 508, 350, + /* 2770 */ 508, 508, 508, 508, 508, 391, 508, 508, 508, 508, + /* 2780 */ 508, 508, 363, 508, 508, 508, 508, 403, 508, 405, + /* 2790 */ 508, 508, 508, 508, 391, 508, 508, 508, 508, 508, + /* 2800 */ 508, 508, 508, 508, 508, 508, 403, 508, 405, 508, + /* 2810 */ 391, 508, 508, 508, 508, 508, 508, 508, 508, 508, + /* 2820 */ 508, 508, 403, 508, 405, 508, 508, 350, 444, 508, + /* 2830 */ 508, 447, 508, 508, 450, 451, 452, 453, 454, 455, + /* 2840 */ 363, 457, 508, 508, 508, 508, 508, 444, 508, 508, + /* 2850 */ 447, 350, 508, 450, 451, 452, 453, 454, 455, 508, + /* 2860 */ 457, 508, 508, 444, 363, 508, 447, 508, 391, 450, + /* 2870 */ 451, 452, 453, 454, 455, 508, 457, 508, 508, 508, + /* 2880 */ 403, 508, 405, 508, 508, 508, 508, 508, 508, 508, + /* 2890 */ 508, 508, 391, 508, 350, 508, 508, 508, 508, 508, + /* 2900 */ 508, 508, 508, 508, 403, 508, 405, 363, 508, 508, + /* 2910 */ 508, 508, 508, 508, 508, 508, 508, 508, 508, 508, + /* 2920 */ 350, 444, 508, 508, 447, 508, 508, 450, 451, 452, + /* 2930 */ 453, 454, 455, 363, 457, 391, 508, 508, 508, 508, + /* 2940 */ 508, 508, 508, 508, 508, 444, 508, 403, 447, 405, + /* 2950 */ 508, 450, 451, 452, 453, 454, 455, 508, 457, 508, + /* 2960 */ 508, 391, 508, 350, 508, 508, 508, 508, 508, 508, + /* 2970 */ 508, 508, 508, 403, 508, 405, 363, 508, 508, 508, + /* 2980 */ 508, 508, 508, 508, 508, 508, 508, 508, 444, 508, + /* 2990 */ 508, 447, 508, 508, 450, 451, 452, 453, 454, 455, + /* 3000 */ 508, 457, 508, 508, 391, 508, 508, 508, 508, 508, + /* 3010 */ 508, 508, 508, 508, 444, 508, 403, 447, 405, 508, + /* 3020 */ 450, 451, 452, 453, 454, 455, 508, 457, 508, 508, + /* 3030 */ 508, 508, 508, 508, 508, 508, 508, 508, 508, 508, + /* 3040 */ 508, 508, 508, 508, 508, 508, 508, 508, 508, 508, + /* 3050 */ 508, 508, 508, 508, 508, 508, 508, 444, 508, 508, + /* 3060 */ 447, 508, 508, 450, 451, 452, 453, 454, 455, 508, + /* 3070 */ 457, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3080 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3090 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3100 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3110 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3120 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3130 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3140 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3150 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3160 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3170 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3180 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3190 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3200 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3210 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3220 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3230 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3240 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3250 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3260 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3270 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3280 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3290 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3300 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3310 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3320 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3330 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3340 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3350 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3360 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3370 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3380 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3390 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3400 */ 347, 347, 347, 347, 347, 347, 347, 347, 347, 347, + /* 3410 */ 347, 347, 347, 347, 347, 347, 347, 347, }; -#define YY_SHIFT_COUNT (834) +#define YY_SHIFT_COUNT (839) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2381) +#define YY_SHIFT_MAX (2374) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 391, 0, 240, 0, 481, 481, 481, 481, 481, 481, - /* 10 */ 481, 481, 481, 481, 481, 481, 721, 961, 961, 1201, - /* 20 */ 961, 961, 961, 961, 961, 961, 961, 961, 961, 961, - /* 30 */ 961, 961, 961, 961, 961, 961, 961, 961, 961, 961, - /* 40 */ 961, 961, 961, 961, 961, 961, 961, 961, 961, 961, - /* 50 */ 961, 93, 162, 152, 47, 278, 343, 278, 278, 47, - /* 60 */ 47, 278, 1319, 278, 239, 1319, 1319, 281, 278, 28, - /* 70 */ 595, 67, 67, 931, 931, 595, 87, 291, 126, 126, - /* 80 */ 173, 67, 67, 67, 67, 67, 67, 67, 67, 67, - /* 90 */ 67, 67, 317, 492, 67, 67, 187, 28, 67, 317, - /* 100 */ 67, 28, 67, 67, 28, 67, 67, 28, 67, 28, - /* 110 */ 28, 28, 67, 368, 439, 439, 242, 546, 569, 569, - /* 120 */ 569, 569, 569, 569, 569, 569, 569, 569, 569, 569, - /* 130 */ 569, 569, 569, 569, 569, 569, 569, 189, 602, 87, - /* 140 */ 291, 1024, 1024, 150, 268, 268, 268, 678, 336, 336, - /* 150 */ 91, 150, 187, 486, 28, 28, 633, 28, 813, 28, - /* 160 */ 813, 813, 823, 959, 89, 89, 89, 89, 89, 89, - /* 170 */ 89, 89, 504, 441, 65, 453, 15, 313, 606, 19, - /* 180 */ 322, 516, 3, 3, 527, 983, 770, 303, 303, 303, - /* 190 */ 502, 303, 800, 1100, 1, 725, 618, 650, 1, 1, - /* 200 */ 808, 1009, 538, 988, 1009, 1261, 1056, 91, 1196, 1422, - /* 210 */ 1439, 1470, 1289, 187, 1470, 187, 1309, 1487, 1489, 1466, - /* 220 */ 1489, 1466, 1339, 1487, 1489, 1487, 1466, 1339, 1339, 1423, - /* 230 */ 1426, 1487, 1430, 1487, 1487, 1487, 1517, 1490, 1517, 1490, - /* 240 */ 1470, 187, 187, 1528, 187, 1532, 1535, 187, 1532, 187, - /* 250 */ 1539, 187, 187, 1487, 187, 1517, 28, 28, 28, 28, - /* 260 */ 28, 28, 28, 28, 28, 28, 28, 1487, 959, 959, - /* 270 */ 1517, 813, 813, 813, 1386, 1469, 1470, 368, 1597, 1416, - /* 280 */ 1418, 1528, 368, 1196, 1487, 813, 1350, 1352, 1350, 1352, - /* 290 */ 1344, 1448, 1350, 1362, 1370, 1393, 1196, 1368, 1377, 1383, - /* 300 */ 1407, 1489, 1657, 1568, 1419, 1532, 368, 368, 1352, 813, - /* 310 */ 813, 813, 813, 1352, 813, 1536, 368, 823, 368, 1489, - /* 320 */ 1616, 1620, 813, 1487, 368, 1713, 1698, 1517, 3178, 3178, - /* 330 */ 3178, 3178, 3178, 3178, 3178, 3178, 3178, 36, 881, 786, - /* 340 */ 30, 825, 1043, 1063, 625, 413, 661, 1103, 877, 1271, - /* 350 */ 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 635, 716, - /* 360 */ 318, 363, 363, 355, 358, 445, 870, 867, 1146, 1202, - /* 370 */ 1006, 1021, 1021, 1211, 1183, 382, 1211, 1211, 1211, 1288, - /* 380 */ 1106, 462, 1066, 1265, 1180, 1291, 1190, 1216, 1226, 1228, - /* 390 */ 677, 1310, 1292, 1336, 1357, 974, 1267, 1347, 477, 1348, - /* 400 */ 1349, 1353, 1221, 417, 8, 1354, 1356, 1358, 1359, 1361, - /* 410 */ 1364, 1367, 1378, 714, 1379, 155, 1381, 1384, 1385, 1388, - /* 420 */ 1390, 1391, 1287, 1213, 1225, 1363, 1382, 1051, 1083, 1752, - /* 430 */ 1753, 1765, 1722, 1769, 1733, 1548, 1737, 1738, 1739, 1554, - /* 440 */ 1778, 1743, 1744, 1559, 1746, 1784, 1563, 1789, 1760, 1799, - /* 450 */ 1779, 1805, 1766, 1588, 1808, 1603, 1810, 1605, 1606, 1612, - /* 460 */ 1617, 1814, 1816, 1817, 1624, 1627, 1822, 1823, 1677, 1776, - /* 470 */ 1777, 1827, 1792, 1780, 1830, 1783, 1835, 1791, 1837, 1838, - /* 480 */ 1839, 1795, 1841, 1845, 1847, 1848, 1855, 1857, 1697, 1824, - /* 490 */ 1859, 1701, 1864, 1865, 1872, 1874, 1875, 1876, 1877, 1878, - /* 500 */ 1879, 1882, 1883, 1893, 1895, 1896, 1897, 1898, 1900, 1852, - /* 510 */ 1902, 1860, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1892, - /* 520 */ 1915, 1770, 1916, 1772, 1919, 1775, 1921, 1922, 1901, 1881, - /* 530 */ 1903, 1884, 1924, 1869, 1891, 1929, 1871, 1936, 1873, 1938, - /* 540 */ 1940, 1905, 1894, 1904, 1943, 1913, 1914, 1918, 1947, 1925, - /* 550 */ 1920, 1927, 1948, 1926, 1949, 1928, 1930, 1923, 1933, 1935, - /* 560 */ 1937, 1946, 1952, 1931, 1934, 1953, 1955, 1958, 1961, 1950, - /* 570 */ 1781, 1964, 1933, 1951, 1967, 1975, 1932, 1977, 1978, 1942, - /* 580 */ 1945, 1956, 2001, 1965, 1954, 1962, 2006, 1971, 1960, 1970, - /* 590 */ 2009, 1982, 1972, 1979, 2024, 2025, 2026, 2027, 2028, 2029, - /* 600 */ 1917, 1941, 1993, 2010, 2033, 2000, 2002, 2003, 2005, 2013, - /* 610 */ 2015, 2018, 2019, 2030, 2031, 2020, 2021, 2037, 2023, 2035, - /* 620 */ 2039, 2043, 2040, 2012, 2066, 2046, 2032, 2070, 2071, 2072, - /* 630 */ 2036, 2074, 2050, 2076, 2055, 2060, 2052, 2054, 2056, 1987, - /* 640 */ 1990, 2097, 1939, 1992, 1899, 1933, 2053, 2099, 1963, 2064, - /* 650 */ 2081, 2105, 1944, 2084, 1966, 1957, 2108, 2118, 1968, 1984, - /* 660 */ 1969, 1985, 2107, 2078, 1840, 2008, 2016, 2022, 2062, 2011, - /* 670 */ 2069, 2038, 2017, 2083, 2088, 2042, 2047, 2058, 2061, 2059, - /* 680 */ 2092, 2077, 2080, 2065, 2094, 1858, 2067, 2082, 2127, 2100, - /* 690 */ 1866, 2106, 2123, 2125, 2135, 2148, 2150, 2087, 2089, 2093, - /* 700 */ 1994, 2158, 2146, 2197, 2199, 2095, 2160, 2098, 2096, 2101, - /* 710 */ 2103, 2104, 2051, 2109, 2200, 2164, 2034, 2112, 2113, 1933, - /* 720 */ 2162, 2179, 2116, 1983, 2117, 2211, 2210, 2041, 2137, 2138, - /* 730 */ 2141, 2143, 2145, 2154, 2213, 2157, 2159, 2215, 2161, 2244, - /* 740 */ 2044, 2163, 2151, 2166, 2237, 2238, 2172, 2173, 2242, 2175, - /* 750 */ 2176, 2245, 2178, 2180, 2248, 2183, 2184, 2249, 2186, 2187, - /* 760 */ 2256, 2189, 2169, 2170, 2171, 2174, 2193, 2267, 2196, 2266, - /* 770 */ 2198, 2267, 2267, 2283, 2236, 2239, 2269, 2271, 2275, 2276, - /* 780 */ 2278, 2279, 2286, 2288, 2289, 2233, 2227, 2251, 2231, 2300, - /* 790 */ 2297, 2304, 2307, 2323, 2309, 2311, 2312, 2274, 2030, 2313, - /* 800 */ 2031, 2315, 2316, 2317, 2318, 2334, 2320, 2358, 2322, 2310, - /* 810 */ 2324, 2362, 2327, 2314, 2325, 2368, 2332, 2319, 2331, 2372, - /* 820 */ 2337, 2326, 2333, 2378, 2342, 2343, 2381, 2360, 2351, 2364, - /* 830 */ 2366, 2367, 2369, 2371, 2370, + /* 0 */ 1442, 0, 241, 0, 483, 483, 483, 483, 483, 483, + /* 10 */ 483, 483, 483, 483, 483, 483, 724, 965, 965, 1206, + /* 20 */ 965, 965, 965, 965, 965, 965, 965, 965, 965, 965, + /* 30 */ 965, 965, 965, 965, 965, 965, 965, 965, 965, 965, + /* 40 */ 965, 965, 965, 965, 965, 965, 965, 965, 965, 965, + /* 50 */ 965, 167, 402, 1084, 251, 405, 587, 405, 405, 251, + /* 60 */ 251, 405, 1325, 405, 240, 1325, 1325, 513, 405, 5, + /* 70 */ 170, 171, 171, 160, 160, 170, 78, 39, 295, 295, + /* 80 */ 326, 171, 171, 171, 171, 171, 171, 171, 171, 171, + /* 90 */ 171, 171, 261, 355, 171, 171, 91, 5, 171, 261, + /* 100 */ 171, 5, 171, 171, 5, 171, 171, 5, 171, 5, + /* 110 */ 5, 5, 171, 400, 202, 202, 465, 198, 118, 118, + /* 120 */ 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, + /* 130 */ 118, 118, 118, 118, 118, 118, 118, 1114, 200, 78, + /* 140 */ 39, 515, 515, 949, 415, 415, 415, 364, 536, 536, + /* 150 */ 1041, 949, 91, 307, 5, 5, 262, 5, 376, 5, + /* 160 */ 376, 376, 506, 618, 577, 577, 577, 577, 577, 577, + /* 170 */ 577, 577, 988, 677, 65, 1132, 66, 523, 242, 76, + /* 180 */ 600, 659, 571, 571, 1059, 1087, 1102, 246, 246, 246, + /* 190 */ 327, 246, 480, 575, 1075, 808, 204, 545, 1075, 1075, + /* 200 */ 1077, 1030, 738, 861, 1030, 530, 1034, 1041, 1216, 1439, + /* 210 */ 1450, 1474, 1281, 91, 1474, 91, 1301, 1484, 1491, 1469, + /* 220 */ 1491, 1469, 1343, 1484, 1491, 1484, 1469, 1343, 1343, 1424, + /* 230 */ 1428, 1484, 1432, 1484, 1484, 1484, 1518, 1489, 1518, 1489, + /* 240 */ 1474, 91, 91, 1529, 91, 1532, 1538, 91, 1532, 91, + /* 250 */ 1543, 91, 91, 1484, 91, 1518, 5, 5, 5, 5, + /* 260 */ 5, 5, 5, 5, 5, 5, 5, 1484, 618, 618, + /* 270 */ 1518, 376, 376, 376, 1369, 1482, 1474, 400, 1591, 1408, + /* 280 */ 1411, 1529, 400, 1216, 1484, 376, 1344, 1347, 1344, 1347, + /* 290 */ 1341, 1440, 1344, 1356, 1362, 1374, 1216, 1340, 1364, 1372, + /* 300 */ 1385, 1491, 1636, 1542, 1394, 1532, 400, 400, 1347, 376, + /* 310 */ 376, 376, 376, 1347, 376, 1505, 400, 506, 400, 1491, + /* 320 */ 1588, 1590, 376, 1484, 400, 1678, 1666, 1518, 3071, 3071, + /* 330 */ 3071, 3071, 3071, 3071, 3071, 3071, 3071, 36, 462, 306, + /* 340 */ 565, 1069, 435, 805, 551, 15, 30, 650, 779, 40, + /* 350 */ 40, 40, 40, 40, 40, 40, 40, 40, 759, 151, + /* 360 */ 416, 1217, 1217, 730, 461, 457, 468, 678, 479, 961, + /* 370 */ 863, 334, 334, 727, 1184, 774, 727, 727, 727, 1262, + /* 380 */ 1103, 503, 1020, 1273, 1155, 1331, 1187, 1230, 1234, 1242, + /* 390 */ 1307, 1332, 388, 936, 1352, 1085, 1127, 1323, 981, 1326, + /* 400 */ 1333, 1354, 1225, 1090, 637, 1355, 1359, 1360, 1361, 1363, + /* 410 */ 1365, 1375, 1366, 1203, 1274, 873, 1367, 1368, 1370, 1371, + /* 420 */ 1373, 1377, 1072, 991, 1278, 1342, 1348, 1320, 1380, 1710, + /* 430 */ 1717, 1718, 1674, 1722, 1688, 1508, 1699, 1700, 1702, 1517, + /* 440 */ 1742, 1706, 1709, 1524, 1712, 1750, 1528, 1751, 1716, 1755, + /* 450 */ 1719, 1758, 1737, 1766, 1732, 1551, 1771, 1565, 1773, 1569, + /* 460 */ 1572, 1576, 1583, 1783, 1784, 1785, 1593, 1592, 1790, 1791, + /* 470 */ 1645, 1744, 1745, 1795, 1759, 1797, 1798, 1762, 1749, 1802, + /* 480 */ 1754, 1804, 1760, 1806, 1807, 1808, 1761, 1811, 1812, 1813, + /* 490 */ 1815, 1816, 1817, 1657, 1782, 1820, 1661, 1824, 1825, 1826, + /* 500 */ 1827, 1832, 1833, 1840, 1843, 1844, 1845, 1846, 1847, 1855, + /* 510 */ 1857, 1858, 1859, 1860, 1780, 1830, 1805, 1851, 1861, 1863, + /* 520 */ 1864, 1866, 1867, 1874, 1854, 1878, 1733, 1879, 1703, 1881, + /* 530 */ 1738, 1884, 1885, 1869, 1838, 1870, 1839, 1893, 1835, 1873, + /* 540 */ 1894, 1836, 1896, 1848, 1897, 1909, 1876, 1865, 1875, 1911, + /* 550 */ 1877, 1868, 1880, 1915, 1886, 1882, 1883, 1921, 1889, 1924, + /* 560 */ 1890, 1892, 1895, 1888, 1891, 1913, 1898, 1929, 1899, 1901, + /* 570 */ 1931, 1936, 1938, 1939, 1902, 1756, 1941, 1888, 1900, 1945, + /* 580 */ 1950, 1904, 1951, 1952, 1916, 1903, 1917, 1957, 1926, 1907, + /* 590 */ 1919, 1964, 1928, 1918, 1925, 1966, 1933, 1922, 1930, 1968, + /* 600 */ 1976, 1983, 1986, 1987, 1988, 1908, 1905, 1953, 1967, 1992, + /* 610 */ 1956, 1958, 1960, 1962, 1963, 1969, 1979, 1981, 1961, 1970, + /* 620 */ 1984, 1990, 1991, 1993, 2005, 1998, 2023, 2002, 1972, 2028, + /* 630 */ 2007, 1996, 2034, 2035, 2036, 2000, 2039, 2004, 2042, 2022, + /* 640 */ 2025, 2009, 2010, 2012, 1944, 1946, 2053, 1912, 1948, 1850, + /* 650 */ 1888, 2013, 2058, 1914, 2024, 2037, 2063, 1862, 2043, 1932, + /* 660 */ 1935, 2066, 2067, 1949, 1943, 1954, 1955, 2065, 2038, 1796, + /* 670 */ 1971, 1973, 1975, 2019, 1974, 2026, 2006, 1994, 2040, 2050, + /* 680 */ 2003, 1989, 2029, 2030, 2008, 2061, 2049, 2051, 2032, 2079, + /* 690 */ 1801, 2011, 2027, 2127, 2098, 1871, 2095, 2103, 2105, 2106, + /* 700 */ 2107, 2109, 2041, 2044, 2100, 1910, 2114, 2101, 2152, 2153, + /* 710 */ 2048, 2115, 2052, 2054, 2055, 2057, 2060, 1985, 2064, 2156, + /* 720 */ 2117, 1995, 2068, 2056, 1888, 2123, 2131, 2069, 1940, 2071, + /* 730 */ 2178, 2160, 1959, 2077, 2086, 2089, 2090, 2092, 2093, 2147, + /* 740 */ 2096, 2099, 2154, 2094, 2182, 1997, 2104, 2091, 2102, 2169, + /* 750 */ 2176, 2118, 2116, 2188, 2120, 2121, 2190, 2124, 2122, 2196, + /* 760 */ 2130, 2134, 2201, 2136, 2137, 2206, 2141, 2119, 2126, 2128, + /* 770 */ 2132, 2142, 2216, 2145, 2220, 2155, 2216, 2216, 2236, 2189, + /* 780 */ 2192, 2227, 2228, 2229, 2230, 2234, 2235, 2237, 2248, 2250, + /* 790 */ 2193, 2191, 2212, 2194, 2262, 2261, 2268, 2270, 2286, 2273, + /* 800 */ 2275, 2277, 2238, 1961, 2280, 1970, 2281, 2283, 2284, 2295, + /* 810 */ 2306, 2296, 2313, 2298, 2285, 2303, 2346, 2310, 2297, 2309, + /* 820 */ 2352, 2317, 2304, 2322, 2366, 2330, 2318, 2326, 2370, 2335, + /* 830 */ 2336, 2374, 2353, 2343, 2355, 2358, 2359, 2360, 2363, 2367, }; #define YY_REDUCE_COUNT (336) -#define YY_REDUCE_MIN (-423) -#define YY_REDUCE_MAX (2721) +#define YY_REDUCE_MIN (-430) +#define YY_REDUCE_MAX (2613) static const short yy_reduce_ofst[] = { - /* 0 */ -149, -302, 387, 199, 419, 646, 680, 866, 899, 1026, - /* 10 */ 457, 1134, 1192, 1229, 1262, 1305, -84, 1342, 1400, 1417, - /* 20 */ 1438, 1537, 1564, 1595, 1632, 1705, 1730, 1773, 1803, 1788, - /* 30 */ 1868, 1886, 1981, 1998, 2014, 2091, 2110, 2177, 2206, 2235, - /* 40 */ 2273, 2330, 2348, 2405, 2425, 2441, 2540, 2556, 2623, 2638, - /* 50 */ 2721, -189, -339, -423, 163, -421, 525, 676, 685, 279, - /* 60 */ 321, 744, -176, -311, -308, 536, 787, 674, 756, -379, - /* 70 */ -248, -356, -192, -288, 4, -244, -329, 39, 181, 383, - /* 80 */ -306, -312, -31, 138, 198, -328, -137, 246, 325, 426, - /* 90 */ 464, -107, 75, -223, 470, 531, -91, 491, 623, 443, - /* 100 */ 626, 494, 658, 662, -381, 673, 684, 600, 712, 476, - /* 110 */ 604, 651, 724, 236, -54, -54, -371, 282, 115, 305, - /* 120 */ 393, 433, 454, 493, 545, 573, 578, 597, 772, 778, - /* 130 */ 818, 845, 880, 893, 895, 906, 911, 161, -293, -123, - /* 140 */ 398, 535, 773, 561, -293, -129, 360, 300, 455, 704, - /* 150 */ -318, 749, -98, 116, 266, 544, 694, 861, 833, 847, - /* 160 */ 865, 872, 883, 920, 620, 656, 703, 755, 863, 902, - /* 170 */ 930, 863, 785, -369, 1011, 896, 854, 871, 1005, 884, - /* 180 */ 982, 982, 995, 1020, 989, 1045, 991, 910, 914, 915, - /* 190 */ 985, 917, 982, 1050, 1012, 1058, 1025, 997, 1019, 1038, - /* 200 */ 982, 980, 980, 960, 980, 990, 984, 1082, 1044, 1029, - /* 210 */ 1040, 1062, 1059, 1130, 1067, 1133, 1078, 1147, 1148, 1101, - /* 220 */ 1151, 1104, 1108, 1157, 1158, 1160, 1111, 1115, 1117, 1152, - /* 230 */ 1156, 1169, 1161, 1171, 1173, 1174, 1185, 1184, 1189, 1186, - /* 240 */ 1109, 1175, 1177, 1149, 1181, 1193, 1131, 1187, 1197, 1191, - /* 250 */ 1144, 1200, 1203, 1210, 1204, 1218, 1199, 1208, 1209, 1214, - /* 260 */ 1215, 1217, 1219, 1220, 1222, 1223, 1224, 1231, 1227, 1241, - /* 270 */ 1246, 1179, 1206, 1230, 1135, 1167, 1178, 1248, 1182, 1188, - /* 280 */ 1194, 1232, 1255, 1235, 1264, 1237, 1140, 1236, 1154, 1238, - /* 290 */ 1145, 1159, 1163, 1166, 1205, 1207, 1242, 1164, 1162, 1172, - /* 300 */ 980, 1314, 1239, 1212, 1240, 1323, 1326, 1330, 1279, 1298, - /* 310 */ 1299, 1300, 1301, 1286, 1308, 1304, 1355, 1335, 1360, 1365, - /* 320 */ 1258, 1337, 1331, 1373, 1369, 1387, 1392, 1389, 1311, 1303, - /* 330 */ 1318, 1321, 1366, 1376, 1380, 1394, 1398, + /* 0 */ 431, -303, 149, 185, -23, 390, 421, 630, 662, 872, + /* 10 */ 967, 1150, 1276, 1310, 1384, 1418, 488, -81, 1451, 1527, + /* 20 */ 1557, 1635, 1652, 1669, 1734, 1764, 1829, 1849, 1872, 1887, + /* 30 */ 1906, 1980, 1999, 2015, 2073, 2097, 2140, 2166, 2209, 2233, + /* 40 */ 2276, 2291, 2307, 2384, 2403, 2419, 2477, 2501, 2544, 2570, + /* 50 */ 2613, -305, -202, 384, -187, 31, 451, 558, 660, 541, + /* 60 */ 707, 763, 643, -340, -341, -99, 228, -177, 89, -380, + /* 70 */ -211, 401, 403, -356, -351, -390, -330, -333, -257, 140, + /* 80 */ -218, 412, 487, 619, 628, -312, -225, 634, 669, 681, + /* 90 */ 696, -97, 179, -2, 739, 793, -284, 250, 642, 187, + /* 100 */ 809, 354, 858, 882, -383, 892, 894, 425, 896, 522, + /* 110 */ 455, 620, 905, -66, -425, -425, -296, -149, 35, 159, + /* 120 */ 182, 397, 452, 485, 534, 638, 722, 820, 843, 844, + /* 130 */ 849, 886, 898, 900, 901, 929, 930, -61, -270, -245, + /* 140 */ -342, 278, 429, 632, -270, 206, 350, 12, 531, 698, + /* 150 */ 751, 761, 509, 670, 520, 776, -307, 313, 765, 782, + /* 160 */ 869, 885, 906, 941, -385, 291, 347, 395, 419, 440, + /* 170 */ 478, 419, -430, 686, 754, 870, 857, 855, 1005, 887, + /* 180 */ 982, 982, 999, 1007, 979, 1047, 993, 918, 919, 921, + /* 190 */ 998, 922, 982, 1060, 1009, 1064, 1057, 1031, 1053, 1055, + /* 200 */ 982, 985, 985, 977, 985, 1011, 1004, 1106, 1062, 1045, + /* 210 */ 1048, 1061, 1054, 1130, 1065, 1131, 1076, 1144, 1149, 1104, + /* 220 */ 1152, 1105, 1109, 1158, 1159, 1161, 1113, 1112, 1118, 1154, + /* 230 */ 1157, 1170, 1162, 1172, 1174, 1175, 1185, 1183, 1188, 1186, + /* 240 */ 1108, 1173, 1176, 1145, 1180, 1190, 1133, 1189, 1195, 1191, + /* 250 */ 1146, 1193, 1196, 1204, 1197, 1214, 1192, 1194, 1198, 1199, + /* 260 */ 1200, 1201, 1202, 1205, 1207, 1208, 1215, 1218, 1224, 1226, + /* 270 */ 1223, 1178, 1179, 1181, 1153, 1168, 1171, 1241, 1209, 1182, + /* 280 */ 1210, 1211, 1251, 1213, 1259, 1219, 1137, 1220, 1140, 1221, + /* 290 */ 1139, 1142, 1156, 1151, 1147, 1164, 1222, 1148, 1160, 1166, + /* 300 */ 985, 1291, 1227, 1177, 1212, 1311, 1305, 1308, 1257, 1277, + /* 310 */ 1279, 1280, 1282, 1263, 1283, 1271, 1321, 1302, 1322, 1330, + /* 320 */ 1228, 1303, 1294, 1337, 1334, 1350, 1349, 1351, 1284, 1268, + /* 330 */ 1286, 1287, 1327, 1336, 1339, 1346, 1387, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 10 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 20 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 30 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 40 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 50 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 60 */ 1876, 2209, 1876, 1876, 2172, 1876, 1876, 1876, 1876, 1876, - /* 70 */ 1876, 1876, 1876, 1876, 1876, 1876, 2179, 1876, 1876, 1876, - /* 80 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 90 */ 1876, 1876, 1876, 1876, 1876, 1876, 1973, 1876, 1876, 1876, - /* 100 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 110 */ 1876, 1876, 1876, 1971, 2411, 1876, 1876, 1876, 1876, 1876, - /* 120 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 130 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 2423, 1876, - /* 140 */ 1876, 1947, 1947, 1876, 2423, 2423, 2423, 1971, 2383, 2383, - /* 150 */ 1876, 1876, 1973, 2247, 1876, 1876, 1876, 1876, 1876, 1876, - /* 160 */ 1876, 1876, 2096, 1906, 1876, 1876, 1876, 1876, 2120, 1876, - /* 170 */ 1876, 1876, 2235, 1876, 1876, 2452, 2512, 1876, 1876, 2455, - /* 180 */ 1876, 1876, 1876, 1876, 2184, 1876, 2442, 1876, 1876, 1876, - /* 190 */ 1876, 1876, 1876, 1876, 1876, 1876, 2049, 2229, 1876, 1876, - /* 200 */ 1876, 2415, 2429, 2496, 2416, 2413, 2436, 1876, 2446, 1876, - /* 210 */ 2271, 1876, 2261, 1973, 1876, 1973, 2222, 2167, 1876, 2177, - /* 220 */ 1876, 2177, 2174, 1876, 1876, 1876, 2177, 2174, 2174, 2038, - /* 230 */ 2034, 1876, 2032, 1876, 1876, 1876, 1876, 1931, 1876, 1931, - /* 240 */ 1876, 1973, 1973, 1876, 1973, 1876, 1876, 1973, 1876, 1973, - /* 250 */ 1876, 1973, 1973, 1876, 1973, 1876, 1876, 1876, 1876, 1876, - /* 260 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 270 */ 1876, 1876, 1876, 1876, 2259, 2245, 1876, 1971, 1876, 2233, - /* 280 */ 2231, 1876, 1971, 2446, 1876, 1876, 2466, 2461, 2466, 2461, - /* 290 */ 2480, 2476, 2466, 2485, 2482, 2448, 2446, 2515, 2502, 2498, - /* 300 */ 2429, 1876, 1876, 2434, 2432, 1876, 1971, 1971, 2461, 1876, - /* 310 */ 1876, 1876, 1876, 2461, 1876, 1876, 1971, 1876, 1971, 1876, - /* 320 */ 1876, 2065, 1876, 1876, 1971, 1876, 1915, 1876, 2224, 2250, - /* 330 */ 2205, 2205, 2099, 2099, 2099, 1974, 1881, 1876, 1876, 1876, - /* 340 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 2479, - /* 350 */ 2478, 2336, 1876, 2387, 2386, 2385, 2376, 2335, 2061, 1876, - /* 360 */ 1876, 2334, 2333, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 370 */ 1876, 2196, 2195, 2327, 1876, 1876, 2328, 2326, 2325, 1876, - /* 380 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 390 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 400 */ 1876, 1876, 1876, 2499, 2503, 1876, 1876, 1876, 1876, 1876, - /* 410 */ 1876, 2412, 1876, 1876, 1876, 2307, 1876, 1876, 1876, 1876, - /* 420 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 430 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 440 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 450 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 460 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 2173, 1876, - /* 470 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 480 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 490 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 500 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 510 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 520 */ 1876, 1876, 1876, 1876, 1876, 2188, 1876, 1876, 1876, 1876, - /* 530 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 540 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 550 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1920, 2314, 1876, - /* 560 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 570 */ 1876, 1876, 2317, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 580 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 590 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 600 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 610 */ 1876, 1876, 1876, 2013, 2012, 1876, 1876, 1876, 1876, 1876, - /* 620 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 630 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 2318, - /* 640 */ 1876, 1876, 1876, 1876, 1876, 2309, 1876, 1876, 1876, 1876, - /* 650 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 660 */ 1876, 1876, 2495, 2449, 1876, 1876, 1876, 1876, 1876, 1876, - /* 670 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 680 */ 1876, 1876, 2307, 1876, 2477, 1876, 1876, 2493, 1876, 2497, - /* 690 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 2422, 2418, 1876, - /* 700 */ 1876, 2414, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 710 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 2306, - /* 720 */ 1876, 2373, 1876, 1876, 1876, 2407, 1876, 1876, 2358, 1876, - /* 730 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 2318, 1876, - /* 740 */ 2321, 1876, 1876, 1876, 1876, 1876, 2093, 1876, 1876, 1876, - /* 750 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 760 */ 1876, 1876, 2077, 2075, 2074, 2073, 1876, 2106, 1876, 1876, - /* 770 */ 1876, 2102, 2101, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 780 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1992, - /* 790 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1984, 1876, - /* 800 */ 1983, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 810 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, - /* 820 */ 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1905, 1876, - /* 830 */ 1876, 1876, 1876, 1876, 1876, + /* 0 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 10 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 20 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 30 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 40 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 50 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 60 */ 1884, 2219, 1884, 1884, 2182, 1884, 1884, 1884, 1884, 1884, + /* 70 */ 1884, 1884, 1884, 1884, 1884, 1884, 2189, 1884, 1884, 1884, + /* 80 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 90 */ 1884, 1884, 1884, 1884, 1884, 1884, 1981, 1884, 1884, 1884, + /* 100 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 110 */ 1884, 1884, 1884, 1979, 2422, 1884, 1884, 1884, 1884, 1884, + /* 120 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 130 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 2434, 1884, + /* 140 */ 1884, 1955, 1955, 1884, 2434, 2434, 2434, 1979, 2394, 2394, + /* 150 */ 1884, 1884, 1981, 2257, 1884, 1884, 1884, 1884, 1884, 1884, + /* 160 */ 1884, 1884, 2104, 1914, 1884, 1884, 1884, 1884, 2128, 1884, + /* 170 */ 1884, 1884, 2245, 1884, 1884, 2463, 2523, 1884, 1884, 2466, + /* 180 */ 1884, 1884, 1884, 1884, 2194, 1884, 2453, 1884, 1884, 1884, + /* 190 */ 1884, 1884, 1884, 1884, 1884, 1884, 2057, 2239, 1884, 1884, + /* 200 */ 1884, 2426, 2440, 2507, 2427, 2424, 2447, 1884, 2457, 1884, + /* 210 */ 2282, 1884, 2271, 1981, 1884, 1981, 2232, 2177, 1884, 2187, + /* 220 */ 1884, 2187, 2184, 1884, 1884, 1884, 2187, 2184, 2184, 2046, + /* 230 */ 2042, 1884, 2040, 1884, 1884, 1884, 1884, 1939, 1884, 1939, + /* 240 */ 1884, 1981, 1981, 1884, 1981, 1884, 1884, 1981, 1884, 1981, + /* 250 */ 1884, 1981, 1981, 1884, 1981, 1884, 1884, 1884, 1884, 1884, + /* 260 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 270 */ 1884, 1884, 1884, 1884, 2269, 2255, 1884, 1979, 1884, 2243, + /* 280 */ 2241, 1884, 1979, 2457, 1884, 1884, 2477, 2472, 2477, 2472, + /* 290 */ 2491, 2487, 2477, 2496, 2493, 2459, 2457, 2526, 2513, 2509, + /* 300 */ 2440, 1884, 1884, 2445, 2443, 1884, 1979, 1979, 2472, 1884, + /* 310 */ 1884, 1884, 1884, 2472, 1884, 1884, 1979, 1884, 1979, 1884, + /* 320 */ 1884, 2073, 1884, 1884, 1979, 1884, 1923, 1884, 2234, 2260, + /* 330 */ 2215, 2215, 2107, 2107, 2107, 1982, 1889, 1884, 1884, 1884, + /* 340 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 2490, + /* 350 */ 2489, 2347, 1884, 2398, 2397, 2396, 2387, 2346, 2069, 1884, + /* 360 */ 1884, 2345, 2344, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 370 */ 1884, 2206, 2205, 2338, 1884, 1884, 2339, 2337, 2336, 1884, + /* 380 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 390 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 400 */ 1884, 1884, 1884, 2510, 2514, 1884, 1884, 1884, 1884, 1884, + /* 410 */ 1884, 2423, 1884, 1884, 1884, 2318, 1884, 1884, 1884, 1884, + /* 420 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 430 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 440 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 450 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 460 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 470 */ 2183, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 480 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 490 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 500 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 510 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 520 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 530 */ 2198, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 540 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 550 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 560 */ 1884, 1884, 1928, 2325, 1884, 1884, 1884, 1884, 1884, 1884, + /* 570 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 2328, 1884, 1884, + /* 580 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 590 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 600 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 610 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 2021, 2020, + /* 620 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 630 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 640 */ 1884, 1884, 1884, 1884, 2329, 1884, 1884, 1884, 1884, 1884, + /* 650 */ 2320, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 660 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 2506, 2460, 1884, + /* 670 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 680 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 2318, 1884, 2488, + /* 690 */ 1884, 1884, 2504, 1884, 2508, 1884, 1884, 1884, 1884, 1884, + /* 700 */ 1884, 1884, 2433, 2429, 1884, 1884, 2425, 1884, 1884, 1884, + /* 710 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 720 */ 1884, 1884, 1884, 1884, 2317, 1884, 2384, 1884, 1884, 1884, + /* 730 */ 2418, 1884, 1884, 2369, 1884, 1884, 1884, 1884, 1884, 1884, + /* 740 */ 1884, 1884, 1884, 2329, 1884, 2332, 1884, 1884, 1884, 1884, + /* 750 */ 1884, 2101, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 760 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 2085, 2083, 2082, + /* 770 */ 2081, 1884, 2114, 1884, 1884, 1884, 2110, 2109, 1884, 1884, + /* 780 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 790 */ 1884, 1884, 1884, 1884, 2000, 1884, 1884, 1884, 1884, 1884, + /* 800 */ 1884, 1884, 1884, 1992, 1884, 1991, 1884, 1884, 1884, 1884, + /* 810 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 820 */ 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, + /* 830 */ 1884, 1884, 1884, 1913, 1884, 1884, 1884, 1884, 1884, 1884, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1232,7 +1559,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* BWLIMIT => nothing */ 0, /* START => nothing */ 0, /* TIMESTAMP => nothing */ - 296, /* END => ABORT */ + 297, /* END => ABORT */ 0, /* TABLE => nothing */ 0, /* NK_LP => nothing */ 0, /* NK_RP => nothing */ @@ -1300,7 +1627,8 @@ static const YYCODETYPE yyFallback[] = { 0, /* VNODES => nothing */ 0, /* ALIVE => nothing */ 0, /* VIEWS => nothing */ - 296, /* VIEW => ABORT */ + 297, /* VIEW => ABORT */ + 0, /* COMPACTS => nothing */ 0, /* NORMAL => nothing */ 0, /* CHILD => nothing */ 0, /* LIKE => nothing */ @@ -1425,55 +1753,55 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASC => nothing */ 0, /* NULLS => nothing */ 0, /* ABORT => nothing */ - 296, /* AFTER => ABORT */ - 296, /* ATTACH => ABORT */ - 296, /* BEFORE => ABORT */ - 296, /* BEGIN => ABORT */ - 296, /* BITAND => ABORT */ - 296, /* BITNOT => ABORT */ - 296, /* BITOR => ABORT */ - 296, /* BLOCKS => ABORT */ - 296, /* CHANGE => ABORT */ - 296, /* COMMA => ABORT */ - 296, /* CONCAT => ABORT */ - 296, /* CONFLICT => ABORT */ - 296, /* COPY => ABORT */ - 296, /* DEFERRED => ABORT */ - 296, /* DELIMITERS => ABORT */ - 296, /* DETACH => ABORT */ - 296, /* DIVIDE => ABORT */ - 296, /* DOT => ABORT */ - 296, /* EACH => ABORT */ - 296, /* FAIL => ABORT */ - 296, /* FILE => ABORT */ - 296, /* FOR => ABORT */ - 296, /* GLOB => ABORT */ - 296, /* ID => ABORT */ - 296, /* IMMEDIATE => ABORT */ - 296, /* IMPORT => ABORT */ - 296, /* INITIALLY => ABORT */ - 296, /* INSTEAD => ABORT */ - 296, /* ISNULL => ABORT */ - 296, /* KEY => ABORT */ - 296, /* MODULES => ABORT */ - 296, /* NK_BITNOT => ABORT */ - 296, /* NK_SEMI => ABORT */ - 296, /* NOTNULL => ABORT */ - 296, /* OF => ABORT */ - 296, /* PLUS => ABORT */ - 296, /* PRIVILEGE => ABORT */ - 296, /* RAISE => ABORT */ - 296, /* RESTRICT => ABORT */ - 296, /* ROW => ABORT */ - 296, /* SEMI => ABORT */ - 296, /* STAR => ABORT */ - 296, /* STATEMENT => ABORT */ - 296, /* STRICT => ABORT */ - 296, /* STRING => ABORT */ - 296, /* TIMES => ABORT */ - 296, /* VALUES => ABORT */ - 296, /* VARIABLE => ABORT */ - 296, /* WAL => ABORT */ + 297, /* AFTER => ABORT */ + 297, /* ATTACH => ABORT */ + 297, /* BEFORE => ABORT */ + 297, /* BEGIN => ABORT */ + 297, /* BITAND => ABORT */ + 297, /* BITNOT => ABORT */ + 297, /* BITOR => ABORT */ + 297, /* BLOCKS => ABORT */ + 297, /* CHANGE => ABORT */ + 297, /* COMMA => ABORT */ + 297, /* CONCAT => ABORT */ + 297, /* CONFLICT => ABORT */ + 297, /* COPY => ABORT */ + 297, /* DEFERRED => ABORT */ + 297, /* DELIMITERS => ABORT */ + 297, /* DETACH => ABORT */ + 297, /* DIVIDE => ABORT */ + 297, /* DOT => ABORT */ + 297, /* EACH => ABORT */ + 297, /* FAIL => ABORT */ + 297, /* FILE => ABORT */ + 297, /* FOR => ABORT */ + 297, /* GLOB => ABORT */ + 297, /* ID => ABORT */ + 297, /* IMMEDIATE => ABORT */ + 297, /* IMPORT => ABORT */ + 297, /* INITIALLY => ABORT */ + 297, /* INSTEAD => ABORT */ + 297, /* ISNULL => ABORT */ + 297, /* KEY => ABORT */ + 297, /* MODULES => ABORT */ + 297, /* NK_BITNOT => ABORT */ + 297, /* NK_SEMI => ABORT */ + 297, /* NOTNULL => ABORT */ + 297, /* OF => ABORT */ + 297, /* PLUS => ABORT */ + 297, /* PRIVILEGE => ABORT */ + 297, /* RAISE => ABORT */ + 297, /* RESTRICT => ABORT */ + 297, /* ROW => ABORT */ + 297, /* SEMI => ABORT */ + 297, /* STAR => ABORT */ + 297, /* STATEMENT => ABORT */ + 297, /* STRICT => ABORT */ + 297, /* STRING => ABORT */ + 297, /* TIMES => ABORT */ + 297, /* VALUES => ABORT */ + 297, /* VARIABLE => ABORT */ + 297, /* WAL => ABORT */ }; #endif /* YYFALLBACK */ @@ -1525,6 +1853,7 @@ struct yyParser { }; typedef struct yyParser yyParser; +#include #ifndef NDEBUG #include static FILE *yyTraceFILE = 0; @@ -1734,340 +2063,341 @@ static const char *const yyTokenName[] = { /* 170 */ "ALIVE", /* 171 */ "VIEWS", /* 172 */ "VIEW", - /* 173 */ "NORMAL", - /* 174 */ "CHILD", - /* 175 */ "LIKE", - /* 176 */ "TBNAME", - /* 177 */ "QTAGS", - /* 178 */ "AS", - /* 179 */ "SYSTEM", - /* 180 */ "INDEX", - /* 181 */ "FUNCTION", - /* 182 */ "INTERVAL", - /* 183 */ "COUNT", - /* 184 */ "LAST_ROW", - /* 185 */ "META", - /* 186 */ "ONLY", - /* 187 */ "TOPIC", - /* 188 */ "CONSUMER", - /* 189 */ "GROUP", - /* 190 */ "DESC", - /* 191 */ "DESCRIBE", - /* 192 */ "RESET", - /* 193 */ "QUERY", - /* 194 */ "CACHE", - /* 195 */ "EXPLAIN", - /* 196 */ "ANALYZE", - /* 197 */ "VERBOSE", - /* 198 */ "NK_BOOL", - /* 199 */ "RATIO", - /* 200 */ "NK_FLOAT", - /* 201 */ "OUTPUTTYPE", - /* 202 */ "AGGREGATE", - /* 203 */ "BUFSIZE", - /* 204 */ "LANGUAGE", - /* 205 */ "REPLACE", - /* 206 */ "STREAM", - /* 207 */ "INTO", - /* 208 */ "PAUSE", - /* 209 */ "RESUME", - /* 210 */ "TRIGGER", - /* 211 */ "AT_ONCE", - /* 212 */ "WINDOW_CLOSE", - /* 213 */ "IGNORE", - /* 214 */ "EXPIRED", - /* 215 */ "FILL_HISTORY", - /* 216 */ "UPDATE", - /* 217 */ "SUBTABLE", - /* 218 */ "UNTREATED", - /* 219 */ "KILL", - /* 220 */ "CONNECTION", - /* 221 */ "TRANSACTION", - /* 222 */ "BALANCE", - /* 223 */ "VGROUP", - /* 224 */ "LEADER", - /* 225 */ "MERGE", - /* 226 */ "REDISTRIBUTE", - /* 227 */ "SPLIT", - /* 228 */ "DELETE", - /* 229 */ "INSERT", - /* 230 */ "NULL", - /* 231 */ "NK_QUESTION", - /* 232 */ "NK_ALIAS", - /* 233 */ "NK_ARROW", - /* 234 */ "ROWTS", - /* 235 */ "QSTART", - /* 236 */ "QEND", - /* 237 */ "QDURATION", - /* 238 */ "WSTART", - /* 239 */ "WEND", - /* 240 */ "WDURATION", - /* 241 */ "IROWTS", - /* 242 */ "ISFILLED", - /* 243 */ "CAST", - /* 244 */ "NOW", - /* 245 */ "TODAY", - /* 246 */ "TIMEZONE", - /* 247 */ "CLIENT_VERSION", - /* 248 */ "SERVER_VERSION", - /* 249 */ "SERVER_STATUS", - /* 250 */ "CURRENT_USER", - /* 251 */ "CASE", - /* 252 */ "WHEN", - /* 253 */ "THEN", - /* 254 */ "ELSE", - /* 255 */ "BETWEEN", - /* 256 */ "IS", - /* 257 */ "NK_LT", - /* 258 */ "NK_GT", - /* 259 */ "NK_LE", - /* 260 */ "NK_GE", - /* 261 */ "NK_NE", - /* 262 */ "MATCH", - /* 263 */ "NMATCH", - /* 264 */ "CONTAINS", - /* 265 */ "IN", - /* 266 */ "JOIN", - /* 267 */ "INNER", - /* 268 */ "SELECT", - /* 269 */ "NK_HINT", - /* 270 */ "DISTINCT", - /* 271 */ "WHERE", - /* 272 */ "PARTITION", - /* 273 */ "BY", - /* 274 */ "SESSION", - /* 275 */ "STATE_WINDOW", - /* 276 */ "EVENT_WINDOW", - /* 277 */ "SLIDING", - /* 278 */ "FILL", - /* 279 */ "VALUE", - /* 280 */ "VALUE_F", - /* 281 */ "NONE", - /* 282 */ "PREV", - /* 283 */ "NULL_F", - /* 284 */ "LINEAR", - /* 285 */ "NEXT", - /* 286 */ "HAVING", - /* 287 */ "RANGE", - /* 288 */ "EVERY", - /* 289 */ "ORDER", - /* 290 */ "SLIMIT", - /* 291 */ "SOFFSET", - /* 292 */ "LIMIT", - /* 293 */ "OFFSET", - /* 294 */ "ASC", - /* 295 */ "NULLS", - /* 296 */ "ABORT", - /* 297 */ "AFTER", - /* 298 */ "ATTACH", - /* 299 */ "BEFORE", - /* 300 */ "BEGIN", - /* 301 */ "BITAND", - /* 302 */ "BITNOT", - /* 303 */ "BITOR", - /* 304 */ "BLOCKS", - /* 305 */ "CHANGE", - /* 306 */ "COMMA", - /* 307 */ "CONCAT", - /* 308 */ "CONFLICT", - /* 309 */ "COPY", - /* 310 */ "DEFERRED", - /* 311 */ "DELIMITERS", - /* 312 */ "DETACH", - /* 313 */ "DIVIDE", - /* 314 */ "DOT", - /* 315 */ "EACH", - /* 316 */ "FAIL", - /* 317 */ "FILE", - /* 318 */ "FOR", - /* 319 */ "GLOB", - /* 320 */ "ID", - /* 321 */ "IMMEDIATE", - /* 322 */ "IMPORT", - /* 323 */ "INITIALLY", - /* 324 */ "INSTEAD", - /* 325 */ "ISNULL", - /* 326 */ "KEY", - /* 327 */ "MODULES", - /* 328 */ "NK_BITNOT", - /* 329 */ "NK_SEMI", - /* 330 */ "NOTNULL", - /* 331 */ "OF", - /* 332 */ "PLUS", - /* 333 */ "PRIVILEGE", - /* 334 */ "RAISE", - /* 335 */ "RESTRICT", - /* 336 */ "ROW", - /* 337 */ "SEMI", - /* 338 */ "STAR", - /* 339 */ "STATEMENT", - /* 340 */ "STRICT", - /* 341 */ "STRING", - /* 342 */ "TIMES", - /* 343 */ "VALUES", - /* 344 */ "VARIABLE", - /* 345 */ "WAL", - /* 346 */ "cmd", - /* 347 */ "account_options", - /* 348 */ "alter_account_options", - /* 349 */ "literal", - /* 350 */ "alter_account_option", - /* 351 */ "ip_range_list", - /* 352 */ "white_list", - /* 353 */ "white_list_opt", - /* 354 */ "user_name", - /* 355 */ "sysinfo_opt", - /* 356 */ "privileges", - /* 357 */ "priv_level", - /* 358 */ "with_opt", - /* 359 */ "priv_type_list", - /* 360 */ "priv_type", - /* 361 */ "db_name", - /* 362 */ "table_name", - /* 363 */ "topic_name", - /* 364 */ "search_condition", - /* 365 */ "dnode_endpoint", - /* 366 */ "force_opt", - /* 367 */ "unsafe_opt", - /* 368 */ "not_exists_opt", - /* 369 */ "db_options", - /* 370 */ "exists_opt", - /* 371 */ "alter_db_options", - /* 372 */ "speed_opt", - /* 373 */ "start_opt", - /* 374 */ "end_opt", - /* 375 */ "integer_list", - /* 376 */ "variable_list", - /* 377 */ "retention_list", - /* 378 */ "signed", - /* 379 */ "alter_db_option", - /* 380 */ "retention", - /* 381 */ "full_table_name", - /* 382 */ "column_def_list", - /* 383 */ "tags_def_opt", - /* 384 */ "table_options", - /* 385 */ "multi_create_clause", - /* 386 */ "tags_def", - /* 387 */ "multi_drop_clause", - /* 388 */ "alter_table_clause", - /* 389 */ "alter_table_options", - /* 390 */ "column_name", - /* 391 */ "type_name", - /* 392 */ "signed_literal", - /* 393 */ "create_subtable_clause", - /* 394 */ "specific_cols_opt", - /* 395 */ "expression_list", - /* 396 */ "drop_table_clause", - /* 397 */ "col_name_list", - /* 398 */ "column_def", - /* 399 */ "duration_list", - /* 400 */ "rollup_func_list", - /* 401 */ "alter_table_option", - /* 402 */ "duration_literal", - /* 403 */ "rollup_func_name", - /* 404 */ "function_name", - /* 405 */ "col_name", - /* 406 */ "db_kind_opt", - /* 407 */ "table_kind_db_name_cond_opt", - /* 408 */ "like_pattern_opt", - /* 409 */ "db_name_cond_opt", - /* 410 */ "table_name_cond", - /* 411 */ "from_db_opt", - /* 412 */ "tag_list_opt", - /* 413 */ "table_kind", - /* 414 */ "tag_item", - /* 415 */ "column_alias", - /* 416 */ "index_options", - /* 417 */ "full_index_name", - /* 418 */ "index_name", - /* 419 */ "func_list", - /* 420 */ "sliding_opt", - /* 421 */ "sma_stream_opt", - /* 422 */ "func", - /* 423 */ "sma_func_name", - /* 424 */ "with_meta", - /* 425 */ "query_or_subquery", - /* 426 */ "where_clause_opt", - /* 427 */ "cgroup_name", - /* 428 */ "analyze_opt", - /* 429 */ "explain_options", - /* 430 */ "insert_query", - /* 431 */ "or_replace_opt", - /* 432 */ "agg_func_opt", - /* 433 */ "bufsize_opt", - /* 434 */ "language_opt", - /* 435 */ "full_view_name", - /* 436 */ "view_name", - /* 437 */ "stream_name", - /* 438 */ "stream_options", - /* 439 */ "col_list_opt", - /* 440 */ "tag_def_or_ref_opt", - /* 441 */ "subtable_opt", - /* 442 */ "ignore_opt", - /* 443 */ "expression", - /* 444 */ "on_vgroup_id", - /* 445 */ "dnode_list", - /* 446 */ "literal_func", - /* 447 */ "literal_list", - /* 448 */ "table_alias", - /* 449 */ "expr_or_subquery", - /* 450 */ "pseudo_column", - /* 451 */ "column_reference", - /* 452 */ "function_expression", - /* 453 */ "case_when_expression", - /* 454 */ "star_func", - /* 455 */ "star_func_para_list", - /* 456 */ "noarg_func", - /* 457 */ "other_para_list", - /* 458 */ "star_func_para", - /* 459 */ "when_then_list", - /* 460 */ "case_when_else_opt", - /* 461 */ "common_expression", - /* 462 */ "when_then_expr", - /* 463 */ "predicate", - /* 464 */ "compare_op", - /* 465 */ "in_op", - /* 466 */ "in_predicate_value", - /* 467 */ "boolean_value_expression", - /* 468 */ "boolean_primary", - /* 469 */ "from_clause_opt", - /* 470 */ "table_reference_list", - /* 471 */ "table_reference", - /* 472 */ "table_primary", - /* 473 */ "joined_table", - /* 474 */ "alias_opt", - /* 475 */ "subquery", - /* 476 */ "parenthesized_joined_table", - /* 477 */ "join_type", - /* 478 */ "query_specification", - /* 479 */ "hint_list", - /* 480 */ "set_quantifier_opt", - /* 481 */ "tag_mode_opt", - /* 482 */ "select_list", - /* 483 */ "partition_by_clause_opt", - /* 484 */ "range_opt", - /* 485 */ "every_opt", - /* 486 */ "fill_opt", - /* 487 */ "twindow_clause_opt", - /* 488 */ "group_by_clause_opt", - /* 489 */ "having_clause_opt", - /* 490 */ "select_item", - /* 491 */ "partition_list", - /* 492 */ "partition_item", - /* 493 */ "interval_sliding_duration_literal", - /* 494 */ "fill_mode", - /* 495 */ "group_by_list", - /* 496 */ "query_expression", - /* 497 */ "query_simple", - /* 498 */ "order_by_clause_opt", - /* 499 */ "slimit_clause_opt", - /* 500 */ "limit_clause_opt", - /* 501 */ "union_query_expression", - /* 502 */ "query_simple_or_subquery", - /* 503 */ "sort_specification_list", - /* 504 */ "sort_specification", - /* 505 */ "ordering_specification_opt", - /* 506 */ "null_ordering_opt", + /* 173 */ "COMPACTS", + /* 174 */ "NORMAL", + /* 175 */ "CHILD", + /* 176 */ "LIKE", + /* 177 */ "TBNAME", + /* 178 */ "QTAGS", + /* 179 */ "AS", + /* 180 */ "SYSTEM", + /* 181 */ "INDEX", + /* 182 */ "FUNCTION", + /* 183 */ "INTERVAL", + /* 184 */ "COUNT", + /* 185 */ "LAST_ROW", + /* 186 */ "META", + /* 187 */ "ONLY", + /* 188 */ "TOPIC", + /* 189 */ "CONSUMER", + /* 190 */ "GROUP", + /* 191 */ "DESC", + /* 192 */ "DESCRIBE", + /* 193 */ "RESET", + /* 194 */ "QUERY", + /* 195 */ "CACHE", + /* 196 */ "EXPLAIN", + /* 197 */ "ANALYZE", + /* 198 */ "VERBOSE", + /* 199 */ "NK_BOOL", + /* 200 */ "RATIO", + /* 201 */ "NK_FLOAT", + /* 202 */ "OUTPUTTYPE", + /* 203 */ "AGGREGATE", + /* 204 */ "BUFSIZE", + /* 205 */ "LANGUAGE", + /* 206 */ "REPLACE", + /* 207 */ "STREAM", + /* 208 */ "INTO", + /* 209 */ "PAUSE", + /* 210 */ "RESUME", + /* 211 */ "TRIGGER", + /* 212 */ "AT_ONCE", + /* 213 */ "WINDOW_CLOSE", + /* 214 */ "IGNORE", + /* 215 */ "EXPIRED", + /* 216 */ "FILL_HISTORY", + /* 217 */ "UPDATE", + /* 218 */ "SUBTABLE", + /* 219 */ "UNTREATED", + /* 220 */ "KILL", + /* 221 */ "CONNECTION", + /* 222 */ "TRANSACTION", + /* 223 */ "BALANCE", + /* 224 */ "VGROUP", + /* 225 */ "LEADER", + /* 226 */ "MERGE", + /* 227 */ "REDISTRIBUTE", + /* 228 */ "SPLIT", + /* 229 */ "DELETE", + /* 230 */ "INSERT", + /* 231 */ "NULL", + /* 232 */ "NK_QUESTION", + /* 233 */ "NK_ALIAS", + /* 234 */ "NK_ARROW", + /* 235 */ "ROWTS", + /* 236 */ "QSTART", + /* 237 */ "QEND", + /* 238 */ "QDURATION", + /* 239 */ "WSTART", + /* 240 */ "WEND", + /* 241 */ "WDURATION", + /* 242 */ "IROWTS", + /* 243 */ "ISFILLED", + /* 244 */ "CAST", + /* 245 */ "NOW", + /* 246 */ "TODAY", + /* 247 */ "TIMEZONE", + /* 248 */ "CLIENT_VERSION", + /* 249 */ "SERVER_VERSION", + /* 250 */ "SERVER_STATUS", + /* 251 */ "CURRENT_USER", + /* 252 */ "CASE", + /* 253 */ "WHEN", + /* 254 */ "THEN", + /* 255 */ "ELSE", + /* 256 */ "BETWEEN", + /* 257 */ "IS", + /* 258 */ "NK_LT", + /* 259 */ "NK_GT", + /* 260 */ "NK_LE", + /* 261 */ "NK_GE", + /* 262 */ "NK_NE", + /* 263 */ "MATCH", + /* 264 */ "NMATCH", + /* 265 */ "CONTAINS", + /* 266 */ "IN", + /* 267 */ "JOIN", + /* 268 */ "INNER", + /* 269 */ "SELECT", + /* 270 */ "NK_HINT", + /* 271 */ "DISTINCT", + /* 272 */ "WHERE", + /* 273 */ "PARTITION", + /* 274 */ "BY", + /* 275 */ "SESSION", + /* 276 */ "STATE_WINDOW", + /* 277 */ "EVENT_WINDOW", + /* 278 */ "SLIDING", + /* 279 */ "FILL", + /* 280 */ "VALUE", + /* 281 */ "VALUE_F", + /* 282 */ "NONE", + /* 283 */ "PREV", + /* 284 */ "NULL_F", + /* 285 */ "LINEAR", + /* 286 */ "NEXT", + /* 287 */ "HAVING", + /* 288 */ "RANGE", + /* 289 */ "EVERY", + /* 290 */ "ORDER", + /* 291 */ "SLIMIT", + /* 292 */ "SOFFSET", + /* 293 */ "LIMIT", + /* 294 */ "OFFSET", + /* 295 */ "ASC", + /* 296 */ "NULLS", + /* 297 */ "ABORT", + /* 298 */ "AFTER", + /* 299 */ "ATTACH", + /* 300 */ "BEFORE", + /* 301 */ "BEGIN", + /* 302 */ "BITAND", + /* 303 */ "BITNOT", + /* 304 */ "BITOR", + /* 305 */ "BLOCKS", + /* 306 */ "CHANGE", + /* 307 */ "COMMA", + /* 308 */ "CONCAT", + /* 309 */ "CONFLICT", + /* 310 */ "COPY", + /* 311 */ "DEFERRED", + /* 312 */ "DELIMITERS", + /* 313 */ "DETACH", + /* 314 */ "DIVIDE", + /* 315 */ "DOT", + /* 316 */ "EACH", + /* 317 */ "FAIL", + /* 318 */ "FILE", + /* 319 */ "FOR", + /* 320 */ "GLOB", + /* 321 */ "ID", + /* 322 */ "IMMEDIATE", + /* 323 */ "IMPORT", + /* 324 */ "INITIALLY", + /* 325 */ "INSTEAD", + /* 326 */ "ISNULL", + /* 327 */ "KEY", + /* 328 */ "MODULES", + /* 329 */ "NK_BITNOT", + /* 330 */ "NK_SEMI", + /* 331 */ "NOTNULL", + /* 332 */ "OF", + /* 333 */ "PLUS", + /* 334 */ "PRIVILEGE", + /* 335 */ "RAISE", + /* 336 */ "RESTRICT", + /* 337 */ "ROW", + /* 338 */ "SEMI", + /* 339 */ "STAR", + /* 340 */ "STATEMENT", + /* 341 */ "STRICT", + /* 342 */ "STRING", + /* 343 */ "TIMES", + /* 344 */ "VALUES", + /* 345 */ "VARIABLE", + /* 346 */ "WAL", + /* 347 */ "cmd", + /* 348 */ "account_options", + /* 349 */ "alter_account_options", + /* 350 */ "literal", + /* 351 */ "alter_account_option", + /* 352 */ "ip_range_list", + /* 353 */ "white_list", + /* 354 */ "white_list_opt", + /* 355 */ "user_name", + /* 356 */ "sysinfo_opt", + /* 357 */ "privileges", + /* 358 */ "priv_level", + /* 359 */ "with_opt", + /* 360 */ "priv_type_list", + /* 361 */ "priv_type", + /* 362 */ "db_name", + /* 363 */ "table_name", + /* 364 */ "topic_name", + /* 365 */ "search_condition", + /* 366 */ "dnode_endpoint", + /* 367 */ "force_opt", + /* 368 */ "unsafe_opt", + /* 369 */ "not_exists_opt", + /* 370 */ "db_options", + /* 371 */ "exists_opt", + /* 372 */ "alter_db_options", + /* 373 */ "speed_opt", + /* 374 */ "start_opt", + /* 375 */ "end_opt", + /* 376 */ "integer_list", + /* 377 */ "variable_list", + /* 378 */ "retention_list", + /* 379 */ "signed", + /* 380 */ "alter_db_option", + /* 381 */ "retention", + /* 382 */ "full_table_name", + /* 383 */ "column_def_list", + /* 384 */ "tags_def_opt", + /* 385 */ "table_options", + /* 386 */ "multi_create_clause", + /* 387 */ "tags_def", + /* 388 */ "multi_drop_clause", + /* 389 */ "alter_table_clause", + /* 390 */ "alter_table_options", + /* 391 */ "column_name", + /* 392 */ "type_name", + /* 393 */ "signed_literal", + /* 394 */ "create_subtable_clause", + /* 395 */ "specific_cols_opt", + /* 396 */ "expression_list", + /* 397 */ "drop_table_clause", + /* 398 */ "col_name_list", + /* 399 */ "column_def", + /* 400 */ "duration_list", + /* 401 */ "rollup_func_list", + /* 402 */ "alter_table_option", + /* 403 */ "duration_literal", + /* 404 */ "rollup_func_name", + /* 405 */ "function_name", + /* 406 */ "col_name", + /* 407 */ "db_kind_opt", + /* 408 */ "table_kind_db_name_cond_opt", + /* 409 */ "like_pattern_opt", + /* 410 */ "db_name_cond_opt", + /* 411 */ "table_name_cond", + /* 412 */ "from_db_opt", + /* 413 */ "tag_list_opt", + /* 414 */ "table_kind", + /* 415 */ "tag_item", + /* 416 */ "column_alias", + /* 417 */ "index_options", + /* 418 */ "full_index_name", + /* 419 */ "index_name", + /* 420 */ "func_list", + /* 421 */ "sliding_opt", + /* 422 */ "sma_stream_opt", + /* 423 */ "func", + /* 424 */ "sma_func_name", + /* 425 */ "with_meta", + /* 426 */ "query_or_subquery", + /* 427 */ "where_clause_opt", + /* 428 */ "cgroup_name", + /* 429 */ "analyze_opt", + /* 430 */ "explain_options", + /* 431 */ "insert_query", + /* 432 */ "or_replace_opt", + /* 433 */ "agg_func_opt", + /* 434 */ "bufsize_opt", + /* 435 */ "language_opt", + /* 436 */ "full_view_name", + /* 437 */ "view_name", + /* 438 */ "stream_name", + /* 439 */ "stream_options", + /* 440 */ "col_list_opt", + /* 441 */ "tag_def_or_ref_opt", + /* 442 */ "subtable_opt", + /* 443 */ "ignore_opt", + /* 444 */ "expression", + /* 445 */ "on_vgroup_id", + /* 446 */ "dnode_list", + /* 447 */ "literal_func", + /* 448 */ "literal_list", + /* 449 */ "table_alias", + /* 450 */ "expr_or_subquery", + /* 451 */ "pseudo_column", + /* 452 */ "column_reference", + /* 453 */ "function_expression", + /* 454 */ "case_when_expression", + /* 455 */ "star_func", + /* 456 */ "star_func_para_list", + /* 457 */ "noarg_func", + /* 458 */ "other_para_list", + /* 459 */ "star_func_para", + /* 460 */ "when_then_list", + /* 461 */ "case_when_else_opt", + /* 462 */ "common_expression", + /* 463 */ "when_then_expr", + /* 464 */ "predicate", + /* 465 */ "compare_op", + /* 466 */ "in_op", + /* 467 */ "in_predicate_value", + /* 468 */ "boolean_value_expression", + /* 469 */ "boolean_primary", + /* 470 */ "from_clause_opt", + /* 471 */ "table_reference_list", + /* 472 */ "table_reference", + /* 473 */ "table_primary", + /* 474 */ "joined_table", + /* 475 */ "alias_opt", + /* 476 */ "subquery", + /* 477 */ "parenthesized_joined_table", + /* 478 */ "join_type", + /* 479 */ "query_specification", + /* 480 */ "hint_list", + /* 481 */ "set_quantifier_opt", + /* 482 */ "tag_mode_opt", + /* 483 */ "select_list", + /* 484 */ "partition_by_clause_opt", + /* 485 */ "range_opt", + /* 486 */ "every_opt", + /* 487 */ "fill_opt", + /* 488 */ "twindow_clause_opt", + /* 489 */ "group_by_clause_opt", + /* 490 */ "having_clause_opt", + /* 491 */ "select_item", + /* 492 */ "partition_list", + /* 493 */ "partition_item", + /* 494 */ "interval_sliding_duration_literal", + /* 495 */ "fill_mode", + /* 496 */ "group_by_list", + /* 497 */ "query_expression", + /* 498 */ "query_simple", + /* 499 */ "order_by_clause_opt", + /* 500 */ "slimit_clause_opt", + /* 501 */ "limit_clause_opt", + /* 502 */ "union_query_expression", + /* 503 */ "query_simple_or_subquery", + /* 504 */ "sort_specification_list", + /* 505 */ "sort_specification", + /* 506 */ "ordering_specification_opt", + /* 507 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -2362,358 +2692,361 @@ static const char *const yyRuleName[] = { /* 284 */ "cmd ::= SHOW CLUSTER ALIVE", /* 285 */ "cmd ::= SHOW db_name_cond_opt VIEWS", /* 286 */ "cmd ::= SHOW CREATE VIEW full_table_name", - /* 287 */ "table_kind_db_name_cond_opt ::=", - /* 288 */ "table_kind_db_name_cond_opt ::= table_kind", - /* 289 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT", - /* 290 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT", - /* 291 */ "table_kind ::= NORMAL", - /* 292 */ "table_kind ::= CHILD", - /* 293 */ "db_name_cond_opt ::=", - /* 294 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 295 */ "like_pattern_opt ::=", - /* 296 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 297 */ "table_name_cond ::= table_name", - /* 298 */ "from_db_opt ::=", - /* 299 */ "from_db_opt ::= FROM db_name", - /* 300 */ "tag_list_opt ::=", - /* 301 */ "tag_list_opt ::= tag_item", - /* 302 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", - /* 303 */ "tag_item ::= TBNAME", - /* 304 */ "tag_item ::= QTAGS", - /* 305 */ "tag_item ::= column_name", - /* 306 */ "tag_item ::= column_name column_alias", - /* 307 */ "tag_item ::= column_name AS column_alias", - /* 308 */ "db_kind_opt ::=", - /* 309 */ "db_kind_opt ::= USER", - /* 310 */ "db_kind_opt ::= SYSTEM", - /* 311 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options", - /* 312 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP", - /* 313 */ "cmd ::= DROP INDEX exists_opt full_index_name", - /* 314 */ "full_index_name ::= index_name", - /* 315 */ "full_index_name ::= db_name NK_DOT index_name", - /* 316 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 317 */ "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", - /* 318 */ "func_list ::= func", - /* 319 */ "func_list ::= func_list NK_COMMA func", - /* 320 */ "func ::= sma_func_name NK_LP expression_list NK_RP", - /* 321 */ "sma_func_name ::= function_name", - /* 322 */ "sma_func_name ::= COUNT", - /* 323 */ "sma_func_name ::= FIRST", - /* 324 */ "sma_func_name ::= LAST", - /* 325 */ "sma_func_name ::= LAST_ROW", - /* 326 */ "sma_stream_opt ::=", - /* 327 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", - /* 328 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", - /* 329 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", - /* 330 */ "with_meta ::= AS", - /* 331 */ "with_meta ::= WITH META AS", - /* 332 */ "with_meta ::= ONLY META AS", - /* 333 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 334 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", - /* 335 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", - /* 336 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 337 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 338 */ "cmd ::= DESC full_table_name", - /* 339 */ "cmd ::= DESCRIBE full_table_name", - /* 340 */ "cmd ::= RESET QUERY CACHE", - /* 341 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 342 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", - /* 343 */ "analyze_opt ::=", - /* 344 */ "analyze_opt ::= ANALYZE", - /* 345 */ "explain_options ::=", - /* 346 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 347 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 348 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", - /* 349 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 350 */ "agg_func_opt ::=", - /* 351 */ "agg_func_opt ::= AGGREGATE", - /* 352 */ "bufsize_opt ::=", - /* 353 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 354 */ "language_opt ::=", - /* 355 */ "language_opt ::= LANGUAGE NK_STRING", - /* 356 */ "or_replace_opt ::=", - /* 357 */ "or_replace_opt ::= OR REPLACE", - /* 358 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery", - /* 359 */ "cmd ::= DROP VIEW exists_opt full_view_name", - /* 360 */ "full_view_name ::= view_name", - /* 361 */ "full_view_name ::= db_name NK_DOT view_name", - /* 362 */ "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", - /* 363 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 364 */ "cmd ::= PAUSE STREAM exists_opt stream_name", - /* 365 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", - /* 366 */ "col_list_opt ::=", - /* 367 */ "col_list_opt ::= NK_LP col_name_list NK_RP", - /* 368 */ "tag_def_or_ref_opt ::=", - /* 369 */ "tag_def_or_ref_opt ::= tags_def", - /* 370 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", - /* 371 */ "stream_options ::=", - /* 372 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 373 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 374 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 375 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 376 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 377 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 378 */ "stream_options ::= stream_options DELETE_MARK duration_literal", - /* 379 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", - /* 380 */ "subtable_opt ::=", - /* 381 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 382 */ "ignore_opt ::=", - /* 383 */ "ignore_opt ::= IGNORE UNTREATED", - /* 384 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 385 */ "cmd ::= KILL QUERY NK_STRING", - /* 386 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 387 */ "cmd ::= BALANCE VGROUP", - /* 388 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", - /* 389 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 390 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 391 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 392 */ "on_vgroup_id ::=", - /* 393 */ "on_vgroup_id ::= ON NK_INTEGER", - /* 394 */ "dnode_list ::= DNODE NK_INTEGER", - /* 395 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 396 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 397 */ "cmd ::= query_or_subquery", - /* 398 */ "cmd ::= insert_query", - /* 399 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 400 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 401 */ "literal ::= NK_INTEGER", - /* 402 */ "literal ::= NK_FLOAT", - /* 403 */ "literal ::= NK_STRING", - /* 404 */ "literal ::= NK_BOOL", - /* 405 */ "literal ::= TIMESTAMP NK_STRING", - /* 406 */ "literal ::= duration_literal", - /* 407 */ "literal ::= NULL", - /* 408 */ "literal ::= NK_QUESTION", - /* 409 */ "duration_literal ::= NK_VARIABLE", - /* 410 */ "signed ::= NK_INTEGER", - /* 411 */ "signed ::= NK_PLUS NK_INTEGER", - /* 412 */ "signed ::= NK_MINUS NK_INTEGER", - /* 413 */ "signed ::= NK_FLOAT", - /* 414 */ "signed ::= NK_PLUS NK_FLOAT", - /* 415 */ "signed ::= NK_MINUS NK_FLOAT", - /* 416 */ "signed_literal ::= signed", - /* 417 */ "signed_literal ::= NK_STRING", - /* 418 */ "signed_literal ::= NK_BOOL", - /* 419 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 420 */ "signed_literal ::= duration_literal", - /* 421 */ "signed_literal ::= NULL", - /* 422 */ "signed_literal ::= literal_func", - /* 423 */ "signed_literal ::= NK_QUESTION", - /* 424 */ "literal_list ::= signed_literal", - /* 425 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 426 */ "db_name ::= NK_ID", - /* 427 */ "table_name ::= NK_ID", - /* 428 */ "column_name ::= NK_ID", - /* 429 */ "function_name ::= NK_ID", - /* 430 */ "view_name ::= NK_ID", - /* 431 */ "table_alias ::= NK_ID", - /* 432 */ "column_alias ::= NK_ID", - /* 433 */ "column_alias ::= NK_ALIAS", - /* 434 */ "user_name ::= NK_ID", - /* 435 */ "topic_name ::= NK_ID", - /* 436 */ "stream_name ::= NK_ID", - /* 437 */ "cgroup_name ::= NK_ID", - /* 438 */ "index_name ::= NK_ID", - /* 439 */ "expr_or_subquery ::= expression", - /* 440 */ "expression ::= literal", - /* 441 */ "expression ::= pseudo_column", - /* 442 */ "expression ::= column_reference", - /* 443 */ "expression ::= function_expression", - /* 444 */ "expression ::= case_when_expression", - /* 445 */ "expression ::= NK_LP expression NK_RP", - /* 446 */ "expression ::= NK_PLUS expr_or_subquery", - /* 447 */ "expression ::= NK_MINUS expr_or_subquery", - /* 448 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 449 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 450 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 451 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 452 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 453 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 454 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 455 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 456 */ "expression_list ::= expr_or_subquery", - /* 457 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 458 */ "column_reference ::= column_name", - /* 459 */ "column_reference ::= table_name NK_DOT column_name", - /* 460 */ "column_reference ::= NK_ALIAS", - /* 461 */ "column_reference ::= table_name NK_DOT NK_ALIAS", - /* 462 */ "pseudo_column ::= ROWTS", - /* 463 */ "pseudo_column ::= TBNAME", - /* 464 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 465 */ "pseudo_column ::= QSTART", - /* 466 */ "pseudo_column ::= QEND", - /* 467 */ "pseudo_column ::= QDURATION", - /* 468 */ "pseudo_column ::= WSTART", - /* 469 */ "pseudo_column ::= WEND", - /* 470 */ "pseudo_column ::= WDURATION", - /* 471 */ "pseudo_column ::= IROWTS", - /* 472 */ "pseudo_column ::= ISFILLED", - /* 473 */ "pseudo_column ::= QTAGS", - /* 474 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 475 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 476 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 477 */ "function_expression ::= literal_func", - /* 478 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 479 */ "literal_func ::= NOW", - /* 480 */ "noarg_func ::= NOW", - /* 481 */ "noarg_func ::= TODAY", - /* 482 */ "noarg_func ::= TIMEZONE", - /* 483 */ "noarg_func ::= DATABASE", - /* 484 */ "noarg_func ::= CLIENT_VERSION", - /* 485 */ "noarg_func ::= SERVER_VERSION", - /* 486 */ "noarg_func ::= SERVER_STATUS", - /* 487 */ "noarg_func ::= CURRENT_USER", - /* 488 */ "noarg_func ::= USER", - /* 489 */ "star_func ::= COUNT", - /* 490 */ "star_func ::= FIRST", - /* 491 */ "star_func ::= LAST", - /* 492 */ "star_func ::= LAST_ROW", - /* 493 */ "star_func_para_list ::= NK_STAR", - /* 494 */ "star_func_para_list ::= other_para_list", - /* 495 */ "other_para_list ::= star_func_para", - /* 496 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 497 */ "star_func_para ::= expr_or_subquery", - /* 498 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 499 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 500 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 501 */ "when_then_list ::= when_then_expr", - /* 502 */ "when_then_list ::= when_then_list when_then_expr", - /* 503 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 504 */ "case_when_else_opt ::=", - /* 505 */ "case_when_else_opt ::= ELSE common_expression", - /* 506 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 507 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 508 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 509 */ "predicate ::= expr_or_subquery IS NULL", - /* 510 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 511 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 512 */ "compare_op ::= NK_LT", - /* 513 */ "compare_op ::= NK_GT", - /* 514 */ "compare_op ::= NK_LE", - /* 515 */ "compare_op ::= NK_GE", - /* 516 */ "compare_op ::= NK_NE", - /* 517 */ "compare_op ::= NK_EQ", - /* 518 */ "compare_op ::= LIKE", - /* 519 */ "compare_op ::= NOT LIKE", - /* 520 */ "compare_op ::= MATCH", - /* 521 */ "compare_op ::= NMATCH", - /* 522 */ "compare_op ::= CONTAINS", - /* 523 */ "in_op ::= IN", - /* 524 */ "in_op ::= NOT IN", - /* 525 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 526 */ "boolean_value_expression ::= boolean_primary", - /* 527 */ "boolean_value_expression ::= NOT boolean_primary", - /* 528 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 529 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 530 */ "boolean_primary ::= predicate", - /* 531 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 532 */ "common_expression ::= expr_or_subquery", - /* 533 */ "common_expression ::= boolean_value_expression", - /* 534 */ "from_clause_opt ::=", - /* 535 */ "from_clause_opt ::= FROM table_reference_list", - /* 536 */ "table_reference_list ::= table_reference", - /* 537 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 538 */ "table_reference ::= table_primary", - /* 539 */ "table_reference ::= joined_table", - /* 540 */ "table_primary ::= table_name alias_opt", - /* 541 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 542 */ "table_primary ::= subquery alias_opt", - /* 543 */ "table_primary ::= parenthesized_joined_table", - /* 544 */ "alias_opt ::=", - /* 545 */ "alias_opt ::= table_alias", - /* 546 */ "alias_opt ::= AS table_alias", - /* 547 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 548 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 549 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 550 */ "join_type ::=", - /* 551 */ "join_type ::= INNER", - /* 552 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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", - /* 553 */ "hint_list ::=", - /* 554 */ "hint_list ::= NK_HINT", - /* 555 */ "tag_mode_opt ::=", - /* 556 */ "tag_mode_opt ::= TAGS", - /* 557 */ "set_quantifier_opt ::=", - /* 558 */ "set_quantifier_opt ::= DISTINCT", - /* 559 */ "set_quantifier_opt ::= ALL", - /* 560 */ "select_list ::= select_item", - /* 561 */ "select_list ::= select_list NK_COMMA select_item", - /* 562 */ "select_item ::= NK_STAR", - /* 563 */ "select_item ::= common_expression", - /* 564 */ "select_item ::= common_expression column_alias", - /* 565 */ "select_item ::= common_expression AS column_alias", - /* 566 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 567 */ "where_clause_opt ::=", - /* 568 */ "where_clause_opt ::= WHERE search_condition", - /* 569 */ "partition_by_clause_opt ::=", - /* 570 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 571 */ "partition_list ::= partition_item", - /* 572 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 573 */ "partition_item ::= expr_or_subquery", - /* 574 */ "partition_item ::= expr_or_subquery column_alias", - /* 575 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 576 */ "twindow_clause_opt ::=", - /* 577 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", - /* 578 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 579 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 580 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 581 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 582 */ "sliding_opt ::=", - /* 583 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", - /* 584 */ "interval_sliding_duration_literal ::= NK_VARIABLE", - /* 585 */ "interval_sliding_duration_literal ::= NK_STRING", - /* 586 */ "interval_sliding_duration_literal ::= NK_INTEGER", - /* 587 */ "fill_opt ::=", - /* 588 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 589 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", - /* 590 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", - /* 591 */ "fill_mode ::= NONE", - /* 592 */ "fill_mode ::= PREV", - /* 593 */ "fill_mode ::= NULL", - /* 594 */ "fill_mode ::= NULL_F", - /* 595 */ "fill_mode ::= LINEAR", - /* 596 */ "fill_mode ::= NEXT", - /* 597 */ "group_by_clause_opt ::=", - /* 598 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 599 */ "group_by_list ::= expr_or_subquery", - /* 600 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 601 */ "having_clause_opt ::=", - /* 602 */ "having_clause_opt ::= HAVING search_condition", - /* 603 */ "range_opt ::=", - /* 604 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 605 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", - /* 606 */ "every_opt ::=", - /* 607 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 608 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 609 */ "query_simple ::= query_specification", - /* 610 */ "query_simple ::= union_query_expression", - /* 611 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 612 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 613 */ "query_simple_or_subquery ::= query_simple", - /* 614 */ "query_simple_or_subquery ::= subquery", - /* 615 */ "query_or_subquery ::= query_expression", - /* 616 */ "query_or_subquery ::= subquery", - /* 617 */ "order_by_clause_opt ::=", - /* 618 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 619 */ "slimit_clause_opt ::=", - /* 620 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 621 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 622 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 623 */ "limit_clause_opt ::=", - /* 624 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 625 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 626 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 627 */ "subquery ::= NK_LP query_expression NK_RP", - /* 628 */ "subquery ::= NK_LP subquery NK_RP", - /* 629 */ "search_condition ::= common_expression", - /* 630 */ "sort_specification_list ::= sort_specification", - /* 631 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 632 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 633 */ "ordering_specification_opt ::=", - /* 634 */ "ordering_specification_opt ::= ASC", - /* 635 */ "ordering_specification_opt ::= DESC", - /* 636 */ "null_ordering_opt ::=", - /* 637 */ "null_ordering_opt ::= NULLS FIRST", - /* 638 */ "null_ordering_opt ::= NULLS LAST", + /* 287 */ "cmd ::= SHOW COMPACTS", + /* 288 */ "cmd ::= SHOW COMPACT NK_INTEGER", + /* 289 */ "table_kind_db_name_cond_opt ::=", + /* 290 */ "table_kind_db_name_cond_opt ::= table_kind", + /* 291 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT", + /* 292 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT", + /* 293 */ "table_kind ::= NORMAL", + /* 294 */ "table_kind ::= CHILD", + /* 295 */ "db_name_cond_opt ::=", + /* 296 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 297 */ "like_pattern_opt ::=", + /* 298 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 299 */ "table_name_cond ::= table_name", + /* 300 */ "from_db_opt ::=", + /* 301 */ "from_db_opt ::= FROM db_name", + /* 302 */ "tag_list_opt ::=", + /* 303 */ "tag_list_opt ::= tag_item", + /* 304 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", + /* 305 */ "tag_item ::= TBNAME", + /* 306 */ "tag_item ::= QTAGS", + /* 307 */ "tag_item ::= column_name", + /* 308 */ "tag_item ::= column_name column_alias", + /* 309 */ "tag_item ::= column_name AS column_alias", + /* 310 */ "db_kind_opt ::=", + /* 311 */ "db_kind_opt ::= USER", + /* 312 */ "db_kind_opt ::= SYSTEM", + /* 313 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options", + /* 314 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP", + /* 315 */ "cmd ::= DROP INDEX exists_opt full_index_name", + /* 316 */ "full_index_name ::= index_name", + /* 317 */ "full_index_name ::= db_name NK_DOT index_name", + /* 318 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 319 */ "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", + /* 320 */ "func_list ::= func", + /* 321 */ "func_list ::= func_list NK_COMMA func", + /* 322 */ "func ::= sma_func_name NK_LP expression_list NK_RP", + /* 323 */ "sma_func_name ::= function_name", + /* 324 */ "sma_func_name ::= COUNT", + /* 325 */ "sma_func_name ::= FIRST", + /* 326 */ "sma_func_name ::= LAST", + /* 327 */ "sma_func_name ::= LAST_ROW", + /* 328 */ "sma_stream_opt ::=", + /* 329 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", + /* 330 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", + /* 331 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", + /* 332 */ "with_meta ::= AS", + /* 333 */ "with_meta ::= WITH META AS", + /* 334 */ "with_meta ::= ONLY META AS", + /* 335 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 336 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", + /* 337 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", + /* 338 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 339 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 340 */ "cmd ::= DESC full_table_name", + /* 341 */ "cmd ::= DESCRIBE full_table_name", + /* 342 */ "cmd ::= RESET QUERY CACHE", + /* 343 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 344 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", + /* 345 */ "analyze_opt ::=", + /* 346 */ "analyze_opt ::= ANALYZE", + /* 347 */ "explain_options ::=", + /* 348 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 349 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 350 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", + /* 351 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 352 */ "agg_func_opt ::=", + /* 353 */ "agg_func_opt ::= AGGREGATE", + /* 354 */ "bufsize_opt ::=", + /* 355 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 356 */ "language_opt ::=", + /* 357 */ "language_opt ::= LANGUAGE NK_STRING", + /* 358 */ "or_replace_opt ::=", + /* 359 */ "or_replace_opt ::= OR REPLACE", + /* 360 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery", + /* 361 */ "cmd ::= DROP VIEW exists_opt full_view_name", + /* 362 */ "full_view_name ::= view_name", + /* 363 */ "full_view_name ::= db_name NK_DOT view_name", + /* 364 */ "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", + /* 365 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 366 */ "cmd ::= PAUSE STREAM exists_opt stream_name", + /* 367 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", + /* 368 */ "col_list_opt ::=", + /* 369 */ "col_list_opt ::= NK_LP col_name_list NK_RP", + /* 370 */ "tag_def_or_ref_opt ::=", + /* 371 */ "tag_def_or_ref_opt ::= tags_def", + /* 372 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", + /* 373 */ "stream_options ::=", + /* 374 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 375 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 376 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 377 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 378 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 379 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 380 */ "stream_options ::= stream_options DELETE_MARK duration_literal", + /* 381 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", + /* 382 */ "subtable_opt ::=", + /* 383 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 384 */ "ignore_opt ::=", + /* 385 */ "ignore_opt ::= IGNORE UNTREATED", + /* 386 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 387 */ "cmd ::= KILL QUERY NK_STRING", + /* 388 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 389 */ "cmd ::= KILL COMPACT NK_INTEGER", + /* 390 */ "cmd ::= BALANCE VGROUP", + /* 391 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", + /* 392 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 393 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 394 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 395 */ "on_vgroup_id ::=", + /* 396 */ "on_vgroup_id ::= ON NK_INTEGER", + /* 397 */ "dnode_list ::= DNODE NK_INTEGER", + /* 398 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 399 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 400 */ "cmd ::= query_or_subquery", + /* 401 */ "cmd ::= insert_query", + /* 402 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 403 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", + /* 404 */ "literal ::= NK_INTEGER", + /* 405 */ "literal ::= NK_FLOAT", + /* 406 */ "literal ::= NK_STRING", + /* 407 */ "literal ::= NK_BOOL", + /* 408 */ "literal ::= TIMESTAMP NK_STRING", + /* 409 */ "literal ::= duration_literal", + /* 410 */ "literal ::= NULL", + /* 411 */ "literal ::= NK_QUESTION", + /* 412 */ "duration_literal ::= NK_VARIABLE", + /* 413 */ "signed ::= NK_INTEGER", + /* 414 */ "signed ::= NK_PLUS NK_INTEGER", + /* 415 */ "signed ::= NK_MINUS NK_INTEGER", + /* 416 */ "signed ::= NK_FLOAT", + /* 417 */ "signed ::= NK_PLUS NK_FLOAT", + /* 418 */ "signed ::= NK_MINUS NK_FLOAT", + /* 419 */ "signed_literal ::= signed", + /* 420 */ "signed_literal ::= NK_STRING", + /* 421 */ "signed_literal ::= NK_BOOL", + /* 422 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 423 */ "signed_literal ::= duration_literal", + /* 424 */ "signed_literal ::= NULL", + /* 425 */ "signed_literal ::= literal_func", + /* 426 */ "signed_literal ::= NK_QUESTION", + /* 427 */ "literal_list ::= signed_literal", + /* 428 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 429 */ "db_name ::= NK_ID", + /* 430 */ "table_name ::= NK_ID", + /* 431 */ "column_name ::= NK_ID", + /* 432 */ "function_name ::= NK_ID", + /* 433 */ "view_name ::= NK_ID", + /* 434 */ "table_alias ::= NK_ID", + /* 435 */ "column_alias ::= NK_ID", + /* 436 */ "column_alias ::= NK_ALIAS", + /* 437 */ "user_name ::= NK_ID", + /* 438 */ "topic_name ::= NK_ID", + /* 439 */ "stream_name ::= NK_ID", + /* 440 */ "cgroup_name ::= NK_ID", + /* 441 */ "index_name ::= NK_ID", + /* 442 */ "expr_or_subquery ::= expression", + /* 443 */ "expression ::= literal", + /* 444 */ "expression ::= pseudo_column", + /* 445 */ "expression ::= column_reference", + /* 446 */ "expression ::= function_expression", + /* 447 */ "expression ::= case_when_expression", + /* 448 */ "expression ::= NK_LP expression NK_RP", + /* 449 */ "expression ::= NK_PLUS expr_or_subquery", + /* 450 */ "expression ::= NK_MINUS expr_or_subquery", + /* 451 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 452 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 453 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 454 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 455 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 456 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 457 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 458 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 459 */ "expression_list ::= expr_or_subquery", + /* 460 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 461 */ "column_reference ::= column_name", + /* 462 */ "column_reference ::= table_name NK_DOT column_name", + /* 463 */ "column_reference ::= NK_ALIAS", + /* 464 */ "column_reference ::= table_name NK_DOT NK_ALIAS", + /* 465 */ "pseudo_column ::= ROWTS", + /* 466 */ "pseudo_column ::= TBNAME", + /* 467 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 468 */ "pseudo_column ::= QSTART", + /* 469 */ "pseudo_column ::= QEND", + /* 470 */ "pseudo_column ::= QDURATION", + /* 471 */ "pseudo_column ::= WSTART", + /* 472 */ "pseudo_column ::= WEND", + /* 473 */ "pseudo_column ::= WDURATION", + /* 474 */ "pseudo_column ::= IROWTS", + /* 475 */ "pseudo_column ::= ISFILLED", + /* 476 */ "pseudo_column ::= QTAGS", + /* 477 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 478 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 479 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 480 */ "function_expression ::= literal_func", + /* 481 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 482 */ "literal_func ::= NOW", + /* 483 */ "noarg_func ::= NOW", + /* 484 */ "noarg_func ::= TODAY", + /* 485 */ "noarg_func ::= TIMEZONE", + /* 486 */ "noarg_func ::= DATABASE", + /* 487 */ "noarg_func ::= CLIENT_VERSION", + /* 488 */ "noarg_func ::= SERVER_VERSION", + /* 489 */ "noarg_func ::= SERVER_STATUS", + /* 490 */ "noarg_func ::= CURRENT_USER", + /* 491 */ "noarg_func ::= USER", + /* 492 */ "star_func ::= COUNT", + /* 493 */ "star_func ::= FIRST", + /* 494 */ "star_func ::= LAST", + /* 495 */ "star_func ::= LAST_ROW", + /* 496 */ "star_func_para_list ::= NK_STAR", + /* 497 */ "star_func_para_list ::= other_para_list", + /* 498 */ "other_para_list ::= star_func_para", + /* 499 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 500 */ "star_func_para ::= expr_or_subquery", + /* 501 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 502 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 503 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 504 */ "when_then_list ::= when_then_expr", + /* 505 */ "when_then_list ::= when_then_list when_then_expr", + /* 506 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 507 */ "case_when_else_opt ::=", + /* 508 */ "case_when_else_opt ::= ELSE common_expression", + /* 509 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 510 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 511 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 512 */ "predicate ::= expr_or_subquery IS NULL", + /* 513 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 514 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 515 */ "compare_op ::= NK_LT", + /* 516 */ "compare_op ::= NK_GT", + /* 517 */ "compare_op ::= NK_LE", + /* 518 */ "compare_op ::= NK_GE", + /* 519 */ "compare_op ::= NK_NE", + /* 520 */ "compare_op ::= NK_EQ", + /* 521 */ "compare_op ::= LIKE", + /* 522 */ "compare_op ::= NOT LIKE", + /* 523 */ "compare_op ::= MATCH", + /* 524 */ "compare_op ::= NMATCH", + /* 525 */ "compare_op ::= CONTAINS", + /* 526 */ "in_op ::= IN", + /* 527 */ "in_op ::= NOT IN", + /* 528 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 529 */ "boolean_value_expression ::= boolean_primary", + /* 530 */ "boolean_value_expression ::= NOT boolean_primary", + /* 531 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 532 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 533 */ "boolean_primary ::= predicate", + /* 534 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 535 */ "common_expression ::= expr_or_subquery", + /* 536 */ "common_expression ::= boolean_value_expression", + /* 537 */ "from_clause_opt ::=", + /* 538 */ "from_clause_opt ::= FROM table_reference_list", + /* 539 */ "table_reference_list ::= table_reference", + /* 540 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 541 */ "table_reference ::= table_primary", + /* 542 */ "table_reference ::= joined_table", + /* 543 */ "table_primary ::= table_name alias_opt", + /* 544 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 545 */ "table_primary ::= subquery alias_opt", + /* 546 */ "table_primary ::= parenthesized_joined_table", + /* 547 */ "alias_opt ::=", + /* 548 */ "alias_opt ::= table_alias", + /* 549 */ "alias_opt ::= AS table_alias", + /* 550 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 551 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 552 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 553 */ "join_type ::=", + /* 554 */ "join_type ::= INNER", + /* 555 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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", + /* 556 */ "hint_list ::=", + /* 557 */ "hint_list ::= NK_HINT", + /* 558 */ "tag_mode_opt ::=", + /* 559 */ "tag_mode_opt ::= TAGS", + /* 560 */ "set_quantifier_opt ::=", + /* 561 */ "set_quantifier_opt ::= DISTINCT", + /* 562 */ "set_quantifier_opt ::= ALL", + /* 563 */ "select_list ::= select_item", + /* 564 */ "select_list ::= select_list NK_COMMA select_item", + /* 565 */ "select_item ::= NK_STAR", + /* 566 */ "select_item ::= common_expression", + /* 567 */ "select_item ::= common_expression column_alias", + /* 568 */ "select_item ::= common_expression AS column_alias", + /* 569 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 570 */ "where_clause_opt ::=", + /* 571 */ "where_clause_opt ::= WHERE search_condition", + /* 572 */ "partition_by_clause_opt ::=", + /* 573 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 574 */ "partition_list ::= partition_item", + /* 575 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 576 */ "partition_item ::= expr_or_subquery", + /* 577 */ "partition_item ::= expr_or_subquery column_alias", + /* 578 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 579 */ "twindow_clause_opt ::=", + /* 580 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", + /* 581 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 582 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 583 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 584 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 585 */ "sliding_opt ::=", + /* 586 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", + /* 587 */ "interval_sliding_duration_literal ::= NK_VARIABLE", + /* 588 */ "interval_sliding_duration_literal ::= NK_STRING", + /* 589 */ "interval_sliding_duration_literal ::= NK_INTEGER", + /* 590 */ "fill_opt ::=", + /* 591 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 592 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", + /* 593 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", + /* 594 */ "fill_mode ::= NONE", + /* 595 */ "fill_mode ::= PREV", + /* 596 */ "fill_mode ::= NULL", + /* 597 */ "fill_mode ::= NULL_F", + /* 598 */ "fill_mode ::= LINEAR", + /* 599 */ "fill_mode ::= NEXT", + /* 600 */ "group_by_clause_opt ::=", + /* 601 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 602 */ "group_by_list ::= expr_or_subquery", + /* 603 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 604 */ "having_clause_opt ::=", + /* 605 */ "having_clause_opt ::= HAVING search_condition", + /* 606 */ "range_opt ::=", + /* 607 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 608 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", + /* 609 */ "every_opt ::=", + /* 610 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 611 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 612 */ "query_simple ::= query_specification", + /* 613 */ "query_simple ::= union_query_expression", + /* 614 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 615 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 616 */ "query_simple_or_subquery ::= query_simple", + /* 617 */ "query_simple_or_subquery ::= subquery", + /* 618 */ "query_or_subquery ::= query_expression", + /* 619 */ "query_or_subquery ::= subquery", + /* 620 */ "order_by_clause_opt ::=", + /* 621 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 622 */ "slimit_clause_opt ::=", + /* 623 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 624 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 625 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 626 */ "limit_clause_opt ::=", + /* 627 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 628 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 629 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 630 */ "subquery ::= NK_LP query_expression NK_RP", + /* 631 */ "subquery ::= NK_LP subquery NK_RP", + /* 632 */ "search_condition ::= common_expression", + /* 633 */ "sort_specification_list ::= sort_specification", + /* 634 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 635 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 636 */ "ordering_specification_opt ::=", + /* 637 */ "ordering_specification_opt ::= ASC", + /* 638 */ "ordering_specification_opt ::= DESC", + /* 639 */ "null_ordering_opt ::=", + /* 640 */ "null_ordering_opt ::= NULLS FIRST", + /* 641 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2840,233 +3173,267 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 346: /* cmd */ - case 349: /* literal */ - case 358: /* with_opt */ - case 364: /* search_condition */ - case 369: /* db_options */ - case 371: /* alter_db_options */ - case 373: /* start_opt */ - case 374: /* end_opt */ - case 378: /* signed */ - case 380: /* retention */ - case 381: /* full_table_name */ - case 384: /* table_options */ - case 388: /* alter_table_clause */ - case 389: /* alter_table_options */ - case 392: /* signed_literal */ - case 393: /* create_subtable_clause */ - case 396: /* drop_table_clause */ - case 398: /* column_def */ - case 402: /* duration_literal */ - case 403: /* rollup_func_name */ - case 405: /* col_name */ - case 408: /* like_pattern_opt */ - case 409: /* db_name_cond_opt */ - case 410: /* table_name_cond */ - case 411: /* from_db_opt */ - case 414: /* tag_item */ - case 416: /* index_options */ - case 417: /* full_index_name */ - case 420: /* sliding_opt */ - case 421: /* sma_stream_opt */ - case 422: /* func */ - case 425: /* query_or_subquery */ - case 426: /* where_clause_opt */ - case 429: /* explain_options */ - case 430: /* insert_query */ - case 435: /* full_view_name */ - case 438: /* stream_options */ - case 441: /* subtable_opt */ - case 443: /* expression */ - case 446: /* literal_func */ - case 449: /* expr_or_subquery */ - case 450: /* pseudo_column */ - case 451: /* column_reference */ - case 452: /* function_expression */ - case 453: /* case_when_expression */ - case 458: /* star_func_para */ - case 460: /* case_when_else_opt */ - case 461: /* common_expression */ - case 462: /* when_then_expr */ - case 463: /* predicate */ - case 466: /* in_predicate_value */ - case 467: /* boolean_value_expression */ - case 468: /* boolean_primary */ - case 469: /* from_clause_opt */ - case 470: /* table_reference_list */ - case 471: /* table_reference */ - case 472: /* table_primary */ - case 473: /* joined_table */ - case 475: /* subquery */ - case 476: /* parenthesized_joined_table */ - case 478: /* query_specification */ - case 484: /* range_opt */ - case 485: /* every_opt */ - case 486: /* fill_opt */ - case 487: /* twindow_clause_opt */ - case 489: /* having_clause_opt */ - case 490: /* select_item */ - case 492: /* partition_item */ - case 493: /* interval_sliding_duration_literal */ - case 496: /* query_expression */ - case 497: /* query_simple */ - case 499: /* slimit_clause_opt */ - case 500: /* limit_clause_opt */ - case 501: /* union_query_expression */ - case 502: /* query_simple_or_subquery */ - case 504: /* sort_specification */ + case 347: /* cmd */ + case 350: /* literal */ + case 359: /* with_opt */ + case 365: /* search_condition */ + case 370: /* db_options */ + case 372: /* alter_db_options */ + case 374: /* start_opt */ + case 375: /* end_opt */ + case 379: /* signed */ + case 381: /* retention */ + case 382: /* full_table_name */ + case 385: /* table_options */ + case 389: /* alter_table_clause */ + case 390: /* alter_table_options */ + case 393: /* signed_literal */ + case 394: /* create_subtable_clause */ + case 397: /* drop_table_clause */ + case 399: /* column_def */ + case 403: /* duration_literal */ + case 404: /* rollup_func_name */ + case 406: /* col_name */ + case 409: /* like_pattern_opt */ + case 410: /* db_name_cond_opt */ + case 411: /* table_name_cond */ + case 412: /* from_db_opt */ + case 415: /* tag_item */ + case 417: /* index_options */ + case 418: /* full_index_name */ + case 421: /* sliding_opt */ + case 422: /* sma_stream_opt */ + case 423: /* func */ + case 426: /* query_or_subquery */ + case 427: /* where_clause_opt */ + case 430: /* explain_options */ + case 431: /* insert_query */ + case 436: /* full_view_name */ + case 439: /* stream_options */ + case 442: /* subtable_opt */ + case 444: /* expression */ + case 447: /* literal_func */ + case 450: /* expr_or_subquery */ + case 451: /* pseudo_column */ + case 452: /* column_reference */ + case 453: /* function_expression */ + case 454: /* case_when_expression */ + case 459: /* star_func_para */ + case 461: /* case_when_else_opt */ + case 462: /* common_expression */ + case 463: /* when_then_expr */ + case 464: /* predicate */ + case 467: /* in_predicate_value */ + case 468: /* boolean_value_expression */ + case 469: /* boolean_primary */ + case 470: /* from_clause_opt */ + case 471: /* table_reference_list */ + case 472: /* table_reference */ + case 473: /* table_primary */ + case 474: /* joined_table */ + case 476: /* subquery */ + case 477: /* parenthesized_joined_table */ + case 479: /* query_specification */ + case 485: /* range_opt */ + case 486: /* every_opt */ + case 487: /* fill_opt */ + case 488: /* twindow_clause_opt */ + case 490: /* having_clause_opt */ + case 491: /* select_item */ + case 493: /* partition_item */ + case 494: /* interval_sliding_duration_literal */ + case 497: /* query_expression */ + case 498: /* query_simple */ + case 500: /* slimit_clause_opt */ + case 501: /* limit_clause_opt */ + case 502: /* union_query_expression */ + case 503: /* query_simple_or_subquery */ + case 505: /* sort_specification */ { - nodesDestroyNode((yypminor->yy80)); +#line 7 "sql.y" + nodesDestroyNode((yypminor->yy232)); +#line 3255 "sql.c" } break; - case 347: /* account_options */ - case 348: /* alter_account_options */ - case 350: /* alter_account_option */ - case 372: /* speed_opt */ - case 424: /* with_meta */ - case 433: /* bufsize_opt */ + case 348: /* account_options */ + case 349: /* alter_account_options */ + case 351: /* alter_account_option */ + case 373: /* speed_opt */ + case 425: /* with_meta */ + case 434: /* bufsize_opt */ { +#line 54 "sql.y" +#line 3267 "sql.c" } break; - case 351: /* ip_range_list */ - case 352: /* white_list */ - case 353: /* white_list_opt */ - case 375: /* integer_list */ - case 376: /* variable_list */ - case 377: /* retention_list */ - case 382: /* column_def_list */ - case 383: /* tags_def_opt */ - case 385: /* multi_create_clause */ - case 386: /* tags_def */ - case 387: /* multi_drop_clause */ - case 394: /* specific_cols_opt */ - case 395: /* expression_list */ - case 397: /* col_name_list */ - case 399: /* duration_list */ - case 400: /* rollup_func_list */ - case 412: /* tag_list_opt */ - case 419: /* func_list */ - case 439: /* col_list_opt */ - case 440: /* tag_def_or_ref_opt */ - case 445: /* dnode_list */ - case 447: /* literal_list */ - case 455: /* star_func_para_list */ - case 457: /* other_para_list */ - case 459: /* when_then_list */ - case 479: /* hint_list */ - case 482: /* select_list */ - case 483: /* partition_by_clause_opt */ - case 488: /* group_by_clause_opt */ - case 491: /* partition_list */ - case 495: /* group_by_list */ - case 498: /* order_by_clause_opt */ - case 503: /* sort_specification_list */ + case 352: /* ip_range_list */ + case 353: /* white_list */ + case 354: /* white_list_opt */ + case 376: /* integer_list */ + case 377: /* variable_list */ + case 378: /* retention_list */ + case 383: /* column_def_list */ + case 384: /* tags_def_opt */ + case 386: /* multi_create_clause */ + case 387: /* tags_def */ + case 388: /* multi_drop_clause */ + case 395: /* specific_cols_opt */ + case 396: /* expression_list */ + case 398: /* col_name_list */ + case 400: /* duration_list */ + case 401: /* rollup_func_list */ + case 413: /* tag_list_opt */ + case 420: /* func_list */ + case 440: /* col_list_opt */ + case 441: /* tag_def_or_ref_opt */ + case 446: /* dnode_list */ + case 448: /* literal_list */ + case 456: /* star_func_para_list */ + case 458: /* other_para_list */ + case 460: /* when_then_list */ + case 480: /* hint_list */ + case 483: /* select_list */ + case 484: /* partition_by_clause_opt */ + case 489: /* group_by_clause_opt */ + case 492: /* partition_list */ + case 496: /* group_by_list */ + case 499: /* order_by_clause_opt */ + case 504: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy106)); +#line 85 "sql.y" + nodesDestroyList((yypminor->yy88)); +#line 3306 "sql.c" } break; - case 354: /* user_name */ - case 361: /* db_name */ - case 362: /* table_name */ - case 363: /* topic_name */ - case 365: /* dnode_endpoint */ - case 390: /* column_name */ - case 404: /* function_name */ - case 415: /* column_alias */ - case 418: /* index_name */ - case 423: /* sma_func_name */ - case 427: /* cgroup_name */ - case 434: /* language_opt */ - case 436: /* view_name */ - case 437: /* stream_name */ - case 444: /* on_vgroup_id */ - case 448: /* table_alias */ - case 454: /* star_func */ - case 456: /* noarg_func */ - case 474: /* alias_opt */ + case 355: /* user_name */ + case 362: /* db_name */ + case 363: /* table_name */ + case 364: /* topic_name */ + case 366: /* dnode_endpoint */ + case 391: /* column_name */ + case 405: /* function_name */ + case 416: /* column_alias */ + case 419: /* index_name */ + case 424: /* sma_func_name */ + case 428: /* cgroup_name */ + case 435: /* language_opt */ + case 437: /* view_name */ + case 438: /* stream_name */ + case 445: /* on_vgroup_id */ + case 449: /* table_alias */ + case 455: /* star_func */ + case 457: /* noarg_func */ + case 475: /* alias_opt */ { +#line 812 "sql.y" +#line 3331 "sql.c" } break; - case 355: /* sysinfo_opt */ + case 356: /* sysinfo_opt */ { +#line 112 "sql.y" +#line 3338 "sql.c" } break; - case 356: /* privileges */ - case 359: /* priv_type_list */ - case 360: /* priv_type */ + case 357: /* privileges */ + case 360: /* priv_type_list */ + case 361: /* priv_type */ { +#line 121 "sql.y" +#line 3347 "sql.c" } break; - case 357: /* priv_level */ + case 358: /* priv_level */ { +#line 138 "sql.y" +#line 3354 "sql.c" } break; - case 366: /* force_opt */ - case 367: /* unsafe_opt */ - case 368: /* not_exists_opt */ - case 370: /* exists_opt */ - case 428: /* analyze_opt */ - case 431: /* or_replace_opt */ - case 432: /* agg_func_opt */ - case 442: /* ignore_opt */ - case 480: /* set_quantifier_opt */ - case 481: /* tag_mode_opt */ + case 367: /* force_opt */ + case 368: /* unsafe_opt */ + case 369: /* not_exists_opt */ + case 371: /* exists_opt */ + case 429: /* analyze_opt */ + case 432: /* or_replace_opt */ + case 433: /* agg_func_opt */ + case 443: /* ignore_opt */ + case 481: /* set_quantifier_opt */ + case 482: /* tag_mode_opt */ { +#line 167 "sql.y" +#line 3370 "sql.c" } break; - case 379: /* alter_db_option */ - case 401: /* alter_table_option */ + case 380: /* alter_db_option */ + case 402: /* alter_table_option */ { +#line 265 "sql.y" +#line 3378 "sql.c" } break; - case 391: /* type_name */ + case 392: /* type_name */ { +#line 388 "sql.y" +#line 3385 "sql.c" } break; - case 406: /* db_kind_opt */ - case 413: /* table_kind */ + case 407: /* db_kind_opt */ + case 414: /* table_kind */ { +#line 553 "sql.y" +#line 3393 "sql.c" } break; - case 407: /* table_kind_db_name_cond_opt */ + case 408: /* table_kind_db_name_cond_opt */ { +#line 518 "sql.y" +#line 3400 "sql.c" } break; - case 464: /* compare_op */ - case 465: /* in_op */ + case 465: /* compare_op */ + case 466: /* in_op */ { +#line 1002 "sql.y" +#line 3408 "sql.c" } break; - case 477: /* join_type */ + case 478: /* join_type */ { +#line 1078 "sql.y" +#line 3415 "sql.c" } break; - case 494: /* fill_mode */ + case 495: /* fill_mode */ { +#line 1169 "sql.y" +#line 3422 "sql.c" } break; - case 505: /* ordering_specification_opt */ + case 506: /* ordering_specification_opt */ { +#line 1254 "sql.y" +#line 3429 "sql.c" } break; - case 506: /* null_ordering_opt */ + case 507: /* null_ordering_opt */ { +#line 1260 "sql.y" +#line 3436 "sql.c" } break; /********* End destructor definitions *****************************************/ @@ -3233,7 +3600,7 @@ static YYACTIONTYPE yy_find_shift_action( #endif /* YYWILDCARD */ return yy_default[stateno]; }else{ - assert( i>=0 && i=0 && i<(int)(sizeof(yy_action)/sizeof(yy_action[0])) ); return yy_action[i]; } }while(1); @@ -3355,645 +3722,648 @@ static void yy_shift( /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side ** of that rule */ static const YYCODETYPE yyRuleInfoLhs[] = { - 346, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - 346, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - 347, /* (2) account_options ::= */ - 347, /* (3) account_options ::= account_options PPS literal */ - 347, /* (4) account_options ::= account_options TSERIES literal */ - 347, /* (5) account_options ::= account_options STORAGE literal */ - 347, /* (6) account_options ::= account_options STREAMS literal */ - 347, /* (7) account_options ::= account_options QTIME literal */ - 347, /* (8) account_options ::= account_options DBS literal */ - 347, /* (9) account_options ::= account_options USERS literal */ - 347, /* (10) account_options ::= account_options CONNS literal */ - 347, /* (11) account_options ::= account_options STATE literal */ - 348, /* (12) alter_account_options ::= alter_account_option */ - 348, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - 350, /* (14) alter_account_option ::= PASS literal */ - 350, /* (15) alter_account_option ::= PPS literal */ - 350, /* (16) alter_account_option ::= TSERIES literal */ - 350, /* (17) alter_account_option ::= STORAGE literal */ - 350, /* (18) alter_account_option ::= STREAMS literal */ - 350, /* (19) alter_account_option ::= QTIME literal */ - 350, /* (20) alter_account_option ::= DBS literal */ - 350, /* (21) alter_account_option ::= USERS literal */ - 350, /* (22) alter_account_option ::= CONNS literal */ - 350, /* (23) alter_account_option ::= STATE literal */ - 351, /* (24) ip_range_list ::= NK_STRING */ - 351, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ - 352, /* (26) white_list ::= HOST ip_range_list */ - 353, /* (27) white_list_opt ::= */ - 353, /* (28) white_list_opt ::= white_list */ - 346, /* (29) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt white_list_opt */ - 346, /* (30) cmd ::= ALTER USER user_name PASS NK_STRING */ - 346, /* (31) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - 346, /* (32) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - 346, /* (33) cmd ::= ALTER USER user_name ADD white_list */ - 346, /* (34) cmd ::= ALTER USER user_name DROP white_list */ - 346, /* (35) cmd ::= DROP USER user_name */ - 355, /* (36) sysinfo_opt ::= */ - 355, /* (37) sysinfo_opt ::= SYSINFO NK_INTEGER */ - 346, /* (38) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ - 346, /* (39) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ - 356, /* (40) privileges ::= ALL */ - 356, /* (41) privileges ::= priv_type_list */ - 356, /* (42) privileges ::= SUBSCRIBE */ - 359, /* (43) priv_type_list ::= priv_type */ - 359, /* (44) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - 360, /* (45) priv_type ::= READ */ - 360, /* (46) priv_type ::= WRITE */ - 360, /* (47) priv_type ::= ALTER */ - 357, /* (48) priv_level ::= NK_STAR NK_DOT NK_STAR */ - 357, /* (49) priv_level ::= db_name NK_DOT NK_STAR */ - 357, /* (50) priv_level ::= db_name NK_DOT table_name */ - 357, /* (51) priv_level ::= topic_name */ - 358, /* (52) with_opt ::= */ - 358, /* (53) with_opt ::= WITH search_condition */ - 346, /* (54) cmd ::= CREATE DNODE dnode_endpoint */ - 346, /* (55) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - 346, /* (56) cmd ::= DROP DNODE NK_INTEGER force_opt */ - 346, /* (57) cmd ::= DROP DNODE dnode_endpoint force_opt */ - 346, /* (58) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ - 346, /* (59) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ - 346, /* (60) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - 346, /* (61) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - 346, /* (62) cmd ::= ALTER ALL DNODES NK_STRING */ - 346, /* (63) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - 346, /* (64) cmd ::= RESTORE DNODE NK_INTEGER */ - 365, /* (65) dnode_endpoint ::= NK_STRING */ - 365, /* (66) dnode_endpoint ::= NK_ID */ - 365, /* (67) dnode_endpoint ::= NK_IPTOKEN */ - 366, /* (68) force_opt ::= */ - 366, /* (69) force_opt ::= FORCE */ - 367, /* (70) unsafe_opt ::= UNSAFE */ - 346, /* (71) cmd ::= ALTER LOCAL NK_STRING */ - 346, /* (72) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - 346, /* (73) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - 346, /* (74) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - 346, /* (75) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ - 346, /* (76) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - 346, /* (77) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - 346, /* (78) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - 346, /* (79) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - 346, /* (80) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - 346, /* (81) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - 346, /* (82) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ - 346, /* (83) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ - 346, /* (84) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - 346, /* (85) cmd ::= DROP DATABASE exists_opt db_name */ - 346, /* (86) cmd ::= USE db_name */ - 346, /* (87) cmd ::= ALTER DATABASE db_name alter_db_options */ - 346, /* (88) cmd ::= FLUSH DATABASE db_name */ - 346, /* (89) cmd ::= TRIM DATABASE db_name speed_opt */ - 346, /* (90) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ - 368, /* (91) not_exists_opt ::= IF NOT EXISTS */ - 368, /* (92) not_exists_opt ::= */ - 370, /* (93) exists_opt ::= IF EXISTS */ - 370, /* (94) exists_opt ::= */ - 369, /* (95) db_options ::= */ - 369, /* (96) db_options ::= db_options BUFFER NK_INTEGER */ - 369, /* (97) db_options ::= db_options CACHEMODEL NK_STRING */ - 369, /* (98) db_options ::= db_options CACHESIZE NK_INTEGER */ - 369, /* (99) db_options ::= db_options COMP NK_INTEGER */ - 369, /* (100) db_options ::= db_options DURATION NK_INTEGER */ - 369, /* (101) db_options ::= db_options DURATION NK_VARIABLE */ - 369, /* (102) db_options ::= db_options MAXROWS NK_INTEGER */ - 369, /* (103) db_options ::= db_options MINROWS NK_INTEGER */ - 369, /* (104) db_options ::= db_options KEEP integer_list */ - 369, /* (105) db_options ::= db_options KEEP variable_list */ - 369, /* (106) db_options ::= db_options PAGES NK_INTEGER */ - 369, /* (107) db_options ::= db_options PAGESIZE NK_INTEGER */ - 369, /* (108) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ - 369, /* (109) db_options ::= db_options PRECISION NK_STRING */ - 369, /* (110) db_options ::= db_options REPLICA NK_INTEGER */ - 369, /* (111) db_options ::= db_options VGROUPS NK_INTEGER */ - 369, /* (112) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - 369, /* (113) db_options ::= db_options RETENTIONS retention_list */ - 369, /* (114) db_options ::= db_options SCHEMALESS NK_INTEGER */ - 369, /* (115) db_options ::= db_options WAL_LEVEL NK_INTEGER */ - 369, /* (116) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ - 369, /* (117) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ - 369, /* (118) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - 369, /* (119) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ - 369, /* (120) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - 369, /* (121) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ - 369, /* (122) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ - 369, /* (123) db_options ::= db_options STT_TRIGGER NK_INTEGER */ - 369, /* (124) db_options ::= db_options TABLE_PREFIX signed */ - 369, /* (125) db_options ::= db_options TABLE_SUFFIX signed */ - 369, /* (126) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ - 371, /* (127) alter_db_options ::= alter_db_option */ - 371, /* (128) alter_db_options ::= alter_db_options alter_db_option */ - 379, /* (129) alter_db_option ::= BUFFER NK_INTEGER */ - 379, /* (130) alter_db_option ::= CACHEMODEL NK_STRING */ - 379, /* (131) alter_db_option ::= CACHESIZE NK_INTEGER */ - 379, /* (132) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - 379, /* (133) alter_db_option ::= KEEP integer_list */ - 379, /* (134) alter_db_option ::= KEEP variable_list */ - 379, /* (135) alter_db_option ::= PAGES NK_INTEGER */ - 379, /* (136) alter_db_option ::= REPLICA NK_INTEGER */ - 379, /* (137) alter_db_option ::= WAL_LEVEL NK_INTEGER */ - 379, /* (138) alter_db_option ::= STT_TRIGGER NK_INTEGER */ - 379, /* (139) alter_db_option ::= MINROWS NK_INTEGER */ - 379, /* (140) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ - 379, /* (141) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - 379, /* (142) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ - 379, /* (143) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - 379, /* (144) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ - 375, /* (145) integer_list ::= NK_INTEGER */ - 375, /* (146) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - 376, /* (147) variable_list ::= NK_VARIABLE */ - 376, /* (148) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - 377, /* (149) retention_list ::= retention */ - 377, /* (150) retention_list ::= retention_list NK_COMMA retention */ - 380, /* (151) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - 380, /* (152) retention ::= NK_MINUS NK_COLON NK_VARIABLE */ - 372, /* (153) speed_opt ::= */ - 372, /* (154) speed_opt ::= BWLIMIT NK_INTEGER */ - 373, /* (155) start_opt ::= */ - 373, /* (156) start_opt ::= START WITH NK_INTEGER */ - 373, /* (157) start_opt ::= START WITH NK_STRING */ - 373, /* (158) start_opt ::= START WITH TIMESTAMP NK_STRING */ - 374, /* (159) end_opt ::= */ - 374, /* (160) end_opt ::= END WITH NK_INTEGER */ - 374, /* (161) end_opt ::= END WITH NK_STRING */ - 374, /* (162) end_opt ::= END WITH TIMESTAMP NK_STRING */ - 346, /* (163) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - 346, /* (164) cmd ::= CREATE TABLE multi_create_clause */ - 346, /* (165) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - 346, /* (166) cmd ::= DROP TABLE multi_drop_clause */ - 346, /* (167) cmd ::= DROP STABLE exists_opt full_table_name */ - 346, /* (168) cmd ::= ALTER TABLE alter_table_clause */ - 346, /* (169) cmd ::= ALTER STABLE alter_table_clause */ - 388, /* (170) alter_table_clause ::= full_table_name alter_table_options */ - 388, /* (171) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - 388, /* (172) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - 388, /* (173) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - 388, /* (174) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - 388, /* (175) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - 388, /* (176) alter_table_clause ::= full_table_name DROP TAG column_name */ - 388, /* (177) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - 388, /* (178) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - 388, /* (179) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - 385, /* (180) multi_create_clause ::= create_subtable_clause */ - 385, /* (181) multi_create_clause ::= multi_create_clause create_subtable_clause */ - 393, /* (182) 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 */ - 387, /* (183) multi_drop_clause ::= drop_table_clause */ - 387, /* (184) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - 396, /* (185) drop_table_clause ::= exists_opt full_table_name */ - 394, /* (186) specific_cols_opt ::= */ - 394, /* (187) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - 381, /* (188) full_table_name ::= table_name */ - 381, /* (189) full_table_name ::= db_name NK_DOT table_name */ - 382, /* (190) column_def_list ::= column_def */ - 382, /* (191) column_def_list ::= column_def_list NK_COMMA column_def */ - 398, /* (192) column_def ::= column_name type_name */ - 391, /* (193) type_name ::= BOOL */ - 391, /* (194) type_name ::= TINYINT */ - 391, /* (195) type_name ::= SMALLINT */ - 391, /* (196) type_name ::= INT */ - 391, /* (197) type_name ::= INTEGER */ - 391, /* (198) type_name ::= BIGINT */ - 391, /* (199) type_name ::= FLOAT */ - 391, /* (200) type_name ::= DOUBLE */ - 391, /* (201) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - 391, /* (202) type_name ::= TIMESTAMP */ - 391, /* (203) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - 391, /* (204) type_name ::= TINYINT UNSIGNED */ - 391, /* (205) type_name ::= SMALLINT UNSIGNED */ - 391, /* (206) type_name ::= INT UNSIGNED */ - 391, /* (207) type_name ::= BIGINT UNSIGNED */ - 391, /* (208) type_name ::= JSON */ - 391, /* (209) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - 391, /* (210) type_name ::= MEDIUMBLOB */ - 391, /* (211) type_name ::= BLOB */ - 391, /* (212) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - 391, /* (213) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - 391, /* (214) type_name ::= DECIMAL */ - 391, /* (215) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - 391, /* (216) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 383, /* (217) tags_def_opt ::= */ - 383, /* (218) tags_def_opt ::= tags_def */ - 386, /* (219) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - 384, /* (220) table_options ::= */ - 384, /* (221) table_options ::= table_options COMMENT NK_STRING */ - 384, /* (222) table_options ::= table_options MAX_DELAY duration_list */ - 384, /* (223) table_options ::= table_options WATERMARK duration_list */ - 384, /* (224) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - 384, /* (225) table_options ::= table_options TTL NK_INTEGER */ - 384, /* (226) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - 384, /* (227) table_options ::= table_options DELETE_MARK duration_list */ - 389, /* (228) alter_table_options ::= alter_table_option */ - 389, /* (229) alter_table_options ::= alter_table_options alter_table_option */ - 401, /* (230) alter_table_option ::= COMMENT NK_STRING */ - 401, /* (231) alter_table_option ::= TTL NK_INTEGER */ - 399, /* (232) duration_list ::= duration_literal */ - 399, /* (233) duration_list ::= duration_list NK_COMMA duration_literal */ - 400, /* (234) rollup_func_list ::= rollup_func_name */ - 400, /* (235) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - 403, /* (236) rollup_func_name ::= function_name */ - 403, /* (237) rollup_func_name ::= FIRST */ - 403, /* (238) rollup_func_name ::= LAST */ - 397, /* (239) col_name_list ::= col_name */ - 397, /* (240) col_name_list ::= col_name_list NK_COMMA col_name */ - 405, /* (241) col_name ::= column_name */ - 346, /* (242) cmd ::= SHOW DNODES */ - 346, /* (243) cmd ::= SHOW USERS */ - 346, /* (244) cmd ::= SHOW USER PRIVILEGES */ - 346, /* (245) cmd ::= SHOW db_kind_opt DATABASES */ - 346, /* (246) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ - 346, /* (247) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - 346, /* (248) cmd ::= SHOW db_name_cond_opt VGROUPS */ - 346, /* (249) cmd ::= SHOW MNODES */ - 346, /* (250) cmd ::= SHOW QNODES */ - 346, /* (251) cmd ::= SHOW FUNCTIONS */ - 346, /* (252) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - 346, /* (253) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - 346, /* (254) cmd ::= SHOW STREAMS */ - 346, /* (255) cmd ::= SHOW ACCOUNTS */ - 346, /* (256) cmd ::= SHOW APPS */ - 346, /* (257) cmd ::= SHOW CONNECTIONS */ - 346, /* (258) cmd ::= SHOW LICENCES */ - 346, /* (259) cmd ::= SHOW GRANTS */ - 346, /* (260) cmd ::= SHOW CREATE DATABASE db_name */ - 346, /* (261) cmd ::= SHOW CREATE TABLE full_table_name */ - 346, /* (262) cmd ::= SHOW CREATE STABLE full_table_name */ - 346, /* (263) cmd ::= SHOW QUERIES */ - 346, /* (264) cmd ::= SHOW SCORES */ - 346, /* (265) cmd ::= SHOW TOPICS */ - 346, /* (266) cmd ::= SHOW VARIABLES */ - 346, /* (267) cmd ::= SHOW CLUSTER VARIABLES */ - 346, /* (268) cmd ::= SHOW LOCAL VARIABLES */ - 346, /* (269) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - 346, /* (270) cmd ::= SHOW BNODES */ - 346, /* (271) cmd ::= SHOW SNODES */ - 346, /* (272) cmd ::= SHOW CLUSTER */ - 346, /* (273) cmd ::= SHOW TRANSACTIONS */ - 346, /* (274) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - 346, /* (275) cmd ::= SHOW CONSUMERS */ - 346, /* (276) cmd ::= SHOW SUBSCRIPTIONS */ - 346, /* (277) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - 346, /* (278) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - 346, /* (279) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - 346, /* (280) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - 346, /* (281) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - 346, /* (282) cmd ::= SHOW VNODES */ - 346, /* (283) cmd ::= SHOW db_name_cond_opt ALIVE */ - 346, /* (284) cmd ::= SHOW CLUSTER ALIVE */ - 346, /* (285) cmd ::= SHOW db_name_cond_opt VIEWS */ - 346, /* (286) cmd ::= SHOW CREATE VIEW full_table_name */ - 407, /* (287) table_kind_db_name_cond_opt ::= */ - 407, /* (288) table_kind_db_name_cond_opt ::= table_kind */ - 407, /* (289) table_kind_db_name_cond_opt ::= db_name NK_DOT */ - 407, /* (290) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ - 413, /* (291) table_kind ::= NORMAL */ - 413, /* (292) table_kind ::= CHILD */ - 409, /* (293) db_name_cond_opt ::= */ - 409, /* (294) db_name_cond_opt ::= db_name NK_DOT */ - 408, /* (295) like_pattern_opt ::= */ - 408, /* (296) like_pattern_opt ::= LIKE NK_STRING */ - 410, /* (297) table_name_cond ::= table_name */ - 411, /* (298) from_db_opt ::= */ - 411, /* (299) from_db_opt ::= FROM db_name */ - 412, /* (300) tag_list_opt ::= */ - 412, /* (301) tag_list_opt ::= tag_item */ - 412, /* (302) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - 414, /* (303) tag_item ::= TBNAME */ - 414, /* (304) tag_item ::= QTAGS */ - 414, /* (305) tag_item ::= column_name */ - 414, /* (306) tag_item ::= column_name column_alias */ - 414, /* (307) tag_item ::= column_name AS column_alias */ - 406, /* (308) db_kind_opt ::= */ - 406, /* (309) db_kind_opt ::= USER */ - 406, /* (310) db_kind_opt ::= SYSTEM */ - 346, /* (311) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - 346, /* (312) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - 346, /* (313) cmd ::= DROP INDEX exists_opt full_index_name */ - 417, /* (314) full_index_name ::= index_name */ - 417, /* (315) full_index_name ::= db_name NK_DOT index_name */ - 416, /* (316) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - 416, /* (317) 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 */ - 419, /* (318) func_list ::= func */ - 419, /* (319) func_list ::= func_list NK_COMMA func */ - 422, /* (320) func ::= sma_func_name NK_LP expression_list NK_RP */ - 423, /* (321) sma_func_name ::= function_name */ - 423, /* (322) sma_func_name ::= COUNT */ - 423, /* (323) sma_func_name ::= FIRST */ - 423, /* (324) sma_func_name ::= LAST */ - 423, /* (325) sma_func_name ::= LAST_ROW */ - 421, /* (326) sma_stream_opt ::= */ - 421, /* (327) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - 421, /* (328) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - 421, /* (329) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - 424, /* (330) with_meta ::= AS */ - 424, /* (331) with_meta ::= WITH META AS */ - 424, /* (332) with_meta ::= ONLY META AS */ - 346, /* (333) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - 346, /* (334) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - 346, /* (335) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - 346, /* (336) cmd ::= DROP TOPIC exists_opt topic_name */ - 346, /* (337) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - 346, /* (338) cmd ::= DESC full_table_name */ - 346, /* (339) cmd ::= DESCRIBE full_table_name */ - 346, /* (340) cmd ::= RESET QUERY CACHE */ - 346, /* (341) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - 346, /* (342) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 428, /* (343) analyze_opt ::= */ - 428, /* (344) analyze_opt ::= ANALYZE */ - 429, /* (345) explain_options ::= */ - 429, /* (346) explain_options ::= explain_options VERBOSE NK_BOOL */ - 429, /* (347) explain_options ::= explain_options RATIO NK_FLOAT */ - 346, /* (348) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - 346, /* (349) cmd ::= DROP FUNCTION exists_opt function_name */ - 432, /* (350) agg_func_opt ::= */ - 432, /* (351) agg_func_opt ::= AGGREGATE */ - 433, /* (352) bufsize_opt ::= */ - 433, /* (353) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 434, /* (354) language_opt ::= */ - 434, /* (355) language_opt ::= LANGUAGE NK_STRING */ - 431, /* (356) or_replace_opt ::= */ - 431, /* (357) or_replace_opt ::= OR REPLACE */ - 346, /* (358) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ - 346, /* (359) cmd ::= DROP VIEW exists_opt full_view_name */ - 435, /* (360) full_view_name ::= view_name */ - 435, /* (361) full_view_name ::= db_name NK_DOT view_name */ - 346, /* (362) 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 */ - 346, /* (363) cmd ::= DROP STREAM exists_opt stream_name */ - 346, /* (364) cmd ::= PAUSE STREAM exists_opt stream_name */ - 346, /* (365) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 439, /* (366) col_list_opt ::= */ - 439, /* (367) col_list_opt ::= NK_LP col_name_list NK_RP */ - 440, /* (368) tag_def_or_ref_opt ::= */ - 440, /* (369) tag_def_or_ref_opt ::= tags_def */ - 440, /* (370) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - 438, /* (371) stream_options ::= */ - 438, /* (372) stream_options ::= stream_options TRIGGER AT_ONCE */ - 438, /* (373) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - 438, /* (374) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - 438, /* (375) stream_options ::= stream_options WATERMARK duration_literal */ - 438, /* (376) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - 438, /* (377) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - 438, /* (378) stream_options ::= stream_options DELETE_MARK duration_literal */ - 438, /* (379) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 441, /* (380) subtable_opt ::= */ - 441, /* (381) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 442, /* (382) ignore_opt ::= */ - 442, /* (383) ignore_opt ::= IGNORE UNTREATED */ - 346, /* (384) cmd ::= KILL CONNECTION NK_INTEGER */ - 346, /* (385) cmd ::= KILL QUERY NK_STRING */ - 346, /* (386) cmd ::= KILL TRANSACTION NK_INTEGER */ - 346, /* (387) cmd ::= BALANCE VGROUP */ - 346, /* (388) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - 346, /* (389) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - 346, /* (390) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - 346, /* (391) cmd ::= SPLIT VGROUP NK_INTEGER */ - 444, /* (392) on_vgroup_id ::= */ - 444, /* (393) on_vgroup_id ::= ON NK_INTEGER */ - 445, /* (394) dnode_list ::= DNODE NK_INTEGER */ - 445, /* (395) dnode_list ::= dnode_list DNODE NK_INTEGER */ - 346, /* (396) cmd ::= DELETE FROM full_table_name where_clause_opt */ - 346, /* (397) cmd ::= query_or_subquery */ - 346, /* (398) cmd ::= insert_query */ - 430, /* (399) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - 430, /* (400) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - 349, /* (401) literal ::= NK_INTEGER */ - 349, /* (402) literal ::= NK_FLOAT */ - 349, /* (403) literal ::= NK_STRING */ - 349, /* (404) literal ::= NK_BOOL */ - 349, /* (405) literal ::= TIMESTAMP NK_STRING */ - 349, /* (406) literal ::= duration_literal */ - 349, /* (407) literal ::= NULL */ - 349, /* (408) literal ::= NK_QUESTION */ - 402, /* (409) duration_literal ::= NK_VARIABLE */ - 378, /* (410) signed ::= NK_INTEGER */ - 378, /* (411) signed ::= NK_PLUS NK_INTEGER */ - 378, /* (412) signed ::= NK_MINUS NK_INTEGER */ - 378, /* (413) signed ::= NK_FLOAT */ - 378, /* (414) signed ::= NK_PLUS NK_FLOAT */ - 378, /* (415) signed ::= NK_MINUS NK_FLOAT */ - 392, /* (416) signed_literal ::= signed */ - 392, /* (417) signed_literal ::= NK_STRING */ - 392, /* (418) signed_literal ::= NK_BOOL */ - 392, /* (419) signed_literal ::= TIMESTAMP NK_STRING */ - 392, /* (420) signed_literal ::= duration_literal */ - 392, /* (421) signed_literal ::= NULL */ - 392, /* (422) signed_literal ::= literal_func */ - 392, /* (423) signed_literal ::= NK_QUESTION */ - 447, /* (424) literal_list ::= signed_literal */ - 447, /* (425) literal_list ::= literal_list NK_COMMA signed_literal */ - 361, /* (426) db_name ::= NK_ID */ - 362, /* (427) table_name ::= NK_ID */ - 390, /* (428) column_name ::= NK_ID */ - 404, /* (429) function_name ::= NK_ID */ - 436, /* (430) view_name ::= NK_ID */ - 448, /* (431) table_alias ::= NK_ID */ - 415, /* (432) column_alias ::= NK_ID */ - 415, /* (433) column_alias ::= NK_ALIAS */ - 354, /* (434) user_name ::= NK_ID */ - 363, /* (435) topic_name ::= NK_ID */ - 437, /* (436) stream_name ::= NK_ID */ - 427, /* (437) cgroup_name ::= NK_ID */ - 418, /* (438) index_name ::= NK_ID */ - 449, /* (439) expr_or_subquery ::= expression */ - 443, /* (440) expression ::= literal */ - 443, /* (441) expression ::= pseudo_column */ - 443, /* (442) expression ::= column_reference */ - 443, /* (443) expression ::= function_expression */ - 443, /* (444) expression ::= case_when_expression */ - 443, /* (445) expression ::= NK_LP expression NK_RP */ - 443, /* (446) expression ::= NK_PLUS expr_or_subquery */ - 443, /* (447) expression ::= NK_MINUS expr_or_subquery */ - 443, /* (448) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - 443, /* (449) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - 443, /* (450) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - 443, /* (451) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - 443, /* (452) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - 443, /* (453) expression ::= column_reference NK_ARROW NK_STRING */ - 443, /* (454) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - 443, /* (455) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - 395, /* (456) expression_list ::= expr_or_subquery */ - 395, /* (457) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - 451, /* (458) column_reference ::= column_name */ - 451, /* (459) column_reference ::= table_name NK_DOT column_name */ - 451, /* (460) column_reference ::= NK_ALIAS */ - 451, /* (461) column_reference ::= table_name NK_DOT NK_ALIAS */ - 450, /* (462) pseudo_column ::= ROWTS */ - 450, /* (463) pseudo_column ::= TBNAME */ - 450, /* (464) pseudo_column ::= table_name NK_DOT TBNAME */ - 450, /* (465) pseudo_column ::= QSTART */ - 450, /* (466) pseudo_column ::= QEND */ - 450, /* (467) pseudo_column ::= QDURATION */ - 450, /* (468) pseudo_column ::= WSTART */ - 450, /* (469) pseudo_column ::= WEND */ - 450, /* (470) pseudo_column ::= WDURATION */ - 450, /* (471) pseudo_column ::= IROWTS */ - 450, /* (472) pseudo_column ::= ISFILLED */ - 450, /* (473) pseudo_column ::= QTAGS */ - 452, /* (474) function_expression ::= function_name NK_LP expression_list NK_RP */ - 452, /* (475) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - 452, /* (476) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - 452, /* (477) function_expression ::= literal_func */ - 446, /* (478) literal_func ::= noarg_func NK_LP NK_RP */ - 446, /* (479) literal_func ::= NOW */ - 456, /* (480) noarg_func ::= NOW */ - 456, /* (481) noarg_func ::= TODAY */ - 456, /* (482) noarg_func ::= TIMEZONE */ - 456, /* (483) noarg_func ::= DATABASE */ - 456, /* (484) noarg_func ::= CLIENT_VERSION */ - 456, /* (485) noarg_func ::= SERVER_VERSION */ - 456, /* (486) noarg_func ::= SERVER_STATUS */ - 456, /* (487) noarg_func ::= CURRENT_USER */ - 456, /* (488) noarg_func ::= USER */ - 454, /* (489) star_func ::= COUNT */ - 454, /* (490) star_func ::= FIRST */ - 454, /* (491) star_func ::= LAST */ - 454, /* (492) star_func ::= LAST_ROW */ - 455, /* (493) star_func_para_list ::= NK_STAR */ - 455, /* (494) star_func_para_list ::= other_para_list */ - 457, /* (495) other_para_list ::= star_func_para */ - 457, /* (496) other_para_list ::= other_para_list NK_COMMA star_func_para */ - 458, /* (497) star_func_para ::= expr_or_subquery */ - 458, /* (498) star_func_para ::= table_name NK_DOT NK_STAR */ - 453, /* (499) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - 453, /* (500) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - 459, /* (501) when_then_list ::= when_then_expr */ - 459, /* (502) when_then_list ::= when_then_list when_then_expr */ - 462, /* (503) when_then_expr ::= WHEN common_expression THEN common_expression */ - 460, /* (504) case_when_else_opt ::= */ - 460, /* (505) case_when_else_opt ::= ELSE common_expression */ - 463, /* (506) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - 463, /* (507) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - 463, /* (508) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - 463, /* (509) predicate ::= expr_or_subquery IS NULL */ - 463, /* (510) predicate ::= expr_or_subquery IS NOT NULL */ - 463, /* (511) predicate ::= expr_or_subquery in_op in_predicate_value */ - 464, /* (512) compare_op ::= NK_LT */ - 464, /* (513) compare_op ::= NK_GT */ - 464, /* (514) compare_op ::= NK_LE */ - 464, /* (515) compare_op ::= NK_GE */ - 464, /* (516) compare_op ::= NK_NE */ - 464, /* (517) compare_op ::= NK_EQ */ - 464, /* (518) compare_op ::= LIKE */ - 464, /* (519) compare_op ::= NOT LIKE */ - 464, /* (520) compare_op ::= MATCH */ - 464, /* (521) compare_op ::= NMATCH */ - 464, /* (522) compare_op ::= CONTAINS */ - 465, /* (523) in_op ::= IN */ - 465, /* (524) in_op ::= NOT IN */ - 466, /* (525) in_predicate_value ::= NK_LP literal_list NK_RP */ - 467, /* (526) boolean_value_expression ::= boolean_primary */ - 467, /* (527) boolean_value_expression ::= NOT boolean_primary */ - 467, /* (528) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - 467, /* (529) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - 468, /* (530) boolean_primary ::= predicate */ - 468, /* (531) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - 461, /* (532) common_expression ::= expr_or_subquery */ - 461, /* (533) common_expression ::= boolean_value_expression */ - 469, /* (534) from_clause_opt ::= */ - 469, /* (535) from_clause_opt ::= FROM table_reference_list */ - 470, /* (536) table_reference_list ::= table_reference */ - 470, /* (537) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - 471, /* (538) table_reference ::= table_primary */ - 471, /* (539) table_reference ::= joined_table */ - 472, /* (540) table_primary ::= table_name alias_opt */ - 472, /* (541) table_primary ::= db_name NK_DOT table_name alias_opt */ - 472, /* (542) table_primary ::= subquery alias_opt */ - 472, /* (543) table_primary ::= parenthesized_joined_table */ - 474, /* (544) alias_opt ::= */ - 474, /* (545) alias_opt ::= table_alias */ - 474, /* (546) alias_opt ::= AS table_alias */ - 476, /* (547) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - 476, /* (548) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - 473, /* (549) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - 477, /* (550) join_type ::= */ - 477, /* (551) join_type ::= INNER */ - 478, /* (552) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 */ - 479, /* (553) hint_list ::= */ - 479, /* (554) hint_list ::= NK_HINT */ - 481, /* (555) tag_mode_opt ::= */ - 481, /* (556) tag_mode_opt ::= TAGS */ - 480, /* (557) set_quantifier_opt ::= */ - 480, /* (558) set_quantifier_opt ::= DISTINCT */ - 480, /* (559) set_quantifier_opt ::= ALL */ - 482, /* (560) select_list ::= select_item */ - 482, /* (561) select_list ::= select_list NK_COMMA select_item */ - 490, /* (562) select_item ::= NK_STAR */ - 490, /* (563) select_item ::= common_expression */ - 490, /* (564) select_item ::= common_expression column_alias */ - 490, /* (565) select_item ::= common_expression AS column_alias */ - 490, /* (566) select_item ::= table_name NK_DOT NK_STAR */ - 426, /* (567) where_clause_opt ::= */ - 426, /* (568) where_clause_opt ::= WHERE search_condition */ - 483, /* (569) partition_by_clause_opt ::= */ - 483, /* (570) partition_by_clause_opt ::= PARTITION BY partition_list */ - 491, /* (571) partition_list ::= partition_item */ - 491, /* (572) partition_list ::= partition_list NK_COMMA partition_item */ - 492, /* (573) partition_item ::= expr_or_subquery */ - 492, /* (574) partition_item ::= expr_or_subquery column_alias */ - 492, /* (575) partition_item ::= expr_or_subquery AS column_alias */ - 487, /* (576) twindow_clause_opt ::= */ - 487, /* (577) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - 487, /* (578) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - 487, /* (579) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 487, /* (580) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 487, /* (581) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 420, /* (582) sliding_opt ::= */ - 420, /* (583) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - 493, /* (584) interval_sliding_duration_literal ::= NK_VARIABLE */ - 493, /* (585) interval_sliding_duration_literal ::= NK_STRING */ - 493, /* (586) interval_sliding_duration_literal ::= NK_INTEGER */ - 486, /* (587) fill_opt ::= */ - 486, /* (588) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - 486, /* (589) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - 486, /* (590) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - 494, /* (591) fill_mode ::= NONE */ - 494, /* (592) fill_mode ::= PREV */ - 494, /* (593) fill_mode ::= NULL */ - 494, /* (594) fill_mode ::= NULL_F */ - 494, /* (595) fill_mode ::= LINEAR */ - 494, /* (596) fill_mode ::= NEXT */ - 488, /* (597) group_by_clause_opt ::= */ - 488, /* (598) group_by_clause_opt ::= GROUP BY group_by_list */ - 495, /* (599) group_by_list ::= expr_or_subquery */ - 495, /* (600) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 489, /* (601) having_clause_opt ::= */ - 489, /* (602) having_clause_opt ::= HAVING search_condition */ - 484, /* (603) range_opt ::= */ - 484, /* (604) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - 484, /* (605) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 485, /* (606) every_opt ::= */ - 485, /* (607) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - 496, /* (608) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - 497, /* (609) query_simple ::= query_specification */ - 497, /* (610) query_simple ::= union_query_expression */ - 501, /* (611) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - 501, /* (612) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - 502, /* (613) query_simple_or_subquery ::= query_simple */ - 502, /* (614) query_simple_or_subquery ::= subquery */ - 425, /* (615) query_or_subquery ::= query_expression */ - 425, /* (616) query_or_subquery ::= subquery */ - 498, /* (617) order_by_clause_opt ::= */ - 498, /* (618) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 499, /* (619) slimit_clause_opt ::= */ - 499, /* (620) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - 499, /* (621) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - 499, /* (622) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 500, /* (623) limit_clause_opt ::= */ - 500, /* (624) limit_clause_opt ::= LIMIT NK_INTEGER */ - 500, /* (625) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - 500, /* (626) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 475, /* (627) subquery ::= NK_LP query_expression NK_RP */ - 475, /* (628) subquery ::= NK_LP subquery NK_RP */ - 364, /* (629) search_condition ::= common_expression */ - 503, /* (630) sort_specification_list ::= sort_specification */ - 503, /* (631) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - 504, /* (632) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 505, /* (633) ordering_specification_opt ::= */ - 505, /* (634) ordering_specification_opt ::= ASC */ - 505, /* (635) ordering_specification_opt ::= DESC */ - 506, /* (636) null_ordering_opt ::= */ - 506, /* (637) null_ordering_opt ::= NULLS FIRST */ - 506, /* (638) null_ordering_opt ::= NULLS LAST */ + 347, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + 347, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + 348, /* (2) account_options ::= */ + 348, /* (3) account_options ::= account_options PPS literal */ + 348, /* (4) account_options ::= account_options TSERIES literal */ + 348, /* (5) account_options ::= account_options STORAGE literal */ + 348, /* (6) account_options ::= account_options STREAMS literal */ + 348, /* (7) account_options ::= account_options QTIME literal */ + 348, /* (8) account_options ::= account_options DBS literal */ + 348, /* (9) account_options ::= account_options USERS literal */ + 348, /* (10) account_options ::= account_options CONNS literal */ + 348, /* (11) account_options ::= account_options STATE literal */ + 349, /* (12) alter_account_options ::= alter_account_option */ + 349, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + 351, /* (14) alter_account_option ::= PASS literal */ + 351, /* (15) alter_account_option ::= PPS literal */ + 351, /* (16) alter_account_option ::= TSERIES literal */ + 351, /* (17) alter_account_option ::= STORAGE literal */ + 351, /* (18) alter_account_option ::= STREAMS literal */ + 351, /* (19) alter_account_option ::= QTIME literal */ + 351, /* (20) alter_account_option ::= DBS literal */ + 351, /* (21) alter_account_option ::= USERS literal */ + 351, /* (22) alter_account_option ::= CONNS literal */ + 351, /* (23) alter_account_option ::= STATE literal */ + 352, /* (24) ip_range_list ::= NK_STRING */ + 352, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ + 353, /* (26) white_list ::= HOST ip_range_list */ + 354, /* (27) white_list_opt ::= */ + 354, /* (28) white_list_opt ::= white_list */ + 347, /* (29) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt white_list_opt */ + 347, /* (30) cmd ::= ALTER USER user_name PASS NK_STRING */ + 347, /* (31) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ + 347, /* (32) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ + 347, /* (33) cmd ::= ALTER USER user_name ADD white_list */ + 347, /* (34) cmd ::= ALTER USER user_name DROP white_list */ + 347, /* (35) cmd ::= DROP USER user_name */ + 356, /* (36) sysinfo_opt ::= */ + 356, /* (37) sysinfo_opt ::= SYSINFO NK_INTEGER */ + 347, /* (38) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ + 347, /* (39) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ + 357, /* (40) privileges ::= ALL */ + 357, /* (41) privileges ::= priv_type_list */ + 357, /* (42) privileges ::= SUBSCRIBE */ + 360, /* (43) priv_type_list ::= priv_type */ + 360, /* (44) priv_type_list ::= priv_type_list NK_COMMA priv_type */ + 361, /* (45) priv_type ::= READ */ + 361, /* (46) priv_type ::= WRITE */ + 361, /* (47) priv_type ::= ALTER */ + 358, /* (48) priv_level ::= NK_STAR NK_DOT NK_STAR */ + 358, /* (49) priv_level ::= db_name NK_DOT NK_STAR */ + 358, /* (50) priv_level ::= db_name NK_DOT table_name */ + 358, /* (51) priv_level ::= topic_name */ + 359, /* (52) with_opt ::= */ + 359, /* (53) with_opt ::= WITH search_condition */ + 347, /* (54) cmd ::= CREATE DNODE dnode_endpoint */ + 347, /* (55) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ + 347, /* (56) cmd ::= DROP DNODE NK_INTEGER force_opt */ + 347, /* (57) cmd ::= DROP DNODE dnode_endpoint force_opt */ + 347, /* (58) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ + 347, /* (59) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ + 347, /* (60) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + 347, /* (61) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + 347, /* (62) cmd ::= ALTER ALL DNODES NK_STRING */ + 347, /* (63) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + 347, /* (64) cmd ::= RESTORE DNODE NK_INTEGER */ + 366, /* (65) dnode_endpoint ::= NK_STRING */ + 366, /* (66) dnode_endpoint ::= NK_ID */ + 366, /* (67) dnode_endpoint ::= NK_IPTOKEN */ + 367, /* (68) force_opt ::= */ + 367, /* (69) force_opt ::= FORCE */ + 368, /* (70) unsafe_opt ::= UNSAFE */ + 347, /* (71) cmd ::= ALTER LOCAL NK_STRING */ + 347, /* (72) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + 347, /* (73) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + 347, /* (74) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + 347, /* (75) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ + 347, /* (76) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + 347, /* (77) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + 347, /* (78) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + 347, /* (79) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + 347, /* (80) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + 347, /* (81) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + 347, /* (82) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ + 347, /* (83) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ + 347, /* (84) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + 347, /* (85) cmd ::= DROP DATABASE exists_opt db_name */ + 347, /* (86) cmd ::= USE db_name */ + 347, /* (87) cmd ::= ALTER DATABASE db_name alter_db_options */ + 347, /* (88) cmd ::= FLUSH DATABASE db_name */ + 347, /* (89) cmd ::= TRIM DATABASE db_name speed_opt */ + 347, /* (90) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ + 369, /* (91) not_exists_opt ::= IF NOT EXISTS */ + 369, /* (92) not_exists_opt ::= */ + 371, /* (93) exists_opt ::= IF EXISTS */ + 371, /* (94) exists_opt ::= */ + 370, /* (95) db_options ::= */ + 370, /* (96) db_options ::= db_options BUFFER NK_INTEGER */ + 370, /* (97) db_options ::= db_options CACHEMODEL NK_STRING */ + 370, /* (98) db_options ::= db_options CACHESIZE NK_INTEGER */ + 370, /* (99) db_options ::= db_options COMP NK_INTEGER */ + 370, /* (100) db_options ::= db_options DURATION NK_INTEGER */ + 370, /* (101) db_options ::= db_options DURATION NK_VARIABLE */ + 370, /* (102) db_options ::= db_options MAXROWS NK_INTEGER */ + 370, /* (103) db_options ::= db_options MINROWS NK_INTEGER */ + 370, /* (104) db_options ::= db_options KEEP integer_list */ + 370, /* (105) db_options ::= db_options KEEP variable_list */ + 370, /* (106) db_options ::= db_options PAGES NK_INTEGER */ + 370, /* (107) db_options ::= db_options PAGESIZE NK_INTEGER */ + 370, /* (108) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ + 370, /* (109) db_options ::= db_options PRECISION NK_STRING */ + 370, /* (110) db_options ::= db_options REPLICA NK_INTEGER */ + 370, /* (111) db_options ::= db_options VGROUPS NK_INTEGER */ + 370, /* (112) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + 370, /* (113) db_options ::= db_options RETENTIONS retention_list */ + 370, /* (114) db_options ::= db_options SCHEMALESS NK_INTEGER */ + 370, /* (115) db_options ::= db_options WAL_LEVEL NK_INTEGER */ + 370, /* (116) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ + 370, /* (117) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ + 370, /* (118) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + 370, /* (119) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ + 370, /* (120) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + 370, /* (121) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ + 370, /* (122) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ + 370, /* (123) db_options ::= db_options STT_TRIGGER NK_INTEGER */ + 370, /* (124) db_options ::= db_options TABLE_PREFIX signed */ + 370, /* (125) db_options ::= db_options TABLE_SUFFIX signed */ + 370, /* (126) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ + 372, /* (127) alter_db_options ::= alter_db_option */ + 372, /* (128) alter_db_options ::= alter_db_options alter_db_option */ + 380, /* (129) alter_db_option ::= BUFFER NK_INTEGER */ + 380, /* (130) alter_db_option ::= CACHEMODEL NK_STRING */ + 380, /* (131) alter_db_option ::= CACHESIZE NK_INTEGER */ + 380, /* (132) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ + 380, /* (133) alter_db_option ::= KEEP integer_list */ + 380, /* (134) alter_db_option ::= KEEP variable_list */ + 380, /* (135) alter_db_option ::= PAGES NK_INTEGER */ + 380, /* (136) alter_db_option ::= REPLICA NK_INTEGER */ + 380, /* (137) alter_db_option ::= WAL_LEVEL NK_INTEGER */ + 380, /* (138) alter_db_option ::= STT_TRIGGER NK_INTEGER */ + 380, /* (139) alter_db_option ::= MINROWS NK_INTEGER */ + 380, /* (140) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ + 380, /* (141) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + 380, /* (142) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ + 380, /* (143) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + 380, /* (144) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ + 376, /* (145) integer_list ::= NK_INTEGER */ + 376, /* (146) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + 377, /* (147) variable_list ::= NK_VARIABLE */ + 377, /* (148) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + 378, /* (149) retention_list ::= retention */ + 378, /* (150) retention_list ::= retention_list NK_COMMA retention */ + 381, /* (151) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + 381, /* (152) retention ::= NK_MINUS NK_COLON NK_VARIABLE */ + 373, /* (153) speed_opt ::= */ + 373, /* (154) speed_opt ::= BWLIMIT NK_INTEGER */ + 374, /* (155) start_opt ::= */ + 374, /* (156) start_opt ::= START WITH NK_INTEGER */ + 374, /* (157) start_opt ::= START WITH NK_STRING */ + 374, /* (158) start_opt ::= START WITH TIMESTAMP NK_STRING */ + 375, /* (159) end_opt ::= */ + 375, /* (160) end_opt ::= END WITH NK_INTEGER */ + 375, /* (161) end_opt ::= END WITH NK_STRING */ + 375, /* (162) end_opt ::= END WITH TIMESTAMP NK_STRING */ + 347, /* (163) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + 347, /* (164) cmd ::= CREATE TABLE multi_create_clause */ + 347, /* (165) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + 347, /* (166) cmd ::= DROP TABLE multi_drop_clause */ + 347, /* (167) cmd ::= DROP STABLE exists_opt full_table_name */ + 347, /* (168) cmd ::= ALTER TABLE alter_table_clause */ + 347, /* (169) cmd ::= ALTER STABLE alter_table_clause */ + 389, /* (170) alter_table_clause ::= full_table_name alter_table_options */ + 389, /* (171) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + 389, /* (172) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + 389, /* (173) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + 389, /* (174) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + 389, /* (175) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + 389, /* (176) alter_table_clause ::= full_table_name DROP TAG column_name */ + 389, /* (177) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + 389, /* (178) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + 389, /* (179) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + 386, /* (180) multi_create_clause ::= create_subtable_clause */ + 386, /* (181) multi_create_clause ::= multi_create_clause create_subtable_clause */ + 394, /* (182) 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 */ + 388, /* (183) multi_drop_clause ::= drop_table_clause */ + 388, /* (184) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ + 397, /* (185) drop_table_clause ::= exists_opt full_table_name */ + 395, /* (186) specific_cols_opt ::= */ + 395, /* (187) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + 382, /* (188) full_table_name ::= table_name */ + 382, /* (189) full_table_name ::= db_name NK_DOT table_name */ + 383, /* (190) column_def_list ::= column_def */ + 383, /* (191) column_def_list ::= column_def_list NK_COMMA column_def */ + 399, /* (192) column_def ::= column_name type_name */ + 392, /* (193) type_name ::= BOOL */ + 392, /* (194) type_name ::= TINYINT */ + 392, /* (195) type_name ::= SMALLINT */ + 392, /* (196) type_name ::= INT */ + 392, /* (197) type_name ::= INTEGER */ + 392, /* (198) type_name ::= BIGINT */ + 392, /* (199) type_name ::= FLOAT */ + 392, /* (200) type_name ::= DOUBLE */ + 392, /* (201) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + 392, /* (202) type_name ::= TIMESTAMP */ + 392, /* (203) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + 392, /* (204) type_name ::= TINYINT UNSIGNED */ + 392, /* (205) type_name ::= SMALLINT UNSIGNED */ + 392, /* (206) type_name ::= INT UNSIGNED */ + 392, /* (207) type_name ::= BIGINT UNSIGNED */ + 392, /* (208) type_name ::= JSON */ + 392, /* (209) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + 392, /* (210) type_name ::= MEDIUMBLOB */ + 392, /* (211) type_name ::= BLOB */ + 392, /* (212) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + 392, /* (213) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + 392, /* (214) type_name ::= DECIMAL */ + 392, /* (215) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + 392, /* (216) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 384, /* (217) tags_def_opt ::= */ + 384, /* (218) tags_def_opt ::= tags_def */ + 387, /* (219) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + 385, /* (220) table_options ::= */ + 385, /* (221) table_options ::= table_options COMMENT NK_STRING */ + 385, /* (222) table_options ::= table_options MAX_DELAY duration_list */ + 385, /* (223) table_options ::= table_options WATERMARK duration_list */ + 385, /* (224) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + 385, /* (225) table_options ::= table_options TTL NK_INTEGER */ + 385, /* (226) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + 385, /* (227) table_options ::= table_options DELETE_MARK duration_list */ + 390, /* (228) alter_table_options ::= alter_table_option */ + 390, /* (229) alter_table_options ::= alter_table_options alter_table_option */ + 402, /* (230) alter_table_option ::= COMMENT NK_STRING */ + 402, /* (231) alter_table_option ::= TTL NK_INTEGER */ + 400, /* (232) duration_list ::= duration_literal */ + 400, /* (233) duration_list ::= duration_list NK_COMMA duration_literal */ + 401, /* (234) rollup_func_list ::= rollup_func_name */ + 401, /* (235) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + 404, /* (236) rollup_func_name ::= function_name */ + 404, /* (237) rollup_func_name ::= FIRST */ + 404, /* (238) rollup_func_name ::= LAST */ + 398, /* (239) col_name_list ::= col_name */ + 398, /* (240) col_name_list ::= col_name_list NK_COMMA col_name */ + 406, /* (241) col_name ::= column_name */ + 347, /* (242) cmd ::= SHOW DNODES */ + 347, /* (243) cmd ::= SHOW USERS */ + 347, /* (244) cmd ::= SHOW USER PRIVILEGES */ + 347, /* (245) cmd ::= SHOW db_kind_opt DATABASES */ + 347, /* (246) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ + 347, /* (247) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + 347, /* (248) cmd ::= SHOW db_name_cond_opt VGROUPS */ + 347, /* (249) cmd ::= SHOW MNODES */ + 347, /* (250) cmd ::= SHOW QNODES */ + 347, /* (251) cmd ::= SHOW FUNCTIONS */ + 347, /* (252) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + 347, /* (253) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + 347, /* (254) cmd ::= SHOW STREAMS */ + 347, /* (255) cmd ::= SHOW ACCOUNTS */ + 347, /* (256) cmd ::= SHOW APPS */ + 347, /* (257) cmd ::= SHOW CONNECTIONS */ + 347, /* (258) cmd ::= SHOW LICENCES */ + 347, /* (259) cmd ::= SHOW GRANTS */ + 347, /* (260) cmd ::= SHOW CREATE DATABASE db_name */ + 347, /* (261) cmd ::= SHOW CREATE TABLE full_table_name */ + 347, /* (262) cmd ::= SHOW CREATE STABLE full_table_name */ + 347, /* (263) cmd ::= SHOW QUERIES */ + 347, /* (264) cmd ::= SHOW SCORES */ + 347, /* (265) cmd ::= SHOW TOPICS */ + 347, /* (266) cmd ::= SHOW VARIABLES */ + 347, /* (267) cmd ::= SHOW CLUSTER VARIABLES */ + 347, /* (268) cmd ::= SHOW LOCAL VARIABLES */ + 347, /* (269) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + 347, /* (270) cmd ::= SHOW BNODES */ + 347, /* (271) cmd ::= SHOW SNODES */ + 347, /* (272) cmd ::= SHOW CLUSTER */ + 347, /* (273) cmd ::= SHOW TRANSACTIONS */ + 347, /* (274) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + 347, /* (275) cmd ::= SHOW CONSUMERS */ + 347, /* (276) cmd ::= SHOW SUBSCRIPTIONS */ + 347, /* (277) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + 347, /* (278) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + 347, /* (279) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + 347, /* (280) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + 347, /* (281) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + 347, /* (282) cmd ::= SHOW VNODES */ + 347, /* (283) cmd ::= SHOW db_name_cond_opt ALIVE */ + 347, /* (284) cmd ::= SHOW CLUSTER ALIVE */ + 347, /* (285) cmd ::= SHOW db_name_cond_opt VIEWS */ + 347, /* (286) cmd ::= SHOW CREATE VIEW full_table_name */ + 347, /* (287) cmd ::= SHOW COMPACTS */ + 347, /* (288) cmd ::= SHOW COMPACT NK_INTEGER */ + 408, /* (289) table_kind_db_name_cond_opt ::= */ + 408, /* (290) table_kind_db_name_cond_opt ::= table_kind */ + 408, /* (291) table_kind_db_name_cond_opt ::= db_name NK_DOT */ + 408, /* (292) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ + 414, /* (293) table_kind ::= NORMAL */ + 414, /* (294) table_kind ::= CHILD */ + 410, /* (295) db_name_cond_opt ::= */ + 410, /* (296) db_name_cond_opt ::= db_name NK_DOT */ + 409, /* (297) like_pattern_opt ::= */ + 409, /* (298) like_pattern_opt ::= LIKE NK_STRING */ + 411, /* (299) table_name_cond ::= table_name */ + 412, /* (300) from_db_opt ::= */ + 412, /* (301) from_db_opt ::= FROM db_name */ + 413, /* (302) tag_list_opt ::= */ + 413, /* (303) tag_list_opt ::= tag_item */ + 413, /* (304) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + 415, /* (305) tag_item ::= TBNAME */ + 415, /* (306) tag_item ::= QTAGS */ + 415, /* (307) tag_item ::= column_name */ + 415, /* (308) tag_item ::= column_name column_alias */ + 415, /* (309) tag_item ::= column_name AS column_alias */ + 407, /* (310) db_kind_opt ::= */ + 407, /* (311) db_kind_opt ::= USER */ + 407, /* (312) db_kind_opt ::= SYSTEM */ + 347, /* (313) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ + 347, /* (314) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ + 347, /* (315) cmd ::= DROP INDEX exists_opt full_index_name */ + 418, /* (316) full_index_name ::= index_name */ + 418, /* (317) full_index_name ::= db_name NK_DOT index_name */ + 417, /* (318) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + 417, /* (319) 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 */ + 420, /* (320) func_list ::= func */ + 420, /* (321) func_list ::= func_list NK_COMMA func */ + 423, /* (322) func ::= sma_func_name NK_LP expression_list NK_RP */ + 424, /* (323) sma_func_name ::= function_name */ + 424, /* (324) sma_func_name ::= COUNT */ + 424, /* (325) sma_func_name ::= FIRST */ + 424, /* (326) sma_func_name ::= LAST */ + 424, /* (327) sma_func_name ::= LAST_ROW */ + 422, /* (328) sma_stream_opt ::= */ + 422, /* (329) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + 422, /* (330) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + 422, /* (331) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + 425, /* (332) with_meta ::= AS */ + 425, /* (333) with_meta ::= WITH META AS */ + 425, /* (334) with_meta ::= ONLY META AS */ + 347, /* (335) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + 347, /* (336) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + 347, /* (337) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + 347, /* (338) cmd ::= DROP TOPIC exists_opt topic_name */ + 347, /* (339) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + 347, /* (340) cmd ::= DESC full_table_name */ + 347, /* (341) cmd ::= DESCRIBE full_table_name */ + 347, /* (342) cmd ::= RESET QUERY CACHE */ + 347, /* (343) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + 347, /* (344) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 429, /* (345) analyze_opt ::= */ + 429, /* (346) analyze_opt ::= ANALYZE */ + 430, /* (347) explain_options ::= */ + 430, /* (348) explain_options ::= explain_options VERBOSE NK_BOOL */ + 430, /* (349) explain_options ::= explain_options RATIO NK_FLOAT */ + 347, /* (350) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + 347, /* (351) cmd ::= DROP FUNCTION exists_opt function_name */ + 433, /* (352) agg_func_opt ::= */ + 433, /* (353) agg_func_opt ::= AGGREGATE */ + 434, /* (354) bufsize_opt ::= */ + 434, /* (355) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 435, /* (356) language_opt ::= */ + 435, /* (357) language_opt ::= LANGUAGE NK_STRING */ + 432, /* (358) or_replace_opt ::= */ + 432, /* (359) or_replace_opt ::= OR REPLACE */ + 347, /* (360) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ + 347, /* (361) cmd ::= DROP VIEW exists_opt full_view_name */ + 436, /* (362) full_view_name ::= view_name */ + 436, /* (363) full_view_name ::= db_name NK_DOT view_name */ + 347, /* (364) 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 */ + 347, /* (365) cmd ::= DROP STREAM exists_opt stream_name */ + 347, /* (366) cmd ::= PAUSE STREAM exists_opt stream_name */ + 347, /* (367) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 440, /* (368) col_list_opt ::= */ + 440, /* (369) col_list_opt ::= NK_LP col_name_list NK_RP */ + 441, /* (370) tag_def_or_ref_opt ::= */ + 441, /* (371) tag_def_or_ref_opt ::= tags_def */ + 441, /* (372) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ + 439, /* (373) stream_options ::= */ + 439, /* (374) stream_options ::= stream_options TRIGGER AT_ONCE */ + 439, /* (375) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + 439, /* (376) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + 439, /* (377) stream_options ::= stream_options WATERMARK duration_literal */ + 439, /* (378) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + 439, /* (379) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + 439, /* (380) stream_options ::= stream_options DELETE_MARK duration_literal */ + 439, /* (381) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 442, /* (382) subtable_opt ::= */ + 442, /* (383) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 443, /* (384) ignore_opt ::= */ + 443, /* (385) ignore_opt ::= IGNORE UNTREATED */ + 347, /* (386) cmd ::= KILL CONNECTION NK_INTEGER */ + 347, /* (387) cmd ::= KILL QUERY NK_STRING */ + 347, /* (388) cmd ::= KILL TRANSACTION NK_INTEGER */ + 347, /* (389) cmd ::= KILL COMPACT NK_INTEGER */ + 347, /* (390) cmd ::= BALANCE VGROUP */ + 347, /* (391) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ + 347, /* (392) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + 347, /* (393) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + 347, /* (394) cmd ::= SPLIT VGROUP NK_INTEGER */ + 445, /* (395) on_vgroup_id ::= */ + 445, /* (396) on_vgroup_id ::= ON NK_INTEGER */ + 446, /* (397) dnode_list ::= DNODE NK_INTEGER */ + 446, /* (398) dnode_list ::= dnode_list DNODE NK_INTEGER */ + 347, /* (399) cmd ::= DELETE FROM full_table_name where_clause_opt */ + 347, /* (400) cmd ::= query_or_subquery */ + 347, /* (401) cmd ::= insert_query */ + 431, /* (402) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + 431, /* (403) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + 350, /* (404) literal ::= NK_INTEGER */ + 350, /* (405) literal ::= NK_FLOAT */ + 350, /* (406) literal ::= NK_STRING */ + 350, /* (407) literal ::= NK_BOOL */ + 350, /* (408) literal ::= TIMESTAMP NK_STRING */ + 350, /* (409) literal ::= duration_literal */ + 350, /* (410) literal ::= NULL */ + 350, /* (411) literal ::= NK_QUESTION */ + 403, /* (412) duration_literal ::= NK_VARIABLE */ + 379, /* (413) signed ::= NK_INTEGER */ + 379, /* (414) signed ::= NK_PLUS NK_INTEGER */ + 379, /* (415) signed ::= NK_MINUS NK_INTEGER */ + 379, /* (416) signed ::= NK_FLOAT */ + 379, /* (417) signed ::= NK_PLUS NK_FLOAT */ + 379, /* (418) signed ::= NK_MINUS NK_FLOAT */ + 393, /* (419) signed_literal ::= signed */ + 393, /* (420) signed_literal ::= NK_STRING */ + 393, /* (421) signed_literal ::= NK_BOOL */ + 393, /* (422) signed_literal ::= TIMESTAMP NK_STRING */ + 393, /* (423) signed_literal ::= duration_literal */ + 393, /* (424) signed_literal ::= NULL */ + 393, /* (425) signed_literal ::= literal_func */ + 393, /* (426) signed_literal ::= NK_QUESTION */ + 448, /* (427) literal_list ::= signed_literal */ + 448, /* (428) literal_list ::= literal_list NK_COMMA signed_literal */ + 362, /* (429) db_name ::= NK_ID */ + 363, /* (430) table_name ::= NK_ID */ + 391, /* (431) column_name ::= NK_ID */ + 405, /* (432) function_name ::= NK_ID */ + 437, /* (433) view_name ::= NK_ID */ + 449, /* (434) table_alias ::= NK_ID */ + 416, /* (435) column_alias ::= NK_ID */ + 416, /* (436) column_alias ::= NK_ALIAS */ + 355, /* (437) user_name ::= NK_ID */ + 364, /* (438) topic_name ::= NK_ID */ + 438, /* (439) stream_name ::= NK_ID */ + 428, /* (440) cgroup_name ::= NK_ID */ + 419, /* (441) index_name ::= NK_ID */ + 450, /* (442) expr_or_subquery ::= expression */ + 444, /* (443) expression ::= literal */ + 444, /* (444) expression ::= pseudo_column */ + 444, /* (445) expression ::= column_reference */ + 444, /* (446) expression ::= function_expression */ + 444, /* (447) expression ::= case_when_expression */ + 444, /* (448) expression ::= NK_LP expression NK_RP */ + 444, /* (449) expression ::= NK_PLUS expr_or_subquery */ + 444, /* (450) expression ::= NK_MINUS expr_or_subquery */ + 444, /* (451) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + 444, /* (452) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + 444, /* (453) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + 444, /* (454) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + 444, /* (455) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + 444, /* (456) expression ::= column_reference NK_ARROW NK_STRING */ + 444, /* (457) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + 444, /* (458) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + 396, /* (459) expression_list ::= expr_or_subquery */ + 396, /* (460) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + 452, /* (461) column_reference ::= column_name */ + 452, /* (462) column_reference ::= table_name NK_DOT column_name */ + 452, /* (463) column_reference ::= NK_ALIAS */ + 452, /* (464) column_reference ::= table_name NK_DOT NK_ALIAS */ + 451, /* (465) pseudo_column ::= ROWTS */ + 451, /* (466) pseudo_column ::= TBNAME */ + 451, /* (467) pseudo_column ::= table_name NK_DOT TBNAME */ + 451, /* (468) pseudo_column ::= QSTART */ + 451, /* (469) pseudo_column ::= QEND */ + 451, /* (470) pseudo_column ::= QDURATION */ + 451, /* (471) pseudo_column ::= WSTART */ + 451, /* (472) pseudo_column ::= WEND */ + 451, /* (473) pseudo_column ::= WDURATION */ + 451, /* (474) pseudo_column ::= IROWTS */ + 451, /* (475) pseudo_column ::= ISFILLED */ + 451, /* (476) pseudo_column ::= QTAGS */ + 453, /* (477) function_expression ::= function_name NK_LP expression_list NK_RP */ + 453, /* (478) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + 453, /* (479) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + 453, /* (480) function_expression ::= literal_func */ + 447, /* (481) literal_func ::= noarg_func NK_LP NK_RP */ + 447, /* (482) literal_func ::= NOW */ + 457, /* (483) noarg_func ::= NOW */ + 457, /* (484) noarg_func ::= TODAY */ + 457, /* (485) noarg_func ::= TIMEZONE */ + 457, /* (486) noarg_func ::= DATABASE */ + 457, /* (487) noarg_func ::= CLIENT_VERSION */ + 457, /* (488) noarg_func ::= SERVER_VERSION */ + 457, /* (489) noarg_func ::= SERVER_STATUS */ + 457, /* (490) noarg_func ::= CURRENT_USER */ + 457, /* (491) noarg_func ::= USER */ + 455, /* (492) star_func ::= COUNT */ + 455, /* (493) star_func ::= FIRST */ + 455, /* (494) star_func ::= LAST */ + 455, /* (495) star_func ::= LAST_ROW */ + 456, /* (496) star_func_para_list ::= NK_STAR */ + 456, /* (497) star_func_para_list ::= other_para_list */ + 458, /* (498) other_para_list ::= star_func_para */ + 458, /* (499) other_para_list ::= other_para_list NK_COMMA star_func_para */ + 459, /* (500) star_func_para ::= expr_or_subquery */ + 459, /* (501) star_func_para ::= table_name NK_DOT NK_STAR */ + 454, /* (502) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + 454, /* (503) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + 460, /* (504) when_then_list ::= when_then_expr */ + 460, /* (505) when_then_list ::= when_then_list when_then_expr */ + 463, /* (506) when_then_expr ::= WHEN common_expression THEN common_expression */ + 461, /* (507) case_when_else_opt ::= */ + 461, /* (508) case_when_else_opt ::= ELSE common_expression */ + 464, /* (509) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + 464, /* (510) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + 464, /* (511) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + 464, /* (512) predicate ::= expr_or_subquery IS NULL */ + 464, /* (513) predicate ::= expr_or_subquery IS NOT NULL */ + 464, /* (514) predicate ::= expr_or_subquery in_op in_predicate_value */ + 465, /* (515) compare_op ::= NK_LT */ + 465, /* (516) compare_op ::= NK_GT */ + 465, /* (517) compare_op ::= NK_LE */ + 465, /* (518) compare_op ::= NK_GE */ + 465, /* (519) compare_op ::= NK_NE */ + 465, /* (520) compare_op ::= NK_EQ */ + 465, /* (521) compare_op ::= LIKE */ + 465, /* (522) compare_op ::= NOT LIKE */ + 465, /* (523) compare_op ::= MATCH */ + 465, /* (524) compare_op ::= NMATCH */ + 465, /* (525) compare_op ::= CONTAINS */ + 466, /* (526) in_op ::= IN */ + 466, /* (527) in_op ::= NOT IN */ + 467, /* (528) in_predicate_value ::= NK_LP literal_list NK_RP */ + 468, /* (529) boolean_value_expression ::= boolean_primary */ + 468, /* (530) boolean_value_expression ::= NOT boolean_primary */ + 468, /* (531) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + 468, /* (532) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + 469, /* (533) boolean_primary ::= predicate */ + 469, /* (534) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + 462, /* (535) common_expression ::= expr_or_subquery */ + 462, /* (536) common_expression ::= boolean_value_expression */ + 470, /* (537) from_clause_opt ::= */ + 470, /* (538) from_clause_opt ::= FROM table_reference_list */ + 471, /* (539) table_reference_list ::= table_reference */ + 471, /* (540) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + 472, /* (541) table_reference ::= table_primary */ + 472, /* (542) table_reference ::= joined_table */ + 473, /* (543) table_primary ::= table_name alias_opt */ + 473, /* (544) table_primary ::= db_name NK_DOT table_name alias_opt */ + 473, /* (545) table_primary ::= subquery alias_opt */ + 473, /* (546) table_primary ::= parenthesized_joined_table */ + 475, /* (547) alias_opt ::= */ + 475, /* (548) alias_opt ::= table_alias */ + 475, /* (549) alias_opt ::= AS table_alias */ + 477, /* (550) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + 477, /* (551) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + 474, /* (552) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + 478, /* (553) join_type ::= */ + 478, /* (554) join_type ::= INNER */ + 479, /* (555) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 */ + 480, /* (556) hint_list ::= */ + 480, /* (557) hint_list ::= NK_HINT */ + 482, /* (558) tag_mode_opt ::= */ + 482, /* (559) tag_mode_opt ::= TAGS */ + 481, /* (560) set_quantifier_opt ::= */ + 481, /* (561) set_quantifier_opt ::= DISTINCT */ + 481, /* (562) set_quantifier_opt ::= ALL */ + 483, /* (563) select_list ::= select_item */ + 483, /* (564) select_list ::= select_list NK_COMMA select_item */ + 491, /* (565) select_item ::= NK_STAR */ + 491, /* (566) select_item ::= common_expression */ + 491, /* (567) select_item ::= common_expression column_alias */ + 491, /* (568) select_item ::= common_expression AS column_alias */ + 491, /* (569) select_item ::= table_name NK_DOT NK_STAR */ + 427, /* (570) where_clause_opt ::= */ + 427, /* (571) where_clause_opt ::= WHERE search_condition */ + 484, /* (572) partition_by_clause_opt ::= */ + 484, /* (573) partition_by_clause_opt ::= PARTITION BY partition_list */ + 492, /* (574) partition_list ::= partition_item */ + 492, /* (575) partition_list ::= partition_list NK_COMMA partition_item */ + 493, /* (576) partition_item ::= expr_or_subquery */ + 493, /* (577) partition_item ::= expr_or_subquery column_alias */ + 493, /* (578) partition_item ::= expr_or_subquery AS column_alias */ + 488, /* (579) twindow_clause_opt ::= */ + 488, /* (580) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ + 488, /* (581) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + 488, /* (582) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + 488, /* (583) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + 488, /* (584) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 421, /* (585) sliding_opt ::= */ + 421, /* (586) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ + 494, /* (587) interval_sliding_duration_literal ::= NK_VARIABLE */ + 494, /* (588) interval_sliding_duration_literal ::= NK_STRING */ + 494, /* (589) interval_sliding_duration_literal ::= NK_INTEGER */ + 487, /* (590) fill_opt ::= */ + 487, /* (591) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + 487, /* (592) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + 487, /* (593) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + 495, /* (594) fill_mode ::= NONE */ + 495, /* (595) fill_mode ::= PREV */ + 495, /* (596) fill_mode ::= NULL */ + 495, /* (597) fill_mode ::= NULL_F */ + 495, /* (598) fill_mode ::= LINEAR */ + 495, /* (599) fill_mode ::= NEXT */ + 489, /* (600) group_by_clause_opt ::= */ + 489, /* (601) group_by_clause_opt ::= GROUP BY group_by_list */ + 496, /* (602) group_by_list ::= expr_or_subquery */ + 496, /* (603) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 490, /* (604) having_clause_opt ::= */ + 490, /* (605) having_clause_opt ::= HAVING search_condition */ + 485, /* (606) range_opt ::= */ + 485, /* (607) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + 485, /* (608) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 486, /* (609) every_opt ::= */ + 486, /* (610) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + 497, /* (611) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + 498, /* (612) query_simple ::= query_specification */ + 498, /* (613) query_simple ::= union_query_expression */ + 502, /* (614) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + 502, /* (615) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + 503, /* (616) query_simple_or_subquery ::= query_simple */ + 503, /* (617) query_simple_or_subquery ::= subquery */ + 426, /* (618) query_or_subquery ::= query_expression */ + 426, /* (619) query_or_subquery ::= subquery */ + 499, /* (620) order_by_clause_opt ::= */ + 499, /* (621) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 500, /* (622) slimit_clause_opt ::= */ + 500, /* (623) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + 500, /* (624) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + 500, /* (625) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 501, /* (626) limit_clause_opt ::= */ + 501, /* (627) limit_clause_opt ::= LIMIT NK_INTEGER */ + 501, /* (628) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + 501, /* (629) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 476, /* (630) subquery ::= NK_LP query_expression NK_RP */ + 476, /* (631) subquery ::= NK_LP subquery NK_RP */ + 365, /* (632) search_condition ::= common_expression */ + 504, /* (633) sort_specification_list ::= sort_specification */ + 504, /* (634) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + 505, /* (635) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 506, /* (636) ordering_specification_opt ::= */ + 506, /* (637) ordering_specification_opt ::= ASC */ + 506, /* (638) ordering_specification_opt ::= DESC */ + 507, /* (639) null_ordering_opt ::= */ + 507, /* (640) null_ordering_opt ::= NULLS FIRST */ + 507, /* (641) null_ordering_opt ::= NULLS LAST */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -4286,358 +4656,361 @@ static const signed char yyRuleInfoNRhs[] = { -3, /* (284) cmd ::= SHOW CLUSTER ALIVE */ -3, /* (285) cmd ::= SHOW db_name_cond_opt VIEWS */ -4, /* (286) cmd ::= SHOW CREATE VIEW full_table_name */ - 0, /* (287) table_kind_db_name_cond_opt ::= */ - -1, /* (288) table_kind_db_name_cond_opt ::= table_kind */ - -2, /* (289) table_kind_db_name_cond_opt ::= db_name NK_DOT */ - -3, /* (290) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ - -1, /* (291) table_kind ::= NORMAL */ - -1, /* (292) table_kind ::= CHILD */ - 0, /* (293) db_name_cond_opt ::= */ - -2, /* (294) db_name_cond_opt ::= db_name NK_DOT */ - 0, /* (295) like_pattern_opt ::= */ - -2, /* (296) like_pattern_opt ::= LIKE NK_STRING */ - -1, /* (297) table_name_cond ::= table_name */ - 0, /* (298) from_db_opt ::= */ - -2, /* (299) from_db_opt ::= FROM db_name */ - 0, /* (300) tag_list_opt ::= */ - -1, /* (301) tag_list_opt ::= tag_item */ - -3, /* (302) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - -1, /* (303) tag_item ::= TBNAME */ - -1, /* (304) tag_item ::= QTAGS */ - -1, /* (305) tag_item ::= column_name */ - -2, /* (306) tag_item ::= column_name column_alias */ - -3, /* (307) tag_item ::= column_name AS column_alias */ - 0, /* (308) db_kind_opt ::= */ - -1, /* (309) db_kind_opt ::= USER */ - -1, /* (310) db_kind_opt ::= SYSTEM */ - -8, /* (311) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - -9, /* (312) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - -4, /* (313) cmd ::= DROP INDEX exists_opt full_index_name */ - -1, /* (314) full_index_name ::= index_name */ - -3, /* (315) full_index_name ::= db_name NK_DOT index_name */ - -10, /* (316) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - -12, /* (317) 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, /* (318) func_list ::= func */ - -3, /* (319) func_list ::= func_list NK_COMMA func */ - -4, /* (320) func ::= sma_func_name NK_LP expression_list NK_RP */ - -1, /* (321) sma_func_name ::= function_name */ - -1, /* (322) sma_func_name ::= COUNT */ - -1, /* (323) sma_func_name ::= FIRST */ - -1, /* (324) sma_func_name ::= LAST */ - -1, /* (325) sma_func_name ::= LAST_ROW */ - 0, /* (326) sma_stream_opt ::= */ - -3, /* (327) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - -3, /* (328) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - -3, /* (329) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - -1, /* (330) with_meta ::= AS */ - -3, /* (331) with_meta ::= WITH META AS */ - -3, /* (332) with_meta ::= ONLY META AS */ - -6, /* (333) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - -7, /* (334) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - -8, /* (335) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - -4, /* (336) cmd ::= DROP TOPIC exists_opt topic_name */ - -7, /* (337) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - -2, /* (338) cmd ::= DESC full_table_name */ - -2, /* (339) cmd ::= DESCRIBE full_table_name */ - -3, /* (340) cmd ::= RESET QUERY CACHE */ - -4, /* (341) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - -4, /* (342) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 0, /* (343) analyze_opt ::= */ - -1, /* (344) analyze_opt ::= ANALYZE */ - 0, /* (345) explain_options ::= */ - -3, /* (346) explain_options ::= explain_options VERBOSE NK_BOOL */ - -3, /* (347) explain_options ::= explain_options RATIO NK_FLOAT */ - -12, /* (348) 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, /* (349) cmd ::= DROP FUNCTION exists_opt function_name */ - 0, /* (350) agg_func_opt ::= */ - -1, /* (351) agg_func_opt ::= AGGREGATE */ - 0, /* (352) bufsize_opt ::= */ - -2, /* (353) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 0, /* (354) language_opt ::= */ - -2, /* (355) language_opt ::= LANGUAGE NK_STRING */ - 0, /* (356) or_replace_opt ::= */ - -2, /* (357) or_replace_opt ::= OR REPLACE */ - -6, /* (358) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ - -4, /* (359) cmd ::= DROP VIEW exists_opt full_view_name */ - -1, /* (360) full_view_name ::= view_name */ - -3, /* (361) full_view_name ::= db_name NK_DOT view_name */ - -12, /* (362) 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, /* (363) cmd ::= DROP STREAM exists_opt stream_name */ - -4, /* (364) cmd ::= PAUSE STREAM exists_opt stream_name */ - -5, /* (365) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 0, /* (366) col_list_opt ::= */ - -3, /* (367) col_list_opt ::= NK_LP col_name_list NK_RP */ - 0, /* (368) tag_def_or_ref_opt ::= */ - -1, /* (369) tag_def_or_ref_opt ::= tags_def */ - -4, /* (370) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - 0, /* (371) stream_options ::= */ - -3, /* (372) stream_options ::= stream_options TRIGGER AT_ONCE */ - -3, /* (373) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - -4, /* (374) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - -3, /* (375) stream_options ::= stream_options WATERMARK duration_literal */ - -4, /* (376) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - -3, /* (377) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - -3, /* (378) stream_options ::= stream_options DELETE_MARK duration_literal */ - -4, /* (379) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 0, /* (380) subtable_opt ::= */ - -4, /* (381) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 0, /* (382) ignore_opt ::= */ - -2, /* (383) ignore_opt ::= IGNORE UNTREATED */ - -3, /* (384) cmd ::= KILL CONNECTION NK_INTEGER */ - -3, /* (385) cmd ::= KILL QUERY NK_STRING */ - -3, /* (386) cmd ::= KILL TRANSACTION NK_INTEGER */ - -2, /* (387) cmd ::= BALANCE VGROUP */ - -4, /* (388) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - -4, /* (389) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - -4, /* (390) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - -3, /* (391) cmd ::= SPLIT VGROUP NK_INTEGER */ - 0, /* (392) on_vgroup_id ::= */ - -2, /* (393) on_vgroup_id ::= ON NK_INTEGER */ - -2, /* (394) dnode_list ::= DNODE NK_INTEGER */ - -3, /* (395) dnode_list ::= dnode_list DNODE NK_INTEGER */ - -4, /* (396) cmd ::= DELETE FROM full_table_name where_clause_opt */ - -1, /* (397) cmd ::= query_or_subquery */ - -1, /* (398) cmd ::= insert_query */ - -7, /* (399) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - -4, /* (400) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - -1, /* (401) literal ::= NK_INTEGER */ - -1, /* (402) literal ::= NK_FLOAT */ - -1, /* (403) literal ::= NK_STRING */ - -1, /* (404) literal ::= NK_BOOL */ - -2, /* (405) literal ::= TIMESTAMP NK_STRING */ - -1, /* (406) literal ::= duration_literal */ - -1, /* (407) literal ::= NULL */ - -1, /* (408) literal ::= NK_QUESTION */ - -1, /* (409) duration_literal ::= NK_VARIABLE */ - -1, /* (410) signed ::= NK_INTEGER */ - -2, /* (411) signed ::= NK_PLUS NK_INTEGER */ - -2, /* (412) signed ::= NK_MINUS NK_INTEGER */ - -1, /* (413) signed ::= NK_FLOAT */ - -2, /* (414) signed ::= NK_PLUS NK_FLOAT */ - -2, /* (415) signed ::= NK_MINUS NK_FLOAT */ - -1, /* (416) signed_literal ::= signed */ - -1, /* (417) signed_literal ::= NK_STRING */ - -1, /* (418) signed_literal ::= NK_BOOL */ - -2, /* (419) signed_literal ::= TIMESTAMP NK_STRING */ - -1, /* (420) signed_literal ::= duration_literal */ - -1, /* (421) signed_literal ::= NULL */ - -1, /* (422) signed_literal ::= literal_func */ - -1, /* (423) signed_literal ::= NK_QUESTION */ - -1, /* (424) literal_list ::= signed_literal */ - -3, /* (425) literal_list ::= literal_list NK_COMMA signed_literal */ - -1, /* (426) db_name ::= NK_ID */ - -1, /* (427) table_name ::= NK_ID */ - -1, /* (428) column_name ::= NK_ID */ - -1, /* (429) function_name ::= NK_ID */ - -1, /* (430) view_name ::= NK_ID */ - -1, /* (431) table_alias ::= NK_ID */ - -1, /* (432) column_alias ::= NK_ID */ - -1, /* (433) column_alias ::= NK_ALIAS */ - -1, /* (434) user_name ::= NK_ID */ - -1, /* (435) topic_name ::= NK_ID */ - -1, /* (436) stream_name ::= NK_ID */ - -1, /* (437) cgroup_name ::= NK_ID */ - -1, /* (438) index_name ::= NK_ID */ - -1, /* (439) expr_or_subquery ::= expression */ - -1, /* (440) expression ::= literal */ - -1, /* (441) expression ::= pseudo_column */ - -1, /* (442) expression ::= column_reference */ - -1, /* (443) expression ::= function_expression */ - -1, /* (444) expression ::= case_when_expression */ - -3, /* (445) expression ::= NK_LP expression NK_RP */ - -2, /* (446) expression ::= NK_PLUS expr_or_subquery */ - -2, /* (447) expression ::= NK_MINUS expr_or_subquery */ - -3, /* (448) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - -3, /* (449) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - -3, /* (450) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - -3, /* (451) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - -3, /* (452) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - -3, /* (453) expression ::= column_reference NK_ARROW NK_STRING */ - -3, /* (454) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - -3, /* (455) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - -1, /* (456) expression_list ::= expr_or_subquery */ - -3, /* (457) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - -1, /* (458) column_reference ::= column_name */ - -3, /* (459) column_reference ::= table_name NK_DOT column_name */ - -1, /* (460) column_reference ::= NK_ALIAS */ - -3, /* (461) column_reference ::= table_name NK_DOT NK_ALIAS */ - -1, /* (462) pseudo_column ::= ROWTS */ - -1, /* (463) pseudo_column ::= TBNAME */ - -3, /* (464) pseudo_column ::= table_name NK_DOT TBNAME */ - -1, /* (465) pseudo_column ::= QSTART */ - -1, /* (466) pseudo_column ::= QEND */ - -1, /* (467) pseudo_column ::= QDURATION */ - -1, /* (468) pseudo_column ::= WSTART */ - -1, /* (469) pseudo_column ::= WEND */ - -1, /* (470) pseudo_column ::= WDURATION */ - -1, /* (471) pseudo_column ::= IROWTS */ - -1, /* (472) pseudo_column ::= ISFILLED */ - -1, /* (473) pseudo_column ::= QTAGS */ - -4, /* (474) function_expression ::= function_name NK_LP expression_list NK_RP */ - -4, /* (475) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - -6, /* (476) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - -1, /* (477) function_expression ::= literal_func */ - -3, /* (478) literal_func ::= noarg_func NK_LP NK_RP */ - -1, /* (479) literal_func ::= NOW */ - -1, /* (480) noarg_func ::= NOW */ - -1, /* (481) noarg_func ::= TODAY */ - -1, /* (482) noarg_func ::= TIMEZONE */ - -1, /* (483) noarg_func ::= DATABASE */ - -1, /* (484) noarg_func ::= CLIENT_VERSION */ - -1, /* (485) noarg_func ::= SERVER_VERSION */ - -1, /* (486) noarg_func ::= SERVER_STATUS */ - -1, /* (487) noarg_func ::= CURRENT_USER */ - -1, /* (488) noarg_func ::= USER */ - -1, /* (489) star_func ::= COUNT */ - -1, /* (490) star_func ::= FIRST */ - -1, /* (491) star_func ::= LAST */ - -1, /* (492) star_func ::= LAST_ROW */ - -1, /* (493) star_func_para_list ::= NK_STAR */ - -1, /* (494) star_func_para_list ::= other_para_list */ - -1, /* (495) other_para_list ::= star_func_para */ - -3, /* (496) other_para_list ::= other_para_list NK_COMMA star_func_para */ - -1, /* (497) star_func_para ::= expr_or_subquery */ - -3, /* (498) star_func_para ::= table_name NK_DOT NK_STAR */ - -4, /* (499) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - -5, /* (500) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - -1, /* (501) when_then_list ::= when_then_expr */ - -2, /* (502) when_then_list ::= when_then_list when_then_expr */ - -4, /* (503) when_then_expr ::= WHEN common_expression THEN common_expression */ - 0, /* (504) case_when_else_opt ::= */ - -2, /* (505) case_when_else_opt ::= ELSE common_expression */ - -3, /* (506) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - -5, /* (507) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - -6, /* (508) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - -3, /* (509) predicate ::= expr_or_subquery IS NULL */ - -4, /* (510) predicate ::= expr_or_subquery IS NOT NULL */ - -3, /* (511) predicate ::= expr_or_subquery in_op in_predicate_value */ - -1, /* (512) compare_op ::= NK_LT */ - -1, /* (513) compare_op ::= NK_GT */ - -1, /* (514) compare_op ::= NK_LE */ - -1, /* (515) compare_op ::= NK_GE */ - -1, /* (516) compare_op ::= NK_NE */ - -1, /* (517) compare_op ::= NK_EQ */ - -1, /* (518) compare_op ::= LIKE */ - -2, /* (519) compare_op ::= NOT LIKE */ - -1, /* (520) compare_op ::= MATCH */ - -1, /* (521) compare_op ::= NMATCH */ - -1, /* (522) compare_op ::= CONTAINS */ - -1, /* (523) in_op ::= IN */ - -2, /* (524) in_op ::= NOT IN */ - -3, /* (525) in_predicate_value ::= NK_LP literal_list NK_RP */ - -1, /* (526) boolean_value_expression ::= boolean_primary */ - -2, /* (527) boolean_value_expression ::= NOT boolean_primary */ - -3, /* (528) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - -3, /* (529) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - -1, /* (530) boolean_primary ::= predicate */ - -3, /* (531) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - -1, /* (532) common_expression ::= expr_or_subquery */ - -1, /* (533) common_expression ::= boolean_value_expression */ - 0, /* (534) from_clause_opt ::= */ - -2, /* (535) from_clause_opt ::= FROM table_reference_list */ - -1, /* (536) table_reference_list ::= table_reference */ - -3, /* (537) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - -1, /* (538) table_reference ::= table_primary */ - -1, /* (539) table_reference ::= joined_table */ - -2, /* (540) table_primary ::= table_name alias_opt */ - -4, /* (541) table_primary ::= db_name NK_DOT table_name alias_opt */ - -2, /* (542) table_primary ::= subquery alias_opt */ - -1, /* (543) table_primary ::= parenthesized_joined_table */ - 0, /* (544) alias_opt ::= */ - -1, /* (545) alias_opt ::= table_alias */ - -2, /* (546) alias_opt ::= AS table_alias */ - -3, /* (547) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - -3, /* (548) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - -6, /* (549) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - 0, /* (550) join_type ::= */ - -1, /* (551) join_type ::= INNER */ - -14, /* (552) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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, /* (553) hint_list ::= */ - -1, /* (554) hint_list ::= NK_HINT */ - 0, /* (555) tag_mode_opt ::= */ - -1, /* (556) tag_mode_opt ::= TAGS */ - 0, /* (557) set_quantifier_opt ::= */ - -1, /* (558) set_quantifier_opt ::= DISTINCT */ - -1, /* (559) set_quantifier_opt ::= ALL */ - -1, /* (560) select_list ::= select_item */ - -3, /* (561) select_list ::= select_list NK_COMMA select_item */ - -1, /* (562) select_item ::= NK_STAR */ - -1, /* (563) select_item ::= common_expression */ - -2, /* (564) select_item ::= common_expression column_alias */ - -3, /* (565) select_item ::= common_expression AS column_alias */ - -3, /* (566) select_item ::= table_name NK_DOT NK_STAR */ - 0, /* (567) where_clause_opt ::= */ - -2, /* (568) where_clause_opt ::= WHERE search_condition */ - 0, /* (569) partition_by_clause_opt ::= */ - -3, /* (570) partition_by_clause_opt ::= PARTITION BY partition_list */ - -1, /* (571) partition_list ::= partition_item */ - -3, /* (572) partition_list ::= partition_list NK_COMMA partition_item */ - -1, /* (573) partition_item ::= expr_or_subquery */ - -2, /* (574) partition_item ::= expr_or_subquery column_alias */ - -3, /* (575) partition_item ::= expr_or_subquery AS column_alias */ - 0, /* (576) twindow_clause_opt ::= */ - -6, /* (577) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - -4, /* (578) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - -6, /* (579) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -8, /* (580) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -7, /* (581) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 0, /* (582) sliding_opt ::= */ - -4, /* (583) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - -1, /* (584) interval_sliding_duration_literal ::= NK_VARIABLE */ - -1, /* (585) interval_sliding_duration_literal ::= NK_STRING */ - -1, /* (586) interval_sliding_duration_literal ::= NK_INTEGER */ - 0, /* (587) fill_opt ::= */ - -4, /* (588) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - -6, /* (589) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - -6, /* (590) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - -1, /* (591) fill_mode ::= NONE */ - -1, /* (592) fill_mode ::= PREV */ - -1, /* (593) fill_mode ::= NULL */ - -1, /* (594) fill_mode ::= NULL_F */ - -1, /* (595) fill_mode ::= LINEAR */ - -1, /* (596) fill_mode ::= NEXT */ - 0, /* (597) group_by_clause_opt ::= */ - -3, /* (598) group_by_clause_opt ::= GROUP BY group_by_list */ - -1, /* (599) group_by_list ::= expr_or_subquery */ - -3, /* (600) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 0, /* (601) having_clause_opt ::= */ - -2, /* (602) having_clause_opt ::= HAVING search_condition */ - 0, /* (603) range_opt ::= */ - -6, /* (604) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - -4, /* (605) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 0, /* (606) every_opt ::= */ - -4, /* (607) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - -4, /* (608) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - -1, /* (609) query_simple ::= query_specification */ - -1, /* (610) query_simple ::= union_query_expression */ - -4, /* (611) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - -3, /* (612) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - -1, /* (613) query_simple_or_subquery ::= query_simple */ - -1, /* (614) query_simple_or_subquery ::= subquery */ - -1, /* (615) query_or_subquery ::= query_expression */ - -1, /* (616) query_or_subquery ::= subquery */ - 0, /* (617) order_by_clause_opt ::= */ - -3, /* (618) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 0, /* (619) slimit_clause_opt ::= */ - -2, /* (620) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - -4, /* (621) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - -4, /* (622) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 0, /* (623) limit_clause_opt ::= */ - -2, /* (624) limit_clause_opt ::= LIMIT NK_INTEGER */ - -4, /* (625) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - -4, /* (626) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - -3, /* (627) subquery ::= NK_LP query_expression NK_RP */ - -3, /* (628) subquery ::= NK_LP subquery NK_RP */ - -1, /* (629) search_condition ::= common_expression */ - -1, /* (630) sort_specification_list ::= sort_specification */ - -3, /* (631) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - -3, /* (632) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 0, /* (633) ordering_specification_opt ::= */ - -1, /* (634) ordering_specification_opt ::= ASC */ - -1, /* (635) ordering_specification_opt ::= DESC */ - 0, /* (636) null_ordering_opt ::= */ - -2, /* (637) null_ordering_opt ::= NULLS FIRST */ - -2, /* (638) null_ordering_opt ::= NULLS LAST */ + -2, /* (287) cmd ::= SHOW COMPACTS */ + -3, /* (288) cmd ::= SHOW COMPACT NK_INTEGER */ + 0, /* (289) table_kind_db_name_cond_opt ::= */ + -1, /* (290) table_kind_db_name_cond_opt ::= table_kind */ + -2, /* (291) table_kind_db_name_cond_opt ::= db_name NK_DOT */ + -3, /* (292) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ + -1, /* (293) table_kind ::= NORMAL */ + -1, /* (294) table_kind ::= CHILD */ + 0, /* (295) db_name_cond_opt ::= */ + -2, /* (296) db_name_cond_opt ::= db_name NK_DOT */ + 0, /* (297) like_pattern_opt ::= */ + -2, /* (298) like_pattern_opt ::= LIKE NK_STRING */ + -1, /* (299) table_name_cond ::= table_name */ + 0, /* (300) from_db_opt ::= */ + -2, /* (301) from_db_opt ::= FROM db_name */ + 0, /* (302) tag_list_opt ::= */ + -1, /* (303) tag_list_opt ::= tag_item */ + -3, /* (304) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + -1, /* (305) tag_item ::= TBNAME */ + -1, /* (306) tag_item ::= QTAGS */ + -1, /* (307) tag_item ::= column_name */ + -2, /* (308) tag_item ::= column_name column_alias */ + -3, /* (309) tag_item ::= column_name AS column_alias */ + 0, /* (310) db_kind_opt ::= */ + -1, /* (311) db_kind_opt ::= USER */ + -1, /* (312) db_kind_opt ::= SYSTEM */ + -8, /* (313) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ + -9, /* (314) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ + -4, /* (315) cmd ::= DROP INDEX exists_opt full_index_name */ + -1, /* (316) full_index_name ::= index_name */ + -3, /* (317) full_index_name ::= db_name NK_DOT index_name */ + -10, /* (318) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + -12, /* (319) 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, /* (320) func_list ::= func */ + -3, /* (321) func_list ::= func_list NK_COMMA func */ + -4, /* (322) func ::= sma_func_name NK_LP expression_list NK_RP */ + -1, /* (323) sma_func_name ::= function_name */ + -1, /* (324) sma_func_name ::= COUNT */ + -1, /* (325) sma_func_name ::= FIRST */ + -1, /* (326) sma_func_name ::= LAST */ + -1, /* (327) sma_func_name ::= LAST_ROW */ + 0, /* (328) sma_stream_opt ::= */ + -3, /* (329) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + -3, /* (330) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + -3, /* (331) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + -1, /* (332) with_meta ::= AS */ + -3, /* (333) with_meta ::= WITH META AS */ + -3, /* (334) with_meta ::= ONLY META AS */ + -6, /* (335) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + -7, /* (336) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + -8, /* (337) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + -4, /* (338) cmd ::= DROP TOPIC exists_opt topic_name */ + -7, /* (339) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + -2, /* (340) cmd ::= DESC full_table_name */ + -2, /* (341) cmd ::= DESCRIBE full_table_name */ + -3, /* (342) cmd ::= RESET QUERY CACHE */ + -4, /* (343) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + -4, /* (344) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 0, /* (345) analyze_opt ::= */ + -1, /* (346) analyze_opt ::= ANALYZE */ + 0, /* (347) explain_options ::= */ + -3, /* (348) explain_options ::= explain_options VERBOSE NK_BOOL */ + -3, /* (349) explain_options ::= explain_options RATIO NK_FLOAT */ + -12, /* (350) 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, /* (351) cmd ::= DROP FUNCTION exists_opt function_name */ + 0, /* (352) agg_func_opt ::= */ + -1, /* (353) agg_func_opt ::= AGGREGATE */ + 0, /* (354) bufsize_opt ::= */ + -2, /* (355) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 0, /* (356) language_opt ::= */ + -2, /* (357) language_opt ::= LANGUAGE NK_STRING */ + 0, /* (358) or_replace_opt ::= */ + -2, /* (359) or_replace_opt ::= OR REPLACE */ + -6, /* (360) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ + -4, /* (361) cmd ::= DROP VIEW exists_opt full_view_name */ + -1, /* (362) full_view_name ::= view_name */ + -3, /* (363) full_view_name ::= db_name NK_DOT view_name */ + -12, /* (364) 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, /* (365) cmd ::= DROP STREAM exists_opt stream_name */ + -4, /* (366) cmd ::= PAUSE STREAM exists_opt stream_name */ + -5, /* (367) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 0, /* (368) col_list_opt ::= */ + -3, /* (369) col_list_opt ::= NK_LP col_name_list NK_RP */ + 0, /* (370) tag_def_or_ref_opt ::= */ + -1, /* (371) tag_def_or_ref_opt ::= tags_def */ + -4, /* (372) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ + 0, /* (373) stream_options ::= */ + -3, /* (374) stream_options ::= stream_options TRIGGER AT_ONCE */ + -3, /* (375) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + -4, /* (376) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + -3, /* (377) stream_options ::= stream_options WATERMARK duration_literal */ + -4, /* (378) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + -3, /* (379) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + -3, /* (380) stream_options ::= stream_options DELETE_MARK duration_literal */ + -4, /* (381) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 0, /* (382) subtable_opt ::= */ + -4, /* (383) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 0, /* (384) ignore_opt ::= */ + -2, /* (385) ignore_opt ::= IGNORE UNTREATED */ + -3, /* (386) cmd ::= KILL CONNECTION NK_INTEGER */ + -3, /* (387) cmd ::= KILL QUERY NK_STRING */ + -3, /* (388) cmd ::= KILL TRANSACTION NK_INTEGER */ + -3, /* (389) cmd ::= KILL COMPACT NK_INTEGER */ + -2, /* (390) cmd ::= BALANCE VGROUP */ + -4, /* (391) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ + -4, /* (392) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + -4, /* (393) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + -3, /* (394) cmd ::= SPLIT VGROUP NK_INTEGER */ + 0, /* (395) on_vgroup_id ::= */ + -2, /* (396) on_vgroup_id ::= ON NK_INTEGER */ + -2, /* (397) dnode_list ::= DNODE NK_INTEGER */ + -3, /* (398) dnode_list ::= dnode_list DNODE NK_INTEGER */ + -4, /* (399) cmd ::= DELETE FROM full_table_name where_clause_opt */ + -1, /* (400) cmd ::= query_or_subquery */ + -1, /* (401) cmd ::= insert_query */ + -7, /* (402) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + -4, /* (403) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + -1, /* (404) literal ::= NK_INTEGER */ + -1, /* (405) literal ::= NK_FLOAT */ + -1, /* (406) literal ::= NK_STRING */ + -1, /* (407) literal ::= NK_BOOL */ + -2, /* (408) literal ::= TIMESTAMP NK_STRING */ + -1, /* (409) literal ::= duration_literal */ + -1, /* (410) literal ::= NULL */ + -1, /* (411) literal ::= NK_QUESTION */ + -1, /* (412) duration_literal ::= NK_VARIABLE */ + -1, /* (413) signed ::= NK_INTEGER */ + -2, /* (414) signed ::= NK_PLUS NK_INTEGER */ + -2, /* (415) signed ::= NK_MINUS NK_INTEGER */ + -1, /* (416) signed ::= NK_FLOAT */ + -2, /* (417) signed ::= NK_PLUS NK_FLOAT */ + -2, /* (418) signed ::= NK_MINUS NK_FLOAT */ + -1, /* (419) signed_literal ::= signed */ + -1, /* (420) signed_literal ::= NK_STRING */ + -1, /* (421) signed_literal ::= NK_BOOL */ + -2, /* (422) signed_literal ::= TIMESTAMP NK_STRING */ + -1, /* (423) signed_literal ::= duration_literal */ + -1, /* (424) signed_literal ::= NULL */ + -1, /* (425) signed_literal ::= literal_func */ + -1, /* (426) signed_literal ::= NK_QUESTION */ + -1, /* (427) literal_list ::= signed_literal */ + -3, /* (428) literal_list ::= literal_list NK_COMMA signed_literal */ + -1, /* (429) db_name ::= NK_ID */ + -1, /* (430) table_name ::= NK_ID */ + -1, /* (431) column_name ::= NK_ID */ + -1, /* (432) function_name ::= NK_ID */ + -1, /* (433) view_name ::= NK_ID */ + -1, /* (434) table_alias ::= NK_ID */ + -1, /* (435) column_alias ::= NK_ID */ + -1, /* (436) column_alias ::= NK_ALIAS */ + -1, /* (437) user_name ::= NK_ID */ + -1, /* (438) topic_name ::= NK_ID */ + -1, /* (439) stream_name ::= NK_ID */ + -1, /* (440) cgroup_name ::= NK_ID */ + -1, /* (441) index_name ::= NK_ID */ + -1, /* (442) expr_or_subquery ::= expression */ + -1, /* (443) expression ::= literal */ + -1, /* (444) expression ::= pseudo_column */ + -1, /* (445) expression ::= column_reference */ + -1, /* (446) expression ::= function_expression */ + -1, /* (447) expression ::= case_when_expression */ + -3, /* (448) expression ::= NK_LP expression NK_RP */ + -2, /* (449) expression ::= NK_PLUS expr_or_subquery */ + -2, /* (450) expression ::= NK_MINUS expr_or_subquery */ + -3, /* (451) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + -3, /* (452) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + -3, /* (453) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + -3, /* (454) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + -3, /* (455) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + -3, /* (456) expression ::= column_reference NK_ARROW NK_STRING */ + -3, /* (457) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + -3, /* (458) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + -1, /* (459) expression_list ::= expr_or_subquery */ + -3, /* (460) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + -1, /* (461) column_reference ::= column_name */ + -3, /* (462) column_reference ::= table_name NK_DOT column_name */ + -1, /* (463) column_reference ::= NK_ALIAS */ + -3, /* (464) column_reference ::= table_name NK_DOT NK_ALIAS */ + -1, /* (465) pseudo_column ::= ROWTS */ + -1, /* (466) pseudo_column ::= TBNAME */ + -3, /* (467) pseudo_column ::= table_name NK_DOT TBNAME */ + -1, /* (468) pseudo_column ::= QSTART */ + -1, /* (469) pseudo_column ::= QEND */ + -1, /* (470) pseudo_column ::= QDURATION */ + -1, /* (471) pseudo_column ::= WSTART */ + -1, /* (472) pseudo_column ::= WEND */ + -1, /* (473) pseudo_column ::= WDURATION */ + -1, /* (474) pseudo_column ::= IROWTS */ + -1, /* (475) pseudo_column ::= ISFILLED */ + -1, /* (476) pseudo_column ::= QTAGS */ + -4, /* (477) function_expression ::= function_name NK_LP expression_list NK_RP */ + -4, /* (478) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + -6, /* (479) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + -1, /* (480) function_expression ::= literal_func */ + -3, /* (481) literal_func ::= noarg_func NK_LP NK_RP */ + -1, /* (482) literal_func ::= NOW */ + -1, /* (483) noarg_func ::= NOW */ + -1, /* (484) noarg_func ::= TODAY */ + -1, /* (485) noarg_func ::= TIMEZONE */ + -1, /* (486) noarg_func ::= DATABASE */ + -1, /* (487) noarg_func ::= CLIENT_VERSION */ + -1, /* (488) noarg_func ::= SERVER_VERSION */ + -1, /* (489) noarg_func ::= SERVER_STATUS */ + -1, /* (490) noarg_func ::= CURRENT_USER */ + -1, /* (491) noarg_func ::= USER */ + -1, /* (492) star_func ::= COUNT */ + -1, /* (493) star_func ::= FIRST */ + -1, /* (494) star_func ::= LAST */ + -1, /* (495) star_func ::= LAST_ROW */ + -1, /* (496) star_func_para_list ::= NK_STAR */ + -1, /* (497) star_func_para_list ::= other_para_list */ + -1, /* (498) other_para_list ::= star_func_para */ + -3, /* (499) other_para_list ::= other_para_list NK_COMMA star_func_para */ + -1, /* (500) star_func_para ::= expr_or_subquery */ + -3, /* (501) star_func_para ::= table_name NK_DOT NK_STAR */ + -4, /* (502) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + -5, /* (503) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + -1, /* (504) when_then_list ::= when_then_expr */ + -2, /* (505) when_then_list ::= when_then_list when_then_expr */ + -4, /* (506) when_then_expr ::= WHEN common_expression THEN common_expression */ + 0, /* (507) case_when_else_opt ::= */ + -2, /* (508) case_when_else_opt ::= ELSE common_expression */ + -3, /* (509) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + -5, /* (510) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + -6, /* (511) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + -3, /* (512) predicate ::= expr_or_subquery IS NULL */ + -4, /* (513) predicate ::= expr_or_subquery IS NOT NULL */ + -3, /* (514) predicate ::= expr_or_subquery in_op in_predicate_value */ + -1, /* (515) compare_op ::= NK_LT */ + -1, /* (516) compare_op ::= NK_GT */ + -1, /* (517) compare_op ::= NK_LE */ + -1, /* (518) compare_op ::= NK_GE */ + -1, /* (519) compare_op ::= NK_NE */ + -1, /* (520) compare_op ::= NK_EQ */ + -1, /* (521) compare_op ::= LIKE */ + -2, /* (522) compare_op ::= NOT LIKE */ + -1, /* (523) compare_op ::= MATCH */ + -1, /* (524) compare_op ::= NMATCH */ + -1, /* (525) compare_op ::= CONTAINS */ + -1, /* (526) in_op ::= IN */ + -2, /* (527) in_op ::= NOT IN */ + -3, /* (528) in_predicate_value ::= NK_LP literal_list NK_RP */ + -1, /* (529) boolean_value_expression ::= boolean_primary */ + -2, /* (530) boolean_value_expression ::= NOT boolean_primary */ + -3, /* (531) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + -3, /* (532) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + -1, /* (533) boolean_primary ::= predicate */ + -3, /* (534) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + -1, /* (535) common_expression ::= expr_or_subquery */ + -1, /* (536) common_expression ::= boolean_value_expression */ + 0, /* (537) from_clause_opt ::= */ + -2, /* (538) from_clause_opt ::= FROM table_reference_list */ + -1, /* (539) table_reference_list ::= table_reference */ + -3, /* (540) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + -1, /* (541) table_reference ::= table_primary */ + -1, /* (542) table_reference ::= joined_table */ + -2, /* (543) table_primary ::= table_name alias_opt */ + -4, /* (544) table_primary ::= db_name NK_DOT table_name alias_opt */ + -2, /* (545) table_primary ::= subquery alias_opt */ + -1, /* (546) table_primary ::= parenthesized_joined_table */ + 0, /* (547) alias_opt ::= */ + -1, /* (548) alias_opt ::= table_alias */ + -2, /* (549) alias_opt ::= AS table_alias */ + -3, /* (550) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + -3, /* (551) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + -6, /* (552) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + 0, /* (553) join_type ::= */ + -1, /* (554) join_type ::= INNER */ + -14, /* (555) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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, /* (556) hint_list ::= */ + -1, /* (557) hint_list ::= NK_HINT */ + 0, /* (558) tag_mode_opt ::= */ + -1, /* (559) tag_mode_opt ::= TAGS */ + 0, /* (560) set_quantifier_opt ::= */ + -1, /* (561) set_quantifier_opt ::= DISTINCT */ + -1, /* (562) set_quantifier_opt ::= ALL */ + -1, /* (563) select_list ::= select_item */ + -3, /* (564) select_list ::= select_list NK_COMMA select_item */ + -1, /* (565) select_item ::= NK_STAR */ + -1, /* (566) select_item ::= common_expression */ + -2, /* (567) select_item ::= common_expression column_alias */ + -3, /* (568) select_item ::= common_expression AS column_alias */ + -3, /* (569) select_item ::= table_name NK_DOT NK_STAR */ + 0, /* (570) where_clause_opt ::= */ + -2, /* (571) where_clause_opt ::= WHERE search_condition */ + 0, /* (572) partition_by_clause_opt ::= */ + -3, /* (573) partition_by_clause_opt ::= PARTITION BY partition_list */ + -1, /* (574) partition_list ::= partition_item */ + -3, /* (575) partition_list ::= partition_list NK_COMMA partition_item */ + -1, /* (576) partition_item ::= expr_or_subquery */ + -2, /* (577) partition_item ::= expr_or_subquery column_alias */ + -3, /* (578) partition_item ::= expr_or_subquery AS column_alias */ + 0, /* (579) twindow_clause_opt ::= */ + -6, /* (580) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ + -4, /* (581) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + -6, /* (582) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + -8, /* (583) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + -7, /* (584) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 0, /* (585) sliding_opt ::= */ + -4, /* (586) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ + -1, /* (587) interval_sliding_duration_literal ::= NK_VARIABLE */ + -1, /* (588) interval_sliding_duration_literal ::= NK_STRING */ + -1, /* (589) interval_sliding_duration_literal ::= NK_INTEGER */ + 0, /* (590) fill_opt ::= */ + -4, /* (591) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + -6, /* (592) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + -6, /* (593) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + -1, /* (594) fill_mode ::= NONE */ + -1, /* (595) fill_mode ::= PREV */ + -1, /* (596) fill_mode ::= NULL */ + -1, /* (597) fill_mode ::= NULL_F */ + -1, /* (598) fill_mode ::= LINEAR */ + -1, /* (599) fill_mode ::= NEXT */ + 0, /* (600) group_by_clause_opt ::= */ + -3, /* (601) group_by_clause_opt ::= GROUP BY group_by_list */ + -1, /* (602) group_by_list ::= expr_or_subquery */ + -3, /* (603) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 0, /* (604) having_clause_opt ::= */ + -2, /* (605) having_clause_opt ::= HAVING search_condition */ + 0, /* (606) range_opt ::= */ + -6, /* (607) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + -4, /* (608) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 0, /* (609) every_opt ::= */ + -4, /* (610) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + -4, /* (611) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + -1, /* (612) query_simple ::= query_specification */ + -1, /* (613) query_simple ::= union_query_expression */ + -4, /* (614) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + -3, /* (615) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + -1, /* (616) query_simple_or_subquery ::= query_simple */ + -1, /* (617) query_simple_or_subquery ::= subquery */ + -1, /* (618) query_or_subquery ::= query_expression */ + -1, /* (619) query_or_subquery ::= subquery */ + 0, /* (620) order_by_clause_opt ::= */ + -3, /* (621) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 0, /* (622) slimit_clause_opt ::= */ + -2, /* (623) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + -4, /* (624) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + -4, /* (625) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 0, /* (626) limit_clause_opt ::= */ + -2, /* (627) limit_clause_opt ::= LIMIT NK_INTEGER */ + -4, /* (628) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + -4, /* (629) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + -3, /* (630) subquery ::= NK_LP query_expression NK_RP */ + -3, /* (631) subquery ::= NK_LP subquery NK_RP */ + -1, /* (632) search_condition ::= common_expression */ + -1, /* (633) sort_specification_list ::= sort_specification */ + -3, /* (634) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + -3, /* (635) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 0, /* (636) ordering_specification_opt ::= */ + -1, /* (637) ordering_specification_opt ::= ASC */ + -1, /* (638) ordering_specification_opt ::= DESC */ + 0, /* (639) null_ordering_opt ::= */ + -2, /* (640) null_ordering_opt ::= NULLS FIRST */ + -2, /* (641) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -4667,54 +5040,6 @@ static YYACTIONTYPE yy_reduce( (void)yyLookahead; (void)yyLookaheadToken; yymsp = yypParser->yytos; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ - yysize = yyRuleInfoNRhs[yyruleno]; - if( yysize ){ - fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", - yyTracePrompt, - yyruleno, yyRuleName[yyruleno], - yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ - yypParser->yyhwm++; - assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); - } -#endif -#if YYSTACKDEPTH>0 - if( yypParser->yytos>=yypParser->yystackEnd ){ - yyStackOverflow(yypParser); - /* The call to yyStackOverflow() above pops the stack until it is - ** empty, causing the main parser loop to exit. So the return value - ** is never used and does not matter. */ - return 0; - } -#else - if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ - if( yyGrowStack(yypParser) ){ - yyStackOverflow(yypParser); - /* The call to yyStackOverflow() above pops the stack until it is - ** empty, causing the main parser loop to exit. So the return value - ** is never used and does not matter. */ - return 0; - } - yymsp = yypParser->yytos; - } -#endif - } switch( yyruleno ){ /* Beginning here are the reduction cases. A typical example @@ -4728,15 +5053,21 @@ 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); } - yy_destructor(yypParser,347,&yymsp[0].minor); - break; - case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ -{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } +#line 5058 "sql.c" yy_destructor(yypParser,348,&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 5064 "sql.c" + yy_destructor(yypParser,349,&yymsp[0].minor); + break; case 2: /* account_options ::= */ +#line 55 "sql.y" { } +#line 5070 "sql.c" break; case 3: /* account_options ::= account_options PPS literal */ case 4: /* account_options ::= account_options TSERIES literal */ yytestcase(yyruleno==4); @@ -4747,20 +5078,26 @@ 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,347,&yymsp[-2].minor); +{ yy_destructor(yypParser,348,&yymsp[-2].minor); +#line 56 "sql.y" { } - yy_destructor(yypParser,349,&yymsp[0].minor); +#line 5084 "sql.c" + yy_destructor(yypParser,350,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,350,&yymsp[0].minor); +{ yy_destructor(yypParser,351,&yymsp[0].minor); +#line 68 "sql.y" { } +#line 5092 "sql.c" } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,348,&yymsp[-1].minor); +{ yy_destructor(yypParser,349,&yymsp[-1].minor); +#line 69 "sql.y" { } - yy_destructor(yypParser,350,&yymsp[0].minor); +#line 5099 "sql.c" + yy_destructor(yypParser,351,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -4773,501 +5110,735 @@ 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" { } - yy_destructor(yypParser,349,&yymsp[0].minor); +#line 5115 "sql.c" + yy_destructor(yypParser,350,&yymsp[0].minor); break; case 24: /* ip_range_list ::= NK_STRING */ -{ yylhsminor.yy106 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy106 = yylhsminor.yy106; +#line 86 "sql.y" +{ yylhsminor.yy88 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } +#line 5121 "sql.c" + yymsp[0].minor.yy88 = yylhsminor.yy88; break; case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ -{ yylhsminor.yy106 = addNodeToList(pCxt, yymsp[-2].minor.yy106, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy106 = yylhsminor.yy106; +#line 87 "sql.y" +{ yylhsminor.yy88 = addNodeToList(pCxt, yymsp[-2].minor.yy88, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } +#line 5127 "sql.c" + yymsp[-2].minor.yy88 = yylhsminor.yy88; break; case 26: /* white_list ::= HOST ip_range_list */ -{ yymsp[-1].minor.yy106 = yymsp[0].minor.yy106; } +#line 91 "sql.y" +{ yymsp[-1].minor.yy88 = yymsp[0].minor.yy88; } +#line 5133 "sql.c" break; case 27: /* white_list_opt ::= */ case 186: /* specific_cols_opt ::= */ yytestcase(yyruleno==186); case 217: /* tags_def_opt ::= */ yytestcase(yyruleno==217); - case 300: /* tag_list_opt ::= */ yytestcase(yyruleno==300); - case 366: /* col_list_opt ::= */ yytestcase(yyruleno==366); - case 368: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==368); - case 569: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==569); - case 597: /* group_by_clause_opt ::= */ yytestcase(yyruleno==597); - case 617: /* order_by_clause_opt ::= */ yytestcase(yyruleno==617); -{ yymsp[1].minor.yy106 = NULL; } + case 302: /* tag_list_opt ::= */ yytestcase(yyruleno==302); + case 368: /* col_list_opt ::= */ yytestcase(yyruleno==368); + case 370: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==370); + case 572: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==572); + case 600: /* group_by_clause_opt ::= */ yytestcase(yyruleno==600); + case 620: /* order_by_clause_opt ::= */ yytestcase(yyruleno==620); +#line 95 "sql.y" +{ yymsp[1].minor.yy88 = NULL; } +#line 5146 "sql.c" break; case 28: /* white_list_opt ::= white_list */ case 218: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==218); - case 369: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==369); - case 494: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==494); -{ yylhsminor.yy106 = yymsp[0].minor.yy106; } - yymsp[0].minor.yy106 = yylhsminor.yy106; + case 371: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==371); + case 497: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==497); +#line 96 "sql.y" +{ yylhsminor.yy88 = yymsp[0].minor.yy88; } +#line 5154 "sql.c" + yymsp[0].minor.yy88 = yylhsminor.yy88; break; case 29: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt white_list_opt */ +#line 100 "sql.y" { - pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-4].minor.yy785, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy431); - pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy106); + pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-4].minor.yy993, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy279); + pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy88); } +#line 5163 "sql.c" break; case 30: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy785, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +#line 104 "sql.y" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy993, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +#line 5168 "sql.c" break; case 31: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy785, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +#line 105 "sql.y" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy993, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +#line 5173 "sql.c" break; case 32: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy785, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +#line 106 "sql.y" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy993, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +#line 5178 "sql.c" break; case 33: /* cmd ::= ALTER USER user_name ADD white_list */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy785, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy106); } +#line 107 "sql.y" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy993, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy88); } +#line 5183 "sql.c" break; case 34: /* cmd ::= ALTER USER user_name DROP white_list */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy785, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy106); } +#line 108 "sql.y" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy993, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy88); } +#line 5188 "sql.c" break; case 35: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy785); } +#line 109 "sql.y" +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy993); } +#line 5193 "sql.c" break; case 36: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy431 = 1; } +#line 113 "sql.y" +{ yymsp[1].minor.yy279 = 1; } +#line 5198 "sql.c" break; case 37: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -{ yymsp[-1].minor.yy431 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +#line 114 "sql.y" +{ yymsp[-1].minor.yy279 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +#line 5203 "sql.c" break; case 38: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy987, &yymsp[-3].minor.yy573, &yymsp[0].minor.yy785, yymsp[-2].minor.yy80); } +#line 117 "sql.y" +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy221, &yymsp[-3].minor.yy241, &yymsp[0].minor.yy993, yymsp[-2].minor.yy232); } +#line 5208 "sql.c" break; case 39: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy987, &yymsp[-3].minor.yy573, &yymsp[0].minor.yy785, yymsp[-2].minor.yy80); } +#line 118 "sql.y" +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy221, &yymsp[-3].minor.yy241, &yymsp[0].minor.yy993, yymsp[-2].minor.yy232); } +#line 5213 "sql.c" break; case 40: /* privileges ::= ALL */ -{ yymsp[0].minor.yy987 = PRIVILEGE_TYPE_ALL; } +#line 122 "sql.y" +{ yymsp[0].minor.yy221 = PRIVILEGE_TYPE_ALL; } +#line 5218 "sql.c" break; case 41: /* privileges ::= priv_type_list */ case 43: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==43); -{ yylhsminor.yy987 = yymsp[0].minor.yy987; } - yymsp[0].minor.yy987 = yylhsminor.yy987; +#line 123 "sql.y" +{ yylhsminor.yy221 = yymsp[0].minor.yy221; } +#line 5224 "sql.c" + yymsp[0].minor.yy221 = yylhsminor.yy221; break; case 42: /* privileges ::= SUBSCRIBE */ -{ yymsp[0].minor.yy987 = PRIVILEGE_TYPE_SUBSCRIBE; } +#line 124 "sql.y" +{ yymsp[0].minor.yy221 = PRIVILEGE_TYPE_SUBSCRIBE; } +#line 5230 "sql.c" break; case 44: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy987 = yymsp[-2].minor.yy987 | yymsp[0].minor.yy987; } - yymsp[-2].minor.yy987 = yylhsminor.yy987; +#line 129 "sql.y" +{ yylhsminor.yy221 = yymsp[-2].minor.yy221 | yymsp[0].minor.yy221; } +#line 5235 "sql.c" + yymsp[-2].minor.yy221 = yylhsminor.yy221; break; case 45: /* priv_type ::= READ */ -{ yymsp[0].minor.yy987 = PRIVILEGE_TYPE_READ; } +#line 133 "sql.y" +{ yymsp[0].minor.yy221 = PRIVILEGE_TYPE_READ; } +#line 5241 "sql.c" break; case 46: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy987 = PRIVILEGE_TYPE_WRITE; } +#line 134 "sql.y" +{ yymsp[0].minor.yy221 = PRIVILEGE_TYPE_WRITE; } +#line 5246 "sql.c" break; case 47: /* priv_type ::= ALTER */ -{ yymsp[0].minor.yy987 = PRIVILEGE_TYPE_ALTER; } +#line 135 "sql.y" +{ yymsp[0].minor.yy221 = PRIVILEGE_TYPE_ALTER; } +#line 5251 "sql.c" break; case 48: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy573.first = yymsp[-2].minor.yy0; yylhsminor.yy573.second = yymsp[0].minor.yy0; } - yymsp[-2].minor.yy573 = yylhsminor.yy573; +#line 139 "sql.y" +{ yylhsminor.yy241.first = yymsp[-2].minor.yy0; yylhsminor.yy241.second = yymsp[0].minor.yy0; } +#line 5256 "sql.c" + yymsp[-2].minor.yy241 = yylhsminor.yy241; break; case 49: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy573.first = yymsp[-2].minor.yy785; yylhsminor.yy573.second = yymsp[0].minor.yy0; } - yymsp[-2].minor.yy573 = yylhsminor.yy573; +#line 140 "sql.y" +{ yylhsminor.yy241.first = yymsp[-2].minor.yy993; yylhsminor.yy241.second = yymsp[0].minor.yy0; } +#line 5262 "sql.c" + yymsp[-2].minor.yy241 = yylhsminor.yy241; break; case 50: /* priv_level ::= db_name NK_DOT table_name */ -{ yylhsminor.yy573.first = yymsp[-2].minor.yy785; yylhsminor.yy573.second = yymsp[0].minor.yy785; } - yymsp[-2].minor.yy573 = yylhsminor.yy573; +#line 141 "sql.y" +{ yylhsminor.yy241.first = yymsp[-2].minor.yy993; yylhsminor.yy241.second = yymsp[0].minor.yy993; } +#line 5268 "sql.c" + yymsp[-2].minor.yy241 = yylhsminor.yy241; break; case 51: /* priv_level ::= topic_name */ -{ yylhsminor.yy573.first = yymsp[0].minor.yy785; yylhsminor.yy573.second = nil_token; } - yymsp[0].minor.yy573 = yylhsminor.yy573; +#line 142 "sql.y" +{ yylhsminor.yy241.first = yymsp[0].minor.yy993; yylhsminor.yy241.second = nil_token; } +#line 5274 "sql.c" + yymsp[0].minor.yy241 = yylhsminor.yy241; break; case 52: /* with_opt ::= */ case 155: /* start_opt ::= */ yytestcase(yyruleno==155); case 159: /* end_opt ::= */ yytestcase(yyruleno==159); - case 295: /* like_pattern_opt ::= */ yytestcase(yyruleno==295); - case 380: /* subtable_opt ::= */ yytestcase(yyruleno==380); - case 504: /* case_when_else_opt ::= */ yytestcase(yyruleno==504); - case 534: /* from_clause_opt ::= */ yytestcase(yyruleno==534); - case 567: /* where_clause_opt ::= */ yytestcase(yyruleno==567); - case 576: /* twindow_clause_opt ::= */ yytestcase(yyruleno==576); - case 582: /* sliding_opt ::= */ yytestcase(yyruleno==582); - case 587: /* fill_opt ::= */ yytestcase(yyruleno==587); - case 601: /* having_clause_opt ::= */ yytestcase(yyruleno==601); - case 603: /* range_opt ::= */ yytestcase(yyruleno==603); - case 606: /* every_opt ::= */ yytestcase(yyruleno==606); - case 619: /* slimit_clause_opt ::= */ yytestcase(yyruleno==619); - case 623: /* limit_clause_opt ::= */ yytestcase(yyruleno==623); -{ yymsp[1].minor.yy80 = NULL; } + case 297: /* like_pattern_opt ::= */ yytestcase(yyruleno==297); + case 382: /* subtable_opt ::= */ yytestcase(yyruleno==382); + case 507: /* case_when_else_opt ::= */ yytestcase(yyruleno==507); + case 537: /* from_clause_opt ::= */ yytestcase(yyruleno==537); + case 570: /* where_clause_opt ::= */ yytestcase(yyruleno==570); + case 579: /* twindow_clause_opt ::= */ yytestcase(yyruleno==579); + case 585: /* sliding_opt ::= */ yytestcase(yyruleno==585); + case 590: /* fill_opt ::= */ yytestcase(yyruleno==590); + case 604: /* having_clause_opt ::= */ yytestcase(yyruleno==604); + case 606: /* range_opt ::= */ yytestcase(yyruleno==606); + case 609: /* every_opt ::= */ yytestcase(yyruleno==609); + case 622: /* slimit_clause_opt ::= */ yytestcase(yyruleno==622); + case 626: /* limit_clause_opt ::= */ yytestcase(yyruleno==626); +#line 144 "sql.y" +{ yymsp[1].minor.yy232 = NULL; } +#line 5295 "sql.c" break; case 53: /* with_opt ::= WITH search_condition */ - case 535: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==535); - case 568: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==568); - case 602: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==602); -{ yymsp[-1].minor.yy80 = yymsp[0].minor.yy80; } + case 538: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==538); + case 571: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==571); + case 605: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==605); +#line 145 "sql.y" +{ yymsp[-1].minor.yy232 = yymsp[0].minor.yy232; } +#line 5303 "sql.c" break; case 54: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy785, NULL); } +#line 148 "sql.y" +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy993, NULL); } +#line 5308 "sql.c" break; case 55: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy0); } +#line 149 "sql.y" +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy0); } +#line 5313 "sql.c" break; case 56: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy923, false); } +#line 150 "sql.y" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy985, false); } +#line 5318 "sql.c" break; case 57: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy785, yymsp[0].minor.yy923, false); } +#line 151 "sql.y" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy993, yymsp[0].minor.yy985, false); } +#line 5323 "sql.c" break; case 58: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy923); } +#line 152 "sql.y" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy985); } +#line 5328 "sql.c" break; case 59: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy785, false, yymsp[0].minor.yy923); } +#line 153 "sql.y" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy993, false, yymsp[0].minor.yy985); } +#line 5333 "sql.c" break; case 60: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ +#line 154 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } +#line 5338 "sql.c" break; case 61: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ +#line 155 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 5343 "sql.c" break; case 62: /* cmd ::= ALTER ALL DNODES NK_STRING */ +#line 156 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); } +#line 5348 "sql.c" break; case 63: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ +#line 157 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 5353 "sql.c" break; case 64: /* cmd ::= RESTORE DNODE NK_INTEGER */ +#line 158 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_DNODE_STMT, &yymsp[0].minor.yy0); } +#line 5358 "sql.c" break; case 65: /* dnode_endpoint ::= NK_STRING */ case 66: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==66); case 67: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==67); - case 322: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==322); - case 323: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==323); - case 324: /* sma_func_name ::= LAST */ yytestcase(yyruleno==324); - case 325: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==325); - case 426: /* db_name ::= NK_ID */ yytestcase(yyruleno==426); - case 427: /* table_name ::= NK_ID */ yytestcase(yyruleno==427); - case 428: /* column_name ::= NK_ID */ yytestcase(yyruleno==428); - case 429: /* function_name ::= NK_ID */ yytestcase(yyruleno==429); - case 430: /* view_name ::= NK_ID */ yytestcase(yyruleno==430); - case 431: /* table_alias ::= NK_ID */ yytestcase(yyruleno==431); - case 432: /* column_alias ::= NK_ID */ yytestcase(yyruleno==432); - case 433: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==433); - case 434: /* user_name ::= NK_ID */ yytestcase(yyruleno==434); - case 435: /* topic_name ::= NK_ID */ yytestcase(yyruleno==435); - case 436: /* stream_name ::= NK_ID */ yytestcase(yyruleno==436); - case 437: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==437); - case 438: /* index_name ::= NK_ID */ yytestcase(yyruleno==438); - case 480: /* noarg_func ::= NOW */ yytestcase(yyruleno==480); - case 481: /* noarg_func ::= TODAY */ yytestcase(yyruleno==481); - case 482: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==482); - case 483: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==483); - case 484: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==484); - case 485: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==485); - case 486: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==486); - case 487: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==487); - case 488: /* noarg_func ::= USER */ yytestcase(yyruleno==488); - case 489: /* star_func ::= COUNT */ yytestcase(yyruleno==489); - case 490: /* star_func ::= FIRST */ yytestcase(yyruleno==490); - case 491: /* star_func ::= LAST */ yytestcase(yyruleno==491); - case 492: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==492); -{ yylhsminor.yy785 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy785 = yylhsminor.yy785; + case 324: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==324); + case 325: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==325); + case 326: /* sma_func_name ::= LAST */ yytestcase(yyruleno==326); + case 327: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==327); + case 429: /* db_name ::= NK_ID */ yytestcase(yyruleno==429); + case 430: /* table_name ::= NK_ID */ yytestcase(yyruleno==430); + case 431: /* column_name ::= NK_ID */ yytestcase(yyruleno==431); + case 432: /* function_name ::= NK_ID */ yytestcase(yyruleno==432); + case 433: /* view_name ::= NK_ID */ yytestcase(yyruleno==433); + case 434: /* table_alias ::= NK_ID */ yytestcase(yyruleno==434); + case 435: /* column_alias ::= NK_ID */ yytestcase(yyruleno==435); + case 436: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==436); + case 437: /* user_name ::= NK_ID */ yytestcase(yyruleno==437); + case 438: /* topic_name ::= NK_ID */ yytestcase(yyruleno==438); + case 439: /* stream_name ::= NK_ID */ yytestcase(yyruleno==439); + case 440: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==440); + case 441: /* index_name ::= NK_ID */ yytestcase(yyruleno==441); + case 483: /* noarg_func ::= NOW */ yytestcase(yyruleno==483); + case 484: /* noarg_func ::= TODAY */ yytestcase(yyruleno==484); + case 485: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==485); + case 486: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==486); + case 487: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==487); + case 488: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==488); + case 489: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==489); + case 490: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==490); + case 491: /* noarg_func ::= USER */ yytestcase(yyruleno==491); + case 492: /* star_func ::= COUNT */ yytestcase(yyruleno==492); + case 493: /* star_func ::= FIRST */ yytestcase(yyruleno==493); + case 494: /* star_func ::= LAST */ yytestcase(yyruleno==494); + case 495: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==495); +#line 162 "sql.y" +{ yylhsminor.yy993 = yymsp[0].minor.yy0; } +#line 5395 "sql.c" + yymsp[0].minor.yy993 = yylhsminor.yy993; break; case 68: /* force_opt ::= */ case 92: /* not_exists_opt ::= */ yytestcase(yyruleno==92); case 94: /* exists_opt ::= */ yytestcase(yyruleno==94); - case 343: /* analyze_opt ::= */ yytestcase(yyruleno==343); - case 350: /* agg_func_opt ::= */ yytestcase(yyruleno==350); - case 356: /* or_replace_opt ::= */ yytestcase(yyruleno==356); - case 382: /* ignore_opt ::= */ yytestcase(yyruleno==382); - case 555: /* tag_mode_opt ::= */ yytestcase(yyruleno==555); - case 557: /* set_quantifier_opt ::= */ yytestcase(yyruleno==557); -{ yymsp[1].minor.yy923 = false; } + case 345: /* analyze_opt ::= */ yytestcase(yyruleno==345); + case 352: /* agg_func_opt ::= */ yytestcase(yyruleno==352); + case 358: /* or_replace_opt ::= */ yytestcase(yyruleno==358); + case 384: /* ignore_opt ::= */ yytestcase(yyruleno==384); + case 558: /* tag_mode_opt ::= */ yytestcase(yyruleno==558); + case 560: /* set_quantifier_opt ::= */ yytestcase(yyruleno==560); +#line 168 "sql.y" +{ yymsp[1].minor.yy985 = false; } +#line 5409 "sql.c" break; case 69: /* force_opt ::= FORCE */ case 70: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==70); - case 344: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==344); - case 351: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==351); - case 556: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==556); - case 558: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==558); -{ yymsp[0].minor.yy923 = true; } + case 346: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==346); + case 353: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==353); + case 559: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==559); + case 561: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==561); +#line 169 "sql.y" +{ yymsp[0].minor.yy985 = true; } +#line 5419 "sql.c" break; case 71: /* cmd ::= ALTER LOCAL NK_STRING */ +#line 176 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } +#line 5424 "sql.c" break; case 72: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */ +#line 177 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 5429 "sql.c" break; case 73: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ +#line 180 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); } +#line 5434 "sql.c" break; case 74: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */ +#line 181 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); } +#line 5439 "sql.c" break; case 75: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ +#line 182 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_QNODE_STMT, &yymsp[0].minor.yy0); } +#line 5444 "sql.c" break; case 76: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ +#line 185 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); } +#line 5449 "sql.c" break; case 77: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */ +#line 186 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); } +#line 5454 "sql.c" break; case 78: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ +#line 189 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); } +#line 5459 "sql.c" break; case 79: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */ +#line 190 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); } +#line 5464 "sql.c" break; case 80: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ +#line 193 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); } +#line 5469 "sql.c" break; case 81: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */ +#line 194 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } +#line 5474 "sql.c" break; case 82: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ +#line 195 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_MNODE_STMT, &yymsp[0].minor.yy0); } +#line 5479 "sql.c" break; case 83: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ +#line 198 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); } +#line 5484 "sql.c" break; case 84: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy923, &yymsp[-1].minor.yy785, yymsp[0].minor.yy80); } +#line 201 "sql.y" +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy985, &yymsp[-1].minor.yy993, yymsp[0].minor.yy232); } +#line 5489 "sql.c" break; case 85: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy923, &yymsp[0].minor.yy785); } +#line 202 "sql.y" +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy985, &yymsp[0].minor.yy993); } +#line 5494 "sql.c" break; case 86: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy785); } +#line 203 "sql.y" +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy993); } +#line 5499 "sql.c" break; case 87: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy785, yymsp[0].minor.yy80); } +#line 204 "sql.y" +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy993, yymsp[0].minor.yy232); } +#line 5504 "sql.c" break; case 88: /* cmd ::= FLUSH DATABASE db_name */ -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy785); } +#line 205 "sql.y" +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy993); } +#line 5509 "sql.c" break; case 89: /* cmd ::= TRIM DATABASE db_name speed_opt */ -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy785, yymsp[0].minor.yy982); } +#line 206 "sql.y" +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy993, yymsp[0].minor.yy92); } +#line 5514 "sql.c" break; case 90: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ -{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy785, yymsp[-1].minor.yy80, yymsp[0].minor.yy80); } +#line 207 "sql.y" +{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy993, yymsp[-1].minor.yy232, yymsp[0].minor.yy232); } +#line 5519 "sql.c" break; case 91: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy923 = true; } +#line 211 "sql.y" +{ yymsp[-2].minor.yy985 = true; } +#line 5524 "sql.c" break; case 93: /* exists_opt ::= IF EXISTS */ - case 357: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==357); - case 383: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==383); -{ yymsp[-1].minor.yy923 = true; } + case 359: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==359); + case 385: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==385); +#line 216 "sql.y" +{ yymsp[-1].minor.yy985 = true; } +#line 5531 "sql.c" break; case 95: /* db_options ::= */ -{ yymsp[1].minor.yy80 = createDefaultDatabaseOptions(pCxt); } +#line 219 "sql.y" +{ yymsp[1].minor.yy232 = createDefaultDatabaseOptions(pCxt); } +#line 5536 "sql.c" break; case 96: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 220 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } +#line 5541 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 97: /* db_options ::= db_options CACHEMODEL NK_STRING */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 221 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } +#line 5547 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 98: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 222 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } +#line 5553 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 99: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 223 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_COMP, &yymsp[0].minor.yy0); } +#line 5559 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 100: /* db_options ::= db_options DURATION NK_INTEGER */ case 101: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==101); -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 224 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } +#line 5566 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 102: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 226 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } +#line 5572 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 103: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 227 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } +#line 5578 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 104: /* db_options ::= db_options KEEP integer_list */ case 105: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==105); -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_KEEP, yymsp[0].minor.yy106); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 228 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_KEEP, yymsp[0].minor.yy88); } +#line 5585 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 106: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 230 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } +#line 5591 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 107: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 231 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } +#line 5597 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 108: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 232 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } +#line 5603 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 109: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 233 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } +#line 5609 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 110: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 234 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } +#line 5615 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 111: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 236 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } +#line 5621 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 112: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 237 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } +#line 5627 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 113: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_RETENTIONS, yymsp[0].minor.yy106); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 238 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_RETENTIONS, yymsp[0].minor.yy88); } +#line 5633 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 114: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 239 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } +#line 5639 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 115: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 240 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_WAL, &yymsp[0].minor.yy0); } +#line 5645 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 116: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 241 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } +#line 5651 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 117: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 242 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } +#line 5657 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 118: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ +#line 243 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-3].minor.yy80, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-3].minor.yy232, DB_OPTION_WAL_RETENTION_PERIOD, &t); } - yymsp[-3].minor.yy80 = yylhsminor.yy80; +#line 5667 "sql.c" + yymsp[-3].minor.yy232 = yylhsminor.yy232; break; case 119: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 248 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } +#line 5673 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 120: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ +#line 249 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-3].minor.yy80, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-3].minor.yy232, DB_OPTION_WAL_RETENTION_SIZE, &t); } - yymsp[-3].minor.yy80 = yylhsminor.yy80; +#line 5683 "sql.c" + yymsp[-3].minor.yy232 = yylhsminor.yy232; break; case 121: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 254 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } +#line 5689 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 122: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 255 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } +#line 5695 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 123: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 256 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } +#line 5701 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 124: /* db_options ::= db_options TABLE_PREFIX signed */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy80); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 257 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy232); } +#line 5707 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 125: /* db_options ::= db_options TABLE_SUFFIX signed */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy80); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 258 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy232); } +#line 5713 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 126: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ -{ yylhsminor.yy80 = setDatabaseOption(pCxt, yymsp[-2].minor.yy80, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 259 "sql.y" +{ yylhsminor.yy232 = setDatabaseOption(pCxt, yymsp[-2].minor.yy232, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } +#line 5719 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 127: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy80 = createAlterDatabaseOptions(pCxt); yylhsminor.yy80 = setAlterDatabaseOption(pCxt, yylhsminor.yy80, &yymsp[0].minor.yy455); } - yymsp[0].minor.yy80 = yylhsminor.yy80; +#line 261 "sql.y" +{ yylhsminor.yy232 = createAlterDatabaseOptions(pCxt); yylhsminor.yy232 = setAlterDatabaseOption(pCxt, yylhsminor.yy232, &yymsp[0].minor.yy117); } +#line 5725 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; case 128: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy80 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy80, &yymsp[0].minor.yy455); } - yymsp[-1].minor.yy80 = yylhsminor.yy80; +#line 262 "sql.y" +{ yylhsminor.yy232 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy232, &yymsp[0].minor.yy117); } +#line 5731 "sql.c" + yymsp[-1].minor.yy232 = yylhsminor.yy232; break; case 129: /* alter_db_option ::= BUFFER NK_INTEGER */ -{ yymsp[-1].minor.yy455.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy455.val = yymsp[0].minor.yy0; } +#line 266 "sql.y" +{ yymsp[-1].minor.yy117.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; } +#line 5737 "sql.c" break; case 130: /* alter_db_option ::= CACHEMODEL NK_STRING */ -{ yymsp[-1].minor.yy455.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy455.val = yymsp[0].minor.yy0; } +#line 267 "sql.y" +{ yymsp[-1].minor.yy117.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; } +#line 5742 "sql.c" break; case 131: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -{ yymsp[-1].minor.yy455.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy455.val = yymsp[0].minor.yy0; } +#line 268 "sql.y" +{ yymsp[-1].minor.yy117.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; } +#line 5747 "sql.c" break; case 132: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ -{ yymsp[-1].minor.yy455.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy455.val = yymsp[0].minor.yy0; } +#line 269 "sql.y" +{ yymsp[-1].minor.yy117.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; } +#line 5752 "sql.c" break; case 133: /* alter_db_option ::= KEEP integer_list */ case 134: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==134); -{ yymsp[-1].minor.yy455.type = DB_OPTION_KEEP; yymsp[-1].minor.yy455.pList = yymsp[0].minor.yy106; } +#line 270 "sql.y" +{ yymsp[-1].minor.yy117.type = DB_OPTION_KEEP; yymsp[-1].minor.yy117.pList = yymsp[0].minor.yy88; } +#line 5758 "sql.c" break; case 135: /* alter_db_option ::= PAGES NK_INTEGER */ -{ yymsp[-1].minor.yy455.type = DB_OPTION_PAGES; yymsp[-1].minor.yy455.val = yymsp[0].minor.yy0; } +#line 272 "sql.y" +{ yymsp[-1].minor.yy117.type = DB_OPTION_PAGES; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; } +#line 5763 "sql.c" break; case 136: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy455.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy455.val = yymsp[0].minor.yy0; } +#line 273 "sql.y" +{ yymsp[-1].minor.yy117.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; } +#line 5768 "sql.c" break; case 137: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ -{ yymsp[-1].minor.yy455.type = DB_OPTION_WAL; yymsp[-1].minor.yy455.val = yymsp[0].minor.yy0; } +#line 275 "sql.y" +{ yymsp[-1].minor.yy117.type = DB_OPTION_WAL; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; } +#line 5773 "sql.c" break; case 138: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ -{ yymsp[-1].minor.yy455.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy455.val = yymsp[0].minor.yy0; } +#line 276 "sql.y" +{ yymsp[-1].minor.yy117.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; } +#line 5778 "sql.c" break; case 139: /* alter_db_option ::= MINROWS NK_INTEGER */ -{ yymsp[-1].minor.yy455.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy455.val = yymsp[0].minor.yy0; } +#line 277 "sql.y" +{ yymsp[-1].minor.yy117.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; } +#line 5783 "sql.c" break; case 140: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ -{ yymsp[-1].minor.yy455.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy455.val = yymsp[0].minor.yy0; } +#line 278 "sql.y" +{ yymsp[-1].minor.yy117.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; } +#line 5788 "sql.c" break; case 141: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ +#line 279 "sql.y" { 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.yy455.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy455.val = t; + yymsp[-2].minor.yy117.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy117.val = t; } +#line 5797 "sql.c" break; case 142: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ -{ yymsp[-1].minor.yy455.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy455.val = yymsp[0].minor.yy0; } +#line 284 "sql.y" +{ yymsp[-1].minor.yy117.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; } +#line 5802 "sql.c" break; case 143: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ +#line 285 "sql.y" { 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.yy455.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy455.val = t; + yymsp[-2].minor.yy117.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy117.val = t; } +#line 5811 "sql.c" break; case 144: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ -{ yymsp[-1].minor.yy455.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy455.val = yymsp[0].minor.yy0; } +#line 290 "sql.y" +{ yymsp[-1].minor.yy117.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; } +#line 5816 "sql.c" break; case 145: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy106 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy106 = yylhsminor.yy106; +#line 294 "sql.y" +{ yylhsminor.yy88 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 5821 "sql.c" + yymsp[0].minor.yy88 = yylhsminor.yy88; break; case 146: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 395: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==395); -{ yylhsminor.yy106 = addNodeToList(pCxt, yymsp[-2].minor.yy106, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy106 = yylhsminor.yy106; + case 398: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==398); +#line 295 "sql.y" +{ yylhsminor.yy88 = addNodeToList(pCxt, yymsp[-2].minor.yy88, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 5828 "sql.c" + yymsp[-2].minor.yy88 = yylhsminor.yy88; break; case 147: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy106 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy106 = yylhsminor.yy106; +#line 299 "sql.y" +{ yylhsminor.yy88 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 5834 "sql.c" + yymsp[0].minor.yy88 = yylhsminor.yy88; break; case 148: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy106 = addNodeToList(pCxt, yymsp[-2].minor.yy106, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy106 = yylhsminor.yy106; +#line 300 "sql.y" +{ yylhsminor.yy88 = addNodeToList(pCxt, yymsp[-2].minor.yy88, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 5840 "sql.c" + yymsp[-2].minor.yy88 = yylhsminor.yy88; break; case 149: /* retention_list ::= retention */ case 180: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==180); @@ -5275,1260 +5846,1897 @@ static YYACTIONTYPE yy_reduce( case 190: /* column_def_list ::= column_def */ yytestcase(yyruleno==190); case 234: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==234); case 239: /* col_name_list ::= col_name */ yytestcase(yyruleno==239); - case 301: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==301); - case 318: /* func_list ::= func */ yytestcase(yyruleno==318); - case 424: /* literal_list ::= signed_literal */ yytestcase(yyruleno==424); - case 495: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==495); - case 501: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==501); - case 560: /* select_list ::= select_item */ yytestcase(yyruleno==560); - case 571: /* partition_list ::= partition_item */ yytestcase(yyruleno==571); - case 630: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==630); -{ yylhsminor.yy106 = createNodeList(pCxt, yymsp[0].minor.yy80); } - yymsp[0].minor.yy106 = yylhsminor.yy106; + case 303: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==303); + case 320: /* func_list ::= func */ yytestcase(yyruleno==320); + case 427: /* literal_list ::= signed_literal */ yytestcase(yyruleno==427); + case 498: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==498); + case 504: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==504); + case 563: /* select_list ::= select_item */ yytestcase(yyruleno==563); + case 574: /* partition_list ::= partition_item */ yytestcase(yyruleno==574); + case 633: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==633); +#line 304 "sql.y" +{ yylhsminor.yy88 = createNodeList(pCxt, yymsp[0].minor.yy232); } +#line 5859 "sql.c" + yymsp[0].minor.yy88 = yylhsminor.yy88; break; case 150: /* retention_list ::= retention_list NK_COMMA retention */ case 184: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==184); case 191: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==191); case 235: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==235); case 240: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==240); - case 302: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==302); - case 319: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==319); - case 425: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==425); - case 496: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==496); - case 561: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==561); - case 572: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==572); - case 631: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==631); -{ yylhsminor.yy106 = addNodeToList(pCxt, yymsp[-2].minor.yy106, yymsp[0].minor.yy80); } - yymsp[-2].minor.yy106 = yylhsminor.yy106; + case 304: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==304); + case 321: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==321); + case 428: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==428); + case 499: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==499); + case 564: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==564); + case 575: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==575); + case 634: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==634); +#line 305 "sql.y" +{ yylhsminor.yy88 = addNodeToList(pCxt, yymsp[-2].minor.yy88, yymsp[0].minor.yy232); } +#line 5876 "sql.c" + yymsp[-2].minor.yy88 = yylhsminor.yy88; break; case 151: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ case 152: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==152); -{ yylhsminor.yy80 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 307 "sql.y" +{ yylhsminor.yy232 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 5883 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 153: /* speed_opt ::= */ - case 352: /* bufsize_opt ::= */ yytestcase(yyruleno==352); -{ yymsp[1].minor.yy982 = 0; } + case 354: /* bufsize_opt ::= */ yytestcase(yyruleno==354); +#line 312 "sql.y" +{ yymsp[1].minor.yy92 = 0; } +#line 5890 "sql.c" break; case 154: /* speed_opt ::= BWLIMIT NK_INTEGER */ - case 353: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==353); -{ yymsp[-1].minor.yy982 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } + case 355: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==355); +#line 313 "sql.y" +{ yymsp[-1].minor.yy92 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } +#line 5896 "sql.c" break; case 156: /* start_opt ::= START WITH NK_INTEGER */ case 160: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==160); -{ yymsp[-2].minor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +#line 316 "sql.y" +{ yymsp[-2].minor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +#line 5902 "sql.c" break; case 157: /* start_opt ::= START WITH NK_STRING */ case 161: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==161); -{ yymsp[-2].minor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 317 "sql.y" +{ yymsp[-2].minor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 5908 "sql.c" break; case 158: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ case 162: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==162); -{ yymsp[-3].minor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 318 "sql.y" +{ yymsp[-3].minor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 5914 "sql.c" break; case 163: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 165: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==165); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy923, yymsp[-5].minor.yy80, yymsp[-3].minor.yy106, yymsp[-1].minor.yy106, yymsp[0].minor.yy80); } +#line 327 "sql.y" +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy985, yymsp[-5].minor.yy232, yymsp[-3].minor.yy88, yymsp[-1].minor.yy88, yymsp[0].minor.yy232); } +#line 5920 "sql.c" break; case 164: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy106); } +#line 328 "sql.y" +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy88); } +#line 5925 "sql.c" break; case 166: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy106); } +#line 331 "sql.y" +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy88); } +#line 5930 "sql.c" break; case 167: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy923, yymsp[0].minor.yy80); } +#line 332 "sql.y" +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy985, yymsp[0].minor.yy232); } +#line 5935 "sql.c" break; case 168: /* cmd ::= ALTER TABLE alter_table_clause */ - case 397: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==397); - case 398: /* cmd ::= insert_query */ yytestcase(yyruleno==398); -{ pCxt->pRootNode = yymsp[0].minor.yy80; } + case 400: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==400); + case 401: /* cmd ::= insert_query */ yytestcase(yyruleno==401); +#line 334 "sql.y" +{ pCxt->pRootNode = yymsp[0].minor.yy232; } +#line 5942 "sql.c" break; case 169: /* cmd ::= ALTER STABLE alter_table_clause */ -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy80); } +#line 335 "sql.y" +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy232); } +#line 5947 "sql.c" break; case 170: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy80 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy80, yymsp[0].minor.yy80); } - yymsp[-1].minor.yy80 = yylhsminor.yy80; +#line 337 "sql.y" +{ yylhsminor.yy232 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy232, yymsp[0].minor.yy232); } +#line 5952 "sql.c" + yymsp[-1].minor.yy232 = yylhsminor.yy232; break; case 171: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy80 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy80, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy785, yymsp[0].minor.yy292); } - yymsp[-4].minor.yy80 = yylhsminor.yy80; +#line 339 "sql.y" +{ yylhsminor.yy232 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy993, yymsp[0].minor.yy400); } +#line 5958 "sql.c" + yymsp[-4].minor.yy232 = yylhsminor.yy232; break; case 172: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy80 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy80, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy785); } - yymsp[-3].minor.yy80 = yylhsminor.yy80; +#line 340 "sql.y" +{ yylhsminor.yy232 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy232, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy993); } +#line 5964 "sql.c" + yymsp[-3].minor.yy232 = yylhsminor.yy232; break; case 173: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy80 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy80, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy785, yymsp[0].minor.yy292); } - yymsp[-4].minor.yy80 = yylhsminor.yy80; +#line 342 "sql.y" +{ yylhsminor.yy232 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy993, yymsp[0].minor.yy400); } +#line 5970 "sql.c" + yymsp[-4].minor.yy232 = yylhsminor.yy232; break; case 174: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy80 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy80, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy785, &yymsp[0].minor.yy785); } - yymsp[-4].minor.yy80 = yylhsminor.yy80; +#line 344 "sql.y" +{ yylhsminor.yy232 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy993, &yymsp[0].minor.yy993); } +#line 5976 "sql.c" + yymsp[-4].minor.yy232 = yylhsminor.yy232; break; case 175: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy80 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy80, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy785, yymsp[0].minor.yy292); } - yymsp[-4].minor.yy80 = yylhsminor.yy80; +#line 346 "sql.y" +{ yylhsminor.yy232 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy993, yymsp[0].minor.yy400); } +#line 5982 "sql.c" + yymsp[-4].minor.yy232 = yylhsminor.yy232; break; case 176: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy80 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy80, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy785); } - yymsp[-3].minor.yy80 = yylhsminor.yy80; +#line 347 "sql.y" +{ yylhsminor.yy232 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy232, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy993); } +#line 5988 "sql.c" + yymsp[-3].minor.yy232 = yylhsminor.yy232; break; case 177: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy80 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy80, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy785, yymsp[0].minor.yy292); } - yymsp[-4].minor.yy80 = yylhsminor.yy80; +#line 349 "sql.y" +{ yylhsminor.yy232 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy993, yymsp[0].minor.yy400); } +#line 5994 "sql.c" + yymsp[-4].minor.yy232 = yylhsminor.yy232; break; case 178: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy80 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy80, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy785, &yymsp[0].minor.yy785); } - yymsp[-4].minor.yy80 = yylhsminor.yy80; +#line 351 "sql.y" +{ yylhsminor.yy232 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy232, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy993, &yymsp[0].minor.yy993); } +#line 6000 "sql.c" + yymsp[-4].minor.yy232 = yylhsminor.yy232; break; case 179: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -{ yylhsminor.yy80 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy80, &yymsp[-2].minor.yy785, yymsp[0].minor.yy80); } - yymsp[-5].minor.yy80 = yylhsminor.yy80; +#line 353 "sql.y" +{ yylhsminor.yy232 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy232, &yymsp[-2].minor.yy993, yymsp[0].minor.yy232); } +#line 6006 "sql.c" + yymsp[-5].minor.yy232 = yylhsminor.yy232; break; case 181: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 502: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==502); -{ yylhsminor.yy106 = addNodeToList(pCxt, yymsp[-1].minor.yy106, yymsp[0].minor.yy80); } - yymsp[-1].minor.yy106 = yylhsminor.yy106; + case 505: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==505); +#line 358 "sql.y" +{ yylhsminor.yy88 = addNodeToList(pCxt, yymsp[-1].minor.yy88, yymsp[0].minor.yy232); } +#line 6013 "sql.c" + yymsp[-1].minor.yy88 = yylhsminor.yy88; break; case 182: /* 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.yy80 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy923, yymsp[-8].minor.yy80, yymsp[-6].minor.yy80, yymsp[-5].minor.yy106, yymsp[-2].minor.yy106, yymsp[0].minor.yy80); } - yymsp[-9].minor.yy80 = yylhsminor.yy80; +#line 362 "sql.y" +{ yylhsminor.yy232 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy985, yymsp[-8].minor.yy232, yymsp[-6].minor.yy232, yymsp[-5].minor.yy88, yymsp[-2].minor.yy88, yymsp[0].minor.yy232); } +#line 6019 "sql.c" + yymsp[-9].minor.yy232 = yylhsminor.yy232; break; case 185: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy80 = createDropTableClause(pCxt, yymsp[-1].minor.yy923, yymsp[0].minor.yy80); } - yymsp[-1].minor.yy80 = yylhsminor.yy80; +#line 369 "sql.y" +{ yylhsminor.yy232 = createDropTableClause(pCxt, yymsp[-1].minor.yy985, yymsp[0].minor.yy232); } +#line 6025 "sql.c" + yymsp[-1].minor.yy232 = yylhsminor.yy232; break; case 187: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ - case 367: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==367); -{ yymsp[-2].minor.yy106 = yymsp[-1].minor.yy106; } + case 369: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==369); +#line 374 "sql.y" +{ yymsp[-2].minor.yy88 = yymsp[-1].minor.yy88; } +#line 6032 "sql.c" break; case 188: /* full_table_name ::= table_name */ -{ yylhsminor.yy80 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy785, NULL); } - yymsp[0].minor.yy80 = yylhsminor.yy80; +#line 376 "sql.y" +{ yylhsminor.yy232 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy993, NULL); } +#line 6037 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; case 189: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy80 = createRealTableNode(pCxt, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy785, NULL); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 377 "sql.y" +{ yylhsminor.yy232 = createRealTableNode(pCxt, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy993, NULL); } +#line 6043 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 192: /* column_def ::= column_name type_name */ -{ yylhsminor.yy80 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy785, yymsp[0].minor.yy292, NULL); } - yymsp[-1].minor.yy80 = yylhsminor.yy80; +#line 384 "sql.y" +{ yylhsminor.yy232 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy993, yymsp[0].minor.yy400, NULL); } +#line 6049 "sql.c" + yymsp[-1].minor.yy232 = yylhsminor.yy232; break; case 193: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_BOOL); } +#line 389 "sql.y" +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_BOOL); } +#line 6055 "sql.c" break; case 194: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_TINYINT); } +#line 390 "sql.y" +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_TINYINT); } +#line 6060 "sql.c" break; case 195: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +#line 391 "sql.y" +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +#line 6065 "sql.c" break; case 196: /* type_name ::= INT */ case 197: /* type_name ::= INTEGER */ yytestcase(yyruleno==197); -{ yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_INT); } +#line 392 "sql.y" +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_INT); } +#line 6071 "sql.c" break; case 198: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_BIGINT); } +#line 394 "sql.y" +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_BIGINT); } +#line 6076 "sql.c" break; case 199: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_FLOAT); } +#line 395 "sql.y" +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_FLOAT); } +#line 6081 "sql.c" break; case 200: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +#line 396 "sql.y" +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +#line 6086 "sql.c" break; case 201: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy292 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +#line 397 "sql.y" +{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +#line 6091 "sql.c" break; case 202: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +#line 398 "sql.y" +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +#line 6096 "sql.c" break; case 203: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy292 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +#line 399 "sql.y" +{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +#line 6101 "sql.c" break; case 204: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy292 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +#line 400 "sql.y" +{ yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +#line 6106 "sql.c" break; case 205: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy292 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +#line 401 "sql.y" +{ yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +#line 6111 "sql.c" break; case 206: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy292 = createDataType(TSDB_DATA_TYPE_UINT); } +#line 402 "sql.y" +{ yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_UINT); } +#line 6116 "sql.c" break; case 207: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy292 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +#line 403 "sql.y" +{ yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +#line 6121 "sql.c" break; case 208: /* type_name ::= JSON */ -{ yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_JSON); } +#line 404 "sql.y" +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_JSON); } +#line 6126 "sql.c" break; case 209: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy292 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +#line 405 "sql.y" +{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +#line 6131 "sql.c" break; case 210: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +#line 406 "sql.y" +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +#line 6136 "sql.c" break; case 211: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_BLOB); } +#line 407 "sql.y" +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_BLOB); } +#line 6141 "sql.c" break; case 212: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy292 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +#line 408 "sql.y" +{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +#line 6146 "sql.c" break; case 213: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy292 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } +#line 409 "sql.y" +{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } +#line 6151 "sql.c" break; case 214: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy292 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +#line 410 "sql.y" +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +#line 6156 "sql.c" break; case 215: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy292 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +#line 411 "sql.y" +{ yymsp[-3].minor.yy400 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +#line 6161 "sql.c" break; case 216: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy292 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +#line 412 "sql.y" +{ yymsp[-5].minor.yy400 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +#line 6166 "sql.c" break; case 219: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ - case 370: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==370); -{ yymsp[-3].minor.yy106 = yymsp[-1].minor.yy106; } + case 372: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==372); +#line 421 "sql.y" +{ yymsp[-3].minor.yy88 = yymsp[-1].minor.yy88; } +#line 6172 "sql.c" break; case 220: /* table_options ::= */ -{ yymsp[1].minor.yy80 = createDefaultTableOptions(pCxt); } +#line 423 "sql.y" +{ yymsp[1].minor.yy232 = createDefaultTableOptions(pCxt); } +#line 6177 "sql.c" break; case 221: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy80 = setTableOption(pCxt, yymsp[-2].minor.yy80, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 424 "sql.y" +{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-2].minor.yy232, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } +#line 6182 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 222: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy80 = setTableOption(pCxt, yymsp[-2].minor.yy80, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy106); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 425 "sql.y" +{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-2].minor.yy232, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy88); } +#line 6188 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 223: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy80 = setTableOption(pCxt, yymsp[-2].minor.yy80, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy106); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 426 "sql.y" +{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-2].minor.yy232, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy88); } +#line 6194 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 224: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy80 = setTableOption(pCxt, yymsp[-4].minor.yy80, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy106); } - yymsp[-4].minor.yy80 = yylhsminor.yy80; +#line 427 "sql.y" +{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-4].minor.yy232, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy88); } +#line 6200 "sql.c" + yymsp[-4].minor.yy232 = yylhsminor.yy232; break; case 225: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy80 = setTableOption(pCxt, yymsp[-2].minor.yy80, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 428 "sql.y" +{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-2].minor.yy232, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } +#line 6206 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 226: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy80 = setTableOption(pCxt, yymsp[-4].minor.yy80, TABLE_OPTION_SMA, yymsp[-1].minor.yy106); } - yymsp[-4].minor.yy80 = yylhsminor.yy80; +#line 429 "sql.y" +{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-4].minor.yy232, TABLE_OPTION_SMA, yymsp[-1].minor.yy88); } +#line 6212 "sql.c" + yymsp[-4].minor.yy232 = yylhsminor.yy232; break; case 227: /* table_options ::= table_options DELETE_MARK duration_list */ -{ yylhsminor.yy80 = setTableOption(pCxt, yymsp[-2].minor.yy80, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy106); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 430 "sql.y" +{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-2].minor.yy232, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy88); } +#line 6218 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 228: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy80 = createAlterTableOptions(pCxt); yylhsminor.yy80 = setTableOption(pCxt, yylhsminor.yy80, yymsp[0].minor.yy455.type, &yymsp[0].minor.yy455.val); } - yymsp[0].minor.yy80 = yylhsminor.yy80; +#line 432 "sql.y" +{ yylhsminor.yy232 = createAlterTableOptions(pCxt); yylhsminor.yy232 = setTableOption(pCxt, yylhsminor.yy232, yymsp[0].minor.yy117.type, &yymsp[0].minor.yy117.val); } +#line 6224 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; case 229: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy80 = setTableOption(pCxt, yymsp[-1].minor.yy80, yymsp[0].minor.yy455.type, &yymsp[0].minor.yy455.val); } - yymsp[-1].minor.yy80 = yylhsminor.yy80; +#line 433 "sql.y" +{ yylhsminor.yy232 = setTableOption(pCxt, yymsp[-1].minor.yy232, yymsp[0].minor.yy117.type, &yymsp[0].minor.yy117.val); } +#line 6230 "sql.c" + yymsp[-1].minor.yy232 = yylhsminor.yy232; break; case 230: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy455.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy455.val = yymsp[0].minor.yy0; } +#line 437 "sql.y" +{ yymsp[-1].minor.yy117.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; } +#line 6236 "sql.c" break; case 231: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy455.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy455.val = yymsp[0].minor.yy0; } +#line 438 "sql.y" +{ yymsp[-1].minor.yy117.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy117.val = yymsp[0].minor.yy0; } +#line 6241 "sql.c" break; case 232: /* duration_list ::= duration_literal */ - case 456: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==456); -{ yylhsminor.yy106 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy80)); } - yymsp[0].minor.yy106 = yylhsminor.yy106; + case 459: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==459); +#line 442 "sql.y" +{ yylhsminor.yy88 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy232)); } +#line 6247 "sql.c" + yymsp[0].minor.yy88 = yylhsminor.yy88; break; case 233: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 457: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==457); -{ yylhsminor.yy106 = addNodeToList(pCxt, yymsp[-2].minor.yy106, releaseRawExprNode(pCxt, yymsp[0].minor.yy80)); } - yymsp[-2].minor.yy106 = yylhsminor.yy106; + case 460: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==460); +#line 443 "sql.y" +{ yylhsminor.yy88 = addNodeToList(pCxt, yymsp[-2].minor.yy88, releaseRawExprNode(pCxt, yymsp[0].minor.yy232)); } +#line 6254 "sql.c" + yymsp[-2].minor.yy88 = yylhsminor.yy88; break; case 236: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy80 = createFunctionNode(pCxt, &yymsp[0].minor.yy785, NULL); } - yymsp[0].minor.yy80 = yylhsminor.yy80; +#line 450 "sql.y" +{ yylhsminor.yy232 = createFunctionNode(pCxt, &yymsp[0].minor.yy993, NULL); } +#line 6260 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; case 237: /* rollup_func_name ::= FIRST */ case 238: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==238); - case 304: /* tag_item ::= QTAGS */ yytestcase(yyruleno==304); -{ yylhsminor.yy80 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 306: /* tag_item ::= QTAGS */ yytestcase(yyruleno==306); +#line 451 "sql.y" +{ yylhsminor.yy232 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } +#line 6268 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; case 241: /* col_name ::= column_name */ - case 305: /* tag_item ::= column_name */ yytestcase(yyruleno==305); -{ yylhsminor.yy80 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy785); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 307: /* tag_item ::= column_name */ yytestcase(yyruleno==307); +#line 459 "sql.y" +{ yylhsminor.yy232 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy993); } +#line 6275 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; case 242: /* cmd ::= SHOW DNODES */ +#line 462 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } +#line 6281 "sql.c" break; case 243: /* cmd ::= SHOW USERS */ +#line 463 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } +#line 6286 "sql.c" break; case 244: /* cmd ::= SHOW USER PRIVILEGES */ +#line 464 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } +#line 6291 "sql.c" break; case 245: /* cmd ::= SHOW db_kind_opt DATABASES */ +#line 465 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); - setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy459); + setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy281); } +#line 6299 "sql.c" break; case 246: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ +#line 469 "sql.y" { - pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy709, yymsp[0].minor.yy80, OP_TYPE_LIKE); + pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy133, yymsp[0].minor.yy232, OP_TYPE_LIKE); } +#line 6306 "sql.c" break; case 247: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy80, yymsp[0].minor.yy80, OP_TYPE_LIKE); } +#line 472 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy232, yymsp[0].minor.yy232, OP_TYPE_LIKE); } +#line 6311 "sql.c" break; case 248: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy80, NULL, OP_TYPE_LIKE); } +#line 473 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy232, NULL, OP_TYPE_LIKE); } +#line 6316 "sql.c" break; case 249: /* cmd ::= SHOW MNODES */ +#line 474 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } +#line 6321 "sql.c" break; case 250: /* cmd ::= SHOW QNODES */ +#line 476 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } +#line 6326 "sql.c" break; case 251: /* cmd ::= SHOW FUNCTIONS */ +#line 477 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } +#line 6331 "sql.c" break; case 252: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy80, yymsp[-1].minor.yy80, OP_TYPE_EQUAL); } +#line 478 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy232, yymsp[-1].minor.yy232, OP_TYPE_EQUAL); } +#line 6336 "sql.c" break; case 253: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy785), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy785), OP_TYPE_EQUAL); } +#line 479 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy993), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy993), OP_TYPE_EQUAL); } +#line 6341 "sql.c" break; case 254: /* cmd ::= SHOW STREAMS */ +#line 480 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } +#line 6346 "sql.c" break; case 255: /* cmd ::= SHOW ACCOUNTS */ +#line 481 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } +#line 6351 "sql.c" break; case 256: /* cmd ::= SHOW APPS */ +#line 482 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } +#line 6356 "sql.c" break; case 257: /* cmd ::= SHOW CONNECTIONS */ +#line 483 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } +#line 6361 "sql.c" break; case 258: /* cmd ::= SHOW LICENCES */ case 259: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==259); +#line 484 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } +#line 6367 "sql.c" break; case 260: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy785); } +#line 486 "sql.y" +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy993); } +#line 6372 "sql.c" break; case 261: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy80); } +#line 487 "sql.y" +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy232); } +#line 6377 "sql.c" break; case 262: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy80); } +#line 488 "sql.y" +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy232); } +#line 6382 "sql.c" break; case 263: /* cmd ::= SHOW QUERIES */ +#line 489 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } +#line 6387 "sql.c" break; case 264: /* cmd ::= SHOW SCORES */ +#line 490 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } +#line 6392 "sql.c" break; case 265: /* cmd ::= SHOW TOPICS */ +#line 491 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } +#line 6397 "sql.c" break; case 266: /* cmd ::= SHOW VARIABLES */ case 267: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==267); +#line 492 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } +#line 6403 "sql.c" break; case 268: /* cmd ::= SHOW LOCAL VARIABLES */ +#line 494 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } +#line 6408 "sql.c" break; case 269: /* 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.yy80); } +#line 495 "sql.y" +{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy232); } +#line 6413 "sql.c" break; case 270: /* cmd ::= SHOW BNODES */ +#line 496 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } +#line 6418 "sql.c" break; case 271: /* cmd ::= SHOW SNODES */ +#line 497 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } +#line 6423 "sql.c" break; case 272: /* cmd ::= SHOW CLUSTER */ +#line 498 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } +#line 6428 "sql.c" break; case 273: /* cmd ::= SHOW TRANSACTIONS */ +#line 499 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } +#line 6433 "sql.c" break; case 274: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy80); } +#line 500 "sql.y" +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy232); } +#line 6438 "sql.c" break; case 275: /* cmd ::= SHOW CONSUMERS */ +#line 501 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } +#line 6443 "sql.c" break; case 276: /* cmd ::= SHOW SUBSCRIPTIONS */ +#line 502 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } +#line 6448 "sql.c" break; case 277: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy80, yymsp[-1].minor.yy80, OP_TYPE_EQUAL); } +#line 503 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy232, yymsp[-1].minor.yy232, OP_TYPE_EQUAL); } +#line 6453 "sql.c" break; case 278: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy785), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy785), OP_TYPE_EQUAL); } +#line 504 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy993), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy993), OP_TYPE_EQUAL); } +#line 6458 "sql.c" break; case 279: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy80, yymsp[0].minor.yy80, yymsp[-3].minor.yy106); } +#line 505 "sql.y" +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy232, yymsp[0].minor.yy232, yymsp[-3].minor.yy88); } +#line 6463 "sql.c" break; case 280: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy785), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy785), yymsp[-4].minor.yy106); } +#line 506 "sql.y" +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy993), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy993), yymsp[-4].minor.yy88); } +#line 6468 "sql.c" break; case 281: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ +#line 507 "sql.y" { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } +#line 6473 "sql.c" break; case 282: /* cmd ::= SHOW VNODES */ +#line 508 "sql.y" { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } +#line 6478 "sql.c" break; case 283: /* cmd ::= SHOW db_name_cond_opt ALIVE */ -{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy80, QUERY_NODE_SHOW_DB_ALIVE_STMT); } +#line 510 "sql.y" +{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy232, QUERY_NODE_SHOW_DB_ALIVE_STMT); } +#line 6483 "sql.c" break; case 284: /* cmd ::= SHOW CLUSTER ALIVE */ +#line 511 "sql.y" { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } +#line 6488 "sql.c" break; case 285: /* cmd ::= SHOW db_name_cond_opt VIEWS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-1].minor.yy80, NULL, OP_TYPE_LIKE); } +#line 512 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-1].minor.yy232, NULL, OP_TYPE_LIKE); } +#line 6493 "sql.c" break; case 286: /* cmd ::= SHOW CREATE VIEW full_table_name */ -{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy80); } +#line 513 "sql.y" +{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy232); } +#line 6498 "sql.c" break; - case 287: /* table_kind_db_name_cond_opt ::= */ -{ yymsp[1].minor.yy709.kind = SHOW_KIND_ALL; yymsp[1].minor.yy709.dbName = nil_token; } + case 287: /* cmd ::= SHOW COMPACTS */ +#line 514 "sql.y" +{ pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); } +#line 6503 "sql.c" break; - case 288: /* table_kind_db_name_cond_opt ::= table_kind */ -{ yylhsminor.yy709.kind = yymsp[0].minor.yy459; yylhsminor.yy709.dbName = nil_token; } - yymsp[0].minor.yy709 = yylhsminor.yy709; + case 288: /* cmd ::= SHOW COMPACT NK_INTEGER */ +#line 515 "sql.y" +{ pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 6508 "sql.c" break; - case 289: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy709.kind = SHOW_KIND_ALL; yylhsminor.yy709.dbName = yymsp[-1].minor.yy785; } - yymsp[-1].minor.yy709 = yylhsminor.yy709; + case 289: /* table_kind_db_name_cond_opt ::= */ +#line 519 "sql.y" +{ yymsp[1].minor.yy133.kind = SHOW_KIND_ALL; yymsp[1].minor.yy133.dbName = nil_token; } +#line 6513 "sql.c" break; - case 290: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ -{ yylhsminor.yy709.kind = yymsp[-2].minor.yy459; yylhsminor.yy709.dbName = yymsp[-1].minor.yy785; } - yymsp[-2].minor.yy709 = yylhsminor.yy709; + case 290: /* table_kind_db_name_cond_opt ::= table_kind */ +#line 520 "sql.y" +{ yylhsminor.yy133.kind = yymsp[0].minor.yy281; yylhsminor.yy133.dbName = nil_token; } +#line 6518 "sql.c" + yymsp[0].minor.yy133 = yylhsminor.yy133; break; - case 291: /* table_kind ::= NORMAL */ -{ yymsp[0].minor.yy459 = SHOW_KIND_TABLES_NORMAL; } + case 291: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ +#line 521 "sql.y" +{ yylhsminor.yy133.kind = SHOW_KIND_ALL; yylhsminor.yy133.dbName = yymsp[-1].minor.yy993; } +#line 6524 "sql.c" + yymsp[-1].minor.yy133 = yylhsminor.yy133; break; - case 292: /* table_kind ::= CHILD */ -{ yymsp[0].minor.yy459 = SHOW_KIND_TABLES_CHILD; } + case 292: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ +#line 522 "sql.y" +{ yylhsminor.yy133.kind = yymsp[-2].minor.yy281; yylhsminor.yy133.dbName = yymsp[-1].minor.yy993; } +#line 6530 "sql.c" + yymsp[-2].minor.yy133 = yylhsminor.yy133; break; - case 293: /* db_name_cond_opt ::= */ - case 298: /* from_db_opt ::= */ yytestcase(yyruleno==298); -{ yymsp[1].minor.yy80 = createDefaultDatabaseCondValue(pCxt); } + case 293: /* table_kind ::= NORMAL */ +#line 526 "sql.y" +{ yymsp[0].minor.yy281 = SHOW_KIND_TABLES_NORMAL; } +#line 6536 "sql.c" break; - case 294: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy80 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy785); } - yymsp[-1].minor.yy80 = yylhsminor.yy80; + case 294: /* table_kind ::= CHILD */ +#line 527 "sql.y" +{ yymsp[0].minor.yy281 = SHOW_KIND_TABLES_CHILD; } +#line 6541 "sql.c" break; - case 296: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 295: /* db_name_cond_opt ::= */ + case 300: /* from_db_opt ::= */ yytestcase(yyruleno==300); +#line 529 "sql.y" +{ yymsp[1].minor.yy232 = createDefaultDatabaseCondValue(pCxt); } +#line 6547 "sql.c" break; - case 297: /* table_name_cond ::= table_name */ -{ yylhsminor.yy80 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy785); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 296: /* db_name_cond_opt ::= db_name NK_DOT */ +#line 530 "sql.y" +{ yylhsminor.yy232 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy993); } +#line 6552 "sql.c" + yymsp[-1].minor.yy232 = yylhsminor.yy232; break; - case 299: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy80 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy785); } + case 298: /* like_pattern_opt ::= LIKE NK_STRING */ +#line 533 "sql.y" +{ yymsp[-1].minor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +#line 6558 "sql.c" break; - case 303: /* tag_item ::= TBNAME */ -{ yylhsminor.yy80 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 299: /* table_name_cond ::= table_name */ +#line 535 "sql.y" +{ yylhsminor.yy232 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy993); } +#line 6563 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 306: /* tag_item ::= column_name column_alias */ -{ yylhsminor.yy80 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy785), &yymsp[0].minor.yy785); } - yymsp[-1].minor.yy80 = yylhsminor.yy80; + case 301: /* from_db_opt ::= FROM db_name */ +#line 538 "sql.y" +{ yymsp[-1].minor.yy232 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy993); } +#line 6569 "sql.c" break; - case 307: /* tag_item ::= column_name AS column_alias */ -{ yylhsminor.yy80 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy785), &yymsp[0].minor.yy785); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 305: /* tag_item ::= TBNAME */ +#line 546 "sql.y" +{ yylhsminor.yy232 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } +#line 6574 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 308: /* db_kind_opt ::= */ -{ yymsp[1].minor.yy459 = SHOW_KIND_ALL; } + case 308: /* tag_item ::= column_name column_alias */ +#line 549 "sql.y" +{ yylhsminor.yy232 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy993), &yymsp[0].minor.yy993); } +#line 6580 "sql.c" + yymsp[-1].minor.yy232 = yylhsminor.yy232; break; - case 309: /* db_kind_opt ::= USER */ -{ yymsp[0].minor.yy459 = SHOW_KIND_DATABASES_USER; } + case 309: /* tag_item ::= column_name AS column_alias */ +#line 550 "sql.y" +{ yylhsminor.yy232 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy993), &yymsp[0].minor.yy993); } +#line 6586 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 310: /* db_kind_opt ::= SYSTEM */ -{ yymsp[0].minor.yy459 = SHOW_KIND_DATABASES_SYSTEM; } + case 310: /* db_kind_opt ::= */ +#line 554 "sql.y" +{ yymsp[1].minor.yy281 = SHOW_KIND_ALL; } +#line 6592 "sql.c" break; - case 311: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy923, yymsp[-3].minor.yy80, yymsp[-1].minor.yy80, NULL, yymsp[0].minor.yy80); } + case 311: /* db_kind_opt ::= USER */ +#line 555 "sql.y" +{ yymsp[0].minor.yy281 = SHOW_KIND_DATABASES_USER; } +#line 6597 "sql.c" break; - case 312: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy923, yymsp[-5].minor.yy80, yymsp[-3].minor.yy80, yymsp[-1].minor.yy106, NULL); } + case 312: /* db_kind_opt ::= SYSTEM */ +#line 556 "sql.y" +{ yymsp[0].minor.yy281 = SHOW_KIND_DATABASES_SYSTEM; } +#line 6602 "sql.c" break; - case 313: /* cmd ::= DROP INDEX exists_opt full_index_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy923, yymsp[0].minor.yy80); } + case 313: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ +#line 560 "sql.y" +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy985, yymsp[-3].minor.yy232, yymsp[-1].minor.yy232, NULL, yymsp[0].minor.yy232); } +#line 6607 "sql.c" break; - case 314: /* full_index_name ::= index_name */ -{ yylhsminor.yy80 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy785); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 314: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ +#line 562 "sql.y" +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy985, yymsp[-5].minor.yy232, yymsp[-3].minor.yy232, yymsp[-1].minor.yy88, NULL); } +#line 6612 "sql.c" break; - case 315: /* full_index_name ::= db_name NK_DOT index_name */ -{ yylhsminor.yy80 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy785); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 315: /* cmd ::= DROP INDEX exists_opt full_index_name */ +#line 563 "sql.y" +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy985, yymsp[0].minor.yy232); } +#line 6617 "sql.c" break; - case 316: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-9].minor.yy80 = createIndexOption(pCxt, yymsp[-7].minor.yy106, releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), NULL, yymsp[-1].minor.yy80, yymsp[0].minor.yy80); } + case 316: /* full_index_name ::= index_name */ +#line 565 "sql.y" +{ yylhsminor.yy232 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy993); } +#line 6622 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 317: /* 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.yy80 = createIndexOption(pCxt, yymsp[-9].minor.yy106, releaseRawExprNode(pCxt, yymsp[-5].minor.yy80), releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), yymsp[-1].minor.yy80, yymsp[0].minor.yy80); } + case 317: /* full_index_name ::= db_name NK_DOT index_name */ +#line 566 "sql.y" +{ yylhsminor.yy232 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy993); } +#line 6628 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 320: /* func ::= sma_func_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy80 = createFunctionNode(pCxt, &yymsp[-3].minor.yy785, yymsp[-1].minor.yy106); } - yymsp[-3].minor.yy80 = yylhsminor.yy80; + case 318: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ +#line 569 "sql.y" +{ yymsp[-9].minor.yy232 = createIndexOption(pCxt, yymsp[-7].minor.yy88, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), NULL, yymsp[-1].minor.yy232, yymsp[0].minor.yy232); } +#line 6634 "sql.c" break; - case 321: /* sma_func_name ::= function_name */ - case 545: /* alias_opt ::= table_alias */ yytestcase(yyruleno==545); -{ yylhsminor.yy785 = yymsp[0].minor.yy785; } - yymsp[0].minor.yy785 = yylhsminor.yy785; + case 319: /* 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 572 "sql.y" +{ yymsp[-11].minor.yy232 = createIndexOption(pCxt, yymsp[-9].minor.yy88, releaseRawExprNode(pCxt, yymsp[-5].minor.yy232), releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), yymsp[-1].minor.yy232, yymsp[0].minor.yy232); } +#line 6639 "sql.c" break; - case 326: /* sma_stream_opt ::= */ - case 371: /* stream_options ::= */ yytestcase(yyruleno==371); -{ yymsp[1].minor.yy80 = createStreamOptions(pCxt); } + case 322: /* func ::= sma_func_name NK_LP expression_list NK_RP */ +#line 579 "sql.y" +{ yylhsminor.yy232 = createFunctionNode(pCxt, &yymsp[-3].minor.yy993, yymsp[-1].minor.yy88); } +#line 6644 "sql.c" + yymsp[-3].minor.yy232 = yylhsminor.yy232; break; - case 327: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy80)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy80); yylhsminor.yy80 = yymsp[-2].minor.yy80; } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 323: /* sma_func_name ::= function_name */ + case 548: /* alias_opt ::= table_alias */ yytestcase(yyruleno==548); +#line 583 "sql.y" +{ yylhsminor.yy993 = yymsp[0].minor.yy993; } +#line 6651 "sql.c" + yymsp[0].minor.yy993 = yylhsminor.yy993; break; - case 328: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy80)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy80); yylhsminor.yy80 = yymsp[-2].minor.yy80; } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 328: /* sma_stream_opt ::= */ + case 373: /* stream_options ::= */ yytestcase(yyruleno==373); +#line 589 "sql.y" +{ yymsp[1].minor.yy232 = createStreamOptions(pCxt); } +#line 6658 "sql.c" break; - case 329: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy80)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy80); yylhsminor.yy80 = yymsp[-2].minor.yy80; } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 329: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ +#line 590 "sql.y" +{ ((SStreamOptions*)yymsp[-2].minor.yy232)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy232); yylhsminor.yy232 = yymsp[-2].minor.yy232; } +#line 6663 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 330: /* with_meta ::= AS */ -{ yymsp[0].minor.yy982 = 0; } + case 330: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ +#line 591 "sql.y" +{ ((SStreamOptions*)yymsp[-2].minor.yy232)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy232); yylhsminor.yy232 = yymsp[-2].minor.yy232; } +#line 6669 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 331: /* with_meta ::= WITH META AS */ -{ yymsp[-2].minor.yy982 = 1; } + case 331: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ +#line 592 "sql.y" +{ ((SStreamOptions*)yymsp[-2].minor.yy232)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy232); yylhsminor.yy232 = yymsp[-2].minor.yy232; } +#line 6675 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 332: /* with_meta ::= ONLY META AS */ -{ yymsp[-2].minor.yy982 = 2; } + case 332: /* with_meta ::= AS */ +#line 597 "sql.y" +{ yymsp[0].minor.yy92 = 0; } +#line 6681 "sql.c" break; - case 333: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy923, &yymsp[-2].minor.yy785, yymsp[0].minor.yy80); } + case 333: /* with_meta ::= WITH META AS */ +#line 598 "sql.y" +{ yymsp[-2].minor.yy92 = 1; } +#line 6686 "sql.c" break; - case 334: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy923, &yymsp[-3].minor.yy785, &yymsp[0].minor.yy785, yymsp[-2].minor.yy982); } + case 334: /* with_meta ::= ONLY META AS */ +#line 599 "sql.y" +{ yymsp[-2].minor.yy92 = 2; } +#line 6691 "sql.c" break; - case 335: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy923, &yymsp[-4].minor.yy785, yymsp[-1].minor.yy80, yymsp[-3].minor.yy982, yymsp[0].minor.yy80); } + case 335: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ +#line 601 "sql.y" +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy985, &yymsp[-2].minor.yy993, yymsp[0].minor.yy232); } +#line 6696 "sql.c" break; - case 336: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy923, &yymsp[0].minor.yy785); } + case 336: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ +#line 603 "sql.y" +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy985, &yymsp[-3].minor.yy993, &yymsp[0].minor.yy993, yymsp[-2].minor.yy92); } +#line 6701 "sql.c" break; - case 337: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy923, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy785); } + case 337: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ +#line 605 "sql.y" +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy985, &yymsp[-4].minor.yy993, yymsp[-1].minor.yy232, yymsp[-3].minor.yy92, yymsp[0].minor.yy232); } +#line 6706 "sql.c" break; - case 338: /* cmd ::= DESC full_table_name */ - case 339: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==339); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy80); } + case 338: /* cmd ::= DROP TOPIC exists_opt topic_name */ +#line 607 "sql.y" +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy985, &yymsp[0].minor.yy993); } +#line 6711 "sql.c" break; - case 340: /* cmd ::= RESET QUERY CACHE */ + case 339: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ +#line 608 "sql.y" +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy985, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy993); } +#line 6716 "sql.c" + break; + case 340: /* cmd ::= DESC full_table_name */ + case 341: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==341); +#line 611 "sql.y" +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy232); } +#line 6722 "sql.c" + break; + case 342: /* cmd ::= RESET QUERY CACHE */ +#line 615 "sql.y" { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } +#line 6727 "sql.c" break; - case 341: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - case 342: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==342); -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy923, yymsp[-1].minor.yy80, yymsp[0].minor.yy80); } + case 343: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + case 344: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==344); +#line 618 "sql.y" +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy985, yymsp[-1].minor.yy232, yymsp[0].minor.yy232); } +#line 6733 "sql.c" break; - case 345: /* explain_options ::= */ -{ yymsp[1].minor.yy80 = createDefaultExplainOptions(pCxt); } + case 347: /* explain_options ::= */ +#line 626 "sql.y" +{ yymsp[1].minor.yy232 = createDefaultExplainOptions(pCxt); } +#line 6738 "sql.c" break; - case 346: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy80 = setExplainVerbose(pCxt, yymsp[-2].minor.yy80, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 348: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +#line 627 "sql.y" +{ yylhsminor.yy232 = setExplainVerbose(pCxt, yymsp[-2].minor.yy232, &yymsp[0].minor.yy0); } +#line 6743 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 347: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy80 = setExplainRatio(pCxt, yymsp[-2].minor.yy80, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 349: /* explain_options ::= explain_options RATIO NK_FLOAT */ +#line 628 "sql.y" +{ yylhsminor.yy232 = setExplainRatio(pCxt, yymsp[-2].minor.yy232, &yymsp[0].minor.yy0); } +#line 6749 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 348: /* 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.yy923, yymsp[-9].minor.yy923, &yymsp[-6].minor.yy785, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy292, yymsp[-1].minor.yy982, &yymsp[0].minor.yy785, yymsp[-10].minor.yy923); } + case 350: /* 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 633 "sql.y" +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy985, yymsp[-9].minor.yy985, &yymsp[-6].minor.yy993, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy400, yymsp[-1].minor.yy92, &yymsp[0].minor.yy993, yymsp[-10].minor.yy985); } +#line 6755 "sql.c" break; - case 349: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy923, &yymsp[0].minor.yy785); } + case 351: /* cmd ::= DROP FUNCTION exists_opt function_name */ +#line 634 "sql.y" +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy985, &yymsp[0].minor.yy993); } +#line 6760 "sql.c" break; - case 354: /* language_opt ::= */ - case 392: /* on_vgroup_id ::= */ yytestcase(yyruleno==392); -{ yymsp[1].minor.yy785 = nil_token; } + case 356: /* language_opt ::= */ + case 395: /* on_vgroup_id ::= */ yytestcase(yyruleno==395); +#line 648 "sql.y" +{ yymsp[1].minor.yy993 = nil_token; } +#line 6766 "sql.c" break; - case 355: /* language_opt ::= LANGUAGE NK_STRING */ - case 393: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==393); -{ yymsp[-1].minor.yy785 = yymsp[0].minor.yy0; } + case 357: /* language_opt ::= LANGUAGE NK_STRING */ + case 396: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==396); +#line 649 "sql.y" +{ yymsp[-1].minor.yy993 = yymsp[0].minor.yy0; } +#line 6772 "sql.c" break; - case 358: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ -{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy923, yymsp[-2].minor.yy80, &yymsp[-1].minor.yy0, yymsp[0].minor.yy80); } + case 360: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ +#line 658 "sql.y" +{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy985, yymsp[-2].minor.yy232, &yymsp[-1].minor.yy0, yymsp[0].minor.yy232); } +#line 6777 "sql.c" break; - case 359: /* cmd ::= DROP VIEW exists_opt full_view_name */ -{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy923, yymsp[0].minor.yy80); } + case 361: /* cmd ::= DROP VIEW exists_opt full_view_name */ +#line 659 "sql.y" +{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy985, yymsp[0].minor.yy232); } +#line 6782 "sql.c" break; - case 360: /* full_view_name ::= view_name */ -{ yylhsminor.yy80 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy785); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 362: /* full_view_name ::= view_name */ +#line 661 "sql.y" +{ yylhsminor.yy232 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy993); } +#line 6787 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 361: /* full_view_name ::= db_name NK_DOT view_name */ -{ yylhsminor.yy80 = createViewNode(pCxt, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy785); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 363: /* full_view_name ::= db_name NK_DOT view_name */ +#line 662 "sql.y" +{ yylhsminor.yy232 = createViewNode(pCxt, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy993); } +#line 6793 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 362: /* 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.yy923, &yymsp[-8].minor.yy785, yymsp[-5].minor.yy80, yymsp[-7].minor.yy80, yymsp[-3].minor.yy106, yymsp[-2].minor.yy80, yymsp[0].minor.yy80, yymsp[-4].minor.yy106); } + case 364: /* 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 667 "sql.y" +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy985, &yymsp[-8].minor.yy993, yymsp[-5].minor.yy232, yymsp[-7].minor.yy232, yymsp[-3].minor.yy88, yymsp[-2].minor.yy232, yymsp[0].minor.yy232, yymsp[-4].minor.yy88); } +#line 6799 "sql.c" break; - case 363: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy923, &yymsp[0].minor.yy785); } + case 365: /* cmd ::= DROP STREAM exists_opt stream_name */ +#line 668 "sql.y" +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy985, &yymsp[0].minor.yy993); } +#line 6804 "sql.c" break; - case 364: /* cmd ::= PAUSE STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy923, &yymsp[0].minor.yy785); } + case 366: /* cmd ::= PAUSE STREAM exists_opt stream_name */ +#line 669 "sql.y" +{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy985, &yymsp[0].minor.yy993); } +#line 6809 "sql.c" break; - case 365: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ -{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy923, yymsp[-1].minor.yy923, &yymsp[0].minor.yy785); } + case 367: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ +#line 670 "sql.y" +{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy985, yymsp[-1].minor.yy985, &yymsp[0].minor.yy993); } +#line 6814 "sql.c" break; - case 372: /* stream_options ::= stream_options TRIGGER AT_ONCE */ - case 373: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==373); -{ yylhsminor.yy80 = setStreamOptions(pCxt, yymsp[-2].minor.yy80, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 374: /* stream_options ::= stream_options TRIGGER AT_ONCE */ + case 375: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==375); +#line 684 "sql.y" +{ yylhsminor.yy232 = setStreamOptions(pCxt, yymsp[-2].minor.yy232, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } +#line 6820 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 374: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ yylhsminor.yy80 = setStreamOptions(pCxt, yymsp[-3].minor.yy80, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy80)); } - yymsp[-3].minor.yy80 = yylhsminor.yy80; + case 376: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +#line 686 "sql.y" +{ yylhsminor.yy232 = setStreamOptions(pCxt, yymsp[-3].minor.yy232, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy232)); } +#line 6826 "sql.c" + yymsp[-3].minor.yy232 = yylhsminor.yy232; break; - case 375: /* stream_options ::= stream_options WATERMARK duration_literal */ -{ yylhsminor.yy80 = setStreamOptions(pCxt, yymsp[-2].minor.yy80, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy80)); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 377: /* stream_options ::= stream_options WATERMARK duration_literal */ +#line 687 "sql.y" +{ yylhsminor.yy232 = setStreamOptions(pCxt, yymsp[-2].minor.yy232, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy232)); } +#line 6832 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 376: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -{ yylhsminor.yy80 = setStreamOptions(pCxt, yymsp[-3].minor.yy80, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-3].minor.yy80 = yylhsminor.yy80; + case 378: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +#line 688 "sql.y" +{ yylhsminor.yy232 = setStreamOptions(pCxt, yymsp[-3].minor.yy232, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } +#line 6838 "sql.c" + yymsp[-3].minor.yy232 = yylhsminor.yy232; break; - case 377: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ -{ yylhsminor.yy80 = setStreamOptions(pCxt, yymsp[-2].minor.yy80, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 379: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ +#line 689 "sql.y" +{ yylhsminor.yy232 = setStreamOptions(pCxt, yymsp[-2].minor.yy232, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } +#line 6844 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 378: /* stream_options ::= stream_options DELETE_MARK duration_literal */ -{ yylhsminor.yy80 = setStreamOptions(pCxt, yymsp[-2].minor.yy80, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy80)); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 380: /* stream_options ::= stream_options DELETE_MARK duration_literal */ +#line 690 "sql.y" +{ yylhsminor.yy232 = setStreamOptions(pCxt, yymsp[-2].minor.yy232, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy232)); } +#line 6850 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 379: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ -{ yylhsminor.yy80 = setStreamOptions(pCxt, yymsp[-3].minor.yy80, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-3].minor.yy80 = yylhsminor.yy80; + case 381: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ +#line 691 "sql.y" +{ yylhsminor.yy232 = setStreamOptions(pCxt, yymsp[-3].minor.yy232, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } +#line 6856 "sql.c" + yymsp[-3].minor.yy232 = yylhsminor.yy232; break; - case 381: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 583: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==583); - case 607: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==607); -{ yymsp[-3].minor.yy80 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy80); } + case 383: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 586: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==586); + case 610: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==610); +#line 694 "sql.y" +{ yymsp[-3].minor.yy232 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy232); } +#line 6864 "sql.c" break; - case 384: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 386: /* cmd ::= KILL CONNECTION NK_INTEGER */ +#line 702 "sql.y" { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } +#line 6869 "sql.c" break; - case 385: /* cmd ::= KILL QUERY NK_STRING */ + case 387: /* cmd ::= KILL QUERY NK_STRING */ +#line 703 "sql.y" { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } +#line 6874 "sql.c" break; - case 386: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 388: /* cmd ::= KILL TRANSACTION NK_INTEGER */ +#line 704 "sql.y" { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } +#line 6879 "sql.c" break; - case 387: /* cmd ::= BALANCE VGROUP */ + case 389: /* cmd ::= KILL COMPACT NK_INTEGER */ +#line 705 "sql.y" +{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_COMPACT_STMT, &yymsp[0].minor.yy0); } +#line 6884 "sql.c" + break; + case 390: /* cmd ::= BALANCE VGROUP */ +#line 708 "sql.y" { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } +#line 6889 "sql.c" break; - case 388: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ -{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy785); } + case 391: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ +#line 709 "sql.y" +{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy993); } +#line 6894 "sql.c" break; - case 389: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 392: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ +#line 710 "sql.y" { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 6899 "sql.c" break; - case 390: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy106); } + case 393: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +#line 711 "sql.y" +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy88); } +#line 6904 "sql.c" break; - case 391: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 394: /* cmd ::= SPLIT VGROUP NK_INTEGER */ +#line 712 "sql.y" { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } +#line 6909 "sql.c" break; - case 394: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy106 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + case 397: /* dnode_list ::= DNODE NK_INTEGER */ +#line 721 "sql.y" +{ yymsp[-1].minor.yy88 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 6914 "sql.c" break; - case 396: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy80, yymsp[0].minor.yy80); } + case 399: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +#line 728 "sql.y" +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy232, yymsp[0].minor.yy232); } +#line 6919 "sql.c" break; - case 399: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ -{ yymsp[-6].minor.yy80 = createInsertStmt(pCxt, yymsp[-4].minor.yy80, yymsp[-2].minor.yy106, yymsp[0].minor.yy80); } + case 402: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +#line 737 "sql.y" +{ yymsp[-6].minor.yy232 = createInsertStmt(pCxt, yymsp[-4].minor.yy232, yymsp[-2].minor.yy88, yymsp[0].minor.yy232); } +#line 6924 "sql.c" break; - case 400: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ -{ yymsp[-3].minor.yy80 = createInsertStmt(pCxt, yymsp[-1].minor.yy80, NULL, yymsp[0].minor.yy80); } + case 403: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ +#line 738 "sql.y" +{ yymsp[-3].minor.yy232 = createInsertStmt(pCxt, yymsp[-1].minor.yy232, NULL, yymsp[0].minor.yy232); } +#line 6929 "sql.c" break; - case 401: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 404: /* literal ::= NK_INTEGER */ +#line 741 "sql.y" +{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } +#line 6934 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 402: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 405: /* literal ::= NK_FLOAT */ +#line 742 "sql.y" +{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } +#line 6940 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 403: /* literal ::= NK_STRING */ -{ yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 406: /* literal ::= NK_STRING */ +#line 743 "sql.y" +{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } +#line 6946 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 404: /* literal ::= NK_BOOL */ -{ yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 407: /* literal ::= NK_BOOL */ +#line 744 "sql.y" +{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } +#line 6952 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 405: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy80 = yylhsminor.yy80; + case 408: /* literal ::= TIMESTAMP NK_STRING */ +#line 745 "sql.y" +{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } +#line 6958 "sql.c" + yymsp[-1].minor.yy232 = yylhsminor.yy232; break; - case 406: /* literal ::= duration_literal */ - case 416: /* signed_literal ::= signed */ yytestcase(yyruleno==416); - case 439: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==439); - case 440: /* expression ::= literal */ yytestcase(yyruleno==440); - case 442: /* expression ::= column_reference */ yytestcase(yyruleno==442); - case 443: /* expression ::= function_expression */ yytestcase(yyruleno==443); - case 444: /* expression ::= case_when_expression */ yytestcase(yyruleno==444); - case 477: /* function_expression ::= literal_func */ yytestcase(yyruleno==477); - case 526: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==526); - case 530: /* boolean_primary ::= predicate */ yytestcase(yyruleno==530); - case 532: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==532); - case 533: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==533); - case 536: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==536); - case 538: /* table_reference ::= table_primary */ yytestcase(yyruleno==538); - case 539: /* table_reference ::= joined_table */ yytestcase(yyruleno==539); - case 543: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==543); - case 609: /* query_simple ::= query_specification */ yytestcase(yyruleno==609); - case 610: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==610); - case 613: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==613); - case 615: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==615); -{ yylhsminor.yy80 = yymsp[0].minor.yy80; } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 409: /* literal ::= duration_literal */ + case 419: /* signed_literal ::= signed */ yytestcase(yyruleno==419); + case 442: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==442); + case 443: /* expression ::= literal */ yytestcase(yyruleno==443); + case 445: /* expression ::= column_reference */ yytestcase(yyruleno==445); + case 446: /* expression ::= function_expression */ yytestcase(yyruleno==446); + case 447: /* expression ::= case_when_expression */ yytestcase(yyruleno==447); + case 480: /* function_expression ::= literal_func */ yytestcase(yyruleno==480); + case 529: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==529); + case 533: /* boolean_primary ::= predicate */ yytestcase(yyruleno==533); + case 535: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==535); + case 536: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==536); + case 539: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==539); + case 541: /* table_reference ::= table_primary */ yytestcase(yyruleno==541); + case 542: /* table_reference ::= joined_table */ yytestcase(yyruleno==542); + case 546: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==546); + case 612: /* query_simple ::= query_specification */ yytestcase(yyruleno==612); + case 613: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==613); + case 616: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==616); + case 618: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==618); +#line 746 "sql.y" +{ yylhsminor.yy232 = yymsp[0].minor.yy232; } +#line 6983 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 407: /* literal ::= NULL */ -{ yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 410: /* literal ::= NULL */ +#line 747 "sql.y" +{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } +#line 6989 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 408: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 411: /* literal ::= NK_QUESTION */ +#line 748 "sql.y" +{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 6995 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 409: /* duration_literal ::= NK_VARIABLE */ - case 584: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==584); - case 585: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==585); - case 586: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==586); -{ yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 412: /* duration_literal ::= NK_VARIABLE */ + case 587: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==587); + case 588: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==588); + case 589: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==589); +#line 750 "sql.y" +{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 7004 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 410: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 413: /* signed ::= NK_INTEGER */ +#line 752 "sql.y" +{ yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } +#line 7010 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 411: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + case 414: /* signed ::= NK_PLUS NK_INTEGER */ +#line 753 "sql.y" +{ yymsp[-1].minor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } +#line 7016 "sql.c" break; - case 412: /* signed ::= NK_MINUS NK_INTEGER */ + case 415: /* signed ::= NK_MINUS NK_INTEGER */ +#line 754 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy80 = yylhsminor.yy80; +#line 7025 "sql.c" + yymsp[-1].minor.yy232 = yylhsminor.yy232; break; - case 413: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 416: /* signed ::= NK_FLOAT */ +#line 759 "sql.y" +{ yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } +#line 7031 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 414: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 417: /* signed ::= NK_PLUS NK_FLOAT */ +#line 760 "sql.y" +{ yymsp[-1].minor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } +#line 7037 "sql.c" break; - case 415: /* signed ::= NK_MINUS NK_FLOAT */ + case 418: /* signed ::= NK_MINUS NK_FLOAT */ +#line 761 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy80 = yylhsminor.yy80; +#line 7046 "sql.c" + yymsp[-1].minor.yy232 = yylhsminor.yy232; break; - case 417: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 420: /* signed_literal ::= NK_STRING */ +#line 768 "sql.y" +{ yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +#line 7052 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 418: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 421: /* signed_literal ::= NK_BOOL */ +#line 769 "sql.y" +{ yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } +#line 7058 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 419: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 422: /* signed_literal ::= TIMESTAMP NK_STRING */ +#line 770 "sql.y" +{ yymsp[-1].minor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 7064 "sql.c" break; - case 420: /* signed_literal ::= duration_literal */ - case 422: /* signed_literal ::= literal_func */ yytestcase(yyruleno==422); - case 497: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==497); - case 563: /* select_item ::= common_expression */ yytestcase(yyruleno==563); - case 573: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==573); - case 614: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==614); - case 616: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==616); - case 629: /* search_condition ::= common_expression */ yytestcase(yyruleno==629); -{ yylhsminor.yy80 = releaseRawExprNode(pCxt, yymsp[0].minor.yy80); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 423: /* signed_literal ::= duration_literal */ + case 425: /* signed_literal ::= literal_func */ yytestcase(yyruleno==425); + case 500: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==500); + case 566: /* select_item ::= common_expression */ yytestcase(yyruleno==566); + case 576: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==576); + case 617: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==617); + case 619: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==619); + case 632: /* search_condition ::= common_expression */ yytestcase(yyruleno==632); +#line 771 "sql.y" +{ yylhsminor.yy232 = releaseRawExprNode(pCxt, yymsp[0].minor.yy232); } +#line 7076 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 421: /* signed_literal ::= NULL */ -{ yylhsminor.yy80 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 424: /* signed_literal ::= NULL */ +#line 772 "sql.y" +{ yylhsminor.yy232 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } +#line 7082 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 423: /* signed_literal ::= NK_QUESTION */ -{ yylhsminor.yy80 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 426: /* signed_literal ::= NK_QUESTION */ +#line 774 "sql.y" +{ yylhsminor.yy232 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } +#line 7088 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 441: /* expression ::= pseudo_column */ -{ yylhsminor.yy80 = yymsp[0].minor.yy80; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy80, true); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 444: /* expression ::= pseudo_column */ +#line 836 "sql.y" +{ yylhsminor.yy232 = yymsp[0].minor.yy232; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy232, true); } +#line 7094 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 445: /* expression ::= NK_LP expression NK_RP */ - case 531: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==531); - case 628: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==628); -{ yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy80)); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 448: /* expression ::= NK_LP expression NK_RP */ + case 534: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==534); + case 631: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==631); +#line 840 "sql.y" +{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy232)); } +#line 7102 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 446: /* expression ::= NK_PLUS expr_or_subquery */ + case 449: /* expression ::= NK_PLUS expr_or_subquery */ +#line 841 "sql.y" { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); - yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy80)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); + yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy232)); } - yymsp[-1].minor.yy80 = yylhsminor.yy80; +#line 7111 "sql.c" + yymsp[-1].minor.yy232 = yylhsminor.yy232; break; - case 447: /* expression ::= NK_MINUS expr_or_subquery */ + case 450: /* expression ::= NK_MINUS expr_or_subquery */ +#line 845 "sql.y" { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); - yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy80), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); + yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy232), NULL)); } - yymsp[-1].minor.yy80 = yylhsminor.yy80; +#line 7120 "sql.c" + yymsp[-1].minor.yy232 = yylhsminor.yy232; break; - case 448: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + case 451: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ +#line 849 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); - yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); + yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 7130 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 449: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + case 452: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ +#line 854 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); - yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); + yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 7140 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 450: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + case 453: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ +#line 859 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); - yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); + yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 7150 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 451: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + case 454: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ +#line 864 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); - yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); + yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 7160 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 452: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ + case 455: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ +#line 869 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); - yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); + yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 7170 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 453: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 456: /* expression ::= column_reference NK_ARROW NK_STRING */ +#line 874 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); - yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); + yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 7179 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 454: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + case 457: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ +#line 878 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); - yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); + yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 7189 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 455: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + case 458: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ +#line 883 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); - yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); + yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 7199 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 458: /* column_reference ::= column_name */ -{ yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy785, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy785)); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 461: /* column_reference ::= column_name */ +#line 894 "sql.y" +{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy993, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy993)); } +#line 7205 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 459: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy785, createColumnNode(pCxt, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy785)); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 462: /* column_reference ::= table_name NK_DOT column_name */ +#line 895 "sql.y" +{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy993, createColumnNode(pCxt, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy993)); } +#line 7211 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 460: /* column_reference ::= NK_ALIAS */ -{ yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 463: /* column_reference ::= NK_ALIAS */ +#line 896 "sql.y" +{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } +#line 7217 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 461: /* column_reference ::= table_name NK_DOT NK_ALIAS */ -{ yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 464: /* column_reference ::= table_name NK_DOT NK_ALIAS */ +#line 897 "sql.y" +{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy0)); } +#line 7223 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 462: /* pseudo_column ::= ROWTS */ - case 463: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==463); - case 465: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==465); - case 466: /* pseudo_column ::= QEND */ yytestcase(yyruleno==466); - case 467: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==467); - case 468: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==468); - case 469: /* pseudo_column ::= WEND */ yytestcase(yyruleno==469); - case 470: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==470); - case 471: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==471); - case 472: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==472); - case 473: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==473); - case 479: /* literal_func ::= NOW */ yytestcase(yyruleno==479); -{ yylhsminor.yy80 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 465: /* pseudo_column ::= ROWTS */ + case 466: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==466); + case 468: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==468); + case 469: /* pseudo_column ::= QEND */ yytestcase(yyruleno==469); + case 470: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==470); + case 471: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==471); + case 472: /* pseudo_column ::= WEND */ yytestcase(yyruleno==472); + case 473: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==473); + case 474: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==474); + case 475: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==475); + case 476: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==476); + case 482: /* literal_func ::= NOW */ yytestcase(yyruleno==482); +#line 899 "sql.y" +{ yylhsminor.yy232 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } +#line 7240 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 464: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy785)))); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 467: /* pseudo_column ::= table_name NK_DOT TBNAME */ +#line 901 "sql.y" +{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy993)))); } +#line 7246 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 474: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 475: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==475); -{ yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy785, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy785, yymsp[-1].minor.yy106)); } - yymsp[-3].minor.yy80 = yylhsminor.yy80; + case 477: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 478: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==478); +#line 912 "sql.y" +{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy993, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy993, yymsp[-1].minor.yy88)); } +#line 7253 "sql.c" + yymsp[-3].minor.yy232 = yylhsminor.yy232; break; - case 476: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ -{ yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), yymsp[-1].minor.yy292)); } - yymsp[-5].minor.yy80 = yylhsminor.yy80; + case 479: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ +#line 915 "sql.y" +{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), yymsp[-1].minor.yy400)); } +#line 7259 "sql.c" + yymsp[-5].minor.yy232 = yylhsminor.yy232; break; - case 478: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy785, NULL)); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 481: /* literal_func ::= noarg_func NK_LP NK_RP */ +#line 918 "sql.y" +{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy993, NULL)); } +#line 7265 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 493: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy106 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy106 = yylhsminor.yy106; + case 496: /* star_func_para_list ::= NK_STAR */ +#line 942 "sql.y" +{ yylhsminor.yy88 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } +#line 7271 "sql.c" + yymsp[0].minor.yy88 = yylhsminor.yy88; break; - case 498: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 566: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==566); -{ yylhsminor.yy80 = createColumnNode(pCxt, &yymsp[-2].minor.yy785, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 501: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 569: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==569); +#line 951 "sql.y" +{ yylhsminor.yy232 = createColumnNode(pCxt, &yymsp[-2].minor.yy993, &yymsp[0].minor.yy0); } +#line 7278 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 499: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ -{ yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy106, yymsp[-1].minor.yy80)); } - yymsp[-3].minor.yy80 = yylhsminor.yy80; + case 502: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +#line 954 "sql.y" +{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy88, yymsp[-1].minor.yy232)); } +#line 7284 "sql.c" + yymsp[-3].minor.yy232 = yylhsminor.yy232; break; - case 500: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -{ yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), yymsp[-2].minor.yy106, yymsp[-1].minor.yy80)); } - yymsp[-4].minor.yy80 = yylhsminor.yy80; + case 503: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +#line 956 "sql.y" +{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), yymsp[-2].minor.yy88, yymsp[-1].minor.yy232)); } +#line 7290 "sql.c" + yymsp[-4].minor.yy232 = yylhsminor.yy232; break; - case 503: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -{ yymsp[-3].minor.yy80 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80)); } + case 506: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +#line 963 "sql.y" +{ yymsp[-3].minor.yy232 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232)); } +#line 7296 "sql.c" break; - case 505: /* case_when_else_opt ::= ELSE common_expression */ -{ yymsp[-1].minor.yy80 = releaseRawExprNode(pCxt, yymsp[0].minor.yy80); } + case 508: /* case_when_else_opt ::= ELSE common_expression */ +#line 966 "sql.y" +{ yymsp[-1].minor.yy232 = releaseRawExprNode(pCxt, yymsp[0].minor.yy232); } +#line 7301 "sql.c" break; - case 506: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 511: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==511); + case 509: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 514: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==514); +#line 969 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); - yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy428, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); + yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy708, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 7311 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 507: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + case 510: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ +#line 976 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy80); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); - yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy80), releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy232); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); + yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy232), releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); } - yymsp[-4].minor.yy80 = yylhsminor.yy80; +#line 7321 "sql.c" + yymsp[-4].minor.yy232 = yylhsminor.yy232; break; - case 508: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + case 511: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ +#line 982 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy80); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); - yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy80), releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy232); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); + yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy232), releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); } - yymsp[-5].minor.yy80 = yylhsminor.yy80; +#line 7331 "sql.c" + yymsp[-5].minor.yy232 = yylhsminor.yy232; break; - case 509: /* predicate ::= expr_or_subquery IS NULL */ + case 512: /* predicate ::= expr_or_subquery IS NULL */ +#line 987 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); - yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); + yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), NULL)); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 7340 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 510: /* predicate ::= expr_or_subquery IS NOT NULL */ + case 513: /* predicate ::= expr_or_subquery IS NOT NULL */ +#line 991 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy80); - yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy232); + yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), NULL)); } - yymsp[-3].minor.yy80 = yylhsminor.yy80; +#line 7349 "sql.c" + yymsp[-3].minor.yy232 = yylhsminor.yy232; break; - case 512: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy428 = OP_TYPE_LOWER_THAN; } + case 515: /* compare_op ::= NK_LT */ +#line 1003 "sql.y" +{ yymsp[0].minor.yy708 = OP_TYPE_LOWER_THAN; } +#line 7355 "sql.c" break; - case 513: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy428 = OP_TYPE_GREATER_THAN; } + case 516: /* compare_op ::= NK_GT */ +#line 1004 "sql.y" +{ yymsp[0].minor.yy708 = OP_TYPE_GREATER_THAN; } +#line 7360 "sql.c" break; - case 514: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy428 = OP_TYPE_LOWER_EQUAL; } + case 517: /* compare_op ::= NK_LE */ +#line 1005 "sql.y" +{ yymsp[0].minor.yy708 = OP_TYPE_LOWER_EQUAL; } +#line 7365 "sql.c" break; - case 515: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy428 = OP_TYPE_GREATER_EQUAL; } + case 518: /* compare_op ::= NK_GE */ +#line 1006 "sql.y" +{ yymsp[0].minor.yy708 = OP_TYPE_GREATER_EQUAL; } +#line 7370 "sql.c" break; - case 516: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy428 = OP_TYPE_NOT_EQUAL; } + case 519: /* compare_op ::= NK_NE */ +#line 1007 "sql.y" +{ yymsp[0].minor.yy708 = OP_TYPE_NOT_EQUAL; } +#line 7375 "sql.c" break; - case 517: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy428 = OP_TYPE_EQUAL; } + case 520: /* compare_op ::= NK_EQ */ +#line 1008 "sql.y" +{ yymsp[0].minor.yy708 = OP_TYPE_EQUAL; } +#line 7380 "sql.c" break; - case 518: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy428 = OP_TYPE_LIKE; } + case 521: /* compare_op ::= LIKE */ +#line 1009 "sql.y" +{ yymsp[0].minor.yy708 = OP_TYPE_LIKE; } +#line 7385 "sql.c" break; - case 519: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy428 = OP_TYPE_NOT_LIKE; } + case 522: /* compare_op ::= NOT LIKE */ +#line 1010 "sql.y" +{ yymsp[-1].minor.yy708 = OP_TYPE_NOT_LIKE; } +#line 7390 "sql.c" break; - case 520: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy428 = OP_TYPE_MATCH; } + case 523: /* compare_op ::= MATCH */ +#line 1011 "sql.y" +{ yymsp[0].minor.yy708 = OP_TYPE_MATCH; } +#line 7395 "sql.c" break; - case 521: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy428 = OP_TYPE_NMATCH; } + case 524: /* compare_op ::= NMATCH */ +#line 1012 "sql.y" +{ yymsp[0].minor.yy708 = OP_TYPE_NMATCH; } +#line 7400 "sql.c" break; - case 522: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy428 = OP_TYPE_JSON_CONTAINS; } + case 525: /* compare_op ::= CONTAINS */ +#line 1013 "sql.y" +{ yymsp[0].minor.yy708 = OP_TYPE_JSON_CONTAINS; } +#line 7405 "sql.c" break; - case 523: /* in_op ::= IN */ -{ yymsp[0].minor.yy428 = OP_TYPE_IN; } + case 526: /* in_op ::= IN */ +#line 1017 "sql.y" +{ yymsp[0].minor.yy708 = OP_TYPE_IN; } +#line 7410 "sql.c" break; - case 524: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy428 = OP_TYPE_NOT_IN; } + case 527: /* in_op ::= NOT IN */ +#line 1018 "sql.y" +{ yymsp[-1].minor.yy708 = OP_TYPE_NOT_IN; } +#line 7415 "sql.c" break; - case 525: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -{ yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy106)); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 528: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +#line 1020 "sql.y" +{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy88)); } +#line 7420 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 527: /* boolean_value_expression ::= NOT boolean_primary */ + case 530: /* boolean_value_expression ::= NOT boolean_primary */ +#line 1024 "sql.y" { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); - yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy80), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); + yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy232), NULL)); } - yymsp[-1].minor.yy80 = yylhsminor.yy80; +#line 7429 "sql.c" + yymsp[-1].minor.yy232 = yylhsminor.yy232; break; - case 528: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 531: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ +#line 1029 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); - yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); + yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 7439 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 529: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 532: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ +#line 1035 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy80); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy80); - yylhsminor.yy80 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), releaseRawExprNode(pCxt, yymsp[0].minor.yy80))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy232); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy232); + yylhsminor.yy232 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; +#line 7449 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 537: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy80 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy80, yymsp[0].minor.yy80, NULL); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 540: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +#line 1053 "sql.y" +{ yylhsminor.yy232 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy232, yymsp[0].minor.yy232, NULL); } +#line 7455 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 540: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy80 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy785, &yymsp[0].minor.yy785); } - yymsp[-1].minor.yy80 = yylhsminor.yy80; + case 543: /* table_primary ::= table_name alias_opt */ +#line 1059 "sql.y" +{ yylhsminor.yy232 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy993, &yymsp[0].minor.yy993); } +#line 7461 "sql.c" + yymsp[-1].minor.yy232 = yylhsminor.yy232; break; - case 541: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy80 = createRealTableNode(pCxt, &yymsp[-3].minor.yy785, &yymsp[-1].minor.yy785, &yymsp[0].minor.yy785); } - yymsp[-3].minor.yy80 = yylhsminor.yy80; + case 544: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +#line 1060 "sql.y" +{ yylhsminor.yy232 = createRealTableNode(pCxt, &yymsp[-3].minor.yy993, &yymsp[-1].minor.yy993, &yymsp[0].minor.yy993); } +#line 7467 "sql.c" + yymsp[-3].minor.yy232 = yylhsminor.yy232; break; - case 542: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy80 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy80), &yymsp[0].minor.yy785); } - yymsp[-1].minor.yy80 = yylhsminor.yy80; + case 545: /* table_primary ::= subquery alias_opt */ +#line 1061 "sql.y" +{ yylhsminor.yy232 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy232), &yymsp[0].minor.yy993); } +#line 7473 "sql.c" + yymsp[-1].minor.yy232 = yylhsminor.yy232; break; - case 544: /* alias_opt ::= */ -{ yymsp[1].minor.yy785 = nil_token; } + case 547: /* alias_opt ::= */ +#line 1066 "sql.y" +{ yymsp[1].minor.yy993 = nil_token; } +#line 7479 "sql.c" break; - case 546: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy785 = yymsp[0].minor.yy785; } + case 549: /* alias_opt ::= AS table_alias */ +#line 1068 "sql.y" +{ yymsp[-1].minor.yy993 = yymsp[0].minor.yy993; } +#line 7484 "sql.c" break; - case 547: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 548: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==548); -{ yymsp[-2].minor.yy80 = yymsp[-1].minor.yy80; } + case 550: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 551: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==551); +#line 1070 "sql.y" +{ yymsp[-2].minor.yy232 = yymsp[-1].minor.yy232; } +#line 7490 "sql.c" break; - case 549: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy80 = createJoinTableNode(pCxt, yymsp[-4].minor.yy828, yymsp[-5].minor.yy80, yymsp[-2].minor.yy80, yymsp[0].minor.yy80); } - yymsp[-5].minor.yy80 = yylhsminor.yy80; + case 552: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +#line 1075 "sql.y" +{ yylhsminor.yy232 = createJoinTableNode(pCxt, yymsp[-4].minor.yy436, yymsp[-5].minor.yy232, yymsp[-2].minor.yy232, yymsp[0].minor.yy232); } +#line 7495 "sql.c" + yymsp[-5].minor.yy232 = yylhsminor.yy232; break; - case 550: /* join_type ::= */ -{ yymsp[1].minor.yy828 = JOIN_TYPE_INNER; } + case 553: /* join_type ::= */ +#line 1079 "sql.y" +{ yymsp[1].minor.yy436 = JOIN_TYPE_INNER; } +#line 7501 "sql.c" break; - case 551: /* join_type ::= INNER */ -{ yymsp[0].minor.yy828 = JOIN_TYPE_INNER; } + case 554: /* join_type ::= INNER */ +#line 1080 "sql.y" +{ yymsp[0].minor.yy436 = JOIN_TYPE_INNER; } +#line 7506 "sql.c" break; - case 552: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 555: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_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 1086 "sql.y" { - yymsp[-13].minor.yy80 = createSelectStmt(pCxt, yymsp[-11].minor.yy923, yymsp[-9].minor.yy106, yymsp[-8].minor.yy80, yymsp[-12].minor.yy106); - yymsp[-13].minor.yy80 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy80, yymsp[-10].minor.yy923); - yymsp[-13].minor.yy80 = addWhereClause(pCxt, yymsp[-13].minor.yy80, yymsp[-7].minor.yy80); - yymsp[-13].minor.yy80 = addPartitionByClause(pCxt, yymsp[-13].minor.yy80, yymsp[-6].minor.yy106); - yymsp[-13].minor.yy80 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy80, yymsp[-2].minor.yy80); - yymsp[-13].minor.yy80 = addGroupByClause(pCxt, yymsp[-13].minor.yy80, yymsp[-1].minor.yy106); - yymsp[-13].minor.yy80 = addHavingClause(pCxt, yymsp[-13].minor.yy80, yymsp[0].minor.yy80); - yymsp[-13].minor.yy80 = addRangeClause(pCxt, yymsp[-13].minor.yy80, yymsp[-5].minor.yy80); - yymsp[-13].minor.yy80 = addEveryClause(pCxt, yymsp[-13].minor.yy80, yymsp[-4].minor.yy80); - yymsp[-13].minor.yy80 = addFillClause(pCxt, yymsp[-13].minor.yy80, yymsp[-3].minor.yy80); + yymsp[-13].minor.yy232 = createSelectStmt(pCxt, yymsp[-11].minor.yy985, yymsp[-9].minor.yy88, yymsp[-8].minor.yy232, yymsp[-12].minor.yy88); + yymsp[-13].minor.yy232 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy232, yymsp[-10].minor.yy985); + yymsp[-13].minor.yy232 = addWhereClause(pCxt, yymsp[-13].minor.yy232, yymsp[-7].minor.yy232); + yymsp[-13].minor.yy232 = addPartitionByClause(pCxt, yymsp[-13].minor.yy232, yymsp[-6].minor.yy88); + yymsp[-13].minor.yy232 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy232, yymsp[-2].minor.yy232); + yymsp[-13].minor.yy232 = addGroupByClause(pCxt, yymsp[-13].minor.yy232, yymsp[-1].minor.yy88); + yymsp[-13].minor.yy232 = addHavingClause(pCxt, yymsp[-13].minor.yy232, yymsp[0].minor.yy232); + yymsp[-13].minor.yy232 = addRangeClause(pCxt, yymsp[-13].minor.yy232, yymsp[-5].minor.yy232); + yymsp[-13].minor.yy232 = addEveryClause(pCxt, yymsp[-13].minor.yy232, yymsp[-4].minor.yy232); + yymsp[-13].minor.yy232 = addFillClause(pCxt, yymsp[-13].minor.yy232, yymsp[-3].minor.yy232); } +#line 7522 "sql.c" break; - case 553: /* hint_list ::= */ -{ yymsp[1].minor.yy106 = createHintNodeList(pCxt, NULL); } + case 556: /* hint_list ::= */ +#line 1101 "sql.y" +{ yymsp[1].minor.yy88 = createHintNodeList(pCxt, NULL); } +#line 7527 "sql.c" break; - case 554: /* hint_list ::= NK_HINT */ -{ yylhsminor.yy106 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy106 = yylhsminor.yy106; + case 557: /* hint_list ::= NK_HINT */ +#line 1102 "sql.y" +{ yylhsminor.yy88 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } +#line 7532 "sql.c" + yymsp[0].minor.yy88 = yylhsminor.yy88; break; - case 559: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy923 = false; } + case 562: /* set_quantifier_opt ::= ALL */ +#line 1113 "sql.y" +{ yymsp[0].minor.yy985 = false; } +#line 7538 "sql.c" break; - case 562: /* select_item ::= NK_STAR */ -{ yylhsminor.yy80 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy80 = yylhsminor.yy80; + case 565: /* select_item ::= NK_STAR */ +#line 1120 "sql.y" +{ yylhsminor.yy232 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } +#line 7543 "sql.c" + yymsp[0].minor.yy232 = yylhsminor.yy232; break; - case 564: /* select_item ::= common_expression column_alias */ - case 574: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==574); -{ yylhsminor.yy80 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy80), &yymsp[0].minor.yy785); } - yymsp[-1].minor.yy80 = yylhsminor.yy80; + case 567: /* select_item ::= common_expression column_alias */ + case 577: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==577); +#line 1122 "sql.y" +{ yylhsminor.yy232 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy232), &yymsp[0].minor.yy993); } +#line 7550 "sql.c" + yymsp[-1].minor.yy232 = yylhsminor.yy232; break; - case 565: /* select_item ::= common_expression AS column_alias */ - case 575: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==575); -{ yylhsminor.yy80 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), &yymsp[0].minor.yy785); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 568: /* select_item ::= common_expression AS column_alias */ + case 578: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==578); +#line 1123 "sql.y" +{ yylhsminor.yy232 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), &yymsp[0].minor.yy993); } +#line 7557 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 570: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 598: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==598); - case 618: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==618); -{ yymsp[-2].minor.yy106 = yymsp[0].minor.yy106; } + case 573: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 601: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==601); + case 621: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==621); +#line 1132 "sql.y" +{ yymsp[-2].minor.yy88 = yymsp[0].minor.yy88; } +#line 7565 "sql.c" break; - case 577: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ -{ yymsp[-5].minor.yy80 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), releaseRawExprNode(pCxt, yymsp[-1].minor.yy80)); } + case 580: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ +#line 1145 "sql.y" +{ yymsp[-5].minor.yy232 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), releaseRawExprNode(pCxt, yymsp[-1].minor.yy232)); } +#line 7570 "sql.c" break; - case 578: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -{ yymsp[-3].minor.yy80 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy80)); } + case 581: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +#line 1146 "sql.y" +{ yymsp[-3].minor.yy232 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy232)); } +#line 7575 "sql.c" break; - case 579: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy80 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), NULL, yymsp[-1].minor.yy80, yymsp[0].minor.yy80); } + case 582: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +#line 1148 "sql.y" +{ yymsp[-5].minor.yy232 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), NULL, yymsp[-1].minor.yy232, yymsp[0].minor.yy232); } +#line 7580 "sql.c" break; - case 580: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy80 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy80), releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), yymsp[-1].minor.yy80, yymsp[0].minor.yy80); } + case 583: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +#line 1152 "sql.y" +{ yymsp[-7].minor.yy232 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy232), releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), yymsp[-1].minor.yy232, yymsp[0].minor.yy232); } +#line 7585 "sql.c" break; - case 581: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ -{ yymsp[-6].minor.yy80 = createEventWindowNode(pCxt, yymsp[-3].minor.yy80, yymsp[0].minor.yy80); } + case 584: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ +#line 1154 "sql.y" +{ yymsp[-6].minor.yy232 = createEventWindowNode(pCxt, yymsp[-3].minor.yy232, yymsp[0].minor.yy232); } +#line 7590 "sql.c" break; - case 588: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy80 = createFillNode(pCxt, yymsp[-1].minor.yy36, NULL); } + case 591: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +#line 1164 "sql.y" +{ yymsp[-3].minor.yy232 = createFillNode(pCxt, yymsp[-1].minor.yy246, NULL); } +#line 7595 "sql.c" break; - case 589: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ -{ yymsp[-5].minor.yy80 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy106)); } + case 592: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ +#line 1165 "sql.y" +{ yymsp[-5].minor.yy232 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy88)); } +#line 7600 "sql.c" break; - case 590: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ -{ yymsp[-5].minor.yy80 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy106)); } + case 593: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ +#line 1166 "sql.y" +{ yymsp[-5].minor.yy232 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy88)); } +#line 7605 "sql.c" break; - case 591: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy36 = FILL_MODE_NONE; } + case 594: /* fill_mode ::= NONE */ +#line 1170 "sql.y" +{ yymsp[0].minor.yy246 = FILL_MODE_NONE; } +#line 7610 "sql.c" break; - case 592: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy36 = FILL_MODE_PREV; } + case 595: /* fill_mode ::= PREV */ +#line 1171 "sql.y" +{ yymsp[0].minor.yy246 = FILL_MODE_PREV; } +#line 7615 "sql.c" break; - case 593: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy36 = FILL_MODE_NULL; } + case 596: /* fill_mode ::= NULL */ +#line 1172 "sql.y" +{ yymsp[0].minor.yy246 = FILL_MODE_NULL; } +#line 7620 "sql.c" break; - case 594: /* fill_mode ::= NULL_F */ -{ yymsp[0].minor.yy36 = FILL_MODE_NULL_F; } + case 597: /* fill_mode ::= NULL_F */ +#line 1173 "sql.y" +{ yymsp[0].minor.yy246 = FILL_MODE_NULL_F; } +#line 7625 "sql.c" break; - case 595: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy36 = FILL_MODE_LINEAR; } + case 598: /* fill_mode ::= LINEAR */ +#line 1174 "sql.y" +{ yymsp[0].minor.yy246 = FILL_MODE_LINEAR; } +#line 7630 "sql.c" break; - case 596: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy36 = FILL_MODE_NEXT; } + case 599: /* fill_mode ::= NEXT */ +#line 1175 "sql.y" +{ yymsp[0].minor.yy246 = FILL_MODE_NEXT; } +#line 7635 "sql.c" break; - case 599: /* group_by_list ::= expr_or_subquery */ -{ yylhsminor.yy106 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy80))); } - yymsp[0].minor.yy106 = yylhsminor.yy106; + case 602: /* group_by_list ::= expr_or_subquery */ +#line 1184 "sql.y" +{ yylhsminor.yy88 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); } +#line 7640 "sql.c" + yymsp[0].minor.yy88 = yylhsminor.yy88; break; - case 600: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -{ yylhsminor.yy106 = addNodeToList(pCxt, yymsp[-2].minor.yy106, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy80))); } - yymsp[-2].minor.yy106 = yylhsminor.yy106; + case 603: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +#line 1185 "sql.y" +{ yylhsminor.yy88 = addNodeToList(pCxt, yymsp[-2].minor.yy88, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy232))); } +#line 7646 "sql.c" + yymsp[-2].minor.yy88 = yylhsminor.yy88; break; - case 604: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ -{ yymsp[-5].minor.yy80 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy80), releaseRawExprNode(pCxt, yymsp[-1].minor.yy80)); } + case 607: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +#line 1192 "sql.y" +{ yymsp[-5].minor.yy232 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy232), releaseRawExprNode(pCxt, yymsp[-1].minor.yy232)); } +#line 7652 "sql.c" break; - case 605: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ -{ yymsp[-3].minor.yy80 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy80)); } + case 608: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ +#line 1194 "sql.y" +{ yymsp[-3].minor.yy232 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy232)); } +#line 7657 "sql.c" break; - case 608: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 611: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ +#line 1201 "sql.y" { - yylhsminor.yy80 = addOrderByClause(pCxt, yymsp[-3].minor.yy80, yymsp[-2].minor.yy106); - yylhsminor.yy80 = addSlimitClause(pCxt, yylhsminor.yy80, yymsp[-1].minor.yy80); - yylhsminor.yy80 = addLimitClause(pCxt, yylhsminor.yy80, yymsp[0].minor.yy80); + yylhsminor.yy232 = addOrderByClause(pCxt, yymsp[-3].minor.yy232, yymsp[-2].minor.yy88); + yylhsminor.yy232 = addSlimitClause(pCxt, yylhsminor.yy232, yymsp[-1].minor.yy232); + yylhsminor.yy232 = addLimitClause(pCxt, yylhsminor.yy232, yymsp[0].minor.yy232); } - yymsp[-3].minor.yy80 = yylhsminor.yy80; +#line 7666 "sql.c" + yymsp[-3].minor.yy232 = yylhsminor.yy232; break; - case 611: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -{ yylhsminor.yy80 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy80, yymsp[0].minor.yy80); } - yymsp[-3].minor.yy80 = yylhsminor.yy80; + case 614: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +#line 1211 "sql.y" +{ yylhsminor.yy232 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy232, yymsp[0].minor.yy232); } +#line 7672 "sql.c" + yymsp[-3].minor.yy232 = yylhsminor.yy232; break; - case 612: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -{ yylhsminor.yy80 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy80, yymsp[0].minor.yy80); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 615: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +#line 1213 "sql.y" +{ yylhsminor.yy232 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy232, yymsp[0].minor.yy232); } +#line 7678 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 620: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 624: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==624); -{ yymsp[-1].minor.yy80 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 623: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 627: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==627); +#line 1227 "sql.y" +{ yymsp[-1].minor.yy232 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } +#line 7685 "sql.c" break; - case 621: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 625: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==625); -{ yymsp[-3].minor.yy80 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 624: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 628: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==628); +#line 1228 "sql.y" +{ yymsp[-3].minor.yy232 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } +#line 7691 "sql.c" break; - case 622: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 626: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==626); -{ yymsp[-3].minor.yy80 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 625: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 629: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==629); +#line 1229 "sql.y" +{ yymsp[-3].minor.yy232 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } +#line 7697 "sql.c" break; - case 627: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy80 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy80); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 630: /* subquery ::= NK_LP query_expression NK_RP */ +#line 1237 "sql.y" +{ yylhsminor.yy232 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy232); } +#line 7702 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 632: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy80 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy80), yymsp[-1].minor.yy812, yymsp[0].minor.yy763); } - yymsp[-2].minor.yy80 = yylhsminor.yy80; + case 635: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +#line 1251 "sql.y" +{ yylhsminor.yy232 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy232), yymsp[-1].minor.yy834, yymsp[0].minor.yy153); } +#line 7708 "sql.c" + yymsp[-2].minor.yy232 = yylhsminor.yy232; break; - case 633: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy812 = ORDER_ASC; } + case 636: /* ordering_specification_opt ::= */ +#line 1255 "sql.y" +{ yymsp[1].minor.yy834 = ORDER_ASC; } +#line 7714 "sql.c" break; - case 634: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy812 = ORDER_ASC; } + case 637: /* ordering_specification_opt ::= ASC */ +#line 1256 "sql.y" +{ yymsp[0].minor.yy834 = ORDER_ASC; } +#line 7719 "sql.c" break; - case 635: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy812 = ORDER_DESC; } + case 638: /* ordering_specification_opt ::= DESC */ +#line 1257 "sql.y" +{ yymsp[0].minor.yy834 = ORDER_DESC; } +#line 7724 "sql.c" break; - case 636: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy763 = NULL_ORDER_DEFAULT; } + case 639: /* null_ordering_opt ::= */ +#line 1261 "sql.y" +{ yymsp[1].minor.yy153 = NULL_ORDER_DEFAULT; } +#line 7729 "sql.c" break; - case 637: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy763 = NULL_ORDER_FIRST; } + case 640: /* null_ordering_opt ::= NULLS FIRST */ +#line 1262 "sql.y" +{ yymsp[-1].minor.yy153 = NULL_ORDER_FIRST; } +#line 7734 "sql.c" break; - case 638: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy763 = NULL_ORDER_LAST; } + case 641: /* null_ordering_opt ::= NULLS LAST */ +#line 1263 "sql.y" +{ yymsp[-1].minor.yy153 = NULL_ORDER_LAST; } +#line 7739 "sql.c" break; default: break; @@ -6590,6 +7798,7 @@ 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) { @@ -6600,6 +7809,7 @@ 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 7812 "sql.c" /************ End %syntax_error code ******************************************/ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseCTX_STORE @@ -6685,12 +7895,56 @@ void Parse( } #endif - do{ + while(1){ /* Exit by "break" */ + assert( yypParser->yytos>=yypParser->yystack ); assert( yyact==yypParser->yytos->stateno ); yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact); if( yyact >= YY_MIN_REDUCE ){ - yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor, - yyminor ParseCTX_PARAM); + unsigned int yyruleno = yyact - YY_MIN_REDUCE; /* Reduce by this rule */ +#ifndef NDEBUG + assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ); + if( yyTraceFILE ){ + int yysize = yyRuleInfoNRhs[yyruleno]; + if( yysize ){ + fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n", + yyTracePrompt, + yyruleno, yyRuleName[yyruleno], + yyrulenoyytos[yysize].stateno); + }else{ + fprintf(yyTraceFILE, "%sReduce %d [%s]%s.\n", + yyTracePrompt, yyruleno, yyRuleName[yyruleno], + yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){ + yypParser->yyhwm++; + assert( yypParser->yyhwm == + (int)(yypParser->yytos - yypParser->yystack)); + } +#endif +#if YYSTACKDEPTH>0 + if( yypParser->yytos>=yypParser->yystackEnd ){ + yyStackOverflow(yypParser); + break; + } +#else + if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ + if( yyGrowStack(yypParser) ){ + yyStackOverflow(yypParser); + break; + } + } +#endif + } + yyact = yy_reduce(yypParser,yyruleno,yymajor,yyminor ParseCTX_PARAM); }else if( yyact <= YY_MAX_SHIFTREDUCE ){ yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor); #ifndef YYNOERRORRECOVERY @@ -6746,14 +8000,13 @@ void Parse( yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); yymajor = YYNOCODE; }else{ - while( yypParser->yytos >= yypParser->yystack - && (yyact = yy_find_reduce_action( - yypParser->yytos->stateno, - YYERRORSYMBOL)) > YY_MAX_SHIFTREDUCE - ){ + while( yypParser->yytos > yypParser->yystack ){ + yyact = yy_find_reduce_action(yypParser->yytos->stateno, + YYERRORSYMBOL); + if( yyact<=YY_MAX_SHIFTREDUCE ) break; yy_pop_parser_stack(yypParser); } - if( yypParser->yytos < yypParser->yystack || yymajor==0 ){ + if( yypParser->yytos <= yypParser->yystack || yymajor==0 ){ yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); yy_parse_failed(yypParser); #ifndef YYNOERRORRECOVERY @@ -6803,7 +8056,7 @@ void Parse( break; #endif } - }while( yypParser->yytos>yypParser->yystack ); + } #ifndef NDEBUG if( yyTraceFILE ){ yyStackEntry *i; diff --git a/source/libs/stream/inc/streamBackendRocksdb.h b/source/libs/stream/inc/streamBackendRocksdb.h index bed0f79f02..9bfec5577c 100644 --- a/source/libs/stream/inc/streamBackendRocksdb.h +++ b/source/libs/stream/inc/streamBackendRocksdb.h @@ -79,6 +79,8 @@ typedef struct { TdThreadRwlock chkpDirLock; int64_t dataWritten; + void* pMeta; + } STaskDbWrapper; typedef struct SDbChkp { diff --git a/source/libs/stream/inc/streamInt.h b/source/libs/stream/inc/streamInt.h index 0df36ec391..f709741b57 100644 --- a/source/libs/stream/inc/streamInt.h +++ b/source/libs/stream/inc/streamInt.h @@ -87,10 +87,10 @@ struct SStreamQueue { int8_t status; }; -extern void* streamTimer; -extern int32_t streamBackendId; -extern int32_t streamBackendCfWrapperId; -extern int32_t taskDbWrapperId; +extern void* streamTimer; +extern int32_t streamBackendId; +extern int32_t streamBackendCfWrapperId; +extern int32_t taskDbWrapperId; void streamRetryDispatchData(SStreamTask* pTask, int64_t waitDuration); int32_t streamDispatchStreamBlock(SStreamTask* pTask); @@ -156,6 +156,8 @@ void* streamQueueNextItem(SStreamQueue* pQueue); void streamFreeQitem(SStreamQueueItem* data); int32_t streamQueueGetItemSize(const SStreamQueue* pQueue); +void streamMetaRemoveDB(void* arg, char* key); + typedef enum UPLOAD_TYPE { UPLOAD_DISABLE = -1, UPLOAD_S3 = 0, diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c index 630650025d..5485c13616 100644 --- a/source/libs/stream/src/streamBackendRocksdb.c +++ b/source/libs/stream/src/streamBackendRocksdb.c @@ -982,8 +982,10 @@ int32_t chkpPreBuildDir(char* path, int64_t chkpId, char** chkpDir, char** chkpI } int32_t taskDbBuildSnap(void* arg, SArray* pSnap) { SStreamMeta* pMeta = arg; - void* pIter = taosHashIterate(pMeta->pTaskDbUnique, NULL); - int32_t code = 0; + + taosThreadMutexLock(&pMeta->backendMutex); + void* pIter = taosHashIterate(pMeta->pTaskDbUnique, NULL); + int32_t code = 0; while (pIter) { STaskDbWrapper* pTaskDb = *(STaskDbWrapper**)pIter; @@ -1000,6 +1002,8 @@ int32_t taskDbBuildSnap(void* arg, SArray* pSnap) { taosArrayPush(pSnap, &snap); pIter = taosHashIterate(pMeta->pTaskDbUnique, pIter); } + taosThreadMutexUnlock(&pMeta->backendMutex); + return code; } int32_t streamBackendAddInUseChkp(void* arg, int64_t chkpId) { @@ -1810,6 +1814,10 @@ STaskDbWrapper* taskDbOpen(char* path, char* key, int64_t chkpId) { void taskDbDestroy(void* pDb, bool flush) { STaskDbWrapper* wrapper = pDb; + if (wrapper == NULL) return; + + streamMetaRemoveDB(wrapper->pMeta, wrapper->idstr); + qDebug("succ to destroy stream backend:%p", wrapper); int8_t nCf = sizeof(ginitDict) / sizeof(ginitDict[0]); @@ -2289,12 +2297,14 @@ int streamStateGetCfIdx(SStreamState* pState, const char* funcName) { } } if (pState != NULL && idx != -1) { - STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; - rocksdb_column_family_handle_t* cf = NULL; + STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend; + if (wrapper == NULL) { + return -1; + } taosThreadMutexLock(&wrapper->mutex); - cf = wrapper->pCf[idx]; + rocksdb_column_family_handle_t* cf = wrapper->pCf[idx]; if (cf == NULL) { char* err = NULL; cf = rocksdb_create_column_family(wrapper->db, wrapper->pCfOpts[idx], ginitDict[idx].key, &err); diff --git a/source/libs/stream/src/streamCheckpoint.c b/source/libs/stream/src/streamCheckpoint.c index 9458539a9d..cf0682f037 100644 --- a/source/libs/stream/src/streamCheckpoint.c +++ b/source/libs/stream/src/streamCheckpoint.c @@ -425,6 +425,9 @@ int32_t streamTaskUploadChkp(SStreamTask* pTask, int64_t chkpId, char* taskId) { if (type == UPLOAD_DISABLE) { return 0; } + if (pTask == NULL || pTask->pBackend == NULL) { + return 0; + } SAsyncUploadArg* arg = taosMemoryCalloc(1, sizeof(SAsyncUploadArg)); arg->type = type; arg->taskId = taosStrdup(taskId); diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index 1a67b08749..5fb7db233f 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -720,14 +720,21 @@ int32_t streamTaskSendCheckpointReadyMsg(SStreamTask* pTask) { // this function is only invoked by source task, and send rsp to mnode int32_t streamTaskSendCheckpointSourceRsp(SStreamTask* pTask) { - ASSERT(pTask->info.taskLevel == TASK_LEVEL__SOURCE && taosArrayGetSize(pTask->pReadyMsgList) == 1); - SStreamChkptReadyInfo* pInfo = taosArrayGet(pTask->pReadyMsgList, 0); + taosThreadMutexLock(&pTask->lock); - tmsgSendRsp(&pInfo->msg); + ASSERT(pTask->info.taskLevel == TASK_LEVEL__SOURCE); - taosArrayClear(pTask->pReadyMsgList); - stDebug("s-task:%s level:%d source checkpoint completed msg sent to mnode", pTask->id.idStr, pTask->info.taskLevel); + if (taosArrayGetSize(pTask->pReadyMsgList) == 1) { + SStreamChkptReadyInfo* pInfo = taosArrayGet(pTask->pReadyMsgList, 0); + tmsgSendRsp(&pInfo->msg); + taosArrayClear(pTask->pReadyMsgList); + stDebug("s-task:%s level:%d source checkpoint completed msg sent to mnode", pTask->id.idStr, pTask->info.taskLevel); + } else { + stDebug("s-task:%s level:%d already send rsp to mnode", pTask->id.idStr, pTask->info.taskLevel); + } + + taosThreadMutexUnlock(&pTask->lock); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index 23cb6f5a35..ce391eeadb 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -250,9 +250,11 @@ int32_t streamTaskSetDb(SStreamMeta* pMeta, void* arg, char* key) { taskDbAddRef(*ppBackend); STaskDbWrapper* pBackend = *ppBackend; + pBackend->pMeta = pMeta; pTask->backendRefId = pBackend->refId; pTask->pBackend = pBackend; + taosThreadMutexUnlock(&pMeta->backendMutex); stDebug("s-task:0x%x set backend %p", pTask->id.taskId, pBackend); @@ -260,9 +262,17 @@ int32_t streamTaskSetDb(SStreamMeta* pMeta, void* arg, char* key) { } STaskDbWrapper* pBackend = taskDbOpen(pMeta->path, key, chkpId); - if (pBackend == NULL) { - taosThreadMutexUnlock(&pMeta->backendMutex); - return -1; + while (1) { + if (pBackend == NULL) { + taosThreadMutexUnlock(&pMeta->backendMutex); + taosMsleep(1000); + stDebug("backed holded by other task, restart later, path: %s, key: %s", pMeta->path, key); + } else { + taosThreadMutexUnlock(&pMeta->backendMutex); + break; + } + taosThreadMutexLock(&pMeta->backendMutex); + pBackend = taskDbOpen(pMeta->path, key, chkpId); } int64_t tref = taosAddRef(taskDbWrapperId, pBackend); @@ -270,6 +280,7 @@ int32_t streamTaskSetDb(SStreamMeta* pMeta, void* arg, char* key) { pTask->pBackend = pBackend; pBackend->refId = tref; pBackend->pTask = pTask; + pBackend->pMeta = pMeta; taosHashPut(pMeta->pTaskDbUnique, key, strlen(key), &pBackend, sizeof(void*)); taosThreadMutexUnlock(&pMeta->backendMutex); @@ -277,6 +288,15 @@ int32_t streamTaskSetDb(SStreamMeta* pMeta, void* arg, char* key) { stDebug("s-task:0x%x set backend %p", pTask->id.taskId, pBackend); return 0; } +void streamMetaRemoveDB(void* arg, char* key) { + if (arg == NULL || key == NULL) return; + + SStreamMeta* pMeta = arg; + taosThreadMutexLock(&pMeta->backendMutex); + taosHashRemove(pMeta->pTaskDbUnique, key, strlen(key)); + + taosThreadMutexUnlock(&pMeta->backendMutex); +} SStreamMeta* streamMetaOpen(const char* path, void* ahandle, FTaskExpand expandFunc, int32_t vgId, int64_t stage) { int32_t code = -1; SStreamMeta* pMeta = taosMemoryCalloc(1, sizeof(SStreamMeta)); @@ -794,7 +814,7 @@ static void doClear(void* pKey, void* pVal, TBC* pCur, SArray* pRecycleList) { } int32_t streamMetaLoadAllTasks(SStreamMeta* pMeta) { - TBC* pCur = NULL; + TBC* pCur = NULL; void* pKey = NULL; int32_t kLen = 0; void* pVal = NULL; @@ -995,10 +1015,18 @@ static bool waitForEnoughDuration(SMetaHbInfo* pInfo) { return false; } -static void clearHbMsg(SStreamHbMsg* pMsg, SArray* pIdList) { - taosArrayDestroy(pMsg->pTaskStatus); - taosArrayDestroy(pMsg->pUpdateNodes); - taosArrayDestroy(pIdList); +void streamMetaClearHbMsg(SStreamHbMsg* pMsg) { + if (pMsg == NULL) { + return; + } + + if (pMsg->pUpdateNodes != NULL) { + taosArrayDestroy(pMsg->pUpdateNodes); + } + + if (pMsg->pTaskStatus != NULL) { + taosArrayDestroy(pMsg->pTaskStatus); + } } static bool existInHbMsg(SStreamHbMsg* pMsg, SDownstreamTaskEpset* pTaskEpset) { @@ -1177,7 +1205,8 @@ void metaHbToMnode(void* param, void* tmrId) { } _end: - clearHbMsg(&hbMsg, pIdList); + streamMetaClearHbMsg(&hbMsg); + taosArrayDestroy(pIdList); taosTmrReset(metaHbToMnode, META_HB_CHECK_INTERVAL, param, streamTimer, &pMeta->pHbInfo->hbTmr); taosReleaseRef(streamMetaId, rid); } diff --git a/source/libs/stream/src/streamStart.c b/source/libs/stream/src/streamStart.c index 309f377621..cda5eca612 100644 --- a/source/libs/stream/src/streamStart.c +++ b/source/libs/stream/src/streamStart.c @@ -14,14 +14,14 @@ */ #include "streamInt.h" +#include "streamsm.h" #include "trpc.h" #include "ttimer.h" #include "wal.h" -#include "streamsm.h" -#define SCANHISTORY_IDLE_TIME_SLICE 100 // 100ms -#define SCANHISTORY_MAX_IDLE_TIME 10 // 10 sec -#define SCANHISTORY_IDLE_TICK ((SCANHISTORY_MAX_IDLE_TIME * 1000) / SCANHISTORY_IDLE_TIME_SLICE) +#define SCANHISTORY_IDLE_TIME_SLICE 100 // 100ms +#define SCANHISTORY_MAX_IDLE_TIME 10 // 10 sec +#define SCANHISTORY_IDLE_TICK ((SCANHISTORY_MAX_IDLE_TIME * 1000) / SCANHISTORY_IDLE_TIME_SLICE) typedef struct SLaunchHTaskInfo { SStreamMeta* pMeta; @@ -56,7 +56,7 @@ int32_t streamTaskSetReady(SStreamTask* pTask) { pTask->info.taskLevel != TASK_LEVEL__SOURCE) { pTask->numOfWaitingUpstream = taosArrayGetSize(pTask->upstreamInfo.pList); stDebug("s-task:%s level:%d task wait for %d upstream tasks complete scan-history procedure, status:%s", - pTask->id.idStr, pTask->info.taskLevel, pTask->numOfWaitingUpstream, p); + pTask->id.idStr, pTask->info.taskLevel, pTask->numOfWaitingUpstream, p); } ASSERT(pTask->status.downstreamReady == 0); @@ -77,7 +77,7 @@ int32_t streamStartScanHistoryAsync(SStreamTask* pTask, int8_t igUntreated) { initScanHistoryReq(pTask, &req, igUntreated); int32_t len = sizeof(SStreamScanHistoryReq); - void* serializedReq = rpcMallocCont(len); + void* serializedReq = rpcMallocCont(len); if (serializedReq == NULL) { return -1; } @@ -96,7 +96,7 @@ static void doReExecScanhistory(void* param, void* tmrId) { SStreamTask* pTask = param; pTask->schedHistoryInfo.numOfTicks -= 1; - char* p = NULL; + char* p = NULL; ETaskStatus status = streamTaskGetStatus(pTask, &p); if (status == TASK_STATUS__DROPPING || status == TASK_STATUS__STOP) { streamMetaReleaseTask(pTask->pMeta, pTask); @@ -115,8 +115,7 @@ static void doReExecScanhistory(void* param, void* tmrId) { // release the task. streamMetaReleaseTask(pTask->pMeta, pTask); } else { - taosTmrReset(doReExecScanhistory, SCANHISTORY_IDLE_TIME_SLICE, pTask, streamTimer, - &pTask->schedHistoryInfo.pTimer); + taosTmrReset(doReExecScanhistory, SCANHISTORY_IDLE_TIME_SLICE, pTask, streamTimer, &pTask->schedHistoryInfo.pTimer); } } @@ -135,7 +134,7 @@ int32_t streamReExecScanHistoryFuture(SStreamTask* pTask, int32_t idleDuration) pTask->schedHistoryInfo.numOfTicks = numOfTicks; int32_t ref = atomic_add_fetch_32(&pTask->status.timerActive, 1); - stDebug("s-task:%s scan-history resumed in %.2fs, ref:%d", pTask->id.idStr, numOfTicks*0.1, ref); + stDebug("s-task:%s scan-history resumed in %.2fs, ref:%d", pTask->id.idStr, numOfTicks * 0.1, ref); if (pTask->schedHistoryInfo.pTimer == NULL) { pTask->schedHistoryInfo.pTimer = taosTmrStart(doReExecScanhistory, SCANHISTORY_IDLE_TIME_SLICE, pTask, streamTimer); @@ -158,7 +157,7 @@ static int32_t doStartScanHistoryTask(SStreamTask* pTask) { } int32_t streamTaskStartScanHistory(SStreamTask* pTask) { - int32_t level = pTask->info.taskLevel; + int32_t level = pTask->info.taskLevel; ETaskStatus status = streamTaskGetStatus(pTask, NULL); ASSERT(pTask->status.downstreamReady == 1 && @@ -213,7 +212,7 @@ void streamTaskCheckDownstream(SStreamTask* pTask) { pTask->checkReqIds = taosArrayInit(numOfVgs, sizeof(int64_t)); stDebug("s-task:%s check %d downstream tasks, ver:%" PRId64 "-%" PRId64 " window:%" PRId64 "-%" PRId64, - pTask->id.idStr, numOfVgs, pRange->range.minVer, pRange->range.maxVer, pWindow->skey, pWindow->ekey); + pTask->id.idStr, numOfVgs, pRange->range.minVer, pRange->range.maxVer, pWindow->skey, pWindow->ekey); for (int32_t i = 0; i < numOfVgs; i++) { SVgroupInfo* pVgInfo = taosArrayGet(vgInfo, i); @@ -263,7 +262,7 @@ static void destroyRecheckInfo(STaskRecheckInfo* pInfo) { static void recheckDownstreamTasks(void* param, void* tmrId) { STaskRecheckInfo* pInfo = param; - SStreamTask* pTask = pInfo->pTask; + SStreamTask* pTask = pInfo->pTask; SStreamTaskCheckReq* pReq = &pInfo->req; @@ -290,7 +289,8 @@ static void recheckDownstreamTasks(void* param, void* tmrId) { stDebug("s-task:%s complete send check in timer, ref:%d", pTask->id.idStr, ref); } -int32_t streamTaskCheckStatus(SStreamTask* pTask, int32_t upstreamTaskId, int32_t vgId, int64_t stage, int64_t* oldStage) { +int32_t streamTaskCheckStatus(SStreamTask* pTask, int32_t upstreamTaskId, int32_t vgId, int64_t stage, + int64_t* oldStage) { SStreamChildEpInfo* pInfo = streamTaskGetUpstreamTaskEpInfo(pTask, upstreamTaskId); ASSERT(pInfo != NULL); @@ -330,7 +330,7 @@ int32_t streamTaskOnNormalTaskReady(SStreamTask* pTask) { streamTaskSetReady(pTask); streamTaskSetRangeStreamCalc(pTask); - char* p = NULL; + char* p = NULL; ETaskStatus status = streamTaskGetStatus(pTask, &p); ASSERT(status == TASK_STATUS__READY); @@ -356,7 +356,7 @@ int32_t streamTaskOnScanhistoryTaskReady(SStreamTask* pTask) { streamTaskSetReady(pTask); streamTaskSetRangeStreamCalc(pTask); - char* p = NULL; + char* p = NULL; ETaskStatus status = streamTaskGetStatus(pTask, &p); ASSERT(status == TASK_STATUS__SCAN_HISTORY || status == TASK_STATUS__STREAM_SCAN_HISTORY); @@ -374,7 +374,7 @@ int32_t streamTaskOnScanhistoryTaskReady(SStreamTask* pTask) { void doProcessDownstreamReadyRsp(SStreamTask* pTask) { EStreamTaskEvent event; if (pTask->info.fillHistory == 0) { - event = HAS_RELATED_FILLHISTORY_TASK(pTask)? TASK_EVENT_INIT_STREAM_SCANHIST:TASK_EVENT_INIT; + event = HAS_RELATED_FILLHISTORY_TASK(pTask) ? TASK_EVENT_INIT_STREAM_SCANHIST : TASK_EVENT_INIT; } else { event = TASK_EVENT_INIT_SCANHIST; } @@ -418,8 +418,7 @@ int32_t streamProcessCheckRsp(SStreamTask* pTask, const SStreamTaskCheckRsp* pRs if (pRsp->status == TASK_DOWNSTREAM_READY) { if (pTask->outputInfo.type == TASK_OUTPUT__SHUFFLE_DISPATCH) { - - bool found = false; + bool found = false; int32_t numOfReqs = taosArrayGetSize(pTask->checkReqIds); for (int32_t i = 0; i < numOfReqs; i++) { int64_t reqId = *(int64_t*)taosArrayGet(pTask->checkReqIds, i); @@ -457,10 +456,11 @@ int32_t streamProcessCheckRsp(SStreamTask* pTask, const SStreamTaskCheckRsp* pRs } else { // not ready, wait for 100ms and retry if (pRsp->status == TASK_UPSTREAM_NEW_STAGE || pRsp->status == TASK_DOWNSTREAM_NOT_LEADER) { if (pRsp->status == TASK_UPSTREAM_NEW_STAGE) { - stError( - "s-task:%s vgId:%d self vnode-transfer/leader-change/restart detected, old stage:%"PRId64", current stage:%"PRId64", " - "not check wait for downstream task nodeUpdate, and all tasks restart", - id, pRsp->upstreamNodeId, pRsp->oldStage, pTask->pMeta->stage); + stError("s-task:%s vgId:%d self vnode-transfer/leader-change/restart detected, old stage:%" PRId64 + ", current stage:%" PRId64 + ", " + "not check wait for downstream task nodeUpdate, and all tasks restart", + id, pRsp->upstreamNodeId, pRsp->oldStage, pTask->pMeta->stage); addIntoNodeUpdateList(pTask, pRsp->upstreamNodeId); } else { stError( @@ -476,17 +476,22 @@ int32_t streamProcessCheckRsp(SStreamTask* pTask, const SStreamTaskCheckRsp* pRs // automatically set the related fill-history task to be failed. if (HAS_RELATED_FILLHISTORY_TASK(pTask)) { STaskId* pId = &pTask->hTaskInfo.id; + int64_t current = taosGetTimestampMs(); SStreamTask* pHTask = streamMetaAcquireTask(pTask->pMeta, pId->streamId, pId->taskId); - streamMetaUpdateTaskDownstreamStatus(pHTask->pMeta, pId->streamId, pId->taskId, pHTask->execInfo.init, - taosGetTimestampMs(), false); - streamMetaReleaseTask(pTask->pMeta, pHTask); + if (pHTask != NULL) { + streamMetaUpdateTaskDownstreamStatus(pTask->pMeta, pId->streamId, pId->taskId, pHTask->execInfo.init, current, + false); + streamMetaReleaseTask(pTask->pMeta, pHTask); + } else { + streamMetaUpdateTaskDownstreamStatus(pTask->pMeta, pId->streamId, pId->taskId, 0, current, false); + } } } else { // TASK_DOWNSTREAM_NOT_READY, let's retry in 100ms STaskRecheckInfo* pInfo = createRecheckInfo(pTask, pRsp); int32_t ref = atomic_add_fetch_32(&pTask->status.timerActive, 1); - stDebug("s-task:%s downstream taskId:0x%x (vgId:%d) not ready, stage:%"PRId64", retry in 100ms, ref:%d ", id, + stDebug("s-task:%s downstream taskId:0x%x (vgId:%d) not ready, stage:%" PRId64 ", retry in 100ms, ref:%d ", id, pRsp->downstreamTaskId, pRsp->downstreamNodeId, pRsp->oldStage, ref); pInfo->checkTimer = taosTmrStart(recheckDownstreamTasks, CHECK_DOWNSTREAM_INTERVAL, pInfo, streamTimer); } @@ -496,7 +501,7 @@ int32_t streamProcessCheckRsp(SStreamTask* pTask, const SStreamTaskCheckRsp* pRs } int32_t streamSendCheckRsp(const SStreamMeta* pMeta, const SStreamTaskCheckReq* pReq, SStreamTaskCheckRsp* pRsp, - SRpcHandleInfo *pRpcInfo, int32_t taskId) { + SRpcHandleInfo* pRpcInfo, int32_t taskId) { SEncoder encoder; int32_t code; int32_t len; @@ -533,11 +538,11 @@ int32_t streamRestoreParam(SStreamTask* pTask) { } // source -int32_t streamSetParamForStreamScannerStep1(SStreamTask* pTask, SVersionRange *pVerRange, STimeWindow* pWindow) { +int32_t streamSetParamForStreamScannerStep1(SStreamTask* pTask, SVersionRange* pVerRange, STimeWindow* pWindow) { return qStreamSourceScanParamForHistoryScanStep1(pTask->exec.pExecutor, pVerRange, pWindow); } -int32_t streamSetParamForStreamScannerStep2(SStreamTask* pTask, SVersionRange *pVerRange, STimeWindow* pWindow) { +int32_t streamSetParamForStreamScannerStep2(SStreamTask* pTask, SVersionRange* pVerRange, STimeWindow* pWindow) { return qStreamSourceScanParamForHistoryScanStep2(pTask->exec.pExecutor, pVerRange, pWindow); } @@ -567,7 +572,7 @@ int32_t streamTaskPutTranstateIntoInputQ(SStreamTask* pTask) { pBlock->info.rows = 1; pBlock->info.childId = pTask->info.selfChildId; - pTranstate->blocks = taosArrayInit(4, sizeof(SSDataBlock));//pBlock; + pTranstate->blocks = taosArrayInit(4, sizeof(SSDataBlock)); // pBlock; taosArrayPush(pTranstate->blocks, pBlock); taosMemoryFree(pBlock); @@ -601,8 +606,8 @@ int32_t streamProcessScanHistoryFinishReq(SStreamTask* pTask, SStreamScanHistory ETaskStatus status = streamTaskGetStatus(pTask, &p); if (status != TASK_STATUS__SCAN_HISTORY && status != TASK_STATUS__STREAM_SCAN_HISTORY) { - stError("s-task:%s not in scan-history status, status:%s return upstream:0x%x scan-history finish directly", - id, p, pReq->upstreamTaskId); + stError("s-task:%s not in scan-history status, status:%s return upstream:0x%x scan-history finish directly", id, p, + pReq->upstreamTaskId); void* pBuf = NULL; int32_t len = 0; @@ -612,8 +617,8 @@ int32_t streamProcessScanHistoryFinishReq(SStreamTask* pTask, SStreamScanHistory initRpcMsg(&msg, 0, pBuf, sizeof(SMsgHead) + len); tmsgSendRsp(&msg); - stDebug("s-task:%s level:%d notify upstream:0x%x(vgId:%d) to continue process data in WAL", id, - taskLevel, pReq->upstreamTaskId, pReq->upstreamNodeId); + stDebug("s-task:%s level:%d notify upstream:0x%x(vgId:%d) to continue process data in WAL", id, taskLevel, + pReq->upstreamTaskId, pReq->upstreamNodeId); return 0; } @@ -642,13 +647,13 @@ int32_t streamProcessScanHistoryFinishReq(SStreamTask* pTask, SStreamScanHistory // mnode will not send the pause/resume message to the sink task, so no need to enable the pause for sink tasks. if (taskLevel == TASK_LEVEL__AGG) { - /*int32_t code = */streamTaskScanHistoryDataComplete(pTask); + /*int32_t code = */ streamTaskScanHistoryDataComplete(pTask); } else { // for sink task, set normal streamTaskHandleEvent(pTask->status.pSM, TASK_EVENT_SCANHIST_DONE); } } else { - stDebug("s-task:%s receive scan-history data finish msg from upstream:0x%x(index:%d), unfinished:%d", - id, pReq->upstreamTaskId, pReq->childId, left); + stDebug("s-task:%s receive scan-history data finish msg from upstream:0x%x(index:%d), unfinished:%d", id, + pReq->upstreamTaskId, pReq->childId, left); } return 0; @@ -657,6 +662,11 @@ int32_t streamProcessScanHistoryFinishReq(SStreamTask* pTask, SStreamScanHistory int32_t streamProcessScanHistoryFinishRsp(SStreamTask* pTask) { ETaskStatus status = streamTaskGetStatus(pTask, NULL); + // task restart now, not handle the scan-history finish rsp + if (status == TASK_STATUS__UNINIT) { + return TSDB_CODE_INVALID_MSG; + } + ASSERT(status == TASK_STATUS__SCAN_HISTORY || status == TASK_STATUS__STREAM_SCAN_HISTORY); SStreamMeta* pMeta = pTask->pMeta; @@ -687,9 +697,9 @@ static void checkFillhistoryTaskStatus(SStreamTask* pTask, SStreamTask* pHTask) if (pTask->info.taskLevel == TASK_LEVEL__SOURCE) { stDebug("s-task:%s set the launch condition for fill-history s-task:%s, window:%" PRId64 " - %" PRId64 - " verRange:%" PRId64 " - %" PRId64", init:%"PRId64, - pTask->id.idStr, pHTask->id.idStr, pRange->window.skey, pRange->window.ekey, - pRange->range.minVer, pRange->range.maxVer, pHTask->execInfo.init); + " verRange:%" PRId64 " - %" PRId64 ", init:%" PRId64, + pTask->id.idStr, pHTask->id.idStr, pRange->window.skey, pRange->window.ekey, pRange->range.minVer, + pRange->range.maxVer, pHTask->execInfo.init); } else { stDebug("s-task:%s no fill-history condition for non-source task:%s", pTask->id.idStr, pHTask->id.idStr); } @@ -724,7 +734,6 @@ static void tryLaunchHistoryTask(void* param, void* tmrId) { SStreamTask* pTask = streamMetaAcquireTask(pMeta, pInfo->id.streamId, pInfo->id.taskId); if (pTask != NULL) { - SHistoryTaskInfo* pHTaskInfo = &pTask->hTaskInfo; pHTaskInfo->tickCount -= 1; diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index 276ed08785..776a9db522 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -91,8 +91,8 @@ int stateKeyCmpr(const void* pKey1, int kLen1, const void* pKey2, int kLen2) { } SStreamState* streamStateOpen(char* path, void* pTask, bool specPath, int32_t szPage, int32_t pages) { - stDebug("open stream state, %s", path); SStreamState* pState = taosMemoryCalloc(1, sizeof(SStreamState)); + stDebug("open stream state %p, %s", pState, path); if (pState == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; return NULL; @@ -211,7 +211,7 @@ int32_t streamStateDelTaskDb(SStreamState* pState) { SStreamTask* pTask = pState->pTdbState->pOwner; taskDbRemoveRef(pTask->pBackend); taosMemoryFree(pTask); - return 0; + return 0; } void streamStateClose(SStreamState* pState, bool remove) { SStreamTask* pTask = pState->pTdbState->pOwner; @@ -374,8 +374,8 @@ int32_t streamStateClear(SStreamState* pState) { streamStatePut(pState, &key, NULL, 0); while (1) { SStreamStateCur* pCur = streamStateSeekKeyNext(pState, &key); - SWinKey delKey = {0}; - int32_t code = streamStateGetKVByCur(pCur, &delKey, NULL, 0); + SWinKey delKey = {0}; + int32_t code = streamStateGetKVByCur(pCur, &delKey, NULL, 0); streamStateFreeCur(pCur); if (code == 0) { streamStateDel(pState, &delKey); @@ -493,7 +493,7 @@ int32_t streamStateGetKVByCur(SStreamStateCur* pCur, SWinKey* pKey, const void** return -1; } const SStateKey* pKTmp = NULL; - int32_t kLen; + int32_t kLen; if (tdbTbcGet(pCur->pCur, (const void**)&pKTmp, &kLen, pVal, pVLen) < 0) { return -1; } @@ -513,7 +513,7 @@ int32_t streamStateFillGetKVByCur(SStreamStateCur* pCur, SWinKey* pKey, const vo return -1; } const SWinKey* pKTmp = NULL; - int32_t kLen; + int32_t kLen; if (tdbTbcGet(pCur->pCur, (const void**)&pKTmp, &kLen, pVal, pVLen) < 0) { return -1; } @@ -530,7 +530,7 @@ int32_t streamStateGetGroupKVByCur(SStreamStateCur* pCur, SWinKey* pKey, const v return -1; } uint64_t groupId = pKey->groupId; - int32_t code = streamStateFillGetKVByCur(pCur, pKey, pVal, pVLen); + int32_t code = streamStateFillGetKVByCur(pCur, pKey, pVal, pVLen); if (code == 0) { if (pKey->groupId == groupId) { return 0; @@ -555,7 +555,7 @@ SStreamStateCur* streamStateSeekKeyNext(SStreamState* pState, const SWinKey* key } SStateKey sKey = {.key = *key, .opNum = pState->number}; - int32_t c = 0; + int32_t c = 0; if (tdbTbcMoveTo(pCur->pCur, &sKey, sizeof(SStateKey), &c) < 0) { streamStateFreeCur(pCur); return NULL; @@ -710,7 +710,8 @@ int32_t streamStateSessionPut(SStreamState* pState, const SSessionKey* key, void #endif } -int32_t streamStateSessionAllocWinBuffByNextPosition(SStreamState* pState, SStreamStateCur* pCur, const SSessionKey* pKey, void** pVal, int32_t* pVLen) { +int32_t streamStateSessionAllocWinBuffByNextPosition(SStreamState* pState, SStreamStateCur* pCur, + const SSessionKey* pKey, void** pVal, int32_t* pVLen) { #ifdef USE_ROCKSDB return allocSessioncWinBuffByNextPosition(pState->pFileState, pCur, pKey, pVal, pVLen); #else @@ -724,9 +725,9 @@ int32_t streamStateSessionGet(SStreamState* pState, SSessionKey* key, void** pVa #else SStreamStateCur* pCur = streamStateSessionSeekKeyCurrentNext(pState, key); - SSessionKey resKey = *key; - void* tmp = NULL; - int32_t code = streamStateSessionGetKVByCur(pCur, &resKey, &tmp, pVLen); + SSessionKey resKey = *key; + void* tmp = NULL; + int32_t code = streamStateSessionGetKVByCur(pCur, &resKey, &tmp, pVLen); if (code == 0) { if (key->win.skey != resKey.win.skey) { code = -1; @@ -767,7 +768,7 @@ SStreamStateCur* streamStateSessionSeekKeyCurrentPrev(SStreamState* pState, cons } SStateSessionKey sKey = {.key = *key, .opNum = pState->number}; - int32_t c = 0; + int32_t c = 0; if (tdbTbcMoveTo(pCur->pCur, &sKey, sizeof(SStateSessionKey), &c) < 0) { streamStateFreeCur(pCur); return NULL; @@ -798,7 +799,7 @@ SStreamStateCur* streamStateSessionSeekKeyCurrentNext(SStreamState* pState, cons } SStateSessionKey sKey = {.key = *key, .opNum = pState->number}; - int32_t c = 0; + int32_t c = 0; if (tdbTbcMoveTo(pCur->pCur, &sKey, sizeof(SStateSessionKey), &c) < 0) { streamStateFreeCur(pCur); return NULL; @@ -830,7 +831,7 @@ SStreamStateCur* streamStateSessionSeekKeyNext(SStreamState* pState, const SSess } SStateSessionKey sKey = {.key = *key, .opNum = pState->number}; - int32_t c = 0; + int32_t c = 0; if (tdbTbcMoveTo(pCur->pCur, &sKey, sizeof(SStateSessionKey), &c) < 0) { streamStateFreeCur(pCur); return NULL; @@ -854,7 +855,7 @@ int32_t streamStateSessionGetKVByCur(SStreamStateCur* pCur, SSessionKey* pKey, v return -1; } SStateSessionKey* pKTmp = NULL; - int32_t kLen; + int32_t kLen; if (tdbTbcGet(pCur->pCur, (const void**)&pKTmp, &kLen, (const void**)pVal, pVLen) < 0) { return -1; } @@ -874,13 +875,13 @@ int32_t streamStateSessionClear(SStreamState* pState) { sessionWinStateClear(pState->pFileState); return streamStateSessionClear_rocksdb(pState); #else - SSessionKey key = {.win.skey = 0, .win.ekey = 0, .groupId = 0}; + SSessionKey key = {.win.skey = 0, .win.ekey = 0, .groupId = 0}; SStreamStateCur* pCur = streamStateSessionSeekKeyCurrentNext(pState, &key); while (1) { SSessionKey delKey = {0}; - void* buf = NULL; - int32_t size = 0; - int32_t code = streamStateSessionGetKVByCur(pCur, &delKey, &buf, &size); + void* buf = NULL; + int32_t size = 0; + int32_t code = streamStateSessionGetKVByCur(pCur, &delKey, &buf, &size); if (code == 0 && size > 0) { memset(buf, 0, size); streamStateSessionPut(pState, &delKey, buf, size); @@ -909,14 +910,14 @@ int32_t streamStateSessionGetKeyByRange(SStreamState* pState, const SSessionKey* } SStateSessionKey sKey = {.key = *key, .opNum = pState->number}; - int32_t c = 0; + int32_t c = 0; if (tdbTbcMoveTo(pCur->pCur, &sKey, sizeof(SStateSessionKey), &c) < 0) { streamStateFreeCur(pCur); return -1; } SSessionKey resKey = *key; - int32_t code = streamStateSessionGetKVByCur(pCur, &resKey, NULL, 0); + int32_t code = streamStateSessionGetKVByCur(pCur, &resKey, NULL, 0); if (code == 0 && sessionRangeKeyCmpr(key, &resKey) == 0) { *curKey = resKey; streamStateFreeCur(pCur); @@ -952,19 +953,19 @@ int32_t streamStateSessionAddIfNotExist(SStreamState* pState, SSessionKey* key, return getSessionWinResultBuff(pState->pFileState, key, gap, pVal, pVLen); #else // todo refactor - int32_t res = 0; + int32_t res = 0; SSessionKey originKey = *key; SSessionKey searchKey = *key; searchKey.win.skey = key->win.skey - gap; searchKey.win.ekey = key->win.ekey + gap; int32_t valSize = *pVLen; - void* tmp = tdbRealloc(NULL, valSize); + void* tmp = tdbRealloc(NULL, valSize); if (!tmp) { return -1; } SStreamStateCur* pCur = streamStateSessionSeekKeyCurrentPrev(pState, key); - int32_t code = streamStateSessionGetKVByCur(pCur, key, pVal, pVLen); + int32_t code = streamStateSessionGetKVByCur(pCur, key, pVal, pVLen); if (code == 0) { if (sessionRangeKeyCmpr(&searchKey, key) == 0) { memcpy(tmp, *pVal, valSize); @@ -1007,16 +1008,16 @@ int32_t streamStateStateAddIfNotExist(SStreamState* pState, SSessionKey* key, ch #ifdef USE_ROCKSDB return getStateWinResultBuff(pState->pFileState, key, pKeyData, keyDataLen, fn, pVal, pVLen); #else - int32_t res = 0; + int32_t res = 0; SSessionKey tmpKey = *key; - int32_t valSize = *pVLen; - void* tmp = tdbRealloc(NULL, valSize); + int32_t valSize = *pVLen; + void* tmp = tdbRealloc(NULL, valSize); if (!tmp) { return -1; } SStreamStateCur* pCur = streamStateSessionSeekKeyCurrentPrev(pState, key); - int32_t code = streamStateSessionGetKVByCur(pCur, key, pVal, pVLen); + int32_t code = streamStateSessionGetKVByCur(pCur, key, pVal, pVLen); if (code == 0) { if (key->win.skey <= tmpKey.win.skey && tmpKey.win.ekey <= key->win.ekey) { memcpy(tmp, *pVal, valSize); @@ -1115,6 +1116,20 @@ int32_t streamStateDeleteCheckPoint(SStreamState* pState, TSKEY mark) { void streamStateReloadInfo(SStreamState* pState, TSKEY ts) { streamFileStateReloadInfo(pState->pFileState, ts); } +void streamStateCopyBackend(SStreamState* src, SStreamState* dst) { + dst->pFileState = src->pFileState; + dst->parNameMap = src->parNameMap; + dst->number = src->number; + dst->taskId = src->taskId; + dst->streamId = src->streamId; + if (dst->pTdbState == NULL) { + dst->pTdbState = taosMemoryCalloc(1, sizeof(STdbState)); + dst->pTdbState->pOwner = taosMemoryCalloc(1, sizeof(SStreamTask)); + } + dst->dump = 1; + dst->pTdbState->pOwner->pBackend = src->pTdbState->pOwner->pBackend; + return; +} SStreamStateCur* createStreamStateCursor() { SStreamStateCur* pCur = taosMemoryCalloc(1, sizeof(SStreamStateCur)); pCur->buffIndex = -1; diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index db0217f000..335f9d27d5 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -302,17 +302,25 @@ static void freeUpstreamItem(void* p) { } void tFreeStreamTask(SStreamTask* pTask) { - int32_t taskId = pTask->id.taskId; - + char* p = NULL; + int32_t taskId = pTask->id.taskId; STaskExecStatisInfo* pStatis = &pTask->execInfo; - stDebug("start to free s-task:0x%x, %p, state:%p", taskId, pTask, pTask->pState); + ETaskStatus status1 = TASK_STATUS__UNINIT; + taosThreadMutexLock(&pTask->lock); + if (pTask->status.pSM != NULL) { + status1 = streamTaskGetStatus(pTask, &p); + } + taosThreadMutexUnlock(&pTask->lock); + + stDebug("start to free s-task:0x%x, %p, state:%s", taskId, pTask, p); + + SCheckpointInfo* pCkInfo = &pTask->chkInfo; stDebug("s-task:0x%x task exec summary: create:%" PRId64 ", init:%" PRId64 ", start:%" PRId64 ", updateCount:%d latestUpdate:%" PRId64 ", latestCheckPoint:%" PRId64 ", ver:%" PRId64 " nextProcessVer:%" PRId64 ", checkpointCount:%d", taskId, pStatis->created, pStatis->init, pStatis->start, pStatis->updateCount, pStatis->latestUpdateTs, - pTask->chkInfo.checkpointId, pTask->chkInfo.checkpointVer, pTask->chkInfo.nextProcessVer, - pStatis->checkpoint); + pCkInfo->checkpointId, pCkInfo->checkpointVer, pCkInfo->nextProcessVer, pStatis->checkpoint); // remove the ref by timer while (pTask->status.timerActive > 0) { @@ -335,7 +343,6 @@ void tFreeStreamTask(SStreamTask* pTask) { pTask->msgInfo.pTimer = NULL; } - int32_t status = atomic_load_8((int8_t*)&(pTask->status.taskStatus)); if (pTask->inputq.queue) { streamQueueClose(pTask->inputq.queue, pTask->id.taskId); } @@ -377,9 +384,8 @@ void tFreeStreamTask(SStreamTask* pTask) { if (pTask->pState) { stDebug("s-task:0x%x start to free task state", taskId); - streamStateClose(pTask->pState, status == TASK_STATUS__DROPPING); + streamStateClose(pTask->pState, status1 == TASK_STATUS__DROPPING); taskDbRemoveRef(pTask->pBackend); - } if (pTask->id.idStr != NULL) { @@ -396,7 +402,6 @@ void tFreeStreamTask(SStreamTask* pTask) { } pTask->status.pSM = streamDestroyStateMachine(pTask->status.pSM); - streamTaskDestroyUpstreamInfo(&pTask->upstreamInfo); pTask->msgInfo.pRetryList = taosArrayDestroy(pTask->msgInfo.pRetryList); diff --git a/source/libs/stream/src/streamTaskSm.c b/source/libs/stream/src/streamTaskSm.c index cac3766893..68ae1cce36 100644 --- a/source/libs/stream/src/streamTaskSm.c +++ b/source/libs/stream/src/streamTaskSm.c @@ -56,6 +56,7 @@ static int32_t streamTaskInitStatus(SStreamTask* pTask); static int32_t streamTaskKeepCurrentVerInWal(SStreamTask* pTask); static int32_t initStateTransferTable(); static void doInitStateTransferTable(void); +static int32_t streamTaskSendTransSuccessMsg(SStreamTask* pTask); static STaskStateTrans createStateTransform(ETaskStatus current, ETaskStatus next, EStreamTaskEvent event, __state_trans_fn fn, __state_trans_succ_fn succFn, @@ -87,6 +88,13 @@ static int32_t streamTaskDoCheckpoint(SStreamTask* pTask) { return 0; } +int32_t streamTaskSendTransSuccessMsg(SStreamTask* pTask) { + if (pTask->info.taskLevel == TASK_LEVEL__SOURCE) { + streamTaskSendCheckpointSourceRsp(pTask); + } + return 0; +} + int32_t streamTaskKeepCurrentVerInWal(SStreamTask* pTask) { ASSERT(HAS_RELATED_FILLHISTORY_TASK(pTask)); @@ -551,7 +559,7 @@ void doInitStateTransferTable(void) { taosArrayPush(streamTaskSMTrans, &trans); trans = createStateTransform(TASK_STATUS__PAUSE, TASK_STATUS__DROPPING, TASK_EVENT_DROPPING, NULL, NULL, NULL, true); taosArrayPush(streamTaskSMTrans, &trans); - trans = createStateTransform(TASK_STATUS__CK, TASK_STATUS__DROPPING, TASK_EVENT_DROPPING, NULL, NULL, NULL, true); + trans = createStateTransform(TASK_STATUS__CK, TASK_STATUS__DROPPING, TASK_EVENT_DROPPING, streamTaskSendTransSuccessMsg, NULL, NULL, true); taosArrayPush(streamTaskSMTrans, &trans); trans = createStateTransform(TASK_STATUS__STREAM_SCAN_HISTORY, TASK_STATUS__DROPPING, TASK_EVENT_DROPPING, NULL, NULL, NULL, true); taosArrayPush(streamTaskSMTrans, &trans); diff --git a/source/libs/transport/src/thttp.c b/source/libs/transport/src/thttp.c index 96537a950e..6de10cbb9e 100644 --- a/source/libs/transport/src/thttp.c +++ b/source/libs/transport/src/thttp.c @@ -28,7 +28,7 @@ static int32_t httpRefMgt = 0; static int64_t httpRef = -1; -static int32_t FAST_FAILURE_LIMIT = 120; +static int32_t FAST_FAILURE_LIMIT = 1; typedef struct SHttpModule { uv_loop_t* loop; SAsyncPool* asyncPool; diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index 017969b4e5..362d38b505 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -1498,6 +1498,7 @@ int transSendResponse(const STransMsg* msg) { return 0; } SExHandle* exh = msg->info.handle; + if (exh == NULL) { rpcFreeCont(msg->pCont); return 0; diff --git a/source/os/test/osSystemTests.cpp b/source/os/test/osSystemTests.cpp index dfc92a1b72..86c600f135 100644 --- a/source/os/test/osSystemTests.cpp +++ b/source/os/test/osSystemTests.cpp @@ -38,4 +38,25 @@ TEST(osSystemTest, osSystem1) { #else taosLogTraceToBuf(tmp, sizeof(tmp), 8); #endif + double cpu_engine; + double cpu_system; + float cpu_cores; + int64_t mem_engine; // KB + int64_t mem_system; // KB + + taosGetCpuUsage(&cpu_system, &cpu_engine); + taosGetCpuCores(&cpu_cores, false); + + taosGetProcMemory(&mem_engine); + taosGetSysMemory(&mem_system); + printf("cpu_engine: %f cpu_system: %f\n", cpu_engine, cpu_system); + printf("cpu_cores: %f\n", cpu_cores); + ASSERT_GT(cpu_cores, 0); + ASSERT_GE(mem_engine, 0); + ASSERT_GE(mem_system, 0); + + float numOfCores = 0; + int32_t res = taosGetCpuInfo(tmp, 4096, &numOfCores); + printf("cpu info: %s\n", tmp); + ASSERT_EQ(res, 0); } diff --git a/source/util/src/terror.c b/source/util/src/terror.c index a869af7d5d..dc5f44cf43 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -324,6 +324,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SMA_OPTION, "Invalid sma index opt TAOS_DEFINE_ERROR(TSDB_CODE_MND_VIEW_ALREADY_EXIST, "view already exists in db") TAOS_DEFINE_ERROR(TSDB_CODE_MND_VIEW_NOT_EXIST, "view not exists in db") +//mnode-compact +TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_COMPACT_ID, "Invalid compact id") // dnode TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_OFFLINE, "Dnode is offline") diff --git a/tests/develop-test/2-query/table_count_scan.py b/tests/develop-test/2-query/table_count_scan.py index 758d28948d..40d2e2a887 100644 --- a/tests/develop-test/2-query/table_count_scan.py +++ b/tests/develop-test/2-query/table_count_scan.py @@ -65,7 +65,7 @@ class TDTestCase: tdSql.query('select count(*),db_name, stable_name from information_schema.ins_tables group by db_name, stable_name;') tdSql.checkRows(3) - tdSql.checkData(0, 0, 24) + tdSql.checkData(0, 0, 26) tdSql.checkData(0, 1, 'information_schema') tdSql.checkData(0, 2, None) tdSql.checkData(1, 0, 3) @@ -77,7 +77,7 @@ class TDTestCase: tdSql.query('select count(1) v,db_name, stable_name from information_schema.ins_tables group by db_name, stable_name order by v desc;') tdSql.checkRows(3) - tdSql.checkData(0, 0, 24) + tdSql.checkData(0, 0, 26) tdSql.checkData(0, 1, 'information_schema') tdSql.checkData(0, 2, None) tdSql.checkData(1, 0, 5) @@ -93,7 +93,7 @@ class TDTestCase: tdSql.checkData(1, 1, 'performance_schema') tdSql.checkData(0, 0, 3) tdSql.checkData(0, 1, 'tbl_count') - tdSql.checkData(2, 0, 24) + tdSql.checkData(2, 0, 26) tdSql.checkData(2, 1, 'information_schema') tdSql.query("select count(*) from information_schema.ins_tables where db_name='tbl_count'") @@ -106,7 +106,7 @@ class TDTestCase: tdSql.query('select count(*) from information_schema.ins_tables') tdSql.checkRows(1) - tdSql.checkData(0, 0, 32) + tdSql.checkData(0, 0, 34) tdSql.execute('create table stba (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 float, c7 double, c8 binary(10), c9 nchar(10), c10 tinyint unsigned, c11 smallint unsigned, c12 int unsigned, c13 bigint unsigned) TAGS(t1 int, t2 binary(10), t3 double);') @@ -189,7 +189,7 @@ class TDTestCase: tdSql.checkData(2, 0, 5) tdSql.checkData(2, 1, 'performance_schema') tdSql.checkData(2, 2, None) - tdSql.checkData(3, 0, 24) + tdSql.checkData(3, 0, 26) tdSql.checkData(3, 1, 'information_schema') tdSql.checkData(3, 2, None) @@ -204,7 +204,7 @@ class TDTestCase: tdSql.checkData(2, 0, 5) tdSql.checkData(2, 1, 'performance_schema') tdSql.checkData(2, 2, None) - tdSql.checkData(3, 0, 24) + tdSql.checkData(3, 0, 26) tdSql.checkData(3, 1, 'information_schema') tdSql.checkData(3, 2, None) @@ -215,7 +215,7 @@ class TDTestCase: tdSql.checkData(0, 1, 'tbl_count') tdSql.checkData(1, 0, 5) tdSql.checkData(1, 1, 'performance_schema') - tdSql.checkData(2, 0, 24) + tdSql.checkData(2, 0, 26) tdSql.checkData(2, 1, 'information_schema') tdSql.query("select count(*) from information_schema.ins_tables where db_name='tbl_count'") @@ -228,7 +228,7 @@ class TDTestCase: tdSql.query('select count(*) from information_schema.ins_tables') tdSql.checkRows(1) - tdSql.checkData(0, 0, 33) + tdSql.checkData(0, 0, 35) tdSql.execute('drop database tbl_count') diff --git a/tests/docs-examples-test/csharp.sh b/tests/docs-examples-test/csharp.sh index c08ffd6d62..9d7867d829 100644 --- a/tests/docs-examples-test/csharp.sh +++ b/tests/docs-examples-test/csharp.sh @@ -11,10 +11,9 @@ dotnet run --project connect/connect.csproj taos -s "drop database if exists power" dotnet run --project sqlInsert/sqlinsert.csproj dotnet run --project query/query.csproj -dotnet run --project asyncQuery/asyncquery.csproj -dotnet run --project subscribe/subscribe.csproj +#dotnet run --project subscribe/subscribe.csproj -taos -s "drop topic if exists topic_example" +#taos -s "drop topic if exists topic_example" taos -s "drop database if exists power" dotnet run --project stmtInsert/stmtinsert.csproj @@ -28,10 +27,12 @@ taos -s "drop database if exists test" dotnet run --project optsJSON/optsJSON.csproj taos -s "create database if not exists test" +taos -s "drop database if exists power" dotnet run --project wsConnect/wsConnect.csproj dotnet run --project wsInsert/wsInsert.csproj -dotnet run --project wsStmt/wsStmt.csproj dotnet run --project wsQuery/wsQuery.csproj +taos -s "drop database if exists power" +dotnet run --project wsStmt/wsStmt.csproj taos -s "drop database if exists test" taos -s "drop database if exists power" diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index d0961830e4..8edfb352ab 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -26,7 +26,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 8-stream/pause_resume_test.py #,,n,system-test,python3 ./test.py -f 8-stream/vnode_restart.py -N 4 #,,n,system-test,python3 ./test.py -f 8-stream/snode_restart.py -N 4 -#,,n,system-test,python3 ./test.py -f 8-stream/snode_restart_with_checkpoint.py -N 4 +,,n,system-test,python3 ./test.py -f 8-stream/snode_restart_with_checkpoint.py -N 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tbname_vgroup.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/stbJoin.py @@ -243,6 +243,7 @@ e ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/compress_tsz1.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/compress_tsz2.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/view/non_marterial_view/test_view.py +,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/test_show_table_distributed.py ,,n,system-test,python3 ./test.py -f 0-others/compatibility.py ,,n,system-test,python3 ./test.py -f 0-others/tag_index_basic.py ,,n,system-test,python3 ./test.py -f 0-others/udfpy_main.py diff --git a/tests/script/tsim/query/sys_tbname.sim b/tests/script/tsim/query/sys_tbname.sim index f49a8e0a7d..8bf0fb4700 100644 --- a/tests/script/tsim/query/sys_tbname.sim +++ b/tests/script/tsim/query/sys_tbname.sim @@ -58,7 +58,7 @@ endi sql select tbname from information_schema.ins_tables; print $rows $data00 -if $rows != 33 then +if $rows != 35 then return -1 endi if $data00 != @ins_tables@ then diff --git a/tests/script/tsim/query/tableCount.sim b/tests/script/tsim/query/tableCount.sim index 6e65852dcc..315a39e56d 100644 --- a/tests/script/tsim/query/tableCount.sim +++ b/tests/script/tsim/query/tableCount.sim @@ -53,7 +53,7 @@ sql select stable_name,count(table_name) from information_schema.ins_tables grou if $rows != 3 then return -1 endi -if $data01 != 30 then +if $data01 != 32 then return -1 endi if $data11 != 10 then @@ -72,7 +72,7 @@ endi if $data11 != 5 then return -1 endi -if $data21 != 24 then +if $data21 != 26 then return -1 endi if $data31 != 5 then @@ -97,7 +97,7 @@ endi if $data42 != 3 then return -1 endi -if $data52 != 24 then +if $data52 != 26 then return -1 endi if $data62 != 5 then diff --git a/tests/script/tsim/stream/basic4.sim b/tests/script/tsim/stream/basic4.sim index b4e3d62545..d2bf321ad5 100644 --- a/tests/script/tsim/stream/basic4.sim +++ b/tests/script/tsim/stream/basic4.sim @@ -80,6 +80,7 @@ sql use test2; 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 stream streams2 trigger at_once ignore expired 0 ignore update 0 waterMark 200s into streamt2 as select _wstart, count(*) c1 from t1 interval(1s); +sleep 1000 sql insert into t1 values(1648791211000,1,2,3,1.0); sql insert into t1 values(1648791212001,2,2,3,1.1); diff --git a/tests/system-test/0-others/information_schema.py b/tests/system-test/0-others/information_schema.py index 2bfe33d0af..20305bf4c1 100644 --- a/tests/system-test/0-others/information_schema.py +++ b/tests/system-test/0-others/information_schema.py @@ -57,7 +57,8 @@ class TDTestCase: self.nchar_str = '涛思数据' self.ins_list = ['ins_dnodes','ins_mnodes','ins_qnodes','ins_snodes','ins_cluster','ins_databases','ins_functions',\ 'ins_indexes','ins_stables','ins_tables','ins_tags','ins_columns','ins_users','ins_grants','ins_vgroups','ins_configs','ins_dnode_variables',\ - 'ins_topics','ins_subscriptions','ins_streams','ins_stream_tasks','ins_vnodes','ins_user_privileges','ins_views'] + 'ins_topics','ins_subscriptions','ins_streams','ins_stream_tasks','ins_vnodes','ins_user_privileges','ins_views', + 'ins_compacts', 'ins_compact_details'] self.perf_list = ['perf_connections','perf_queries','perf_consumers','perf_trans','perf_apps'] def insert_data(self,column_dict,tbname,row_num): insert_sql = self.setsql.set_insertsql(column_dict,tbname,self.binary_str,self.nchar_str) @@ -217,7 +218,7 @@ class TDTestCase: tdSql.checkEqual(20470,len(tdSql.queryResult)) tdSql.query("select * from information_schema.ins_columns where db_name ='information_schema'") - tdSql.checkEqual(210, len(tdSql.queryResult)) + tdSql.checkEqual(219, len(tdSql.queryResult)) tdSql.query("select * from information_schema.ins_columns where db_name ='performance_schema'") tdSql.checkEqual(54, len(tdSql.queryResult)) diff --git a/tests/system-test/0-others/test_show_table_distributed.py b/tests/system-test/0-others/test_show_table_distributed.py new file mode 100644 index 0000000000..c414f8ba88 --- /dev/null +++ b/tests/system-test/0-others/test_show_table_distributed.py @@ -0,0 +1,77 @@ +from itertools import product +import taos +import random +import time +from taos.tmq import * +from util.cases import * +from util.common import * +from util.log import * +from util.sql import * +from util.sqlset import * + + +class TDTestCase: + """This test case is used to veirfy show table distributed command""" + + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug("start to execute %s" % __file__) + # init the tdsql + tdSql.init(conn.cursor()) + self.dbname = "distributed_db" + self.stname = "st" + self.ctnum = 1 + self.row_num = 99 + + # create database + tdSql.execute(f'create database if not exists {self.dbname};') + tdSql.execute(f'use {self.dbname};') + # create super table + tdSql.execute(f'create table {self.dbname}.{self.stname} (ts timestamp, id int, temperature float) tags (name binary(20));') + # create child table + for i in range(self.ctnum): + tdSql.execute(f'create table ct_{str(i+1)} using {self.stname} tags ("name{str(i+1)}");') + # insert data + sql = f"insert into ct_{str(i+1)} values " + for j in range(self.row_num): + sql += f"(now+{j+1}s, {j+1}, {random.uniform(15, 30)}) " + sql += ";" + tdSql.execute(sql) + tdLog.debug("init finished") + + def checkRes(self, queryRes): + mem_rows_num = 0 + stt_rows_num = 0 + for item in queryRes: + if "Inmem_Rows=" in item[0]: + mem_rows_num = int(item[0].split("=")[1].split(" ")[0].replace("[", "").replace("]", "")) + tdLog.debug("mem_rows_num: %s" % mem_rows_num) + if "Stt_Rows=" in item[0]: + stt_rows_num = int(item[0].split("=")[2].replace("[", "").replace("]", "")) + tdLog.debug("stt_rows_num: %s" % stt_rows_num) + return mem_rows_num, stt_rows_num + + def run(self): + tdSql.query(f"show table distributed {self.stname};") + tdLog.debug(tdSql.queryResult) + mem_rows_num, stt_rows_num = self.checkRes(tdSql.queryResult) + tdLog.debug("mem_rows_num: %s, stt_rows_num: %s" % (mem_rows_num, stt_rows_num)) + assert(99 == mem_rows_num and 0 == stt_rows_num) + + tdSql.execute(f"flush database {self.dbname};") + time.sleep(1) + tdSql.query(f"show table distributed {self.stname};") + tdLog.debug(tdSql.queryResult) + mem_rows_num, stt_rows_num = self.checkRes(tdSql.queryResult) + tdLog.debug("mem_rows_num: %s, stt_rows_num: %s" % (mem_rows_num, stt_rows_num)) + assert(0 == mem_rows_num and 99 == stt_rows_num) + + def stop(self): + # remove the user + tdSql.execute(f'drop database {self.dbname};') + # close the connection + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/system-test/1-insert/db_tb_name_check.py b/tests/system-test/1-insert/db_tb_name_check.py index fa43603e25..e217bbe183 100644 --- a/tests/system-test/1-insert/db_tb_name_check.py +++ b/tests/system-test/1-insert/db_tb_name_check.py @@ -76,7 +76,8 @@ class TDTestCase: new_tbname = ''.join(tbname1) for sql in [f'`{dbname}`.`{new_tbname}`',f'`{new_tbname}`']: tdSql.error(f'create table {sql} (ts timestamp,c0 int)') - tdSql.execute(f'drop database `{dbname}`') + tdSql.execute(f'trim database `{dbname}`') + tdSql.execute(f'drop database `{dbname}`') def run(self): self.db_name_check() self.tb_name_check() diff --git a/tests/system-test/1-insert/delete_stable.py b/tests/system-test/1-insert/delete_stable.py index 67561c51e5..bff6548517 100644 --- a/tests/system-test/1-insert/delete_stable.py +++ b/tests/system-test/1-insert/delete_stable.py @@ -24,7 +24,7 @@ from util.common import * from util.sqlset import TDSetSql class TDTestCase: - updatecfgDict = {'tsdbdebugFlag': 143} + updatecfgDict = {'tsdbdebugFlag': 131} def init(self, conn, logSql, replicaVar=1): self.replicaVar = int(replicaVar) tdLog.debug("start to execute %s" % __file__) @@ -36,7 +36,7 @@ class TDTestCase: self.setsql = TDSetSql() self.stbname = 'stb' self.ntbname = 'ntb' - self.rowNum = 10 + self.rowNum = 3 self.tbnum = 3 self.ts = 1537146000000 self.binary_str = 'taosdata' diff --git a/tests/system-test/8-stream/stream_basic.py b/tests/system-test/8-stream/stream_basic.py index 7f4d1d5ee3..e838950bb8 100644 --- a/tests/system-test/8-stream/stream_basic.py +++ b/tests/system-test/8-stream/stream_basic.py @@ -91,6 +91,8 @@ class TDTestCase: tdLog.info("loop wait result ...") tdSql.checkDataLoop(0, 0, 99999, sql, loopCount=120, waitTime=0.5) + time.sleep(5) + # check all data is correct sql = "select * from sta where cnt != 20;" tdSql.query(sql) diff --git a/utils/test/c/tmqSim.c b/utils/test/c/tmqSim.c index 14e30008fe..006bd516d0 100644 --- a/utils/test/c/tmqSim.c +++ b/utils/test/c/tmqSim.c @@ -906,6 +906,7 @@ void* consumeThreadFunc(void* param) { pPrint("tmq_commit() manual commit when consume end.\n"); /*tmq_commit(pInfo->tmq, NULL, 0);*/ tmq_commit_sync(pInfo->tmq, NULL); + tmq_commit_cb_print(pInfo->tmq, 0, pInfo); taosFprintfFile(g_fp, "tmq_commit() manual commit over.\n"); pPrint("tmq_commit() manual commit over.\n"); }