diff --git a/Jenkinsfile2 b/Jenkinsfile2 index c41e739bd3..165d203a22 100644 --- a/Jenkinsfile2 +++ b/Jenkinsfile2 @@ -314,9 +314,9 @@ def pre_test_build_win() { cd %WIN_CONNECTOR_ROOT% python.exe -m pip install --upgrade pip python -m pip uninstall taospy -y - python -m pip install taospy==2.7.10 + python -m pip install taospy==2.7.12 python -m pip uninstall taos-ws-py -y - python -m pip install taos-ws-py==0.2.8 + python -m pip install taos-ws-py==0.2.9 xcopy /e/y/i/f %WIN_INTERNAL_ROOT%\\debug\\build\\lib\\taos.dll C:\\Windows\\System32 ''' return 1 diff --git a/docs/en/07-develop/07-tmq.mdx b/docs/en/07-develop/07-tmq.mdx index 42a9f3af5a..f833dbf439 100644 --- a/docs/en/07-develop/07-tmq.mdx +++ b/docs/en/07-develop/07-tmq.mdx @@ -23,20 +23,30 @@ 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. -Tips:(c interface for example) -1. A consumption group consumes all data under the same topic, and different consumption groups are independent of each other; -2. 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; -3. 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; -4. Each poll server will return a result block, which belongs to a vgroup and may contain data from multiple versions of wal. This block can be accessed through tmq_get_vgroup_offset. The offset interface obtains the offset of the first record in the block; -5. If a consumer group has never committed an offset, when its member consumers restart and pull data again, they start consuming from the set value of the parameter auto.offset.reset; In a consumer lifecycle, the client locally records the offset of the most recent pull data and will not pull duplicate data; -6. If a consumer terminates abnormally (without calling tmq_close), they need to wait for about 12 seconds to trigger their consumer group rebalance. The consumer's status on the server will change to LOST, and after about 1 day, the consumer will be automatically deleted; Exit normally, and after exiting, the consumer will be deleted; Add a new consumer, wait for about 2 seconds to trigger Rebalance, and the consumer's status on the server will change to ready; -7. The consumer group Rebalance will reassign Vgroups to all consumer members in the ready state of the group, and consumers can only assign/see/commit/poll operations to the Vgroups they are responsible for; -8. Consumers can tmq_position to obtain the offset of the current consumption, seek to the specified offset, and consume again; -9. Seek points the position to the specified offset without executing the commit operation. Once the seek is successful, it can poll the specified offset and subsequent data; -10. Before the seek operation, tmq must be call tmq_get_topic_assignment, The assignment interface obtains the vgroup ID and offset range of the consumer. The seek operation will detect whether the vgroup ID and offset are legal, and if they are illegal, an error will be reported; -11. Due to the existence of a WAL expiration deletion mechanism, even if the seek operation is successful, it is possible that the offset has expired when polling data. If the offset of poll is less than the WAL minimum version number, it will be consumed from the WAL minimum version number; -12. The tmq_get_vgroup_offset interface obtains the offset of the first data in the result block where the record is located. When seeking to this offset, it will consume all the data in this block. Refer to point four; -13. Data subscription is to consume data from the wal. If some wal files are deleted according to WAL retention policy, the deleted data can't be consumed any more. So you need to set a reasonable value for parameter `WAL_RETENTION_PERIOD` or `WAL_RETENTION_SIZE` when creating the database and make sure your application consume the data in a timely way to make sure there is no data loss. This behavior is similar to Kafka and other widely used message queue products. +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. +- 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; +- Each poll server will return a result block, which belongs to a vgroup and may contain data from multiple versions of wal. This block can be accessed through offset interface. The offset interface obtains the offset of the first record in the block; +- If a consumer group has never committed an offset, when its member consumers restart and pull data again, they start consuming from the set value of the parameter auto.offset.reset; In a consumer lifecycle, the client locally records the offset of the most recent pull data and will not pull duplicate data; +- If a consumer terminates abnormally (without calling tmq_close), they need to wait for about 12 seconds to trigger their consumer group rebalance. The consumer's status on the server will change to LOST, and after about 1 day, the consumer will be automatically deleted; Exit normally, and after exiting, the consumer will be deleted; Add a new consumer, wait for about 2 seconds to trigger Rebalance, and the consumer's status on the server will change to ready; +- The consumer group Rebalance will reassign Vgroups to all consumer members in the ready state of the group, and consumers can only assign/see/commit/poll operations to the Vgroups they are responsible for; +- Consumers can call position interface to obtain the offset of the current consumption, seek to the specified offset, and consume again; +- Seek points the position to the specified offset without executing the commit operation. Once the seek is successful, it can poll the specified offset and subsequent data; +- Position is to obtain the current consumption position, which is the position to be taken next time, not the current consumption position +- Commit is the submission of the consumption location. Without parameters, it is the submission of the current consumption location (the location to be taken next time, not the current consumption location). With parameters, it is the location in the submission parameters (i.e. the location to be taken after the next exit and restart) +- Seek is to set the consumer's consumption position. Wherever the seek goes, the position will be returned, all of which are the positions to be taken next time +- Seek does not affect commit, commit does not affect seek, independent of each other, the two are different concepts +- The begin interface is the offset of the first data in wal, and the end interface is the offset+1 of the last data in wal10. +- Before the seek operation, tmq must be call assignment interface, The assignment interface obtains the vgroup ID and offset range of the consumer. The seek operation will detect whether the vgroup ID and offset are legal, and if they are illegal, an error will be reported; +- Due to the existence of a WAL expiration deletion mechanism, even if the seek operation is successful, it is possible that the offset has expired when polling data. If the offset of poll is less than the WAL minimum version number, it will be consumed from the WAL minimum version number; +- The offset interface obtains the offset of the first data in the result block where the record is located. When seeking to this offset, it will consume all the data in this block. Refer to point four; +- Data subscription is to consume data from the wal. If some wal files are deleted according to WAL retention policy, the deleted data can't be consumed any more. So you need to set a reasonable value for parameter `WAL_RETENTION_PERIOD` or `WAL_RETENTION_SIZE` when creating the database and make sure your application consume the data in a timely way to make sure there is no data loss. This behavior is similar to Kafka and other widely used message queue products. + +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. + +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 diff --git a/docs/en/14-reference/03-connector/04-java.mdx b/docs/en/14-reference/03-connector/04-java.mdx index 7e580a52d4..85bc67d0fd 100644 --- a/docs/en/14-reference/03-connector/04-java.mdx +++ b/docs/en/14-reference/03-connector/04-java.mdx @@ -142,8 +142,15 @@ TDengine currently supports timestamp, number, character, Boolean type, and the | BINARY | byte array | | NCHAR | java.lang.String | | JSON | java.lang.String | +| VARBINARY | byte[] | +| GEOMETRY | byte[] | **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] (/tao-sql/data-type/#Data Types) +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 @@ -354,7 +361,7 @@ The configuration parameters in properties are as follows. - TSDBDriver.PROPERTY_KEY_CONFIG_DIR: only works when using JDBC native connection. Client configuration file directory path, default value `/etc/taos` on Linux OS, default value `C:/TDengine/cfg` on Windows OS, default value `/etc/taos` on macOS. - TSDBDriver.PROPERTY_KEY_CHARSET: In the character set used by the client, the default value is the system character set. - TSDBDriver.PROPERTY_KEY_LOCALE: this only takes effect when using JDBC native connection. Client language environment, the default value is system current locale. -- TSDBDriver.PROPERTY_KEY_TIME_ZONE: only takes effect when using JDBC native connection. In the time zone used by the client, the default value is the system's current time zone. +- TSDBDriver.PROPERTY_KEY_TIME_ZONE: only takes effect when using JDBC native connection. In the time zone used by the client, the default value is the system's current time zone. Due to historical reasons, we only support some specifications of the POSIX standard, such as UTC-8 (representing timezone Shanghai in China), GMT-7, Europe/Paris. - TSDBDriver.HTTP_CONNECT_TIMEOUT: REST connection timeout in milliseconds, the default value is 60000 ms. It only takes effect when using JDBC REST connection. - TSDBDriver.HTTP_SOCKET_TIMEOUT: socket timeout in milliseconds, the default value is 60000 ms. It only takes effect when using JDBC REST connection and batchfetch is false. - 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. @@ -456,13 +463,15 @@ public class ParameterBindingDemo { private static final String host = "127.0.0.1"; private static final Random random = new Random(System.currentTimeMillis()); - private static final int BINARY_COLUMN_SIZE = 20; + private static final int BINARY_COLUMN_SIZE = 50; private static final String[] schemaList = { "create table stable1(ts timestamp, f1 tinyint, f2 smallint, f3 int, f4 bigint) tags(t1 tinyint, t2 smallint, t3 int, t4 bigint)", "create table stable2(ts timestamp, f1 float, f2 double) tags(t1 float, t2 double)", "create table stable3(ts timestamp, f1 bool) tags(t1 bool)", "create table stable4(ts timestamp, f1 binary(" + BINARY_COLUMN_SIZE + ")) tags(t1 binary(" + BINARY_COLUMN_SIZE + "))", - "create table stable5(ts timestamp, f1 nchar(" + BINARY_COLUMN_SIZE + ")) tags(t1 nchar(" + BINARY_COLUMN_SIZE + "))" + "create table stable5(ts timestamp, f1 nchar(" + BINARY_COLUMN_SIZE + ")) tags(t1 nchar(" + BINARY_COLUMN_SIZE + "))", + "create table stable6(ts timestamp, f1 varbinary(" + BINARY_COLUMN_SIZE + ")) tags(t1 varbinary(" + BINARY_COLUMN_SIZE + "))", + "create table stable7(ts timestamp, f1 geometry(" + BINARY_COLUMN_SIZE + ")) tags(t1 geometry(" + BINARY_COLUMN_SIZE + "))", }; private static final int numOfSubTable = 10, numOfRow = 10; @@ -474,21 +483,20 @@ public class ParameterBindingDemo { init(conn); bindInteger(conn); - bindFloat(conn); - bindBoolean(conn); - bindBytes(conn); - bindString(conn); + bindVarbinary(conn); + bindGeometry(conn); + clean(conn); conn.close(); } private static void init(Connection conn) throws SQLException { + clean(conn); try (Statement stmt = conn.createStatement()) { - stmt.execute("drop database if exists test_parabind"); stmt.execute("create database if not exists test_parabind"); stmt.execute("use test_parabind"); for (int i = 0; i < schemaList.length; i++) { @@ -496,6 +504,11 @@ public class ParameterBindingDemo { } } } + private static void clean(Connection conn) throws SQLException { + try (Statement stmt = conn.createStatement()) { + stmt.execute("drop database if exists test_parabind"); + } + } private static void bindInteger(Connection conn) throws SQLException { String sql = "insert into ? using stable1 tags(?,?,?,?) values(?,?,?,?,?)"; @@ -674,10 +687,84 @@ public class ParameterBindingDemo { pstmt.columnDataExecuteBatch(); } } + + private static void bindVarbinary(Connection conn) throws SQLException { + String sql = "insert into ? using stable6 tags(?) values(?,?)"; + + try (TSDBPreparedStatement pstmt = conn.prepareStatement(sql).unwrap(TSDBPreparedStatement.class)) { + + for (int i = 1; i <= numOfSubTable; i++) { + // set table name + pstmt.setTableName("t6_" + i); + // set tags + byte[] bTag = new byte[]{0,2,3,4,5}; + bTag[0] = (byte) i; + pstmt.setTagVarbinary(0, bTag); + + // set columns + ArrayList tsList = new ArrayList<>(); + long current = System.currentTimeMillis(); + for (int j = 0; j < numOfRow; j++) + tsList.add(current + j); + pstmt.setTimestamp(0, tsList); + + ArrayList f1List = new ArrayList<>(); + for (int j = 0; j < numOfRow; j++) { + byte[] v = new byte[]{0,2,3,4,5,6}; + v[0] = (byte)j; + f1List.add(v); + } + pstmt.setVarbinary(1, f1List, BINARY_COLUMN_SIZE); + + // add column + pstmt.columnDataAddBatch(); + } + // execute + pstmt.columnDataExecuteBatch(); + } + } + + private static void bindGeometry(Connection conn) throws SQLException { + String sql = "insert into ? using stable7 tags(?) values(?,?)"; + + try (TSDBPreparedStatement pstmt = conn.prepareStatement(sql).unwrap(TSDBPreparedStatement.class)) { + + byte[] g1 = StringUtils.hexToBytes("0101000000000000000000F03F0000000000000040"); + byte[] g2 = StringUtils.hexToBytes("0102000020E610000002000000000000000000F03F000000000000004000000000000008400000000000001040"); + List listGeo = new ArrayList<>(); + listGeo.add(g1); + listGeo.add(g2); + + for (int i = 1; i <= 2; i++) { + // set table name + pstmt.setTableName("t7_" + i); + // set tags + pstmt.setTagGeometry(0, listGeo.get(i - 1)); + + // set columns + ArrayList tsList = new ArrayList<>(); + long current = System.currentTimeMillis(); + for (int j = 0; j < numOfRow; j++) + tsList.add(current + j); + pstmt.setTimestamp(0, tsList); + + ArrayList f1List = new ArrayList<>(); + for (int j = 0; j < numOfRow; j++) { + f1List.add(listGeo.get(i - 1)); + } + pstmt.setGeometry(1, f1List, BINARY_COLUMN_SIZE); + + // add column + pstmt.columnDataAddBatch(); + } + // execute + pstmt.columnDataExecuteBatch(); + } + } } ``` -**Note**: both setString and setNString require the user to declare the width of the corresponding column in the size parameter of the table definition +**Note**: both String and byte[] require the user to declare the width of the corresponding column in the size parameter of the table definition The methods to set VALUES columns: @@ -692,6 +779,8 @@ public void setByte(int columnIndex, ArrayList list) throws SQLException public void setShort(int columnIndex, ArrayList list) throws SQLException public void setString(int columnIndex, ArrayList list, int size) throws SQLException public void setNString(int columnIndex, ArrayList list, int size) throws SQLException +public void setVarbinary(int columnIndex, ArrayList list, int size) throws SQLException +public void setGeometry(int columnIndex, ArrayList list, int size) throws SQLException ``` @@ -880,6 +969,9 @@ public void setTagFloat(int index, float value) public void setTagDouble(int index, double value) public void setTagString(int index, String value) public void setTagNString(int index, String value) +public void setTagJson(int index, String value) +public void setTagVarbinary(int index, byte[] value) +public void setTagGeometry(int index, byte[] value) ``` ### Schemaless Writing diff --git a/docs/examples/java/pom.xml b/docs/examples/java/pom.xml index 69a0179759..2caf85e743 100644 --- a/docs/examples/java/pom.xml +++ b/docs/examples/java/pom.xml @@ -22,7 +22,7 @@ com.taosdata.jdbc taos-jdbcdriver - 3.2.4 + 3.2.7-SNAPSHOT diff --git a/docs/zh/07-develop/07-tmq.mdx b/docs/zh/07-develop/07-tmq.mdx index a73d43cd04..927d762829 100644 --- a/docs/zh/07-develop/07-tmq.mdx +++ b/docs/zh/07-develop/07-tmq.mdx @@ -23,22 +23,30 @@ import CDemo from "./_sub_c.mdx"; 为了实现上述功能,TDengine 会为 WAL (Write-Ahead-Log) 文件自动创建索引以支持快速随机访问,并提供了灵活可配置的文件切换与保留机制:用户可以按需指定 WAL 文件保留的时间以及大小(详见 create database 语句)。通过以上方式将 WAL 改造成了一个保留事件到达顺序的、可持久化的存储引擎(但由于 TSDB 具有远比 WAL 更高的压缩率,我们不推荐保留太长时间,一般来说,不超过几天)。 对于以 topic 形式创建的查询,TDengine 将对接 WAL 而不是 TSDB 作为其存储引擎。在消费时,TDengine 根据当前消费进度从 WAL 直接读取数据,并使用统一的查询引擎实现过滤、变换等操作,将数据推送给消费者。 -本文档不对消息队列本身的基础知识做介绍,如果需要了解,请自行搜索。 +下面为关于数据订阅的一些说明,需要对TDengine的架构有一些了解,结合各个语言链接器的接口使用。 +- 一个消费组消费同一个topic下的所有数据,不同消费组之间相互独立; +- 一个消费组消费同一个topic所有的vgroup,消费组可由多个消费者组成,但一个vgroup仅被一个消费者消费,如果消费者数量超过了vgroup数量,多余的消费者不消费数据; +- 在服务端每个vgroup仅保存一个offset,每个vgroup的offset是单调递增的,但不一定连续。各个vgroup的offset之间没有关联; +- 每次poll服务端会返回一个结果block,该block属于一个vgroup,可能包含多个wal版本的数据,可以通过 offset 接口获得是该block第一条记录的offset; +- 一个消费组如果从未commit过offset,当其成员消费者重启重新拉取数据时,均从参数auto.offset.reset设定值开始消费;在一个消费者生命周期中,客户端本地记录了最近一次拉取数据的offset,不会拉取重复数据; +- 消费者如果异常终止(没有调用tmq_close),需等约12秒后触发其所属消费组rebalance,该消费者在服务端状态变为LOST,约1天后该消费者自动被删除;正常退出,退出后就会删除消费者;新增消费者,需等约2秒触发rebalance,该消费者在服务端状态变为ready; +- 消费组rebalance会对该组所有ready状态的消费者成员重新进行vgroup分配,消费者仅能对自己负责的vgroup进行assignment/seek/commit/poll操作; +- 消费者可利用 position 获得当前消费的offset,并seek到指定offset,重新消费; +- seek将position指向指定offset,不执行commit操作,一旦seek成功,可poll拉取指定offset及以后的数据; +- seek 操作之前须调用 assignment 接口获取该consumer的vgroup ID和offset范围。seek 操作会检测vgroup ID 和 offset是否合法,如非法将报错; +- position是获取当前的消费位置,是下次要取的位置,不是当前消费到的位置 +- commit是提交消费位置,不带参数的话,是提交当前消费位置(下次要取的位置,不是当前消费到的位置),带参数的话,是提交参数里的位置(也即下次退出重启后要取的位置) +- seek是设置consumer消费位置,seek到哪,position就返回哪,都是下次要取的位置 +- seek不会影响commit,commit不影响seek,相互独立,两个是不同的概念 +- begin接口为wal 第一条数据的offset,end 接口为wal 最后一条数据的offset + 1 +- offset接口获取的是记录所在结果block块里的第一条数据的offset,当seek至该offset时,将消费到这个block里的全部数据。参见第四点; +- 由于存在 WAL 过期删除机制,即使seek 操作成功,poll数据时有可能offset已失效。如果poll 的offset 小于 WAL 最小版本号,将会从WAL最小版本号消费; +- 数据订阅是从 WAL 消费数据,如果一些 WAL 文件被基于 WAL 保留策略删除,则已经删除的 WAL 文件中的数据就无法再消费到。需要根据业务需要在创建数据库时合理设置 `WAL_RETENTION_PERIOD` 或 `WAL_RETENTION_SIZE` ,并确保应用及时消费数据,这样才不会产生数据丢失的现象。数据订阅的行为与 Kafka 等广泛使用的消息队列类产品的行为相似; -说明(以c接口为例): -1. 一个消费组消费同一个topic下的所有数据,不同消费组之间相互独立; -2. 一个消费组消费同一个topic所有的vgroup,消费组可由多个消费者组成,但一个vgroup仅被一个消费者消费,如果消费者数量超过了vgroup数量,多余的消费者不消费数据; -3. 在服务端每个vgroup仅保存一个offset,每个vgroup的offset是单调递增的,但不一定连续。各个vgroup的offset之间没有关联; -4. 每次poll服务端会返回一个结果block,该block属于一个vgroup,可能包含多个wal版本的数据,可以通过 tmq_get_vgroup_offset 接口获得是该block第一条记录的offset; -5. 一个消费组如果从未commit过offset,当其成员消费者重启重新拉取数据时,均从参数auto.offset.reset设定值开始消费;在一个消费者生命周期中,客户端本地记录了最近一次拉取数据的offset,不会拉取重复数据; -6. 消费者如果异常终止(没有调用tmq_close),需等约12秒后触发其所属消费组rebalance,该消费者在服务端状态变为LOST,约1天后该消费者自动被删除;正常退出,退出后就会删除消费者;新增消费者,需等约2秒触发rebalance,该消费者在服务端状态变为ready; -7. 消费组rebalance会对该组所有ready状态的消费者成员重新进行vgroup分配,消费者仅能对自己负责的vgroup进行assignment/seek/commit/poll操作; -8. 消费者可利用 tmq_position 获得当前消费的offset,并seek到指定offset,重新消费; -9. seek将position指向指定offset,不执行commit操作,一旦seek成功,可poll拉取指定offset及以后的数据; -10. seek 操作之前须调用 tmq_get_topic_assignment 接口获取该consumer的vgroup ID和offset范围。seek 操作会检测vgroup ID 和 offset是否合法,如非法将报错; -11. tmq_get_vgroup_offset接口获取的是记录所在结果block块里的第一条数据的offset,当seek至该offset时,将消费到这个block里的全部数据。参见第四点; -12. 由于存在 WAL 过期删除机制,即使seek 操作成功,poll数据时有可能offset已失效。如果poll 的offset 小于 WAL 最小版本号,将会从WAL最小版本号消费; -13. 数据订阅是从 WAL 消费数据,如果一些 WAL 文件被基于 WAL 保留策略删除,则已经删除的 WAL 文件中的数据就无法再消费到。需要根据业务需要在创建数据库时合理设置 `WAL_RETENTION_PERIOD` 或 `WAL_RETENTION_SIZE` ,并确保应用及时消费数据,这样才不会产生数据丢失的现象。数据订阅的行为与 Kafka 等广泛使用的消息队列类产品的行为相似; +本文档不对消息队列本身的知识做更多的介绍,如果需要了解,请自行搜索。 + +从3.2.0.0版本开始,数据订阅支持vnode迁移和分裂。 +由于数据订阅依赖wal文件,而在vnode迁移和分裂的过程中,wal并不会同步过去,所以迁移或分裂后,之前没消费完的wal数据后消费不到。所以请保证之前把数据全部消费完后,再进行vnode迁移或分裂,否则,消费会丢失数据。 ## 主要数据结构和 API diff --git a/docs/zh/08-connector/14-java.mdx b/docs/zh/08-connector/14-java.mdx index 64e9a3daed..7b6db8ee69 100644 --- a/docs/zh/08-connector/14-java.mdx +++ b/docs/zh/08-connector/14-java.mdx @@ -142,8 +142,14 @@ TDengine 目前支持时间戳、数字、字符、布尔类型,与 Java 对 | BINARY | byte array | | NCHAR | java.lang.String | | JSON | java.lang.String | +| VARBINARY | byte[] | +| GEOMETRY | byte[] | -**注意**:JSON 类型仅在 tag 中支持。 +**注意**:JSON 类型仅在 tag 中支持。 +由于历史原因,TDengine中的BINARY底层不是真正的二进制数据,已不建议使用。请用VARBINARY类型代替。 +GEOMETRY类型是little endian字节序的二进制数据,符合WKB规范。详细信息请参考 [数据类型](/taos-sql/data-type/#数据类型) +WKB规范请参考[Well-Known Binary (WKB)](https://libgeos.org/specifications/wkb/) +对于java连接器,可以使用jts库来方便的创建GEOMETRY类型对象,序列化后写入TDengine,这里有一个样例[Geometry示例](https://github.com/taosdata/TDengine/blob/3.0/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/GeometryDemo.java) ## 安装步骤 @@ -357,7 +363,7 @@ properties 中的配置参数如下: - TSDBDriver.PROPERTY_KEY_CONFIG_DIR:仅在使用 JDBC 原生连接时生效。客户端配置文件目录路径,Linux OS 上默认值 `/etc/taos`,Windows OS 上默认值 `C:/TDengine/cfg`。 - TSDBDriver.PROPERTY_KEY_CHARSET:客户端使用的字符集,默认值为系统字符集。 - TSDBDriver.PROPERTY_KEY_LOCALE:仅在使用 JDBC 原生连接时生效。 客户端语言环境,默认值系统当前 locale。 -- TSDBDriver.PROPERTY_KEY_TIME_ZONE:仅在使用 JDBC 原生连接时生效。 客户端使用的时区,默认值为系统当前时区。 +- TSDBDriver.PROPERTY_KEY_TIME_ZONE:仅在使用 JDBC 原生连接时生效。 客户端使用的时区,默认值为系统当前时区。因为历史的原因,我们只支持POSIX标准的部分规范,如UTC-8(代表中国上上海), GMT-8,Asia/Shanghai 这几种形式。 - TSDBDriver.HTTP_CONNECT_TIMEOUT: 连接超时时间,单位 ms, 默认值为 60000。仅在 REST 连接时生效。 - TSDBDriver.HTTP_SOCKET_TIMEOUT: socket 超时时间,单位 ms,默认值为 60000。仅在 REST 连接且 batchfetch 设置为 false 时生效。 - TSDBDriver.PROPERTY_KEY_MESSAGE_WAIT_TIMEOUT: 消息超时时间, 单位 ms, 默认值为 60000。 仅在 REST 连接且 batchfetch 设置为 true 时生效。 @@ -459,13 +465,15 @@ public class ParameterBindingDemo { private static final String host = "127.0.0.1"; private static final Random random = new Random(System.currentTimeMillis()); - private static final int BINARY_COLUMN_SIZE = 30; + private static final int BINARY_COLUMN_SIZE = 50; private static final String[] schemaList = { "create table stable1(ts timestamp, f1 tinyint, f2 smallint, f3 int, f4 bigint) tags(t1 tinyint, t2 smallint, t3 int, t4 bigint)", "create table stable2(ts timestamp, f1 float, f2 double) tags(t1 float, t2 double)", "create table stable3(ts timestamp, f1 bool) tags(t1 bool)", "create table stable4(ts timestamp, f1 binary(" + BINARY_COLUMN_SIZE + ")) tags(t1 binary(" + BINARY_COLUMN_SIZE + "))", - "create table stable5(ts timestamp, f1 nchar(" + BINARY_COLUMN_SIZE + ")) tags(t1 nchar(" + BINARY_COLUMN_SIZE + "))" + "create table stable5(ts timestamp, f1 nchar(" + BINARY_COLUMN_SIZE + ")) tags(t1 nchar(" + BINARY_COLUMN_SIZE + "))", + "create table stable6(ts timestamp, f1 varbinary(" + BINARY_COLUMN_SIZE + ")) tags(t1 varbinary(" + BINARY_COLUMN_SIZE + "))", + "create table stable7(ts timestamp, f1 geometry(" + BINARY_COLUMN_SIZE + ")) tags(t1 geometry(" + BINARY_COLUMN_SIZE + "))", }; private static final int numOfSubTable = 10, numOfRow = 10; @@ -477,21 +485,20 @@ public class ParameterBindingDemo { init(conn); bindInteger(conn); - bindFloat(conn); - bindBoolean(conn); - bindBytes(conn); - bindString(conn); + bindVarbinary(conn); + bindGeometry(conn); + clean(conn); conn.close(); } private static void init(Connection conn) throws SQLException { + clean(conn); try (Statement stmt = conn.createStatement()) { - stmt.execute("drop database if exists test_parabind"); stmt.execute("create database if not exists test_parabind"); stmt.execute("use test_parabind"); for (int i = 0; i < schemaList.length; i++) { @@ -499,6 +506,11 @@ public class ParameterBindingDemo { } } } + private static void clean(Connection conn) throws SQLException { + try (Statement stmt = conn.createStatement()) { + stmt.execute("drop database if exists test_parabind"); + } + } private static void bindInteger(Connection conn) throws SQLException { String sql = "insert into ? using stable1 tags(?,?,?,?) values(?,?,?,?,?)"; @@ -677,10 +689,84 @@ public class ParameterBindingDemo { pstmt.columnDataExecuteBatch(); } } + + private static void bindVarbinary(Connection conn) throws SQLException { + String sql = "insert into ? using stable6 tags(?) values(?,?)"; + + try (TSDBPreparedStatement pstmt = conn.prepareStatement(sql).unwrap(TSDBPreparedStatement.class)) { + + for (int i = 1; i <= numOfSubTable; i++) { + // set table name + pstmt.setTableName("t6_" + i); + // set tags + byte[] bTag = new byte[]{0,2,3,4,5}; + bTag[0] = (byte) i; + pstmt.setTagVarbinary(0, bTag); + + // set columns + ArrayList tsList = new ArrayList<>(); + long current = System.currentTimeMillis(); + for (int j = 0; j < numOfRow; j++) + tsList.add(current + j); + pstmt.setTimestamp(0, tsList); + + ArrayList f1List = new ArrayList<>(); + for (int j = 0; j < numOfRow; j++) { + byte[] v = new byte[]{0,2,3,4,5,6}; + v[0] = (byte)j; + f1List.add(v); + } + pstmt.setVarbinary(1, f1List, BINARY_COLUMN_SIZE); + + // add column + pstmt.columnDataAddBatch(); + } + // execute + pstmt.columnDataExecuteBatch(); + } + } + + private static void bindGeometry(Connection conn) throws SQLException { + String sql = "insert into ? using stable7 tags(?) values(?,?)"; + + try (TSDBPreparedStatement pstmt = conn.prepareStatement(sql).unwrap(TSDBPreparedStatement.class)) { + + byte[] g1 = StringUtils.hexToBytes("0101000000000000000000F03F0000000000000040"); + byte[] g2 = StringUtils.hexToBytes("0102000020E610000002000000000000000000F03F000000000000004000000000000008400000000000001040"); + List listGeo = new ArrayList<>(); + listGeo.add(g1); + listGeo.add(g2); + + for (int i = 1; i <= 2; i++) { + // set table name + pstmt.setTableName("t7_" + i); + // set tags + pstmt.setTagGeometry(0, listGeo.get(i - 1)); + + // set columns + ArrayList tsList = new ArrayList<>(); + long current = System.currentTimeMillis(); + for (int j = 0; j < numOfRow; j++) + tsList.add(current + j); + pstmt.setTimestamp(0, tsList); + + ArrayList f1List = new ArrayList<>(); + for (int j = 0; j < numOfRow; j++) { + f1List.add(listGeo.get(i - 1)); + } + pstmt.setGeometry(1, f1List, BINARY_COLUMN_SIZE); + + // add column + pstmt.columnDataAddBatch(); + } + // execute + pstmt.columnDataExecuteBatch(); + } + } } ``` -**注**:setString 和 setNString 都要求用户在 size 参数里声明表定义中对应列的列宽 +**注**:字符串和数组类型都要求用户在 size 参数里声明表定义中对应列的列宽。 用于设定 VALUES 数据列的取值的方法总共有: @@ -695,6 +781,8 @@ public void setByte(int columnIndex, ArrayList list) throws SQLException public void setShort(int columnIndex, ArrayList list) throws SQLException public void setString(int columnIndex, ArrayList list, int size) throws SQLException public void setNString(int columnIndex, ArrayList list, int size) throws SQLException +public void setVarbinary(int columnIndex, ArrayList list, int size) throws SQLException +public void setGeometry(int columnIndex, ArrayList list, int size) throws SQLException ``` @@ -883,6 +971,9 @@ public void setTagFloat(int index, float value) public void setTagDouble(int index, double value) public void setTagString(int index, String value) public void setTagNString(int index, String value) +public void setTagJson(int index, String value) +public void setTagVarbinary(int index, byte[] value) +public void setTagGeometry(int index, byte[] value) ``` ### 无模式写入 diff --git a/examples/JDBC/JDBCDemo/pom.xml b/examples/JDBC/JDBCDemo/pom.xml index 807ceb0f24..0f66685da0 100644 --- a/examples/JDBC/JDBCDemo/pom.xml +++ b/examples/JDBC/JDBCDemo/pom.xml @@ -11,13 +11,20 @@ src/main/resources/assembly + 1.8 + com.taosdata.jdbc taos-jdbcdriver - 3.0.0 + 3.2.7 + + + org.locationtech.jts + jts-core + 1.19.0 @@ -68,12 +75,12 @@ - SubscribeDemo + GeometryDemo - SubscribeDemo + GeometryDemo - com.taosdata.example.SubscribeDemo + com.taosdata.example.GeometryDemo diff --git a/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/ConsumerLoop.java b/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/ConsumerLoop.java new file mode 100644 index 0000000000..412f5b1a96 --- /dev/null +++ b/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/ConsumerLoop.java @@ -0,0 +1,94 @@ +package com.taosdata.example; + +import com.taosdata.jdbc.tmq.ConsumerRecord; +import com.taosdata.jdbc.tmq.ConsumerRecords; +import com.taosdata.jdbc.tmq.ReferenceDeserializer; +import com.taosdata.jdbc.tmq.TaosConsumer; + +import java.sql.SQLException; +import java.sql.Timestamp; +import java.time.Duration; +import java.util.Collections; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicBoolean; + +public abstract class ConsumerLoop { + private final TaosConsumer consumer; + private final List topics; + private final AtomicBoolean shutdown; + private final CountDownLatch shutdownLatch; + + public ConsumerLoop() throws SQLException { + Properties config = new Properties(); + config.setProperty("td.connect.type", "jni"); + config.setProperty("bootstrap.servers", "localhost:6030"); + config.setProperty("td.connect.user", "root"); + config.setProperty("td.connect.pass", "taosdata"); + config.setProperty("auto.offset.reset", "earliest"); + config.setProperty("msg.with.table.name", "true"); + config.setProperty("enable.auto.commit", "true"); + config.setProperty("auto.commit.interval.ms", "1000"); + config.setProperty("group.id", "group1"); + config.setProperty("client.id", "1"); + config.setProperty("value.deserializer", "com.taosdata.jdbc.tmq.ConsumerTest.ConsumerLoop$ResultDeserializer"); + config.setProperty("value.deserializer.encoding", "UTF-8"); + config.setProperty("experimental.snapshot.enable", "true"); + + this.consumer = new TaosConsumer<>(config); + this.topics = Collections.singletonList("topic_speed"); + this.shutdown = new AtomicBoolean(false); + this.shutdownLatch = new CountDownLatch(1); + } + + public abstract void process(ResultBean result); + + public void pollData() throws SQLException { + try { + consumer.subscribe(topics); + + while (!shutdown.get()) { + ConsumerRecords records = consumer.poll(Duration.ofMillis(100)); + for (ConsumerRecord record : records) { + ResultBean bean = record.value(); + process(bean); + } + } + consumer.unsubscribe(); + } finally { + consumer.close(); + shutdownLatch.countDown(); + } + } + + public void shutdown() throws InterruptedException { + shutdown.set(true); + shutdownLatch.await(); + } + + public static class ResultDeserializer extends ReferenceDeserializer { + + } + + public static class ResultBean { + private Timestamp ts; + private int speed; + + public Timestamp getTs() { + return ts; + } + + public void setTs(Timestamp ts) { + this.ts = ts; + } + + public int getSpeed() { + return speed; + } + + public void setSpeed(int speed) { + this.speed = speed; + } + } +} \ No newline at end of file diff --git a/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/GeometryDemo.java b/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/GeometryDemo.java new file mode 100644 index 0000000000..b58d3212f0 --- /dev/null +++ b/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/GeometryDemo.java @@ -0,0 +1,190 @@ +package com.taosdata.example; + +import com.taosdata.jdbc.TSDBPreparedStatement; +import org.locationtech.jts.geom.*; +import org.locationtech.jts.io.ByteOrderValues; +import org.locationtech.jts.io.ParseException; +import org.locationtech.jts.io.WKBReader; +import org.locationtech.jts.io.WKBWriter; + +import java.sql.*; +import java.util.ArrayList; +import java.util.Properties; + +public class GeometryDemo { + private static String host = "localhost"; + private static final String dbName = "test"; + private static final String tbName = "weather"; + private static final String user = "root"; + private static final String password = "taosdata"; + + private Connection connection; + + public static void main(String[] args) throws SQLException { + for (int i = 0; i < args.length; i++) { + if ("-host".equalsIgnoreCase(args[i]) && i < args.length - 1) + host = args[++i]; + } + if (host == null) { + printHelp(); + } + GeometryDemo demo = new GeometryDemo(); + demo.init(); + demo.createDatabase(); + demo.useDatabase(); + demo.dropTable(); + demo.createTable(); + + demo.insert(); + demo.stmtInsert(); + demo.select(); + + demo.dropTable(); + demo.close(); + } + + private void init() { + final String url = "jdbc:TAOS://" + host + ":6030/?user=" + user + "&password=" + password; + // get connection + try { + Properties properties = new Properties(); + properties.setProperty("charset", "UTF-8"); + properties.setProperty("locale", "en_US.UTF-8"); + properties.setProperty("timezone", "UTC-8"); + System.out.println("get connection starting..."); + connection = DriverManager.getConnection(url, properties); + if (connection != null) + System.out.println("[ OK ] Connection established."); + } catch (SQLException e) { + e.printStackTrace(); + } + } + + private void createDatabase() { + String sql = "create database if not exists " + dbName; + execute(sql); + } + + private void useDatabase() { + String sql = "use " + dbName; + execute(sql); + } + + private void dropTable() { + final String sql = "drop table if exists " + dbName + "." + tbName + ""; + execute(sql); + } + + private void createTable() { + final String sql = "create table if not exists " + dbName + "." + tbName + " (ts timestamp, temperature float, humidity int, location geometry(50))"; + execute(sql); + } + + private void insert() { + final String sql = "insert into " + dbName + "." + tbName + " (ts, temperature, humidity, location) values(now, 20.5, 34, 'POINT(1 2)')"; + execute(sql); + } + + private void stmtInsert() throws SQLException { + TSDBPreparedStatement preparedStatement = (TSDBPreparedStatement) connection.prepareStatement("insert into " + dbName + "." + tbName + " values (?, ?, ?, ?)"); + + long current = System.currentTimeMillis(); + ArrayList tsList = new ArrayList<>(); + tsList.add(current); + tsList.add(current + 1); + preparedStatement.setTimestamp(0, tsList); + ArrayList tempList = new ArrayList<>(); + tempList.add(20.1F); + tempList.add(21.2F); + preparedStatement.setFloat(1, tempList); + ArrayList humList = new ArrayList<>(); + humList.add(30); + humList.add(31); + preparedStatement.setInt(2, humList); + + + ArrayList list = new ArrayList<>(); + GeometryFactory gf = new GeometryFactory(); + Point p1 = gf.createPoint(new Coordinate(1,2)); + p1.setSRID(1234); + + // NOTE: TDengine current version only support 2D dimension and little endian byte order + WKBWriter w = new WKBWriter(2, ByteOrderValues.LITTLE_ENDIAN, true); + byte[] wkb = w.write(p1); + list.add(wkb); + + Coordinate[] coordinates = { new Coordinate(10, 20), + new Coordinate(30, 40)}; + LineString lineString = gf.createLineString(coordinates); + lineString.setSRID(2345); + byte[] wkb2 = w.write(lineString); + list.add(wkb2); + + preparedStatement.setGeometry(3, list, 50); + + preparedStatement.columnDataAddBatch(); + preparedStatement.columnDataExecuteBatch(); + } + + private void select() { + final String sql = "select * from " + dbName + "." + tbName; + executeQuery(sql); + } + + private void close() { + try { + if (connection != null) { + this.connection.close(); + System.out.println("connection closed."); + } + } catch (SQLException e) { + e.printStackTrace(); + } + } + + private void executeQuery(String sql) { + long start = System.currentTimeMillis(); + try (Statement statement = connection.createStatement()) { + ResultSet resultSet = statement.executeQuery(sql); + long end = System.currentTimeMillis(); + printSql(sql, true, (end - start)); + + while (resultSet.next()){ + byte[] result1 = resultSet.getBytes(4); + WKBReader reader = new WKBReader(); + Geometry g1 = reader.read(result1); + System.out.println("GEO OBJ: " + g1 + ", SRID: " + g1.getSRID()); + } + + } catch (SQLException e) { + long end = System.currentTimeMillis(); + printSql(sql, false, (end - start)); + e.printStackTrace(); + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + + private void printSql(String sql, boolean succeed, long cost) { + System.out.println("[ " + (succeed ? "OK" : "ERROR!") + " ] time cost: " + cost + " ms, execute statement ====> " + sql); + } + + private void execute(String sql) { + long start = System.currentTimeMillis(); + try (Statement statement = connection.createStatement()) { + boolean execute = statement.execute(sql); + long end = System.currentTimeMillis(); + printSql(sql, true, (end - start)); + } catch (SQLException e) { + long end = System.currentTimeMillis(); + printSql(sql, false, (end - start)); + e.printStackTrace(); + } + } + + private static void printHelp() { + System.out.println("Usage: java -jar JDBCDemo.jar -host "); + System.exit(0); + } + +} diff --git a/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/ParameterBindingDemo.java b/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/ParameterBindingDemo.java new file mode 100644 index 0000000000..bc323c2b14 --- /dev/null +++ b/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/ParameterBindingDemo.java @@ -0,0 +1,316 @@ +package com.taosdata.example; + +import com.taosdata.jdbc.TSDBPreparedStatement; +import com.taosdata.jdbc.utils.StringUtils; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +public class ParameterBindingDemo { + + private static final String host = "127.0.0.1"; + private static final Random random = new Random(System.currentTimeMillis()); + private static final int BINARY_COLUMN_SIZE = 50; + private static final String[] schemaList = { + "create table stable1(ts timestamp, f1 tinyint, f2 smallint, f3 int, f4 bigint) tags(t1 tinyint, t2 smallint, t3 int, t4 bigint)", + "create table stable2(ts timestamp, f1 float, f2 double) tags(t1 float, t2 double)", + "create table stable3(ts timestamp, f1 bool) tags(t1 bool)", + "create table stable4(ts timestamp, f1 binary(" + BINARY_COLUMN_SIZE + ")) tags(t1 binary(" + BINARY_COLUMN_SIZE + "))", + "create table stable5(ts timestamp, f1 nchar(" + BINARY_COLUMN_SIZE + ")) tags(t1 nchar(" + BINARY_COLUMN_SIZE + "))", + "create table stable6(ts timestamp, f1 varbinary(" + BINARY_COLUMN_SIZE + ")) tags(t1 varbinary(" + BINARY_COLUMN_SIZE + "))", + "create table stable7(ts timestamp, f1 geometry(" + BINARY_COLUMN_SIZE + ")) tags(t1 geometry(" + BINARY_COLUMN_SIZE + "))", + }; + private static final int numOfSubTable = 10, numOfRow = 10; + + public static void main(String[] args) throws SQLException { + + String jdbcUrl = "jdbc:TAOS://" + host + ":6030/"; + Connection conn = DriverManager.getConnection(jdbcUrl, "root", "taosdata"); + + init(conn); + + bindInteger(conn); + bindFloat(conn); + bindBoolean(conn); + bindBytes(conn); + bindString(conn); + bindVarbinary(conn); + bindGeometry(conn); + + clean(conn); + conn.close(); + } + + private static void init(Connection conn) throws SQLException { + clean(conn); + try (Statement stmt = conn.createStatement()) { + stmt.execute("create database if not exists test_parabind"); + stmt.execute("use test_parabind"); + for (int i = 0; i < schemaList.length; i++) { + stmt.execute(schemaList[i]); + } + } + } + private static void clean(Connection conn) throws SQLException { + try (Statement stmt = conn.createStatement()) { + stmt.execute("drop database if exists test_parabind"); + } + } + + private static void bindInteger(Connection conn) throws SQLException { + String sql = "insert into ? using stable1 tags(?,?,?,?) values(?,?,?,?,?)"; + + try (TSDBPreparedStatement pstmt = conn.prepareStatement(sql).unwrap(TSDBPreparedStatement.class)) { + + for (int i = 1; i <= numOfSubTable; i++) { + // set table name + pstmt.setTableName("t1_" + i); + // set tags + pstmt.setTagByte(0, Byte.parseByte(Integer.toString(random.nextInt(Byte.MAX_VALUE)))); + pstmt.setTagShort(1, Short.parseShort(Integer.toString(random.nextInt(Short.MAX_VALUE)))); + pstmt.setTagInt(2, random.nextInt(Integer.MAX_VALUE)); + pstmt.setTagLong(3, random.nextLong()); + // set columns + ArrayList tsList = new ArrayList<>(); + long current = System.currentTimeMillis(); + for (int j = 0; j < numOfRow; j++) + tsList.add(current + j); + pstmt.setTimestamp(0, tsList); + + ArrayList f1List = new ArrayList<>(); + for (int j = 0; j < numOfRow; j++) + f1List.add(Byte.parseByte(Integer.toString(random.nextInt(Byte.MAX_VALUE)))); + pstmt.setByte(1, f1List); + + ArrayList f2List = new ArrayList<>(); + for (int j = 0; j < numOfRow; j++) + f2List.add(Short.parseShort(Integer.toString(random.nextInt(Short.MAX_VALUE)))); + pstmt.setShort(2, f2List); + + ArrayList f3List = new ArrayList<>(); + for (int j = 0; j < numOfRow; j++) + f3List.add(random.nextInt(Integer.MAX_VALUE)); + pstmt.setInt(3, f3List); + + ArrayList f4List = new ArrayList<>(); + for (int j = 0; j < numOfRow; j++) + f4List.add(random.nextLong()); + pstmt.setLong(4, f4List); + + // add column + pstmt.columnDataAddBatch(); + } + // execute column + pstmt.columnDataExecuteBatch(); + } + } + + private static void bindFloat(Connection conn) throws SQLException { + String sql = "insert into ? using stable2 tags(?,?) values(?,?,?)"; + + TSDBPreparedStatement pstmt = conn.prepareStatement(sql).unwrap(TSDBPreparedStatement.class); + + for (int i = 1; i <= numOfSubTable; i++) { + // set table name + pstmt.setTableName("t2_" + i); + // set tags + pstmt.setTagFloat(0, random.nextFloat()); + pstmt.setTagDouble(1, random.nextDouble()); + // set columns + ArrayList tsList = new ArrayList<>(); + long current = System.currentTimeMillis(); + for (int j = 0; j < numOfRow; j++) + tsList.add(current + j); + pstmt.setTimestamp(0, tsList); + + ArrayList f1List = new ArrayList<>(); + for (int j = 0; j < numOfRow; j++) + f1List.add(random.nextFloat()); + pstmt.setFloat(1, f1List); + + ArrayList f2List = new ArrayList<>(); + for (int j = 0; j < numOfRow; j++) + f2List.add(random.nextDouble()); + pstmt.setDouble(2, f2List); + + // add column + pstmt.columnDataAddBatch(); + } + // execute + pstmt.columnDataExecuteBatch(); + // close if no try-with-catch statement is used + pstmt.close(); + } + + private static void bindBoolean(Connection conn) throws SQLException { + String sql = "insert into ? using stable3 tags(?) values(?,?)"; + + try (TSDBPreparedStatement pstmt = conn.prepareStatement(sql).unwrap(TSDBPreparedStatement.class)) { + for (int i = 1; i <= numOfSubTable; i++) { + // set table name + pstmt.setTableName("t3_" + i); + // set tags + pstmt.setTagBoolean(0, random.nextBoolean()); + // set columns + ArrayList tsList = new ArrayList<>(); + long current = System.currentTimeMillis(); + for (int j = 0; j < numOfRow; j++) + tsList.add(current + j); + pstmt.setTimestamp(0, tsList); + + ArrayList f1List = new ArrayList<>(); + for (int j = 0; j < numOfRow; j++) + f1List.add(random.nextBoolean()); + pstmt.setBoolean(1, f1List); + + // add column + pstmt.columnDataAddBatch(); + } + // execute + pstmt.columnDataExecuteBatch(); + } + } + + private static void bindBytes(Connection conn) throws SQLException { + String sql = "insert into ? using stable4 tags(?) values(?,?)"; + + try (TSDBPreparedStatement pstmt = conn.prepareStatement(sql).unwrap(TSDBPreparedStatement.class)) { + + for (int i = 1; i <= numOfSubTable; i++) { + // set table name + pstmt.setTableName("t4_" + i); + // set tags + pstmt.setTagString(0, new String("abc")); + + // set columns + ArrayList tsList = new ArrayList<>(); + long current = System.currentTimeMillis(); + for (int j = 0; j < numOfRow; j++) + tsList.add(current + j); + pstmt.setTimestamp(0, tsList); + + ArrayList f1List = new ArrayList<>(); + for (int j = 0; j < numOfRow; j++) { + f1List.add(new String("abc")); + } + pstmt.setString(1, f1List, BINARY_COLUMN_SIZE); + + // add column + pstmt.columnDataAddBatch(); + } + // execute + pstmt.columnDataExecuteBatch(); + } + } + + private static void bindString(Connection conn) throws SQLException { + String sql = "insert into ? using stable5 tags(?) values(?,?)"; + + try (TSDBPreparedStatement pstmt = conn.prepareStatement(sql).unwrap(TSDBPreparedStatement.class)) { + + for (int i = 1; i <= numOfSubTable; i++) { + // set table name + pstmt.setTableName("t5_" + i); + // set tags + pstmt.setTagNString(0, "California.SanFrancisco"); + + // set columns + ArrayList tsList = new ArrayList<>(); + long current = System.currentTimeMillis(); + for (int j = 0; j < numOfRow; j++) + tsList.add(current + j); + pstmt.setTimestamp(0, tsList); + + ArrayList f1List = new ArrayList<>(); + for (int j = 0; j < numOfRow; j++) { + f1List.add("California.LosAngeles"); + } + pstmt.setNString(1, f1List, BINARY_COLUMN_SIZE); + + // add column + pstmt.columnDataAddBatch(); + } + // execute + pstmt.columnDataExecuteBatch(); + } + } + + private static void bindVarbinary(Connection conn) throws SQLException { + String sql = "insert into ? using stable6 tags(?) values(?,?)"; + + try (TSDBPreparedStatement pstmt = conn.prepareStatement(sql).unwrap(TSDBPreparedStatement.class)) { + + for (int i = 1; i <= numOfSubTable; i++) { + // set table name + pstmt.setTableName("t6_" + i); + // set tags + byte[] bTag = new byte[]{0,2,3,4,5}; + bTag[0] = (byte) i; + pstmt.setTagVarbinary(0, bTag); + + // set columns + ArrayList tsList = new ArrayList<>(); + long current = System.currentTimeMillis(); + for (int j = 0; j < numOfRow; j++) + tsList.add(current + j); + pstmt.setTimestamp(0, tsList); + + ArrayList f1List = new ArrayList<>(); + for (int j = 0; j < numOfRow; j++) { + byte[] v = new byte[]{0,2,3,4,5,6}; + v[0] = (byte)j; + f1List.add(v); + } + pstmt.setVarbinary(1, f1List, BINARY_COLUMN_SIZE); + + // add column + pstmt.columnDataAddBatch(); + } + // execute + pstmt.columnDataExecuteBatch(); + } + } + + private static void bindGeometry(Connection conn) throws SQLException { + String sql = "insert into ? using stable7 tags(?) values(?,?)"; + + try (TSDBPreparedStatement pstmt = conn.prepareStatement(sql).unwrap(TSDBPreparedStatement.class)) { + + byte[] g1 = StringUtils.hexToBytes("0101000000000000000000F03F0000000000000040"); + byte[] g2 = StringUtils.hexToBytes("0102000020E610000002000000000000000000F03F000000000000004000000000000008400000000000001040"); + List listGeo = new ArrayList<>(); + listGeo.add(g1); + listGeo.add(g2); + + for (int i = 1; i <= 2; i++) { + // set table name + pstmt.setTableName("t7_" + i); + // set tags + pstmt.setTagGeometry(0, listGeo.get(i - 1)); + + // set columns + ArrayList tsList = new ArrayList<>(); + long current = System.currentTimeMillis(); + for (int j = 0; j < numOfRow; j++) + tsList.add(current + j); + pstmt.setTimestamp(0, tsList); + + ArrayList f1List = new ArrayList<>(); + for (int j = 0; j < numOfRow; j++) { + f1List.add(listGeo.get(i - 1)); + } + pstmt.setGeometry(1, f1List, BINARY_COLUMN_SIZE); + + // add column + pstmt.columnDataAddBatch(); + } + // execute + pstmt.columnDataExecuteBatch(); + } + } +} \ No newline at end of file diff --git a/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/SubscribeDemo.java b/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/SubscribeDemo.java deleted file mode 100644 index 4c499b0b3a..0000000000 --- a/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/SubscribeDemo.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.taosdata.example; - -import com.taosdata.jdbc.TSDBConnection; -import com.taosdata.jdbc.TSDBDriver; -import com.taosdata.jdbc.TSDBResultSet; -import com.taosdata.jdbc.TSDBSubscribe; - -import java.sql.DriverManager; -import java.sql.ResultSetMetaData; -import java.util.Properties; -import java.util.concurrent.TimeUnit; - -public class SubscribeDemo { - private static final String usage = "java -jar SubscribeDemo.jar -host -database -topic -sql "; - - public static void main(String[] args) { - // parse args from command line - String host = "", database = "", topic = "", sql = ""; - for (int i = 0; i < args.length; i++) { - if ("-host".equalsIgnoreCase(args[i]) && i < args.length - 1) { - host = args[++i]; - } - if ("-database".equalsIgnoreCase(args[i]) && i < args.length - 1) { - database = args[++i]; - } - if ("-topic".equalsIgnoreCase(args[i]) && i < args.length - 1) { - topic = args[++i]; - } - if ("-sql".equalsIgnoreCase(args[i]) && i < args.length - 1) { - sql = args[++i]; - } - } - if (host.isEmpty() || database.isEmpty() || topic.isEmpty() || sql.isEmpty()) { - System.out.println(usage); - return; - } - - try { - Properties properties = new Properties(); - properties.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8"); - properties.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8"); - properties.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8"); - final String url = "jdbc:TAOS://" + host + ":6030/" + database + "?user=root&password=taosdata"; - // get TSDBConnection - TSDBConnection connection = (TSDBConnection) DriverManager.getConnection(url, properties); - // create TSDBSubscribe - TSDBSubscribe sub = connection.subscribe(topic, sql, false); - - int total = 0; - while (true) { - TSDBResultSet rs = sub.consume(); - int count = 0; - ResultSetMetaData meta = rs.getMetaData(); - while (rs.next()) { - for (int i = 1; i <= meta.getColumnCount(); i++) { - System.out.print(meta.getColumnLabel(i) + ": " + rs.getString(i) + "\t"); - } - System.out.println(); - count++; - } - total += count; -// System.out.printf("%d rows consumed, total %d\n", count, total); - if (total >= 10) - break; - TimeUnit.SECONDS.sleep(1); - } - sub.close(false); - connection.close(); - } catch (Exception e) { - System.out.println("host: " + host + ", database: " + database + ", topic: " + topic + ", sql: " + sql); - e.printStackTrace(); - } - } -} \ No newline at end of file diff --git a/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/WSParameterBindingDemo.java b/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/WSParameterBindingDemo.java new file mode 100644 index 0000000000..e9e0b9da51 --- /dev/null +++ b/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/WSParameterBindingDemo.java @@ -0,0 +1,170 @@ +package com.taosdata.example; + +import com.taosdata.jdbc.ws.TSWSPreparedStatement; + +import java.sql.*; +import java.util.Random; + +public class WSParameterBindingDemo { + private static final String host = "127.0.0.1"; + private static final Random random = new Random(System.currentTimeMillis()); + private static final int BINARY_COLUMN_SIZE = 30; + private static final String[] schemaList = { + "create table stable1(ts timestamp, f1 tinyint, f2 smallint, f3 int, f4 bigint) tags(t1 tinyint, t2 smallint, t3 int, t4 bigint)", + "create table stable2(ts timestamp, f1 float, f2 double) tags(t1 float, t2 double)", + "create table stable3(ts timestamp, f1 bool) tags(t1 bool)", + "create table stable4(ts timestamp, f1 binary(" + BINARY_COLUMN_SIZE + ")) tags(t1 binary(" + BINARY_COLUMN_SIZE + "))", + "create table stable5(ts timestamp, f1 nchar(" + BINARY_COLUMN_SIZE + ")) tags(t1 nchar(" + BINARY_COLUMN_SIZE + "))" + }; + private static final int numOfSubTable = 10, numOfRow = 10; + + public static void main(String[] args) throws SQLException { + + String jdbcUrl = "jdbc:TAOS-RS://" + host + ":6041/?batchfetch=true"; + Connection conn = DriverManager.getConnection(jdbcUrl, "root", "taosdata"); + + init(conn); + + bindInteger(conn); + + bindFloat(conn); + + bindBoolean(conn); + + bindBytes(conn); + + bindString(conn); + + conn.close(); + } + + private static void init(Connection conn) throws SQLException { + try (Statement stmt = conn.createStatement()) { + stmt.execute("drop database if exists test_ws_parabind"); + stmt.execute("create database if not exists test_ws_parabind"); + stmt.execute("use test_ws_parabind"); + for (int i = 0; i < schemaList.length; i++) { + stmt.execute(schemaList[i]); + } + } + } + + private static void bindInteger(Connection conn) throws SQLException { + String sql = "insert into ? using stable1 tags(?,?,?,?) values(?,?,?,?,?)"; + + try (TSWSPreparedStatement pstmt = conn.prepareStatement(sql).unwrap(TSWSPreparedStatement.class)) { + + for (int i = 1; i <= numOfSubTable; i++) { + // set table name + pstmt.setTableName("t1_" + i); + // set tags + pstmt.setTagByte(1, Byte.parseByte(Integer.toString(random.nextInt(Byte.MAX_VALUE)))); + pstmt.setTagShort(2, Short.parseShort(Integer.toString(random.nextInt(Short.MAX_VALUE)))); + pstmt.setTagInt(3, random.nextInt(Integer.MAX_VALUE)); + pstmt.setTagLong(4, random.nextLong()); + // set columns + long current = System.currentTimeMillis(); + for (int j = 0; j < numOfRow; j++) { + pstmt.setTimestamp(1, new Timestamp(current + j)); + pstmt.setByte(2, Byte.parseByte(Integer.toString(random.nextInt(Byte.MAX_VALUE)))); + pstmt.setShort(3, Short.parseShort(Integer.toString(random.nextInt(Short.MAX_VALUE)))); + pstmt.setInt(4, random.nextInt(Integer.MAX_VALUE)); + pstmt.setLong(5, random.nextLong()); + pstmt.addBatch(); + } + pstmt.executeBatch(); + } + } + } + + private static void bindFloat(Connection conn) throws SQLException { + String sql = "insert into ? using stable2 tags(?,?) values(?,?,?)"; + + try(TSWSPreparedStatement pstmt = conn.prepareStatement(sql).unwrap(TSWSPreparedStatement.class)) { + + for (int i = 1; i <= numOfSubTable; i++) { + // set table name + pstmt.setTableName("t2_" + i); + // set tags + pstmt.setTagFloat(1, random.nextFloat()); + pstmt.setTagDouble(2, random.nextDouble()); + // set columns + long current = System.currentTimeMillis(); + for (int j = 0; j < numOfRow; j++) { + pstmt.setTimestamp(1, new Timestamp(current + j)); + pstmt.setFloat(2, random.nextFloat()); + pstmt.setDouble(3, random.nextDouble()); + pstmt.addBatch(); + } + pstmt.executeBatch(); + } + } + } + + private static void bindBoolean(Connection conn) throws SQLException { + String sql = "insert into ? using stable3 tags(?) values(?,?)"; + + try (TSWSPreparedStatement pstmt = conn.prepareStatement(sql).unwrap(TSWSPreparedStatement.class)) { + for (int i = 1; i <= numOfSubTable; i++) { + // set table name + pstmt.setTableName("t3_" + i); + // set tags + pstmt.setTagBoolean(1, random.nextBoolean()); + // set columns + long current = System.currentTimeMillis(); + for (int j = 0; j < numOfRow; j++) { + pstmt.setTimestamp(1, new Timestamp(current + j)); + pstmt.setBoolean(2, random.nextBoolean()); + pstmt.addBatch(); + } + pstmt.executeBatch(); + } + } + } + + private static void bindBytes(Connection conn) throws SQLException { + String sql = "insert into ? using stable4 tags(?) values(?,?)"; + + try (TSWSPreparedStatement pstmt = conn.prepareStatement(sql).unwrap(TSWSPreparedStatement.class)) { + + for (int i = 1; i <= numOfSubTable; i++) { + // set table name + pstmt.setTableName("t4_" + i); + // set tags + pstmt.setTagString(1, new String("abc")); + + // set columns + long current = System.currentTimeMillis(); + for (int j = 0; j < numOfRow; j++) { + pstmt.setTimestamp(1, new Timestamp(current + j)); + pstmt.setString(2, "abc"); + pstmt.addBatch(); + } + pstmt.executeBatch(); + } + } + } + + private static void bindString(Connection conn) throws SQLException { + String sql = "insert into ? using stable5 tags(?) values(?,?)"; + + try (TSWSPreparedStatement pstmt = conn.prepareStatement(sql).unwrap(TSWSPreparedStatement.class)) { + + for (int i = 1; i <= numOfSubTable; i++) { + // set table name + pstmt.setTableName("t5_" + i); + // set tags + pstmt.setTagNString(1, "California.SanFrancisco"); + + // set columns + long current = System.currentTimeMillis(); + for (int j = 0; j < numOfRow; j++) { + pstmt.setTimestamp(0, new Timestamp(current + j)); + pstmt.setNString(1, "California.SanFrancisco"); + pstmt.addBatch(); + } + pstmt.executeBatch(); + } + } + } +} diff --git a/include/client/taos.h b/include/client/taos.h index dac8e61542..f75a84baa8 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -125,7 +125,8 @@ typedef enum { typedef enum { TAOS_NOTIFY_PASSVER = 0, - TAOS_NOTIFY_WHITELIST_VER = 1 + TAOS_NOTIFY_WHITELIST_VER = 1, + TAOS_NOTIFY_USER_DROPPED = 2, } TAOS_NOTIFY_TYPE; #define RET_MSG_LENGTH 1024 @@ -240,6 +241,11 @@ DLL_EXPORT int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t fp, void *param typedef void (*__taos_async_whitelist_fn_t)(void *param, int code, TAOS *taos, int numOfWhiteLists, uint64_t* pWhiteLists); DLL_EXPORT void taos_fetch_whitelist_a(TAOS *taos, __taos_async_whitelist_fn_t fp, void *param); +typedef enum { + TAOS_CONN_MODE_BI = 0, +} TAOS_CONN_MODE; + +DLL_EXPORT int taos_set_conn_mode(TAOS* taos, int mode, int value); /* --------------------------schemaless INTERFACE------------------------------- */ DLL_EXPORT TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int protocol, int precision); @@ -313,6 +319,7 @@ DLL_EXPORT int32_t tmq_offset_seek(tmq_t *tmq, const char *pTopicName, int32_t DLL_EXPORT int64_t tmq_position(tmq_t *tmq, const char *pTopicName, int32_t vgId); // The current offset is the offset of the last consumed message + 1 DLL_EXPORT int64_t tmq_committed(tmq_t *tmq, const char *pTopicName, int32_t vgId); +DLL_EXPORT TAOS *tmq_get_connect(tmq_t *tmq); DLL_EXPORT const char *tmq_get_table_name(TAOS_RES *res); DLL_EXPORT tmq_res_t tmq_get_res_type(TAOS_RES *res); DLL_EXPORT const char *tmq_get_topic_name(TAOS_RES *res); diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 1c5510ba0d..bef581a31b 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -145,6 +145,7 @@ extern bool tsUseAdapter; extern int32_t tsMetaCacheMaxSize; extern int32_t tsSlowLogThreshold; extern int32_t tsSlowLogScope; +extern int32_t tsTimeSeriesThreshold; // client extern int32_t tsMinSlidingTime; diff --git a/include/common/tgrant.h b/include/common/tgrant.h index 46e09a56b6..31d34add24 100644 --- a/include/common/tgrant.h +++ b/include/common/tgrant.h @@ -30,6 +30,8 @@ extern "C" { #define GRANTS_COL_MAX_LEN 196 #endif +#define GRANT_HEART_BEAT_MIN 2 + typedef enum { TSDB_GRANT_ALL, TSDB_GRANT_TIME, diff --git a/include/common/tmsg.h b/include/common/tmsg.h index a0af96853e..d1d38ca2f8 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -959,7 +959,7 @@ typedef struct { int8_t superAuth; int8_t sysInfo; int8_t enable; - int8_t reserve; + int8_t dropped; SHashObj* createdDbs; SHashObj* readDbs; SHashObj* writeDbs; @@ -1464,6 +1464,11 @@ typedef struct { int32_t learnerProgress; // use one reservered } SVnodeLoad; +typedef struct { + int32_t vgId; + int64_t nTimeSeries; +} SVnodeLoadLite; + typedef struct { int8_t syncState; int64_t syncTerm; @@ -1511,6 +1516,16 @@ int32_t tSerializeSStatusReq(void* buf, int32_t bufLen, SStatusReq* pReq); int32_t tDeserializeSStatusReq(void* buf, int32_t bufLen, SStatusReq* pReq); void tFreeSStatusReq(SStatusReq* pReq); +typedef struct { + int32_t dnodeId; + int64_t clusterId; + SArray* pVloads; +} SNotifyReq; + +int32_t tSerializeSNotifyReq(void* buf, int32_t bufLen, SNotifyReq* pReq); +int32_t tDeserializeSNotifyReq(void* buf, int32_t bufLen, SNotifyReq* pReq); +void tFreeSNotifyReq(SNotifyReq* pReq); + typedef struct { int32_t dnodeId; int64_t clusterId; diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h index dd9a1af67c..7e030bef3f 100644 --- a/include/common/tmsgdef.h +++ b/include/common/tmsgdef.h @@ -179,8 +179,7 @@ enum { // WARN: new msg should be appended to segment tail TD_DEF_MSG_TYPE(TDMT_MND_STREAM_HEARTBEAT, "stream-heartbeat", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_RETRIEVE_IP_WHITE, "retrieve-ip-white", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_GET_USER_WHITELIST, "get-user-whitelist", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_MND_MAX_MSG, "mnd-max", NULL, NULL) - + TD_DEF_MSG_TYPE(TDMT_MND_NOTIFY, "notify", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_BALANCE_VGROUP_LEADER, "balance-vgroup-leader", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_RESTORE_DNODE, "restore-dnode", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_PAUSE_STREAM, "pause-stream", NULL, NULL) @@ -189,6 +188,8 @@ enum { // WARN: new msg should be appended to segment tail TD_DEF_MSG_TYPE(TDMT_MND_STREAM_BEGIN_CHECKPOINT, "stream-begin-checkpoint", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_STREAM_NODECHANGE_CHECK, "stream-nodechange-check", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_TRIM_DB_TIMER, "trim-db-tmr", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_GRANT_NOTIFY, "grant-notify", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_MAX_MSG, "mnd-max", NULL, NULL) TD_NEW_MSG_SEG(TDMT_VND_MSG) TD_DEF_MSG_TYPE(TDMT_VND_SUBMIT, "submit", SSubmitReq, SSubmitRsp) diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index f1c22f750f..d236e21f24 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -186,177 +186,179 @@ #define TK_SUBSCRIPTIONS 167 #define TK_VNODES 168 #define TK_ALIVE 169 -#define TK_LIKE 170 -#define TK_TBNAME 171 -#define TK_QTAGS 172 -#define TK_AS 173 -#define TK_INDEX 174 -#define TK_FUNCTION 175 -#define TK_INTERVAL 176 -#define TK_COUNT 177 -#define TK_LAST_ROW 178 -#define TK_META 179 -#define TK_ONLY 180 -#define TK_TOPIC 181 -#define TK_CONSUMER 182 -#define TK_GROUP 183 -#define TK_DESC 184 -#define TK_DESCRIBE 185 -#define TK_RESET 186 -#define TK_QUERY 187 -#define TK_CACHE 188 -#define TK_EXPLAIN 189 -#define TK_ANALYZE 190 -#define TK_VERBOSE 191 -#define TK_NK_BOOL 192 -#define TK_RATIO 193 -#define TK_NK_FLOAT 194 -#define TK_OUTPUTTYPE 195 -#define TK_AGGREGATE 196 -#define TK_BUFSIZE 197 -#define TK_LANGUAGE 198 -#define TK_REPLACE 199 -#define TK_STREAM 200 -#define TK_INTO 201 -#define TK_PAUSE 202 -#define TK_RESUME 203 -#define TK_TRIGGER 204 -#define TK_AT_ONCE 205 -#define TK_WINDOW_CLOSE 206 -#define TK_IGNORE 207 -#define TK_EXPIRED 208 -#define TK_FILL_HISTORY 209 -#define TK_UPDATE 210 -#define TK_SUBTABLE 211 -#define TK_UNTREATED 212 -#define TK_KILL 213 -#define TK_CONNECTION 214 -#define TK_TRANSACTION 215 -#define TK_BALANCE 216 -#define TK_VGROUP 217 -#define TK_LEADER 218 -#define TK_MERGE 219 -#define TK_REDISTRIBUTE 220 -#define TK_SPLIT 221 -#define TK_DELETE 222 -#define TK_INSERT 223 -#define TK_NULL 224 -#define TK_NK_QUESTION 225 -#define TK_NK_ARROW 226 -#define TK_ROWTS 227 -#define TK_QSTART 228 -#define TK_QEND 229 -#define TK_QDURATION 230 -#define TK_WSTART 231 -#define TK_WEND 232 -#define TK_WDURATION 233 -#define TK_IROWTS 234 -#define TK_ISFILLED 235 -#define TK_CAST 236 -#define TK_NOW 237 -#define TK_TODAY 238 -#define TK_TIMEZONE 239 -#define TK_CLIENT_VERSION 240 -#define TK_SERVER_VERSION 241 -#define TK_SERVER_STATUS 242 -#define TK_CURRENT_USER 243 -#define TK_CASE 244 -#define TK_WHEN 245 -#define TK_THEN 246 -#define TK_ELSE 247 -#define TK_BETWEEN 248 -#define TK_IS 249 -#define TK_NK_LT 250 -#define TK_NK_GT 251 -#define TK_NK_LE 252 -#define TK_NK_GE 253 -#define TK_NK_NE 254 -#define TK_MATCH 255 -#define TK_NMATCH 256 -#define TK_CONTAINS 257 -#define TK_IN 258 -#define TK_JOIN 259 -#define TK_INNER 260 -#define TK_SELECT 261 -#define TK_NK_HINT 262 -#define TK_DISTINCT 263 -#define TK_WHERE 264 -#define TK_PARTITION 265 -#define TK_BY 266 -#define TK_SESSION 267 -#define TK_STATE_WINDOW 268 -#define TK_EVENT_WINDOW 269 -#define TK_SLIDING 270 -#define TK_FILL 271 -#define TK_VALUE 272 -#define TK_VALUE_F 273 -#define TK_NONE 274 -#define TK_PREV 275 -#define TK_NULL_F 276 -#define TK_LINEAR 277 -#define TK_NEXT 278 -#define TK_HAVING 279 -#define TK_RANGE 280 -#define TK_EVERY 281 -#define TK_ORDER 282 -#define TK_SLIMIT 283 -#define TK_SOFFSET 284 -#define TK_LIMIT 285 -#define TK_OFFSET 286 -#define TK_ASC 287 -#define TK_NULLS 288 -#define TK_ABORT 289 -#define TK_AFTER 290 -#define TK_ATTACH 291 -#define TK_BEFORE 292 -#define TK_BEGIN 293 -#define TK_BITAND 294 -#define TK_BITNOT 295 -#define TK_BITOR 296 -#define TK_BLOCKS 297 -#define TK_CHANGE 298 -#define TK_COMMA 299 -#define TK_CONCAT 300 -#define TK_CONFLICT 301 -#define TK_COPY 302 -#define TK_DEFERRED 303 -#define TK_DELIMITERS 304 -#define TK_DETACH 305 -#define TK_DIVIDE 306 -#define TK_DOT 307 -#define TK_EACH 308 -#define TK_FAIL 309 -#define TK_FILE 310 -#define TK_FOR 311 -#define TK_GLOB 312 -#define TK_ID 313 -#define TK_IMMEDIATE 314 -#define TK_IMPORT 315 -#define TK_INITIALLY 316 -#define TK_INSTEAD 317 -#define TK_ISNULL 318 -#define TK_KEY 319 -#define TK_MODULES 320 -#define TK_NK_BITNOT 321 -#define TK_NK_SEMI 322 -#define TK_NOTNULL 323 -#define TK_OF 324 -#define TK_PLUS 325 -#define TK_PRIVILEGE 326 -#define TK_RAISE 327 -#define TK_RESTRICT 328 -#define TK_ROW 329 -#define TK_SEMI 330 -#define TK_STAR 331 -#define TK_STATEMENT 332 -#define TK_STRICT 333 -#define TK_STRING 334 -#define TK_TIMES 335 -#define TK_VALUES 336 -#define TK_VARIABLE 337 -#define TK_VIEW 338 -#define TK_WAL 339 - +#define TK_NORMAL 170 +#define TK_CHILD 171 +#define TK_LIKE 172 +#define TK_TBNAME 173 +#define TK_QTAGS 174 +#define TK_AS 175 +#define TK_SYSTEM 176 +#define TK_INDEX 177 +#define TK_FUNCTION 178 +#define TK_INTERVAL 179 +#define TK_COUNT 180 +#define TK_LAST_ROW 181 +#define TK_META 182 +#define TK_ONLY 183 +#define TK_TOPIC 184 +#define TK_CONSUMER 185 +#define TK_GROUP 186 +#define TK_DESC 187 +#define TK_DESCRIBE 188 +#define TK_RESET 189 +#define TK_QUERY 190 +#define TK_CACHE 191 +#define TK_EXPLAIN 192 +#define TK_ANALYZE 193 +#define TK_VERBOSE 194 +#define TK_NK_BOOL 195 +#define TK_RATIO 196 +#define TK_NK_FLOAT 197 +#define TK_OUTPUTTYPE 198 +#define TK_AGGREGATE 199 +#define TK_BUFSIZE 200 +#define TK_LANGUAGE 201 +#define TK_REPLACE 202 +#define TK_STREAM 203 +#define TK_INTO 204 +#define TK_PAUSE 205 +#define TK_RESUME 206 +#define TK_TRIGGER 207 +#define TK_AT_ONCE 208 +#define TK_WINDOW_CLOSE 209 +#define TK_IGNORE 210 +#define TK_EXPIRED 211 +#define TK_FILL_HISTORY 212 +#define TK_UPDATE 213 +#define TK_SUBTABLE 214 +#define TK_UNTREATED 215 +#define TK_KILL 216 +#define TK_CONNECTION 217 +#define TK_TRANSACTION 218 +#define TK_BALANCE 219 +#define TK_VGROUP 220 +#define TK_LEADER 221 +#define TK_MERGE 222 +#define TK_REDISTRIBUTE 223 +#define TK_SPLIT 224 +#define TK_DELETE 225 +#define TK_INSERT 226 +#define TK_NULL 227 +#define TK_NK_QUESTION 228 +#define TK_NK_ARROW 229 +#define TK_ROWTS 230 +#define TK_QSTART 231 +#define TK_QEND 232 +#define TK_QDURATION 233 +#define TK_WSTART 234 +#define TK_WEND 235 +#define TK_WDURATION 236 +#define TK_IROWTS 237 +#define TK_ISFILLED 238 +#define TK_CAST 239 +#define TK_NOW 240 +#define TK_TODAY 241 +#define TK_TIMEZONE 242 +#define TK_CLIENT_VERSION 243 +#define TK_SERVER_VERSION 244 +#define TK_SERVER_STATUS 245 +#define TK_CURRENT_USER 246 +#define TK_CASE 247 +#define TK_WHEN 248 +#define TK_THEN 249 +#define TK_ELSE 250 +#define TK_BETWEEN 251 +#define TK_IS 252 +#define TK_NK_LT 253 +#define TK_NK_GT 254 +#define TK_NK_LE 255 +#define TK_NK_GE 256 +#define TK_NK_NE 257 +#define TK_MATCH 258 +#define TK_NMATCH 259 +#define TK_CONTAINS 260 +#define TK_IN 261 +#define TK_JOIN 262 +#define TK_INNER 263 +#define TK_SELECT 264 +#define TK_NK_HINT 265 +#define TK_DISTINCT 266 +#define TK_WHERE 267 +#define TK_PARTITION 268 +#define TK_BY 269 +#define TK_SESSION 270 +#define TK_STATE_WINDOW 271 +#define TK_EVENT_WINDOW 272 +#define TK_SLIDING 273 +#define TK_FILL 274 +#define TK_VALUE 275 +#define TK_VALUE_F 276 +#define TK_NONE 277 +#define TK_PREV 278 +#define TK_NULL_F 279 +#define TK_LINEAR 280 +#define TK_NEXT 281 +#define TK_HAVING 282 +#define TK_RANGE 283 +#define TK_EVERY 284 +#define TK_ORDER 285 +#define TK_SLIMIT 286 +#define TK_SOFFSET 287 +#define TK_LIMIT 288 +#define TK_OFFSET 289 +#define TK_ASC 290 +#define TK_NULLS 291 +#define TK_ABORT 292 +#define TK_AFTER 293 +#define TK_ATTACH 294 +#define TK_BEFORE 295 +#define TK_BEGIN 296 +#define TK_BITAND 297 +#define TK_BITNOT 298 +#define TK_BITOR 299 +#define TK_BLOCKS 300 +#define TK_CHANGE 301 +#define TK_COMMA 302 +#define TK_CONCAT 303 +#define TK_CONFLICT 304 +#define TK_COPY 305 +#define TK_DEFERRED 306 +#define TK_DELIMITERS 307 +#define TK_DETACH 308 +#define TK_DIVIDE 309 +#define TK_DOT 310 +#define TK_EACH 311 +#define TK_FAIL 312 +#define TK_FILE 313 +#define TK_FOR 314 +#define TK_GLOB 315 +#define TK_ID 316 +#define TK_IMMEDIATE 317 +#define TK_IMPORT 318 +#define TK_INITIALLY 319 +#define TK_INSTEAD 320 +#define TK_ISNULL 321 +#define TK_KEY 322 +#define TK_MODULES 323 +#define TK_NK_BITNOT 324 +#define TK_NK_SEMI 325 +#define TK_NOTNULL 326 +#define TK_OF 327 +#define TK_PLUS 328 +#define TK_PRIVILEGE 329 +#define TK_RAISE 330 +#define TK_RESTRICT 331 +#define TK_ROW 332 +#define TK_SEMI 333 +#define TK_STAR 334 +#define TK_STATEMENT 335 +#define TK_STRICT 336 +#define TK_STRING 337 +#define TK_TIMES 338 +#define TK_VALUES 339 +#define TK_VARIABLE 340 +#define TK_VIEW 341 +#define TK_WAL 342 #define TK_NK_SPACE 600 #define TK_NK_COMMENT 601 diff --git a/include/libs/command/command.h b/include/libs/command/command.h index a8b1a0902a..b788b03386 100644 --- a/include/libs/command/command.h +++ b/include/libs/command/command.h @@ -22,7 +22,7 @@ typedef struct SExplainCtx SExplainCtx; -int32_t qExecCommand(int64_t* pConnId, bool sysInfoUser, SNode *pStmt, SRetrieveTableRsp **pRsp); +int32_t qExecCommand(int64_t* pConnId, bool sysInfoUser, SNode *pStmt, SRetrieveTableRsp **pRsp, int8_t biMode); int32_t qExecStaticExplain(SQueryPlan *pDag, SRetrieveTableRsp **pRsp); int32_t qExecExplainBegin(SQueryPlan *pDag, SExplainCtx **pCtx, int64_t startTs); diff --git a/include/libs/executor/storageapi.h b/include/libs/executor/storageapi.h index 0a240dd8f5..d21fb8c459 100644 --- a/include/libs/executor/storageapi.h +++ b/include/libs/executor/storageapi.h @@ -142,6 +142,7 @@ typedef struct SSnapContext { typedef struct { int64_t uid; int64_t ctbNum; + int32_t colNum; } SMetaStbStats; // void tqReaderSetColIdList(STqReader *pReader, SArray *pColIdList); @@ -285,8 +286,8 @@ typedef struct SStoreMeta { // db name, vgId, numOfTables, numOfSTables int32_t (*getNumOfChildTables)( - void* pVnode, int64_t uid, - int64_t* numOfTables); // int32_t metaGetStbStats(SMeta *pMeta, int64_t uid, SMetaStbStats *pInfo); + void* pVnode, int64_t uid, int64_t* numOfTables, + int32_t* numOfCols); // int32_t metaGetStbStats(SMeta *pMeta, int64_t uid, SMetaStbStats *pInfo); void (*getBasicInfo)(void* pVnode, const char** dbname, int32_t* vgId, int64_t* numOfTables, int64_t* numOfNormalTables); // vnodeGetInfo(void *pVnode, const char **dbname, int32_t *vgId) & // metaGetTbNum(SMeta *pMeta) & metaGetNtbNum(SMeta *pMeta); diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index 1954f2a415..48c2210f46 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -236,6 +236,7 @@ bool fmIsInterpPseudoColumnFunc(int32_t funcId); bool fmIsGroupKeyFunc(int32_t funcId); bool fmIsBlockDistFunc(int32_t funcId); bool fmIsConstantResFunc(SFunctionNode* pFunc); +bool fmIsSkipScanCheckFunc(int32_t funcId); void getLastCacheDataType(SDataType* pType); SFunctionNode* createFunction(const char* pName, SNodeList* pParameterList); diff --git a/include/libs/monitor/monitor.h b/include/libs/monitor/monitor.h index 607179c446..708953f45e 100644 --- a/include/libs/monitor/monitor.h +++ b/include/libs/monitor/monitor.h @@ -191,7 +191,7 @@ typedef struct { } SMonBmInfo; typedef struct { - SArray *pVloads; // SVnodeLoad + SArray *pVloads; // SVnodeLoad/SVnodeLoadLite } SMonVloadInfo; typedef struct { diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index 40b9d21503..b85fab9ae6 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -273,6 +273,7 @@ typedef struct SShowStmt { SNode* pDbName; // SValueNode SNode* pTbName; // SValueNode EOperatorType tableCondType; + EShowKind showKind; // show databases: user/system, show tables: normal/child, others NULL } SShowStmt; typedef struct SShowCreateDatabaseStmt { diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h index 6e36ea7514..9725aa48c0 100644 --- a/include/libs/nodes/nodes.h +++ b/include/libs/nodes/nodes.h @@ -124,6 +124,7 @@ int32_t nodesListStrictAppendList(SNodeList* pTarget, SNodeList* pSrc); int32_t nodesListPushFront(SNodeList* pList, SNode* pNode); SListCell* nodesListErase(SNodeList* pList, SListCell* pCell); void nodesListInsertList(SNodeList* pTarget, SListCell* pPos, SNodeList* pSrc); +void nodesListInsertListAfterPos(SNodeList* pTarget, SListCell* pPos, SNodeList* pSrc); SNode* nodesListGetNode(SNodeList* pList, int32_t index); SListCell* nodesListGetCell(SNodeList* pList, int32_t index); void nodesDestroyList(SNodeList* pList); diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index 885e9e5a30..dbbe1d92dc 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -293,6 +293,7 @@ typedef struct SPartitionLogicNode { SNodeList* pPartitionKeys; SNodeList* pTags; SNode* pSubtable; + SNodeList* pAggFuncs; bool needBlockOutputTsOrder; // if true, partition output block will have ts order maintained int32_t pkTsColId; diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index bb6713dc83..98f0a795f7 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -277,6 +277,14 @@ typedef enum ETimeLineMode { TIME_LINE_GLOBAL, } ETimeLineMode; +typedef enum EShowKind { + SHOW_KIND_ALL = 1, + SHOW_KIND_TABLES_NORMAL, + SHOW_KIND_TABLES_CHILD, + SHOW_KIND_DATABASES_USER, + SHOW_KIND_DATABASES_SYSTEM +} EShowKind; + typedef struct SFillNode { ENodeType type; // QUERY_NODE_FILL EFillMode mode; @@ -519,6 +527,8 @@ void* nodesGetValueFromNode(SValueNode* pNode); int32_t nodesSetValueNodeValue(SValueNode* pNode, void* value); char* nodesGetStrValueFromNode(SValueNode* pNode); void nodesValueNodeToVariant(const SValueNode* pNode, SVariant* pVal); +SValueNode* nodesMakeValueNodeFromString(char* literal); +SValueNode* nodesMakeValueNodeFromBool(bool b); char* nodesGetFillModeString(EFillMode mode); int32_t nodesMergeConds(SNode** pDst, SNodeList** pSrc); @@ -526,6 +536,9 @@ int32_t nodesMergeConds(SNode** pDst, SNodeList** pSrc); const char* operatorTypeStr(EOperatorType type); const char* logicConditionTypeStr(ELogicConditionType type); +bool nodesIsStar(SNode* pNode); +bool nodesIsTableStar(SNode* pNode); + #ifdef __cplusplus } #endif diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h index 2dc5c8f112..4b1af5cc26 100644 --- a/include/libs/parser/parser.h +++ b/include/libs/parser/parser.h @@ -64,6 +64,7 @@ typedef struct SParseContext { SArray* pTableMetaPos; // sql table pos => catalog data pos SArray* pTableVgroupPos; // sql table pos => catalog data pos int64_t allocatorId; + int8_t biMode; } SParseContext; int32_t qParseSql(SParseContext* pCxt, SQuery** pQuery); diff --git a/include/os/osThread.h b/include/os/osThread.h index aa0dc066c6..f0b79ac2c9 100644 --- a/include/os/osThread.h +++ b/include/os/osThread.h @@ -22,6 +22,15 @@ extern "C" { #endif +#if defined(WINDOWS) && !defined(__USE_PTHREAD) +#include +#define __USE_WIN_THREAD +// https://learn.microsoft.com/en-us/windows/win32/winprog/using-the-windows-headers +// #ifndef _WIN32_WINNT +// #define _WIN32_WINNT 0x0600 +// #endif +#endif + #if !defined(WINDOWS) && !defined(_ALPINE) #ifndef __USE_XOPEN2K #define TD_USE_SPINLOCK_AS_MUTEX @@ -29,6 +38,22 @@ typedef pthread_mutex_t pthread_spinlock_t; #endif #endif +#ifdef __USE_WIN_THREAD +typedef pthread_t TdThread; // pthread api +typedef pthread_spinlock_t TdThreadSpinlock; // pthread api +typedef CRITICAL_SECTION TdThreadMutex; // windows api +typedef HANDLE TdThreadMutexAttr; // windows api +typedef struct { + SRWLOCK lock; + int8_t excl; +} TdThreadRwlock; // windows api +typedef pthread_attr_t TdThreadAttr; // pthread api +typedef pthread_once_t TdThreadOnce; // pthread api +typedef HANDLE TdThreadRwlockAttr; // windows api +typedef CONDITION_VARIABLE TdThreadCond; // windows api +typedef HANDLE TdThreadCondAttr; // windows api +typedef pthread_key_t TdThreadKey; // pthread api +#else typedef pthread_t TdThread; typedef pthread_spinlock_t TdThreadSpinlock; typedef pthread_mutex_t TdThreadMutex; @@ -40,11 +65,14 @@ typedef pthread_rwlockattr_t TdThreadRwlockAttr; typedef pthread_cond_t TdThreadCond; typedef pthread_condattr_t TdThreadCondAttr; typedef pthread_key_t TdThreadKey; +#endif #define taosThreadCleanupPush pthread_cleanup_push #define taosThreadCleanupPop pthread_cleanup_pop -#ifdef WINDOWS +#if defined(WINDOWS) && !defined(__USE_PTHREAD) +#define TD_PTHREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER_FORBID +#elif defined(WINDOWS) #define TD_PTHREAD_MUTEX_INITIALIZER (TdThreadMutex)(-1) #else #define TD_PTHREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 9448634c5b..9cf3716c19 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -133,32 +133,37 @@ typedef struct { int32_t ver; void* param; __taos_notify_fn_t fp; -} SPassInfo; +} STscNotifyInfo; + +typedef STscNotifyInfo SPassInfo; typedef struct { - int64_t ver; - void* param; + int64_t ver; + void* param; __taos_notify_fn_t fp; } SWhiteListInfo; typedef struct STscObj { - char user[TSDB_USER_LEN]; - char pass[TSDB_PASSWORD_LEN]; - char db[TSDB_DB_FNAME_LEN]; - char sVer[TSDB_VERSION_LEN]; - char sDetailVer[128]; - int8_t sysInfo; - int8_t connType; - int32_t acctId; - uint32_t connId; - int64_t id; // ref ID returned by taosAddRef - TdThreadMutex mutex; // used to protect the operation on db - int32_t numOfReqs; // number of sqlObj bound to this connection - int32_t authVer; - SAppInstInfo* pAppInfo; - SHashObj* pRequests; - SPassInfo passInfo; + char user[TSDB_USER_LEN]; + char pass[TSDB_PASSWORD_LEN]; + char db[TSDB_DB_FNAME_LEN]; + char sVer[TSDB_VERSION_LEN]; + char sDetailVer[128]; + int8_t sysInfo; + int8_t connType; + int8_t dropped; + int8_t biMode; + int32_t acctId; + uint32_t connId; + int64_t id; // ref ID returned by taosAddRef + TdThreadMutex mutex; // used to protect the operation on db + int32_t numOfReqs; // number of sqlObj bound to this connection + int32_t authVer; + SAppInstInfo* pAppInfo; + SHashObj* pRequests; + SPassInfo passInfo; SWhiteListInfo whiteListInfo; + STscNotifyInfo userDroppedInfo; } STscObj; typedef struct STscDbg { diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index e64f0d779c..dfcca2f36e 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -96,6 +96,19 @@ static int32_t hbUpdateUserAuthInfo(SAppHbMgr *pAppHbMgr, SUserAuthBatchRsp *bat } } + if (pRsp->dropped == 1) { + if (atomic_val_compare_exchange_8(&pTscObj->dropped, 0, 1) == 0) { + if (pTscObj->userDroppedInfo.fp) { + SPassInfo *dropInfo = &pTscObj->userDroppedInfo; + if (dropInfo->fp) { + (*dropInfo->fp)(dropInfo->param, NULL, TAOS_NOTIFY_USER_DROPPED); + } + } + } + releaseTscObj(pReq->connKey.tscRid); + continue; + } + pTscObj->authVer = pRsp->version; if (pTscObj->sysInfo != pRsp->sysInfo) { @@ -842,7 +855,8 @@ SClientHbBatchReq *hbGatherAllInfo(SAppHbMgr *pAppHbMgr) { SClientHbKey *connKey = &pOneReq->connKey; STscObj *pTscObj = (STscObj *)acquireTscObj(connKey->tscRid); - if (!pTscObj) { + if (!pTscObj || atomic_load_8(&pTscObj->dropped) == 1) { + if (pTscObj) releaseTscObj(connKey->tscRid); continue; } diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index c78ba4c4a0..57cfa61847 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -297,7 +297,8 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtC int32_t execLocalCmd(SRequestObj* pRequest, SQuery* pQuery) { SRetrieveTableRsp* pRsp = NULL; - int32_t code = qExecCommand(&pRequest->pTscObj->id, pRequest->pTscObj->sysInfo, pQuery->pRoot, &pRsp); + int8_t biMode = atomic_load_8(&pRequest->pTscObj->biMode); + int32_t code = qExecCommand(&pRequest->pTscObj->id, pRequest->pTscObj->sysInfo, pQuery->pRoot, &pRsp, biMode); if (TSDB_CODE_SUCCESS == code && NULL != pRsp) { code = setQueryResultFromRsp(&pRequest->body.resInfo, pRsp, false, true); } @@ -335,7 +336,7 @@ void asyncExecLocalCmd(SRequestObj* pRequest, SQuery* pQuery) { return; } - int32_t code = qExecCommand(&pRequest->pTscObj->id, pRequest->pTscObj->sysInfo, pQuery->pRoot, &pRsp); + int32_t code = qExecCommand(&pRequest->pTscObj->id, pRequest->pTscObj->sysInfo, pQuery->pRoot, &pRsp, atomic_load_8(&pRequest->pTscObj->biMode)); if (TSDB_CODE_SUCCESS == code && NULL != pRsp) { code = setQueryResultFromRsp(&pRequest->body.resInfo, pRsp, false, true); } @@ -2553,6 +2554,14 @@ static void fetchCallback(void* pResult, void* param, int32_t code) { } void taosAsyncFetchImpl(SRequestObj* pRequest, __taos_async_fn_t fp, void* param) { + if (pRequest->syncQuery && pRequest->body.param != param) { + if (pRequest->body.param) { + tsem_destroy(&((SSyncQueryParam *)pRequest->body.param)->sem); + } + taosMemoryFree(pRequest->body.param); + pRequest->syncQuery = false; + } + pRequest->body.fetchFp = fp; pRequest->body.param = param; diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 7902d6029e..5b8c54f1d6 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -147,6 +147,13 @@ int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t fp, void *param, int type) taosThreadMutexUnlock(&pObj->mutex); break; } + case TAOS_NOTIFY_USER_DROPPED: { + taosThreadMutexLock(&pObj->mutex); + pObj->userDroppedInfo.fp = fp; + pObj->userDroppedInfo.param = param; + taosThreadMutexUnlock(&pObj->mutex); + break; + } default: { terrno = TSDB_CODE_INVALID_PARA; releaseTscObj(*(int64_t *)taos); @@ -1166,6 +1173,8 @@ int32_t createParseContext(const SRequestObj *pRequest, SParseContext **pCxt) { .svrVer = pTscObj->sVer, .nodeOffline = (pTscObj->pAppInfo->onlineDnodes < pTscObj->pAppInfo->totalDnodes), .allocatorId = pRequest->allocatorRefId}; + int8_t biMode = atomic_load_8(&((STscObj *)pTscObj)->biMode); + (*pCxt)->biMode = biMode; return TSDB_CODE_SUCCESS; } @@ -1829,3 +1838,26 @@ int taos_stmt_close(TAOS_STMT *stmt) { return stmtClose(stmt); } + +int taos_set_conn_mode(TAOS* taos, int mode, int value) { + if (taos == NULL) { + terrno = TSDB_CODE_INVALID_PARA; + return terrno; + } + + STscObj *pObj = acquireTscObj(*(int64_t *)taos); + if (NULL == pObj) { + terrno = TSDB_CODE_TSC_DISCONNECTED; + tscError("invalid parameter for %s", __func__); + return terrno; + } + switch (mode) { + case TAOS_CONN_MODE_BI: + atomic_store_8(&pObj->biMode, value); + break; + default: + tscError("not supported mode."); + return TSDB_CODE_INVALID_PARA; + } + return 0; +} \ No newline at end of file diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index f5cdfeadad..b7e92d2e65 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -1411,7 +1411,7 @@ int taos_write_raw_block_with_fields(TAOS* taos, int rows, char* pData, const ch code = smlBuildOutput(pQuery, pVgHash); if (code != TSDB_CODE_SUCCESS) { uError("smlBuildOutput failed"); - return code; + goto end; } launchQueryImpl(pRequest, pQuery, true, NULL); @@ -1496,7 +1496,7 @@ int taos_write_raw_block(TAOS* taos, int rows, char* pData, const char* tbname) code = smlBuildOutput(pQuery, pVgHash); if (code != TSDB_CODE_SUCCESS) { uError("smlBuildOutput failed"); - return code; + goto end; } launchQueryImpl(pRequest, pQuery, true, NULL); diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 054302974c..6ee5508048 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1415,6 +1415,8 @@ static void initClientTopicFromRsp(SMqClientTopic* pTopic, SMqSubTopicEp* pTopic STqOffsetVal offsetNew = {0}; offsetNew.type = tmq->resetOffsetCfg; + tscInfo("consumer:0x%" PRIx64 ", update topic:%s, new numOfVgs:%d, num:%d, port:%d", tmq->consumerId, pTopic->topicName, vgNumGet, pVgEp->epSet.numOfEps,pVgEp->epSet.eps[pVgEp->epSet.inUse].port); + SMqClientVg clientVg = { .pollCnt = 0, .vgId = pVgEp->vgId, @@ -1766,7 +1768,7 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) { tscError("consumer:0x%" PRIx64 " msg from vgId:%d discarded, since %s", tmq->consumerId, pollRspWrapper->vgId, tstrerror(pRspWrapper->code)); taosWLockLatch(&tmq->lock); SMqClientVg* pVg = getVgInfo(tmq, pollRspWrapper->topicName, pollRspWrapper->vgId); - pVg->emptyBlockReceiveTs = taosGetTimestampMs(); + if(pVg) pVg->emptyBlockReceiveTs = taosGetTimestampMs(); taosWUnLockLatch(&tmq->lock); } setVgIdle(tmq, pollRspWrapper->topicName, pollRspWrapper->vgId); @@ -3104,3 +3106,10 @@ int32_t tmq_offset_seek(tmq_t* tmq, const char* pTopicName, int32_t vgId, int64_ return code; } + +TAOS *tmq_get_connect(tmq_t *tmq){ + if (tmq && tmq->pTscObj) { + return (TAOS *)(&(tmq->pTscObj->id)); + } + return NULL; +} diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 03285edcf7..868cd927d7 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -144,6 +144,7 @@ bool tsUseAdapter = false; int32_t tsMetaCacheMaxSize = -1; // MB int32_t tsSlowLogThreshold = 3; // seconds int32_t tsSlowLogScope = SLOW_LOG_TYPE_ALL; +int32_t tsTimeSeriesThreshold = 50; /* * denote if the server needs to compress response message at the application layer to client, including query rsp, @@ -264,6 +265,9 @@ char tsS3BucketName[TSDB_FQDN_LEN] = ""; char tsS3AppId[TSDB_FQDN_LEN] = ""; int8_t tsS3Enabled = false; +int32_t tsS3BlockSize = 4096; // number of tsdb pages +int32_t tsS3BlockCacheSize = 16; // number of blocks + int32_t tsCheckpointInterval = 20; #ifndef _STORAGE @@ -321,7 +325,9 @@ int32_t taosSetS3Cfg(SConfig *pCfg) { return 0; } -struct SConfig *taosGetCfg() { return tsCfg; } +struct SConfig *taosGetCfg() { + return tsCfg; +} static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *inputCfgDir, const char *envFile, char *apolloUrl) { @@ -630,6 +636,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddInt32(pCfg, "trimVDbIntervalSec", tsTrimVDbIntervalSec, 1, 100000, CFG_SCOPE_SERVER) != 0) return -1; if (cfgAddInt32(pCfg, "uptimeInterval", tsUptimeInterval, 1, 100000, CFG_SCOPE_SERVER) != 0) return -1; if (cfgAddInt32(pCfg, "queryRsmaTolerance", tsQueryRsmaTolerance, 0, 900000, CFG_SCOPE_SERVER) != 0) return -1; + if (cfgAddInt32(pCfg, "timeseriesThreshold", tsTimeSeriesThreshold, 0, 2000, CFG_SCOPE_SERVER) != 0) return -1; if (cfgAddInt64(pCfg, "walFsyncDataSizeLimit", tsWalFsyncDataSizeLimit, 100 * 1024 * 1024, INT64_MAX, CFG_SCOPE_SERVER) != 0) @@ -655,6 +662,8 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddString(pCfg, "s3Accesskey", tsS3AccessKey, CFG_SCOPE_SERVER) != 0) return -1; if (cfgAddString(pCfg, "s3Endpoint", tsS3Endpoint, CFG_SCOPE_SERVER) != 0) return -1; if (cfgAddString(pCfg, "s3BucketName", tsS3BucketName, CFG_SCOPE_SERVER) != 0) return -1; + if (cfgAddInt32(pCfg, "s3BlockSize", tsS3BlockSize, 2048, 1024 * 1024, CFG_SCOPE_SERVER) != 0) return -1; + if (cfgAddInt32(pCfg, "s3BlockCacheSize", tsS3BlockCacheSize, 4, 1024 * 1024, CFG_SCOPE_SERVER) != 0) return -1; // min free disk space used to check if the disk is full [50MB, 1GB] if (cfgAddInt64(pCfg, "minDiskFreeSize", tsMinDiskFreeSize, TFS_MIN_DISK_FREE_SIZE, 1024 * 1024 * 1024, @@ -1036,6 +1045,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsTrimVDbIntervalSec = cfgGetItem(pCfg, "trimVDbIntervalSec")->i32; tsUptimeInterval = cfgGetItem(pCfg, "uptimeInterval")->i32; tsQueryRsmaTolerance = cfgGetItem(pCfg, "queryRsmaTolerance")->i32; + tsTimeSeriesThreshold = cfgGetItem(pCfg, "timeseriesThreshold")->i32; tsWalFsyncDataSizeLimit = cfgGetItem(pCfg, "walFsyncDataSizeLimit")->i64; @@ -1070,6 +1080,9 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsResolveFQDNRetryTime = cfgGetItem(pCfg, "resolveFQDNRetryTime")->i32; tsMinDiskFreeSize = cfgGetItem(pCfg, "minDiskFreeSize")->i64; + tsS3BlockSize = cfgGetItem(pCfg, "s3BlockSize")->i32; + tsS3BlockCacheSize = cfgGetItem(pCfg, "s3BlockCacheSize")->i32; + GRANT_CFG_GET; return 0; } @@ -1448,6 +1461,8 @@ int32_t taosApplyLocalCfg(SConfig *pCfg, char *name) { tqDebugFlag = cfgGetItem(pCfg, "tqDebugFlag")->i32; } else if (strcasecmp("ttlFlushThreshold", name) == 0) { tsTtlFlushThreshold = cfgGetItem(pCfg, "ttlFlushThreshold")->i32; + } else if (strcasecmp("timeseriesThreshold", name) == 0) { + tsTimeSeriesThreshold = cfgGetItem(pCfg, "timeseriesThreshold")->i32; } break; } @@ -1643,6 +1658,20 @@ void taosCfgDynamicOptions(const char *option, const char *value) { return; } + if (strcasecmp(option, "s3BlockSize") == 0) { + int32_t newS3BlockSize = atoi(value); + uInfo("s3BlockSize set from %d to %d", tsS3BlockSize, newS3BlockSize); + tsS3BlockSize = newS3BlockSize; + return; + } + + if (strcasecmp(option, "s3BlockCacheSize") == 0) { + int32_t newS3BlockCacheSize = atoi(value); + uInfo("s3BlockCacheSize set from %d to %d", tsS3BlockCacheSize, newS3BlockCacheSize); + tsS3BlockCacheSize = newS3BlockCacheSize; + return; + } + if (strcasecmp(option, "keepTimeOffset") == 0) { int32_t newKeepTimeOffset = atoi(value); uInfo("keepTimeOffset set from %d to %d", tsKeepTimeOffset, newKeepTimeOffset); diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index b4ce55b71d..a9f83cc21a 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -1035,6 +1035,68 @@ int32_t tDeserializeSMDropFullTextReq(void *buf, int32_t bufLen, SMDropFullTextR return 0; } +int32_t tSerializeSNotifyReq(void *buf, int32_t bufLen, SNotifyReq *pReq) { + SEncoder encoder = {0}; + tEncoderInit(&encoder, buf, bufLen); + + if (tStartEncode(&encoder) < 0) return -1; + + if (tEncodeI32(&encoder, pReq->dnodeId) < 0) return -1; + if (tEncodeI64(&encoder, pReq->clusterId) < 0) return -1; + + int32_t nVgroup = taosArrayGetSize(pReq->pVloads); + if (tEncodeI32(&encoder, nVgroup) < 0) return -1; + for (int32_t i = 0; i < nVgroup; ++i) { + SVnodeLoadLite *vload = TARRAY_GET_ELEM(pReq->pVloads, i); + if (tEncodeI32(&encoder, vload->vgId) < 0) return -1; + if (tEncodeI64(&encoder, vload->nTimeSeries) < 0) return -1; + } + + tEndEncode(&encoder); + + int32_t tlen = encoder.pos; + tEncoderClear(&encoder); + return tlen; +} + +int32_t tDeserializeSNotifyReq(void *buf, int32_t bufLen, SNotifyReq *pReq) { + int32_t code = TSDB_CODE_INVALID_MSG; + SDecoder decoder = {0}; + tDecoderInit(&decoder, buf, bufLen); + + if (tStartDecode(&decoder) < 0) goto _exit; + if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) goto _exit; + if (tDecodeI64(&decoder, &pReq->clusterId) < 0) goto _exit; + int32_t nVgroup = 0; + if (tDecodeI32(&decoder, &nVgroup) < 0) goto _exit; + if (nVgroup > 0) { + pReq->pVloads = taosArrayInit(nVgroup, sizeof(SVnodeLoadLite)); + if (!pReq->pVloads) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _exit; + } + for (int32_t i = 0; i < nVgroup; ++i) { + SVnodeLoadLite vload; + if (tDecodeI32(&decoder, &(vload.vgId)) < 0) goto _exit; + if (tDecodeI64(&decoder, &(vload.nTimeSeries)) < 0) goto _exit; + taosArrayPush(pReq->pVloads, &vload); + } + } + + code = 0; + +_exit: + tEndDecode(&decoder); + tDecoderClear(&decoder); + return code; +} + +void tFreeSNotifyReq(SNotifyReq *pReq) { + if (pReq) { + taosArrayDestroy(pReq->pVloads); + } +} + int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) { SEncoder encoder = {0}; tEncoderInit(&encoder, buf, bufLen); @@ -1652,7 +1714,7 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp) if (tEncodeI8(pEncoder, pRsp->superAuth) < 0) return -1; if (tEncodeI8(pEncoder, pRsp->sysInfo) < 0) return -1; if (tEncodeI8(pEncoder, pRsp->enable) < 0) return -1; - if (tEncodeI8(pEncoder, pRsp->reserve) < 0) return -1; + if (tEncodeI8(pEncoder, pRsp->dropped) < 0) return -1; if (tEncodeI32(pEncoder, pRsp->version) < 0) return -1; int32_t numOfCreatedDbs = taosHashGetSize(pRsp->createdDbs); @@ -1767,7 +1829,7 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs if (tDecodeI8(pDecoder, &pRsp->superAuth) < 0) goto _err; if (tDecodeI8(pDecoder, &pRsp->sysInfo) < 0) goto _err; if (tDecodeI8(pDecoder, &pRsp->enable) < 0) goto _err; - if (tDecodeI8(pDecoder, &pRsp->reserve) < 0) goto _err; + if (tDecodeI8(pDecoder, &pRsp->dropped) < 0) goto _err; if (tDecodeI32(pDecoder, &pRsp->version) < 0) goto _err; int32_t numOfCreatedDbs = 0; diff --git a/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h b/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h index 35947c001b..9e43c2af47 100644 --- a/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h +++ b/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h @@ -28,6 +28,7 @@ typedef struct SDnodeMgmt { const char *path; const char *name; TdThread statusThread; + TdThread notifyThread; TdThread monitorThread; TdThread crashReportThread; SSingleWorker mgmtWorker; @@ -36,6 +37,7 @@ typedef struct SDnodeMgmt { ProcessDropNodeFp processDropNodeFp; SendMonitorReportFp sendMonitorReportFp; GetVnodeLoadsFp getVnodeLoadsFp; + GetVnodeLoadsFp getVnodeLoadsLiteFp; GetMnodeLoadsFp getMnodeLoadsFp; GetQnodeLoadsFp getQnodeLoadsFp; int32_t statusSeq; @@ -44,17 +46,21 @@ typedef struct SDnodeMgmt { // dmHandle.c SArray *dmGetMsgHandles(); void dmSendStatusReq(SDnodeMgmt *pMgmt); +void dmSendNotifyReq(SDnodeMgmt *pMgmt); int32_t dmProcessConfigReq(SDnodeMgmt *pMgmt, SRpcMsg *pMsg); int32_t dmProcessAuthRsp(SDnodeMgmt *pMgmt, SRpcMsg *pMsg); int32_t dmProcessGrantRsp(SDnodeMgmt *pMgmt, SRpcMsg *pMsg); int32_t dmProcessServerRunStatus(SDnodeMgmt *pMgmt, SRpcMsg *pMsg); int32_t dmProcessRetrieve(SDnodeMgmt *pMgmt, SRpcMsg *pMsg); int32_t dmProcessGrantReq(void *pInfo, SRpcMsg *pMsg); +int32_t dmProcessGrantNotify(void *pInfo, SRpcMsg *pMsg); // dmWorker.c int32_t dmPutNodeMsgToMgmtQueue(SDnodeMgmt *pMgmt, SRpcMsg *pMsg); int32_t dmStartStatusThread(SDnodeMgmt *pMgmt); void dmStopStatusThread(SDnodeMgmt *pMgmt); +int32_t dmStartNotifyThread(SDnodeMgmt *pMgmt); +void dmStopNotifyThread(SDnodeMgmt *pMgmt); int32_t dmStartMonitorThread(SDnodeMgmt *pMgmt); void dmStopMonitorThread(SDnodeMgmt *pMgmt); int32_t dmStartCrashReportThread(SDnodeMgmt *pMgmt); diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index a56387079f..c7af552da4 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -170,6 +170,36 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) { dmProcessStatusRsp(pMgmt, &rpcRsp); } +void dmSendNotifyReq(SDnodeMgmt *pMgmt) { + SNotifyReq req = {0}; + + taosThreadRwlockRdlock(&pMgmt->pData->lock); + req.dnodeId = pMgmt->pData->dnodeId; + taosThreadRwlockUnlock(&pMgmt->pData->lock); + + req.clusterId = pMgmt->pData->clusterId; + + SMonVloadInfo vinfo = {0}; + (*pMgmt->getVnodeLoadsLiteFp)(&vinfo); + req.pVloads = vinfo.pVloads; + + int32_t contLen = tSerializeSNotifyReq(NULL, 0, &req); + void *pHead = rpcMallocCont(contLen); + tSerializeSNotifyReq(pHead, contLen, &req); + tFreeSNotifyReq(&req); + + SRpcMsg rpcMsg = {.pCont = pHead, + .contLen = contLen, + .msgType = TDMT_MND_NOTIFY, + .info.ahandle = (void *)0x9527, + .info.refId = 0, + .info.noResp = 1}; + + SEpSet epSet = {0}; + dmGetMnodeEpSet(pMgmt->pData, &epSet); + rpcSendRequest(pMgmt->msgCb.clientRpc, &epSet, &rpcMsg, NULL); +} + int32_t dmProcessAuthRsp(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) { dError("auth rsp is received, but not supported yet"); return 0; @@ -395,6 +425,7 @@ SArray *dmGetMsgHandles() { // Requests handled by MNODE if (dmSetMgmtHandle(pArray, TDMT_MND_GRANT, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_MND_GRANT_NOTIFY, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_AUTH_RSP, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER; code = 0; diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmInt.c b/source/dnode/mgmt/mgmt_dnode/src/dmInt.c index e754b08daf..966891feb8 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmInt.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmInt.c @@ -20,6 +20,11 @@ static int32_t dmStartMgmt(SDnodeMgmt *pMgmt) { if (dmStartStatusThread(pMgmt) != 0) { return -1; } +#ifdef TD_ENTERPRISE + if (dmStartNotifyThread(pMgmt) != 0) { + return -1; + } +#endif if (dmStartMonitorThread(pMgmt) != 0) { return -1; } @@ -33,6 +38,7 @@ static void dmStopMgmt(SDnodeMgmt *pMgmt) { pMgmt->pData->stopped = true; dmStopMonitorThread(pMgmt); dmStopStatusThread(pMgmt); + dmStopNotifyThread(pMgmt); dmStopCrashReportThread(pMgmt); } @@ -52,6 +58,7 @@ static int32_t dmOpenMgmt(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) { pMgmt->processDropNodeFp = pInput->processDropNodeFp; pMgmt->sendMonitorReportFp = pInput->sendMonitorReportFp; pMgmt->getVnodeLoadsFp = pInput->getVnodeLoadsFp; + pMgmt->getVnodeLoadsLiteFp = pInput->getVnodeLoadsLiteFp; pMgmt->getMnodeLoadsFp = pInput->getMnodeLoadsFp; pMgmt->getQnodeLoadsFp = pInput->getQnodeLoadsFp; diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c index 76cb65b53a..5b2bd0783a 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c @@ -53,6 +53,26 @@ static void *dmStatusThreadFp(void *param) { return NULL; } +tsem_t dmNotifySem; +static void *dmNotifyThreadFp(void *param) { + SDnodeMgmt *pMgmt = param; + int64_t lastTime = taosGetTimestampMs(); + setThreadName("dnode-notify"); + + if (tsem_init(&dmNotifySem, 0, 0) != 0) { + return NULL; + } + + while (1) { + if (pMgmt->pData->dropped || pMgmt->pData->stopped) break; + + tsem_wait(&dmNotifySem); + dmSendNotifyReq(pMgmt); + } + + return NULL; +} + static void *dmMonitorThreadFp(void *param) { SDnodeMgmt *pMgmt = param; int64_t lastTime = taosGetTimestampMs(); @@ -132,7 +152,6 @@ static void *dmCrashReportThreadFp(void *param) { return NULL; } - int32_t dmStartStatusThread(SDnodeMgmt *pMgmt) { TdThreadAttr thAttr; taosThreadAttrInit(&thAttr); @@ -154,6 +173,29 @@ void dmStopStatusThread(SDnodeMgmt *pMgmt) { } } +int32_t dmStartNotifyThread(SDnodeMgmt *pMgmt) { + TdThreadAttr thAttr; + taosThreadAttrInit(&thAttr); + taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE); + if (taosThreadCreate(&pMgmt->notifyThread, &thAttr, dmNotifyThreadFp, pMgmt) != 0) { + dError("failed to create notify thread since %s", strerror(errno)); + return -1; + } + + taosThreadAttrDestroy(&thAttr); + tmsgReportStartup("dnode-notify", "initialized"); + return 0; +} + +void dmStopNotifyThread(SDnodeMgmt *pMgmt) { + if (taosCheckPthreadValid(pMgmt->notifyThread)) { + tsem_post(&dmNotifySem); + taosThreadJoin(pMgmt->notifyThread, NULL); + taosThreadClear(&pMgmt->notifyThread); + } + tsem_destroy(&dmNotifySem); +} + int32_t dmStartMonitorThread(SDnodeMgmt *pMgmt) { TdThreadAttr thAttr; taosThreadAttrInit(&thAttr); @@ -251,6 +293,11 @@ static void dmProcessMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { case TDMT_MND_GRANT: code = dmProcessGrantReq(&pMgmt->pData->clusterId, pMsg); break; + case TDMT_MND_GRANT_NOTIFY: +#ifdef MAKE_JENKINS_HAPPY + code = dmProcessGrantNotify(NULL, pMsg); +#endif + break; default: terrno = TSDB_CODE_MSG_NOT_PROCESSED; dGError("msg:%p, not processed in mgmt queue", pMsg); diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c index 42eb89b5fb..3fc3ca4cea 100644 --- a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c +++ b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c @@ -178,6 +178,7 @@ SArray *mmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_MND_KILL_CONN, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_HEARTBEAT, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_STATUS, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_MND_NOTIFY, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_SYSTABLE_RETRIEVE, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_AUTH, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_SHOW_VARIABLES, mmPutMsgToReadQueue, 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 0251b9b636..a13c8fcc57 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -40,6 +40,28 @@ void vmGetVnodeLoads(SVnodeMgmt *pMgmt, SMonVloadInfo *pInfo, bool isReset) { taosThreadRwlockUnlock(&pMgmt->lock); } +void vmGetVnodeLoadsLite(SVnodeMgmt *pMgmt, SMonVloadInfo *pInfo) { + pInfo->pVloads = taosArrayInit(pMgmt->state.totalVnodes, sizeof(SVnodeLoadLite)); + if (!pInfo->pVloads) return; + + taosThreadRwlockRdlock(&pMgmt->lock); + + void *pIter = taosHashIterate(pMgmt->hash, NULL); + while (pIter) { + SVnodeObj **ppVnode = pIter; + if (ppVnode == NULL || *ppVnode == NULL) continue; + + SVnodeObj *pVnode = *ppVnode; + SVnodeLoadLite vload = {0}; + if (vnodeGetLoadLite(pVnode->pImpl, &vload) == 0) { + taosArrayPush(pInfo->pVloads, &vload); + } + pIter = taosHashIterate(pMgmt->hash, pIter); + } + + taosThreadRwlockUnlock(&pMgmt->lock); +} + void vmGetMonitorInfo(SVnodeMgmt *pMgmt, SMonVmInfo *pInfo) { SMonVloadInfo vloads = {0}; vmGetVnodeLoads(pMgmt, &vloads, true); diff --git a/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h b/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h index 98489433b9..1c6625ba1a 100644 --- a/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h +++ b/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h @@ -119,6 +119,7 @@ int32_t dmProcessNodeMsg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg); // dmMonitor.c void dmSendMonitorReport(); void dmGetVnodeLoads(SMonVloadInfo *pInfo); +void dmGetVnodeLoadsLite(SMonVloadInfo *pInfo); void dmGetMnodeLoads(SMonMloadInfo *pInfo); void dmGetQnodeLoads(SQnodeLoad *pInfo); diff --git a/source/dnode/mgmt/node_mgmt/inc/dmNodes.h b/source/dnode/mgmt/node_mgmt/inc/dmNodes.h index 5f36309038..7d635c6bdc 100644 --- a/source/dnode/mgmt/node_mgmt/inc/dmNodes.h +++ b/source/dnode/mgmt/node_mgmt/inc/dmNodes.h @@ -35,6 +35,7 @@ void smGetMonitorInfo(void *pMgmt, SMonSmInfo *pInfo); void bmGetMonitorInfo(void *pMgmt, SMonBmInfo *pInfo); void vmGetVnodeLoads(void *pMgmt, SMonVloadInfo *pInfo, bool isReset); +void vmGetVnodeLoadsLite(void *pMgmt, SMonVloadInfo *pInfo); void mmGetMnodeLoads(void *pMgmt, SMonMloadInfo *pInfo); void qmGetQnodeLoads(void *pMgmt, SQnodeLoad *pInfo); diff --git a/source/dnode/mgmt/node_mgmt/src/dmEnv.c b/source/dnode/mgmt/node_mgmt/src/dmEnv.c index 320c9db37d..8815647047 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmEnv.c +++ b/source/dnode/mgmt/node_mgmt/src/dmEnv.c @@ -419,6 +419,7 @@ SMgmtInputOpt dmBuildMgmtInputOpt(SMgmtWrapper *pWrapper) { .processDropNodeFp = dmProcessDropNodeReq, .sendMonitorReportFp = dmSendMonitorReport, .getVnodeLoadsFp = dmGetVnodeLoads, + .getVnodeLoadsLiteFp = dmGetVnodeLoadsLite, .getMnodeLoadsFp = dmGetMnodeLoads, .getQnodeLoadsFp = dmGetQnodeLoads, }; diff --git a/source/dnode/mgmt/node_mgmt/src/dmMonitor.c b/source/dnode/mgmt/node_mgmt/src/dmMonitor.c index 4ab56ed682..b3db7c3058 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmMonitor.c +++ b/source/dnode/mgmt/node_mgmt/src/dmMonitor.c @@ -119,6 +119,17 @@ void dmGetVnodeLoads(SMonVloadInfo *pInfo) { } } +void dmGetVnodeLoadsLite(SMonVloadInfo *pInfo) { + SDnode *pDnode = dmInstance(); + SMgmtWrapper *pWrapper = &pDnode->wrappers[VNODE]; + if (dmMarkWrapper(pWrapper) == 0) { + if (pWrapper->pMgmt != NULL) { + vmGetVnodeLoadsLite(pWrapper->pMgmt, pInfo); + } + dmReleaseWrapper(pWrapper); + } +} + void dmGetMnodeLoads(SMonMloadInfo *pInfo) { SDnode *pDnode = dmInstance(); SMgmtWrapper *pWrapper = &pDnode->wrappers[MNODE]; diff --git a/source/dnode/mgmt/node_util/inc/dmUtil.h b/source/dnode/mgmt/node_util/inc/dmUtil.h index ad87bc91c6..9d97e6ae9f 100644 --- a/source/dnode/mgmt/node_util/inc/dmUtil.h +++ b/source/dnode/mgmt/node_util/inc/dmUtil.h @@ -121,6 +121,7 @@ typedef struct { ProcessDropNodeFp processDropNodeFp; SendMonitorReportFp sendMonitorReportFp; GetVnodeLoadsFp getVnodeLoadsFp; + GetVnodeLoadsFp getVnodeLoadsLiteFp; GetMnodeLoadsFp getMnodeLoadsFp; GetQnodeLoadsFp getQnodeLoadsFp; } SMgmtInputOpt; diff --git a/source/dnode/mnode/impl/inc/mndSubscribe.h b/source/dnode/mnode/impl/inc/mndSubscribe.h index ba4328b8fe..10864da5fb 100644 --- a/source/dnode/mnode/impl/inc/mndSubscribe.h +++ b/source/dnode/mnode/impl/inc/mndSubscribe.h @@ -32,11 +32,11 @@ void mndReleaseSubscribe(SMnode *pMnode, SMqSubscribeObj *pSub); int32_t mndMakeSubscribeKey(char *key, const char *cgroup, const char *topicName); -static FORCE_INLINE int32_t mndMakePartitionKey(char *key, const char *cgroup, const char *topicName, int32_t vgId) { - return snprintf(key, TSDB_PARTITION_KEY_LEN, "%d:%s:%s", vgId, cgroup, topicName); -} +//static FORCE_INLINE int32_t mndMakePartitionKey(char *key, const char *cgroup, const char *topicName, int32_t vgId) { +// return snprintf(key, TSDB_PARTITION_KEY_LEN, "%d:%s:%s", vgId, cgroup, topicName); +//} -int32_t mndDropSubByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb); +//int32_t mndDropSubByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb); int32_t mndDropSubByTopic(SMnode *pMnode, STrans *pTrans, const char *topic); int32_t mndSetDropSubCommitLogs(SMnode *pMnode, STrans *pTrans, SMqSubscribeObj *pSub); diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index c1494fd0d0..7273e13317 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -311,6 +311,34 @@ static int32_t mndProcessMqTimerMsg(SRpcMsg *pMsg) { taosArrayPush(pRebSub->removedConsumers, &pConsumer->consumerId); } taosRUnLockLatch(&pConsumer->lock); + }else{ + int32_t newTopicNum = taosArrayGetSize(pConsumer->currentTopics); + for (int32_t i = 0; i < newTopicNum; i++) { + char * topic = taosArrayGetP(pConsumer->currentTopics, i); + SMqSubscribeObj *pSub = mndAcquireSubscribe(pMnode, pConsumer->cgroup, topic); + if (pSub == NULL) { + continue; + } + taosRLockLatch(&pSub->lock); + + // 2.2 iterate all vg assigned to the consumer of that topic + SMqConsumerEp *pConsumerEp = taosHashGet(pSub->consumerHash, &pConsumer->consumerId, sizeof(int64_t)); + int32_t vgNum = taosArrayGetSize(pConsumerEp->vgs); + + for (int32_t j = 0; j < vgNum; j++) { + SMqVgEp *pVgEp = taosArrayGetP(pConsumerEp->vgs, j); + SVgObj * pVgroup = mndAcquireVgroup(pMnode, pVgEp->vgId); + if (!pVgroup) { + char key[TSDB_SUBSCRIBE_KEY_LEN]; + mndMakeSubscribeKey(key, pConsumer->cgroup, topic); + mndGetOrCreateRebSub(pRebMsg->rebSubHash, key); + mInfo("vnode splitted, vgId:%d rebalance will be triggered", pVgEp->vgId); + } + mndReleaseVgroup(pMnode, pVgroup); + } + taosRUnLockLatch(&pSub->lock); + mndReleaseSubscribe(pMnode, pSub); + } } } else if (status == MQ_CONSUMER_STATUS_LOST) { if (hbStatus > MND_CONSUMER_LOST_CLEAR_THRESHOLD) { // clear consumer if lost a day @@ -343,7 +371,7 @@ static int32_t mndProcessMqTimerMsg(SRpcMsg *pMsg) { } if (taosHashGetSize(pRebMsg->rebSubHash) != 0) { - mInfo("mq rebalance will be triggered"); + mInfo("mq rebalance will be triggered"); SRpcMsg rpcMsg = { .msgType = TDMT_MND_TMQ_DO_REBALANCE, .pCont = pRebMsg, @@ -548,8 +576,8 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) { for (int32_t j = 0; j < vgNum; j++) { SMqVgEp *pVgEp = taosArrayGetP(pConsumerEp->vgs, j); - char offsetKey[TSDB_PARTITION_KEY_LEN]; - mndMakePartitionKey(offsetKey, pConsumer->cgroup, topic, pVgEp->vgId); +// char offsetKey[TSDB_PARTITION_KEY_LEN]; +// mndMakePartitionKey(offsetKey, pConsumer->cgroup, topic, pVgEp->vgId); if(epoch == -1){ SVgObj *pVgroup = mndAcquireVgroup(pMnode, pVgEp->vgId); diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index f38cf70dc6..a2c7f7b5cf 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -71,6 +71,7 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq); static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq); static int32_t mndProcessConfigDnodeRsp(SRpcMsg *pRsp); static int32_t mndProcessStatusReq(SRpcMsg *pReq); +static int32_t mndProcessNotifyReq(SRpcMsg *pReq); static int32_t mndProcessRestoreDnodeReq(SRpcMsg *pReq); static int32_t mndRetrieveConfigs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); @@ -80,6 +81,12 @@ static void mndCancelGetNextDnode(SMnode *pMnode, void *pIter); static int32_t mndMCfgGetValInt32(SMCfgDnodeReq *pInMCfgReq, int32_t opLen, int32_t *pOutValue); +#ifndef TD_ENTERPRISE +static int32_t mndUpdClusterInfo(SRpcMsg *pReq) { return 0; } +#else +int32_t mndUpdClusterInfo(SRpcMsg *pReq); +#endif + int32_t mndInitDnode(SMnode *pMnode) { SSdbTable table = { .sdbType = SDB_DNODE, @@ -97,6 +104,7 @@ int32_t mndInitDnode(SMnode *pMnode) { mndSetMsgHandle(pMnode, TDMT_MND_CONFIG_DNODE, mndProcessConfigDnodeReq); mndSetMsgHandle(pMnode, TDMT_DND_CONFIG_DNODE_RSP, mndProcessConfigDnodeRsp); mndSetMsgHandle(pMnode, TDMT_MND_STATUS, mndProcessStatusReq); + mndSetMsgHandle(pMnode, TDMT_MND_NOTIFY, mndProcessNotifyReq); mndSetMsgHandle(pMnode, TDMT_MND_DNODE_LIST, mndProcessDnodeListReq); mndSetMsgHandle(pMnode, TDMT_MND_SHOW_VARIABLES, mndProcessShowVariablesReq); mndSetMsgHandle(pMnode, TDMT_MND_RESTORE_DNODE, mndProcessRestoreDnodeReq); @@ -543,6 +551,10 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) { mGTrace("dnode:%d, status received, accessTimes:%d check:%d online:%d reboot:%d changed:%d statusSeq:%d", pDnode->id, pDnode->accessTimes, needCheck, online, reboot, dnodeChanged, statusReq.statusSeq); + if (reboot) { + tsGrantHBInterval = GRANT_HEART_BEAT_MIN; + } + for (int32_t v = 0; v < taosArrayGetSize(statusReq.pVloads); ++v) { SVnodeLoad *pVload = taosArrayGet(statusReq.pVloads, v); @@ -676,6 +688,45 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) { _OVER: mndReleaseDnode(pMnode, pDnode); taosArrayDestroy(statusReq.pVloads); +#ifdef MAKE_JENKINS_HAPPY + mndUpdClusterInfo(pReq); +#endif + return code; +} + +static int32_t mndProcessNotifyReq(SRpcMsg *pReq) { + SMnode *pMnode = pReq->info.node; + SNotifyReq notifyReq = {0}; + int32_t code = 0; + + if ((code = tDeserializeSNotifyReq(pReq->pCont, pReq->contLen, ¬ifyReq)) != 0) { + terrno = code; + goto _OVER; + } + + int64_t clusterid = mndGetClusterId(pMnode); + if (notifyReq.clusterId != 0 && notifyReq.clusterId != clusterid) { + code = TSDB_CODE_MND_DNODE_DIFF_CLUSTER; + mWarn("dnode:%d, its clusterid:%" PRId64 " differ from current cluster:%" PRId64 " since %s", notifyReq.dnodeId, + notifyReq.clusterId, clusterid, tstrerror(code)); + goto _OVER; + } + + int32_t nVgroup = taosArrayGetSize(notifyReq.pVloads); + for (int32_t v = 0; v < nVgroup; ++v) { + SVnodeLoadLite *pVload = taosArrayGet(notifyReq.pVloads, v); + + SVgObj *pVgroup = mndAcquireVgroup(pMnode, pVload->vgId); + if (pVgroup != NULL) { + pVgroup->numOfTimeSeries = pVload->nTimeSeries; + mndReleaseVgroup(pMnode, pVgroup); + } + } +_OVER: +#ifdef MAKE_JENKINS_HAPPY + mndUpdClusterInfo(pReq); +#endif + tFreeSNotifyReq(¬ifyReq); return code; } diff --git a/source/dnode/mnode/impl/src/mndPrivilege.c b/source/dnode/mnode/impl/src/mndPrivilege.c index 2769c3ac4c..c59f364f02 100644 --- a/source/dnode/mnode/impl/src/mndPrivilege.c +++ b/source/dnode/mnode/impl/src/mndPrivilege.c @@ -35,7 +35,6 @@ int32_t mndCheckTopicPrivilegeByName(SMnode *pMnode, const char *user, EOperType } -// TODO: for community version use the commented version int32_t mndSetUserWhiteListRsp(SMnode *pMnode, SUserObj *pUser, SGetUserWhiteListRsp *pWhiteListRsp) { memcpy(pWhiteListRsp->user, pUser->user, TSDB_USER_LEN); pWhiteListRsp->numWhiteLists = 1; @@ -43,14 +42,26 @@ int32_t mndSetUserWhiteListRsp(SMnode *pMnode, SUserObj *pUser, SGetUserWhiteLis if (pWhiteListRsp->pWhiteLists == NULL) { return TSDB_CODE_OUT_OF_MEMORY; } - memset(pWhiteListRsp->pWhiteLists, 0, pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range)); - // pWhiteListRsp->numWhiteLists = pUser->pIpWhiteList->num; - // pWhiteListRsp->pWhiteLists = taosMemoryMalloc(pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range)); - // if (pWhiteListRsp->pWhiteLists == NULL) { - // return TSDB_CODE_OUT_OF_MEMORY; - // } - // memcpy(pWhiteListRsp->pWhiteLists, pUser->pIpWhiteList->pIpRange, - // pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range)); + memset(pWhiteListRsp->pWhiteLists, 0, pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range)); + +// if (tsEnableWhiteList) { +// memcpy(pWhiteListRsp->user, pUser->user, TSDB_USER_LEN); +// pWhiteListRsp->numWhiteLists = pUser->pIpWhiteList->num; +// pWhiteListRsp->pWhiteLists = taosMemoryMalloc(pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range)); +// if (pWhiteListRsp->pWhiteLists == NULL) { +// return TSDB_CODE_OUT_OF_MEMORY; +// } +// memcpy(pWhiteListRsp->pWhiteLists, pUser->pIpWhiteList->pIpRange, +// pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range)); +// } else { +// memcpy(pWhiteListRsp->user, pUser->user, TSDB_USER_LEN); +// pWhiteListRsp->numWhiteLists = 1; +// pWhiteListRsp->pWhiteLists = taosMemoryMalloc(pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range)); +// if (pWhiteListRsp->pWhiteLists == NULL) { +// return TSDB_CODE_OUT_OF_MEMORY; +// } +// memset(pWhiteListRsp->pWhiteLists, 0, pWhiteListRsp->numWhiteLists * sizeof(SIpV4Range)); +// } return 0; } diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index d0a242c8ea..c47c4994b7 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -1678,6 +1678,10 @@ static int32_t mndAddSuperTableColumn(const SStbObj *pOld, SStbObj *pNew, SArray return -1; } + if ((terrno = grantCheck(TSDB_GRANT_TIMESERIES)) != 0) { + return -1; + } + pNew->numOfColumns = pNew->numOfColumns + ncols; if (mndAllocStbSchemas(pOld, pNew) != 0) { return -1; diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index ae58eeee35..408b664e50 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -361,8 +361,71 @@ static void transferVgroupsForConsumers(SMqRebOutputObj *pOutput, SHashObj *pHas } } +static int32_t processRemoveAddVgs(SMnode *pMnode, SMqRebOutputObj *pOutput){ + int32_t totalVgNum = 0; + SVgObj* pVgroup = NULL; + void* pIter = NULL; + SArray* newVgs = taosArrayInit(0, POINTER_BYTES); + while (1) { + pIter = sdbFetch(pMnode->pSdb, SDB_VGROUP, pIter, (void**)&pVgroup); + if (pIter == NULL) { + break; + } + + if (!mndVgroupInDb(pVgroup, pOutput->pSub->dbUid)) { + sdbRelease(pMnode->pSdb, pVgroup); + continue; + } + + totalVgNum++; + SMqVgEp* pVgEp = taosMemoryMalloc(sizeof(SMqVgEp)); + pVgEp->epSet = mndGetVgroupEpset(pMnode, pVgroup); + pVgEp->vgId = pVgroup->vgId; + taosArrayPush(newVgs, &pVgEp); + sdbRelease(pMnode->pSdb, pVgroup); + } + + pIter = NULL; + while (1) { + pIter = taosHashIterate(pOutput->pSub->consumerHash, pIter); + if (pIter == NULL) break; + SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter; + + int32_t j = 0; + while (j < taosArrayGetSize(pConsumerEp->vgs)) { + SMqVgEp *pVgEp = taosArrayGetP(pConsumerEp->vgs, j); + bool find = false; + for(int32_t k = 0; k < taosArrayGetSize(newVgs); k++){ + SMqVgEp *pnewVgEp = taosArrayGetP(newVgs, k); + if(pVgEp->vgId == pnewVgEp->vgId){ + tDeleteSMqVgEp(pnewVgEp); + taosArrayRemove(newVgs, k); + find = true; + break; + } + } + if(!find){ + mInfo("processRemoveAddVgs old vgId:%d", pVgEp->vgId); + tDeleteSMqVgEp(pVgEp); + taosArrayRemove(pConsumerEp->vgs, j); + continue; + } + j++; + } + } + + if(taosArrayGetSize(pOutput->pSub->unassignedVgs) == 0 && taosArrayGetSize(newVgs) != 0){ + taosArrayAddAll(pOutput->pSub->unassignedVgs, newVgs); + mInfo("processRemoveAddVgs add new vg num:%d", (int)taosArrayGetSize(newVgs)); + taosArrayDestroy(newVgs); + }else{ + taosArrayDestroyP(newVgs, (FDelete)tDeleteSMqVgEp); + } + return totalVgNum; +} + static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqRebOutputObj *pOutput) { - int32_t totalVgNum = pOutput->pSub->vgNum; + int32_t totalVgNum = processRemoveAddVgs(pMnode, pOutput); const char *pSubKey = pOutput->pSub->key; int32_t numOfRemoved = taosArrayGetSize(pInput->pRebInfo->removedConsumers); @@ -771,6 +834,29 @@ static int32_t mndProcessRebalanceReq(SRpcMsg *pMsg) { return 0; } +static int32_t sendDeleteSubToVnode(SMqSubscribeObj *pSub, STrans *pTrans){ + // iter all vnode to delete handle + int32_t sz = taosArrayGetSize(pSub->unassignedVgs); + for (int32_t i = 0; i < sz; i++) { + SMqVgEp *pVgEp = taosArrayGetP(pSub->unassignedVgs, i); + SMqVDeleteReq *pReq = taosMemoryCalloc(1, sizeof(SMqVDeleteReq)); + pReq->head.vgId = htonl(pVgEp->vgId); + pReq->vgId = pVgEp->vgId; + pReq->consumerId = -1; + memcpy(pReq->subKey, pSub->key, TSDB_SUBSCRIBE_KEY_LEN); + STransAction action = {0}; + action.epSet = pVgEp->epSet; + action.pCont = pReq; + action.contLen = sizeof(SMqVDeleteReq); + action.msgType = TDMT_VND_TMQ_DELETE_SUB; + if (mndTransAppendRedoAction(pTrans, &action) != 0) { + taosMemoryFree(pReq); + return -1; + } + } + return 0; +} + static int32_t mndProcessDropCgroupReq(SRpcMsg *pMsg) { SMnode *pMnode = pMsg->info.node; SMDropCgroupReq dropReq = {0}; @@ -831,6 +917,11 @@ static int32_t mndProcessDropCgroupReq(SRpcMsg *pMsg) { mInfo("trans:%d, used to drop cgroup:%s on topic %s", pTrans->id, dropReq.cgroup, dropReq.topic); + code = sendDeleteSubToVnode(pSub, pTrans); + if (code != 0) { + goto end; + } + if (mndSetDropSubCommitLogs(pMnode, pTrans, pSub) < 0) { mError("cgroup %s on topic:%s, failed to drop since %s", dropReq.cgroup, dropReq.topic, terrstr()); code = -1; @@ -1065,33 +1156,33 @@ int32_t mndSetDropSubCommitLogs(SMnode *pMnode, STrans *pTrans, SMqSubscribeObj return 0; } -int32_t mndDropSubByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) { - int32_t code = 0; - SSdb *pSdb = pMnode->pSdb; - - void *pIter = NULL; - SMqSubscribeObj *pSub = NULL; - while (1) { - pIter = sdbFetch(pSdb, SDB_SUBSCRIBE, pIter, (void **)&pSub); - if (pIter == NULL) break; - - if (pSub->dbUid != pDb->uid) { - sdbRelease(pSdb, pSub); - continue; - } - - if (mndSetDropSubCommitLogs(pMnode, pTrans, pSub) < 0) { - sdbRelease(pSdb, pSub); - sdbCancelFetch(pSdb, pIter); - code = -1; - break; - } - - sdbRelease(pSdb, pSub); - } - - return code; -} +//int32_t mndDropSubByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) { +// int32_t code = 0; +// SSdb *pSdb = pMnode->pSdb; +// +// void *pIter = NULL; +// SMqSubscribeObj *pSub = NULL; +// while (1) { +// pIter = sdbFetch(pSdb, SDB_SUBSCRIBE, pIter, (void **)&pSub); +// if (pIter == NULL) break; +// +// if (pSub->dbUid != pDb->uid) { +// sdbRelease(pSdb, pSub); +// continue; +// } +// +// if (mndSetDropSubCommitLogs(pMnode, pTrans, pSub) < 0) { +// sdbRelease(pSdb, pSub); +// sdbCancelFetch(pSdb, pIter); +// code = -1; +// break; +// } +// +// sdbRelease(pSdb, pSub); +// } +// +// return code; +//} int32_t mndDropSubByTopic(SMnode *pMnode, STrans *pTrans, const char *topicName) { SSdb *pSdb = pMnode->pSdb; @@ -1117,25 +1208,10 @@ int32_t mndDropSubByTopic(SMnode *pMnode, STrans *pTrans, const char *topicName) sdbCancelFetch(pSdb, pIter); return -1; } - int32_t sz = taosArrayGetSize(pSub->unassignedVgs); - for (int32_t i = 0; i < sz; i++) { - SMqVgEp *pVgEp = taosArrayGetP(pSub->unassignedVgs, i); - SMqVDeleteReq *pReq = taosMemoryCalloc(1, sizeof(SMqVDeleteReq)); - pReq->head.vgId = htonl(pVgEp->vgId); - pReq->vgId = pVgEp->vgId; - pReq->consumerId = -1; - memcpy(pReq->subKey, pSub->key, TSDB_SUBSCRIBE_KEY_LEN); - STransAction action = {0}; - action.epSet = pVgEp->epSet; - action.pCont = pReq; - action.contLen = sizeof(SMqVDeleteReq); - action.msgType = TDMT_VND_TMQ_DELETE_SUB; - if (mndTransAppendRedoAction(pTrans, &action) != 0) { - taosMemoryFree(pReq); - sdbRelease(pSdb, pSub); - sdbCancelFetch(pSdb, pIter); - return -1; - } + if (sendDeleteSubToVnode(pSub, pTrans) != 0) { + sdbRelease(pSdb, pSub); + sdbCancelFetch(pSdb, pIter); + return -1; } if (mndSetDropSubRedoLogs(pMnode, pTrans, pSub) < 0) { diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index a82623ae1b..138820a3b8 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -2289,6 +2289,11 @@ int32_t mndValidateUserAuthInfo(SMnode *pMnode, SUserAuthVersion *pUsers, int32_ for (int32_t i = 0; i < numOfUses; ++i) { SUserObj *pUser = mndAcquireUser(pMnode, pUsers[i].user); if (pUser == NULL) { + if (TSDB_CODE_MND_USER_NOT_EXIST == terrno) { + SGetUserAuthRsp rsp = {.dropped = 1}; + memcpy(rsp.user, pUsers[i].user, TSDB_USER_LEN); + taosArrayPush(batchRsp.pArray, &rsp); + } mError("user:%s, failed to auth user since %s", pUsers[i].user, terrstr()); continue; } diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index d819b71f18..9d27a27365 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -2672,14 +2672,14 @@ int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj *pVgro SDbObj dbObj = {0}; SArray *pArray = mndBuildDnodesArray(pMnode, 0); - int32_t numOfTopics = 0; - if (mndGetNumOfTopics(pMnode, pDb->name, &numOfTopics) != 0) { - goto _OVER; - } - if (numOfTopics > 0) { - terrno = TSDB_CODE_MND_TOPIC_MUST_BE_DELETED; - goto _OVER; - } +// int32_t numOfTopics = 0; +// if (mndGetNumOfTopics(pMnode, pDb->name, &numOfTopics) != 0) { +// goto _OVER; +// } +// if (numOfTopics > 0) { +// terrno = TSDB_CODE_MND_TOPIC_MUST_BE_DELETED; +// goto _OVER; +// } int32_t numOfStreams = 0; if (mndGetNumOfStreams(pMnode, pDb->name, &numOfStreams) != 0) { diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index b66d811284..84d54f3350 100644 --- a/source/dnode/vnode/CMakeLists.txt +++ b/source/dnode/vnode/CMakeLists.txt @@ -65,7 +65,8 @@ set( "src/tq/tqSink.c" "src/tq/tqCommit.c" "src/tq/tqStreamTask.c" - "src/tq/tqSnapshot.c" + "src/tq/tqHandleSnapshot.c" + "src/tq/tqCheckInfoSnapshot.c" "src/tq/tqOffsetSnapshot.c" "src/tq/tqStreamStateSnap.c" "src/tq/tqStreamTaskSnap.c" diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index e15f5f911d..727d790b91 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -86,11 +86,13 @@ void *vnodeGetIdx(void *pVnode); void *vnodeGetIvtIdx(void *pVnode); int32_t vnodeGetCtbNum(SVnode *pVnode, int64_t suid, int64_t *num); +int32_t vnodeGetStbColumnNum(SVnode *pVnode, tb_uid_t suid, int *num); int32_t vnodeGetTimeSeriesNum(SVnode *pVnode, int64_t *num); int32_t vnodeGetAllCtbNum(SVnode *pVnode, int64_t *num); void vnodeResetLoad(SVnode *pVnode, SVnodeLoad *pLoad); int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad); +int32_t vnodeGetLoadLite(SVnode *pVnode, SVnodeLoadLite *pLoad); int32_t vnodeValidateTableHash(SVnode *pVnode, char *tableFName); int32_t vnodePreProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg); @@ -134,7 +136,7 @@ bool metaTbInFilterCache(void *pVnode, tb_uid_t suid, int8_t type); int32_t metaPutTbToFilterCache(void *pVnode, tb_uid_t suid, int8_t type); int32_t metaSizeOfTbFilterCache(void *pVnode, int8_t type); -int32_t metaGetStbStats(void *pVnode, int64_t uid, int64_t *numOfTables); +int32_t metaGetStbStats(void *pVnode, int64_t uid, int64_t *numOfTables, int32_t *numOfCols); // tsdb typedef struct STsdbReader STsdbReader; @@ -288,10 +290,10 @@ typedef struct { int64_t numOfSTables; int64_t numOfCTables; int64_t numOfNTables; - int64_t numOfCmprTables; + int64_t numOfReportedTimeSeries; int64_t numOfNTimeSeries; int64_t numOfTimeSeries; - int64_t itvTimeSeries; + // int64_t itvTimeSeries; int64_t pointsWritten; int64_t totalStorage; int64_t compStorage; diff --git a/source/dnode/vnode/src/inc/meta.h b/source/dnode/vnode/src/inc/meta.h index 4f25bf31a2..c74ccf6c11 100644 --- a/source/dnode/vnode/src/inc/meta.h +++ b/source/dnode/vnode/src/inc/meta.h @@ -71,7 +71,7 @@ int32_t metaCacheDrop(SMeta* pMeta, int64_t uid); int32_t metaStatsCacheUpsert(SMeta* pMeta, SMetaStbStats* pInfo); int32_t metaStatsCacheDrop(SMeta* pMeta, int64_t uid); int32_t metaStatsCacheGet(SMeta* pMeta, int64_t uid, SMetaStbStats* pInfo); -void metaUpdateStbStats(SMeta* pMeta, int64_t uid, int64_t delta); +void metaUpdateStbStats(SMeta* pMeta, int64_t uid, int64_t deltaCtb, int32_t deltaCol); int32_t metaUidFilterCacheGet(SMeta* pMeta, uint64_t suid, const void* pKey, int32_t keyLen, LRUHandle** pHandle); struct SMeta { diff --git a/source/dnode/vnode/src/inc/tq.h b/source/dnode/vnode/src/inc/tq.h index 72310f6b19..ee96e602d8 100644 --- a/source/dnode/vnode/src/inc/tq.h +++ b/source/dnode/vnode/src/inc/tq.h @@ -134,7 +134,7 @@ int32_t tqMetaOpen(STQ* pTq); int32_t tqMetaClose(STQ* pTq); int32_t tqMetaSaveHandle(STQ* pTq, const char* key, const STqHandle* pHandle); int32_t tqMetaDeleteHandle(STQ* pTq, const char* key); -int32_t tqMetaRestoreHandle(STQ* pTq); +//int32_t tqMetaRestoreHandle(STQ* pTq); int32_t tqMetaSaveCheckInfo(STQ* pTq, const char* key, const void* value, int32_t vLen); int32_t tqMetaDeleteCheckInfo(STQ* pTq, const char* key); int32_t tqMetaRestoreCheckInfo(STQ* pTq); diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index ab6a7fb88b..edcce83a05 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -380,6 +380,8 @@ struct STsdb { TdThreadMutex lruMutex; SLRUCache *biCache; TdThreadMutex biMutex; + SLRUCache *bCache; + TdThreadMutex bMutex; struct STFileSystem *pFS; // new SRocksCache rCache; }; @@ -643,13 +645,19 @@ struct SRowMerger { }; typedef struct { - char *path; - int32_t szPage; - int32_t flag; - TdFilePtr pFD; - int64_t pgno; - uint8_t *pBuf; - int64_t szFile; + char *path; + int32_t szPage; + int32_t flag; + TdFilePtr pFD; + int64_t pgno; + uint8_t *pBuf; + int64_t szFile; + STsdb *pTsdb; + const char *objName; + uint8_t s3File; + int32_t fid; + int64_t cid; + int64_t blkno; } STsdbFD; struct SDelFWriter { @@ -716,9 +724,9 @@ typedef struct SSttBlockLoadCostInfo { } SSttBlockLoadCostInfo; typedef struct SSttBlockLoadInfo { - SBlockData blockData[2]; // buffered block data - int32_t statisBlockIndex; // buffered statistics block index - void *statisBlock; // buffered statistics block data + SBlockData blockData[2]; // buffered block data + int32_t statisBlockIndex; // buffered statistics block index + void *statisBlock; // buffered statistics block data void *pSttStatisBlkArray; SArray *aSttBlk; int32_t blockIndex[2]; // to denote the loaded block in the corresponding position. @@ -861,6 +869,9 @@ int32_t tsdbCacheRelease(SLRUCache *pCache, LRUHandle *h); int32_t tsdbCacheGetBlockIdx(SLRUCache *pCache, SDataFReader *pFileReader, LRUHandle **handle); int32_t tsdbBICacheRelease(SLRUCache *pCache, LRUHandle *h); +int32_t tsdbCacheGetBlockS3(SLRUCache *pCache, STsdbFD *pFD, LRUHandle **handle); +int32_t tsdbBCacheRelease(SLRUCache *pCache, LRUHandle *h); + int32_t tsdbCacheDeleteLastrow(SLRUCache *pCache, tb_uid_t uid, TSKEY eKey); int32_t tsdbCacheDeleteLast(SLRUCache *pCache, tb_uid_t uid, TSKEY eKey); int32_t tsdbCacheDelete(SLRUCache *pCache, tb_uid_t uid, TSKEY eKey); diff --git a/source/dnode/vnode/src/inc/vndCos.h b/source/dnode/vnode/src/inc/vndCos.h index 51d214518a..bb4d284f0e 100644 --- a/source/dnode/vnode/src/inc/vndCos.h +++ b/source/dnode/vnode/src/inc/vndCos.h @@ -22,15 +22,21 @@ extern "C" { #endif -extern int8_t tsS3Enabled; +#define S3_BLOCK_CACHE + +extern int8_t tsS3Enabled; +extern int32_t tsS3BlockSize; +extern int32_t tsS3BlockCacheSize; int32_t s3Init(); void s3CleanUp(); int32_t s3PutObjectFromFile(const char *file, const char *object); +int32_t s3PutObjectFromFile2(const char *file, const char *object); void s3DeleteObjectsByPrefix(const char *prefix); void s3DeleteObjects(const char *object_name[], int nobject); bool s3Exists(const char *object_name); bool s3Get(const char *object_name, const char *path); +int32_t s3GetObjectBlock(const char *object_name, int64_t offset, int64_t size, uint8_t **ppBlock); void s3EvictCache(const char *path, long object_size); long s3Size(const char *object_name); diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index 536273c044..2952c863cb 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -69,6 +69,8 @@ typedef struct STqSnapReader STqSnapReader; typedef struct STqSnapWriter STqSnapWriter; typedef struct STqOffsetReader STqOffsetReader; typedef struct STqOffsetWriter STqOffsetWriter; +typedef struct STqCheckInfoReader STqCheckInfoReader; +typedef struct STqCheckInfoWriter STqCheckInfoWriter; typedef struct SStreamTaskReader SStreamTaskReader; typedef struct SStreamTaskWriter SStreamTaskWriter; typedef struct SStreamStateReader SStreamStateReader; @@ -168,7 +170,8 @@ int32_t metaTbGroupCacheClear(SMeta* pMeta, uint64_t suid); int metaAddIndexToSTable(SMeta* pMeta, int64_t version, SVCreateStbReq* pReq); int metaDropIndexFromSTable(SMeta* pMeta, int64_t version, SDropIndexReq* pReq); -int64_t metaGetTimeSeriesNum(SMeta* pMeta); +int64_t metaGetTimeSeriesNum(SMeta* pMeta, int type); +void metaUpdTimeSeriesNum(SMeta* pMeta); SMCtbCursor* metaOpenCtbCursor(void* pVnode, tb_uid_t uid, int lock); int32_t metaResumeCtbCursor(SMCtbCursor* pCtbCur, int8_t first); void metaPauseCtbCursor(SMCtbCursor* pCtbCur); @@ -308,6 +311,14 @@ int32_t tqSnapRead(STqSnapReader* pReader, uint8_t** ppData); int32_t tqSnapWriterOpen(STQ* pTq, int64_t sver, int64_t ever, STqSnapWriter** ppWriter); int32_t tqSnapWriterClose(STqSnapWriter** ppWriter, int8_t rollback); int32_t tqSnapWrite(STqSnapWriter* pWriter, uint8_t* pData, uint32_t nData); +// STqCheckInfoshotReader == +int32_t tqCheckInfoReaderOpen(STQ* pTq, int64_t sver, int64_t ever, STqCheckInfoReader** ppReader); +int32_t tqCheckInfoReaderClose(STqCheckInfoReader** ppReader); +int32_t tqCheckInfoRead(STqCheckInfoReader* pReader, uint8_t** ppData); +// STqCheckInfoshotWriter ====================================== +int32_t tqCheckInfoWriterOpen(STQ* pTq, int64_t sver, int64_t ever, STqCheckInfoWriter** ppWriter); +int32_t tqCheckInfoWriterClose(STqCheckInfoWriter** ppWriter, int8_t rollback); +int32_t tqCheckInfoWrite(STqCheckInfoWriter* pWriter, uint8_t* pData, uint32_t nData); // STqOffsetReader ======================================== int32_t tqOffsetReaderOpen(STQ* pTq, int64_t sver, int64_t ever, STqOffsetReader** ppReader); int32_t tqOffsetReaderClose(STqOffsetReader** ppReader); @@ -503,6 +514,7 @@ enum { SNAP_DATA_STREAM_TASK_CHECKPOINT = 10, SNAP_DATA_STREAM_STATE = 11, SNAP_DATA_STREAM_STATE_BACKEND = 12, + SNAP_DATA_TQ_CHECKINFO = 13, }; struct SSnapDataHdr { diff --git a/source/dnode/vnode/src/meta/metaQuery.c b/source/dnode/vnode/src/meta/metaQuery.c index c74f36eaa2..2bf73198aa 100644 --- a/source/dnode/vnode/src/meta/metaQuery.c +++ b/source/dnode/vnode/src/meta/metaQuery.c @@ -696,22 +696,30 @@ int64_t metaGetTbNum(SMeta *pMeta) { return pMeta->pVnode->config.vndStats.numOfCTables + pMeta->pVnode->config.vndStats.numOfNTables; } -// N.B. Called by statusReq per second -int64_t metaGetTimeSeriesNum(SMeta *pMeta) { - // sum of (number of columns of stable - 1) * number of ctables (excluding timestamp column) - int64_t nTables = metaGetTbNum(pMeta); - if (nTables - pMeta->pVnode->config.vndStats.numOfCmprTables > 100 || - pMeta->pVnode->config.vndStats.numOfTimeSeries <= 0 || - ++pMeta->pVnode->config.vndStats.itvTimeSeries % (60 * 5) == 0) { - int64_t num = 0; - vnodeGetTimeSeriesNum(pMeta->pVnode, &num); - pMeta->pVnode->config.vndStats.numOfTimeSeries = num; +void metaUpdTimeSeriesNum(SMeta *pMeta) { + int64_t nCtbTimeSeries = 0; + if (vnodeGetTimeSeriesNum(pMeta->pVnode, &nCtbTimeSeries) == 0) { + atomic_store_64(&pMeta->pVnode->config.vndStats.numOfTimeSeries, nCtbTimeSeries); + } +} - pMeta->pVnode->config.vndStats.itvTimeSeries = (TD_VID(pMeta->pVnode) % 100) * 2; - pMeta->pVnode->config.vndStats.numOfCmprTables = nTables; +static FORCE_INLINE int64_t metaGetTimeSeriesNumImpl(SMeta *pMeta, bool forceUpd) { + // sum of (number of columns of stable - 1) * number of ctables (excluding timestamp column) + SVnodeStats *pStats = &pMeta->pVnode->config.vndStats; + if (forceUpd || pStats->numOfTimeSeries <= 0) { + metaUpdTimeSeriesNum(pMeta); } - return pMeta->pVnode->config.vndStats.numOfTimeSeries + pMeta->pVnode->config.vndStats.numOfNTimeSeries; + return pStats->numOfTimeSeries + pStats->numOfNTimeSeries; +} + +// type: 1 reported timeseries +int64_t metaGetTimeSeriesNum(SMeta *pMeta, int type) { + int64_t nTimeSeries = metaGetTimeSeriesNumImpl(pMeta, false); + if (type == 1) { + atomic_store_64(&pMeta->pVnode->config.vndStats.numOfReportedTimeSeries, nTimeSeries); + } + return nTimeSeries; } typedef struct { @@ -1509,9 +1517,10 @@ _exit: return code; } -int32_t metaGetStbStats(void *pVnode, int64_t uid, int64_t *numOfTables) { +int32_t metaGetStbStats(void *pVnode, int64_t uid, int64_t *numOfTables, int32_t *numOfCols) { int32_t code = 0; - *numOfTables = 0; + + if (!numOfTables && !numOfCols) goto _exit; SVnode *pVnodeObj = pVnode; metaRLock(pVnodeObj->pMeta); @@ -1520,19 +1529,26 @@ int32_t metaGetStbStats(void *pVnode, int64_t uid, int64_t *numOfTables) { SMetaStbStats state = {0}; if (metaStatsCacheGet(pVnodeObj->pMeta, uid, &state) == TSDB_CODE_SUCCESS) { metaULock(pVnodeObj->pMeta); - *numOfTables = state.ctbNum; + if (numOfTables) *numOfTables = state.ctbNum; + if (numOfCols) *numOfCols = state.colNum; + ASSERTS(state.colNum > 0, "vgId:%d, suid:%" PRIi64 " nCols:%d <= 0 in metaCache", TD_VID(pVnodeObj), uid, + state.colNum); goto _exit; } // slow path: search TDB int64_t ctbNum = 0; + int32_t colNum = 0; vnodeGetCtbNum(pVnode, uid, &ctbNum); - + vnodeGetStbColumnNum(pVnode, uid, &colNum); metaULock(pVnodeObj->pMeta); - *numOfTables = ctbNum; + + if (numOfTables) *numOfTables = ctbNum; + if (numOfCols) *numOfCols = colNum; state.uid = uid; state.ctbNum = ctbNum; + state.colNum = colNum; // upsert the cache metaWLock(pVnodeObj->pMeta); @@ -1543,12 +1559,12 @@ _exit: return code; } -void metaUpdateStbStats(SMeta *pMeta, int64_t uid, int64_t delta) { +void metaUpdateStbStats(SMeta *pMeta, int64_t uid, int64_t deltaCtb, int32_t deltaCol) { SMetaStbStats stats = {0}; if (metaStatsCacheGet(pMeta, uid, &stats) == TSDB_CODE_SUCCESS) { - stats.ctbNum += delta; - + stats.ctbNum += deltaCtb; + stats.colNum += deltaCol; metaStatsCacheUpsert(pMeta, &stats); } } diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c index 9a298a4bb7..0a25bdc9c7 100644 --- a/source/dnode/vnode/src/meta/metaTable.c +++ b/source/dnode/vnode/src/meta/metaTable.c @@ -15,6 +15,8 @@ #include "meta.h" +extern tsem_t dmNotifySem; + static int metaSaveJsonVarToIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSchema *pSchema); static int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSchema *pSchema); static int metaSaveToTbDb(SMeta *pMeta, const SMetaEntry *pME); @@ -26,7 +28,7 @@ static int metaSaveToSkmDb(SMeta *pMeta, const SMetaEntry *pME); static int metaUpdateCtbIdx(SMeta *pMeta, const SMetaEntry *pME); static int metaUpdateSuidIdx(SMeta *pMeta, const SMetaEntry *pME); static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry); -static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type); +static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *pSuid); static void metaDestroyTagIdxKey(STagIdxKey *pTagIdxKey); // opt ins_tables query static int metaUpdateBtimeIdx(SMeta *pMeta, const SMetaEntry *pME); @@ -34,6 +36,7 @@ static int metaDeleteBtimeIdx(SMeta *pMeta, const SMetaEntry *pME); static int metaUpdateNcolIdx(SMeta *pMeta, const SMetaEntry *pME); static int metaDeleteNcolIdx(SMeta *pMeta, const SMetaEntry *pME); + static void metaGetEntryInfo(const SMetaEntry *pEntry, SMetaInfo *pInfo) { pInfo->uid = pEntry->uid; pInfo->version = pEntry->version; @@ -191,6 +194,14 @@ int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSche return 0; } +static inline void metaTimeSeriesNotifyCheck(SMeta *pMeta) { +#ifdef TD_ENTERPRISE + int64_t nTimeSeries = metaGetTimeSeriesNum(pMeta, 0); + int64_t deltaTS = nTimeSeries - pMeta->pVnode->config.vndStats.numOfReportedTimeSeries; + if (deltaTS > tsTimeSeriesThreshold) tsem_post(&dmNotifySem); +#endif +} + int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) { SMetaEntry me = {0}; int kLen = 0; @@ -292,7 +303,7 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq, SArray *tb for (int32_t iChild = 0; iChild < taosArrayGetSize(tbUidList); iChild++) { tb_uid_t uid = *(tb_uid_t *)taosArrayGet(tbUidList, iChild); - metaDropTableByUid(pMeta, uid, NULL); + metaDropTableByUid(pMeta, uid, NULL, NULL); } // drop super table @@ -304,8 +315,12 @@ _drop_super_table: tdbTbDelete(pMeta->pUidIdx, &pReq->suid, sizeof(tb_uid_t), pMeta->txn); tdbTbDelete(pMeta->pSuidIdx, &pReq->suid, sizeof(tb_uid_t), pMeta->txn); + metaStatsCacheDrop(pMeta, pReq->suid); + metaULock(pMeta); + metaUpdTimeSeriesNum(pMeta); + _exit: tdbFree(pKey); tdbFree(pData); @@ -376,6 +391,8 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) { nStbEntry.stbEntry.schemaRow = pReq->schemaRow; nStbEntry.stbEntry.schemaTag = pReq->schemaTag; + int32_t deltaCol = pReq->schemaRow.nCols - oStbEntry.stbEntry.schemaRow.nCols; + metaWLock(pMeta); // compare two entry if (oStbEntry.stbEntry.schemaRow.version != pReq->schemaRow.version) { @@ -390,8 +407,18 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) { // metaStatsCacheDrop(pMeta, nStbEntry.uid); + if (deltaCol != 0) { + metaUpdateStbStats(pMeta, pReq->suid, 0, deltaCol); + } metaULock(pMeta); + if (deltaCol != 0) { + int64_t ctbNum; + metaGetStbStats(pMeta->pVnode, pReq->suid, &ctbNum, NULL); + pMeta->pVnode->config.vndStats.numOfTimeSeries += (ctbNum * deltaCol); + } + +_exit: if (oStbEntry.pBuf) taosMemoryFree(oStbEntry.pBuf); tDecoderClear(&dc); tdbTbcClose(pTbDbc); @@ -734,6 +761,7 @@ int metaCreateTable(SMeta *pMeta, int64_t ver, SVCreateTbReq *pReq, STableMetaRs metaReaderClear(&mr); // build SMetaEntry + SVnodeStats *pStats = &pMeta->pVnode->config.vndStats; me.version = ver; me.type = pReq->type; me.uid = pReq->uid; @@ -767,10 +795,13 @@ int metaCreateTable(SMeta *pMeta, int64_t ver, SVCreateTbReq *pReq, STableMetaRs } #endif - ++pMeta->pVnode->config.vndStats.numOfCTables; + ++pStats->numOfCTables; + int32_t nCols = 0; + metaGetStbStats(pMeta->pVnode, me.ctbEntry.suid, 0, &nCols); + pStats->numOfTimeSeries += nCols - 1; metaWLock(pMeta); - metaUpdateStbStats(pMeta, me.ctbEntry.suid, 1); + metaUpdateStbStats(pMeta, me.ctbEntry.suid, 1, 0); metaUidCacheClear(pMeta, me.ctbEntry.suid); metaTbGroupCacheClear(pMeta, me.ctbEntry.suid); metaULock(pMeta); @@ -782,12 +813,14 @@ int metaCreateTable(SMeta *pMeta, int64_t ver, SVCreateTbReq *pReq, STableMetaRs me.ntbEntry.schemaRow = pReq->ntb.schemaRow; me.ntbEntry.ncid = me.ntbEntry.schemaRow.pSchema[me.ntbEntry.schemaRow.nCols - 1].colId + 1; - ++pMeta->pVnode->config.vndStats.numOfNTables; - pMeta->pVnode->config.vndStats.numOfNTimeSeries += me.ntbEntry.schemaRow.nCols - 1; + ++pStats->numOfNTables; + pStats->numOfNTimeSeries += me.ntbEntry.schemaRow.nCols - 1; } if (metaHandleEntry(pMeta, &me) < 0) goto _err; + metaTimeSeriesNotifyCheck(pMeta); + if (pMetaRsp) { *pMetaRsp = taosMemoryCalloc(1, sizeof(STableMetaRsp)); @@ -817,7 +850,8 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq, SArray *tbUi void *pData = NULL; int nData = 0; int rc = 0; - tb_uid_t uid; + tb_uid_t uid = 0; + tb_uid_t suid = 0; int type; rc = tdbTbGet(pMeta->pNameIdx, pReq->name, strlen(pReq->name) + 1, &pData, &nData); @@ -828,9 +862,19 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq, SArray *tbUi uid = *(tb_uid_t *)pData; metaWLock(pMeta); - metaDropTableByUid(pMeta, uid, &type); + rc = metaDropTableByUid(pMeta, uid, &type, &suid); metaULock(pMeta); + if (rc < 0) goto _exit; + + if (type == TSDB_CHILD_TABLE) { + int32_t nCols = 0; + SVnodeStats *pStats = &pMeta->pVnode->config.vndStats; + if (metaGetStbStats(pMeta->pVnode, suid, NULL, &nCols) == 0) { + pStats->numOfTimeSeries -= nCols - 1; + } + } + if ((type == TSDB_CHILD_TABLE || type == TSDB_NORMAL_TABLE) && tbUids) { taosArrayPush(tbUids, &uid); } @@ -839,20 +883,48 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq, SArray *tbUi *tbUid = uid; } +_exit: tdbFree(pData); - return 0; + return rc; } void metaDropTables(SMeta *pMeta, SArray *tbUids) { if (taosArrayGetSize(tbUids) == 0) return; + int64_t nCtbDropped = 0; + SSHashObj *suidHash = tSimpleHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT)); + metaWLock(pMeta); for (int i = 0; i < taosArrayGetSize(tbUids); ++i) { tb_uid_t uid = *(tb_uid_t *)taosArrayGet(tbUids, i); - metaDropTableByUid(pMeta, uid, NULL); + tb_uid_t suid = 0; + int type; + metaDropTableByUid(pMeta, uid, &type, &suid); + if (type == TSDB_CHILD_TABLE && suid != 0 && suidHash) { + int64_t *pVal = tSimpleHashGet(suidHash, &suid, sizeof(tb_uid_t)); + if (pVal) { + nCtbDropped = *pVal + 1; + } else { + nCtbDropped = 1; + } + tSimpleHashPut(suidHash, &suid, sizeof(tb_uid_t), &nCtbDropped, sizeof(int64_t)); + } metaDebug("batch drop table:%" PRId64, uid); } metaULock(pMeta); + + // update timeseries + void *pCtbDropped = NULL; + int32_t iter = 0; + while ((pCtbDropped = tSimpleHashIterate(suidHash, pCtbDropped, &iter))) { + tb_uid_t *pSuid = tSimpleHashGetKey(pCtbDropped, NULL); + int32_t nCols = 0; + SVnodeStats *pStats = &pMeta->pVnode->config.vndStats; + if (metaGetStbStats(pMeta->pVnode, *pSuid, NULL, &nCols) == 0) { + pStats->numOfTimeSeries -= *(int64_t *)pCtbDropped * (nCols - 1); + } + } + tSimpleHashCleanup(suidHash); } static int32_t metaFilterTableByHash(SMeta *pMeta, SArray *uidList) { @@ -987,7 +1059,7 @@ static int metaDeleteTtl(SMeta *pMeta, const SMetaEntry *pME) { return ttlMgrDeleteTtl(pMeta->pTtlMgr, &ctx); } -static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) { +static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *pSuid) { void *pData = NULL; int nData = 0; int rc = 0; @@ -1012,9 +1084,11 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) { if (type) *type = e.type; if (e.type == TSDB_CHILD_TABLE) { + if (pSuid) *pSuid = e.ctbEntry.suid; void *tData = NULL; int tLen = 0; + if (tdbTbGet(pMeta->pUidIdx, &e.ctbEntry.suid, sizeof(tb_uid_t), &tData, &tLen) == 0) { STbDbKey tbDbKey = {.uid = e.ctbEntry.suid, .version = ((SUidIdxVal *)tData)[0].version}; if (tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &tData, &tLen) == 0) { @@ -1075,8 +1149,7 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) { tdbTbDelete(pMeta->pCtbIdx, &(SCtbIdxKey){.suid = e.ctbEntry.suid, .uid = uid}, sizeof(SCtbIdxKey), pMeta->txn); --pMeta->pVnode->config.vndStats.numOfCTables; - - metaUpdateStbStats(pMeta, e.ctbEntry.suid, -1); + metaUpdateStbStats(pMeta, e.ctbEntry.suid, -1, 0); metaUidCacheClear(pMeta, e.ctbEntry.suid); metaTbGroupCacheClear(pMeta, e.ctbEntry.suid); } else if (e.type == TSDB_NORMAL_TABLE) { @@ -1243,6 +1316,9 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl terrno = TSDB_CODE_VND_COL_ALREADY_EXISTS; goto _err; } + if ((terrno = grantCheck(TSDB_GRANT_TIMESERIES)) < 0) { + goto _err; + } pSchema->version++; pSchema->nCols++; pNewSchema = taosMemoryMalloc(sizeof(SSchema) * pSchema->nCols); @@ -1255,6 +1331,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl strcpy(pSchema->pSchema[entry.ntbEntry.schemaRow.nCols - 1].name, pAlterTbReq->colName); ++pMeta->pVnode->config.vndStats.numOfNTimeSeries; + metaTimeSeriesNotifyCheck(pMeta); break; case TSDB_ALTER_TABLE_DROP_COLUMN: if (pColumn == NULL) { diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 3aeb679eb7..adf3abe4d9 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -697,7 +697,9 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg tqDestroyTqHandle(&handle); goto end; } + taosWLockLatch(&pTq->lock); ret = tqMetaSaveHandle(pTq, req.subKey, &handle); + taosWUnLockLatch(&pTq->lock); } else { while(1){ taosWLockLatch(&pTq->lock); @@ -710,7 +712,7 @@ int32_t tqProcessSubscribeReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg continue; } if (pHandle->consumerId == req.newConsumerId) { // do nothing - tqInfo("vgId:%d no switch consumer:0x%" PRIx64 " remains, because redo wal log", req.vgId, req.newConsumerId); + tqInfo("vgId:%d no switch consumer:0x%" PRIx64 " remains", req.vgId, req.newConsumerId); } else { tqInfo("vgId:%d switch consumer from Id:0x%" PRIx64 " to Id:0x%" PRIx64, req.vgId, pHandle->consumerId, req.newConsumerId); diff --git a/source/dnode/vnode/src/tq/tqCheckInfoSnapshot.c b/source/dnode/vnode/src/tq/tqCheckInfoSnapshot.c new file mode 100644 index 0000000000..a3bd22eef0 --- /dev/null +++ b/source/dnode/vnode/src/tq/tqCheckInfoSnapshot.c @@ -0,0 +1,196 @@ +/* + * 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 "meta.h" +#include "tdbInt.h" +#include "tq.h" + +// STqCheckInfoReader ======================================== +struct STqCheckInfoReader { + STQ* pTq; + int64_t sver; + int64_t ever; + TBC* pCur; +}; + +int32_t tqCheckInfoReaderOpen(STQ* pTq, int64_t sver, int64_t ever, STqCheckInfoReader** ppReader) { + int32_t code = 0; + STqCheckInfoReader* pReader = NULL; + + // alloc + pReader = (STqCheckInfoReader*)taosMemoryCalloc(1, sizeof(STqCheckInfoReader)); + if (pReader == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _err; + } + pReader->pTq = pTq; + pReader->sver = sver; + pReader->ever = ever; + + // impl + code = tdbTbcOpen(pTq->pCheckStore, &pReader->pCur, NULL); + if (code) { + taosMemoryFree(pReader); + goto _err; + } + + code = tdbTbcMoveToFirst(pReader->pCur); + if (code) { + taosMemoryFree(pReader); + goto _err; + } + + tqInfo("vgId:%d, vnode checkinfo tq reader opened", TD_VID(pTq->pVnode)); + + *ppReader = pReader; + return code; + +_err: + tqError("vgId:%d, vnode checkinfo tq reader open failed since %s", TD_VID(pTq->pVnode), tstrerror(code)); + *ppReader = NULL; + return code; +} + +int32_t tqCheckInfoReaderClose(STqCheckInfoReader** ppReader) { + int32_t code = 0; + + tdbTbcClose((*ppReader)->pCur); + taosMemoryFree(*ppReader); + *ppReader = NULL; + + return code; +} + +int32_t tqCheckInfoRead(STqCheckInfoReader* pReader, uint8_t** ppData) { + int32_t code = 0; + void* pKey = NULL; + void* pVal = NULL; + int32_t kLen = 0; + int32_t vLen = 0; + + if (tdbTbcNext(pReader->pCur, &pKey, &kLen, &pVal, &vLen)) { + goto _exit; + } + + *ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + vLen); + if (*ppData == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _err; + } + + SSnapDataHdr* pHdr = (SSnapDataHdr*)(*ppData); + pHdr->type = SNAP_DATA_TQ_CHECKINFO; + pHdr->size = vLen; + memcpy(pHdr->data, pVal, vLen); + +_exit: + tdbFree(pKey); + tdbFree(pVal); + + tqInfo("vgId:%d, vnode check info tq read data, vLen:%d", TD_VID(pReader->pTq->pVnode), vLen); + return code; + +_err: + tdbFree(pKey); + tdbFree(pVal); + + tqError("vgId:%d, vnode check info tq read data failed since %s", TD_VID(pReader->pTq->pVnode), tstrerror(code)); + return code; +} + +// STqCheckInfoWriter ======================================== +struct STqCheckInfoWriter { + STQ* pTq; + int64_t sver; + int64_t ever; + TXN* txn; +}; + +int32_t tqCheckInfoWriterOpen(STQ* pTq, int64_t sver, int64_t ever, STqCheckInfoWriter** ppWriter) { + int32_t code = 0; + STqCheckInfoWriter* pWriter; + + // alloc + pWriter = (STqCheckInfoWriter*)taosMemoryCalloc(1, sizeof(*pWriter)); + if (pWriter == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _err; + } + pWriter->pTq = pTq; + pWriter->sver = sver; + pWriter->ever = ever; + + if (tdbBegin(pTq->pMetaDB, &pWriter->txn, tdbDefaultMalloc, tdbDefaultFree, NULL, 0) < 0) { + code = -1; + taosMemoryFree(pWriter); + goto _err; + } + + *ppWriter = pWriter; + return code; + +_err: + tqError("vgId:%d, tq check info writer open failed since %s", TD_VID(pTq->pVnode), tstrerror(code)); + *ppWriter = NULL; + return code; +} + +int32_t tqCheckInfoWriterClose(STqCheckInfoWriter** ppWriter, int8_t rollback) { + int32_t code = 0; + STqCheckInfoWriter* pWriter = *ppWriter; + STQ* pTq = pWriter->pTq; + + if (rollback) { + tdbAbort(pWriter->pTq->pMetaDB, pWriter->txn); + } else { + code = tdbCommit(pWriter->pTq->pMetaDB, pWriter->txn); + if (code) goto _err; + code = tdbPostCommit(pWriter->pTq->pMetaDB, pWriter->txn); + if (code) goto _err; + } + + taosMemoryFree(pWriter); + *ppWriter = NULL; + + return code; + +_err: + tqError("vgId:%d, tq check info writer close failed since %s", TD_VID(pTq->pVnode), tstrerror(code)); + return code; +} + +int32_t tqCheckInfoWrite(STqCheckInfoWriter* pWriter, uint8_t* pData, uint32_t nData) { + int32_t code = 0; + STQ* pTq = pWriter->pTq; + STqCheckInfo info = {0}; + SDecoder decoder; + SDecoder* pDecoder = &decoder; + + tDecoderInit(pDecoder, pData + sizeof(SSnapDataHdr), nData - sizeof(SSnapDataHdr)); + code = tDecodeSTqCheckInfo(pDecoder, &info); + if (code) goto _err; + code = taosHashPut(pTq->pCheckInfo, info.topic, strlen(info.topic), &info, sizeof(STqCheckInfo)); + if (code) goto _err; + code = tqMetaSaveCheckInfo(pTq, info.topic, pData + sizeof(SSnapDataHdr), nData - sizeof(SSnapDataHdr)); + if (code) goto _err; + tDecoderClear(pDecoder); + + return code; + +_err: + tDecoderClear(pDecoder); + tqError("vgId:%d, vnode check info tq write failed since %s", TD_VID(pTq->pVnode), tstrerror(code)); + return code; +} diff --git a/source/dnode/vnode/src/tq/tqSnapshot.c b/source/dnode/vnode/src/tq/tqHandleSnapshot.c similarity index 78% rename from source/dnode/vnode/src/tq/tqSnapshot.c rename to source/dnode/vnode/src/tq/tqHandleSnapshot.c index 5c0649c109..3ce838ce8b 100644 --- a/source/dnode/vnode/src/tq/tqSnapshot.c +++ b/source/dnode/vnode/src/tq/tqHandleSnapshot.c @@ -75,29 +75,13 @@ int32_t tqSnapReaderClose(STqSnapReader** ppReader) { int32_t tqSnapRead(STqSnapReader* pReader, uint8_t** ppData) { int32_t code = 0; - const void* pKey = NULL; - const void* pVal = NULL; + void* pKey = NULL; + void* pVal = NULL; int32_t kLen = 0; int32_t vLen = 0; - SDecoder decoder; - STqHandle handle; - *ppData = NULL; - for (;;) { - if (tdbTbcGet(pReader->pCur, &pKey, &kLen, &pVal, &vLen)) { - goto _exit; - } - - tDecoderInit(&decoder, (uint8_t*)pVal, vLen); - tDecodeSTqHandle(&decoder, &handle); - tDecoderClear(&decoder); - - if (handle.snapshotVer <= pReader->sver && handle.snapshotVer >= pReader->ever) { - tdbTbcMoveToNext(pReader->pCur); - break; - } else { - tdbTbcMoveToNext(pReader->pCur); - } + if (tdbTbcNext(pReader->pCur, &pKey, &kLen, &pVal, &vLen)) { + goto _exit; } *ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + vLen); @@ -111,13 +95,15 @@ int32_t tqSnapRead(STqSnapReader* pReader, uint8_t** ppData) { pHdr->size = vLen; memcpy(pHdr->data, pVal, vLen); - tqInfo("vgId:%d, vnode snapshot tq read data, version:%" PRId64 " subKey: %s vLen:%d", TD_VID(pReader->pTq->pVnode), - handle.snapshotVer, handle.subKey, vLen); - _exit: + tdbFree(pKey); + tdbFree(pVal); + tqInfo("vgId:%d, vnode snapshot tq read data, vLen:%d", TD_VID(pReader->pTq->pVnode), vLen); return code; _err: + tdbFree(pKey); + tdbFree(pVal); tqError("vgId:%d, vnode snapshot tq read data failed since %s", TD_VID(pReader->pTq->pVnode), tstrerror(code)); return code; } @@ -173,20 +159,13 @@ int32_t tqSnapWriterClose(STqSnapWriter** ppWriter, int8_t rollback) { if (code) goto _err; } - int vgId = TD_VID(pWriter->pTq->pVnode); - taosMemoryFree(pWriter); *ppWriter = NULL; - // restore from metastore - if (tqMetaRestoreHandle(pTq) < 0) { - goto _err; - } - return code; _err: - tqError("vgId:%d, tq snapshot writer close failed since %s", vgId, tstrerror(code)); + tqError("vgId:%d, tq snapshot writer close failed since %s", TD_VID(pTq->pVnode), tstrerror(code)); return code; } @@ -195,19 +174,18 @@ int32_t tqSnapWrite(STqSnapWriter* pWriter, uint8_t* pData, uint32_t nData) { STQ* pTq = pWriter->pTq; SDecoder decoder = {0}; SDecoder* pDecoder = &decoder; - STqHandle handle; + STqHandle handle = {0}; tDecoderInit(pDecoder, pData + sizeof(SSnapDataHdr), nData - sizeof(SSnapDataHdr)); code = tDecodeSTqHandle(pDecoder, &handle); - if (code) goto _err; + if (code) goto end; + taosWLockLatch(&pTq->lock); code = tqMetaSaveHandle(pTq, handle.subKey, &handle); - if (code < 0) goto _err; - tDecoderClear(pDecoder); + taosWUnLockLatch(&pTq->lock); - return code; - -_err: +end: tDecoderClear(pDecoder); - tqError("vgId:%d, vnode snapshot tq write failed since %s", TD_VID(pTq->pVnode), tstrerror(code)); + tqDestroyTqHandle(&handle); + tqInfo("vgId:%d, vnode snapshot tq write result:%d", TD_VID(pTq->pVnode), code); return code; } diff --git a/source/dnode/vnode/src/tq/tqMeta.c b/source/dnode/vnode/src/tq/tqMeta.c index 154ac1e8c1..4c403dc18f 100644 --- a/source/dnode/vnode/src/tq/tqMeta.c +++ b/source/dnode/vnode/src/tq/tqMeta.c @@ -198,58 +198,51 @@ int32_t tqMetaRestoreCheckInfo(STQ* pTq) { int32_t tqMetaSaveHandle(STQ* pTq, const char* key, const STqHandle* pHandle) { int32_t code; int32_t vlen; + void* buf = NULL; + SEncoder encoder; tEncodeSize(tEncodeSTqHandle, pHandle, vlen, code); if (code < 0) { - return -1; + goto end; } tqDebug("tq save %s(%d) handle consumer:0x%" PRIx64 " epoch:%d vgId:%d", pHandle->subKey, (int32_t)strlen(pHandle->subKey), pHandle->consumerId, pHandle->epoch, TD_VID(pTq->pVnode)); - void* buf = taosMemoryCalloc(1, vlen); + buf = taosMemoryCalloc(1, vlen); if (buf == NULL) { - return -1; + code = TSDB_CODE_OUT_OF_MEMORY; + goto end; } - SEncoder encoder; + tEncoderInit(&encoder, buf, vlen); - if (tEncodeSTqHandle(&encoder, pHandle) < 0) { - tEncoderClear(&encoder); - taosMemoryFree(buf); - return -1; + code = tEncodeSTqHandle(&encoder, pHandle); + if (code < 0) { + goto end; } - TXN* txn; - - if (tdbBegin(pTq->pMetaDB, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED) < - 0) { - tEncoderClear(&encoder); - taosMemoryFree(buf); - return -1; + TXN* txn = NULL; + code = tdbBegin(pTq->pMetaDB, &txn, tdbDefaultMalloc, tdbDefaultFree, NULL, TDB_TXN_WRITE | TDB_TXN_READ_UNCOMMITTED); + if (code < 0) { + goto end; } - if (tdbTbUpsert(pTq->pExecStore, key, (int)strlen(key), buf, vlen, txn) < 0) { - tEncoderClear(&encoder); - taosMemoryFree(buf); - return -1; + code = tdbTbUpsert(pTq->pExecStore, key, (int)strlen(key), buf, vlen, txn); + if (code < 0) { + goto end; } - if (tdbCommit(pTq->pMetaDB, txn) < 0) { - tEncoderClear(&encoder); - taosMemoryFree(buf); - return -1; - } - - if (tdbPostCommit(pTq->pMetaDB, txn) < 0) { - tEncoderClear(&encoder); - taosMemoryFree(buf); - return -1; + code = tdbCommit(pTq->pMetaDB, txn); + if (code < 0) { + goto end; } + code = tdbPostCommit(pTq->pMetaDB, txn); +end: tEncoderClear(&encoder); taosMemoryFree(buf); - return 0; + return code; } int32_t tqMetaDeleteHandle(STQ* pTq, const char* key) { @@ -349,15 +342,18 @@ static int buildHandle(STQ* pTq, STqHandle* handle){ static int restoreHandle(STQ* pTq, void* pVal, int vLen, STqHandle* handle){ int32_t vgId = TD_VID(pTq->pVnode); SDecoder decoder; + int32_t code = 0; tDecoderInit(&decoder, (uint8_t*)pVal, vLen); - tDecodeSTqHandle(&decoder, handle); - tDecoderClear(&decoder); - - if(buildHandle(pTq, handle) < 0){ - return -1; - } + code = tDecodeSTqHandle(&decoder, handle); + if (code) goto end; + code = buildHandle(pTq, handle); + if (code) goto end; tqInfo("restoreHandle %s consumer 0x%" PRIx64 " vgId:%d", handle->subKey, handle->consumerId, vgId); - return taosHashPut(pTq->pHandle, handle->subKey, strlen(handle->subKey), handle, sizeof(STqHandle)); + code = taosHashPut(pTq->pHandle, handle->subKey, strlen(handle->subKey), handle, sizeof(STqHandle)); + +end: + tDecoderClear(&decoder); + return code; } int32_t tqCreateHandle(STQ* pTq, SMqRebVgReq* req, STqHandle* handle){ @@ -388,34 +384,34 @@ int32_t tqCreateHandle(STQ* pTq, SMqRebVgReq* req, STqHandle* handle){ return taosHashPut(pTq->pHandle, handle->subKey, strlen(handle->subKey), handle, sizeof(STqHandle)); } -int32_t tqMetaRestoreHandle(STQ* pTq) { - int code = 0; - TBC* pCur = NULL; - if (tdbTbcOpen(pTq->pExecStore, &pCur, NULL) < 0) { - return -1; - } - - void* pKey = NULL; - int kLen = 0; - void* pVal = NULL; - int vLen = 0; - - tdbTbcMoveToFirst(pCur); - - while (tdbTbcNext(pCur, &pKey, &kLen, &pVal, &vLen) == 0) { - STqHandle handle = {0}; - code = restoreHandle(pTq, pVal, vLen, &handle); - if (code < 0) { - tqDestroyTqHandle(&handle); - break; - } - } - - tdbFree(pKey); - tdbFree(pVal); - tdbTbcClose(pCur); - return code; -} +//int32_t tqMetaRestoreHandle(STQ* pTq) { +// int code = 0; +// TBC* pCur = NULL; +// if (tdbTbcOpen(pTq->pExecStore, &pCur, NULL) < 0) { +// return -1; +// } +// +// void* pKey = NULL; +// int kLen = 0; +// void* pVal = NULL; +// int vLen = 0; +// +// tdbTbcMoveToFirst(pCur); +// +// while (tdbTbcNext(pCur, &pKey, &kLen, &pVal, &vLen) == 0) { +// STqHandle handle = {0}; +// code = restoreHandle(pTq, pVal, vLen, &handle); +// if (code < 0) { +// tqDestroyTqHandle(&handle); +// break; +// } +// } +// +// tdbFree(pKey); +// tdbFree(pVal); +// tdbTbcClose(pCur); +// return code; +//} int32_t tqMetaGetHandle(STQ* pTq, const char* key) { void* pVal = NULL; diff --git a/source/dnode/vnode/src/tq/tqOffsetSnapshot.c b/source/dnode/vnode/src/tq/tqOffsetSnapshot.c index 6a66da30c6..8a7f672e5d 100644 --- a/source/dnode/vnode/src/tq/tqOffsetSnapshot.c +++ b/source/dnode/vnode/src/tq/tqOffsetSnapshot.c @@ -85,6 +85,7 @@ int32_t tqOffsetSnapRead(STqOffsetReader* pReader, uint8_t** ppData) { *ppData = (uint8_t*)buf; pReader->readEnd = 1; + taosCloseFile(&pFile); return 0; } @@ -159,6 +160,7 @@ int32_t tqOffsetSnapWrite(STqOffsetWriter* pWriter, uint8_t* pData, uint32_t nDa taosCloseFile(&pFile); return -1; } + taosCloseFile(&pFile); } else { return -1; } diff --git a/source/dnode/vnode/src/tq/tqStreamStateSnap.c b/source/dnode/vnode/src/tq/tqStreamStateSnap.c index 4a1b3961cd..c4ddaa9e54 100644 --- a/source/dnode/vnode/src/tq/tqStreamStateSnap.c +++ b/source/dnode/vnode/src/tq/tqStreamStateSnap.c @@ -104,6 +104,7 @@ int32_t streamStateSnapRead(SStreamStateReader* pReader, uint8_t** ppData) { pHdr->type = SNAP_DATA_STREAM_STATE_BACKEND; pHdr->size = len; memcpy(pHdr->data, rowData, len); + taosMemoryFree(rowData); tqDebug("vgId:%d, vnode stream-state snapshot read data success", TD_VID(pReader->pTq->pVnode)); return code; diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 89bdc085a3..38fbf42915 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -16,6 +16,7 @@ #include "tsdbDataFileRW.h" #include "tsdbReadUtil.h" #include "vnd.h" +#include "vndCos.h" #define ROCKS_BATCH_SIZE (4096) @@ -51,6 +52,41 @@ static void tsdbCloseBICache(STsdb *pTsdb) { } } +static int32_t tsdbOpenBCache(STsdb *pTsdb) { + int32_t code = 0; + // SLRUCache *pCache = taosLRUCacheInit(10 * 1024 * 1024, 0, .5); + int32_t szPage = pTsdb->pVnode->config.tsdbPageSize; + + SLRUCache *pCache = taosLRUCacheInit(tsS3BlockCacheSize * tsS3BlockSize * szPage, 0, .5); + if (pCache == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _err; + } + + taosLRUCacheSetStrictCapacity(pCache, false); + + taosThreadMutexInit(&pTsdb->bMutex, NULL); + +_err: + pTsdb->bCache = pCache; + return code; +} + +static void tsdbCloseBCache(STsdb *pTsdb) { + SLRUCache *pCache = pTsdb->bCache; + if (pCache) { + int32_t elems = taosLRUCacheGetElems(pCache); + tsdbTrace("vgId:%d, elems: %d", TD_VID(pTsdb->pVnode), elems); + taosLRUCacheEraseUnrefEntries(pCache); + elems = taosLRUCacheGetElems(pCache); + tsdbTrace("vgId:%d, elems: %d", TD_VID(pTsdb->pVnode), elems); + + taosLRUCacheCleanup(pCache); + + taosThreadMutexDestroy(&pTsdb->bMutex); + } +} + #define ROCKS_KEY_LEN (sizeof(tb_uid_t) + sizeof(int16_t) + sizeof(int8_t)) typedef struct { @@ -1149,6 +1185,12 @@ int32_t tsdbOpenCache(STsdb *pTsdb) { goto _err; } + code = tsdbOpenBCache(pTsdb); + if (code != TSDB_CODE_SUCCESS) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _err; + } + code = tsdbOpenRocksCache(pTsdb); if (code != TSDB_CODE_SUCCESS) { code = TSDB_CODE_OUT_OF_MEMORY; @@ -1178,6 +1220,7 @@ void tsdbCloseCache(STsdb *pTsdb) { } tsdbCloseBICache(pTsdb); + tsdbCloseBCache(pTsdb); tsdbCloseRocksCache(pTsdb); } @@ -2987,3 +3030,100 @@ int32_t tsdbBICacheRelease(SLRUCache *pCache, LRUHandle *h) { return code; } + +// block cache +static void getBCacheKey(int32_t fid, int64_t commitID, int64_t blkno, char *key, int *len) { + struct { + int32_t fid; + int64_t commitID; + int64_t blkno; + } bKey = {0}; + + bKey.fid = fid; + bKey.commitID = commitID; + bKey.blkno = blkno; + + *len = sizeof(bKey); + memcpy(key, &bKey, *len); +} + +static int32_t tsdbCacheLoadBlockS3(STsdbFD *pFD, uint8_t **ppBlock) { + int32_t code = 0; + /* + uint8_t *pBlock = taosMemoryCalloc(1, tsS3BlockSize * pFD->szPage); + if (pBlock == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _exit; + } + */ + int64_t block_offset = (pFD->blkno - 1) * tsS3BlockSize * pFD->szPage; + // int64_t size = 4096; + code = s3GetObjectBlock(pFD->objName, block_offset, tsS3BlockSize * pFD->szPage, ppBlock); + if (code != TSDB_CODE_SUCCESS) { + // taosMemoryFree(pBlock); + code = TSDB_CODE_OUT_OF_MEMORY; + return code; + } + + //*ppBlock = pBlock; + + tsdbTrace("block:%p load from s3", *ppBlock); + +_exit: + return code; +} + +static void deleteBCache(const void *key, size_t keyLen, void *value, void *ud) { + (void)ud; + uint8_t *pBlock = (uint8_t *)value; + + taosMemoryFree(pBlock); +} + +int32_t tsdbCacheGetBlockS3(SLRUCache *pCache, STsdbFD *pFD, LRUHandle **handle) { + int32_t code = 0; + char key[128] = {0}; + int keyLen = 0; + + getBCacheKey(pFD->fid, pFD->cid, pFD->blkno, key, &keyLen); + LRUHandle *h = taosLRUCacheLookup(pCache, key, keyLen); + if (!h) { + STsdb *pTsdb = pFD->pTsdb; + taosThreadMutexLock(&pTsdb->bMutex); + + h = taosLRUCacheLookup(pCache, key, keyLen); + if (!h) { + uint8_t *pBlock = NULL; + code = tsdbCacheLoadBlockS3(pFD, &pBlock); + // if table's empty or error, return code of -1 + if (code != TSDB_CODE_SUCCESS || pBlock == NULL) { + taosThreadMutexUnlock(&pTsdb->bMutex); + + *handle = NULL; + return 0; + } + + size_t charge = tsS3BlockSize * pFD->szPage; + _taos_lru_deleter_t deleter = deleteBCache; + LRUStatus status = + taosLRUCacheInsert(pCache, key, keyLen, pBlock, charge, deleter, &h, TAOS_LRU_PRIORITY_LOW, NULL); + if (status != TAOS_LRU_STATUS_OK) { + code = -1; + } + } + + taosThreadMutexUnlock(&pTsdb->bMutex); + } + + *handle = h; + + return code; +} + +int32_t tsdbBCacheRelease(SLRUCache *pCache, LRUHandle *h) { + int32_t code = 0; + + taosLRUCacheRelease(pCache, h, false); + + return code; +} diff --git a/source/dnode/vnode/src/tsdb/tsdbDataFileRW.c b/source/dnode/vnode/src/tsdb/tsdbDataFileRW.c index 7e5eb2c553..6e4cb517ff 100644 --- a/source/dnode/vnode/src/tsdb/tsdbDataFileRW.c +++ b/source/dnode/vnode/src/tsdb/tsdbDataFileRW.c @@ -101,7 +101,7 @@ int32_t tsdbDataFileReaderOpen(const char *fname[], const SDataFileReaderConfig if (fname) { for (int32_t i = 0; i < TSDB_FTYPE_MAX; ++i) { if (fname[i]) { - code = tsdbOpenFile(fname[i], config->szPage, TD_FILE_READ, &reader[0]->fd[i]); + code = tsdbOpenFile(fname[i], config->tsdb, TD_FILE_READ, &reader[0]->fd[i]); TSDB_CHECK_CODE(code, lino, _exit); } } @@ -110,7 +110,7 @@ int32_t tsdbDataFileReaderOpen(const char *fname[], const SDataFileReaderConfig if (config->files[i].exist) { char fname1[TSDB_FILENAME_LEN]; tsdbTFileName(config->tsdb, &config->files[i].file, fname1); - code = tsdbOpenFile(fname1, config->szPage, TD_FILE_READ, &reader[0]->fd[i]); + code = tsdbOpenFile(fname1, config->tsdb, TD_FILE_READ, &reader[0]->fd[i]); TSDB_CHECK_CODE(code, lino, _exit); } } @@ -1466,7 +1466,7 @@ static int32_t tsdbDataFileWriterOpenDataFD(SDataFileWriter *writer) { } tsdbTFileName(writer->config->tsdb, &writer->files[ftype], fname); - code = tsdbOpenFile(fname, writer->config->szPage, flag, &writer->fd[ftype]); + code = tsdbOpenFile(fname, writer->config->tsdb, flag, &writer->fd[ftype]); TSDB_CHECK_CODE(code, lino, _exit); if (writer->files[ftype].size == 0) { @@ -1634,7 +1634,7 @@ static int32_t tsdbDataFileWriterOpenTombFD(SDataFileWriter *writer) { int32_t flag = (TD_FILE_READ | TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC); tsdbTFileName(writer->config->tsdb, writer->files + ftype, fname); - code = tsdbOpenFile(fname, writer->config->szPage, flag, &writer->fd[ftype]); + code = tsdbOpenFile(fname, writer->config->tsdb, flag, &writer->fd[ftype]); TSDB_CHECK_CODE(code, lino, _exit); uint8_t hdr[TSDB_FHDR_SIZE] = {0}; @@ -1684,4 +1684,4 @@ _exit: TSDB_ERROR_LOG(TD_VID(writer->config->tsdb->pVnode), lino, code); } return code; -} \ No newline at end of file +} diff --git a/source/dnode/vnode/src/tsdb/tsdbDef.h b/source/dnode/vnode/src/tsdb/tsdbDef.h index e768f68b15..da2445dee5 100644 --- a/source/dnode/vnode/src/tsdb/tsdbDef.h +++ b/source/dnode/vnode/src/tsdb/tsdbDef.h @@ -31,7 +31,7 @@ typedef struct SFDataPtr { int64_t size; } SFDataPtr; -extern int32_t tsdbOpenFile(const char *path, int32_t szPage, int32_t flag, STsdbFD **ppFD); +extern int32_t tsdbOpenFile(const char *path, STsdb *pTsdb, int32_t flag, STsdbFD **ppFD); extern void tsdbCloseFile(STsdbFD **ppFD); extern int32_t tsdbWriteFile(STsdbFD *pFD, int64_t offset, const uint8_t *pBuf, int64_t size); extern int32_t tsdbReadFile(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64_t size); @@ -41,4 +41,4 @@ extern int32_t tsdbFsyncFile(STsdbFD *pFD); } #endif -#endif /*_TD_TSDB_DEF_H_*/ \ No newline at end of file +#endif /*_TD_TSDB_DEF_H_*/ diff --git a/source/dnode/vnode/src/tsdb/tsdbReadUtil.c b/source/dnode/vnode/src/tsdb/tsdbReadUtil.c index 74eb1c7302..a4d2eef093 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReadUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbReadUtil.c @@ -486,10 +486,15 @@ typedef enum { } ETombBlkCheckEnum; static int32_t doCheckTombBlock(STombBlock* pBlock, STsdbReader* pReader, int32_t numOfTables, int32_t* j, - STableBlockScanInfo** pScanInfo, ETombBlkCheckEnum* pRet) { + ETombBlkCheckEnum* pRet) { int32_t code = 0; STombRecord record = {0}; + uint64_t uid = pReader->status.uidList.tableUidList[*j]; + STableBlockScanInfo* pScanInfo = getTableBlockScanInfo(pReader->status.pTableMap, uid, pReader->idStr); + if (pScanInfo->pFileDelData == NULL) { + pScanInfo->pFileDelData = taosArrayInit(4, sizeof(SDelData)); + } for (int32_t k = 0; k < TARRAY2_SIZE(pBlock->suid); ++k) { code = tTombBlockGet(pBlock, k, &record); @@ -507,11 +512,9 @@ static int32_t doCheckTombBlock(STombBlock* pBlock, STsdbReader* pReader, int32_ return TSDB_CODE_SUCCESS; } - bool newTable = false; if (uid < record.uid) { while ((*j) < numOfTables && pReader->status.uidList.tableUidList[*j] < record.uid) { (*j) += 1; - newTable = true; } if ((*j) >= numOfTables) { @@ -520,6 +523,10 @@ static int32_t doCheckTombBlock(STombBlock* pBlock, STsdbReader* pReader, int32_ } uid = pReader->status.uidList.tableUidList[*j]; + pScanInfo = getTableBlockScanInfo(pReader->status.pTableMap, uid, pReader->idStr); + if (pScanInfo->pFileDelData == NULL) { + pScanInfo->pFileDelData = taosArrayInit(4, sizeof(SDelData)); + } } if (record.uid < uid) { @@ -528,16 +535,9 @@ static int32_t doCheckTombBlock(STombBlock* pBlock, STsdbReader* pReader, int32_ ASSERT(record.suid == pReader->info.suid && uid == record.uid); - if (newTable) { - (*pScanInfo) = getTableBlockScanInfo(pReader->status.pTableMap, uid, pReader->idStr); - if ((*pScanInfo)->pFileDelData == NULL) { - (*pScanInfo)->pFileDelData = taosArrayInit(4, sizeof(SDelData)); - } - } - if (record.version <= pReader->info.verRange.maxVer) { SDelData delData = {.version = record.version, .sKey = record.skey, .eKey = record.ekey}; - taosArrayPush((*pScanInfo)->pFileDelData, &delData); + taosArrayPush(pScanInfo->pFileDelData, &delData); } } @@ -581,15 +581,15 @@ static int32_t doLoadTombDataFromTombBlk(const TTombBlkArray* pTombBlkArray, STs return code; } - uint64_t uid = pReader->status.uidList.tableUidList[j]; +// uint64_t uid = pReader->status.uidList.tableUidList[j]; - STableBlockScanInfo* pScanInfo = getTableBlockScanInfo(pReader->status.pTableMap, uid, pReader->idStr); - if (pScanInfo->pFileDelData == NULL) { - pScanInfo->pFileDelData = taosArrayInit(4, sizeof(SDelData)); - } +// STableBlockScanInfo* pScanInfo = getTableBlockScanInfo(pReader->status.pTableMap, uid, pReader->idStr); +// if (pScanInfo->pFileDelData == NULL) { +// pScanInfo->pFileDelData = taosArrayInit(4, sizeof(SDelData)); +// } ETombBlkCheckEnum ret = 0; - code = doCheckTombBlock(&block, pReader, numOfTables, &j, &pScanInfo, &ret); + code = doCheckTombBlock(&block, pReader, numOfTables, &j, &ret); tTombBlockDestroy(&block); if (code != TSDB_CODE_SUCCESS || ret == BLK_CHECK_QUIT) { diff --git a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c index 974b7f1b76..c143bb8a72 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c +++ b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c @@ -28,6 +28,7 @@ static int32_t tsdbOpenFileImpl(STsdbFD *pFD) { const char *object_name = taosDirEntryBaseName((char *)path); long s3_size = tsS3Enabled ? s3Size(object_name) : 0; if (tsS3Enabled && !strncmp(path + strlen(path) - 5, ".data", 5) && s3_size > 0) { +#ifndef S3_BLOCK_CACHE s3EvictCache(path, s3_size); s3Get(object_name, path); @@ -38,6 +39,14 @@ static int32_t tsdbOpenFileImpl(STsdbFD *pFD) { // taosMemoryFree(pFD); goto _exit; } +#else + pFD->s3File = 1; + pFD->pFD = (TdFilePtr)&pFD->s3File; + int32_t vid = 0; + sscanf(object_name, "v%df%dver%" PRId64 ".data", &vid, &pFD->fid, &pFD->cid); + pFD->objName = object_name; + // pFD->szFile = s3_size; +#endif } else { code = TAOS_SYSTEM_ERROR(errsv); // taosMemoryFree(pFD); @@ -72,9 +81,10 @@ _exit: } // =============== PAGE-WISE FILE =============== -int32_t tsdbOpenFile(const char *path, int32_t szPage, int32_t flag, STsdbFD **ppFD) { +int32_t tsdbOpenFile(const char *path, STsdb *pTsdb, int32_t flag, STsdbFD **ppFD) { int32_t code = 0; STsdbFD *pFD = NULL; + int32_t szPage = pTsdb->pVnode->config.tsdbPageSize; *ppFD = NULL; @@ -90,6 +100,7 @@ int32_t tsdbOpenFile(const char *path, int32_t szPage, int32_t flag, STsdbFD **p pFD->flag = flag; pFD->szPage = szPage; pFD->pgno = 0; + pFD->pTsdb = pTsdb; *ppFD = pFD; @@ -101,7 +112,9 @@ void tsdbCloseFile(STsdbFD **ppFD) { STsdbFD *pFD = *ppFD; if (pFD) { taosMemoryFree(pFD->pBuf); - taosCloseFile(&pFD->pFD); + if (!pFD->s3File) { + taosCloseFile(&pFD->pFD); + } taosMemoryFree(pFD); *ppFD = NULL; } @@ -153,22 +166,41 @@ static int32_t tsdbReadFilePage(STsdbFD *pFD, int64_t pgno) { } } - // seek int64_t offset = PAGE_OFFSET(pgno, pFD->szPage); - int64_t n = taosLSeekFile(pFD->pFD, offset, SEEK_SET); - if (n < 0) { - code = TAOS_SYSTEM_ERROR(errno); - goto _exit; - } - // read - n = taosReadFile(pFD->pFD, pFD->pBuf, pFD->szPage); - if (n < 0) { - code = TAOS_SYSTEM_ERROR(errno); - goto _exit; - } else if (n < pFD->szPage) { - code = TSDB_CODE_FILE_CORRUPTED; - goto _exit; + if (pFD->s3File) { + LRUHandle *handle = NULL; + + pFD->blkno = (pgno + tsS3BlockSize - 1) / tsS3BlockSize; + int32_t code = tsdbCacheGetBlockS3(pFD->pTsdb->bCache, pFD, &handle); + if (code != TSDB_CODE_SUCCESS || handle == NULL) { + tsdbBCacheRelease(pFD->pTsdb->bCache, handle); + goto _exit; + } + + uint8_t *pBlock = (uint8_t *)taosLRUCacheValue(pFD->pTsdb->bCache, handle); + + int64_t blk_offset = (pFD->blkno - 1) * tsS3BlockSize * pFD->szPage; + memcpy(pFD->pBuf, pBlock + (offset - blk_offset), pFD->szPage); + + tsdbBCacheRelease(pFD->pTsdb->bCache, handle); + } else { + // seek + int64_t n = taosLSeekFile(pFD->pFD, offset, SEEK_SET); + if (n < 0) { + code = TAOS_SYSTEM_ERROR(errno); + goto _exit; + } + + // read + n = taosReadFile(pFD->pFD, pFD->pBuf, pFD->szPage); + if (n < 0) { + code = TAOS_SYSTEM_ERROR(errno); + goto _exit; + } else if (n < pFD->szPage) { + code = TSDB_CODE_FILE_CORRUPTED; + goto _exit; + } } // check @@ -293,7 +325,7 @@ int32_t tsdbDataFWriterOpen(SDataFWriter **ppWriter, STsdb *pTsdb, SDFileSet *pS // head flag = TD_FILE_READ | TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC; tsdbHeadFileName(pTsdb, pWriter->wSet.diskId, pWriter->wSet.fid, &pWriter->fHead, fname); - code = tsdbOpenFile(fname, szPage, flag, &pWriter->pHeadFD); + code = tsdbOpenFile(fname, pTsdb, flag, &pWriter->pHeadFD); if (code) goto _err; code = tsdbWriteFile(pWriter->pHeadFD, 0, hdr, TSDB_FHDR_SIZE); @@ -307,7 +339,7 @@ int32_t tsdbDataFWriterOpen(SDataFWriter **ppWriter, STsdb *pTsdb, SDFileSet *pS flag = TD_FILE_READ | TD_FILE_WRITE; } tsdbDataFileName(pTsdb, pWriter->wSet.diskId, pWriter->wSet.fid, &pWriter->fData, fname); - code = tsdbOpenFile(fname, szPage, flag, &pWriter->pDataFD); + code = tsdbOpenFile(fname, pTsdb, flag, &pWriter->pDataFD); if (code) goto _err; if (pWriter->fData.size == 0) { code = tsdbWriteFile(pWriter->pDataFD, 0, hdr, TSDB_FHDR_SIZE); @@ -322,7 +354,7 @@ int32_t tsdbDataFWriterOpen(SDataFWriter **ppWriter, STsdb *pTsdb, SDFileSet *pS flag = TD_FILE_READ | TD_FILE_WRITE; } tsdbSmaFileName(pTsdb, pWriter->wSet.diskId, pWriter->wSet.fid, &pWriter->fSma, fname); - code = tsdbOpenFile(fname, szPage, flag, &pWriter->pSmaFD); + code = tsdbOpenFile(fname, pTsdb, flag, &pWriter->pSmaFD); if (code) goto _err; if (pWriter->fSma.size == 0) { code = tsdbWriteFile(pWriter->pSmaFD, 0, hdr, TSDB_FHDR_SIZE); @@ -335,7 +367,7 @@ int32_t tsdbDataFWriterOpen(SDataFWriter **ppWriter, STsdb *pTsdb, SDFileSet *pS ASSERT(pWriter->fStt[pSet->nSttF - 1].size == 0); flag = TD_FILE_READ | TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC; tsdbSttFileName(pTsdb, pWriter->wSet.diskId, pWriter->wSet.fid, &pWriter->fStt[pSet->nSttF - 1], fname); - code = tsdbOpenFile(fname, szPage, flag, &pWriter->pSttFD); + code = tsdbOpenFile(fname, pTsdb, flag, &pWriter->pSttFD); if (code) goto _err; code = tsdbWriteFile(pWriter->pSttFD, 0, hdr, TSDB_FHDR_SIZE); if (code) goto _err; @@ -907,23 +939,23 @@ int32_t tsdbDataFReaderOpen(SDataFReader **ppReader, STsdb *pTsdb, SDFileSet *pS // head tsdbHeadFileName(pTsdb, pSet->diskId, pSet->fid, pSet->pHeadF, fname); - code = tsdbOpenFile(fname, szPage, TD_FILE_READ, &pReader->pHeadFD); + code = tsdbOpenFile(fname, pTsdb, TD_FILE_READ, &pReader->pHeadFD); TSDB_CHECK_CODE(code, lino, _exit); // data tsdbDataFileName(pTsdb, pSet->diskId, pSet->fid, pSet->pDataF, fname); - code = tsdbOpenFile(fname, szPage, TD_FILE_READ, &pReader->pDataFD); + code = tsdbOpenFile(fname, pTsdb, TD_FILE_READ, &pReader->pDataFD); TSDB_CHECK_CODE(code, lino, _exit); // sma tsdbSmaFileName(pTsdb, pSet->diskId, pSet->fid, pSet->pSmaF, fname); - code = tsdbOpenFile(fname, szPage, TD_FILE_READ, &pReader->pSmaFD); + code = tsdbOpenFile(fname, pTsdb, TD_FILE_READ, &pReader->pSmaFD); TSDB_CHECK_CODE(code, lino, _exit); // stt for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) { tsdbSttFileName(pTsdb, pSet->diskId, pSet->fid, pSet->aSttF[iStt], fname); - code = tsdbOpenFile(fname, szPage, TD_FILE_READ, &pReader->aSttFD[iStt]); + code = tsdbOpenFile(fname, pTsdb, TD_FILE_READ, &pReader->aSttFD[iStt]); TSDB_CHECK_CODE(code, lino, _exit); } @@ -1323,8 +1355,7 @@ int32_t tsdbDelFWriterOpen(SDelFWriter **ppWriter, SDelFile *pFile, STsdb *pTsdb pDelFWriter->fDel = *pFile; tsdbDelFileName(pTsdb, pFile, fname); - code = tsdbOpenFile(fname, pTsdb->pVnode->config.tsdbPageSize, TD_FILE_READ | TD_FILE_WRITE | TD_FILE_CREATE, - &pDelFWriter->pWriteH); + code = tsdbOpenFile(fname, pTsdb, TD_FILE_READ | TD_FILE_WRITE | TD_FILE_CREATE, &pDelFWriter->pWriteH); TSDB_CHECK_CODE(code, lino, _exit); // update header @@ -1498,7 +1529,7 @@ int32_t tsdbDelFReaderOpen(SDelFReader **ppReader, SDelFile *pFile, STsdb *pTsdb pDelFReader->fDel = *pFile; tsdbDelFileName(pTsdb, pFile, fname); - code = tsdbOpenFile(fname, pTsdb->pVnode->config.tsdbPageSize, TD_FILE_READ, &pDelFReader->pReadH); + code = tsdbOpenFile(fname, pTsdb, TD_FILE_READ, &pDelFReader->pReadH); if (code) { taosMemoryFree(pDelFReader); goto _exit; diff --git a/source/dnode/vnode/src/tsdb/tsdbRetention.c b/source/dnode/vnode/src/tsdb/tsdbRetention.c index 61be14f9bc..cb53876d97 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRetention.c +++ b/source/dnode/vnode/src/tsdb/tsdbRetention.c @@ -114,7 +114,7 @@ static int32_t tsdbCopyFileS3(SRTNer *rtner, const STFileObj *from, const STFile TSDB_CHECK_CODE(code, lino, _exit); char *object_name = taosDirEntryBaseName(fname); - code = s3PutObjectFromFile(from->fname, object_name); + code = s3PutObjectFromFile2(from->fname, object_name); TSDB_CHECK_CODE(code, lino, _exit); taosCloseFile(&fdFrom); diff --git a/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c b/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c index 27fae9dc6e..fa8d2d5ba4 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c +++ b/source/dnode/vnode/src/tsdb/tsdbSttFileRW.c @@ -46,12 +46,12 @@ int32_t tsdbSttFileReaderOpen(const char *fname, const SSttFileReaderConfig *con // open file if (fname) { - code = tsdbOpenFile(fname, config->szPage, TD_FILE_READ, &reader[0]->fd); + code = tsdbOpenFile(fname, config->tsdb, TD_FILE_READ, &reader[0]->fd); TSDB_CHECK_CODE(code, lino, _exit); } else { char fname1[TSDB_FILENAME_LEN]; tsdbTFileName(config->tsdb, config->file, fname1); - code = tsdbOpenFile(fname1, config->szPage, TD_FILE_READ, &reader[0]->fd); + code = tsdbOpenFile(fname1, config->tsdb, TD_FILE_READ, &reader[0]->fd); TSDB_CHECK_CODE(code, lino, _exit); } @@ -705,7 +705,7 @@ static int32_t tsdbSttFWriterDoOpen(SSttFileWriter *writer) { char fname[TSDB_FILENAME_LEN]; tsdbTFileName(writer->config->tsdb, writer->file, fname); - code = tsdbOpenFile(fname, writer->config->szPage, flag, &writer->fd); + code = tsdbOpenFile(fname, writer->config->tsdb, flag, &writer->fd); TSDB_CHECK_CODE(code, lino, _exit); uint8_t hdr[TSDB_FHDR_SIZE] = {0}; @@ -984,4 +984,4 @@ _exit: return code; } -bool tsdbSttFileWriterIsOpened(SSttFileWriter *writer) { return writer->ctx->opened; } \ No newline at end of file +bool tsdbSttFileWriterIsOpened(SSttFileWriter *writer) { return writer->ctx->opened; } diff --git a/source/dnode/vnode/src/tsdb/tsdbUpgrade.c b/source/dnode/vnode/src/tsdb/tsdbUpgrade.c index 3b38a0ae45..0884c32385 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUpgrade.c +++ b/source/dnode/vnode/src/tsdb/tsdbUpgrade.c @@ -87,7 +87,7 @@ static int32_t tsdbUpgradeHead(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReader * char fname[TSDB_FILENAME_LEN]; tsdbTFileName(tsdb, &file, fname); - code = tsdbOpenFile(fname, ctx->szPage, TD_FILE_READ | TD_FILE_WRITE, &ctx->fd); + code = tsdbOpenFile(fname, tsdb, TD_FILE_READ | TD_FILE_WRITE, &ctx->fd); TSDB_CHECK_CODE(code, lino, _exit); // convert @@ -257,7 +257,7 @@ static int32_t tsdbUpgradeSttFile(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReade code = tsdbTFileObjInit(tsdb, &file, &fobj); TSDB_CHECK_CODE(code, lino, _exit1); - code = tsdbOpenFile(fobj->fname, ctx->szPage, TD_FILE_READ | TD_FILE_WRITE, &ctx->fd); + code = tsdbOpenFile(fobj->fname, tsdb, TD_FILE_READ | TD_FILE_WRITE, &ctx->fd); TSDB_CHECK_CODE(code, lino, _exit1); for (int32_t iSttBlk = 0; iSttBlk < taosArrayGetSize(aSttBlk); iSttBlk++) { @@ -408,8 +408,7 @@ static int32_t tsdbUpgradeOpenTombFile(STsdb *tsdb, STFileSet *fset, STsdbFD **f } char fname[TSDB_FILENAME_LEN] = {0}; - code = tsdbOpenFile(fobj[0]->fname, tsdb->pVnode->config.tsdbPageSize, - TD_FILE_READ | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_CREATE, fd); + code = tsdbOpenFile(fobj[0]->fname, tsdb, TD_FILE_READ | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_CREATE, fd); TSDB_CHECK_CODE(code, lino, _exit); uint8_t hdr[TSDB_FHDR_SIZE] = {0}; @@ -633,4 +632,4 @@ int32_t tsdbCheckAndUpgradeFileSystem(STsdb *tsdb, int8_t rollback) { taosRemoveFile(fname); return 0; -} \ No newline at end of file +} diff --git a/source/dnode/vnode/src/vnd/vnodeCos.c b/source/dnode/vnode/src/vnd/vnodeCos.c index 7e95a55077..e6c3b87e94 100644 --- a/source/dnode/vnode/src/vnd/vnodeCos.c +++ b/source/dnode/vnode/src/vnd/vnodeCos.c @@ -59,17 +59,19 @@ int32_t s3PutObjectFromFile(const char *file_str, const char *object_str) { cos_request_options_t *options = NULL; cos_string_t bucket, object, file; cos_table_t *resp_headers; - int traffic_limit = 0; + // int traffic_limit = 0; cos_pool_create(&p, NULL); options = cos_request_options_create(p); s3InitRequestOptions(options, is_cname); cos_table_t *headers = NULL; + /* if (traffic_limit) { // 限速值设置范围为819200 - 838860800,即100KB/s - 100MB/s,如果超出该范围将返回400错误 headers = cos_table_make(p, 1); cos_table_add_int(headers, "x-cos-traffic-limit", 819200); } + */ cos_str_set(&bucket, tsS3BucketName); cos_str_set(&file, file_str); cos_str_set(&object, object_str); @@ -85,6 +87,48 @@ int32_t s3PutObjectFromFile(const char *file_str, const char *object_str) { return code; } +int32_t s3PutObjectFromFile2(const char *file_str, const char *object_str) { + int32_t code = 0; + cos_pool_t *p = NULL; + int is_cname = 0; + cos_status_t *s = NULL; + cos_request_options_t *options = NULL; + cos_string_t bucket, object, file; + cos_table_t *resp_headers; + int traffic_limit = 0; + cos_table_t *headers = NULL; + cos_resumable_clt_params_t *clt_params = NULL; + + cos_pool_create(&p, NULL); + options = cos_request_options_create(p); + s3InitRequestOptions(options, is_cname); + headers = cos_table_make(p, 0); + cos_str_set(&bucket, tsS3BucketName); + cos_str_set(&file, file_str); + cos_str_set(&object, object_str); + + // upload + clt_params = cos_create_resumable_clt_params_content(p, 1024 * 1024, 8, COS_FALSE, NULL); + s = cos_resumable_upload_file(options, &bucket, &object, &file, headers, NULL, clt_params, NULL, &resp_headers, NULL); + + if (!cos_status_is_ok(s)) { + vError("s3: %s", s->error_msg); + vError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno)); + code = terrno; + return code; + } + + log_status(s); + + cos_pool_destroy(p); + + if (s->code != 200) { + return code = s->code; + } + + return code; +} + void s3DeleteObjectsByPrefix(const char *prefix_str) { cos_pool_t *p = NULL; cos_request_options_t *options = NULL; @@ -217,6 +261,77 @@ bool s3Get(const char *object_name, const char *path) { return ret; } +int32_t s3GetObjectBlock(const char *object_name, int64_t offset, int64_t block_size, uint8_t **ppBlock) { + int32_t code = 0; + cos_pool_t *p = NULL; + int is_cname = 0; + cos_status_t *s = NULL; + cos_request_options_t *options = NULL; + cos_string_t bucket; + cos_string_t object; + cos_table_t *resp_headers; + cos_table_t *headers = NULL; + cos_buf_t *content = NULL; + // cos_string_t file; + // int traffic_limit = 0; + char range_buf[64]; + + //创建内存池 + cos_pool_create(&p, NULL); + + //初始化请求选项 + options = cos_request_options_create(p); + // init_test_request_options(options, is_cname); + s3InitRequestOptions(options, is_cname); + cos_str_set(&bucket, tsS3BucketName); + cos_str_set(&object, object_name); + cos_list_t download_buffer; + cos_list_init(&download_buffer); + /* + if (traffic_limit) { + // 限速值设置范围为819200 - 838860800,单位默认为 bit/s,即800Kb/s - 800Mb/s,如果超出该范围将返回400错误 + headers = cos_table_make(p, 1); + cos_table_add_int(headers, "x-cos-traffic-limit", 819200); + } + */ + + headers = cos_table_create_if_null(options, headers, 1); + apr_snprintf(range_buf, sizeof(range_buf), "bytes=%" APR_INT64_T_FMT "-%" APR_INT64_T_FMT, offset, + offset + block_size - 1); + apr_table_add(headers, COS_RANGE, range_buf); + + s = cos_get_object_to_buffer(options, &bucket, &object, headers, NULL, &download_buffer, &resp_headers); + if (!cos_status_is_ok(s)) { + vError("s3: %s", s->error_msg); + vError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno)); + code = terrno; + return code; + } + + log_status(s); + // print_headers(resp_headers); + int64_t len = 0; + int64_t size = 0; + int64_t pos = 0; + cos_list_for_each_entry(cos_buf_t, content, &download_buffer, node) { len += cos_buf_size(content); } + // char *buf = cos_pcalloc(p, (apr_size_t)(len + 1)); + char *buf = taosMemoryCalloc(1, (apr_size_t)(len)); + // buf[len] = '\0'; + cos_list_for_each_entry(cos_buf_t, content, &download_buffer, node) { + size = cos_buf_size(content); + memcpy(buf + pos, content->pos, (size_t)size); + pos += size; + } + // cos_warn_log("Download data=%s", buf); + + //销毁内存池 + cos_pool_destroy(p); + + *ppBlock = buf; + + return code; +} + typedef struct { int64_t size; int32_t atime; @@ -333,10 +448,12 @@ long s3Size(const char *object_name) { int32_t s3Init() { return 0; } void s3CleanUp() {} int32_t s3PutObjectFromFile(const char *file, const char *object) { return 0; } +int32_t s3PutObjectFromFile2(const char *file, const char *object) { return 0; } void s3DeleteObjectsByPrefix(const char *prefix) {} void s3DeleteObjects(const char *object_name[], int nobject) {} bool s3Exists(const char *object_name) { return false; } bool s3Get(const char *object_name, const char *path) { return false; } +int32_t s3GetObjectBlock(const char *object_name, int64_t offset, int64_t size, uint8_t **ppBlock) { return 0; } void s3EvictCache(const char *path, long object_size) {} long s3Size(const char *object_name) { return 0; } diff --git a/source/dnode/vnode/src/vnd/vnodeQuery.c b/source/dnode/vnode/src/vnd/vnodeQuery.c index 01dd062866..01292f33e4 100644 --- a/source/dnode/vnode/src/vnd/vnodeQuery.c +++ b/source/dnode/vnode/src/vnd/vnodeQuery.c @@ -388,7 +388,7 @@ int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad) { pLoad->cacheUsage = tsdbCacheGetUsage(pVnode); pLoad->numOfCachedTables = tsdbCacheGetElems(pVnode); pLoad->numOfTables = metaGetTbNum(pVnode->pMeta); - pLoad->numOfTimeSeries = metaGetTimeSeriesNum(pVnode->pMeta); + pLoad->numOfTimeSeries = metaGetTimeSeriesNum(pVnode->pMeta, 1); pLoad->totalStorage = (int64_t)3 * 1073741824; pLoad->compStorage = (int64_t)2 * 1073741824; pLoad->pointsWritten = 100; @@ -400,6 +400,15 @@ int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad) { return 0; } +int32_t vnodeGetLoadLite(SVnode *pVnode, SVnodeLoadLite *pLoad) { + SSyncState syncState = syncGetState(pVnode->sync); + if (syncState.state == TAOS_SYNC_STATE_LEADER) { + pLoad->vgId = TD_VID(pVnode); + pLoad->nTimeSeries = metaGetTimeSeriesNum(pVnode->pMeta, 1); + return 0; + } + return -1; +} /** * @brief Reset the statistics value by monitor interval * @@ -544,8 +553,8 @@ int32_t vnodeGetCtbNum(SVnode *pVnode, int64_t suid, int64_t *num) { return TSDB_CODE_SUCCESS; } -static int32_t vnodeGetStbColumnNum(SVnode *pVnode, tb_uid_t suid, int *num) { - SSchemaWrapper *pSW = metaGetTableSchema(pVnode->pMeta, suid, -1, 1); +int32_t vnodeGetStbColumnNum(SVnode *pVnode, tb_uid_t suid, int *num) { + SSchemaWrapper *pSW = metaGetTableSchema(pVnode->pMeta, suid, -1, 0); if (pSW) { *num = pSW->nCols; tDeleteSchemaWrapper(pSW); @@ -634,10 +643,8 @@ int32_t vnodeGetTimeSeriesNum(SVnode *pVnode, int64_t *num) { tb_uid_t suid = *(tb_uid_t *)taosArrayGet(suidList, i); int64_t ctbNum = 0; - metaGetStbStats(pVnode, suid, &ctbNum); - - int numOfCols = 0; - vnodeGetStbColumnNum(pVnode, suid, &numOfCols); + int32_t numOfCols = 0; + metaGetStbStats(pVnode, suid, &ctbNum, &numOfCols); *num += ctbNum * (numOfCols - 1); } diff --git a/source/dnode/vnode/src/vnd/vnodeSnapshot.c b/source/dnode/vnode/src/vnd/vnodeSnapshot.c index f19068ea88..3abcf79839 100644 --- a/source/dnode/vnode/src/vnd/vnodeSnapshot.c +++ b/source/dnode/vnode/src/vnd/vnodeSnapshot.c @@ -34,6 +34,8 @@ struct SVSnapReader { STqSnapReader *pTqSnapReader; int8_t tqOffsetDone; STqOffsetReader *pTqOffsetReader; + int8_t tqCheckInfoDone; + STqCheckInfoReader *pTqCheckInfoReader; // stream int8_t streamTaskDone; SStreamTaskReader *pStreamTaskReader; @@ -81,6 +83,18 @@ void vnodeSnapReaderClose(SVSnapReader *pReader) { metaSnapReaderClose(&pReader->pMetaReader); } + if (pReader->pTqSnapReader) { + tqSnapReaderClose(&pReader->pTqSnapReader); + } + + if (pReader->pTqOffsetReader) { + tqOffsetReaderClose(&pReader->pTqOffsetReader); + } + + if (pReader->pTqCheckInfoReader) { + tqCheckInfoReaderClose(&pReader->pTqCheckInfoReader); + } + taosMemoryFree(pReader); } @@ -181,6 +195,7 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, uint8_t **ppData, uint32_t *nData) } // TQ ================ + vInfo("vgId:%d tq transform start", vgId); if (!pReader->tqHandleDone) { if (pReader->pTqSnapReader == NULL) { code = tqSnapReaderOpen(pReader->pVnode->pTq, pReader->sver, pReader->ever, &pReader->pTqSnapReader); @@ -200,6 +215,25 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, uint8_t **ppData, uint32_t *nData) } } } + if (!pReader->tqCheckInfoDone) { + if (pReader->pTqCheckInfoReader == NULL) { + code = tqCheckInfoReaderOpen(pReader->pVnode->pTq, pReader->sver, pReader->ever, &pReader->pTqCheckInfoReader); + if (code < 0) goto _err; + } + + code = tqCheckInfoRead(pReader->pTqCheckInfoReader, ppData); + if (code) { + goto _err; + } else { + if (*ppData) { + goto _exit; + } else { + pReader->tqCheckInfoDone = 1; + code = tqCheckInfoReaderClose(&pReader->pTqCheckInfoReader); + if (code) goto _err; + } + } + } if (!pReader->tqOffsetDone) { if (pReader->pTqOffsetReader == NULL) { code = tqOffsetReaderOpen(pReader->pVnode->pTq, pReader->sver, pReader->ever, &pReader->pTqOffsetReader); @@ -334,6 +368,7 @@ struct SVSnapWriter { // tq STqSnapWriter *pTqSnapWriter; STqOffsetWriter *pTqOffsetWriter; + STqCheckInfoWriter *pTqCheckInfoWriter; // stream SStreamTaskWriter *pStreamTaskWriter; SStreamStateWriter *pStreamStateWriter; @@ -411,6 +446,21 @@ int32_t vnodeSnapWriterClose(SVSnapWriter *pWriter, int8_t rollback, SSnapshot * if (code) goto _exit; } + if (pWriter->pTqSnapWriter) { + code = tqSnapWriterClose(&pWriter->pTqSnapWriter, rollback); + if (code) goto _exit; + } + + if (pWriter->pTqCheckInfoWriter) { + code = tqCheckInfoWriterClose(&pWriter->pTqCheckInfoWriter, rollback); + if (code) goto _exit; + } + + if (pWriter->pTqOffsetWriter) { + code = tqOffsetWriterClose(&pWriter->pTqOffsetWriter, rollback); + if (code) goto _exit; + } + if (pWriter->pStreamTaskWriter) { code = streamTaskSnapWriterClose(pWriter->pStreamTaskWriter, rollback); if (code) goto _exit; @@ -519,8 +569,34 @@ int32_t vnodeSnapWrite(SVSnapWriter *pWriter, uint8_t *pData, uint32_t nData) { if (code) goto _err; } break; case SNAP_DATA_TQ_HANDLE: { + // tq handle + if (pWriter->pTqSnapWriter == NULL) { + code = tqSnapWriterOpen(pVnode->pTq, pWriter->sver, pWriter->ever, &pWriter->pTqSnapWriter); + if (code) goto _err; + } + + code = tqSnapWrite(pWriter->pTqSnapWriter, pData, nData); + if (code) goto _err; + } break; + case SNAP_DATA_TQ_CHECKINFO: { + // tq checkinfo + if (pWriter->pTqCheckInfoWriter == NULL) { + code = tqCheckInfoWriterOpen(pVnode->pTq, pWriter->sver, pWriter->ever, &pWriter->pTqCheckInfoWriter); + if (code) goto _err; + } + + code = tqCheckInfoWrite(pWriter->pTqCheckInfoWriter, pData, nData); + if (code) goto _err; } break; case SNAP_DATA_TQ_OFFSET: { + // tq offset + if (pWriter->pTqOffsetWriter == NULL) { + code = tqOffsetWriterOpen(pVnode->pTq, pWriter->sver, pWriter->ever, &pWriter->pTqOffsetWriter); + if (code) goto _err; + } + + code = tqOffsetSnapWrite(pWriter->pTqOffsetWriter, pData, nData); + if (code) goto _err; } break; case SNAP_DATA_STREAM_TASK: case SNAP_DATA_STREAM_TASK_CHECKPOINT: { diff --git a/source/libs/catalog/inc/catalogInt.h b/source/libs/catalog/inc/catalogInt.h index 7d47e82164..8c9275eb94 100644 --- a/source/libs/catalog/inc/catalogInt.h +++ b/source/libs/catalog/inc/catalogInt.h @@ -975,6 +975,7 @@ void ctgFreeQNode(SCtgQNode* node); void ctgClearHandle(SCatalog* pCtg); void ctgFreeTbCacheImpl(SCtgTbCache* pCache, bool lock); int32_t ctgRemoveTbMeta(SCatalog* pCtg, SName* pTableName); +int32_t ctgRemoveCacheUser(SCatalog* pCtg, const char* user); int32_t ctgGetTbHashVgroup(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName, SVgroupInfo* pVgroup, bool* exists); SName* ctgGetFetchName(SArray* pNames, SCtgFetch* pFetch); diff --git a/source/libs/catalog/src/ctgCache.c b/source/libs/catalog/src/ctgCache.c index 44de83b7ef..b541cdd411 100644 --- a/source/libs/catalog/src/ctgCache.c +++ b/source/libs/catalog/src/ctgCache.c @@ -2243,11 +2243,15 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) { SCtgUserAuth *pUser = (SCtgUserAuth *)taosHashGet(pCtg->userCache, msg->userAuth.user, strlen(msg->userAuth.user)); if (NULL == pUser) { + if (msg->userAuth.dropped == 1) { + goto _return; + } + SCtgUserAuth userAuth = {0}; memcpy(&userAuth.userAuth, &msg->userAuth, sizeof(msg->userAuth)); userAuth.userCacheSize = ctgGetUserCacheSize(&userAuth.userAuth); - + if (taosHashPut(pCtg->userCache, msg->userAuth.user, strlen(msg->userAuth.user), &userAuth, sizeof(userAuth))) { ctgError("taosHashPut user %s to cache failed", msg->userAuth.user); CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); @@ -2258,6 +2262,11 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) { CTG_CACHE_NUM_INC(CTG_CI_USER, 1); return TSDB_CODE_SUCCESS; + } else if (msg->userAuth.dropped == 1) { + if (ctgRemoveCacheUser(pCtg, msg->userAuth.user) == 0) { + CTG_CACHE_NUM_DEC(CTG_CI_USER, 1); + } + goto _return; } CTG_LOCK(CTG_WRITE, &pUser->lock); diff --git a/source/libs/catalog/src/ctgUtil.c b/source/libs/catalog/src/ctgUtil.c index dab007aa47..ef1fb18cb4 100644 --- a/source/libs/catalog/src/ctgUtil.c +++ b/source/libs/catalog/src/ctgUtil.c @@ -311,6 +311,22 @@ void ctgFreeHandleImpl(SCatalog* pCtg) { taosMemoryFree(pCtg); } +int32_t ctgRemoveCacheUser(SCatalog* pCtg, const char* user) { + if (!pCtg || !user) { + return -1; + } + + SCtgUserAuth* pUser = (SCtgUserAuth*)taosHashGet(pCtg->userCache, user, strlen(user)); + if (pUser) { + ctgFreeSCtgUserAuth(pUser); + if (taosHashRemove(pCtg->userCache, user, strlen(user)) == 0) { + return 0; // user found and removed + } + } + + return -1; +} + void ctgFreeHandle(SCatalog* pCtg) { if (NULL == pCtg) { return; diff --git a/source/libs/command/inc/commandInt.h b/source/libs/command/inc/commandInt.h index 996891c77a..f74c61ea78 100644 --- a/source/libs/command/inc/commandInt.h +++ b/source/libs/command/inc/commandInt.h @@ -104,6 +104,7 @@ extern "C" { #define EXPLAIN_VGROUP_SLOT_FORMAT "vgroup_slot=%d,%d" #define EXPLAIN_UID_SLOT_FORMAT "uid_slot=%d,%d" #define EXPLAIN_SRC_SCAN_FORMAT "src_scan=%d,%d" +#define EXPLAIN_PLAN_BLOCKING "blocking=%d" #define COMMAND_RESET_LOG "resetLog" #define COMMAND_SCHEDULE_POLICY "schedulePolicy" diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index 8b868ffde4..33ba5217a8 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -88,8 +88,9 @@ static int32_t buildDescResultDataBlock(SSDataBlock** pOutput) { return code; } -static int32_t setDescResultIntoDataBlock(bool sysInfoUser, SSDataBlock* pBlock, int32_t numOfRows, STableMeta* pMeta) { - blockDataEnsureCapacity(pBlock, numOfRows); +static int32_t setDescResultIntoDataBlock(bool sysInfoUser, SSDataBlock* pBlock, int32_t numOfRows, STableMeta* pMeta, int8_t biMode) { + int32_t blockCap = (biMode != 0) ? numOfRows + 1 : numOfRows; + blockDataEnsureCapacity(pBlock, blockCap); pBlock->info.rows = 0; // field @@ -115,6 +116,17 @@ static int32_t setDescResultIntoDataBlock(bool sysInfoUser, SSDataBlock* pBlock, colDataSetVal(pCol4, pBlock->info.rows, buf, false); ++(pBlock->info.rows); } + if (pMeta->tableType == TSDB_SUPER_TABLE && biMode != 0) { + STR_TO_VARSTR(buf, "tbname"); + colDataSetVal(pCol1, pBlock->info.rows, buf, false); + STR_TO_VARSTR(buf, "VARCHAR"); + colDataSetVal(pCol2, pBlock->info.rows, buf, false); + int32_t bytes = TSDB_TABLE_NAME_LEN - 1; + colDataSetVal(pCol3, pBlock->info.rows, (const char*)&bytes, false); + STR_TO_VARSTR(buf, "TAG"); + colDataSetVal(pCol4, pBlock->info.rows, buf, false); + ++(pBlock->info.rows); + } if (pBlock->info.rows <= 0) { qError("no permission to view any columns"); return TSDB_CODE_PAR_PERMISSION_DENIED; @@ -122,14 +134,14 @@ static int32_t setDescResultIntoDataBlock(bool sysInfoUser, SSDataBlock* pBlock, return TSDB_CODE_SUCCESS; } -static int32_t execDescribe(bool sysInfoUser, SNode* pStmt, SRetrieveTableRsp** pRsp) { +static int32_t execDescribe(bool sysInfoUser, SNode* pStmt, SRetrieveTableRsp** pRsp, int8_t biMode) { SDescribeStmt* pDesc = (SDescribeStmt*)pStmt; int32_t numOfRows = TABLE_TOTAL_COL_NUM(pDesc->pMeta); SSDataBlock* pBlock = NULL; int32_t code = buildDescResultDataBlock(&pBlock); if (TSDB_CODE_SUCCESS == code) { - code = setDescResultIntoDataBlock(sysInfoUser, pBlock, numOfRows, pDesc->pMeta); + code = setDescResultIntoDataBlock(sysInfoUser, pBlock, numOfRows, pDesc->pMeta, biMode); } if (TSDB_CODE_SUCCESS == code) { code = buildRetrieveTableRsp(pBlock, DESCRIBE_RESULT_COLS, pRsp); @@ -926,10 +938,10 @@ static int32_t execSelectWithoutFrom(SSelectStmt* pSelect, SRetrieveTableRsp** p return code; } -int32_t qExecCommand(int64_t* pConnId, bool sysInfoUser, SNode* pStmt, SRetrieveTableRsp** pRsp) { +int32_t qExecCommand(int64_t* pConnId, bool sysInfoUser, SNode* pStmt, SRetrieveTableRsp** pRsp, int8_t biMode) { switch (nodeType(pStmt)) { case QUERY_NODE_DESCRIBE_STMT: - return execDescribe(sysInfoUser, pStmt, pRsp); + return execDescribe(sysInfoUser, pStmt, pRsp, biMode); case QUERY_NODE_RESET_QUERY_CACHE_STMT: return execResetQueryCache(); case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c index 655775e224..27cfaab3cf 100644 --- a/source/libs/command/src/explain.c +++ b/source/libs/command/src/explain.c @@ -629,6 +629,8 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pAggNode->node.pOutputDataBlockDesc->outputRowSize); EXPLAIN_ROW_APPEND_LIMIT(pAggNode->node.pLimit); EXPLAIN_ROW_APPEND_SLIMIT(pAggNode->node.pSlimit); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_PLAN_BLOCKING, !pAggNode->node.forceCreateNonBlockingOptr); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 474128007a..b95a948937 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -3928,7 +3928,7 @@ static void buildVnodeFilteredTbCount(SOperatorInfo* pOperator, STableCountScanO pAPI->metaFn.getTableUidByName(pInfo->readHandle.vnode, pSupp->stbNameFilter, &uid); int64_t numOfChildTables = 0; - pAPI->metaFn.getNumOfChildTables(pInfo->readHandle.vnode, uid, &numOfChildTables); + pAPI->metaFn.getNumOfChildTables(pInfo->readHandle.vnode, uid, &numOfChildTables, NULL); fillTableCountScanDataBlock(pSupp, dbName, pSupp->stbNameFilter, numOfChildTables, pRes); } else { @@ -3979,7 +3979,7 @@ static void buildVnodeGroupedStbTableCount(STableCountScanOperatorInfo* pInfo, S pRes->info.id.groupId = groupId; int64_t ctbNum = 0; - int32_t code = pAPI->metaFn.getNumOfChildTables(pInfo->readHandle.vnode, stbUid, &ctbNum); + int32_t code = pAPI->metaFn.getNumOfChildTables(pInfo->readHandle.vnode, stbUid, &ctbNum, NULL); fillTableCountScanDataBlock(pSupp, dbName, varDataVal(stbName), ctbNum, pRes); } diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c index 44d39392a2..6c537d7b98 100644 --- a/source/libs/executor/src/tfill.c +++ b/source/libs/executor/src/tfill.c @@ -75,7 +75,7 @@ static void doSetUserSpecifiedValue(SColumnInfoData* pDst, SVariant* pVar, int32 double v = 0; GET_TYPED_DATA(v, double, pVar->nType, &pVar->d); colDataSetVal(pDst, rowIndex, (char*)&v, isNull); - } else if (IS_SIGNED_NUMERIC_TYPE(pDst->info.type)) { + } else if (IS_SIGNED_NUMERIC_TYPE(pDst->info.type) || pDst->info.type == TSDB_DATA_TYPE_BOOL) { int64_t v = 0; GET_TYPED_DATA(v, int64_t, pVar->nType, &pVar->i); colDataSetVal(pDst, rowIndex, (char*)&v, isNull); @@ -85,7 +85,10 @@ static void doSetUserSpecifiedValue(SColumnInfoData* pDst, SVariant* pVar, int32 colDataSetVal(pDst, rowIndex, (char*)&v, isNull); } else if (pDst->info.type == TSDB_DATA_TYPE_TIMESTAMP) { colDataSetVal(pDst, rowIndex, (const char*)¤tKey, isNull); - } else { // varchar/nchar data + } else if (pDst->info.type == TSDB_DATA_TYPE_NCHAR || pDst->info.type == TSDB_DATA_TYPE_VARCHAR || + pDst->info.type == TSDB_DATA_TYPE_VARBINARY) { + colDataSetVal(pDst, rowIndex, pVar->pz, isNull); + } else { // others data colDataSetNULL(pDst, rowIndex); } } diff --git a/source/libs/function/inc/functionMgtInt.h b/source/libs/function/inc/functionMgtInt.h index 6d23f65cf3..30bd38e7ba 100644 --- a/source/libs/function/inc/functionMgtInt.h +++ b/source/libs/function/inc/functionMgtInt.h @@ -52,6 +52,7 @@ extern "C" { #define FUNC_MGT_INTERP_PC_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(23) #define FUNC_MGT_GEOMETRY_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(24) #define FUNC_MGT_FORBID_SYSTABLE_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(25) +#define FUNC_MGT_SKIP_SCAN_CHECK_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(26) #define FUNC_MGT_TEST_MASK(val, mask) (((val) & (mask)) != 0) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 0057df7902..c62b5946dc 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -3446,7 +3446,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "_group_key", .type = FUNCTION_TYPE_GROUP_KEY, - .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_KEEP_ORDER_FUNC, + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_SKIP_SCAN_CHECK_FUNC, .translateFunc = translateGroupKey, .getEnvFunc = getGroupKeyFuncEnv, .initFunc = functionSetup, diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c index 9e70710fbd..036e4238d4 100644 --- a/source/libs/function/src/functionMgt.c +++ b/source/libs/function/src/functionMgt.c @@ -346,6 +346,10 @@ bool fmIsConstantResFunc(SFunctionNode* pFunc) { return true; } +bool fmIsSkipScanCheckFunc(int32_t funcId) { + return isSpecificClassifyFunc(funcId, FUNC_MGT_SKIP_SCAN_CHECK_FUNC); +} + void getLastCacheDataType(SDataType* pType) { pType->bytes = getFirstLastInfoSize(pType->bytes) + VARSTR_HEADER_SIZE; pType->type = TSDB_DATA_TYPE_BINARY; diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index 3d48036095..bd73b02c80 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -543,6 +543,7 @@ static int32_t logicPartitionCopy(const SPartitionLogicNode* pSrc, SPartitionLog CLONE_NODE_LIST_FIELD(pPartitionKeys); CLONE_NODE_LIST_FIELD(pTags); CLONE_NODE_FIELD(pSubtable); + CLONE_NODE_LIST_FIELD(pAggFuncs); COPY_SCALAR_FIELD(needBlockOutputTsOrder); COPY_SCALAR_FIELD(pkTsColId); COPY_SCALAR_FIELD(pkTsColTbId); diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index a5b9f6dd91..bf5b6c8080 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -1205,6 +1205,7 @@ void nodesDestroyNode(SNode* pNode) { nodesDestroyList(pLogicNode->pPartitionKeys); nodesDestroyList(pLogicNode->pTags); nodesDestroyNode(pLogicNode->pSubtable); + nodesDestroyList(pLogicNode->pAggFuncs); break; } case QUERY_NODE_LOGIC_PLAN_INDEF_ROWS_FUNC: { @@ -1594,6 +1595,26 @@ void nodesListInsertList(SNodeList* pTarget, SListCell* pPos, SNodeList* pSrc) { nodesFree(pSrc); } +void nodesListInsertListAfterPos(SNodeList* pTarget, SListCell* pPos, SNodeList* pSrc) { + if (NULL == pTarget || NULL == pPos || NULL == pSrc || NULL == pSrc->pHead) { + return; + } + + if (NULL == pPos->pNext) { + pTarget->pTail = pSrc->pHead; + } else { + pPos->pNext->pPrev = pSrc->pHead; + } + + pSrc->pHead->pPrev = pPos; + pSrc->pTail->pNext = pPos->pNext; + + pPos->pNext = pSrc->pHead; + + pTarget->length += pSrc->length; + nodesFree(pSrc); +} + SNode* nodesListGetNode(SNodeList* pList, int32_t index) { SNode* node; FOREACH(node, pList) { @@ -2283,3 +2304,47 @@ const char* dataOrderStr(EDataOrderLevel order) { } return "unknown"; } + +SValueNode* nodesMakeValueNodeFromString(char* literal) { + int32_t lenStr = strlen(literal); + SValueNode* pValNode = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE); + if (pValNode) { + pValNode->node.resType.type = TSDB_DATA_TYPE_VARCHAR; + pValNode->node.resType.bytes = lenStr + VARSTR_HEADER_SIZE; + char* p = taosMemoryMalloc(lenStr + 1 + VARSTR_HEADER_SIZE); + if (p == NULL) { + return NULL; + } + varDataSetLen(p, lenStr); + memcpy(varDataVal(p), literal, lenStr + 1); + pValNode->datum.p = p; + pValNode->literal = tstrdup(literal); + pValNode->translate = true; + pValNode->isDuration = false; + pValNode->isNull = false; + } + return pValNode; +} + +SValueNode* nodesMakeValueNodeFromBool(bool b) { + SValueNode* pValNode = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE); + if (pValNode) { + pValNode->node.resType.type = TSDB_DATA_TYPE_BOOL; + pValNode->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; + nodesSetValueNodeValue(pValNode, &b); + pValNode->translate = true; + pValNode->isDuration = false; + pValNode->isNull = false; + } + return pValNode; +} + +bool nodesIsStar(SNode* pNode) { + return (QUERY_NODE_COLUMN == nodeType(pNode)) && ('\0' == ((SColumnNode*)pNode)->tableAlias[0]) && + (0 == strcmp(((SColumnNode*)pNode)->colName, "*")); +} + +bool nodesIsTableStar(SNode* pNode) { + return (QUERY_NODE_COLUMN == nodeType(pNode)) && ('\0' != ((SColumnNode*)pNode)->tableAlias[0]) && + (0 == strcmp(((SColumnNode*)pNode)->colName, "*")); +} \ No newline at end of file diff --git a/source/libs/parser/CMakeLists.txt b/source/libs/parser/CMakeLists.txt index 41553918e1..487b4e3e36 100644 --- a/source/libs/parser/CMakeLists.txt +++ b/source/libs/parser/CMakeLists.txt @@ -1,4 +1,7 @@ aux_source_directory(src PARSER_SRC) +IF (TD_BI_SUPPORT) + LIST(APPEND PARSER_SRC ${TD_ENTERPRISE_DIR}/src/plugins/bi/src/biRewriteQuery.c) +ENDIF () add_library(parser STATIC ${PARSER_SRC}) target_include_directories( parser diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 719e7ba08c..7ec872a475 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -87,6 +87,11 @@ typedef struct STokenPair { SToken second; } STokenPair; +typedef struct SShowTablesOption { + EShowKind kind; + SToken dbName; +} SShowTablesOption; + extern SToken nil_token; void initAstCreateContext(SParseContext* pParseCxt, SAstCreateContext* pCxt); @@ -181,9 +186,11 @@ SNode* createAlterTableRenameCol(SAstCreateContext* pCxt, SNode* pRealTable, int SNode* createAlterTableSetTag(SAstCreateContext* pCxt, SNode* pRealTable, SToken* pTagName, SNode* pVal); SNode* setAlterSuperTableType(SNode* pStmt); SNode* createUseDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName); +SNode* setShowKind(SAstCreateContext* pCxt, SNode* pStmt, EShowKind showKind); SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type); SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, SNode* pTbName, EOperatorType tableCondType); +SNode* createShowTablesStmt(SAstCreateContext* pCxt, SShowTablesOption option, SNode* pTbName, EOperatorType tableCondType); SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName); SNode* createShowAliveStmt(SAstCreateContext* pCxt, SNode* pDbName, ENodeType type); SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable); diff --git a/source/libs/parser/inc/parInt.h b/source/libs/parser/inc/parInt.h index 69253e62e2..9e95478b3f 100644 --- a/source/libs/parser/inc/parInt.h +++ b/source/libs/parser/inc/parInt.h @@ -36,7 +36,6 @@ int32_t extractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pS int32_t calculateConstant(SParseContext* pParseCxt, SQuery* pQuery); int32_t translatePostCreateStream(SParseContext* pParseCxt, SQuery* pQuery, void** pResRow); int32_t translatePostCreateSmaIndex(SParseContext* pParseCxt, SQuery* pQuery, void** pResRow); - #ifdef __cplusplus } #endif diff --git a/source/libs/parser/inc/parTranslater.h b/source/libs/parser/inc/parTranslater.h new file mode 100644 index 0000000000..7f721a2c25 --- /dev/null +++ b/source/libs/parser/inc/parTranslater.h @@ -0,0 +1,55 @@ +/* + * 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_PARSER_TRANS_H_ +#define _TD_PARSER_TRANS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "parToken.h" +#include "parUtil.h" +#include "parser.h" + +typedef struct STranslateContext { + SParseContext* pParseCxt; + int32_t errCode; + SMsgBuf msgBuf; + SArray* pNsLevel; // element is SArray*, the element of this subarray is STableNode* + int32_t currLevel; + int32_t levelNo; + ESqlClause currClause; + SNode* pCurrStmt; + SCmdMsgInfo* pCmdMsg; + SHashObj* pDbs; + SHashObj* pTables; + SHashObj* pTargetTables; + SExplainOptions* pExplainOpt; + SParseMetaCache* pMetaCache; + bool createStream; + bool stableQuery; + bool showRewrite; + SNode* pPrevRoot; + SNode* pPostRoot; +} STranslateContext; + +int32_t biRewriteSelectStar(STranslateContext* pCxt, SSelectStmt* pSelect); +int32_t findTable(STranslateContext* pCxt, const char* pTableAlias, STableNode** pOutput); +#ifdef __cplusplus +} +#endif + +#endif /*_TD_PARSER_TRANS_H_*/ \ No newline at end of file diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 6e2521e5b9..2cd7f6edc7 100755 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -458,8 +458,13 @@ col_name(A) ::= column_name(B). cmd ::= SHOW DNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } cmd ::= SHOW USERS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } cmd ::= SHOW USER PRIVILEGES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } -cmd ::= SHOW DATABASES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } -cmd ::= SHOW db_name_cond_opt(A) TABLES like_pattern_opt(B). { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, A, B, OP_TYPE_LIKE); } +cmd ::= SHOW db_kind_opt(A) DATABASES. { + pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); + setShowKind(pCxt, pCxt->pRootNode, A); + } +cmd ::= SHOW table_kind_db_name_cond_opt(A) TABLES like_pattern_opt(B). { + pCxt->pRootNode = createShowTablesStmt(pCxt, A, B, OP_TYPE_LIKE); + } cmd ::= SHOW db_name_cond_opt(A) STABLES like_pattern_opt(B). { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, A, B, OP_TYPE_LIKE); } cmd ::= SHOW db_name_cond_opt(A) VGROUPS. { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, A, NULL, OP_TYPE_LIKE); } cmd ::= SHOW MNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } @@ -501,6 +506,18 @@ cmd ::= SHOW VNODES. cmd ::= SHOW db_name_cond_opt(A) ALIVE. { pCxt->pRootNode = createShowAliveStmt(pCxt, A, QUERY_NODE_SHOW_DB_ALIVE_STMT); } cmd ::= SHOW CLUSTER ALIVE. { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } +%type table_kind_db_name_cond_opt { SShowTablesOption } +%destructor table_kind_db_name_cond_opt { } +table_kind_db_name_cond_opt(A) ::= . { A.kind = SHOW_KIND_ALL; A.dbName = nil_token; } +table_kind_db_name_cond_opt(A) ::= table_kind(B). { A.kind = B; A.dbName = nil_token; } +table_kind_db_name_cond_opt(A) ::= db_name(C) NK_DOT. { A.kind = SHOW_KIND_ALL; A.dbName = C; } +table_kind_db_name_cond_opt(A) ::= table_kind(B) db_name(C) NK_DOT. { A.kind = B; A.dbName = C; } + +%type table_kind { EShowKind } +%destructor table_kind { } +table_kind(A) ::= NORMAL. { A = SHOW_KIND_TABLES_NORMAL; } +table_kind(A) ::= CHILD. { A = SHOW_KIND_TABLES_CHILD; } + db_name_cond_opt(A) ::= . { A = createDefaultDatabaseCondValue(pCxt); } db_name_cond_opt(A) ::= db_name(B) NK_DOT. { A = createIdentifierValueNode(pCxt, &B); } @@ -524,6 +541,12 @@ tag_item(A) ::= column_name(B). tag_item(A) ::= column_name(B) column_alias(C). { A = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &B), &C); } tag_item(A) ::= column_name(B) AS column_alias(C). { A = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &B), &C); } +%type db_kind_opt { EShowKind } +%destructor db_kind_opt { } +db_kind_opt(A) ::= . { A = SHOW_KIND_ALL; } +db_kind_opt(A) ::= USER. { A = SHOW_KIND_DATABASES_USER; } +db_kind_opt(A) ::= SYSTEM. { A = SHOW_KIND_DATABASES_SYSTEM; } + /************************************************ create index ********************************************************/ cmd ::= CREATE SMA INDEX not_exists_opt(D) col_name(A) ON full_table_name(B) index_options(C). { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, D, A, B, NULL, C); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 68865110f7..30a9fd6ed6 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1552,6 +1552,15 @@ SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type) { return (SNode*)pStmt; } +SNode* setShowKind(SAstCreateContext* pCxt, SNode* pStmt, EShowKind showKind) { + if (pStmt == NULL) { + return NULL; + } + SShowStmt* pShow = (SShowStmt*)pStmt; + pShow->showKind = showKind; + return pStmt; +} + SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, SNode* pTbName, EOperatorType tableCondType) { CHECK_PARSER_STATUS(pCxt); @@ -1568,6 +1577,19 @@ SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pD return (SNode*)pStmt; } +SNode* createShowTablesStmt(SAstCreateContext* pCxt, SShowTablesOption option, SNode* pTbName, EOperatorType tableCondType) { + CHECK_PARSER_STATUS(pCxt); + SNode* pDbName = NULL; + if (option.dbName.type == TK_NK_NIL) { + pDbName = createDefaultDatabaseCondValue(pCxt); + } else { + pDbName = createIdentifierValueNode(pCxt, &option.dbName); + } + SNode* pStmt = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, pDbName, pTbName, tableCondType); + setShowKind(pCxt, pStmt, option.kind); + return pStmt; +} + SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName) { CHECK_PARSER_STATUS(pCxt); if (!checkDbName(pCxt, pDbName, true)) { diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index cbb3b1952b..84ed47b5d2 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -57,6 +57,7 @@ static SKeyword keywordTable[] = { {"CACHESIZE", TK_CACHESIZE}, {"CASE", TK_CASE}, {"CAST", TK_CAST}, + {"CHILD", TK_CHILD}, {"CLIENT_VERSION", TK_CLIENT_VERSION}, {"CLUSTER", TK_CLUSTER}, {"COLUMN", TK_COLUMN}, @@ -149,6 +150,7 @@ static SKeyword keywordTable[] = { {"MNODES", TK_MNODES}, {"MODIFY", TK_MODIFY}, {"MODULES", TK_MODULES}, + {"NORMAL", TK_NORMAL}, {"NCHAR", TK_NCHAR}, {"NEXT", TK_NEXT}, {"NMATCH", TK_NMATCH}, @@ -224,6 +226,7 @@ static SKeyword keywordTable[] = { {"SUBSCRIPTIONS", TK_SUBSCRIPTIONS}, {"SUBTABLE", TK_SUBTABLE}, {"SYSINFO", TK_SYSINFO}, + {"SYSTEM", TK_SYSTEM}, {"TABLE", TK_TABLE}, {"TABLES", TK_TABLES}, {"TABLE_PREFIX", TK_TABLE_PREFIX}, diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 3a6829da56..9dce3d2fe4 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -14,6 +14,7 @@ */ #include "parInt.h" +#include "parTranslater.h" #include "catalog.h" #include "cmdnodes.h" @@ -35,28 +36,6 @@ typedef struct SRewriteTbNameContext { char* pTbName; } SRewriteTbNameContext; -typedef struct STranslateContext { - SParseContext* pParseCxt; - int32_t errCode; - SMsgBuf msgBuf; - SArray* pNsLevel; // element is SArray*, the element of this subarray is STableNode* - int32_t currLevel; - int32_t levelNo; - ESqlClause currClause; - SNode* pCurrStmt; - SCmdMsgInfo* pCmdMsg; - SHashObj* pDbs; - SHashObj* pTables; - SHashObj* pTargetTables; - SExplainOptions* pExplainOpt; - SParseMetaCache* pMetaCache; - bool createStream; - bool stableQuery; - bool showRewrite; - SNode* pPrevRoot; - SNode* pPostRoot; -} STranslateContext; - typedef struct SBuildTopicContext { bool colExists; bool colNotFound; @@ -1419,7 +1398,7 @@ static EDealRes haveVectorFunction(SNode* pNode, void* pContext) { return DEAL_RES_CONTINUE; } -static int32_t findTable(STranslateContext* pCxt, const char* pTableAlias, STableNode** pOutput) { +int32_t findTable(STranslateContext* pCxt, const char* pTableAlias, STableNode** pOutput) { SArray* pTables = taosArrayGetP(pCxt->pNsLevel, pCxt->currLevel); size_t nums = taosArrayGetSize(pTables); for (size_t i = 0; i < nums; ++i) { @@ -1810,17 +1789,8 @@ static int32_t translateBlockDistFunc(STranslateContext* pCtx, SFunctionNode* pF return TSDB_CODE_SUCCESS; } -static bool isStar(SNode* pNode) { - return (QUERY_NODE_COLUMN == nodeType(pNode)) && ('\0' == ((SColumnNode*)pNode)->tableAlias[0]) && - (0 == strcmp(((SColumnNode*)pNode)->colName, "*")); -} -static bool isTableStar(SNode* pNode) { - return (QUERY_NODE_COLUMN == nodeType(pNode)) && ('\0' != ((SColumnNode*)pNode)->tableAlias[0]) && - (0 == strcmp(((SColumnNode*)pNode)->colName, "*")); -} - -static bool isStarParam(SNode* pNode) { return isStar(pNode) || isTableStar(pNode); } +static bool isStarParam(SNode* pNode) { return nodesIsStar(pNode) || nodesIsTableStar(pNode); } static int32_t translateMultiResFunc(STranslateContext* pCxt, SFunctionNode* pFunc) { if (!fmIsMultiResFunc(pFunc->funcId)) { @@ -2857,7 +2827,7 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) { return code; } -static int32_t createAllColumns(STranslateContext* pCxt, bool igTags, SNodeList** pCols) { +static int32_t createAllColumns(STranslateContext* pCxt, bool igTags, SNodeList** pCols) { *pCols = nodesMakeList(); if (NULL == *pCols) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY); @@ -2938,9 +2908,9 @@ static int32_t createMultiResFuncsParas(STranslateContext* pCxt, SNodeList* pSrc SNodeList* pExprs = NULL; SNode* pPara = NULL; FOREACH(pPara, pSrcParas) { - if (isStar(pPara)) { + if (nodesIsStar(pPara)) { code = createAllColumns(pCxt, true, &pExprs); - } else if (isTableStar(pPara)) { + } else if (nodesIsTableStar(pPara)) { code = createTableAllCols(pCxt, (SColumnNode*)pPara, true, &pExprs); } else { code = nodesListMakeStrictAppend(&pExprs, nodesCloneNode(pPara)); @@ -3022,11 +2992,18 @@ static int32_t createTags(STranslateContext* pCxt, SNodeList** pOutput) { return TSDB_CODE_SUCCESS; } + +#ifndef TD_ENTERPRISE +int32_t biRewriteSelectStar(STranslateContext* pCxt, SSelectStmt* pSelect) { + return TSDB_CODE_SUCCESS; +} +#endif + static int32_t translateStar(STranslateContext* pCxt, SSelectStmt* pSelect) { SNode* pNode = NULL; WHERE_EACH(pNode, pSelect->pProjectionList) { int32_t code = TSDB_CODE_SUCCESS; - if (isStar(pNode)) { + if (nodesIsStar(pNode)) { SNodeList* pCols = NULL; code = createAllColumns(pCxt, false, &pCols); if (TSDB_CODE_SUCCESS == code) { @@ -3046,7 +3023,7 @@ static int32_t translateStar(STranslateContext* pCxt, SSelectStmt* pSelect) { ERASE_NODE(pSelect->pProjectionList); continue; } - } else if (isTableStar(pNode)) { + } else if (nodesIsTableStar(pNode)) { SNodeList* pCols = NULL; code = createTableAllCols(pCxt, (SColumnNode*)pNode, false, &pCols); if (TSDB_CODE_SUCCESS == code) { @@ -3935,6 +3912,9 @@ static int32_t translateSelectFrom(STranslateContext* pCxt, SSelectStmt* pSelect if (TSDB_CODE_SUCCESS == code) { code = translateHaving(pCxt, pSelect); } + if (TSDB_CODE_SUCCESS == code && pCxt->pParseCxt->biMode != 0) { + code = biRewriteSelectStar(pCxt, pSelect); + } if (TSDB_CODE_SUCCESS == code) { code = translateSelectList(pCxt, pSelect); } @@ -7997,12 +7977,12 @@ static const char* getTbNameColName(ENodeType type) { return (QUERY_NODE_SHOW_STABLES_STMT == type ? "stable_name" : "table_name"); } -static int32_t createLogicCondNode(SNode* pCond1, SNode* pCond2, SNode** pCond) { +static int32_t createLogicCondNode(SNode* pCond1, SNode* pCond2, SNode** pCond, ELogicConditionType logicCondType) { SLogicConditionNode* pCondition = (SLogicConditionNode*)nodesMakeNode(QUERY_NODE_LOGIC_CONDITION); if (NULL == pCondition) { return TSDB_CODE_OUT_OF_MEMORY; } - pCondition->condType = LOGIC_COND_TYPE_AND; + pCondition->condType = logicCondType; pCondition->pParameterList = nodesMakeList(); if (NULL == pCondition->pParameterList) { nodesDestroyNode((SNode*)pCondition); @@ -8018,6 +7998,87 @@ static int32_t createLogicCondNode(SNode* pCond1, SNode* pCond2, SNode** pCond) return TSDB_CODE_SUCCESS; } +static int32_t insertCondIntoSelectStmt(SSelectStmt* pSelect, SNode* pCond) { + if (pSelect->pWhere == NULL) { + pSelect->pWhere = pCond; + } else { + SNode* pWhere = NULL; + createLogicCondNode(pSelect->pWhere, pCond, &pWhere, LOGIC_COND_TYPE_AND); + pSelect->pWhere = pWhere; + } + return TSDB_CODE_SUCCESS; +} + +static int32_t addShowUserDatabasesCond(SSelectStmt* pSelect) { + SNode* pNameCond1 = NULL; + SNode* pNameCond2 = NULL; + SValueNode* pValNode1 = nodesMakeValueNodeFromString(TSDB_INFORMATION_SCHEMA_DB); + SValueNode* pValNode2 = nodesMakeValueNodeFromString(TSDB_PERFORMANCE_SCHEMA_DB); + createOperatorNode(OP_TYPE_NOT_EQUAL, "name", (SNode*)pValNode1, &pNameCond1); + createOperatorNode(OP_TYPE_NOT_EQUAL, "name", (SNode*)pValNode2, &pNameCond2); + nodesDestroyNode((SNode*)pValNode2); + nodesDestroyNode((SNode*)pValNode1); + SNode* pNameCond = NULL; + createLogicCondNode(pNameCond1, pNameCond2, &pNameCond, LOGIC_COND_TYPE_AND); + insertCondIntoSelectStmt(pSelect, pNameCond); + return TSDB_CODE_SUCCESS; +} + +static int32_t addShowSystemDatabasesCond(SSelectStmt* pSelect) { + SNode* pNameCond1 = NULL; + SNode* pNameCond2 = NULL; + SValueNode* pValNode1 = nodesMakeValueNodeFromString(TSDB_INFORMATION_SCHEMA_DB); + SValueNode* pValNode2 = nodesMakeValueNodeFromString(TSDB_PERFORMANCE_SCHEMA_DB); + createOperatorNode(OP_TYPE_EQUAL, "name", (SNode*)pValNode1, &pNameCond1); + createOperatorNode(OP_TYPE_EQUAL, "name", (SNode*)pValNode2, &pNameCond2); + nodesDestroyNode((SNode*)pValNode2); + nodesDestroyNode((SNode*)pValNode1); + SNode* pNameCond = NULL; + createLogicCondNode(pNameCond1, pNameCond2, &pNameCond, LOGIC_COND_TYPE_OR); + insertCondIntoSelectStmt(pSelect, pNameCond); + return TSDB_CODE_SUCCESS; +} + +static int32_t addShowNormalTablesCond(SSelectStmt* pSelect) { + SNode* pTypeCond = NULL; + SValueNode* pValNode1 = nodesMakeValueNodeFromString("NORMAL_TABLE"); + createOperatorNode(OP_TYPE_EQUAL, "type", (SNode*)pValNode1, &pTypeCond); + nodesDestroyNode((SNode*)pValNode1); + insertCondIntoSelectStmt(pSelect, pTypeCond); + return TSDB_CODE_SUCCESS; +} + +static int32_t addShowChildTablesCond(SSelectStmt* pSelect) { + SNode* pTypeCond = NULL; + SValueNode* pValNode1 = nodesMakeValueNodeFromString("CHILD_TABLE"); + createOperatorNode(OP_TYPE_EQUAL, "type", (SNode*)pValNode1, &pTypeCond); + nodesDestroyNode((SNode*)pValNode1); + insertCondIntoSelectStmt(pSelect, pTypeCond); + return TSDB_CODE_SUCCESS; +} + +static int32_t addShowKindCond(const SShowStmt* pShow, SSelectStmt* pSelect) { + if (pShow->type != QUERY_NODE_SHOW_DATABASES_STMT && pShow->type != QUERY_NODE_SHOW_TABLES_STMT || + pShow->showKind == SHOW_KIND_ALL) { + return TSDB_CODE_SUCCESS; + } + if (pShow->type == QUERY_NODE_SHOW_DATABASES_STMT) { + if (pShow->showKind == SHOW_KIND_DATABASES_USER) { + addShowUserDatabasesCond(pSelect); + } else if (pShow->showKind == SHOW_KIND_DATABASES_SYSTEM) { + addShowSystemDatabasesCond(pSelect); + } + } else if (pShow->type == QUERY_NODE_SHOW_TABLES_STMT) { + if (pShow->showKind == SHOW_KIND_TABLES_NORMAL) { + addShowNormalTablesCond(pSelect); + } else if (pShow->showKind == SHOW_KIND_TABLES_CHILD) { + addShowChildTablesCond(pSelect); + } + } + return TSDB_CODE_SUCCESS; +} + + static int32_t createShowCondition(const SShowStmt* pShow, SSelectStmt* pSelect) { SNode* pDbCond = NULL; SNode* pTbCond = NULL; @@ -8030,7 +8091,7 @@ static int32_t createShowCondition(const SShowStmt* pShow, SSelectStmt* pSelect) } if (NULL != pDbCond && NULL != pTbCond) { - if (TSDB_CODE_SUCCESS != createLogicCondNode(pDbCond, pTbCond, &pSelect->pWhere)) { + if (TSDB_CODE_SUCCESS != createLogicCondNode(pDbCond, pTbCond, &pSelect->pWhere, LOGIC_COND_TYPE_AND)) { nodesDestroyNode(pDbCond); nodesDestroyNode(pTbCond); return TSDB_CODE_OUT_OF_MEMORY; @@ -8039,6 +8100,11 @@ static int32_t createShowCondition(const SShowStmt* pShow, SSelectStmt* pSelect) pSelect->pWhere = (NULL == pDbCond ? pTbCond : pDbCond); } + int32_t code = addShowKindCond(pShow, pSelect); + if (TSDB_CODE_SUCCESS != code) { + return code; + } + if (NULL != pShow->pDbName) { strcpy(((SRealTableNode*)pSelect->pFromTable)->qualDbName, ((SValueNode*)pShow->pDbName)->literal); } @@ -8132,7 +8198,7 @@ static int32_t rewriteShowDnodeVariables(STranslateContext* pCxt, SQuery* pQuery } if (TSDB_CODE_SUCCESS == code) { if (NULL != pLikeCond) { - code = createLogicCondNode(pDnodeCond, pLikeCond, &pSelect->pWhere); + code = createLogicCondNode(pDnodeCond, pLikeCond, &pSelect->pWhere, LOGIC_COND_TYPE_AND); } else { pSelect->pWhere = pDnodeCond; } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 5d295e083f..ff8031bc28 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -216,176 +216,179 @@ #define TK_SUBSCRIPTIONS 167 #define TK_VNODES 168 #define TK_ALIVE 169 -#define TK_LIKE 170 -#define TK_TBNAME 171 -#define TK_QTAGS 172 -#define TK_AS 173 -#define TK_INDEX 174 -#define TK_FUNCTION 175 -#define TK_INTERVAL 176 -#define TK_COUNT 177 -#define TK_LAST_ROW 178 -#define TK_META 179 -#define TK_ONLY 180 -#define TK_TOPIC 181 -#define TK_CONSUMER 182 -#define TK_GROUP 183 -#define TK_DESC 184 -#define TK_DESCRIBE 185 -#define TK_RESET 186 -#define TK_QUERY 187 -#define TK_CACHE 188 -#define TK_EXPLAIN 189 -#define TK_ANALYZE 190 -#define TK_VERBOSE 191 -#define TK_NK_BOOL 192 -#define TK_RATIO 193 -#define TK_NK_FLOAT 194 -#define TK_OUTPUTTYPE 195 -#define TK_AGGREGATE 196 -#define TK_BUFSIZE 197 -#define TK_LANGUAGE 198 -#define TK_REPLACE 199 -#define TK_STREAM 200 -#define TK_INTO 201 -#define TK_PAUSE 202 -#define TK_RESUME 203 -#define TK_TRIGGER 204 -#define TK_AT_ONCE 205 -#define TK_WINDOW_CLOSE 206 -#define TK_IGNORE 207 -#define TK_EXPIRED 208 -#define TK_FILL_HISTORY 209 -#define TK_UPDATE 210 -#define TK_SUBTABLE 211 -#define TK_UNTREATED 212 -#define TK_KILL 213 -#define TK_CONNECTION 214 -#define TK_TRANSACTION 215 -#define TK_BALANCE 216 -#define TK_VGROUP 217 -#define TK_LEADER 218 -#define TK_MERGE 219 -#define TK_REDISTRIBUTE 220 -#define TK_SPLIT 221 -#define TK_DELETE 222 -#define TK_INSERT 223 -#define TK_NULL 224 -#define TK_NK_QUESTION 225 -#define TK_NK_ARROW 226 -#define TK_ROWTS 227 -#define TK_QSTART 228 -#define TK_QEND 229 -#define TK_QDURATION 230 -#define TK_WSTART 231 -#define TK_WEND 232 -#define TK_WDURATION 233 -#define TK_IROWTS 234 -#define TK_ISFILLED 235 -#define TK_CAST 236 -#define TK_NOW 237 -#define TK_TODAY 238 -#define TK_TIMEZONE 239 -#define TK_CLIENT_VERSION 240 -#define TK_SERVER_VERSION 241 -#define TK_SERVER_STATUS 242 -#define TK_CURRENT_USER 243 -#define TK_CASE 244 -#define TK_WHEN 245 -#define TK_THEN 246 -#define TK_ELSE 247 -#define TK_BETWEEN 248 -#define TK_IS 249 -#define TK_NK_LT 250 -#define TK_NK_GT 251 -#define TK_NK_LE 252 -#define TK_NK_GE 253 -#define TK_NK_NE 254 -#define TK_MATCH 255 -#define TK_NMATCH 256 -#define TK_CONTAINS 257 -#define TK_IN 258 -#define TK_JOIN 259 -#define TK_INNER 260 -#define TK_SELECT 261 -#define TK_NK_HINT 262 -#define TK_DISTINCT 263 -#define TK_WHERE 264 -#define TK_PARTITION 265 -#define TK_BY 266 -#define TK_SESSION 267 -#define TK_STATE_WINDOW 268 -#define TK_EVENT_WINDOW 269 -#define TK_SLIDING 270 -#define TK_FILL 271 -#define TK_VALUE 272 -#define TK_VALUE_F 273 -#define TK_NONE 274 -#define TK_PREV 275 -#define TK_NULL_F 276 -#define TK_LINEAR 277 -#define TK_NEXT 278 -#define TK_HAVING 279 -#define TK_RANGE 280 -#define TK_EVERY 281 -#define TK_ORDER 282 -#define TK_SLIMIT 283 -#define TK_SOFFSET 284 -#define TK_LIMIT 285 -#define TK_OFFSET 286 -#define TK_ASC 287 -#define TK_NULLS 288 -#define TK_ABORT 289 -#define TK_AFTER 290 -#define TK_ATTACH 291 -#define TK_BEFORE 292 -#define TK_BEGIN 293 -#define TK_BITAND 294 -#define TK_BITNOT 295 -#define TK_BITOR 296 -#define TK_BLOCKS 297 -#define TK_CHANGE 298 -#define TK_COMMA 299 -#define TK_CONCAT 300 -#define TK_CONFLICT 301 -#define TK_COPY 302 -#define TK_DEFERRED 303 -#define TK_DELIMITERS 304 -#define TK_DETACH 305 -#define TK_DIVIDE 306 -#define TK_DOT 307 -#define TK_EACH 308 -#define TK_FAIL 309 -#define TK_FILE 310 -#define TK_FOR 311 -#define TK_GLOB 312 -#define TK_ID 313 -#define TK_IMMEDIATE 314 -#define TK_IMPORT 315 -#define TK_INITIALLY 316 -#define TK_INSTEAD 317 -#define TK_ISNULL 318 -#define TK_KEY 319 -#define TK_MODULES 320 -#define TK_NK_BITNOT 321 -#define TK_NK_SEMI 322 -#define TK_NOTNULL 323 -#define TK_OF 324 -#define TK_PLUS 325 -#define TK_PRIVILEGE 326 -#define TK_RAISE 327 -#define TK_RESTRICT 328 -#define TK_ROW 329 -#define TK_SEMI 330 -#define TK_STAR 331 -#define TK_STATEMENT 332 -#define TK_STRICT 333 -#define TK_STRING 334 -#define TK_TIMES 335 -#define TK_VALUES 336 -#define TK_VARIABLE 337 -#define TK_VIEW 338 -#define TK_WAL 339 +#define TK_NORMAL 170 +#define TK_CHILD 171 +#define TK_LIKE 172 +#define TK_TBNAME 173 +#define TK_QTAGS 174 +#define TK_AS 175 +#define TK_SYSTEM 176 +#define TK_INDEX 177 +#define TK_FUNCTION 178 +#define TK_INTERVAL 179 +#define TK_COUNT 180 +#define TK_LAST_ROW 181 +#define TK_META 182 +#define TK_ONLY 183 +#define TK_TOPIC 184 +#define TK_CONSUMER 185 +#define TK_GROUP 186 +#define TK_DESC 187 +#define TK_DESCRIBE 188 +#define TK_RESET 189 +#define TK_QUERY 190 +#define TK_CACHE 191 +#define TK_EXPLAIN 192 +#define TK_ANALYZE 193 +#define TK_VERBOSE 194 +#define TK_NK_BOOL 195 +#define TK_RATIO 196 +#define TK_NK_FLOAT 197 +#define TK_OUTPUTTYPE 198 +#define TK_AGGREGATE 199 +#define TK_BUFSIZE 200 +#define TK_LANGUAGE 201 +#define TK_REPLACE 202 +#define TK_STREAM 203 +#define TK_INTO 204 +#define TK_PAUSE 205 +#define TK_RESUME 206 +#define TK_TRIGGER 207 +#define TK_AT_ONCE 208 +#define TK_WINDOW_CLOSE 209 +#define TK_IGNORE 210 +#define TK_EXPIRED 211 +#define TK_FILL_HISTORY 212 +#define TK_UPDATE 213 +#define TK_SUBTABLE 214 +#define TK_UNTREATED 215 +#define TK_KILL 216 +#define TK_CONNECTION 217 +#define TK_TRANSACTION 218 +#define TK_BALANCE 219 +#define TK_VGROUP 220 +#define TK_LEADER 221 +#define TK_MERGE 222 +#define TK_REDISTRIBUTE 223 +#define TK_SPLIT 224 +#define TK_DELETE 225 +#define TK_INSERT 226 +#define TK_NULL 227 +#define TK_NK_QUESTION 228 +#define TK_NK_ARROW 229 +#define TK_ROWTS 230 +#define TK_QSTART 231 +#define TK_QEND 232 +#define TK_QDURATION 233 +#define TK_WSTART 234 +#define TK_WEND 235 +#define TK_WDURATION 236 +#define TK_IROWTS 237 +#define TK_ISFILLED 238 +#define TK_CAST 239 +#define TK_NOW 240 +#define TK_TODAY 241 +#define TK_TIMEZONE 242 +#define TK_CLIENT_VERSION 243 +#define TK_SERVER_VERSION 244 +#define TK_SERVER_STATUS 245 +#define TK_CURRENT_USER 246 +#define TK_CASE 247 +#define TK_WHEN 248 +#define TK_THEN 249 +#define TK_ELSE 250 +#define TK_BETWEEN 251 +#define TK_IS 252 +#define TK_NK_LT 253 +#define TK_NK_GT 254 +#define TK_NK_LE 255 +#define TK_NK_GE 256 +#define TK_NK_NE 257 +#define TK_MATCH 258 +#define TK_NMATCH 259 +#define TK_CONTAINS 260 +#define TK_IN 261 +#define TK_JOIN 262 +#define TK_INNER 263 +#define TK_SELECT 264 +#define TK_NK_HINT 265 +#define TK_DISTINCT 266 +#define TK_WHERE 267 +#define TK_PARTITION 268 +#define TK_BY 269 +#define TK_SESSION 270 +#define TK_STATE_WINDOW 271 +#define TK_EVENT_WINDOW 272 +#define TK_SLIDING 273 +#define TK_FILL 274 +#define TK_VALUE 275 +#define TK_VALUE_F 276 +#define TK_NONE 277 +#define TK_PREV 278 +#define TK_NULL_F 279 +#define TK_LINEAR 280 +#define TK_NEXT 281 +#define TK_HAVING 282 +#define TK_RANGE 283 +#define TK_EVERY 284 +#define TK_ORDER 285 +#define TK_SLIMIT 286 +#define TK_SOFFSET 287 +#define TK_LIMIT 288 +#define TK_OFFSET 289 +#define TK_ASC 290 +#define TK_NULLS 291 +#define TK_ABORT 292 +#define TK_AFTER 293 +#define TK_ATTACH 294 +#define TK_BEFORE 295 +#define TK_BEGIN 296 +#define TK_BITAND 297 +#define TK_BITNOT 298 +#define TK_BITOR 299 +#define TK_BLOCKS 300 +#define TK_CHANGE 301 +#define TK_COMMA 302 +#define TK_CONCAT 303 +#define TK_CONFLICT 304 +#define TK_COPY 305 +#define TK_DEFERRED 306 +#define TK_DELIMITERS 307 +#define TK_DETACH 308 +#define TK_DIVIDE 309 +#define TK_DOT 310 +#define TK_EACH 311 +#define TK_FAIL 312 +#define TK_FILE 313 +#define TK_FOR 314 +#define TK_GLOB 315 +#define TK_ID 316 +#define TK_IMMEDIATE 317 +#define TK_IMPORT 318 +#define TK_INITIALLY 319 +#define TK_INSTEAD 320 +#define TK_ISNULL 321 +#define TK_KEY 322 +#define TK_MODULES 323 +#define TK_NK_BITNOT 324 +#define TK_NK_SEMI 325 +#define TK_NOTNULL 326 +#define TK_OF 327 +#define TK_PLUS 328 +#define TK_PRIVILEGE 329 +#define TK_RAISE 330 +#define TK_RESTRICT 331 +#define TK_ROW 332 +#define TK_SEMI 333 +#define TK_STAR 334 +#define TK_STATEMENT 335 +#define TK_STRICT 336 +#define TK_STRING 337 +#define TK_TIMES 338 +#define TK_VALUES 339 +#define TK_VARIABLE 340 +#define TK_VIEW 341 +#define TK_WAL 342 #endif /**************** End token definitions ***************************************/ @@ -445,27 +448,29 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 494 +#define YYNOCODE 500 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SNode* yy28; - SDataType yy32; - EJoinType yy152; - SNodeList* yy236; - EFillMode yy322; - SAlterOption yy481; - int64_t yy701; - EOrder yy734; - bool yy793; - STokenPair yy833; - int8_t yy847; - SToken yy889; - EOperatorType yy896; - ENullOrder yy945; - int32_t yy956; + int64_t yy109; + SAlterOption yy245; + EShowKind yy289; + EFillMode yy294; + STokenPair yy297; + SToken yy329; + EJoinType yy412; + SNodeList* yy424; + SShowTablesOption yy517; + EOperatorType yy540; + SNode* yy712; + bool yy737; + SDataType yy784; + ENullOrder yy857; + int32_t yy860; + int8_t yy903; + EOrder yy938; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -481,18 +486,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 811 -#define YYNRULE 611 -#define YYNRULE_WITH_ACTION 611 -#define YYNTOKEN 340 -#define YY_MAX_SHIFT 810 -#define YY_MIN_SHIFTREDUCE 1196 -#define YY_MAX_SHIFTREDUCE 1806 -#define YY_ERROR_ACTION 1807 -#define YY_ACCEPT_ACTION 1808 -#define YY_NO_ACTION 1809 -#define YY_MIN_REDUCE 1810 -#define YY_MAX_REDUCE 2420 +#define YYNSTATE 816 +#define YYNRULE 620 +#define YYNRULE_WITH_ACTION 620 +#define YYNTOKEN 343 +#define YY_MAX_SHIFT 815 +#define YY_MIN_SHIFTREDUCE 1204 +#define YY_MAX_SHIFTREDUCE 1823 +#define YY_ERROR_ACTION 1824 +#define YY_ACCEPT_ACTION 1825 +#define YY_NO_ACTION 1826 +#define YY_MIN_REDUCE 1827 +#define YY_MAX_REDUCE 2446 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -559,813 +564,871 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2798) +#define YY_ACTTAB_COUNT (3087) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 38, 311, 2227, 410, 541, 699, 1994, 542, 1853, 2041, - /* 10 */ 2042, 164, 48, 46, 1733, 716, 416, 415, 389, 1996, - /* 20 */ 407, 1811, 1578, 41, 40, 133, 2045, 47, 45, 44, - /* 30 */ 43, 42, 583, 579, 578, 1659, 1893, 1576, 1603, 678, - /* 40 */ 142, 1585, 123, 2245, 2078, 122, 121, 120, 119, 118, - /* 50 */ 117, 116, 115, 114, 107, 2195, 9, 715, 699, 1994, - /* 60 */ 666, 41, 40, 2391, 1654, 47, 45, 44, 43, 42, - /* 70 */ 19, 143, 2116, 1606, 2116, 678, 142, 1584, 194, 1986, - /* 80 */ 665, 189, 678, 142, 400, 2392, 667, 2113, 686, 2114, - /* 90 */ 686, 2226, 170, 2262, 1822, 185, 172, 2228, 719, 2230, - /* 100 */ 2231, 714, 807, 709, 706, 15, 459, 2034, 782, 781, - /* 110 */ 780, 779, 419, 504, 778, 777, 146, 772, 771, 770, - /* 120 */ 769, 768, 767, 766, 158, 762, 761, 760, 418, 417, - /* 130 */ 757, 756, 755, 177, 176, 1604, 1833, 1603, 1808, 1394, - /* 140 */ 546, 1661, 1662, 188, 2323, 2324, 543, 140, 2328, 668, - /* 150 */ 2412, 355, 2181, 1385, 744, 743, 742, 1389, 741, 1391, - /* 160 */ 1392, 740, 737, 698, 1400, 734, 1402, 1403, 731, 728, - /* 170 */ 725, 1634, 1644, 213, 212, 699, 1994, 1660, 1663, 190, - /* 180 */ 2323, 2324, 560, 140, 2328, 1970, 290, 2323, 677, 2195, - /* 190 */ 134, 676, 1579, 2391, 1577, 56, 503, 2396, 1588, 1803, - /* 200 */ 2391, 41, 40, 429, 482, 47, 45, 44, 43, 42, - /* 210 */ 665, 189, 1604, 481, 422, 2392, 667, 549, 2395, 421, - /* 220 */ 542, 1853, 2392, 2394, 1582, 1583, 270, 1633, 1636, 1637, - /* 230 */ 1638, 1639, 1640, 1641, 1642, 1643, 711, 707, 1652, 1653, - /* 240 */ 1655, 1656, 1657, 1658, 2, 48, 46, 698, 640, 1261, - /* 250 */ 359, 1260, 1601, 407, 754, 1578, 1504, 1505, 1680, 495, - /* 260 */ 2227, 641, 511, 367, 2391, 1236, 138, 510, 1659, 556, - /* 270 */ 1576, 41, 40, 716, 1722, 47, 45, 44, 43, 42, - /* 280 */ 1603, 2397, 189, 478, 1262, 512, 2392, 667, 1487, 1488, - /* 290 */ 480, 1761, 1503, 1506, 698, 2396, 30, 1654, 2391, 557, - /* 300 */ 62, 2245, 1802, 19, 1264, 1265, 1688, 1238, 1241, 1242, - /* 310 */ 1584, 678, 142, 2195, 412, 715, 2395, 2040, 2042, 123, - /* 320 */ 2392, 2393, 122, 121, 120, 119, 118, 117, 116, 115, - /* 330 */ 114, 656, 51, 1429, 1430, 807, 376, 101, 15, 653, - /* 340 */ 652, 1759, 1760, 1762, 1763, 1764, 2205, 466, 2160, 2226, - /* 350 */ 1832, 2262, 558, 2109, 110, 2228, 719, 2230, 2231, 714, - /* 360 */ 2213, 709, 1987, 1689, 145, 62, 151, 2286, 2315, 1773, - /* 370 */ 2209, 60, 403, 2311, 1661, 1662, 52, 508, 638, 51, - /* 380 */ 502, 501, 500, 499, 494, 493, 492, 491, 490, 486, - /* 390 */ 485, 484, 483, 358, 475, 474, 473, 258, 468, 467, - /* 400 */ 374, 699, 1994, 2195, 1634, 1644, 1810, 1880, 2211, 404, - /* 410 */ 1660, 1663, 661, 66, 680, 187, 2323, 2324, 709, 140, - /* 420 */ 2328, 133, 662, 657, 650, 1579, 660, 1577, 588, 602, - /* 430 */ 132, 131, 130, 129, 128, 127, 126, 125, 124, 699, - /* 440 */ 1994, 37, 405, 1683, 1684, 1685, 1686, 1687, 1691, 1692, - /* 450 */ 1693, 1694, 581, 580, 2245, 441, 294, 1582, 1583, 457, - /* 460 */ 1633, 1636, 1637, 1638, 1639, 1640, 1641, 1642, 1643, 711, - /* 470 */ 707, 1652, 1653, 1655, 1656, 1657, 1658, 2, 12, 48, - /* 480 */ 46, 2330, 443, 439, 1261, 2227, 1260, 407, 294, 1578, - /* 490 */ 752, 156, 155, 749, 748, 747, 153, 222, 681, 62, - /* 500 */ 538, 544, 1659, 1860, 1576, 2227, 2205, 2327, 536, 659, - /* 510 */ 606, 532, 528, 626, 62, 601, 600, 599, 716, 1262, - /* 520 */ 1985, 294, 591, 139, 595, 618, 2245, 754, 594, 182, - /* 530 */ 2209, 1654, 294, 593, 598, 383, 382, 19, 2195, 592, - /* 540 */ 715, 254, 464, 2095, 1584, 401, 2245, 2047, 617, 375, - /* 550 */ 2099, 256, 182, 167, 373, 255, 144, 609, 2195, 2286, - /* 560 */ 715, 1996, 2045, 615, 603, 613, 253, 252, 2211, 807, - /* 570 */ 251, 1338, 15, 2100, 2226, 12, 2262, 2227, 709, 110, - /* 580 */ 2228, 719, 2230, 2231, 714, 451, 709, 450, 90, 203, - /* 590 */ 716, 186, 1862, 2315, 2226, 1831, 2262, 403, 2311, 171, - /* 600 */ 2228, 719, 2230, 2231, 714, 377, 709, 169, 1661, 1662, - /* 610 */ 70, 1340, 191, 69, 1989, 1935, 93, 449, 2245, 362, - /* 620 */ 2345, 1584, 387, 2396, 619, 1737, 666, 597, 596, 2391, - /* 630 */ 2195, 1603, 715, 47, 45, 44, 43, 42, 1634, 1644, - /* 640 */ 1605, 642, 2356, 745, 1660, 1663, 665, 189, 2195, 410, - /* 650 */ 224, 2392, 667, 589, 544, 294, 1860, 167, 2178, 1579, - /* 660 */ 1896, 1577, 699, 1994, 1578, 1996, 2226, 2330, 2262, 1349, - /* 670 */ 294, 110, 2228, 719, 2230, 2231, 714, 1336, 709, 1576, - /* 680 */ 470, 2095, 458, 2411, 1348, 2315, 44, 43, 42, 403, - /* 690 */ 2311, 1582, 1583, 2326, 1633, 1636, 1637, 1638, 1639, 1640, - /* 700 */ 1641, 1642, 1643, 711, 707, 1652, 1653, 1655, 1656, 1657, - /* 710 */ 1658, 2, 48, 46, 1664, 1863, 1830, 2227, 453, 1584, - /* 720 */ 407, 2047, 1578, 452, 302, 303, 1796, 206, 2188, 301, - /* 730 */ 681, 2047, 601, 600, 599, 1659, 685, 1576, 388, 591, - /* 740 */ 139, 595, 699, 1994, 807, 594, 2045, 2205, 2047, 513, - /* 750 */ 593, 598, 383, 382, 699, 1994, 592, 12, 2245, 10, - /* 760 */ 2189, 2214, 472, 694, 1654, 641, 2047, 800, 2391, 2195, - /* 770 */ 2195, 2209, 715, 397, 487, 641, 1871, 1584, 2391, 699, - /* 780 */ 1994, 2045, 1635, 699, 1994, 2397, 189, 764, 497, 2095, - /* 790 */ 2392, 667, 257, 292, 746, 2397, 189, 2038, 604, 488, - /* 800 */ 2392, 667, 807, 559, 2227, 49, 2226, 641, 2262, 2211, - /* 810 */ 2391, 110, 2228, 719, 2230, 2231, 714, 716, 709, 709, - /* 820 */ 699, 1994, 317, 186, 2047, 2315, 1605, 2397, 189, 403, - /* 830 */ 2311, 402, 2392, 667, 1579, 211, 1577, 1971, 1983, 2045, - /* 840 */ 1991, 1661, 1662, 41, 40, 2245, 1353, 47, 45, 44, - /* 850 */ 43, 42, 2346, 699, 1994, 699, 1994, 2195, 1829, 715, - /* 860 */ 168, 1352, 1549, 1550, 1669, 333, 1582, 1583, 699, 1994, - /* 870 */ 1603, 1634, 1644, 259, 2047, 267, 436, 1660, 1663, 1969, - /* 880 */ 2330, 411, 330, 73, 699, 1994, 72, 1979, 684, 2045, - /* 890 */ 14, 13, 1579, 2226, 1577, 2262, 356, 90, 111, 2228, - /* 900 */ 719, 2230, 2231, 714, 306, 709, 2325, 220, 523, 521, - /* 910 */ 518, 2195, 2315, 1828, 41, 40, 2314, 2311, 47, 45, - /* 920 */ 44, 43, 42, 1990, 1582, 1583, 515, 1633, 1636, 1637, - /* 930 */ 1638, 1639, 1640, 1641, 1642, 1643, 711, 707, 1652, 1653, - /* 940 */ 1655, 1656, 1657, 1658, 2, 48, 46, 62, 1603, 699, - /* 950 */ 1994, 1827, 1826, 407, 1690, 1578, 41, 40, 699, 1994, - /* 960 */ 47, 45, 44, 43, 42, 1606, 2195, 239, 1659, 696, - /* 970 */ 1576, 752, 156, 155, 749, 748, 747, 153, 697, 292, - /* 980 */ 699, 1994, 413, 174, 1825, 109, 699, 1994, 2227, 1606, - /* 990 */ 167, 577, 573, 569, 565, 1702, 238, 1654, 1996, 624, - /* 1000 */ 312, 716, 1730, 2353, 2195, 2195, 414, 208, 166, 701, - /* 1010 */ 1584, 2287, 1772, 752, 156, 155, 749, 748, 747, 153, - /* 1020 */ 1824, 1635, 703, 1821, 2287, 1820, 81, 80, 456, 2245, - /* 1030 */ 2359, 201, 35, 776, 774, 807, 91, 2195, 49, 236, - /* 1040 */ 2227, 2195, 1695, 715, 448, 446, 641, 86, 587, 2391, - /* 1050 */ 85, 167, 586, 716, 1749, 357, 2395, 765, 437, 1997, - /* 1060 */ 1956, 435, 431, 427, 424, 449, 2397, 189, 1838, 802, - /* 1070 */ 2088, 2392, 667, 2195, 1661, 1662, 2195, 2226, 2195, 2262, - /* 1080 */ 3, 2245, 110, 2228, 719, 2230, 2231, 714, 670, 709, - /* 1090 */ 1819, 1818, 54, 2195, 2411, 715, 2315, 1817, 1816, 1635, - /* 1100 */ 403, 2311, 2047, 294, 1634, 1644, 235, 228, 1587, 34, - /* 1110 */ 1660, 1663, 462, 233, 554, 41, 40, 2046, 204, 47, - /* 1120 */ 45, 44, 43, 42, 106, 1579, 154, 1577, 1815, 2226, - /* 1130 */ 1814, 2262, 226, 103, 110, 2228, 719, 2230, 2231, 714, - /* 1140 */ 682, 709, 269, 2195, 2195, 1813, 2290, 1972, 2315, 154, - /* 1150 */ 2195, 2195, 403, 2311, 381, 380, 750, 1582, 1583, 2038, - /* 1160 */ 1633, 1636, 1637, 1638, 1639, 1640, 1641, 1642, 1643, 711, - /* 1170 */ 707, 1652, 1653, 1655, 1656, 1657, 1658, 2, 48, 46, - /* 1180 */ 147, 2195, 751, 2195, 673, 2038, 407, 641, 1578, 326, - /* 1190 */ 2391, 1244, 2024, 1241, 1242, 2335, 1722, 1602, 2195, 55, - /* 1200 */ 74, 1659, 135, 1576, 2227, 268, 244, 2397, 189, 242, - /* 1210 */ 1869, 590, 2392, 667, 83, 154, 50, 716, 246, 2366, - /* 1220 */ 248, 245, 1544, 247, 379, 378, 250, 585, 1981, 249, - /* 1230 */ 1654, 1977, 607, 41, 40, 1334, 50, 47, 45, 44, - /* 1240 */ 43, 42, 621, 1584, 620, 2245, 758, 274, 94, 587, - /* 1250 */ 84, 2227, 154, 586, 1805, 1806, 50, 2195, 1998, 715, - /* 1260 */ 263, 1729, 2216, 299, 716, 1590, 648, 710, 807, 36, - /* 1270 */ 1314, 15, 1586, 759, 266, 41, 40, 1936, 2227, 47, - /* 1280 */ 45, 44, 43, 42, 14, 13, 1295, 287, 1547, 1758, - /* 1290 */ 1823, 713, 2245, 2226, 654, 2262, 137, 1312, 110, 2228, - /* 1300 */ 719, 2230, 2231, 714, 2195, 709, 715, 1661, 1662, 1757, - /* 1310 */ 2411, 281, 2315, 1934, 71, 152, 403, 2311, 2218, 2245, - /* 1320 */ 276, 1933, 2246, 420, 390, 683, 1296, 2104, 1854, 1501, - /* 1330 */ 2349, 2195, 1859, 715, 2035, 669, 304, 1634, 1644, 671, - /* 1340 */ 2226, 154, 2262, 1660, 1663, 110, 2228, 719, 2230, 2231, - /* 1350 */ 714, 64, 709, 679, 50, 289, 286, 2411, 1579, 2315, - /* 1360 */ 1577, 416, 415, 403, 2311, 50, 293, 2226, 5, 2262, - /* 1370 */ 2227, 1592, 348, 2228, 719, 2230, 2231, 714, 712, 709, - /* 1380 */ 700, 2280, 423, 716, 1659, 2384, 1585, 691, 308, 428, - /* 1390 */ 1582, 1583, 371, 1633, 1636, 1637, 1638, 1639, 1640, 1641, - /* 1400 */ 1642, 1643, 711, 707, 1652, 1653, 1655, 1656, 1657, 1658, - /* 1410 */ 2, 2245, 723, 1654, 1379, 152, 1609, 154, 136, 2227, - /* 1420 */ 152, 445, 444, 2195, 1696, 715, 1584, 1645, 196, 1589, - /* 1430 */ 197, 447, 716, 199, 2334, 1525, 320, 674, 325, 2227, - /* 1440 */ 1602, 465, 463, 210, 1606, 2105, 469, 471, 506, 476, - /* 1450 */ 1601, 705, 716, 496, 489, 2097, 516, 498, 505, 2226, - /* 1460 */ 2245, 2262, 507, 517, 110, 2228, 719, 2230, 2231, 714, - /* 1470 */ 514, 709, 2195, 214, 715, 215, 2411, 519, 2315, 217, - /* 1480 */ 2245, 522, 403, 2311, 524, 1407, 1607, 520, 1411, 4, - /* 1490 */ 1418, 1416, 2195, 157, 715, 540, 539, 547, 550, 225, - /* 1500 */ 1604, 551, 548, 227, 1608, 1610, 553, 1611, 2226, 552, - /* 1510 */ 2262, 555, 582, 110, 2228, 719, 2230, 2231, 714, 230, - /* 1520 */ 709, 232, 88, 2110, 89, 2411, 561, 2315, 2226, 237, - /* 1530 */ 2262, 403, 2311, 110, 2228, 719, 2230, 2231, 714, 610, - /* 1540 */ 709, 1593, 112, 1588, 352, 2288, 584, 2315, 611, 2169, - /* 1550 */ 623, 403, 2311, 625, 1984, 2166, 241, 1980, 243, 160, - /* 1560 */ 161, 92, 1982, 2227, 1978, 162, 148, 260, 163, 629, - /* 1570 */ 321, 628, 1532, 1596, 1598, 2165, 716, 636, 264, 2365, - /* 1580 */ 635, 630, 655, 633, 689, 262, 707, 1652, 1653, 1655, - /* 1590 */ 1656, 1657, 1658, 645, 2350, 2227, 2360, 651, 8, 2364, - /* 1600 */ 272, 664, 275, 393, 2245, 658, 175, 2337, 716, 634, - /* 1610 */ 280, 646, 643, 282, 644, 2227, 2195, 283, 715, 394, - /* 1620 */ 2414, 285, 675, 2390, 672, 1722, 141, 1605, 716, 1725, - /* 1630 */ 2331, 1727, 179, 295, 687, 149, 2245, 1, 284, 322, - /* 1640 */ 688, 150, 2227, 2124, 2123, 323, 2122, 399, 2195, 692, - /* 1650 */ 715, 100, 2226, 693, 2262, 716, 2245, 110, 2228, 719, - /* 1660 */ 2230, 2231, 714, 1995, 709, 324, 192, 61, 2195, 702, - /* 1670 */ 715, 2315, 2296, 102, 721, 403, 2311, 1957, 288, 327, - /* 1680 */ 2039, 1220, 315, 2245, 2226, 804, 2262, 801, 53, 111, - /* 1690 */ 2228, 719, 2230, 2231, 714, 2195, 709, 715, 329, 159, - /* 1700 */ 806, 351, 363, 2315, 717, 2227, 2262, 704, 2311, 111, - /* 1710 */ 2228, 719, 2230, 2231, 714, 2187, 709, 364, 716, 78, - /* 1720 */ 336, 2227, 350, 2315, 340, 2186, 2185, 366, 2311, 331, - /* 1730 */ 2182, 2226, 425, 2262, 716, 426, 111, 2228, 719, 2230, - /* 1740 */ 2231, 714, 1569, 709, 1570, 195, 2245, 430, 2180, 432, - /* 1750 */ 2315, 433, 2227, 434, 2179, 2312, 372, 2177, 2195, 438, - /* 1760 */ 715, 2176, 2245, 440, 2175, 716, 442, 391, 1560, 2156, - /* 1770 */ 2227, 198, 2155, 200, 2195, 79, 715, 1528, 1527, 2137, - /* 1780 */ 2136, 2135, 454, 716, 455, 2134, 2133, 1478, 2087, 460, - /* 1790 */ 461, 2084, 202, 2245, 2226, 2083, 2262, 2082, 392, 171, - /* 1800 */ 2228, 719, 2230, 2231, 714, 2195, 709, 715, 82, 2081, - /* 1810 */ 2226, 2245, 2262, 2086, 205, 349, 2228, 719, 2230, 2231, - /* 1820 */ 714, 2085, 709, 2195, 2080, 715, 2079, 2077, 2076, 2075, - /* 1830 */ 207, 477, 2074, 479, 2090, 2073, 2072, 2071, 2070, 2069, - /* 1840 */ 2068, 2226, 2357, 2262, 2067, 2066, 349, 2228, 719, 2230, - /* 1850 */ 2231, 714, 2065, 709, 2064, 2063, 2062, 2227, 360, 2226, - /* 1860 */ 2061, 2262, 2060, 2059, 342, 2228, 719, 2230, 2231, 714, - /* 1870 */ 716, 709, 2227, 2058, 209, 87, 2057, 2056, 2055, 2089, - /* 1880 */ 2054, 2053, 2052, 1480, 2051, 716, 2050, 2227, 509, 2049, - /* 1890 */ 2048, 1350, 1354, 361, 1899, 216, 1346, 1898, 2245, 1897, - /* 1900 */ 713, 1895, 1892, 525, 526, 218, 527, 1891, 529, 663, - /* 1910 */ 2195, 219, 715, 2245, 531, 1884, 530, 535, 398, 534, - /* 1920 */ 533, 1873, 537, 1849, 183, 2195, 1243, 715, 2245, 231, - /* 1930 */ 76, 1848, 221, 2154, 2227, 2144, 223, 2132, 2131, 2108, - /* 1940 */ 2195, 2215, 715, 1973, 184, 545, 2226, 716, 2262, 234, - /* 1950 */ 77, 172, 2228, 719, 2230, 2231, 714, 1894, 709, 2227, - /* 1960 */ 229, 2226, 562, 2262, 1890, 563, 349, 2228, 719, 2230, - /* 1970 */ 2231, 714, 716, 709, 1288, 2245, 2226, 1888, 2262, 566, - /* 1980 */ 406, 348, 2228, 719, 2230, 2231, 714, 2195, 709, 715, - /* 1990 */ 2281, 564, 567, 568, 1886, 570, 2227, 571, 572, 1883, - /* 2000 */ 2245, 575, 574, 576, 1868, 2413, 1866, 1867, 1865, 716, - /* 2010 */ 1845, 1975, 2195, 1423, 715, 1422, 240, 63, 1974, 1337, - /* 2020 */ 1335, 1333, 1332, 2226, 1331, 2262, 1330, 1329, 349, 2228, - /* 2030 */ 719, 2230, 2231, 714, 773, 709, 775, 2245, 1324, 1326, - /* 2040 */ 1881, 384, 408, 1872, 385, 605, 1325, 1870, 622, 2195, - /* 2050 */ 2262, 715, 1323, 344, 2228, 719, 2230, 2231, 714, 386, - /* 2060 */ 709, 608, 2227, 1844, 1843, 1842, 612, 1841, 614, 1840, - /* 2070 */ 616, 113, 1554, 1556, 1558, 716, 1553, 29, 2153, 57, - /* 2080 */ 67, 1534, 1536, 2227, 631, 2226, 2143, 2262, 265, 627, - /* 2090 */ 349, 2228, 719, 2230, 2231, 714, 716, 709, 2130, 632, - /* 2100 */ 2129, 1513, 2396, 2245, 20, 1512, 165, 810, 1538, 637, - /* 2110 */ 31, 6, 17, 639, 2227, 2195, 647, 715, 1775, 271, - /* 2120 */ 7, 649, 21, 319, 2245, 22, 173, 716, 278, 273, - /* 2130 */ 279, 1756, 277, 32, 2216, 95, 2195, 33, 715, 181, - /* 2140 */ 1748, 65, 24, 1790, 1795, 1789, 291, 798, 794, 790, - /* 2150 */ 786, 2226, 316, 2262, 395, 2245, 334, 2228, 719, 2230, - /* 2160 */ 2231, 714, 1796, 709, 23, 1794, 1793, 2195, 396, 715, - /* 2170 */ 59, 178, 2226, 2128, 2262, 58, 2107, 332, 2228, 719, - /* 2180 */ 2230, 2231, 714, 18, 709, 2227, 1719, 97, 1718, 298, - /* 2190 */ 2106, 307, 108, 1754, 98, 309, 96, 310, 716, 25, - /* 2200 */ 26, 2227, 690, 2226, 103, 2262, 300, 305, 335, 2228, - /* 2210 */ 719, 2230, 2231, 714, 716, 709, 68, 99, 1671, 11, - /* 2220 */ 13, 1670, 1594, 180, 1681, 2265, 2245, 695, 193, 1649, - /* 2230 */ 708, 1626, 1647, 1646, 720, 39, 722, 16, 2195, 27, - /* 2240 */ 715, 1618, 2245, 409, 28, 726, 1408, 724, 1413, 1405, - /* 2250 */ 1404, 727, 729, 2227, 2195, 730, 715, 1401, 732, 718, - /* 2260 */ 733, 735, 297, 1395, 736, 738, 716, 1393, 739, 296, - /* 2270 */ 313, 104, 2227, 1399, 2226, 105, 2262, 1417, 1286, 341, - /* 2280 */ 2228, 719, 2230, 2231, 714, 716, 709, 75, 261, 753, - /* 2290 */ 2226, 1398, 2262, 1318, 2245, 345, 2228, 719, 2230, 2231, - /* 2300 */ 714, 1397, 709, 1396, 1317, 2227, 2195, 1316, 715, 1315, - /* 2310 */ 1344, 1313, 1311, 2245, 1310, 1309, 763, 314, 716, 1307, - /* 2320 */ 1306, 1304, 1305, 1303, 2227, 2195, 1302, 715, 1341, 1301, - /* 2330 */ 1339, 1298, 1297, 1294, 1293, 1292, 1889, 716, 1291, 783, - /* 2340 */ 2227, 784, 2226, 1887, 2262, 785, 2245, 337, 2228, 719, - /* 2350 */ 2230, 2231, 714, 716, 709, 787, 788, 789, 2195, 1885, - /* 2360 */ 715, 2226, 791, 2262, 793, 2245, 346, 2228, 719, 2230, - /* 2370 */ 2231, 714, 792, 709, 1882, 2227, 795, 2195, 796, 715, - /* 2380 */ 1864, 2245, 797, 799, 1233, 1839, 1221, 803, 716, 318, - /* 2390 */ 805, 808, 2227, 2195, 2226, 715, 2262, 1580, 328, 338, - /* 2400 */ 2228, 719, 2230, 2231, 714, 716, 709, 809, 1809, 1809, - /* 2410 */ 1809, 1809, 1809, 2226, 1809, 2262, 2245, 1809, 347, 2228, - /* 2420 */ 719, 2230, 2231, 714, 1809, 709, 1809, 2227, 2195, 2226, - /* 2430 */ 715, 2262, 1809, 2245, 339, 2228, 719, 2230, 2231, 714, - /* 2440 */ 716, 709, 1809, 1809, 1809, 2195, 1809, 715, 1809, 1809, - /* 2450 */ 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, - /* 2460 */ 1809, 1809, 1809, 1809, 2226, 1809, 2262, 1809, 2245, 353, - /* 2470 */ 2228, 719, 2230, 2231, 714, 1809, 709, 1809, 1809, 1809, - /* 2480 */ 2195, 2226, 715, 2262, 1809, 1809, 354, 2228, 719, 2230, - /* 2490 */ 2231, 714, 2227, 709, 1809, 1809, 1809, 1809, 1809, 1809, - /* 2500 */ 1809, 1809, 1809, 1809, 1809, 716, 1809, 2227, 1809, 1809, - /* 2510 */ 1809, 1809, 1809, 1809, 1809, 1809, 2226, 1809, 2262, 1809, - /* 2520 */ 716, 2239, 2228, 719, 2230, 2231, 714, 1809, 709, 2227, - /* 2530 */ 1809, 1809, 1809, 2245, 1809, 1809, 1809, 1809, 1809, 1809, - /* 2540 */ 1809, 1809, 716, 1809, 1809, 2195, 1809, 715, 2245, 1809, - /* 2550 */ 1809, 1809, 1809, 1809, 2227, 1809, 1809, 1809, 1809, 1809, - /* 2560 */ 2195, 1809, 715, 1809, 1809, 1809, 1809, 716, 1809, 1809, - /* 2570 */ 2245, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, - /* 2580 */ 1809, 2226, 2195, 2262, 715, 1809, 2238, 2228, 719, 2230, - /* 2590 */ 2231, 714, 1809, 709, 1809, 2245, 2226, 1809, 2262, 1809, - /* 2600 */ 1809, 2237, 2228, 719, 2230, 2231, 714, 2195, 709, 715, - /* 2610 */ 1809, 1809, 1809, 1809, 1809, 1809, 2227, 1809, 2226, 1809, - /* 2620 */ 2262, 1809, 1809, 368, 2228, 719, 2230, 2231, 714, 716, - /* 2630 */ 709, 1809, 1809, 1809, 2227, 1809, 1809, 1809, 1809, 1809, - /* 2640 */ 1809, 1809, 1809, 2226, 1809, 2262, 1809, 716, 369, 2228, - /* 2650 */ 719, 2230, 2231, 714, 1809, 709, 1809, 2245, 1809, 1809, - /* 2660 */ 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 2195, - /* 2670 */ 1809, 715, 1809, 1809, 1809, 2245, 1809, 1809, 1809, 1809, - /* 2680 */ 1809, 2227, 1809, 1809, 1809, 1809, 1809, 2195, 1809, 715, - /* 2690 */ 1809, 1809, 1809, 1809, 716, 1809, 2227, 1809, 1809, 1809, - /* 2700 */ 1809, 1809, 1809, 1809, 1809, 2226, 1809, 2262, 1809, 716, - /* 2710 */ 365, 2228, 719, 2230, 2231, 714, 1809, 709, 1809, 1809, - /* 2720 */ 1809, 1809, 2245, 2226, 1809, 2262, 1809, 1809, 370, 2228, - /* 2730 */ 719, 2230, 2231, 714, 2195, 709, 715, 2245, 1809, 1809, - /* 2740 */ 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 2195, - /* 2750 */ 1809, 715, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, - /* 2760 */ 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, 1809, - /* 2770 */ 717, 1809, 2262, 1809, 1809, 344, 2228, 719, 2230, 2231, - /* 2780 */ 714, 1809, 709, 1809, 1809, 2226, 1809, 2262, 1809, 1809, - /* 2790 */ 343, 2228, 719, 2230, 2231, 714, 1809, 709, + /* 0 */ 2142, 2231, 14, 13, 38, 312, 671, 2000, 2422, 2417, + /* 10 */ 1850, 2417, 48, 46, 1750, 2239, 2058, 2059, 2140, 691, + /* 20 */ 408, 1849, 1595, 1828, 223, 2235, 670, 189, 549, 2421, + /* 30 */ 1877, 2418, 672, 2418, 2420, 1676, 1910, 1593, 47, 45, + /* 40 */ 44, 43, 42, 2142, 123, 1848, 2253, 122, 121, 120, + /* 50 */ 119, 118, 117, 116, 115, 114, 683, 142, 401, 686, + /* 60 */ 1620, 2139, 691, 2221, 1671, 1827, 2237, 405, 1272, 1273, + /* 70 */ 19, 1269, 1825, 1268, 2221, 123, 714, 1601, 122, 121, + /* 80 */ 120, 119, 118, 117, 116, 115, 114, 2271, 138, 132, + /* 90 */ 131, 130, 129, 128, 127, 126, 125, 124, 2221, 2221, + /* 100 */ 546, 720, 812, 547, 1870, 15, 1270, 1719, 787, 786, + /* 110 */ 785, 784, 420, 565, 783, 782, 146, 777, 776, 775, + /* 120 */ 774, 773, 772, 771, 158, 767, 766, 765, 419, 418, + /* 130 */ 762, 761, 760, 177, 176, 703, 62, 461, 2252, 645, + /* 140 */ 2288, 1678, 1679, 110, 2254, 724, 2256, 2257, 719, 454, + /* 150 */ 714, 423, 704, 2011, 453, 186, 422, 2341, 584, 583, + /* 160 */ 622, 404, 2337, 291, 2349, 682, 665, 134, 681, 703, + /* 170 */ 2417, 2095, 194, 1651, 1661, 620, 191, 618, 254, 253, + /* 180 */ 1677, 1680, 513, 511, 2371, 360, 2422, 670, 189, 202, + /* 190 */ 417, 416, 2418, 672, 2271, 1596, 646, 1594, 646, 2417, + /* 200 */ 170, 2417, 1839, 1622, 41, 40, 704, 2011, 47, 45, + /* 210 */ 44, 43, 42, 1501, 1502, 1602, 2423, 189, 2423, 189, + /* 220 */ 51, 2418, 672, 2418, 672, 1621, 56, 1599, 1600, 1620, + /* 230 */ 1650, 1653, 1654, 1655, 1656, 1657, 1658, 1659, 1660, 716, + /* 240 */ 712, 1669, 1670, 1672, 1673, 1674, 1675, 2, 48, 46, + /* 250 */ 1987, 67, 664, 359, 51, 1618, 408, 554, 1595, 1622, + /* 260 */ 547, 1870, 498, 1913, 60, 516, 368, 704, 2011, 169, + /* 270 */ 515, 1676, 643, 1593, 41, 40, 1778, 1952, 47, 45, + /* 280 */ 44, 43, 42, 606, 605, 604, 481, 133, 517, 1813, + /* 290 */ 596, 139, 600, 483, 588, 295, 599, 1620, 2231, 30, + /* 300 */ 1671, 598, 603, 384, 383, 12, 19, 597, 185, 1705, + /* 310 */ 41, 40, 2002, 1601, 47, 45, 44, 43, 42, 759, + /* 320 */ 2051, 2253, 2235, 1244, 658, 657, 1776, 1777, 1779, 1780, + /* 330 */ 1781, 485, 683, 142, 686, 606, 605, 604, 812, 377, + /* 340 */ 484, 15, 596, 139, 600, 225, 1437, 1438, 599, 549, + /* 350 */ 469, 1877, 62, 598, 603, 384, 383, 413, 293, 597, + /* 360 */ 2057, 2059, 2271, 2237, 551, 1246, 1249, 1250, 1706, 661, + /* 370 */ 548, 562, 1790, 714, 2221, 1605, 720, 1678, 1679, 295, + /* 380 */ 2129, 2108, 62, 505, 504, 503, 502, 497, 496, 495, + /* 390 */ 494, 493, 489, 488, 487, 486, 358, 478, 477, 476, + /* 400 */ 52, 471, 470, 375, 167, 1489, 1490, 442, 75, 1651, + /* 410 */ 1661, 1508, 2014, 2252, 293, 2288, 1677, 1680, 110, 2254, + /* 420 */ 724, 2256, 2257, 719, 703, 714, 1988, 563, 2135, 507, + /* 430 */ 186, 1596, 2341, 1594, 444, 440, 404, 2337, 685, 187, + /* 440 */ 2349, 2350, 561, 140, 2354, 683, 142, 37, 406, 1700, + /* 450 */ 1701, 1702, 1703, 1704, 1708, 1709, 1710, 1711, 85, 2372, + /* 460 */ 667, 662, 655, 1599, 1600, 258, 1650, 1653, 1654, 1655, + /* 470 */ 1656, 1657, 1658, 1659, 1660, 716, 712, 1669, 1670, 1672, + /* 480 */ 1673, 1674, 1675, 2, 12, 48, 46, 2253, 666, 1820, + /* 490 */ 213, 411, 102, 408, 2064, 1595, 704, 2011, 2064, 164, + /* 500 */ 721, 389, 467, 2118, 1402, 374, 390, 2013, 1676, 2062, + /* 510 */ 1593, 295, 506, 2062, 2062, 1847, 458, 2004, 1393, 749, + /* 520 */ 748, 747, 1397, 746, 1399, 1400, 745, 742, 2271, 1408, + /* 530 */ 739, 1410, 1411, 736, 733, 730, 543, 1671, 1566, 1567, + /* 540 */ 2221, 295, 720, 19, 541, 182, 144, 537, 533, 2312, + /* 550 */ 1601, 204, 188, 2349, 2350, 1595, 140, 2354, 2253, 295, + /* 560 */ 757, 156, 155, 754, 753, 752, 153, 376, 2221, 2122, + /* 570 */ 1593, 721, 2214, 1879, 62, 812, 1754, 1846, 15, 2252, + /* 580 */ 671, 2288, 1620, 2417, 110, 2254, 724, 2256, 2257, 719, + /* 590 */ 1845, 714, 1819, 12, 145, 10, 151, 2312, 2341, 2271, + /* 600 */ 670, 189, 404, 2337, 592, 2418, 672, 240, 591, 759, + /* 610 */ 1601, 2221, 91, 720, 1678, 1679, 1623, 704, 2011, 646, + /* 620 */ 41, 40, 2417, 174, 47, 45, 44, 43, 42, 378, + /* 630 */ 2221, 582, 578, 574, 570, 812, 239, 459, 2006, 2423, + /* 640 */ 189, 704, 2011, 2221, 2418, 672, 1651, 1661, 473, 2118, + /* 650 */ 2252, 182, 2288, 1677, 1680, 110, 2254, 724, 2256, 2257, + /* 660 */ 719, 475, 714, 452, 402, 451, 631, 2437, 1596, 2341, + /* 670 */ 1594, 1601, 167, 404, 2337, 2123, 92, 41, 40, 237, + /* 680 */ 2013, 47, 45, 44, 43, 42, 41, 40, 1844, 1623, + /* 690 */ 47, 45, 44, 43, 42, 450, 2105, 207, 500, 2118, + /* 700 */ 1599, 1600, 1346, 1650, 1653, 1654, 1655, 1656, 1657, 1658, + /* 710 */ 1659, 1660, 716, 712, 1669, 1670, 1672, 1673, 1674, 1675, + /* 720 */ 2, 48, 46, 1681, 2253, 704, 2011, 2207, 1596, 408, + /* 730 */ 1594, 1595, 411, 295, 750, 1652, 2064, 721, 465, 2379, + /* 740 */ 167, 2221, 1348, 398, 1676, 490, 1593, 212, 2013, 236, + /* 750 */ 229, 2062, 683, 142, 704, 2011, 234, 559, 1986, 2356, + /* 760 */ 1599, 1600, 41, 40, 414, 2271, 47, 45, 44, 43, + /* 770 */ 42, 205, 167, 1671, 133, 227, 1686, 2221, 430, 720, + /* 780 */ 2013, 593, 1620, 1843, 1789, 2353, 1601, 166, 41, 40, + /* 790 */ 1842, 34, 47, 45, 44, 43, 42, 41, 40, 704, + /* 800 */ 2011, 47, 45, 44, 43, 42, 2421, 704, 2011, 704, + /* 810 */ 2011, 812, 1841, 1838, 49, 2356, 2252, 2253, 2288, 491, + /* 820 */ 769, 110, 2254, 724, 2256, 2257, 719, 564, 714, 2008, + /* 830 */ 721, 611, 2392, 2437, 209, 2341, 2221, 704, 2011, 404, + /* 840 */ 2337, 2352, 36, 2221, 271, 706, 623, 2313, 41, 40, + /* 850 */ 1678, 1679, 47, 45, 44, 43, 42, 260, 2271, 190, + /* 860 */ 2349, 2350, 255, 140, 2354, 2221, 2221, 704, 2011, 2064, + /* 870 */ 2221, 1621, 720, 1269, 87, 1268, 403, 86, 614, 704, + /* 880 */ 2011, 2356, 1651, 1661, 2062, 608, 1766, 268, 108, 1677, + /* 890 */ 1680, 252, 757, 156, 155, 754, 753, 752, 153, 689, + /* 900 */ 704, 2011, 704, 2011, 1596, 143, 1594, 2351, 1270, 2252, + /* 910 */ 1837, 2288, 1747, 2003, 110, 2254, 724, 2256, 2257, 719, + /* 920 */ 307, 714, 701, 2064, 586, 585, 2437, 2215, 2341, 318, + /* 930 */ 412, 71, 404, 2337, 70, 1652, 1599, 1600, 2062, 1650, + /* 940 */ 1653, 1654, 1655, 1656, 1657, 1658, 1659, 1660, 716, 712, + /* 950 */ 1669, 1670, 1672, 1673, 1674, 1675, 2, 48, 46, 2186, + /* 960 */ 2253, 704, 2011, 2221, 708, 408, 2313, 1595, 382, 381, + /* 970 */ 602, 601, 257, 721, 646, 653, 256, 2417, 704, 2011, + /* 980 */ 1676, 702, 1593, 757, 156, 155, 754, 753, 752, 153, + /* 990 */ 2231, 1836, 1521, 1522, 2423, 189, 704, 2011, 313, 2418, + /* 1000 */ 672, 2271, 1357, 2422, 2240, 1361, 2417, 303, 304, 1671, + /* 1010 */ 1707, 259, 302, 2221, 2235, 720, 415, 1356, 1620, 1835, + /* 1020 */ 1360, 1834, 1601, 629, 2421, 1833, 1832, 2064, 2418, 2419, + /* 1030 */ 687, 1520, 1523, 781, 779, 44, 43, 42, 380, 379, + /* 1040 */ 94, 590, 690, 363, 2221, 1623, 388, 812, 624, 9, + /* 1050 */ 49, 1831, 2252, 2253, 2288, 2237, 1830, 110, 2254, 724, + /* 1060 */ 2256, 2257, 719, 592, 714, 714, 721, 591, 2410, 2437, + /* 1070 */ 646, 2341, 2221, 2417, 2221, 404, 2337, 646, 2221, 2221, + /* 1080 */ 2417, 91, 518, 1855, 807, 520, 1678, 1679, 674, 35, + /* 1090 */ 2423, 189, 1249, 1250, 2271, 2418, 672, 2423, 189, 1712, + /* 1100 */ 2064, 1604, 2418, 672, 2221, 2064, 2221, 2007, 720, 2221, + /* 1110 */ 3, 751, 2204, 755, 2055, 699, 2055, 1252, 1651, 1661, + /* 1120 */ 2063, 756, 54, 1619, 2055, 1677, 1680, 327, 1989, 770, + /* 1130 */ 2041, 154, 1973, 2361, 1739, 245, 247, 135, 243, 246, + /* 1140 */ 1596, 249, 1594, 251, 248, 2252, 250, 2288, 1897, 84, + /* 1150 */ 110, 2254, 724, 2256, 2257, 719, 154, 714, 626, 154, + /* 1160 */ 625, 147, 2437, 50, 2341, 269, 1996, 50, 404, 2337, + /* 1170 */ 607, 1652, 1599, 1600, 1746, 1650, 1653, 1654, 1655, 1656, + /* 1180 */ 1657, 1658, 1659, 1660, 716, 712, 1669, 1670, 1672, 1673, + /* 1190 */ 1674, 1675, 2, 48, 46, 594, 595, 1880, 275, 675, + /* 1200 */ 270, 408, 1888, 1595, 55, 632, 1886, 678, 95, 1822, + /* 1210 */ 1823, 154, 50, 14, 13, 711, 1676, 2242, 1593, 1344, + /* 1220 */ 1342, 300, 72, 815, 609, 152, 107, 1603, 612, 1561, + /* 1230 */ 763, 1998, 1564, 764, 154, 104, 1775, 2253, 1994, 320, + /* 1240 */ 1774, 65, 2015, 50, 50, 1671, 728, 152, 154, 805, + /* 1250 */ 721, 264, 2360, 1303, 1322, 181, 715, 1320, 1601, 136, + /* 1260 */ 267, 1607, 1953, 803, 799, 795, 791, 1840, 317, 2385, + /* 1270 */ 1739, 277, 288, 2244, 152, 659, 137, 168, 2271, 282, + /* 1280 */ 1951, 1950, 334, 812, 688, 1518, 15, 2272, 391, 421, + /* 1290 */ 2221, 2127, 720, 1304, 305, 696, 1871, 1876, 309, 331, + /* 1300 */ 74, 2052, 2375, 73, 684, 417, 416, 1387, 109, 290, + /* 1310 */ 287, 310, 424, 356, 1713, 1609, 1662, 326, 294, 1415, + /* 1320 */ 1419, 1426, 1678, 1679, 221, 528, 526, 523, 1676, 2252, + /* 1330 */ 1602, 2288, 1424, 437, 110, 2254, 724, 2256, 2257, 719, + /* 1340 */ 5, 714, 429, 700, 1626, 446, 2437, 157, 2341, 372, + /* 1350 */ 445, 197, 404, 2337, 1651, 1661, 196, 1671, 448, 199, + /* 1360 */ 1542, 1677, 1680, 1618, 62, 321, 462, 1619, 466, 468, + /* 1370 */ 1601, 211, 1697, 1623, 2128, 472, 1596, 474, 1594, 509, + /* 1380 */ 479, 298, 492, 508, 501, 499, 510, 1606, 297, 2120, + /* 1390 */ 521, 522, 215, 519, 216, 710, 524, 2253, 525, 218, + /* 1400 */ 527, 529, 63, 1624, 544, 4, 552, 262, 1599, 1600, + /* 1410 */ 721, 1650, 1653, 1654, 1655, 1656, 1657, 1658, 1659, 1660, + /* 1420 */ 716, 712, 1669, 1670, 1672, 1673, 1674, 1675, 2, 545, + /* 1430 */ 553, 555, 226, 1621, 228, 556, 1625, 1627, 2271, 557, + /* 1440 */ 560, 558, 1628, 231, 566, 233, 82, 81, 457, 89, + /* 1450 */ 2221, 201, 720, 676, 2136, 90, 238, 587, 589, 2001, + /* 1460 */ 112, 353, 615, 679, 449, 447, 616, 628, 242, 2195, + /* 1470 */ 1997, 244, 160, 2253, 161, 357, 630, 1999, 438, 1995, + /* 1480 */ 162, 436, 432, 428, 425, 450, 721, 163, 1610, 2252, + /* 1490 */ 1605, 2288, 93, 2192, 110, 2254, 724, 2256, 2257, 719, + /* 1500 */ 148, 714, 2253, 261, 2191, 634, 2316, 633, 2341, 638, + /* 1510 */ 1549, 265, 404, 2337, 2271, 721, 641, 650, 660, 8, + /* 1520 */ 1613, 1615, 635, 295, 2391, 639, 2221, 322, 720, 263, + /* 1530 */ 640, 2376, 2386, 712, 1669, 1670, 1672, 1673, 1674, 1675, + /* 1540 */ 2253, 694, 273, 2271, 2363, 669, 656, 651, 276, 2390, + /* 1550 */ 394, 663, 649, 721, 648, 2221, 286, 720, 395, 2440, + /* 1560 */ 680, 677, 1739, 1622, 141, 2252, 2357, 2288, 1744, 179, + /* 1570 */ 110, 2254, 724, 2256, 2257, 719, 323, 714, 1742, 281, + /* 1580 */ 324, 2271, 2314, 296, 2341, 692, 149, 284, 404, 2337, + /* 1590 */ 1, 175, 2253, 2221, 2252, 720, 2288, 693, 2150, 110, + /* 1600 */ 2254, 724, 2256, 2257, 719, 721, 714, 2416, 283, 285, + /* 1610 */ 192, 707, 697, 2341, 289, 150, 698, 404, 2337, 325, + /* 1620 */ 101, 2149, 2148, 400, 2012, 61, 103, 2056, 1974, 2322, + /* 1630 */ 2253, 726, 2252, 2271, 2288, 328, 316, 111, 2254, 724, + /* 1640 */ 2256, 2257, 719, 721, 714, 2221, 1228, 720, 809, 806, + /* 1650 */ 159, 2341, 811, 53, 337, 2340, 2337, 364, 352, 351, + /* 1660 */ 2253, 365, 341, 330, 332, 2213, 2212, 2211, 79, 2208, + /* 1670 */ 426, 2271, 427, 718, 1586, 1587, 195, 431, 2206, 433, + /* 1680 */ 434, 435, 2253, 2221, 2252, 720, 2288, 2205, 373, 111, + /* 1690 */ 2254, 724, 2256, 2257, 719, 721, 714, 2203, 439, 2202, + /* 1700 */ 2201, 2271, 441, 2341, 1577, 443, 2182, 709, 2337, 198, + /* 1710 */ 2181, 200, 1545, 2221, 80, 720, 2163, 1544, 2162, 2161, + /* 1720 */ 455, 456, 722, 2271, 2288, 2160, 2159, 111, 2254, 724, + /* 1730 */ 2256, 2257, 719, 2110, 714, 2221, 2104, 720, 460, 1488, + /* 1740 */ 463, 2341, 464, 2101, 203, 367, 2337, 2100, 2099, 83, + /* 1750 */ 2098, 2103, 2252, 2102, 2288, 2253, 206, 349, 2254, 724, + /* 1760 */ 2256, 2257, 719, 717, 714, 705, 2306, 2097, 721, 2096, + /* 1770 */ 2094, 2093, 2253, 2092, 2252, 208, 2288, 480, 2091, 171, + /* 1780 */ 2254, 724, 2256, 2257, 719, 721, 714, 482, 2107, 2090, + /* 1790 */ 2089, 2088, 2087, 2253, 2086, 2085, 2271, 88, 210, 2075, + /* 1800 */ 2074, 2073, 2072, 2106, 2071, 2070, 721, 2084, 2221, 2083, + /* 1810 */ 720, 2082, 2081, 2271, 2080, 2079, 2078, 2077, 2076, 2069, + /* 1820 */ 1494, 647, 2382, 214, 2068, 2221, 512, 720, 2067, 514, + /* 1830 */ 2066, 2065, 1358, 361, 2271, 1362, 1916, 362, 217, 1915, + /* 1840 */ 219, 1914, 1912, 1354, 220, 1909, 2221, 2252, 720, 2288, + /* 1850 */ 532, 1908, 172, 2254, 724, 2256, 2257, 719, 530, 714, + /* 1860 */ 534, 1901, 2253, 1890, 2252, 1866, 2288, 536, 183, 111, + /* 1870 */ 2254, 724, 2256, 2257, 719, 721, 714, 531, 535, 540, + /* 1880 */ 538, 542, 77, 2341, 539, 2252, 2253, 2288, 2338, 1251, + /* 1890 */ 171, 2254, 724, 2256, 2257, 719, 2241, 714, 222, 721, + /* 1900 */ 1865, 184, 224, 2271, 550, 673, 2438, 2180, 392, 78, + /* 1910 */ 2170, 2158, 2253, 230, 232, 2221, 2157, 720, 235, 2134, + /* 1920 */ 1990, 1296, 1911, 1907, 567, 721, 569, 2271, 568, 1905, + /* 1930 */ 571, 572, 393, 2383, 1903, 575, 2253, 573, 577, 2221, + /* 1940 */ 576, 720, 579, 581, 1885, 580, 1883, 1884, 1882, 721, + /* 1950 */ 1900, 1862, 1992, 2271, 2252, 1430, 2288, 241, 1431, 350, + /* 1960 */ 2254, 724, 2256, 2257, 719, 2221, 714, 720, 1345, 64, + /* 1970 */ 1991, 1332, 1343, 1341, 1340, 1339, 1338, 2271, 2252, 1898, + /* 1980 */ 2288, 1889, 1337, 350, 2254, 724, 2256, 2257, 719, 2221, + /* 1990 */ 714, 720, 778, 780, 1334, 1333, 385, 386, 1331, 1887, + /* 2000 */ 387, 613, 2253, 1861, 2252, 1860, 2288, 610, 1859, 343, + /* 2010 */ 2254, 724, 2256, 2257, 719, 721, 714, 617, 2253, 1858, + /* 2020 */ 619, 1857, 621, 1571, 113, 1573, 1570, 2179, 2252, 2253, + /* 2030 */ 2288, 718, 1575, 172, 2254, 724, 2256, 2257, 719, 57, + /* 2040 */ 714, 2169, 721, 2271, 1551, 29, 68, 1553, 399, 637, + /* 2050 */ 1555, 636, 165, 2156, 668, 2221, 266, 720, 1530, 2271, + /* 2060 */ 2155, 642, 2422, 1529, 644, 17, 20, 31, 6, 1792, + /* 2070 */ 2271, 2221, 272, 720, 652, 407, 7, 654, 274, 21, + /* 2080 */ 22, 279, 2221, 1773, 720, 280, 2242, 2439, 1765, 173, + /* 2090 */ 278, 66, 32, 1807, 2252, 96, 2288, 33, 23, 350, + /* 2100 */ 2254, 724, 2256, 2257, 719, 24, 714, 1812, 1813, 2154, + /* 2110 */ 2252, 1806, 2288, 396, 1811, 349, 2254, 724, 2256, 2257, + /* 2120 */ 719, 2252, 714, 2288, 2307, 59, 350, 2254, 724, 2256, + /* 2130 */ 2257, 719, 2253, 714, 1810, 18, 397, 1736, 292, 178, + /* 2140 */ 1735, 2133, 98, 2253, 97, 721, 299, 58, 25, 2132, + /* 2150 */ 1771, 311, 695, 99, 301, 306, 721, 69, 26, 100, + /* 2160 */ 1688, 11, 13, 180, 1687, 104, 1611, 2291, 2253, 308, + /* 2170 */ 1698, 1666, 713, 2271, 1664, 39, 193, 1663, 409, 1635, + /* 2180 */ 16, 721, 723, 27, 2271, 2221, 1643, 720, 28, 727, + /* 2190 */ 1416, 410, 729, 731, 725, 734, 2221, 1413, 720, 732, + /* 2200 */ 737, 1412, 1409, 735, 740, 743, 738, 1407, 741, 2271, + /* 2210 */ 1403, 1401, 744, 105, 314, 106, 1425, 76, 1421, 1406, + /* 2220 */ 758, 2221, 1294, 720, 2252, 1326, 2288, 1325, 1324, 350, + /* 2230 */ 2254, 724, 2256, 2257, 719, 627, 714, 2288, 2253, 1405, + /* 2240 */ 345, 2254, 724, 2256, 2257, 719, 1404, 714, 1323, 1321, + /* 2250 */ 1319, 721, 1318, 1317, 1352, 315, 768, 1315, 1314, 1312, + /* 2260 */ 2252, 1313, 2288, 1311, 2253, 335, 2254, 724, 2256, 2257, + /* 2270 */ 719, 1310, 714, 1309, 1300, 1349, 1347, 721, 1306, 2271, + /* 2280 */ 1305, 1302, 1301, 1299, 1906, 788, 789, 1904, 2253, 790, + /* 2290 */ 792, 2221, 794, 720, 1902, 796, 798, 1899, 800, 802, + /* 2300 */ 793, 721, 797, 1881, 1856, 2271, 801, 804, 1241, 808, + /* 2310 */ 1229, 319, 810, 1826, 2253, 1597, 813, 2221, 329, 720, + /* 2320 */ 814, 1826, 1826, 1826, 1826, 1826, 1826, 721, 1826, 2271, + /* 2330 */ 2252, 1826, 2288, 1826, 1826, 333, 2254, 724, 2256, 2257, + /* 2340 */ 719, 2221, 714, 720, 1826, 1826, 1826, 1826, 1826, 1826, + /* 2350 */ 1826, 1826, 1826, 1826, 1826, 2271, 2252, 1826, 2288, 1826, + /* 2360 */ 1826, 336, 2254, 724, 2256, 2257, 719, 2221, 714, 720, + /* 2370 */ 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 2253, 1826, + /* 2380 */ 2252, 1826, 2288, 1826, 1826, 342, 2254, 724, 2256, 2257, + /* 2390 */ 719, 721, 714, 1826, 1826, 1826, 1826, 1826, 1826, 1826, + /* 2400 */ 1826, 1826, 1826, 1826, 2253, 1826, 2252, 1826, 2288, 1826, + /* 2410 */ 1826, 346, 2254, 724, 2256, 2257, 719, 721, 714, 2271, + /* 2420 */ 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, + /* 2430 */ 1826, 2221, 1826, 720, 1826, 1826, 1826, 1826, 1826, 1826, + /* 2440 */ 1826, 1826, 1826, 1826, 1826, 2271, 1826, 1826, 1826, 1826, + /* 2450 */ 1826, 1826, 1826, 1826, 1826, 1826, 1826, 2221, 1826, 720, + /* 2460 */ 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 2253, 1826, + /* 2470 */ 2252, 1826, 2288, 1826, 1826, 338, 2254, 724, 2256, 2257, + /* 2480 */ 719, 721, 714, 1826, 1826, 1826, 1826, 1826, 1826, 1826, + /* 2490 */ 1826, 1826, 1826, 1826, 1826, 1826, 2252, 1826, 2288, 1826, + /* 2500 */ 1826, 347, 2254, 724, 2256, 2257, 719, 1826, 714, 2271, + /* 2510 */ 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, + /* 2520 */ 2253, 2221, 1826, 720, 1826, 1826, 1826, 1826, 1826, 1826, + /* 2530 */ 1826, 1826, 1826, 721, 1826, 1826, 1826, 1826, 1826, 1826, + /* 2540 */ 1826, 1826, 1826, 2253, 1826, 1826, 1826, 1826, 1826, 1826, + /* 2550 */ 1826, 1826, 1826, 1826, 1826, 1826, 721, 1826, 1826, 1826, + /* 2560 */ 2252, 2271, 2288, 1826, 1826, 339, 2254, 724, 2256, 2257, + /* 2570 */ 719, 1826, 714, 2221, 1826, 720, 1826, 1826, 1826, 1826, + /* 2580 */ 1826, 1826, 1826, 1826, 2271, 1826, 1826, 1826, 1826, 1826, + /* 2590 */ 1826, 1826, 1826, 1826, 1826, 1826, 2221, 1826, 720, 1826, + /* 2600 */ 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, + /* 2610 */ 1826, 1826, 2252, 2253, 2288, 1826, 1826, 348, 2254, 724, + /* 2620 */ 2256, 2257, 719, 1826, 714, 1826, 721, 1826, 1826, 1826, + /* 2630 */ 1826, 1826, 1826, 1826, 1826, 2252, 1826, 2288, 2253, 1826, + /* 2640 */ 340, 2254, 724, 2256, 2257, 719, 1826, 714, 1826, 1826, + /* 2650 */ 1826, 721, 1826, 1826, 2271, 1826, 1826, 1826, 1826, 1826, + /* 2660 */ 1826, 1826, 1826, 1826, 1826, 1826, 2221, 1826, 720, 1826, + /* 2670 */ 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 2271, + /* 2680 */ 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 2253, 1826, + /* 2690 */ 1826, 2221, 1826, 720, 1826, 1826, 1826, 1826, 1826, 1826, + /* 2700 */ 1826, 721, 1826, 2253, 1826, 2252, 1826, 2288, 1826, 1826, + /* 2710 */ 354, 2254, 724, 2256, 2257, 719, 721, 714, 1826, 1826, + /* 2720 */ 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 2271, + /* 2730 */ 2252, 1826, 2288, 1826, 1826, 355, 2254, 724, 2256, 2257, + /* 2740 */ 719, 2221, 714, 720, 2271, 1826, 1826, 1826, 1826, 1826, + /* 2750 */ 1826, 1826, 1826, 2253, 1826, 1826, 2221, 1826, 720, 1826, + /* 2760 */ 1826, 1826, 1826, 1826, 1826, 1826, 721, 1826, 1826, 1826, + /* 2770 */ 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 2253, 1826, + /* 2780 */ 2252, 1826, 2288, 1826, 1826, 2265, 2254, 724, 2256, 2257, + /* 2790 */ 719, 721, 714, 1826, 2271, 2252, 1826, 2288, 1826, 1826, + /* 2800 */ 2264, 2254, 724, 2256, 2257, 719, 2221, 714, 720, 1826, + /* 2810 */ 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 2271, + /* 2820 */ 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 2253, 1826, + /* 2830 */ 1826, 2221, 1826, 720, 1826, 1826, 1826, 1826, 1826, 1826, + /* 2840 */ 1826, 721, 1826, 2253, 1826, 2252, 1826, 2288, 1826, 1826, + /* 2850 */ 2263, 2254, 724, 2256, 2257, 719, 721, 714, 1826, 1826, + /* 2860 */ 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 2271, + /* 2870 */ 2252, 1826, 2288, 1826, 1826, 369, 2254, 724, 2256, 2257, + /* 2880 */ 719, 2221, 714, 720, 2271, 1826, 1826, 1826, 1826, 1826, + /* 2890 */ 1826, 1826, 1826, 1826, 1826, 1826, 2221, 1826, 720, 1826, + /* 2900 */ 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 2253, 1826, + /* 2910 */ 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, + /* 2920 */ 2252, 721, 2288, 1826, 1826, 370, 2254, 724, 2256, 2257, + /* 2930 */ 719, 1826, 714, 1826, 1826, 2252, 1826, 2288, 1826, 1826, + /* 2940 */ 366, 2254, 724, 2256, 2257, 719, 1826, 714, 1826, 2271, + /* 2950 */ 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, + /* 2960 */ 2253, 2221, 1826, 720, 1826, 1826, 1826, 1826, 1826, 1826, + /* 2970 */ 1826, 1826, 1826, 721, 1826, 1826, 1826, 1826, 1826, 1826, + /* 2980 */ 1826, 1826, 2253, 1826, 1826, 1826, 1826, 1826, 1826, 1826, + /* 2990 */ 1826, 1826, 1826, 1826, 1826, 721, 1826, 1826, 1826, 1826, + /* 3000 */ 2252, 2271, 2288, 1826, 1826, 371, 2254, 724, 2256, 2257, + /* 3010 */ 719, 1826, 714, 2221, 1826, 720, 1826, 1826, 1826, 1826, + /* 3020 */ 1826, 1826, 1826, 2271, 1826, 1826, 1826, 1826, 1826, 1826, + /* 3030 */ 1826, 1826, 1826, 1826, 1826, 2221, 1826, 720, 1826, 1826, + /* 3040 */ 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, 1826, + /* 3050 */ 1826, 1826, 722, 1826, 2288, 1826, 1826, 345, 2254, 724, + /* 3060 */ 2256, 2257, 719, 1826, 714, 1826, 1826, 1826, 1826, 1826, + /* 3070 */ 1826, 1826, 1826, 1826, 2252, 1826, 2288, 1826, 1826, 344, + /* 3080 */ 2254, 724, 2256, 2257, 719, 1826, 714, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 452, 453, 343, 376, 350, 355, 356, 353, 354, 397, - /* 10 */ 398, 384, 12, 13, 14, 356, 12, 13, 391, 392, - /* 20 */ 20, 0, 22, 8, 9, 375, 399, 12, 13, 14, - /* 30 */ 15, 16, 382, 360, 361, 35, 0, 37, 20, 355, - /* 40 */ 356, 37, 21, 384, 0, 24, 25, 26, 27, 28, - /* 50 */ 29, 30, 31, 32, 362, 396, 42, 398, 355, 356, - /* 60 */ 463, 8, 9, 466, 64, 12, 13, 14, 15, 16, - /* 70 */ 70, 379, 398, 20, 398, 355, 356, 77, 375, 387, - /* 80 */ 483, 484, 355, 356, 410, 488, 489, 413, 414, 413, - /* 90 */ 414, 432, 342, 434, 344, 383, 437, 438, 439, 440, - /* 100 */ 441, 442, 102, 444, 70, 105, 355, 395, 72, 73, - /* 110 */ 74, 75, 76, 86, 78, 79, 80, 81, 82, 83, + /* 0 */ 401, 375, 1, 2, 458, 459, 469, 388, 469, 472, + /* 10 */ 346, 472, 12, 13, 14, 389, 400, 401, 419, 420, + /* 20 */ 20, 346, 22, 0, 354, 399, 489, 490, 358, 490, + /* 30 */ 360, 494, 495, 494, 495, 35, 0, 37, 12, 13, + /* 40 */ 14, 15, 16, 401, 21, 346, 346, 24, 25, 26, + /* 50 */ 27, 28, 29, 30, 31, 32, 358, 359, 416, 359, + /* 60 */ 20, 419, 420, 399, 64, 0, 440, 441, 56, 57, + /* 70 */ 70, 20, 343, 22, 399, 21, 450, 77, 24, 25, + /* 80 */ 26, 27, 28, 29, 30, 31, 32, 387, 37, 24, + /* 90 */ 25, 26, 27, 28, 29, 30, 31, 32, 399, 399, + /* 100 */ 353, 401, 102, 356, 357, 105, 55, 106, 72, 73, + /* 110 */ 74, 75, 76, 69, 78, 79, 80, 81, 82, 83, /* 120 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - /* 130 */ 94, 95, 96, 97, 98, 20, 343, 20, 340, 102, - /* 140 */ 14, 141, 142, 459, 460, 461, 20, 463, 464, 490, - /* 150 */ 491, 400, 0, 116, 117, 118, 119, 120, 121, 122, - /* 160 */ 123, 124, 125, 20, 127, 128, 129, 130, 131, 132, - /* 170 */ 133, 171, 172, 146, 147, 355, 356, 177, 178, 459, - /* 180 */ 460, 461, 69, 463, 464, 0, 459, 460, 461, 396, - /* 190 */ 463, 464, 192, 466, 194, 375, 169, 463, 194, 184, - /* 200 */ 466, 8, 9, 51, 160, 12, 13, 14, 15, 16, - /* 210 */ 483, 484, 20, 169, 416, 488, 489, 350, 484, 421, - /* 220 */ 353, 354, 488, 489, 224, 225, 173, 227, 228, 229, + /* 130 */ 94, 95, 96, 97, 98, 20, 105, 358, 438, 50, + /* 140 */ 440, 141, 142, 443, 444, 445, 446, 447, 448, 422, + /* 150 */ 450, 422, 358, 359, 427, 455, 427, 457, 363, 364, + /* 160 */ 21, 461, 462, 465, 466, 467, 359, 469, 470, 20, + /* 170 */ 472, 0, 378, 173, 174, 36, 476, 38, 39, 40, + /* 180 */ 180, 181, 403, 404, 484, 406, 3, 489, 490, 410, + /* 190 */ 12, 13, 494, 495, 387, 195, 469, 197, 469, 472, + /* 200 */ 345, 472, 347, 20, 8, 9, 358, 359, 12, 13, + /* 210 */ 14, 15, 16, 173, 174, 37, 489, 490, 489, 490, + /* 220 */ 105, 494, 495, 494, 495, 20, 378, 227, 228, 20, /* 230 */ 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - /* 240 */ 240, 241, 242, 243, 244, 12, 13, 20, 50, 20, - /* 250 */ 18, 22, 20, 20, 69, 22, 141, 142, 224, 27, - /* 260 */ 343, 463, 30, 70, 466, 4, 37, 35, 35, 20, - /* 270 */ 37, 8, 9, 356, 260, 12, 13, 14, 15, 16, - /* 280 */ 20, 483, 484, 51, 55, 53, 488, 489, 171, 172, - /* 290 */ 58, 224, 177, 178, 20, 463, 33, 64, 466, 355, - /* 300 */ 105, 384, 287, 70, 56, 57, 113, 46, 47, 48, - /* 310 */ 77, 355, 356, 396, 394, 398, 484, 397, 398, 21, - /* 320 */ 488, 489, 24, 25, 26, 27, 28, 29, 30, 31, - /* 330 */ 32, 176, 105, 141, 142, 102, 104, 362, 105, 272, - /* 340 */ 273, 274, 275, 276, 277, 278, 372, 115, 380, 432, - /* 350 */ 343, 434, 408, 409, 437, 438, 439, 440, 441, 442, - /* 360 */ 386, 444, 387, 170, 447, 105, 449, 450, 451, 106, - /* 370 */ 396, 173, 455, 456, 141, 142, 105, 145, 180, 105, - /* 380 */ 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - /* 390 */ 158, 159, 160, 161, 162, 163, 164, 429, 166, 167, - /* 400 */ 168, 355, 356, 396, 171, 172, 0, 0, 434, 435, - /* 410 */ 177, 178, 20, 4, 458, 459, 460, 461, 444, 463, - /* 420 */ 464, 375, 267, 268, 269, 192, 356, 194, 382, 22, - /* 430 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 355, - /* 440 */ 356, 248, 249, 250, 251, 252, 253, 254, 255, 256, - /* 450 */ 257, 258, 360, 361, 384, 187, 261, 224, 225, 375, - /* 460 */ 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, - /* 470 */ 237, 238, 239, 240, 241, 242, 243, 244, 245, 12, - /* 480 */ 13, 436, 214, 215, 20, 343, 22, 20, 261, 22, - /* 490 */ 134, 135, 136, 137, 138, 139, 140, 351, 356, 105, - /* 500 */ 51, 355, 35, 357, 37, 343, 372, 462, 59, 439, - /* 510 */ 4, 62, 63, 115, 105, 72, 73, 74, 356, 55, - /* 520 */ 386, 261, 79, 80, 81, 19, 384, 69, 85, 384, - /* 530 */ 396, 64, 261, 90, 91, 92, 93, 70, 396, 96, - /* 540 */ 398, 35, 355, 356, 77, 376, 384, 384, 21, 404, - /* 550 */ 405, 136, 384, 384, 391, 140, 447, 51, 396, 450, - /* 560 */ 398, 392, 399, 36, 58, 38, 39, 40, 434, 102, - /* 570 */ 64, 37, 105, 405, 432, 245, 434, 343, 444, 437, - /* 580 */ 438, 439, 440, 441, 442, 191, 444, 193, 364, 402, - /* 590 */ 356, 449, 358, 451, 432, 343, 434, 455, 456, 437, - /* 600 */ 438, 439, 440, 441, 442, 381, 444, 365, 141, 142, - /* 610 */ 104, 77, 470, 107, 390, 373, 201, 223, 384, 204, - /* 620 */ 478, 77, 207, 3, 209, 14, 463, 369, 370, 466, - /* 630 */ 396, 20, 398, 12, 13, 14, 15, 16, 171, 172, - /* 640 */ 20, 479, 480, 115, 177, 178, 483, 484, 396, 376, - /* 650 */ 351, 488, 489, 13, 355, 261, 357, 384, 0, 192, - /* 660 */ 0, 194, 355, 356, 22, 392, 432, 436, 434, 22, - /* 670 */ 261, 437, 438, 439, 440, 441, 442, 37, 444, 37, - /* 680 */ 355, 356, 375, 449, 37, 451, 14, 15, 16, 455, - /* 690 */ 456, 224, 225, 462, 227, 228, 229, 230, 231, 232, - /* 700 */ 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - /* 710 */ 243, 244, 12, 13, 14, 0, 343, 343, 416, 77, - /* 720 */ 20, 384, 22, 421, 135, 136, 106, 402, 416, 140, - /* 730 */ 356, 384, 72, 73, 74, 35, 399, 37, 391, 79, - /* 740 */ 80, 81, 355, 356, 102, 85, 399, 372, 384, 102, - /* 750 */ 90, 91, 92, 93, 355, 356, 96, 245, 384, 247, - /* 760 */ 416, 386, 375, 399, 64, 463, 384, 52, 466, 396, - /* 770 */ 396, 396, 398, 391, 375, 463, 0, 77, 466, 355, - /* 780 */ 356, 399, 171, 355, 356, 483, 484, 77, 355, 356, - /* 790 */ 488, 489, 135, 173, 393, 483, 484, 396, 22, 375, - /* 800 */ 488, 489, 102, 375, 343, 105, 432, 463, 434, 434, - /* 810 */ 466, 437, 438, 439, 440, 441, 442, 356, 444, 444, - /* 820 */ 355, 356, 34, 449, 384, 451, 20, 483, 484, 455, - /* 830 */ 456, 391, 488, 489, 192, 402, 194, 0, 385, 399, - /* 840 */ 375, 141, 142, 8, 9, 384, 22, 12, 13, 14, - /* 850 */ 15, 16, 478, 355, 356, 355, 356, 396, 343, 398, - /* 860 */ 18, 37, 205, 206, 14, 23, 224, 225, 355, 356, - /* 870 */ 20, 171, 172, 375, 384, 375, 218, 177, 178, 0, - /* 880 */ 436, 391, 40, 41, 355, 356, 44, 385, 375, 399, - /* 890 */ 1, 2, 192, 432, 194, 434, 54, 364, 437, 438, - /* 900 */ 439, 440, 441, 442, 375, 444, 462, 65, 66, 67, - /* 910 */ 68, 396, 451, 343, 8, 9, 455, 456, 12, 13, - /* 920 */ 14, 15, 16, 390, 224, 225, 102, 227, 228, 229, - /* 930 */ 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - /* 940 */ 240, 241, 242, 243, 244, 12, 13, 105, 20, 355, - /* 950 */ 356, 343, 343, 20, 170, 22, 8, 9, 355, 356, - /* 960 */ 12, 13, 14, 15, 16, 20, 396, 35, 35, 375, - /* 970 */ 37, 134, 135, 136, 137, 138, 139, 140, 375, 173, - /* 980 */ 355, 356, 376, 51, 343, 143, 355, 356, 343, 20, - /* 990 */ 384, 59, 60, 61, 62, 106, 64, 64, 392, 416, - /* 1000 */ 375, 356, 4, 358, 396, 396, 375, 64, 173, 448, - /* 1010 */ 77, 450, 106, 134, 135, 136, 137, 138, 139, 140, - /* 1020 */ 343, 171, 448, 343, 450, 343, 184, 185, 186, 384, - /* 1030 */ 406, 189, 248, 369, 370, 102, 104, 396, 105, 107, - /* 1040 */ 343, 396, 258, 398, 202, 203, 463, 104, 134, 466, - /* 1050 */ 107, 384, 138, 356, 106, 213, 3, 371, 216, 392, - /* 1060 */ 374, 219, 220, 221, 222, 223, 483, 484, 346, 347, - /* 1070 */ 0, 488, 489, 396, 141, 142, 396, 432, 396, 434, - /* 1080 */ 33, 384, 437, 438, 439, 440, 441, 442, 33, 444, - /* 1090 */ 343, 343, 45, 396, 449, 398, 451, 343, 343, 171, - /* 1100 */ 455, 456, 384, 261, 171, 172, 174, 175, 37, 2, - /* 1110 */ 177, 178, 42, 181, 182, 8, 9, 399, 173, 12, - /* 1120 */ 13, 14, 15, 16, 105, 192, 33, 194, 343, 432, - /* 1130 */ 343, 434, 200, 114, 437, 438, 439, 440, 441, 442, - /* 1140 */ 416, 444, 173, 396, 396, 343, 449, 0, 451, 33, - /* 1150 */ 396, 396, 455, 456, 39, 40, 393, 224, 225, 396, - /* 1160 */ 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, - /* 1170 */ 237, 238, 239, 240, 241, 242, 243, 244, 12, 13, - /* 1180 */ 33, 396, 393, 396, 33, 396, 20, 463, 22, 377, - /* 1190 */ 466, 14, 380, 47, 48, 259, 260, 20, 396, 106, - /* 1200 */ 115, 35, 33, 37, 343, 64, 108, 483, 484, 111, - /* 1210 */ 0, 13, 488, 489, 45, 33, 33, 356, 108, 358, - /* 1220 */ 108, 111, 106, 111, 109, 110, 108, 112, 385, 111, - /* 1230 */ 64, 385, 22, 8, 9, 37, 33, 12, 13, 14, - /* 1240 */ 15, 16, 208, 77, 210, 384, 13, 33, 107, 134, - /* 1250 */ 165, 343, 33, 138, 141, 142, 33, 396, 385, 398, - /* 1260 */ 385, 263, 49, 33, 356, 194, 358, 385, 102, 2, - /* 1270 */ 37, 105, 37, 13, 422, 8, 9, 373, 343, 12, - /* 1280 */ 13, 14, 15, 16, 1, 2, 37, 492, 106, 106, - /* 1290 */ 344, 356, 384, 432, 481, 434, 359, 37, 437, 438, - /* 1300 */ 439, 440, 441, 442, 396, 444, 398, 141, 142, 106, - /* 1310 */ 449, 475, 451, 372, 33, 33, 455, 456, 105, 384, - /* 1320 */ 106, 372, 384, 359, 415, 106, 77, 406, 354, 106, - /* 1330 */ 406, 396, 356, 398, 395, 282, 106, 171, 172, 284, - /* 1340 */ 432, 33, 434, 177, 178, 437, 438, 439, 440, 441, - /* 1350 */ 442, 33, 444, 465, 33, 485, 457, 449, 192, 451, - /* 1360 */ 194, 12, 13, 455, 456, 33, 468, 432, 264, 434, - /* 1370 */ 343, 22, 437, 438, 439, 440, 441, 442, 443, 444, - /* 1380 */ 445, 446, 417, 356, 35, 358, 37, 106, 106, 51, - /* 1390 */ 224, 225, 433, 227, 228, 229, 230, 231, 232, 233, - /* 1400 */ 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, - /* 1410 */ 244, 384, 33, 64, 106, 33, 20, 33, 33, 343, - /* 1420 */ 33, 426, 207, 396, 106, 398, 77, 106, 431, 194, - /* 1430 */ 364, 426, 356, 364, 358, 190, 419, 286, 106, 343, - /* 1440 */ 20, 403, 356, 45, 20, 406, 356, 403, 170, 401, - /* 1450 */ 20, 102, 356, 356, 355, 355, 103, 403, 401, 432, - /* 1460 */ 384, 434, 401, 368, 437, 438, 439, 440, 441, 442, - /* 1470 */ 101, 444, 396, 367, 398, 355, 449, 100, 451, 355, - /* 1480 */ 384, 355, 455, 456, 355, 106, 20, 366, 106, 50, - /* 1490 */ 106, 106, 396, 106, 398, 352, 348, 348, 426, 364, - /* 1500 */ 20, 398, 352, 364, 20, 20, 418, 20, 432, 357, - /* 1510 */ 434, 357, 348, 437, 438, 439, 440, 441, 442, 364, - /* 1520 */ 444, 364, 364, 409, 364, 449, 355, 451, 432, 364, - /* 1530 */ 434, 455, 456, 437, 438, 439, 440, 441, 442, 346, - /* 1540 */ 444, 192, 355, 194, 348, 449, 384, 451, 346, 396, - /* 1550 */ 211, 455, 456, 430, 384, 396, 384, 384, 384, 384, - /* 1560 */ 384, 105, 384, 343, 384, 384, 428, 362, 384, 198, - /* 1570 */ 426, 197, 196, 224, 225, 396, 356, 355, 362, 474, - /* 1580 */ 417, 425, 271, 398, 270, 424, 237, 238, 239, 240, - /* 1590 */ 241, 242, 243, 396, 406, 343, 406, 396, 279, 474, - /* 1600 */ 411, 183, 411, 396, 384, 396, 474, 477, 356, 423, - /* 1610 */ 476, 281, 265, 473, 280, 343, 396, 472, 398, 288, - /* 1620 */ 493, 417, 285, 487, 283, 260, 356, 20, 356, 262, - /* 1630 */ 436, 115, 357, 362, 396, 362, 384, 469, 471, 411, - /* 1640 */ 396, 362, 343, 396, 396, 411, 396, 396, 396, 175, - /* 1650 */ 398, 362, 432, 407, 434, 356, 384, 437, 438, 439, - /* 1660 */ 440, 441, 442, 356, 444, 380, 467, 105, 396, 449, - /* 1670 */ 398, 451, 454, 105, 388, 455, 456, 374, 486, 355, - /* 1680 */ 396, 22, 362, 384, 432, 345, 434, 38, 420, 437, - /* 1690 */ 438, 439, 440, 441, 442, 396, 444, 398, 363, 349, - /* 1700 */ 348, 427, 412, 451, 432, 343, 434, 455, 456, 437, - /* 1710 */ 438, 439, 440, 441, 442, 0, 444, 412, 356, 45, - /* 1720 */ 378, 343, 378, 451, 378, 0, 0, 455, 456, 341, - /* 1730 */ 0, 432, 37, 434, 356, 217, 437, 438, 439, 440, - /* 1740 */ 441, 442, 37, 444, 37, 37, 384, 217, 0, 37, - /* 1750 */ 451, 37, 343, 217, 0, 456, 217, 0, 396, 37, - /* 1760 */ 398, 0, 384, 22, 0, 356, 37, 389, 212, 0, - /* 1770 */ 343, 200, 0, 200, 396, 201, 398, 194, 192, 0, - /* 1780 */ 0, 0, 188, 356, 187, 0, 0, 49, 0, 37, - /* 1790 */ 51, 0, 49, 384, 432, 0, 434, 0, 389, 437, - /* 1800 */ 438, 439, 440, 441, 442, 396, 444, 398, 45, 0, - /* 1810 */ 432, 384, 434, 0, 49, 437, 438, 439, 440, 441, - /* 1820 */ 442, 0, 444, 396, 0, 398, 0, 0, 0, 0, - /* 1830 */ 160, 37, 0, 160, 0, 0, 0, 0, 0, 0, - /* 1840 */ 0, 432, 480, 434, 0, 0, 437, 438, 439, 440, - /* 1850 */ 441, 442, 0, 444, 0, 0, 0, 343, 50, 432, - /* 1860 */ 0, 434, 0, 0, 437, 438, 439, 440, 441, 442, - /* 1870 */ 356, 444, 343, 0, 49, 45, 0, 0, 0, 0, - /* 1880 */ 0, 0, 0, 22, 0, 356, 0, 343, 144, 0, - /* 1890 */ 0, 22, 22, 50, 0, 64, 37, 0, 384, 0, - /* 1900 */ 356, 0, 0, 37, 51, 64, 42, 0, 37, 482, - /* 1910 */ 396, 64, 398, 384, 42, 0, 51, 42, 389, 51, - /* 1920 */ 37, 0, 37, 0, 33, 396, 14, 398, 384, 183, - /* 1930 */ 42, 0, 45, 0, 343, 0, 43, 0, 0, 0, - /* 1940 */ 396, 49, 398, 0, 49, 49, 432, 356, 434, 49, - /* 1950 */ 42, 437, 438, 439, 440, 441, 442, 0, 444, 343, - /* 1960 */ 42, 432, 37, 434, 0, 51, 437, 438, 439, 440, - /* 1970 */ 441, 442, 356, 444, 71, 384, 432, 0, 434, 37, - /* 1980 */ 389, 437, 438, 439, 440, 441, 442, 396, 444, 398, - /* 1990 */ 446, 42, 51, 42, 0, 37, 343, 51, 42, 0, - /* 2000 */ 384, 51, 37, 42, 0, 491, 0, 0, 0, 356, - /* 2010 */ 0, 0, 396, 37, 398, 22, 111, 113, 0, 37, - /* 2020 */ 37, 37, 37, 432, 37, 434, 37, 37, 437, 438, - /* 2030 */ 439, 440, 441, 442, 33, 444, 33, 384, 22, 37, - /* 2040 */ 0, 22, 389, 0, 22, 53, 37, 0, 432, 396, - /* 2050 */ 434, 398, 37, 437, 438, 439, 440, 441, 442, 22, - /* 2060 */ 444, 37, 343, 0, 0, 0, 37, 0, 37, 0, - /* 2070 */ 22, 20, 37, 37, 106, 356, 37, 105, 0, 173, - /* 2080 */ 105, 37, 22, 343, 22, 432, 0, 434, 175, 1, - /* 2090 */ 437, 438, 439, 440, 441, 442, 356, 444, 0, 173, - /* 2100 */ 0, 173, 3, 384, 33, 173, 195, 19, 199, 179, - /* 2110 */ 105, 50, 266, 179, 343, 396, 103, 398, 106, 105, - /* 2120 */ 50, 101, 33, 35, 384, 33, 105, 356, 33, 106, - /* 2130 */ 49, 106, 105, 105, 49, 105, 396, 33, 398, 51, - /* 2140 */ 106, 3, 33, 37, 106, 37, 49, 59, 60, 61, - /* 2150 */ 62, 432, 64, 434, 37, 384, 437, 438, 439, 440, - /* 2160 */ 441, 442, 106, 444, 266, 37, 37, 396, 37, 398, - /* 2170 */ 33, 49, 432, 0, 434, 259, 0, 437, 438, 439, - /* 2180 */ 440, 441, 442, 266, 444, 343, 106, 42, 106, 106, - /* 2190 */ 0, 174, 104, 106, 42, 107, 105, 49, 356, 105, - /* 2200 */ 33, 343, 176, 432, 114, 434, 105, 105, 437, 438, - /* 2210 */ 439, 440, 441, 442, 356, 444, 105, 105, 103, 246, - /* 2220 */ 2, 103, 22, 49, 224, 105, 384, 139, 49, 106, - /* 2230 */ 105, 22, 106, 106, 115, 105, 37, 105, 396, 105, - /* 2240 */ 398, 106, 384, 37, 105, 37, 106, 105, 22, 106, - /* 2250 */ 106, 105, 37, 343, 396, 105, 398, 106, 37, 226, - /* 2260 */ 105, 37, 174, 106, 105, 37, 356, 106, 105, 181, - /* 2270 */ 33, 105, 343, 126, 432, 105, 434, 37, 71, 437, - /* 2280 */ 438, 439, 440, 441, 442, 356, 444, 105, 200, 70, - /* 2290 */ 432, 126, 434, 37, 384, 437, 438, 439, 440, 441, - /* 2300 */ 442, 126, 444, 126, 37, 343, 396, 37, 398, 37, - /* 2310 */ 77, 37, 37, 384, 37, 37, 99, 33, 356, 37, - /* 2320 */ 37, 22, 37, 37, 343, 396, 37, 398, 77, 37, - /* 2330 */ 37, 37, 37, 37, 37, 22, 0, 356, 37, 37, - /* 2340 */ 343, 51, 432, 0, 434, 42, 384, 437, 438, 439, - /* 2350 */ 440, 441, 442, 356, 444, 37, 51, 42, 396, 0, - /* 2360 */ 398, 432, 37, 434, 42, 384, 437, 438, 439, 440, - /* 2370 */ 441, 442, 51, 444, 0, 343, 37, 396, 51, 398, - /* 2380 */ 0, 384, 42, 37, 37, 0, 22, 33, 356, 22, - /* 2390 */ 21, 21, 343, 396, 432, 398, 434, 22, 22, 437, - /* 2400 */ 438, 439, 440, 441, 442, 356, 444, 20, 494, 494, - /* 2410 */ 494, 494, 494, 432, 494, 434, 384, 494, 437, 438, - /* 2420 */ 439, 440, 441, 442, 494, 444, 494, 343, 396, 432, - /* 2430 */ 398, 434, 494, 384, 437, 438, 439, 440, 441, 442, - /* 2440 */ 356, 444, 494, 494, 494, 396, 494, 398, 494, 494, - /* 2450 */ 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, - /* 2460 */ 494, 494, 494, 494, 432, 494, 434, 494, 384, 437, - /* 2470 */ 438, 439, 440, 441, 442, 494, 444, 494, 494, 494, - /* 2480 */ 396, 432, 398, 434, 494, 494, 437, 438, 439, 440, - /* 2490 */ 441, 442, 343, 444, 494, 494, 494, 494, 494, 494, - /* 2500 */ 494, 494, 494, 494, 494, 356, 494, 343, 494, 494, - /* 2510 */ 494, 494, 494, 494, 494, 494, 432, 494, 434, 494, - /* 2520 */ 356, 437, 438, 439, 440, 441, 442, 494, 444, 343, - /* 2530 */ 494, 494, 494, 384, 494, 494, 494, 494, 494, 494, - /* 2540 */ 494, 494, 356, 494, 494, 396, 494, 398, 384, 494, - /* 2550 */ 494, 494, 494, 494, 343, 494, 494, 494, 494, 494, - /* 2560 */ 396, 494, 398, 494, 494, 494, 494, 356, 494, 494, - /* 2570 */ 384, 494, 494, 494, 494, 494, 494, 494, 494, 494, - /* 2580 */ 494, 432, 396, 434, 398, 494, 437, 438, 439, 440, - /* 2590 */ 441, 442, 494, 444, 494, 384, 432, 494, 434, 494, - /* 2600 */ 494, 437, 438, 439, 440, 441, 442, 396, 444, 398, - /* 2610 */ 494, 494, 494, 494, 494, 494, 343, 494, 432, 494, - /* 2620 */ 434, 494, 494, 437, 438, 439, 440, 441, 442, 356, - /* 2630 */ 444, 494, 494, 494, 343, 494, 494, 494, 494, 494, - /* 2640 */ 494, 494, 494, 432, 494, 434, 494, 356, 437, 438, - /* 2650 */ 439, 440, 441, 442, 494, 444, 494, 384, 494, 494, - /* 2660 */ 494, 494, 494, 494, 494, 494, 494, 494, 494, 396, - /* 2670 */ 494, 398, 494, 494, 494, 384, 494, 494, 494, 494, - /* 2680 */ 494, 343, 494, 494, 494, 494, 494, 396, 494, 398, - /* 2690 */ 494, 494, 494, 494, 356, 494, 343, 494, 494, 494, - /* 2700 */ 494, 494, 494, 494, 494, 432, 494, 434, 494, 356, - /* 2710 */ 437, 438, 439, 440, 441, 442, 494, 444, 494, 494, - /* 2720 */ 494, 494, 384, 432, 494, 434, 494, 494, 437, 438, - /* 2730 */ 439, 440, 441, 442, 396, 444, 398, 384, 494, 494, - /* 2740 */ 494, 494, 494, 494, 494, 494, 494, 494, 494, 396, - /* 2750 */ 494, 398, 494, 494, 494, 494, 494, 494, 494, 494, - /* 2760 */ 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, - /* 2770 */ 432, 494, 434, 494, 494, 437, 438, 439, 440, 441, - /* 2780 */ 442, 494, 444, 494, 494, 432, 494, 434, 494, 494, - /* 2790 */ 437, 438, 439, 440, 441, 442, 494, 444, 340, 340, - /* 2800 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 2810 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 2820 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 2830 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 2840 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 2850 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 2860 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 2870 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 2880 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 2890 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 2900 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 2910 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 2920 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 2930 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 2940 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 2950 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 2960 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 2970 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 2980 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 2990 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3000 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3010 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3020 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3030 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3040 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3050 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3060 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3070 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3080 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3090 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3100 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3110 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3120 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, - /* 3130 */ 340, 340, 340, 340, 340, 340, 340, 340, + /* 240 */ 240, 241, 242, 243, 244, 245, 246, 247, 12, 13, + /* 250 */ 0, 4, 445, 18, 105, 20, 20, 353, 22, 20, + /* 260 */ 356, 357, 27, 0, 175, 30, 70, 358, 359, 368, + /* 270 */ 35, 35, 183, 37, 8, 9, 227, 376, 12, 13, + /* 280 */ 14, 15, 16, 72, 73, 74, 51, 378, 53, 106, + /* 290 */ 79, 80, 81, 58, 385, 264, 85, 20, 375, 33, + /* 300 */ 64, 90, 91, 92, 93, 248, 70, 96, 386, 113, + /* 310 */ 8, 9, 389, 77, 12, 13, 14, 15, 16, 69, + /* 320 */ 398, 346, 399, 4, 275, 276, 277, 278, 279, 280, + /* 330 */ 281, 160, 358, 359, 359, 72, 73, 74, 102, 104, + /* 340 */ 169, 105, 79, 80, 81, 354, 141, 142, 85, 358, + /* 350 */ 115, 360, 105, 90, 91, 92, 93, 397, 175, 96, + /* 360 */ 400, 401, 387, 440, 14, 46, 47, 48, 172, 179, + /* 370 */ 20, 358, 106, 450, 399, 197, 401, 141, 142, 264, + /* 380 */ 145, 146, 105, 148, 149, 150, 151, 152, 153, 154, + /* 390 */ 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, + /* 400 */ 105, 166, 167, 168, 387, 170, 171, 190, 115, 173, + /* 410 */ 174, 176, 395, 438, 175, 440, 180, 181, 443, 444, + /* 420 */ 445, 446, 447, 448, 20, 450, 0, 414, 415, 86, + /* 430 */ 455, 195, 457, 197, 217, 218, 461, 462, 464, 465, + /* 440 */ 466, 467, 20, 469, 470, 358, 359, 251, 252, 253, + /* 450 */ 254, 255, 256, 257, 258, 259, 260, 261, 165, 484, + /* 460 */ 270, 271, 272, 227, 228, 135, 230, 231, 232, 233, + /* 470 */ 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + /* 480 */ 244, 245, 246, 247, 248, 12, 13, 346, 20, 187, + /* 490 */ 147, 379, 365, 20, 387, 22, 358, 359, 387, 387, + /* 500 */ 359, 394, 358, 359, 102, 394, 394, 395, 35, 402, + /* 510 */ 37, 264, 169, 402, 402, 346, 378, 390, 116, 117, + /* 520 */ 118, 119, 120, 121, 122, 123, 124, 125, 387, 127, + /* 530 */ 128, 129, 130, 131, 132, 133, 51, 64, 208, 209, + /* 540 */ 399, 264, 401, 70, 59, 387, 453, 62, 63, 456, + /* 550 */ 77, 407, 465, 466, 467, 22, 469, 470, 346, 264, + /* 560 */ 134, 135, 136, 137, 138, 139, 140, 409, 399, 411, + /* 570 */ 37, 359, 422, 361, 105, 102, 14, 346, 105, 438, + /* 580 */ 469, 440, 20, 472, 443, 444, 445, 446, 447, 448, + /* 590 */ 346, 450, 290, 248, 453, 250, 455, 456, 457, 387, + /* 600 */ 489, 490, 461, 462, 134, 494, 495, 35, 138, 69, + /* 610 */ 77, 399, 367, 401, 141, 142, 20, 358, 359, 469, + /* 620 */ 8, 9, 472, 51, 12, 13, 14, 15, 16, 384, + /* 630 */ 399, 59, 60, 61, 62, 102, 64, 378, 393, 489, + /* 640 */ 490, 358, 359, 399, 494, 495, 173, 174, 358, 359, + /* 650 */ 438, 387, 440, 180, 181, 443, 444, 445, 446, 447, + /* 660 */ 448, 378, 450, 194, 379, 196, 115, 455, 195, 457, + /* 670 */ 197, 77, 387, 461, 462, 411, 104, 8, 9, 107, + /* 680 */ 395, 12, 13, 14, 15, 16, 8, 9, 346, 20, + /* 690 */ 12, 13, 14, 15, 16, 226, 0, 407, 358, 359, + /* 700 */ 227, 228, 37, 230, 231, 232, 233, 234, 235, 236, + /* 710 */ 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + /* 720 */ 247, 12, 13, 14, 346, 358, 359, 0, 195, 20, + /* 730 */ 197, 22, 379, 264, 115, 173, 387, 359, 42, 361, + /* 740 */ 387, 399, 77, 394, 35, 378, 37, 407, 395, 177, + /* 750 */ 178, 402, 358, 359, 358, 359, 184, 185, 0, 442, + /* 760 */ 227, 228, 8, 9, 379, 387, 12, 13, 14, 15, + /* 770 */ 16, 175, 387, 64, 378, 203, 14, 399, 51, 401, + /* 780 */ 395, 385, 20, 346, 106, 468, 77, 175, 8, 9, + /* 790 */ 346, 2, 12, 13, 14, 15, 16, 8, 9, 358, + /* 800 */ 359, 12, 13, 14, 15, 16, 3, 358, 359, 358, + /* 810 */ 359, 102, 346, 346, 105, 442, 438, 346, 440, 378, + /* 820 */ 77, 443, 444, 445, 446, 447, 448, 378, 450, 378, + /* 830 */ 359, 4, 361, 455, 64, 457, 399, 358, 359, 461, + /* 840 */ 462, 468, 2, 399, 175, 454, 19, 456, 8, 9, + /* 850 */ 141, 142, 12, 13, 14, 15, 16, 378, 387, 465, + /* 860 */ 466, 467, 35, 469, 470, 399, 399, 358, 359, 387, + /* 870 */ 399, 20, 401, 20, 104, 22, 394, 107, 51, 358, + /* 880 */ 359, 442, 173, 174, 402, 58, 106, 378, 365, 180, + /* 890 */ 181, 64, 134, 135, 136, 137, 138, 139, 140, 378, + /* 900 */ 358, 359, 358, 359, 195, 382, 197, 468, 55, 438, + /* 910 */ 346, 440, 4, 390, 443, 444, 445, 446, 447, 448, + /* 920 */ 378, 450, 378, 387, 363, 364, 455, 422, 457, 34, + /* 930 */ 394, 104, 461, 462, 107, 173, 227, 228, 402, 230, + /* 940 */ 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, + /* 950 */ 241, 242, 243, 244, 245, 246, 247, 12, 13, 383, + /* 960 */ 346, 358, 359, 399, 454, 20, 456, 22, 39, 40, + /* 970 */ 372, 373, 136, 359, 469, 361, 140, 472, 358, 359, + /* 980 */ 35, 378, 37, 134, 135, 136, 137, 138, 139, 140, + /* 990 */ 375, 346, 141, 142, 489, 490, 358, 359, 378, 494, + /* 1000 */ 495, 387, 22, 469, 389, 22, 472, 135, 136, 64, + /* 1010 */ 172, 435, 140, 399, 399, 401, 378, 37, 20, 346, + /* 1020 */ 37, 346, 77, 422, 490, 346, 346, 387, 494, 495, + /* 1030 */ 422, 180, 181, 372, 373, 14, 15, 16, 109, 110, + /* 1040 */ 204, 112, 402, 207, 399, 20, 210, 102, 212, 42, + /* 1050 */ 105, 346, 438, 346, 440, 440, 346, 443, 444, 445, + /* 1060 */ 446, 447, 448, 134, 450, 450, 359, 138, 361, 455, + /* 1070 */ 469, 457, 399, 472, 399, 461, 462, 469, 399, 399, + /* 1080 */ 472, 367, 102, 349, 350, 102, 141, 142, 285, 251, + /* 1090 */ 489, 490, 47, 48, 387, 494, 495, 489, 490, 261, + /* 1100 */ 387, 37, 494, 495, 399, 387, 399, 393, 401, 399, + /* 1110 */ 33, 396, 0, 396, 399, 402, 399, 14, 173, 174, + /* 1120 */ 402, 396, 45, 20, 399, 180, 181, 380, 0, 374, + /* 1130 */ 383, 33, 377, 262, 263, 108, 108, 33, 111, 111, + /* 1140 */ 195, 108, 197, 108, 111, 438, 111, 440, 0, 45, + /* 1150 */ 443, 444, 445, 446, 447, 448, 33, 450, 211, 33, + /* 1160 */ 213, 33, 455, 33, 457, 64, 388, 33, 461, 462, + /* 1170 */ 22, 173, 227, 228, 266, 230, 231, 232, 233, 234, + /* 1180 */ 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, + /* 1190 */ 245, 246, 247, 12, 13, 13, 13, 0, 33, 33, + /* 1200 */ 175, 20, 0, 22, 106, 1, 0, 33, 107, 141, + /* 1210 */ 142, 33, 33, 1, 2, 70, 35, 49, 37, 37, + /* 1220 */ 37, 33, 33, 19, 22, 33, 105, 37, 22, 106, + /* 1230 */ 13, 388, 106, 13, 33, 114, 106, 346, 388, 35, + /* 1240 */ 106, 33, 388, 33, 33, 64, 33, 33, 33, 52, + /* 1250 */ 359, 388, 361, 37, 37, 51, 388, 37, 77, 33, + /* 1260 */ 428, 197, 376, 59, 60, 61, 62, 347, 64, 412, + /* 1270 */ 263, 106, 498, 105, 33, 487, 362, 18, 387, 481, + /* 1280 */ 375, 375, 23, 102, 106, 106, 105, 387, 421, 362, + /* 1290 */ 399, 412, 401, 77, 106, 106, 357, 359, 106, 40, + /* 1300 */ 41, 398, 412, 44, 471, 12, 13, 106, 104, 491, + /* 1310 */ 463, 107, 423, 54, 106, 22, 106, 106, 474, 106, + /* 1320 */ 106, 106, 141, 142, 65, 66, 67, 68, 35, 438, + /* 1330 */ 37, 440, 106, 221, 443, 444, 445, 446, 447, 448, + /* 1340 */ 267, 450, 51, 139, 20, 432, 455, 106, 457, 439, + /* 1350 */ 210, 367, 461, 462, 173, 174, 437, 64, 432, 367, + /* 1360 */ 193, 180, 181, 20, 105, 425, 358, 20, 359, 408, + /* 1370 */ 77, 45, 227, 20, 412, 359, 195, 408, 197, 172, + /* 1380 */ 405, 177, 358, 405, 408, 359, 405, 197, 184, 358, + /* 1390 */ 103, 371, 370, 101, 358, 102, 100, 346, 369, 358, + /* 1400 */ 358, 358, 143, 20, 351, 50, 351, 203, 227, 228, + /* 1410 */ 359, 230, 231, 232, 233, 234, 235, 236, 237, 238, + /* 1420 */ 239, 240, 241, 242, 243, 244, 245, 246, 247, 355, + /* 1430 */ 355, 432, 367, 20, 367, 401, 20, 20, 387, 360, + /* 1440 */ 360, 424, 20, 367, 358, 367, 187, 188, 189, 367, + /* 1450 */ 399, 192, 401, 287, 415, 367, 367, 351, 387, 387, + /* 1460 */ 358, 351, 349, 289, 205, 206, 349, 214, 387, 399, + /* 1470 */ 387, 387, 387, 346, 387, 216, 436, 387, 219, 387, + /* 1480 */ 387, 222, 223, 224, 225, 226, 359, 387, 195, 438, + /* 1490 */ 197, 440, 105, 399, 443, 444, 445, 446, 447, 448, + /* 1500 */ 434, 450, 346, 365, 399, 201, 455, 200, 457, 401, + /* 1510 */ 199, 365, 461, 462, 387, 359, 358, 399, 274, 282, + /* 1520 */ 227, 228, 431, 264, 480, 429, 399, 432, 401, 430, + /* 1530 */ 423, 412, 412, 240, 241, 242, 243, 244, 245, 246, + /* 1540 */ 346, 273, 417, 387, 483, 186, 399, 284, 417, 480, + /* 1550 */ 399, 399, 283, 359, 268, 399, 423, 401, 291, 499, + /* 1560 */ 288, 286, 263, 20, 359, 438, 442, 440, 115, 360, + /* 1570 */ 443, 444, 445, 446, 447, 448, 417, 450, 265, 482, + /* 1580 */ 417, 387, 455, 365, 457, 399, 365, 478, 461, 462, + /* 1590 */ 475, 480, 346, 399, 438, 401, 440, 399, 399, 443, + /* 1600 */ 444, 445, 446, 447, 448, 359, 450, 493, 479, 477, + /* 1610 */ 473, 455, 178, 457, 492, 365, 413, 461, 462, 383, + /* 1620 */ 365, 399, 399, 399, 359, 105, 105, 399, 377, 460, + /* 1630 */ 346, 391, 438, 387, 440, 358, 365, 443, 444, 445, + /* 1640 */ 446, 447, 448, 359, 450, 399, 22, 401, 348, 38, + /* 1650 */ 352, 457, 351, 426, 381, 461, 462, 418, 433, 381, + /* 1660 */ 346, 418, 381, 366, 344, 0, 0, 0, 45, 0, + /* 1670 */ 37, 387, 220, 359, 37, 37, 37, 220, 0, 37, + /* 1680 */ 37, 220, 346, 399, 438, 401, 440, 0, 220, 443, + /* 1690 */ 444, 445, 446, 447, 448, 359, 450, 0, 37, 0, + /* 1700 */ 0, 387, 22, 457, 215, 37, 0, 461, 462, 203, + /* 1710 */ 0, 203, 197, 399, 204, 401, 0, 195, 0, 0, + /* 1720 */ 191, 190, 438, 387, 440, 0, 0, 443, 444, 445, + /* 1730 */ 446, 447, 448, 146, 450, 399, 0, 401, 49, 49, + /* 1740 */ 37, 457, 51, 0, 49, 461, 462, 0, 0, 45, + /* 1750 */ 0, 0, 438, 0, 440, 346, 49, 443, 444, 445, + /* 1760 */ 446, 447, 448, 449, 450, 451, 452, 0, 359, 0, + /* 1770 */ 0, 0, 346, 0, 438, 160, 440, 37, 0, 443, + /* 1780 */ 444, 445, 446, 447, 448, 359, 450, 160, 0, 0, + /* 1790 */ 0, 0, 0, 346, 0, 0, 387, 45, 49, 0, + /* 1800 */ 0, 0, 0, 0, 0, 0, 359, 0, 399, 0, + /* 1810 */ 401, 0, 0, 387, 0, 0, 0, 0, 0, 0, + /* 1820 */ 22, 485, 486, 146, 0, 399, 145, 401, 0, 144, + /* 1830 */ 0, 0, 22, 50, 387, 22, 0, 50, 64, 0, + /* 1840 */ 64, 0, 0, 37, 64, 0, 399, 438, 401, 440, + /* 1850 */ 42, 0, 443, 444, 445, 446, 447, 448, 37, 450, + /* 1860 */ 37, 0, 346, 0, 438, 0, 440, 42, 33, 443, + /* 1870 */ 444, 445, 446, 447, 448, 359, 450, 51, 51, 42, + /* 1880 */ 37, 37, 42, 457, 51, 438, 346, 440, 462, 14, + /* 1890 */ 443, 444, 445, 446, 447, 448, 49, 450, 45, 359, + /* 1900 */ 0, 49, 43, 387, 49, 496, 497, 0, 392, 42, + /* 1910 */ 0, 0, 346, 42, 186, 399, 0, 401, 49, 0, + /* 1920 */ 0, 71, 0, 0, 37, 359, 42, 387, 51, 0, + /* 1930 */ 37, 51, 392, 486, 0, 37, 346, 42, 42, 399, + /* 1940 */ 51, 401, 37, 42, 0, 51, 0, 0, 0, 359, + /* 1950 */ 0, 0, 0, 387, 438, 22, 440, 111, 37, 443, + /* 1960 */ 444, 445, 446, 447, 448, 399, 450, 401, 37, 113, + /* 1970 */ 0, 22, 37, 37, 37, 37, 37, 387, 438, 0, + /* 1980 */ 440, 0, 37, 443, 444, 445, 446, 447, 448, 399, + /* 1990 */ 450, 401, 33, 33, 37, 37, 22, 22, 37, 0, + /* 2000 */ 22, 37, 346, 0, 438, 0, 440, 53, 0, 443, + /* 2010 */ 444, 445, 446, 447, 448, 359, 450, 37, 346, 0, + /* 2020 */ 37, 0, 22, 37, 20, 37, 37, 0, 438, 346, + /* 2030 */ 440, 359, 106, 443, 444, 445, 446, 447, 448, 175, + /* 2040 */ 450, 0, 359, 387, 37, 105, 105, 22, 392, 175, + /* 2050 */ 202, 22, 198, 0, 488, 399, 178, 401, 175, 387, + /* 2060 */ 0, 182, 3, 175, 182, 269, 33, 105, 50, 106, + /* 2070 */ 387, 399, 105, 401, 103, 392, 50, 101, 106, 33, + /* 2080 */ 33, 33, 399, 106, 401, 49, 49, 497, 106, 105, + /* 2090 */ 105, 3, 105, 37, 438, 105, 440, 33, 269, 443, + /* 2100 */ 444, 445, 446, 447, 448, 33, 450, 106, 106, 0, + /* 2110 */ 438, 37, 440, 37, 37, 443, 444, 445, 446, 447, + /* 2120 */ 448, 438, 450, 440, 452, 33, 443, 444, 445, 446, + /* 2130 */ 447, 448, 346, 450, 37, 269, 37, 106, 49, 49, + /* 2140 */ 106, 0, 42, 346, 105, 359, 106, 262, 105, 0, + /* 2150 */ 106, 49, 179, 42, 105, 105, 359, 105, 33, 105, + /* 2160 */ 103, 249, 2, 49, 103, 114, 22, 105, 346, 177, + /* 2170 */ 227, 106, 105, 387, 106, 105, 49, 106, 392, 106, + /* 2180 */ 105, 359, 229, 105, 387, 399, 22, 401, 105, 37, + /* 2190 */ 106, 37, 105, 37, 115, 37, 399, 106, 401, 105, + /* 2200 */ 37, 106, 106, 105, 37, 37, 105, 126, 105, 387, + /* 2210 */ 106, 106, 105, 105, 33, 105, 37, 105, 22, 126, + /* 2220 */ 70, 399, 71, 401, 438, 37, 440, 37, 37, 443, + /* 2230 */ 444, 445, 446, 447, 448, 438, 450, 440, 346, 126, + /* 2240 */ 443, 444, 445, 446, 447, 448, 126, 450, 37, 37, + /* 2250 */ 37, 359, 37, 37, 77, 33, 99, 37, 37, 22, + /* 2260 */ 438, 37, 440, 37, 346, 443, 444, 445, 446, 447, + /* 2270 */ 448, 37, 450, 37, 22, 77, 37, 359, 37, 387, + /* 2280 */ 37, 37, 37, 37, 0, 37, 51, 0, 346, 42, + /* 2290 */ 37, 399, 42, 401, 0, 37, 42, 0, 37, 42, + /* 2300 */ 51, 359, 51, 0, 0, 387, 51, 37, 37, 33, + /* 2310 */ 22, 22, 21, 500, 346, 22, 21, 399, 22, 401, + /* 2320 */ 20, 500, 500, 500, 500, 500, 500, 359, 500, 387, + /* 2330 */ 438, 500, 440, 500, 500, 443, 444, 445, 446, 447, + /* 2340 */ 448, 399, 450, 401, 500, 500, 500, 500, 500, 500, + /* 2350 */ 500, 500, 500, 500, 500, 387, 438, 500, 440, 500, + /* 2360 */ 500, 443, 444, 445, 446, 447, 448, 399, 450, 401, + /* 2370 */ 500, 500, 500, 500, 500, 500, 500, 500, 346, 500, + /* 2380 */ 438, 500, 440, 500, 500, 443, 444, 445, 446, 447, + /* 2390 */ 448, 359, 450, 500, 500, 500, 500, 500, 500, 500, + /* 2400 */ 500, 500, 500, 500, 346, 500, 438, 500, 440, 500, + /* 2410 */ 500, 443, 444, 445, 446, 447, 448, 359, 450, 387, + /* 2420 */ 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, + /* 2430 */ 500, 399, 500, 401, 500, 500, 500, 500, 500, 500, + /* 2440 */ 500, 500, 500, 500, 500, 387, 500, 500, 500, 500, + /* 2450 */ 500, 500, 500, 500, 500, 500, 500, 399, 500, 401, + /* 2460 */ 500, 500, 500, 500, 500, 500, 500, 500, 346, 500, + /* 2470 */ 438, 500, 440, 500, 500, 443, 444, 445, 446, 447, + /* 2480 */ 448, 359, 450, 500, 500, 500, 500, 500, 500, 500, + /* 2490 */ 500, 500, 500, 500, 500, 500, 438, 500, 440, 500, + /* 2500 */ 500, 443, 444, 445, 446, 447, 448, 500, 450, 387, + /* 2510 */ 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, + /* 2520 */ 346, 399, 500, 401, 500, 500, 500, 500, 500, 500, + /* 2530 */ 500, 500, 500, 359, 500, 500, 500, 500, 500, 500, + /* 2540 */ 500, 500, 500, 346, 500, 500, 500, 500, 500, 500, + /* 2550 */ 500, 500, 500, 500, 500, 500, 359, 500, 500, 500, + /* 2560 */ 438, 387, 440, 500, 500, 443, 444, 445, 446, 447, + /* 2570 */ 448, 500, 450, 399, 500, 401, 500, 500, 500, 500, + /* 2580 */ 500, 500, 500, 500, 387, 500, 500, 500, 500, 500, + /* 2590 */ 500, 500, 500, 500, 500, 500, 399, 500, 401, 500, + /* 2600 */ 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, + /* 2610 */ 500, 500, 438, 346, 440, 500, 500, 443, 444, 445, + /* 2620 */ 446, 447, 448, 500, 450, 500, 359, 500, 500, 500, + /* 2630 */ 500, 500, 500, 500, 500, 438, 500, 440, 346, 500, + /* 2640 */ 443, 444, 445, 446, 447, 448, 500, 450, 500, 500, + /* 2650 */ 500, 359, 500, 500, 387, 500, 500, 500, 500, 500, + /* 2660 */ 500, 500, 500, 500, 500, 500, 399, 500, 401, 500, + /* 2670 */ 500, 500, 500, 500, 500, 500, 500, 500, 500, 387, + /* 2680 */ 500, 500, 500, 500, 500, 500, 500, 500, 346, 500, + /* 2690 */ 500, 399, 500, 401, 500, 500, 500, 500, 500, 500, + /* 2700 */ 500, 359, 500, 346, 500, 438, 500, 440, 500, 500, + /* 2710 */ 443, 444, 445, 446, 447, 448, 359, 450, 500, 500, + /* 2720 */ 500, 500, 500, 500, 500, 500, 500, 500, 500, 387, + /* 2730 */ 438, 500, 440, 500, 500, 443, 444, 445, 446, 447, + /* 2740 */ 448, 399, 450, 401, 387, 500, 500, 500, 500, 500, + /* 2750 */ 500, 500, 500, 346, 500, 500, 399, 500, 401, 500, + /* 2760 */ 500, 500, 500, 500, 500, 500, 359, 500, 500, 500, + /* 2770 */ 500, 500, 500, 500, 500, 500, 500, 500, 346, 500, + /* 2780 */ 438, 500, 440, 500, 500, 443, 444, 445, 446, 447, + /* 2790 */ 448, 359, 450, 500, 387, 438, 500, 440, 500, 500, + /* 2800 */ 443, 444, 445, 446, 447, 448, 399, 450, 401, 500, + /* 2810 */ 500, 500, 500, 500, 500, 500, 500, 500, 500, 387, + /* 2820 */ 500, 500, 500, 500, 500, 500, 500, 500, 346, 500, + /* 2830 */ 500, 399, 500, 401, 500, 500, 500, 500, 500, 500, + /* 2840 */ 500, 359, 500, 346, 500, 438, 500, 440, 500, 500, + /* 2850 */ 443, 444, 445, 446, 447, 448, 359, 450, 500, 500, + /* 2860 */ 500, 500, 500, 500, 500, 500, 500, 500, 500, 387, + /* 2870 */ 438, 500, 440, 500, 500, 443, 444, 445, 446, 447, + /* 2880 */ 448, 399, 450, 401, 387, 500, 500, 500, 500, 500, + /* 2890 */ 500, 500, 500, 500, 500, 500, 399, 500, 401, 500, + /* 2900 */ 500, 500, 500, 500, 500, 500, 500, 500, 346, 500, + /* 2910 */ 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, + /* 2920 */ 438, 359, 440, 500, 500, 443, 444, 445, 446, 447, + /* 2930 */ 448, 500, 450, 500, 500, 438, 500, 440, 500, 500, + /* 2940 */ 443, 444, 445, 446, 447, 448, 500, 450, 500, 387, + /* 2950 */ 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, + /* 2960 */ 346, 399, 500, 401, 500, 500, 500, 500, 500, 500, + /* 2970 */ 500, 500, 500, 359, 500, 500, 500, 500, 500, 500, + /* 2980 */ 500, 500, 346, 500, 500, 500, 500, 500, 500, 500, + /* 2990 */ 500, 500, 500, 500, 500, 359, 500, 500, 500, 500, + /* 3000 */ 438, 387, 440, 500, 500, 443, 444, 445, 446, 447, + /* 3010 */ 448, 500, 450, 399, 500, 401, 500, 500, 500, 500, + /* 3020 */ 500, 500, 500, 387, 500, 500, 500, 500, 500, 500, + /* 3030 */ 500, 500, 500, 500, 500, 399, 500, 401, 500, 500, + /* 3040 */ 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, + /* 3050 */ 500, 500, 438, 500, 440, 500, 500, 443, 444, 445, + /* 3060 */ 446, 447, 448, 500, 450, 500, 500, 500, 500, 500, + /* 3070 */ 500, 500, 500, 500, 438, 500, 440, 500, 500, 443, + /* 3080 */ 444, 445, 446, 447, 448, 500, 450, 343, 343, 343, + /* 3090 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3100 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3110 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3120 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3130 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3140 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3150 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3160 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3170 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3180 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3190 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3200 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3210 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3220 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3230 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3240 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3250 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3260 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3270 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3280 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3290 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3300 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3310 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3320 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3330 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3340 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3350 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3360 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3370 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3380 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3390 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3400 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3410 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, + /* 3420 */ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, }; -#define YY_SHIFT_COUNT (810) +#define YY_SHIFT_COUNT (815) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2387) +#define YY_SHIFT_MAX (2304) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 842, 0, 233, 0, 467, 467, 467, 467, 467, 467, - /* 10 */ 467, 467, 467, 467, 467, 467, 700, 933, 933, 1166, - /* 20 */ 933, 933, 933, 933, 933, 933, 933, 933, 933, 933, - /* 30 */ 933, 933, 933, 933, 933, 933, 933, 933, 933, 933, - /* 40 */ 933, 933, 933, 933, 933, 933, 933, 933, 933, 933, - /* 50 */ 933, 227, 260, 394, 274, 195, 271, 195, 274, 274, - /* 60 */ 195, 1349, 195, 1349, 1349, 409, 195, 18, 115, 143, - /* 70 */ 143, 115, 261, 261, 117, 192, 126, 126, 143, 143, - /* 80 */ 143, 143, 143, 143, 143, 143, 143, 143, 249, 143, - /* 90 */ 143, 113, 18, 143, 143, 392, 18, 143, 143, 18, - /* 100 */ 143, 143, 18, 143, 18, 18, 18, 143, 458, 232, - /* 110 */ 193, 193, 443, 298, 642, 642, 642, 642, 642, 642, - /* 120 */ 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, - /* 130 */ 642, 642, 642, 1115, 620, 117, 192, 248, 248, 534, - /* 140 */ 806, 806, 806, 185, 512, 512, 534, 113, 398, 18, - /* 150 */ 18, 330, 18, 544, 18, 544, 544, 528, 710, 788, - /* 160 */ 37, 37, 37, 37, 37, 37, 37, 37, 2088, 660, - /* 170 */ 21, 53, 15, 67, 229, 155, 4, 4, 611, 198, - /* 180 */ 850, 464, 945, 1146, 1177, 914, 969, 936, 14, 1053, - /* 190 */ 936, 1047, 998, 928, 1104, 1338, 1396, 1215, 113, 1396, - /* 200 */ 113, 1245, 1420, 1398, 1424, 1420, 1398, 1278, 1430, 1420, - /* 210 */ 1430, 1398, 1278, 1278, 1353, 1369, 1430, 1377, 1430, 1430, - /* 220 */ 1430, 1466, 1439, 1466, 1439, 1396, 113, 1480, 113, 1484, - /* 230 */ 1485, 113, 1484, 113, 1487, 113, 113, 1430, 113, 1466, - /* 240 */ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - /* 250 */ 18, 1430, 788, 788, 1466, 544, 544, 544, 1339, 1456, - /* 260 */ 1396, 458, 1371, 1374, 1480, 458, 1376, 1104, 1430, 1424, - /* 270 */ 1424, 544, 1311, 1314, 544, 1311, 1314, 544, 544, 18, - /* 280 */ 1319, 1418, 1311, 1330, 1334, 1347, 1104, 1331, 1337, 1341, - /* 290 */ 1365, 1420, 1607, 1516, 1367, 1484, 458, 458, 1314, 544, - /* 300 */ 544, 544, 544, 544, 1314, 544, 1474, 458, 528, 458, - /* 310 */ 1420, 1562, 1568, 544, 710, 1430, 458, 1659, 1649, 1466, - /* 320 */ 2798, 2798, 2798, 2798, 2798, 2798, 2798, 2798, 2798, 36, - /* 330 */ 932, 406, 263, 506, 906, 948, 837, 1107, 1267, 835, - /* 340 */ 879, 1225, 1225, 1225, 1225, 1225, 1225, 1225, 1225, 1225, - /* 350 */ 356, 415, 527, 621, 621, 27, 449, 268, 44, 943, - /* 360 */ 647, 824, 657, 589, 589, 672, 889, 784, 672, 672, - /* 370 */ 672, 152, 658, 1093, 1070, 1169, 1085, 1147, 1098, 1110, - /* 380 */ 1112, 1118, 640, 1198, 407, 776, 1210, 1034, 1116, 1182, - /* 390 */ 1141, 1183, 1203, 1214, 1113, 1055, 1151, 1219, 1223, 1230, - /* 400 */ 1281, 1282, 1308, 1283, 1318, 34, 1321, 1213, 1332, 1379, - /* 410 */ 1382, 1384, 1385, 1387, 1019, 1071, 1235, 1233, 1260, 1249, - /* 420 */ 715, 1715, 1725, 1726, 1674, 1730, 1695, 1518, 1705, 1707, - /* 430 */ 1708, 1530, 1748, 1712, 1714, 1536, 1754, 1539, 1757, 1722, - /* 440 */ 1761, 1741, 1764, 1729, 1556, 1769, 1571, 1772, 1573, 1574, - /* 450 */ 1583, 1586, 1779, 1780, 1781, 1594, 1597, 1785, 1786, 1738, - /* 460 */ 1788, 1752, 1739, 1791, 1743, 1795, 1763, 1797, 1809, 1813, - /* 470 */ 1765, 1821, 1824, 1826, 1827, 1828, 1829, 1670, 1794, 1832, - /* 480 */ 1673, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1844, 1845, - /* 490 */ 1852, 1854, 1855, 1856, 1860, 1862, 1863, 1825, 1873, 1830, - /* 500 */ 1876, 1877, 1878, 1879, 1880, 1881, 1861, 1882, 1884, 1886, - /* 510 */ 1744, 1889, 1890, 1869, 1808, 1870, 1843, 1894, 1831, 1859, - /* 520 */ 1897, 1841, 1899, 1847, 1901, 1902, 1866, 1853, 1864, 1907, - /* 530 */ 1871, 1865, 1872, 1915, 1883, 1868, 1875, 1921, 1885, 1923, - /* 540 */ 1887, 1888, 1891, 1892, 1895, 1912, 1896, 1931, 1893, 1908, - /* 550 */ 1933, 1935, 1937, 1918, 1746, 1938, 1892, 1900, 1939, 1943, - /* 560 */ 1903, 1957, 1964, 1925, 1914, 1949, 1977, 1942, 1941, 1951, - /* 570 */ 1994, 1958, 1946, 1956, 1999, 1965, 1950, 1961, 2004, 2006, - /* 580 */ 2007, 2008, 2010, 2011, 1904, 1905, 1976, 1993, 2018, 1982, - /* 590 */ 1983, 1984, 1985, 1987, 1989, 1990, 2001, 2003, 2002, 2009, - /* 600 */ 2016, 2015, 2040, 2019, 2043, 2022, 1992, 2047, 2037, 2024, - /* 610 */ 2063, 2064, 2065, 2029, 2067, 2031, 2069, 2048, 2051, 2035, - /* 620 */ 2036, 2039, 1968, 1972, 2078, 1906, 1975, 1909, 2044, 2060, - /* 630 */ 2086, 1911, 2062, 1926, 1913, 2098, 2100, 1928, 1930, 1932, - /* 640 */ 1934, 2099, 2071, 1846, 2005, 2012, 2014, 2061, 2013, 2070, - /* 650 */ 2020, 2023, 2089, 2092, 2025, 2021, 2027, 2028, 2034, 2095, - /* 660 */ 2081, 2085, 2030, 2104, 1898, 2038, 2056, 2138, 2109, 1917, - /* 670 */ 2106, 2108, 2117, 2128, 2129, 2131, 2080, 2082, 2097, 1916, - /* 680 */ 2137, 2122, 2173, 2176, 2091, 2145, 2094, 2083, 2087, 2101, - /* 690 */ 2102, 2026, 2111, 2190, 2152, 2017, 2112, 2090, 1892, 2148, - /* 700 */ 2167, 2115, 1973, 2118, 2218, 2200, 2000, 2120, 2123, 2125, - /* 710 */ 2126, 2130, 2127, 2174, 2132, 2134, 2179, 2135, 2209, 2033, - /* 720 */ 2139, 2119, 2140, 2199, 2206, 2142, 2143, 2208, 2146, 2144, - /* 730 */ 2215, 2150, 2151, 2221, 2155, 2157, 2224, 2159, 2161, 2228, - /* 740 */ 2163, 2147, 2165, 2175, 2177, 2166, 2237, 2170, 2240, 2182, - /* 750 */ 2237, 2237, 2226, 2207, 2219, 2256, 2267, 2270, 2272, 2274, - /* 760 */ 2275, 2277, 2278, 2233, 2217, 2284, 2282, 2283, 2285, 2299, - /* 770 */ 2286, 2289, 2292, 2251, 2001, 2293, 2003, 2294, 2295, 2296, - /* 780 */ 2297, 2313, 2301, 2336, 2302, 2290, 2303, 2343, 2318, 2305, - /* 790 */ 2315, 2359, 2325, 2321, 2322, 2374, 2339, 2327, 2340, 2380, - /* 800 */ 2346, 2347, 2385, 2364, 2354, 2367, 2369, 2375, 2376, 2370, - /* 810 */ 2387, + /* 0 */ 1259, 0, 236, 0, 473, 473, 473, 473, 473, 473, + /* 10 */ 473, 473, 473, 473, 473, 473, 709, 945, 945, 1181, + /* 20 */ 945, 945, 945, 945, 945, 945, 945, 945, 945, 945, + /* 30 */ 945, 945, 945, 945, 945, 945, 945, 945, 945, 945, + /* 40 */ 945, 945, 945, 945, 945, 945, 945, 945, 945, 945, + /* 50 */ 945, 115, 277, 469, 149, 31, 295, 31, 149, 149, + /* 60 */ 31, 1293, 31, 235, 1293, 1293, 247, 31, 209, 851, + /* 70 */ 404, 404, 851, 319, 319, 40, 205, 350, 350, 404, + /* 80 */ 404, 404, 404, 404, 404, 404, 404, 404, 404, 422, + /* 90 */ 404, 404, 44, 209, 404, 404, 468, 209, 404, 404, + /* 100 */ 209, 404, 404, 209, 404, 209, 209, 209, 404, 540, + /* 110 */ 196, 196, 211, 54, 533, 533, 533, 533, 533, 533, + /* 120 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533, + /* 130 */ 533, 533, 533, 929, 183, 40, 205, 12, 12, 665, + /* 140 */ 239, 239, 239, 250, 345, 345, 665, 44, 551, 209, + /* 150 */ 209, 57, 209, 594, 209, 594, 594, 619, 743, 895, + /* 160 */ 402, 402, 402, 402, 402, 402, 402, 402, 1204, 263, + /* 170 */ 23, 669, 302, 49, 51, 190, 178, 178, 562, 89, + /* 180 */ 762, 853, 596, 1045, 1103, 470, 1025, 871, 1007, 803, + /* 190 */ 871, 1077, 908, 998, 1073, 1291, 1324, 1140, 44, 1324, + /* 200 */ 44, 1167, 1343, 1347, 1326, 1353, 1347, 1326, 1207, 1343, + /* 210 */ 1347, 1343, 1326, 1207, 1207, 1287, 1292, 1343, 1296, 1343, + /* 220 */ 1343, 1343, 1383, 1355, 1383, 1355, 1324, 44, 1413, 44, + /* 230 */ 1416, 1417, 44, 1416, 44, 1422, 44, 44, 1343, 44, + /* 240 */ 1383, 209, 209, 209, 209, 209, 209, 209, 209, 209, + /* 250 */ 209, 209, 1343, 895, 895, 1383, 594, 594, 594, 1253, + /* 260 */ 1387, 1324, 540, 1304, 1307, 1413, 540, 1311, 1073, 1343, + /* 270 */ 1353, 1353, 594, 1244, 1268, 594, 1244, 1268, 594, 594, + /* 280 */ 209, 1237, 1359, 1244, 1263, 1269, 1286, 1073, 1267, 1272, + /* 290 */ 1275, 1299, 1347, 1543, 1453, 1313, 1416, 540, 540, 1268, + /* 300 */ 594, 594, 594, 594, 594, 1268, 594, 1434, 540, 619, + /* 310 */ 540, 1347, 1520, 1521, 594, 743, 1343, 540, 1624, 1611, + /* 320 */ 1383, 3087, 3087, 3087, 3087, 3087, 3087, 3087, 3087, 3087, + /* 330 */ 36, 572, 65, 266, 827, 678, 780, 426, 789, 840, + /* 340 */ 612, 758, 754, 754, 754, 754, 754, 754, 754, 754, + /* 350 */ 754, 849, 836, 139, 26, 26, 485, 217, 171, 770, + /* 360 */ 343, 980, 983, 330, 872, 872, 1021, 1, 838, 1021, + /* 370 */ 1021, 1021, 727, 1112, 1098, 696, 1104, 293, 1128, 1027, + /* 380 */ 1028, 1033, 1035, 1182, 1183, 1148, 1202, 1206, 947, 1123, + /* 390 */ 1126, 1101, 1130, 1134, 1165, 1068, 1166, 1174, 1178, 1179, + /* 400 */ 1188, 1189, 1192, 1201, 1212, 1208, 1145, 1210, 1168, 1211, + /* 410 */ 1213, 1214, 1215, 1226, 1241, 1121, 1064, 1190, 1217, 1220, + /* 420 */ 1216, 1197, 1665, 1666, 1667, 1623, 1669, 1633, 1452, 1637, + /* 430 */ 1638, 1639, 1457, 1678, 1642, 1643, 1461, 1687, 1468, 1697, + /* 440 */ 1661, 1699, 1680, 1700, 1668, 1489, 1706, 1506, 1710, 1508, + /* 450 */ 1510, 1515, 1522, 1716, 1718, 1719, 1529, 1531, 1725, 1726, + /* 460 */ 1587, 1689, 1690, 1736, 1703, 1691, 1743, 1695, 1747, 1704, + /* 470 */ 1748, 1750, 1751, 1707, 1753, 1767, 1769, 1770, 1771, 1773, + /* 480 */ 1615, 1740, 1778, 1627, 1788, 1789, 1790, 1791, 1792, 1794, + /* 490 */ 1795, 1807, 1809, 1811, 1812, 1814, 1815, 1816, 1817, 1818, + /* 500 */ 1749, 1799, 1752, 1800, 1801, 1802, 1803, 1804, 1805, 1798, + /* 510 */ 1819, 1677, 1824, 1681, 1828, 1685, 1830, 1831, 1810, 1783, + /* 520 */ 1813, 1787, 1836, 1774, 1806, 1839, 1776, 1841, 1780, 1842, + /* 530 */ 1845, 1821, 1826, 1808, 1851, 1823, 1827, 1825, 1861, 1843, + /* 540 */ 1833, 1837, 1863, 1844, 1865, 1853, 1840, 1835, 1847, 1852, + /* 550 */ 1875, 1855, 1900, 1859, 1867, 1907, 1910, 1911, 1871, 1728, + /* 560 */ 1916, 1847, 1869, 1919, 1920, 1850, 1922, 1923, 1887, 1877, + /* 570 */ 1884, 1929, 1893, 1880, 1895, 1934, 1898, 1889, 1896, 1950, + /* 580 */ 1905, 1894, 1901, 1944, 1946, 1947, 1948, 1951, 1952, 1856, + /* 590 */ 1846, 1921, 1933, 1970, 1931, 1935, 1936, 1937, 1938, 1939, + /* 600 */ 1945, 1959, 1960, 1957, 1958, 1949, 1961, 1979, 1974, 1981, + /* 610 */ 1975, 1954, 1999, 1978, 1964, 2003, 2005, 2008, 1980, 2019, + /* 620 */ 1983, 2021, 2000, 2004, 1986, 1988, 1989, 1926, 1940, 2027, + /* 630 */ 1864, 1941, 1848, 2007, 2025, 2041, 1854, 2029, 1874, 1878, + /* 640 */ 2053, 2060, 1883, 1879, 1888, 1882, 2059, 2033, 1796, 1962, + /* 650 */ 1963, 1967, 2018, 1971, 2026, 1976, 1972, 2046, 2047, 1977, + /* 660 */ 1984, 1985, 1987, 1982, 2048, 2036, 2037, 1990, 2064, 1829, + /* 670 */ 2001, 2002, 2088, 2072, 1866, 2056, 2074, 2076, 2077, 2097, + /* 680 */ 2099, 2031, 2034, 2089, 1885, 2092, 2090, 2109, 2141, 2039, + /* 690 */ 2100, 2043, 2040, 2044, 2049, 2050, 1973, 2052, 2149, 2111, + /* 700 */ 1992, 2054, 2051, 1847, 2102, 2125, 2057, 1912, 2061, 2160, + /* 710 */ 2144, 1943, 2062, 2065, 2067, 2068, 2070, 2071, 2114, 2075, + /* 720 */ 2078, 2127, 2073, 2164, 1953, 2083, 2079, 2084, 2152, 2154, + /* 730 */ 2087, 2091, 2156, 2094, 2095, 2158, 2098, 2096, 2163, 2101, + /* 740 */ 2104, 2167, 2103, 2105, 2168, 2107, 2081, 2093, 2113, 2120, + /* 750 */ 2108, 2181, 2110, 2179, 2112, 2181, 2181, 2196, 2151, 2150, + /* 760 */ 2188, 2190, 2191, 2211, 2212, 2213, 2215, 2216, 2177, 2157, + /* 770 */ 2222, 2220, 2221, 2224, 2237, 2226, 2234, 2236, 2198, 1959, + /* 780 */ 2239, 1960, 2241, 2243, 2244, 2245, 2252, 2246, 2284, 2248, + /* 790 */ 2235, 2247, 2287, 2253, 2249, 2250, 2294, 2258, 2251, 2254, + /* 800 */ 2297, 2261, 2255, 2257, 2303, 2270, 2271, 2304, 2288, 2276, + /* 810 */ 2289, 2291, 2293, 2296, 2295, 2300, }; -#define YY_REDUCE_COUNT (328) -#define YY_REDUCE_MIN (-452) -#define YY_REDUCE_MAX (2353) +#define YY_REDUCE_COUNT (329) +#define YY_REDUCE_MIN (-463) +#define YY_REDUCE_MAX (2636) static const short yy_reduce_ofst[] = { - /* 0 */ -202, 142, -83, 374, 234, 645, 861, 908, 1027, 1076, - /* 10 */ 697, 1096, 1220, 461, 1252, 1272, 935, 162, -341, 1299, - /* 20 */ 1362, 1378, 1409, 1427, 1514, 1529, 1544, 1591, 1653, 1616, - /* 30 */ 1719, 1740, 1771, 1842, 1858, 1910, 1929, 1962, 1981, 1997, - /* 40 */ 2032, 2049, 2084, 2149, 2164, 2186, 2211, 2273, 2291, 2338, - /* 50 */ 2353, -273, 163, 302, -44, 312, 344, 583, -316, -280, - /* 60 */ 724, -26, -403, 134, 375, -266, -168, -373, -326, -350, - /* 70 */ 46, -324, -346, -133, 145, -80, 146, 299, -297, -180, - /* 80 */ 84, 307, 187, 325, 387, 399, 424, 433, -56, 428, - /* 90 */ 465, 224, 347, 498, 500, 70, 382, 513, 529, 169, - /* 100 */ 594, 603, 440, 625, 273, 490, 606, 631, -308, -249, - /* 110 */ -452, -452, 242, -250, -207, 7, 252, 373, 515, 570, - /* 120 */ 608, 609, 641, 677, 680, 682, 747, 748, 754, 755, - /* 130 */ 785, 787, 802, -288, 45, 168, -388, -327, 92, 258, - /* 140 */ 45, 231, 444, -25, 561, 574, 664, 533, -32, 337, - /* 150 */ 364, 109, 667, 401, 718, 763, 789, 812, 686, 722, - /* 160 */ 453, 502, 843, 846, 873, 875, 882, 873, 852, 904, - /* 170 */ 946, 624, 795, 813, 937, 836, 941, 949, 938, 909, - /* 180 */ 938, 964, 921, 974, 976, 939, 924, 888, 888, 870, - /* 190 */ 888, 899, 898, 938, 965, 959, 995, 997, 1066, 1005, - /* 200 */ 1069, 1017, 1086, 1038, 1039, 1090, 1044, 1048, 1099, 1097, - /* 210 */ 1100, 1054, 1057, 1061, 1095, 1106, 1120, 1121, 1124, 1126, - /* 220 */ 1129, 1148, 1143, 1149, 1150, 1072, 1135, 1103, 1139, 1152, - /* 230 */ 1088, 1155, 1154, 1157, 1114, 1158, 1160, 1171, 1165, 1164, - /* 240 */ 1162, 1170, 1172, 1173, 1174, 1175, 1176, 1178, 1180, 1181, - /* 250 */ 1184, 1187, 1193, 1202, 1196, 1153, 1159, 1179, 1123, 1138, - /* 260 */ 1144, 1205, 1156, 1161, 1185, 1216, 1186, 1163, 1222, 1188, - /* 270 */ 1190, 1197, 1105, 1189, 1201, 1125, 1191, 1207, 1209, 938, - /* 280 */ 1130, 1134, 1132, 1140, 1145, 1167, 1204, 1127, 1136, 1192, - /* 290 */ 888, 1270, 1194, 1168, 1199, 1275, 1271, 1273, 1228, 1238, - /* 300 */ 1244, 1247, 1248, 1250, 1234, 1251, 1246, 1279, 1285, 1289, - /* 310 */ 1307, 1218, 1286, 1284, 1303, 1324, 1320, 1340, 1350, 1352, - /* 320 */ 1268, 1274, 1290, 1305, 1342, 1344, 1346, 1335, 1388, + /* 0 */ -271, -300, 141, -25, 212, 378, 471, 614, 707, 891, + /* 10 */ 1051, 1127, 1156, 1194, 1246, 1284, 1314, 1336, 1409, 1426, + /* 20 */ 1447, 1516, 1540, 1566, 1590, 1656, 1672, 1683, 1786, 1797, + /* 30 */ 1822, 1892, 1918, 1942, 1968, 2032, 2058, 2122, 2174, 2197, + /* 40 */ 2267, 2292, 2342, 2357, 2407, 2432, 2482, 2497, 2562, 2614, + /* 50 */ 2636, -302, 111, -273, -26, 150, 505, 601, 87, 394, + /* 60 */ 608, -374, -463, -221, -77, 615, -461, 534, 112, -358, + /* 70 */ -91, 396, -401, -253, -96, 158, -40, -330, -9, -206, + /* 80 */ -152, 138, 259, 144, 290, 283, 367, 441, 340, 13, + /* 90 */ 449, 451, 245, 107, 479, 509, -193, 349, 521, 542, + /* 100 */ 285, 544, 603, 482, 620, 353, 536, 385, 638, 523, + /* 110 */ -454, -454, -99, -145, -336, -325, -301, 169, 231, 244, + /* 120 */ 342, 437, 444, 466, 467, 564, 645, 673, 675, 679, + /* 130 */ 680, 705, 710, -78, 317, 264, -384, -205, 561, 598, + /* 140 */ 317, 373, 439, 127, 391, 510, 661, 714, 576, 640, + /* 150 */ 713, 93, 17, 715, 718, 717, 725, 747, 755, 734, + /* 160 */ -381, 778, 843, 850, 854, 863, 868, 854, 832, 886, + /* 170 */ 920, 857, 774, 788, 914, 798, 905, 906, 900, 867, + /* 180 */ 900, 927, 879, 939, 938, 903, 890, 833, 833, 818, + /* 190 */ 833, 847, 844, 900, 889, 910, 913, 919, 984, 926, + /* 200 */ 992, 940, 1008, 1009, 961, 962, 1016, 969, 975, 1024, + /* 210 */ 1026, 1031, 976, 978, 981, 1020, 1022, 1036, 1029, 1041, + /* 220 */ 1042, 1043, 1053, 1074, 1055, 1075, 999, 1065, 1034, 1067, + /* 230 */ 1079, 1017, 1076, 1080, 1078, 1039, 1082, 1088, 1086, 1089, + /* 240 */ 1106, 1071, 1072, 1081, 1083, 1084, 1085, 1087, 1090, 1092, + /* 250 */ 1093, 1100, 1102, 1113, 1117, 1110, 1070, 1094, 1105, 1040, + /* 260 */ 1066, 1095, 1138, 1091, 1099, 1108, 1146, 1096, 1107, 1158, + /* 270 */ 1119, 1120, 1118, 1044, 1125, 1147, 1069, 1131, 1151, 1152, + /* 280 */ 900, 1061, 1097, 1111, 1129, 1109, 1132, 1133, 1060, 1114, + /* 290 */ 1122, 833, 1205, 1124, 1115, 1137, 1209, 1218, 1221, 1159, + /* 300 */ 1186, 1198, 1199, 1222, 1223, 1163, 1224, 1203, 1250, 1236, + /* 310 */ 1255, 1265, 1169, 1240, 1228, 1251, 1277, 1271, 1300, 1298, + /* 320 */ 1301, 1227, 1225, 1239, 1243, 1273, 1278, 1281, 1297, 1320, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 10 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 20 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 30 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 40 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 50 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 60 */ 2125, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 70 */ 1807, 1807, 1807, 1807, 2098, 1807, 1807, 1807, 1807, 1807, - /* 80 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 90 */ 1807, 1903, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 100 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1901, 2091, - /* 110 */ 2317, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 120 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 130 */ 1807, 1807, 1807, 1807, 2329, 1807, 1807, 1877, 1877, 1807, - /* 140 */ 2329, 2329, 2329, 1901, 2289, 2289, 1807, 1903, 2159, 1807, - /* 150 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 2023, 1807, 1837, - /* 160 */ 1807, 1807, 1807, 1807, 2047, 1807, 1807, 1807, 2151, 1807, - /* 170 */ 1807, 2358, 2415, 1807, 1807, 2361, 1807, 1807, 1807, 1807, - /* 180 */ 1807, 1807, 2103, 1807, 1807, 1976, 2348, 2321, 2335, 2399, - /* 190 */ 2322, 2319, 2342, 1807, 2352, 1807, 1807, 2173, 1903, 1807, - /* 200 */ 1903, 2138, 1807, 2096, 1807, 1807, 2096, 2093, 1807, 1807, - /* 210 */ 1807, 2096, 2093, 2093, 1965, 1961, 1807, 1959, 1807, 1807, - /* 220 */ 1807, 1807, 1861, 1807, 1861, 1807, 1903, 1807, 1903, 1807, - /* 230 */ 1807, 1903, 1807, 1903, 1807, 1903, 1903, 1807, 1903, 1807, - /* 240 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 250 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 2171, 2157, - /* 260 */ 1807, 1901, 2149, 2147, 1807, 1901, 2145, 2352, 1807, 1807, - /* 270 */ 1807, 1807, 2369, 2367, 1807, 2369, 2367, 1807, 1807, 1807, - /* 280 */ 2383, 2379, 2369, 2388, 2385, 2354, 2352, 2418, 2405, 2401, - /* 290 */ 2335, 1807, 1807, 2340, 2338, 1807, 1901, 1901, 2367, 1807, - /* 300 */ 1807, 1807, 1807, 1807, 2367, 1807, 1807, 1901, 1807, 1901, - /* 310 */ 1807, 1807, 1992, 1807, 1807, 1807, 1901, 1807, 1846, 1807, - /* 320 */ 2140, 2162, 2121, 2121, 2026, 2026, 2026, 1904, 1812, 1807, - /* 330 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 340 */ 1807, 2382, 2381, 2244, 1807, 2293, 2292, 2291, 2282, 2243, - /* 350 */ 1988, 1807, 1807, 2242, 2241, 1807, 1807, 1807, 1807, 1807, - /* 360 */ 1807, 1807, 1807, 2112, 2111, 2235, 1807, 1807, 2236, 2234, - /* 370 */ 2233, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 380 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 390 */ 1807, 1807, 1807, 1807, 1807, 2402, 2406, 1807, 1807, 1807, - /* 400 */ 1807, 1807, 1807, 2318, 1807, 1807, 1807, 2217, 1807, 1807, - /* 410 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 420 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 430 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 440 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 450 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 460 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 470 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 480 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 490 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 500 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 510 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 520 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 530 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 540 */ 1807, 1807, 1851, 2222, 1807, 1807, 1807, 1807, 1807, 1807, - /* 550 */ 1807, 1807, 1807, 1807, 1807, 1807, 2225, 1807, 1807, 1807, - /* 560 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 570 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 580 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 590 */ 1807, 1807, 1807, 1807, 1807, 1807, 1942, 1941, 1807, 1807, - /* 600 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 610 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 620 */ 1807, 1807, 2226, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 630 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 640 */ 1807, 2398, 2355, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 650 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 660 */ 1807, 2217, 1807, 2380, 1807, 1807, 2396, 1807, 2400, 1807, - /* 670 */ 1807, 1807, 1807, 1807, 1807, 1807, 2328, 2324, 1807, 1807, - /* 680 */ 2320, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 690 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 2216, 1807, - /* 700 */ 2279, 1807, 1807, 1807, 2313, 1807, 1807, 2264, 1807, 1807, - /* 710 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 2226, 1807, 2229, - /* 720 */ 1807, 1807, 1807, 1807, 1807, 2020, 1807, 1807, 1807, 1807, - /* 730 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 740 */ 1807, 2004, 2002, 2001, 2000, 1807, 2033, 1807, 1807, 1807, - /* 750 */ 2029, 2028, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 760 */ 1807, 1807, 1807, 1807, 1807, 1922, 1807, 1807, 1807, 1807, - /* 770 */ 1807, 1807, 1807, 1807, 1914, 1807, 1913, 1807, 1807, 1807, - /* 780 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 790 */ 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, 1807, - /* 800 */ 1807, 1807, 1807, 1807, 1836, 1807, 1807, 1807, 1807, 1807, - /* 810 */ 1807, + /* 0 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 10 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 20 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 30 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 40 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 50 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 60 */ 2151, 1824, 1824, 2114, 1824, 1824, 1824, 1824, 1824, 1824, + /* 70 */ 1824, 1824, 1824, 1824, 1824, 2121, 1824, 1824, 1824, 1824, + /* 80 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 90 */ 1824, 1824, 1920, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 100 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1918, + /* 110 */ 2343, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 120 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 130 */ 1824, 1824, 1824, 1824, 2355, 1824, 1824, 1894, 1894, 1824, + /* 140 */ 2355, 2355, 2355, 1918, 2315, 2315, 1824, 1920, 2185, 1824, + /* 150 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 2040, 1824, 1854, + /* 160 */ 1824, 1824, 1824, 1824, 2064, 1824, 1824, 1824, 2177, 1824, + /* 170 */ 1824, 2384, 2441, 1824, 1824, 2387, 1824, 1824, 1824, 1824, + /* 180 */ 1824, 1824, 2126, 1824, 1824, 1993, 2374, 2347, 2361, 2425, + /* 190 */ 2348, 2345, 2368, 1824, 2378, 1824, 1824, 2199, 1920, 1824, + /* 200 */ 1920, 2164, 2109, 1824, 2119, 1824, 1824, 2119, 2116, 1824, + /* 210 */ 1824, 1824, 2119, 2116, 2116, 1982, 1978, 1824, 1976, 1824, + /* 220 */ 1824, 1824, 1824, 1878, 1824, 1878, 1824, 1920, 1824, 1920, + /* 230 */ 1824, 1824, 1920, 1824, 1920, 1824, 1920, 1920, 1824, 1920, + /* 240 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 250 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 2197, + /* 260 */ 2183, 1824, 1918, 2175, 2173, 1824, 1918, 2171, 2378, 1824, + /* 270 */ 1824, 1824, 1824, 2395, 2393, 1824, 2395, 2393, 1824, 1824, + /* 280 */ 1824, 2409, 2405, 2395, 2414, 2411, 2380, 2378, 2444, 2431, + /* 290 */ 2427, 2361, 1824, 1824, 2366, 2364, 1824, 1918, 1918, 2393, + /* 300 */ 1824, 1824, 1824, 1824, 1824, 2393, 1824, 1824, 1918, 1824, + /* 310 */ 1918, 1824, 1824, 2009, 1824, 1824, 1824, 1918, 1824, 1863, + /* 320 */ 1824, 2166, 2188, 2147, 2147, 2043, 2043, 2043, 1921, 1829, + /* 330 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 340 */ 1824, 1824, 2408, 2407, 2270, 1824, 2319, 2318, 2317, 2308, + /* 350 */ 2269, 2005, 1824, 1824, 2268, 2267, 1824, 1824, 1824, 1824, + /* 360 */ 1824, 1824, 1824, 1824, 2138, 2137, 2261, 1824, 1824, 2262, + /* 370 */ 2260, 2259, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 380 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 390 */ 1824, 1824, 1824, 1824, 1824, 1824, 2428, 2432, 1824, 1824, + /* 400 */ 1824, 1824, 1824, 1824, 2344, 1824, 1824, 1824, 2243, 1824, + /* 410 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 420 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 430 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 440 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 450 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 460 */ 2115, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 470 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 480 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 490 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 500 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 510 */ 1824, 1824, 1824, 1824, 1824, 2130, 1824, 1824, 1824, 1824, + /* 520 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 530 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 540 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1868, 2248, 1824, + /* 550 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 560 */ 1824, 2251, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 570 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 580 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 590 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 600 */ 1824, 1959, 1958, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 610 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 620 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 2252, 1824, 1824, + /* 630 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 640 */ 1824, 1824, 1824, 1824, 1824, 1824, 2424, 2381, 1824, 1824, + /* 650 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 660 */ 1824, 1824, 1824, 1824, 1824, 1824, 2243, 1824, 2406, 1824, + /* 670 */ 1824, 2422, 1824, 2426, 1824, 1824, 1824, 1824, 1824, 1824, + /* 680 */ 1824, 2354, 2350, 1824, 1824, 2346, 1824, 1824, 1824, 1824, + /* 690 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 700 */ 1824, 1824, 1824, 2242, 1824, 2305, 1824, 1824, 1824, 2339, + /* 710 */ 1824, 1824, 2290, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 720 */ 1824, 1824, 2252, 1824, 2255, 1824, 1824, 1824, 1824, 1824, + /* 730 */ 2037, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 740 */ 1824, 1824, 1824, 1824, 1824, 1824, 2021, 2019, 2018, 2017, + /* 750 */ 1824, 2050, 1824, 1824, 1824, 2046, 2045, 1824, 1824, 1824, + /* 760 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 770 */ 1939, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1931, + /* 780 */ 1824, 1930, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 790 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + /* 800 */ 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1853, + /* 810 */ 1824, 1824, 1824, 1824, 1824, 1824, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1488,7 +1551,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* BWLIMIT => nothing */ 0, /* START => nothing */ 0, /* TIMESTAMP => nothing */ - 289, /* END => ABORT */ + 292, /* END => ABORT */ 0, /* TABLE => nothing */ 0, /* NK_LP => nothing */ 0, /* NK_RP => nothing */ @@ -1555,10 +1618,13 @@ static const YYCODETYPE yyFallback[] = { 0, /* SUBSCRIPTIONS => nothing */ 0, /* VNODES => nothing */ 0, /* ALIVE => nothing */ + 0, /* NORMAL => nothing */ + 0, /* CHILD => nothing */ 0, /* LIKE => nothing */ 0, /* TBNAME => nothing */ 0, /* QTAGS => nothing */ 0, /* AS => nothing */ + 0, /* SYSTEM => nothing */ 0, /* INDEX => nothing */ 0, /* FUNCTION => nothing */ 0, /* INTERVAL => nothing */ @@ -1675,56 +1741,56 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASC => nothing */ 0, /* NULLS => nothing */ 0, /* ABORT => nothing */ - 289, /* AFTER => ABORT */ - 289, /* ATTACH => ABORT */ - 289, /* BEFORE => ABORT */ - 289, /* BEGIN => ABORT */ - 289, /* BITAND => ABORT */ - 289, /* BITNOT => ABORT */ - 289, /* BITOR => ABORT */ - 289, /* BLOCKS => ABORT */ - 289, /* CHANGE => ABORT */ - 289, /* COMMA => ABORT */ - 289, /* CONCAT => ABORT */ - 289, /* CONFLICT => ABORT */ - 289, /* COPY => ABORT */ - 289, /* DEFERRED => ABORT */ - 289, /* DELIMITERS => ABORT */ - 289, /* DETACH => ABORT */ - 289, /* DIVIDE => ABORT */ - 289, /* DOT => ABORT */ - 289, /* EACH => ABORT */ - 289, /* FAIL => ABORT */ - 289, /* FILE => ABORT */ - 289, /* FOR => ABORT */ - 289, /* GLOB => ABORT */ - 289, /* ID => ABORT */ - 289, /* IMMEDIATE => ABORT */ - 289, /* IMPORT => ABORT */ - 289, /* INITIALLY => ABORT */ - 289, /* INSTEAD => ABORT */ - 289, /* ISNULL => ABORT */ - 289, /* KEY => ABORT */ - 289, /* MODULES => ABORT */ - 289, /* NK_BITNOT => ABORT */ - 289, /* NK_SEMI => ABORT */ - 289, /* NOTNULL => ABORT */ - 289, /* OF => ABORT */ - 289, /* PLUS => ABORT */ - 289, /* PRIVILEGE => ABORT */ - 289, /* RAISE => ABORT */ - 289, /* RESTRICT => ABORT */ - 289, /* ROW => ABORT */ - 289, /* SEMI => ABORT */ - 289, /* STAR => ABORT */ - 289, /* STATEMENT => ABORT */ - 289, /* STRICT => ABORT */ - 289, /* STRING => ABORT */ - 289, /* TIMES => ABORT */ - 289, /* VALUES => ABORT */ - 289, /* VARIABLE => ABORT */ - 289, /* VIEW => ABORT */ - 289, /* WAL => ABORT */ + 292, /* AFTER => ABORT */ + 292, /* ATTACH => ABORT */ + 292, /* BEFORE => ABORT */ + 292, /* BEGIN => ABORT */ + 292, /* BITAND => ABORT */ + 292, /* BITNOT => ABORT */ + 292, /* BITOR => ABORT */ + 292, /* BLOCKS => ABORT */ + 292, /* CHANGE => ABORT */ + 292, /* COMMA => ABORT */ + 292, /* CONCAT => ABORT */ + 292, /* CONFLICT => ABORT */ + 292, /* COPY => ABORT */ + 292, /* DEFERRED => ABORT */ + 292, /* DELIMITERS => ABORT */ + 292, /* DETACH => ABORT */ + 292, /* DIVIDE => ABORT */ + 292, /* DOT => ABORT */ + 292, /* EACH => ABORT */ + 292, /* FAIL => ABORT */ + 292, /* FILE => ABORT */ + 292, /* FOR => ABORT */ + 292, /* GLOB => ABORT */ + 292, /* ID => ABORT */ + 292, /* IMMEDIATE => ABORT */ + 292, /* IMPORT => ABORT */ + 292, /* INITIALLY => ABORT */ + 292, /* INSTEAD => ABORT */ + 292, /* ISNULL => ABORT */ + 292, /* KEY => ABORT */ + 292, /* MODULES => ABORT */ + 292, /* NK_BITNOT => ABORT */ + 292, /* NK_SEMI => ABORT */ + 292, /* NOTNULL => ABORT */ + 292, /* OF => ABORT */ + 292, /* PLUS => ABORT */ + 292, /* PRIVILEGE => ABORT */ + 292, /* RAISE => ABORT */ + 292, /* RESTRICT => ABORT */ + 292, /* ROW => ABORT */ + 292, /* SEMI => ABORT */ + 292, /* STAR => ABORT */ + 292, /* STATEMENT => ABORT */ + 292, /* STRICT => ABORT */ + 292, /* STRING => ABORT */ + 292, /* TIMES => ABORT */ + 292, /* VALUES => ABORT */ + 292, /* VARIABLE => ABORT */ + 292, /* VIEW => ABORT */ + 292, /* WAL => ABORT */ }; #endif /* YYFALLBACK */ @@ -1983,330 +2049,336 @@ static const char *const yyTokenName[] = { /* 167 */ "SUBSCRIPTIONS", /* 168 */ "VNODES", /* 169 */ "ALIVE", - /* 170 */ "LIKE", - /* 171 */ "TBNAME", - /* 172 */ "QTAGS", - /* 173 */ "AS", - /* 174 */ "INDEX", - /* 175 */ "FUNCTION", - /* 176 */ "INTERVAL", - /* 177 */ "COUNT", - /* 178 */ "LAST_ROW", - /* 179 */ "META", - /* 180 */ "ONLY", - /* 181 */ "TOPIC", - /* 182 */ "CONSUMER", - /* 183 */ "GROUP", - /* 184 */ "DESC", - /* 185 */ "DESCRIBE", - /* 186 */ "RESET", - /* 187 */ "QUERY", - /* 188 */ "CACHE", - /* 189 */ "EXPLAIN", - /* 190 */ "ANALYZE", - /* 191 */ "VERBOSE", - /* 192 */ "NK_BOOL", - /* 193 */ "RATIO", - /* 194 */ "NK_FLOAT", - /* 195 */ "OUTPUTTYPE", - /* 196 */ "AGGREGATE", - /* 197 */ "BUFSIZE", - /* 198 */ "LANGUAGE", - /* 199 */ "REPLACE", - /* 200 */ "STREAM", - /* 201 */ "INTO", - /* 202 */ "PAUSE", - /* 203 */ "RESUME", - /* 204 */ "TRIGGER", - /* 205 */ "AT_ONCE", - /* 206 */ "WINDOW_CLOSE", - /* 207 */ "IGNORE", - /* 208 */ "EXPIRED", - /* 209 */ "FILL_HISTORY", - /* 210 */ "UPDATE", - /* 211 */ "SUBTABLE", - /* 212 */ "UNTREATED", - /* 213 */ "KILL", - /* 214 */ "CONNECTION", - /* 215 */ "TRANSACTION", - /* 216 */ "BALANCE", - /* 217 */ "VGROUP", - /* 218 */ "LEADER", - /* 219 */ "MERGE", - /* 220 */ "REDISTRIBUTE", - /* 221 */ "SPLIT", - /* 222 */ "DELETE", - /* 223 */ "INSERT", - /* 224 */ "NULL", - /* 225 */ "NK_QUESTION", - /* 226 */ "NK_ARROW", - /* 227 */ "ROWTS", - /* 228 */ "QSTART", - /* 229 */ "QEND", - /* 230 */ "QDURATION", - /* 231 */ "WSTART", - /* 232 */ "WEND", - /* 233 */ "WDURATION", - /* 234 */ "IROWTS", - /* 235 */ "ISFILLED", - /* 236 */ "CAST", - /* 237 */ "NOW", - /* 238 */ "TODAY", - /* 239 */ "TIMEZONE", - /* 240 */ "CLIENT_VERSION", - /* 241 */ "SERVER_VERSION", - /* 242 */ "SERVER_STATUS", - /* 243 */ "CURRENT_USER", - /* 244 */ "CASE", - /* 245 */ "WHEN", - /* 246 */ "THEN", - /* 247 */ "ELSE", - /* 248 */ "BETWEEN", - /* 249 */ "IS", - /* 250 */ "NK_LT", - /* 251 */ "NK_GT", - /* 252 */ "NK_LE", - /* 253 */ "NK_GE", - /* 254 */ "NK_NE", - /* 255 */ "MATCH", - /* 256 */ "NMATCH", - /* 257 */ "CONTAINS", - /* 258 */ "IN", - /* 259 */ "JOIN", - /* 260 */ "INNER", - /* 261 */ "SELECT", - /* 262 */ "NK_HINT", - /* 263 */ "DISTINCT", - /* 264 */ "WHERE", - /* 265 */ "PARTITION", - /* 266 */ "BY", - /* 267 */ "SESSION", - /* 268 */ "STATE_WINDOW", - /* 269 */ "EVENT_WINDOW", - /* 270 */ "SLIDING", - /* 271 */ "FILL", - /* 272 */ "VALUE", - /* 273 */ "VALUE_F", - /* 274 */ "NONE", - /* 275 */ "PREV", - /* 276 */ "NULL_F", - /* 277 */ "LINEAR", - /* 278 */ "NEXT", - /* 279 */ "HAVING", - /* 280 */ "RANGE", - /* 281 */ "EVERY", - /* 282 */ "ORDER", - /* 283 */ "SLIMIT", - /* 284 */ "SOFFSET", - /* 285 */ "LIMIT", - /* 286 */ "OFFSET", - /* 287 */ "ASC", - /* 288 */ "NULLS", - /* 289 */ "ABORT", - /* 290 */ "AFTER", - /* 291 */ "ATTACH", - /* 292 */ "BEFORE", - /* 293 */ "BEGIN", - /* 294 */ "BITAND", - /* 295 */ "BITNOT", - /* 296 */ "BITOR", - /* 297 */ "BLOCKS", - /* 298 */ "CHANGE", - /* 299 */ "COMMA", - /* 300 */ "CONCAT", - /* 301 */ "CONFLICT", - /* 302 */ "COPY", - /* 303 */ "DEFERRED", - /* 304 */ "DELIMITERS", - /* 305 */ "DETACH", - /* 306 */ "DIVIDE", - /* 307 */ "DOT", - /* 308 */ "EACH", - /* 309 */ "FAIL", - /* 310 */ "FILE", - /* 311 */ "FOR", - /* 312 */ "GLOB", - /* 313 */ "ID", - /* 314 */ "IMMEDIATE", - /* 315 */ "IMPORT", - /* 316 */ "INITIALLY", - /* 317 */ "INSTEAD", - /* 318 */ "ISNULL", - /* 319 */ "KEY", - /* 320 */ "MODULES", - /* 321 */ "NK_BITNOT", - /* 322 */ "NK_SEMI", - /* 323 */ "NOTNULL", - /* 324 */ "OF", - /* 325 */ "PLUS", - /* 326 */ "PRIVILEGE", - /* 327 */ "RAISE", - /* 328 */ "RESTRICT", - /* 329 */ "ROW", - /* 330 */ "SEMI", - /* 331 */ "STAR", - /* 332 */ "STATEMENT", - /* 333 */ "STRICT", - /* 334 */ "STRING", - /* 335 */ "TIMES", - /* 336 */ "VALUES", - /* 337 */ "VARIABLE", - /* 338 */ "VIEW", - /* 339 */ "WAL", - /* 340 */ "cmd", - /* 341 */ "account_options", - /* 342 */ "alter_account_options", - /* 343 */ "literal", - /* 344 */ "alter_account_option", - /* 345 */ "ip_range_list", - /* 346 */ "white_list", - /* 347 */ "white_list_opt", - /* 348 */ "user_name", - /* 349 */ "sysinfo_opt", - /* 350 */ "privileges", - /* 351 */ "priv_level", - /* 352 */ "with_opt", - /* 353 */ "priv_type_list", - /* 354 */ "priv_type", - /* 355 */ "db_name", - /* 356 */ "table_name", - /* 357 */ "topic_name", - /* 358 */ "search_condition", - /* 359 */ "dnode_endpoint", - /* 360 */ "force_opt", - /* 361 */ "unsafe_opt", - /* 362 */ "not_exists_opt", - /* 363 */ "db_options", - /* 364 */ "exists_opt", - /* 365 */ "alter_db_options", - /* 366 */ "speed_opt", - /* 367 */ "start_opt", - /* 368 */ "end_opt", - /* 369 */ "integer_list", - /* 370 */ "variable_list", - /* 371 */ "retention_list", - /* 372 */ "signed", - /* 373 */ "alter_db_option", - /* 374 */ "retention", - /* 375 */ "full_table_name", - /* 376 */ "column_def_list", - /* 377 */ "tags_def_opt", - /* 378 */ "table_options", - /* 379 */ "multi_create_clause", - /* 380 */ "tags_def", - /* 381 */ "multi_drop_clause", - /* 382 */ "alter_table_clause", - /* 383 */ "alter_table_options", - /* 384 */ "column_name", - /* 385 */ "type_name", - /* 386 */ "signed_literal", - /* 387 */ "create_subtable_clause", - /* 388 */ "specific_cols_opt", - /* 389 */ "expression_list", - /* 390 */ "drop_table_clause", - /* 391 */ "col_name_list", - /* 392 */ "column_def", - /* 393 */ "duration_list", - /* 394 */ "rollup_func_list", - /* 395 */ "alter_table_option", - /* 396 */ "duration_literal", - /* 397 */ "rollup_func_name", - /* 398 */ "function_name", - /* 399 */ "col_name", - /* 400 */ "db_name_cond_opt", - /* 401 */ "like_pattern_opt", - /* 402 */ "table_name_cond", - /* 403 */ "from_db_opt", - /* 404 */ "tag_list_opt", - /* 405 */ "tag_item", - /* 406 */ "column_alias", - /* 407 */ "index_options", - /* 408 */ "full_index_name", - /* 409 */ "index_name", - /* 410 */ "func_list", - /* 411 */ "sliding_opt", - /* 412 */ "sma_stream_opt", - /* 413 */ "func", - /* 414 */ "sma_func_name", - /* 415 */ "with_meta", - /* 416 */ "query_or_subquery", - /* 417 */ "where_clause_opt", - /* 418 */ "cgroup_name", - /* 419 */ "analyze_opt", - /* 420 */ "explain_options", - /* 421 */ "insert_query", - /* 422 */ "or_replace_opt", - /* 423 */ "agg_func_opt", - /* 424 */ "bufsize_opt", - /* 425 */ "language_opt", - /* 426 */ "stream_name", - /* 427 */ "stream_options", - /* 428 */ "col_list_opt", - /* 429 */ "tag_def_or_ref_opt", - /* 430 */ "subtable_opt", - /* 431 */ "ignore_opt", - /* 432 */ "expression", - /* 433 */ "dnode_list", - /* 434 */ "literal_func", - /* 435 */ "literal_list", - /* 436 */ "table_alias", - /* 437 */ "expr_or_subquery", - /* 438 */ "pseudo_column", - /* 439 */ "column_reference", - /* 440 */ "function_expression", - /* 441 */ "case_when_expression", - /* 442 */ "star_func", - /* 443 */ "star_func_para_list", - /* 444 */ "noarg_func", - /* 445 */ "other_para_list", - /* 446 */ "star_func_para", - /* 447 */ "when_then_list", - /* 448 */ "case_when_else_opt", - /* 449 */ "common_expression", - /* 450 */ "when_then_expr", - /* 451 */ "predicate", - /* 452 */ "compare_op", - /* 453 */ "in_op", - /* 454 */ "in_predicate_value", - /* 455 */ "boolean_value_expression", - /* 456 */ "boolean_primary", - /* 457 */ "from_clause_opt", - /* 458 */ "table_reference_list", - /* 459 */ "table_reference", - /* 460 */ "table_primary", - /* 461 */ "joined_table", - /* 462 */ "alias_opt", - /* 463 */ "subquery", - /* 464 */ "parenthesized_joined_table", - /* 465 */ "join_type", - /* 466 */ "query_specification", - /* 467 */ "hint_list", - /* 468 */ "set_quantifier_opt", - /* 469 */ "tag_mode_opt", - /* 470 */ "select_list", - /* 471 */ "partition_by_clause_opt", - /* 472 */ "range_opt", - /* 473 */ "every_opt", - /* 474 */ "fill_opt", - /* 475 */ "twindow_clause_opt", - /* 476 */ "group_by_clause_opt", - /* 477 */ "having_clause_opt", - /* 478 */ "select_item", - /* 479 */ "partition_list", - /* 480 */ "partition_item", - /* 481 */ "fill_mode", - /* 482 */ "group_by_list", - /* 483 */ "query_expression", - /* 484 */ "query_simple", - /* 485 */ "order_by_clause_opt", - /* 486 */ "slimit_clause_opt", - /* 487 */ "limit_clause_opt", - /* 488 */ "union_query_expression", - /* 489 */ "query_simple_or_subquery", - /* 490 */ "sort_specification_list", - /* 491 */ "sort_specification", - /* 492 */ "ordering_specification_opt", - /* 493 */ "null_ordering_opt", + /* 170 */ "NORMAL", + /* 171 */ "CHILD", + /* 172 */ "LIKE", + /* 173 */ "TBNAME", + /* 174 */ "QTAGS", + /* 175 */ "AS", + /* 176 */ "SYSTEM", + /* 177 */ "INDEX", + /* 178 */ "FUNCTION", + /* 179 */ "INTERVAL", + /* 180 */ "COUNT", + /* 181 */ "LAST_ROW", + /* 182 */ "META", + /* 183 */ "ONLY", + /* 184 */ "TOPIC", + /* 185 */ "CONSUMER", + /* 186 */ "GROUP", + /* 187 */ "DESC", + /* 188 */ "DESCRIBE", + /* 189 */ "RESET", + /* 190 */ "QUERY", + /* 191 */ "CACHE", + /* 192 */ "EXPLAIN", + /* 193 */ "ANALYZE", + /* 194 */ "VERBOSE", + /* 195 */ "NK_BOOL", + /* 196 */ "RATIO", + /* 197 */ "NK_FLOAT", + /* 198 */ "OUTPUTTYPE", + /* 199 */ "AGGREGATE", + /* 200 */ "BUFSIZE", + /* 201 */ "LANGUAGE", + /* 202 */ "REPLACE", + /* 203 */ "STREAM", + /* 204 */ "INTO", + /* 205 */ "PAUSE", + /* 206 */ "RESUME", + /* 207 */ "TRIGGER", + /* 208 */ "AT_ONCE", + /* 209 */ "WINDOW_CLOSE", + /* 210 */ "IGNORE", + /* 211 */ "EXPIRED", + /* 212 */ "FILL_HISTORY", + /* 213 */ "UPDATE", + /* 214 */ "SUBTABLE", + /* 215 */ "UNTREATED", + /* 216 */ "KILL", + /* 217 */ "CONNECTION", + /* 218 */ "TRANSACTION", + /* 219 */ "BALANCE", + /* 220 */ "VGROUP", + /* 221 */ "LEADER", + /* 222 */ "MERGE", + /* 223 */ "REDISTRIBUTE", + /* 224 */ "SPLIT", + /* 225 */ "DELETE", + /* 226 */ "INSERT", + /* 227 */ "NULL", + /* 228 */ "NK_QUESTION", + /* 229 */ "NK_ARROW", + /* 230 */ "ROWTS", + /* 231 */ "QSTART", + /* 232 */ "QEND", + /* 233 */ "QDURATION", + /* 234 */ "WSTART", + /* 235 */ "WEND", + /* 236 */ "WDURATION", + /* 237 */ "IROWTS", + /* 238 */ "ISFILLED", + /* 239 */ "CAST", + /* 240 */ "NOW", + /* 241 */ "TODAY", + /* 242 */ "TIMEZONE", + /* 243 */ "CLIENT_VERSION", + /* 244 */ "SERVER_VERSION", + /* 245 */ "SERVER_STATUS", + /* 246 */ "CURRENT_USER", + /* 247 */ "CASE", + /* 248 */ "WHEN", + /* 249 */ "THEN", + /* 250 */ "ELSE", + /* 251 */ "BETWEEN", + /* 252 */ "IS", + /* 253 */ "NK_LT", + /* 254 */ "NK_GT", + /* 255 */ "NK_LE", + /* 256 */ "NK_GE", + /* 257 */ "NK_NE", + /* 258 */ "MATCH", + /* 259 */ "NMATCH", + /* 260 */ "CONTAINS", + /* 261 */ "IN", + /* 262 */ "JOIN", + /* 263 */ "INNER", + /* 264 */ "SELECT", + /* 265 */ "NK_HINT", + /* 266 */ "DISTINCT", + /* 267 */ "WHERE", + /* 268 */ "PARTITION", + /* 269 */ "BY", + /* 270 */ "SESSION", + /* 271 */ "STATE_WINDOW", + /* 272 */ "EVENT_WINDOW", + /* 273 */ "SLIDING", + /* 274 */ "FILL", + /* 275 */ "VALUE", + /* 276 */ "VALUE_F", + /* 277 */ "NONE", + /* 278 */ "PREV", + /* 279 */ "NULL_F", + /* 280 */ "LINEAR", + /* 281 */ "NEXT", + /* 282 */ "HAVING", + /* 283 */ "RANGE", + /* 284 */ "EVERY", + /* 285 */ "ORDER", + /* 286 */ "SLIMIT", + /* 287 */ "SOFFSET", + /* 288 */ "LIMIT", + /* 289 */ "OFFSET", + /* 290 */ "ASC", + /* 291 */ "NULLS", + /* 292 */ "ABORT", + /* 293 */ "AFTER", + /* 294 */ "ATTACH", + /* 295 */ "BEFORE", + /* 296 */ "BEGIN", + /* 297 */ "BITAND", + /* 298 */ "BITNOT", + /* 299 */ "BITOR", + /* 300 */ "BLOCKS", + /* 301 */ "CHANGE", + /* 302 */ "COMMA", + /* 303 */ "CONCAT", + /* 304 */ "CONFLICT", + /* 305 */ "COPY", + /* 306 */ "DEFERRED", + /* 307 */ "DELIMITERS", + /* 308 */ "DETACH", + /* 309 */ "DIVIDE", + /* 310 */ "DOT", + /* 311 */ "EACH", + /* 312 */ "FAIL", + /* 313 */ "FILE", + /* 314 */ "FOR", + /* 315 */ "GLOB", + /* 316 */ "ID", + /* 317 */ "IMMEDIATE", + /* 318 */ "IMPORT", + /* 319 */ "INITIALLY", + /* 320 */ "INSTEAD", + /* 321 */ "ISNULL", + /* 322 */ "KEY", + /* 323 */ "MODULES", + /* 324 */ "NK_BITNOT", + /* 325 */ "NK_SEMI", + /* 326 */ "NOTNULL", + /* 327 */ "OF", + /* 328 */ "PLUS", + /* 329 */ "PRIVILEGE", + /* 330 */ "RAISE", + /* 331 */ "RESTRICT", + /* 332 */ "ROW", + /* 333 */ "SEMI", + /* 334 */ "STAR", + /* 335 */ "STATEMENT", + /* 336 */ "STRICT", + /* 337 */ "STRING", + /* 338 */ "TIMES", + /* 339 */ "VALUES", + /* 340 */ "VARIABLE", + /* 341 */ "VIEW", + /* 342 */ "WAL", + /* 343 */ "cmd", + /* 344 */ "account_options", + /* 345 */ "alter_account_options", + /* 346 */ "literal", + /* 347 */ "alter_account_option", + /* 348 */ "ip_range_list", + /* 349 */ "white_list", + /* 350 */ "white_list_opt", + /* 351 */ "user_name", + /* 352 */ "sysinfo_opt", + /* 353 */ "privileges", + /* 354 */ "priv_level", + /* 355 */ "with_opt", + /* 356 */ "priv_type_list", + /* 357 */ "priv_type", + /* 358 */ "db_name", + /* 359 */ "table_name", + /* 360 */ "topic_name", + /* 361 */ "search_condition", + /* 362 */ "dnode_endpoint", + /* 363 */ "force_opt", + /* 364 */ "unsafe_opt", + /* 365 */ "not_exists_opt", + /* 366 */ "db_options", + /* 367 */ "exists_opt", + /* 368 */ "alter_db_options", + /* 369 */ "speed_opt", + /* 370 */ "start_opt", + /* 371 */ "end_opt", + /* 372 */ "integer_list", + /* 373 */ "variable_list", + /* 374 */ "retention_list", + /* 375 */ "signed", + /* 376 */ "alter_db_option", + /* 377 */ "retention", + /* 378 */ "full_table_name", + /* 379 */ "column_def_list", + /* 380 */ "tags_def_opt", + /* 381 */ "table_options", + /* 382 */ "multi_create_clause", + /* 383 */ "tags_def", + /* 384 */ "multi_drop_clause", + /* 385 */ "alter_table_clause", + /* 386 */ "alter_table_options", + /* 387 */ "column_name", + /* 388 */ "type_name", + /* 389 */ "signed_literal", + /* 390 */ "create_subtable_clause", + /* 391 */ "specific_cols_opt", + /* 392 */ "expression_list", + /* 393 */ "drop_table_clause", + /* 394 */ "col_name_list", + /* 395 */ "column_def", + /* 396 */ "duration_list", + /* 397 */ "rollup_func_list", + /* 398 */ "alter_table_option", + /* 399 */ "duration_literal", + /* 400 */ "rollup_func_name", + /* 401 */ "function_name", + /* 402 */ "col_name", + /* 403 */ "db_kind_opt", + /* 404 */ "table_kind_db_name_cond_opt", + /* 405 */ "like_pattern_opt", + /* 406 */ "db_name_cond_opt", + /* 407 */ "table_name_cond", + /* 408 */ "from_db_opt", + /* 409 */ "tag_list_opt", + /* 410 */ "table_kind", + /* 411 */ "tag_item", + /* 412 */ "column_alias", + /* 413 */ "index_options", + /* 414 */ "full_index_name", + /* 415 */ "index_name", + /* 416 */ "func_list", + /* 417 */ "sliding_opt", + /* 418 */ "sma_stream_opt", + /* 419 */ "func", + /* 420 */ "sma_func_name", + /* 421 */ "with_meta", + /* 422 */ "query_or_subquery", + /* 423 */ "where_clause_opt", + /* 424 */ "cgroup_name", + /* 425 */ "analyze_opt", + /* 426 */ "explain_options", + /* 427 */ "insert_query", + /* 428 */ "or_replace_opt", + /* 429 */ "agg_func_opt", + /* 430 */ "bufsize_opt", + /* 431 */ "language_opt", + /* 432 */ "stream_name", + /* 433 */ "stream_options", + /* 434 */ "col_list_opt", + /* 435 */ "tag_def_or_ref_opt", + /* 436 */ "subtable_opt", + /* 437 */ "ignore_opt", + /* 438 */ "expression", + /* 439 */ "dnode_list", + /* 440 */ "literal_func", + /* 441 */ "literal_list", + /* 442 */ "table_alias", + /* 443 */ "expr_or_subquery", + /* 444 */ "pseudo_column", + /* 445 */ "column_reference", + /* 446 */ "function_expression", + /* 447 */ "case_when_expression", + /* 448 */ "star_func", + /* 449 */ "star_func_para_list", + /* 450 */ "noarg_func", + /* 451 */ "other_para_list", + /* 452 */ "star_func_para", + /* 453 */ "when_then_list", + /* 454 */ "case_when_else_opt", + /* 455 */ "common_expression", + /* 456 */ "when_then_expr", + /* 457 */ "predicate", + /* 458 */ "compare_op", + /* 459 */ "in_op", + /* 460 */ "in_predicate_value", + /* 461 */ "boolean_value_expression", + /* 462 */ "boolean_primary", + /* 463 */ "from_clause_opt", + /* 464 */ "table_reference_list", + /* 465 */ "table_reference", + /* 466 */ "table_primary", + /* 467 */ "joined_table", + /* 468 */ "alias_opt", + /* 469 */ "subquery", + /* 470 */ "parenthesized_joined_table", + /* 471 */ "join_type", + /* 472 */ "query_specification", + /* 473 */ "hint_list", + /* 474 */ "set_quantifier_opt", + /* 475 */ "tag_mode_opt", + /* 476 */ "select_list", + /* 477 */ "partition_by_clause_opt", + /* 478 */ "range_opt", + /* 479 */ "every_opt", + /* 480 */ "fill_opt", + /* 481 */ "twindow_clause_opt", + /* 482 */ "group_by_clause_opt", + /* 483 */ "having_clause_opt", + /* 484 */ "select_item", + /* 485 */ "partition_list", + /* 486 */ "partition_item", + /* 487 */ "fill_mode", + /* 488 */ "group_by_list", + /* 489 */ "query_expression", + /* 490 */ "query_simple", + /* 491 */ "order_by_clause_opt", + /* 492 */ "slimit_clause_opt", + /* 493 */ "limit_clause_opt", + /* 494 */ "union_query_expression", + /* 495 */ "query_simple_or_subquery", + /* 496 */ "sort_specification_list", + /* 497 */ "sort_specification", + /* 498 */ "ordering_specification_opt", + /* 499 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -2555,8 +2627,8 @@ static const char *const yyRuleName[] = { /* 238 */ "cmd ::= SHOW DNODES", /* 239 */ "cmd ::= SHOW USERS", /* 240 */ "cmd ::= SHOW USER PRIVILEGES", - /* 241 */ "cmd ::= SHOW DATABASES", - /* 242 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", + /* 241 */ "cmd ::= SHOW db_kind_opt DATABASES", + /* 242 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt", /* 243 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", /* 244 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", /* 245 */ "cmd ::= SHOW MNODES", @@ -2595,336 +2667,345 @@ static const char *const yyRuleName[] = { /* 278 */ "cmd ::= SHOW VNODES", /* 279 */ "cmd ::= SHOW db_name_cond_opt ALIVE", /* 280 */ "cmd ::= SHOW CLUSTER ALIVE", - /* 281 */ "db_name_cond_opt ::=", - /* 282 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 283 */ "like_pattern_opt ::=", - /* 284 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 285 */ "table_name_cond ::= table_name", - /* 286 */ "from_db_opt ::=", - /* 287 */ "from_db_opt ::= FROM db_name", - /* 288 */ "tag_list_opt ::=", - /* 289 */ "tag_list_opt ::= tag_item", - /* 290 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", - /* 291 */ "tag_item ::= TBNAME", - /* 292 */ "tag_item ::= QTAGS", - /* 293 */ "tag_item ::= column_name", - /* 294 */ "tag_item ::= column_name column_alias", - /* 295 */ "tag_item ::= column_name AS column_alias", - /* 296 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options", - /* 297 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP", - /* 298 */ "cmd ::= DROP INDEX exists_opt full_index_name", - /* 299 */ "full_index_name ::= index_name", - /* 300 */ "full_index_name ::= db_name NK_DOT index_name", - /* 301 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 302 */ "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", - /* 303 */ "func_list ::= func", - /* 304 */ "func_list ::= func_list NK_COMMA func", - /* 305 */ "func ::= sma_func_name NK_LP expression_list NK_RP", - /* 306 */ "sma_func_name ::= function_name", - /* 307 */ "sma_func_name ::= COUNT", - /* 308 */ "sma_func_name ::= FIRST", - /* 309 */ "sma_func_name ::= LAST", - /* 310 */ "sma_func_name ::= LAST_ROW", - /* 311 */ "sma_stream_opt ::=", - /* 312 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", - /* 313 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", - /* 314 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", - /* 315 */ "with_meta ::= AS", - /* 316 */ "with_meta ::= WITH META AS", - /* 317 */ "with_meta ::= ONLY META AS", - /* 318 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 319 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", - /* 320 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", - /* 321 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 322 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 323 */ "cmd ::= DESC full_table_name", - /* 324 */ "cmd ::= DESCRIBE full_table_name", - /* 325 */ "cmd ::= RESET QUERY CACHE", - /* 326 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 327 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", - /* 328 */ "analyze_opt ::=", - /* 329 */ "analyze_opt ::= ANALYZE", - /* 330 */ "explain_options ::=", - /* 331 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 332 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 333 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", - /* 334 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 335 */ "agg_func_opt ::=", - /* 336 */ "agg_func_opt ::= AGGREGATE", - /* 337 */ "bufsize_opt ::=", - /* 338 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 339 */ "language_opt ::=", - /* 340 */ "language_opt ::= LANGUAGE NK_STRING", - /* 341 */ "or_replace_opt ::=", - /* 342 */ "or_replace_opt ::= OR REPLACE", - /* 343 */ "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", - /* 344 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 345 */ "cmd ::= PAUSE STREAM exists_opt stream_name", - /* 346 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", - /* 347 */ "col_list_opt ::=", - /* 348 */ "col_list_opt ::= NK_LP col_name_list NK_RP", - /* 349 */ "tag_def_or_ref_opt ::=", - /* 350 */ "tag_def_or_ref_opt ::= tags_def", - /* 351 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", - /* 352 */ "stream_options ::=", - /* 353 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 354 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 355 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 356 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 357 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 358 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 359 */ "stream_options ::= stream_options DELETE_MARK duration_literal", - /* 360 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", - /* 361 */ "subtable_opt ::=", - /* 362 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 363 */ "ignore_opt ::=", - /* 364 */ "ignore_opt ::= IGNORE UNTREATED", - /* 365 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 366 */ "cmd ::= KILL QUERY NK_STRING", - /* 367 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 368 */ "cmd ::= BALANCE VGROUP", - /* 369 */ "cmd ::= BALANCE VGROUP LEADER", - /* 370 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 371 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 372 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 373 */ "dnode_list ::= DNODE NK_INTEGER", - /* 374 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 375 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 376 */ "cmd ::= query_or_subquery", - /* 377 */ "cmd ::= insert_query", - /* 378 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 379 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 380 */ "literal ::= NK_INTEGER", - /* 381 */ "literal ::= NK_FLOAT", - /* 382 */ "literal ::= NK_STRING", - /* 383 */ "literal ::= NK_BOOL", - /* 384 */ "literal ::= TIMESTAMP NK_STRING", - /* 385 */ "literal ::= duration_literal", - /* 386 */ "literal ::= NULL", - /* 387 */ "literal ::= NK_QUESTION", - /* 388 */ "duration_literal ::= NK_VARIABLE", - /* 389 */ "signed ::= NK_INTEGER", - /* 390 */ "signed ::= NK_PLUS NK_INTEGER", - /* 391 */ "signed ::= NK_MINUS NK_INTEGER", - /* 392 */ "signed ::= NK_FLOAT", - /* 393 */ "signed ::= NK_PLUS NK_FLOAT", - /* 394 */ "signed ::= NK_MINUS NK_FLOAT", - /* 395 */ "signed_literal ::= signed", - /* 396 */ "signed_literal ::= NK_STRING", - /* 397 */ "signed_literal ::= NK_BOOL", - /* 398 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 399 */ "signed_literal ::= duration_literal", - /* 400 */ "signed_literal ::= NULL", - /* 401 */ "signed_literal ::= literal_func", - /* 402 */ "signed_literal ::= NK_QUESTION", - /* 403 */ "literal_list ::= signed_literal", - /* 404 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 405 */ "db_name ::= NK_ID", - /* 406 */ "table_name ::= NK_ID", - /* 407 */ "column_name ::= NK_ID", - /* 408 */ "function_name ::= NK_ID", - /* 409 */ "table_alias ::= NK_ID", - /* 410 */ "column_alias ::= NK_ID", - /* 411 */ "user_name ::= NK_ID", - /* 412 */ "topic_name ::= NK_ID", - /* 413 */ "stream_name ::= NK_ID", - /* 414 */ "cgroup_name ::= NK_ID", - /* 415 */ "index_name ::= NK_ID", - /* 416 */ "expr_or_subquery ::= expression", - /* 417 */ "expression ::= literal", - /* 418 */ "expression ::= pseudo_column", - /* 419 */ "expression ::= column_reference", - /* 420 */ "expression ::= function_expression", - /* 421 */ "expression ::= case_when_expression", - /* 422 */ "expression ::= NK_LP expression NK_RP", - /* 423 */ "expression ::= NK_PLUS expr_or_subquery", - /* 424 */ "expression ::= NK_MINUS expr_or_subquery", - /* 425 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 426 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 427 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 428 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 429 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 430 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 431 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 432 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 433 */ "expression_list ::= expr_or_subquery", - /* 434 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 435 */ "column_reference ::= column_name", - /* 436 */ "column_reference ::= table_name NK_DOT column_name", - /* 437 */ "pseudo_column ::= ROWTS", - /* 438 */ "pseudo_column ::= TBNAME", - /* 439 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 440 */ "pseudo_column ::= QSTART", - /* 441 */ "pseudo_column ::= QEND", - /* 442 */ "pseudo_column ::= QDURATION", - /* 443 */ "pseudo_column ::= WSTART", - /* 444 */ "pseudo_column ::= WEND", - /* 445 */ "pseudo_column ::= WDURATION", - /* 446 */ "pseudo_column ::= IROWTS", - /* 447 */ "pseudo_column ::= ISFILLED", - /* 448 */ "pseudo_column ::= QTAGS", - /* 449 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 450 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 451 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 452 */ "function_expression ::= literal_func", - /* 453 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 454 */ "literal_func ::= NOW", - /* 455 */ "noarg_func ::= NOW", - /* 456 */ "noarg_func ::= TODAY", - /* 457 */ "noarg_func ::= TIMEZONE", - /* 458 */ "noarg_func ::= DATABASE", - /* 459 */ "noarg_func ::= CLIENT_VERSION", - /* 460 */ "noarg_func ::= SERVER_VERSION", - /* 461 */ "noarg_func ::= SERVER_STATUS", - /* 462 */ "noarg_func ::= CURRENT_USER", - /* 463 */ "noarg_func ::= USER", - /* 464 */ "star_func ::= COUNT", - /* 465 */ "star_func ::= FIRST", - /* 466 */ "star_func ::= LAST", - /* 467 */ "star_func ::= LAST_ROW", - /* 468 */ "star_func_para_list ::= NK_STAR", - /* 469 */ "star_func_para_list ::= other_para_list", - /* 470 */ "other_para_list ::= star_func_para", - /* 471 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 472 */ "star_func_para ::= expr_or_subquery", - /* 473 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 474 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 475 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 476 */ "when_then_list ::= when_then_expr", - /* 477 */ "when_then_list ::= when_then_list when_then_expr", - /* 478 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 479 */ "case_when_else_opt ::=", - /* 480 */ "case_when_else_opt ::= ELSE common_expression", - /* 481 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 482 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 483 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 484 */ "predicate ::= expr_or_subquery IS NULL", - /* 485 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 486 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 487 */ "compare_op ::= NK_LT", - /* 488 */ "compare_op ::= NK_GT", - /* 489 */ "compare_op ::= NK_LE", - /* 490 */ "compare_op ::= NK_GE", - /* 491 */ "compare_op ::= NK_NE", - /* 492 */ "compare_op ::= NK_EQ", - /* 493 */ "compare_op ::= LIKE", - /* 494 */ "compare_op ::= NOT LIKE", - /* 495 */ "compare_op ::= MATCH", - /* 496 */ "compare_op ::= NMATCH", - /* 497 */ "compare_op ::= CONTAINS", - /* 498 */ "in_op ::= IN", - /* 499 */ "in_op ::= NOT IN", - /* 500 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 501 */ "boolean_value_expression ::= boolean_primary", - /* 502 */ "boolean_value_expression ::= NOT boolean_primary", - /* 503 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 504 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 505 */ "boolean_primary ::= predicate", - /* 506 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 507 */ "common_expression ::= expr_or_subquery", - /* 508 */ "common_expression ::= boolean_value_expression", - /* 509 */ "from_clause_opt ::=", - /* 510 */ "from_clause_opt ::= FROM table_reference_list", - /* 511 */ "table_reference_list ::= table_reference", - /* 512 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 513 */ "table_reference ::= table_primary", - /* 514 */ "table_reference ::= joined_table", - /* 515 */ "table_primary ::= table_name alias_opt", - /* 516 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 517 */ "table_primary ::= subquery alias_opt", - /* 518 */ "table_primary ::= parenthesized_joined_table", - /* 519 */ "alias_opt ::=", - /* 520 */ "alias_opt ::= table_alias", - /* 521 */ "alias_opt ::= AS table_alias", - /* 522 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 523 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 524 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 525 */ "join_type ::=", - /* 526 */ "join_type ::= INNER", - /* 527 */ "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", - /* 528 */ "hint_list ::=", - /* 529 */ "hint_list ::= NK_HINT", - /* 530 */ "tag_mode_opt ::=", - /* 531 */ "tag_mode_opt ::= TAGS", - /* 532 */ "set_quantifier_opt ::=", - /* 533 */ "set_quantifier_opt ::= DISTINCT", - /* 534 */ "set_quantifier_opt ::= ALL", - /* 535 */ "select_list ::= select_item", - /* 536 */ "select_list ::= select_list NK_COMMA select_item", - /* 537 */ "select_item ::= NK_STAR", - /* 538 */ "select_item ::= common_expression", - /* 539 */ "select_item ::= common_expression column_alias", - /* 540 */ "select_item ::= common_expression AS column_alias", - /* 541 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 542 */ "where_clause_opt ::=", - /* 543 */ "where_clause_opt ::= WHERE search_condition", - /* 544 */ "partition_by_clause_opt ::=", - /* 545 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 546 */ "partition_list ::= partition_item", - /* 547 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 548 */ "partition_item ::= expr_or_subquery", - /* 549 */ "partition_item ::= expr_or_subquery column_alias", - /* 550 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 551 */ "twindow_clause_opt ::=", - /* 552 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 553 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 554 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 555 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 556 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 557 */ "sliding_opt ::=", - /* 558 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 559 */ "fill_opt ::=", - /* 560 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 561 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", - /* 562 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", - /* 563 */ "fill_mode ::= NONE", - /* 564 */ "fill_mode ::= PREV", - /* 565 */ "fill_mode ::= NULL", - /* 566 */ "fill_mode ::= NULL_F", - /* 567 */ "fill_mode ::= LINEAR", - /* 568 */ "fill_mode ::= NEXT", - /* 569 */ "group_by_clause_opt ::=", - /* 570 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 571 */ "group_by_list ::= expr_or_subquery", - /* 572 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 573 */ "having_clause_opt ::=", - /* 574 */ "having_clause_opt ::= HAVING search_condition", - /* 575 */ "range_opt ::=", - /* 576 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 577 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", - /* 578 */ "every_opt ::=", - /* 579 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 580 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 581 */ "query_simple ::= query_specification", - /* 582 */ "query_simple ::= union_query_expression", - /* 583 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 584 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 585 */ "query_simple_or_subquery ::= query_simple", - /* 586 */ "query_simple_or_subquery ::= subquery", - /* 587 */ "query_or_subquery ::= query_expression", - /* 588 */ "query_or_subquery ::= subquery", - /* 589 */ "order_by_clause_opt ::=", - /* 590 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 591 */ "slimit_clause_opt ::=", - /* 592 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 593 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 594 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 595 */ "limit_clause_opt ::=", - /* 596 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 597 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 598 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 599 */ "subquery ::= NK_LP query_expression NK_RP", - /* 600 */ "subquery ::= NK_LP subquery NK_RP", - /* 601 */ "search_condition ::= common_expression", - /* 602 */ "sort_specification_list ::= sort_specification", - /* 603 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 604 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 605 */ "ordering_specification_opt ::=", - /* 606 */ "ordering_specification_opt ::= ASC", - /* 607 */ "ordering_specification_opt ::= DESC", - /* 608 */ "null_ordering_opt ::=", - /* 609 */ "null_ordering_opt ::= NULLS FIRST", - /* 610 */ "null_ordering_opt ::= NULLS LAST", + /* 281 */ "table_kind_db_name_cond_opt ::=", + /* 282 */ "table_kind_db_name_cond_opt ::= table_kind", + /* 283 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT", + /* 284 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT", + /* 285 */ "table_kind ::= NORMAL", + /* 286 */ "table_kind ::= CHILD", + /* 287 */ "db_name_cond_opt ::=", + /* 288 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 289 */ "like_pattern_opt ::=", + /* 290 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 291 */ "table_name_cond ::= table_name", + /* 292 */ "from_db_opt ::=", + /* 293 */ "from_db_opt ::= FROM db_name", + /* 294 */ "tag_list_opt ::=", + /* 295 */ "tag_list_opt ::= tag_item", + /* 296 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", + /* 297 */ "tag_item ::= TBNAME", + /* 298 */ "tag_item ::= QTAGS", + /* 299 */ "tag_item ::= column_name", + /* 300 */ "tag_item ::= column_name column_alias", + /* 301 */ "tag_item ::= column_name AS column_alias", + /* 302 */ "db_kind_opt ::=", + /* 303 */ "db_kind_opt ::= USER", + /* 304 */ "db_kind_opt ::= SYSTEM", + /* 305 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options", + /* 306 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP", + /* 307 */ "cmd ::= DROP INDEX exists_opt full_index_name", + /* 308 */ "full_index_name ::= index_name", + /* 309 */ "full_index_name ::= db_name NK_DOT index_name", + /* 310 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 311 */ "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", + /* 312 */ "func_list ::= func", + /* 313 */ "func_list ::= func_list NK_COMMA func", + /* 314 */ "func ::= sma_func_name NK_LP expression_list NK_RP", + /* 315 */ "sma_func_name ::= function_name", + /* 316 */ "sma_func_name ::= COUNT", + /* 317 */ "sma_func_name ::= FIRST", + /* 318 */ "sma_func_name ::= LAST", + /* 319 */ "sma_func_name ::= LAST_ROW", + /* 320 */ "sma_stream_opt ::=", + /* 321 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", + /* 322 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", + /* 323 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", + /* 324 */ "with_meta ::= AS", + /* 325 */ "with_meta ::= WITH META AS", + /* 326 */ "with_meta ::= ONLY META AS", + /* 327 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 328 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", + /* 329 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", + /* 330 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 331 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 332 */ "cmd ::= DESC full_table_name", + /* 333 */ "cmd ::= DESCRIBE full_table_name", + /* 334 */ "cmd ::= RESET QUERY CACHE", + /* 335 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 336 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", + /* 337 */ "analyze_opt ::=", + /* 338 */ "analyze_opt ::= ANALYZE", + /* 339 */ "explain_options ::=", + /* 340 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 341 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 342 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", + /* 343 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 344 */ "agg_func_opt ::=", + /* 345 */ "agg_func_opt ::= AGGREGATE", + /* 346 */ "bufsize_opt ::=", + /* 347 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 348 */ "language_opt ::=", + /* 349 */ "language_opt ::= LANGUAGE NK_STRING", + /* 350 */ "or_replace_opt ::=", + /* 351 */ "or_replace_opt ::= OR REPLACE", + /* 352 */ "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", + /* 353 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 354 */ "cmd ::= PAUSE STREAM exists_opt stream_name", + /* 355 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", + /* 356 */ "col_list_opt ::=", + /* 357 */ "col_list_opt ::= NK_LP col_name_list NK_RP", + /* 358 */ "tag_def_or_ref_opt ::=", + /* 359 */ "tag_def_or_ref_opt ::= tags_def", + /* 360 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", + /* 361 */ "stream_options ::=", + /* 362 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 363 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 364 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 365 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 366 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 367 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 368 */ "stream_options ::= stream_options DELETE_MARK duration_literal", + /* 369 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", + /* 370 */ "subtable_opt ::=", + /* 371 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 372 */ "ignore_opt ::=", + /* 373 */ "ignore_opt ::= IGNORE UNTREATED", + /* 374 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 375 */ "cmd ::= KILL QUERY NK_STRING", + /* 376 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 377 */ "cmd ::= BALANCE VGROUP", + /* 378 */ "cmd ::= BALANCE VGROUP LEADER", + /* 379 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 380 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 381 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 382 */ "dnode_list ::= DNODE NK_INTEGER", + /* 383 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 384 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 385 */ "cmd ::= query_or_subquery", + /* 386 */ "cmd ::= insert_query", + /* 387 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 388 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", + /* 389 */ "literal ::= NK_INTEGER", + /* 390 */ "literal ::= NK_FLOAT", + /* 391 */ "literal ::= NK_STRING", + /* 392 */ "literal ::= NK_BOOL", + /* 393 */ "literal ::= TIMESTAMP NK_STRING", + /* 394 */ "literal ::= duration_literal", + /* 395 */ "literal ::= NULL", + /* 396 */ "literal ::= NK_QUESTION", + /* 397 */ "duration_literal ::= NK_VARIABLE", + /* 398 */ "signed ::= NK_INTEGER", + /* 399 */ "signed ::= NK_PLUS NK_INTEGER", + /* 400 */ "signed ::= NK_MINUS NK_INTEGER", + /* 401 */ "signed ::= NK_FLOAT", + /* 402 */ "signed ::= NK_PLUS NK_FLOAT", + /* 403 */ "signed ::= NK_MINUS NK_FLOAT", + /* 404 */ "signed_literal ::= signed", + /* 405 */ "signed_literal ::= NK_STRING", + /* 406 */ "signed_literal ::= NK_BOOL", + /* 407 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 408 */ "signed_literal ::= duration_literal", + /* 409 */ "signed_literal ::= NULL", + /* 410 */ "signed_literal ::= literal_func", + /* 411 */ "signed_literal ::= NK_QUESTION", + /* 412 */ "literal_list ::= signed_literal", + /* 413 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 414 */ "db_name ::= NK_ID", + /* 415 */ "table_name ::= NK_ID", + /* 416 */ "column_name ::= NK_ID", + /* 417 */ "function_name ::= NK_ID", + /* 418 */ "table_alias ::= NK_ID", + /* 419 */ "column_alias ::= NK_ID", + /* 420 */ "user_name ::= NK_ID", + /* 421 */ "topic_name ::= NK_ID", + /* 422 */ "stream_name ::= NK_ID", + /* 423 */ "cgroup_name ::= NK_ID", + /* 424 */ "index_name ::= NK_ID", + /* 425 */ "expr_or_subquery ::= expression", + /* 426 */ "expression ::= literal", + /* 427 */ "expression ::= pseudo_column", + /* 428 */ "expression ::= column_reference", + /* 429 */ "expression ::= function_expression", + /* 430 */ "expression ::= case_when_expression", + /* 431 */ "expression ::= NK_LP expression NK_RP", + /* 432 */ "expression ::= NK_PLUS expr_or_subquery", + /* 433 */ "expression ::= NK_MINUS expr_or_subquery", + /* 434 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 435 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 436 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 437 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 438 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 439 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 440 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 441 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 442 */ "expression_list ::= expr_or_subquery", + /* 443 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 444 */ "column_reference ::= column_name", + /* 445 */ "column_reference ::= table_name NK_DOT column_name", + /* 446 */ "pseudo_column ::= ROWTS", + /* 447 */ "pseudo_column ::= TBNAME", + /* 448 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 449 */ "pseudo_column ::= QSTART", + /* 450 */ "pseudo_column ::= QEND", + /* 451 */ "pseudo_column ::= QDURATION", + /* 452 */ "pseudo_column ::= WSTART", + /* 453 */ "pseudo_column ::= WEND", + /* 454 */ "pseudo_column ::= WDURATION", + /* 455 */ "pseudo_column ::= IROWTS", + /* 456 */ "pseudo_column ::= ISFILLED", + /* 457 */ "pseudo_column ::= QTAGS", + /* 458 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 459 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 460 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 461 */ "function_expression ::= literal_func", + /* 462 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 463 */ "literal_func ::= NOW", + /* 464 */ "noarg_func ::= NOW", + /* 465 */ "noarg_func ::= TODAY", + /* 466 */ "noarg_func ::= TIMEZONE", + /* 467 */ "noarg_func ::= DATABASE", + /* 468 */ "noarg_func ::= CLIENT_VERSION", + /* 469 */ "noarg_func ::= SERVER_VERSION", + /* 470 */ "noarg_func ::= SERVER_STATUS", + /* 471 */ "noarg_func ::= CURRENT_USER", + /* 472 */ "noarg_func ::= USER", + /* 473 */ "star_func ::= COUNT", + /* 474 */ "star_func ::= FIRST", + /* 475 */ "star_func ::= LAST", + /* 476 */ "star_func ::= LAST_ROW", + /* 477 */ "star_func_para_list ::= NK_STAR", + /* 478 */ "star_func_para_list ::= other_para_list", + /* 479 */ "other_para_list ::= star_func_para", + /* 480 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 481 */ "star_func_para ::= expr_or_subquery", + /* 482 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 483 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 484 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 485 */ "when_then_list ::= when_then_expr", + /* 486 */ "when_then_list ::= when_then_list when_then_expr", + /* 487 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 488 */ "case_when_else_opt ::=", + /* 489 */ "case_when_else_opt ::= ELSE common_expression", + /* 490 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 491 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 492 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 493 */ "predicate ::= expr_or_subquery IS NULL", + /* 494 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 495 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 496 */ "compare_op ::= NK_LT", + /* 497 */ "compare_op ::= NK_GT", + /* 498 */ "compare_op ::= NK_LE", + /* 499 */ "compare_op ::= NK_GE", + /* 500 */ "compare_op ::= NK_NE", + /* 501 */ "compare_op ::= NK_EQ", + /* 502 */ "compare_op ::= LIKE", + /* 503 */ "compare_op ::= NOT LIKE", + /* 504 */ "compare_op ::= MATCH", + /* 505 */ "compare_op ::= NMATCH", + /* 506 */ "compare_op ::= CONTAINS", + /* 507 */ "in_op ::= IN", + /* 508 */ "in_op ::= NOT IN", + /* 509 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 510 */ "boolean_value_expression ::= boolean_primary", + /* 511 */ "boolean_value_expression ::= NOT boolean_primary", + /* 512 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 513 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 514 */ "boolean_primary ::= predicate", + /* 515 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 516 */ "common_expression ::= expr_or_subquery", + /* 517 */ "common_expression ::= boolean_value_expression", + /* 518 */ "from_clause_opt ::=", + /* 519 */ "from_clause_opt ::= FROM table_reference_list", + /* 520 */ "table_reference_list ::= table_reference", + /* 521 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 522 */ "table_reference ::= table_primary", + /* 523 */ "table_reference ::= joined_table", + /* 524 */ "table_primary ::= table_name alias_opt", + /* 525 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 526 */ "table_primary ::= subquery alias_opt", + /* 527 */ "table_primary ::= parenthesized_joined_table", + /* 528 */ "alias_opt ::=", + /* 529 */ "alias_opt ::= table_alias", + /* 530 */ "alias_opt ::= AS table_alias", + /* 531 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 532 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 533 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 534 */ "join_type ::=", + /* 535 */ "join_type ::= INNER", + /* 536 */ "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", + /* 537 */ "hint_list ::=", + /* 538 */ "hint_list ::= NK_HINT", + /* 539 */ "tag_mode_opt ::=", + /* 540 */ "tag_mode_opt ::= TAGS", + /* 541 */ "set_quantifier_opt ::=", + /* 542 */ "set_quantifier_opt ::= DISTINCT", + /* 543 */ "set_quantifier_opt ::= ALL", + /* 544 */ "select_list ::= select_item", + /* 545 */ "select_list ::= select_list NK_COMMA select_item", + /* 546 */ "select_item ::= NK_STAR", + /* 547 */ "select_item ::= common_expression", + /* 548 */ "select_item ::= common_expression column_alias", + /* 549 */ "select_item ::= common_expression AS column_alias", + /* 550 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 551 */ "where_clause_opt ::=", + /* 552 */ "where_clause_opt ::= WHERE search_condition", + /* 553 */ "partition_by_clause_opt ::=", + /* 554 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 555 */ "partition_list ::= partition_item", + /* 556 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 557 */ "partition_item ::= expr_or_subquery", + /* 558 */ "partition_item ::= expr_or_subquery column_alias", + /* 559 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 560 */ "twindow_clause_opt ::=", + /* 561 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 562 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 563 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 564 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 565 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 566 */ "sliding_opt ::=", + /* 567 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 568 */ "fill_opt ::=", + /* 569 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 570 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", + /* 571 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", + /* 572 */ "fill_mode ::= NONE", + /* 573 */ "fill_mode ::= PREV", + /* 574 */ "fill_mode ::= NULL", + /* 575 */ "fill_mode ::= NULL_F", + /* 576 */ "fill_mode ::= LINEAR", + /* 577 */ "fill_mode ::= NEXT", + /* 578 */ "group_by_clause_opt ::=", + /* 579 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 580 */ "group_by_list ::= expr_or_subquery", + /* 581 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 582 */ "having_clause_opt ::=", + /* 583 */ "having_clause_opt ::= HAVING search_condition", + /* 584 */ "range_opt ::=", + /* 585 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 586 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", + /* 587 */ "every_opt ::=", + /* 588 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 589 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 590 */ "query_simple ::= query_specification", + /* 591 */ "query_simple ::= union_query_expression", + /* 592 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 593 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 594 */ "query_simple_or_subquery ::= query_simple", + /* 595 */ "query_simple_or_subquery ::= subquery", + /* 596 */ "query_or_subquery ::= query_expression", + /* 597 */ "query_or_subquery ::= subquery", + /* 598 */ "order_by_clause_opt ::=", + /* 599 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 600 */ "slimit_clause_opt ::=", + /* 601 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 602 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 603 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 604 */ "limit_clause_opt ::=", + /* 605 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 606 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 607 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 608 */ "subquery ::= NK_LP query_expression NK_RP", + /* 609 */ "subquery ::= NK_LP subquery NK_RP", + /* 610 */ "search_condition ::= common_expression", + /* 611 */ "sort_specification_list ::= sort_specification", + /* 612 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 613 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 614 */ "ordering_specification_opt ::=", + /* 615 */ "ordering_specification_opt ::= ASC", + /* 616 */ "ordering_specification_opt ::= DESC", + /* 617 */ "null_ordering_opt ::=", + /* 618 */ "null_ordering_opt ::= NULLS FIRST", + /* 619 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -3051,248 +3132,263 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 340: /* cmd */ - case 343: /* literal */ - case 352: /* with_opt */ - case 358: /* search_condition */ - case 363: /* db_options */ - case 365: /* alter_db_options */ - case 367: /* start_opt */ - case 368: /* end_opt */ - case 372: /* signed */ - case 374: /* retention */ - case 375: /* full_table_name */ - case 378: /* table_options */ - case 382: /* alter_table_clause */ - case 383: /* alter_table_options */ - case 386: /* signed_literal */ - case 387: /* create_subtable_clause */ - case 390: /* drop_table_clause */ - case 392: /* column_def */ - case 396: /* duration_literal */ - case 397: /* rollup_func_name */ - case 399: /* col_name */ - case 400: /* db_name_cond_opt */ - case 401: /* like_pattern_opt */ - case 402: /* table_name_cond */ - case 403: /* from_db_opt */ - case 405: /* tag_item */ - case 407: /* index_options */ - case 408: /* full_index_name */ - case 411: /* sliding_opt */ - case 412: /* sma_stream_opt */ - case 413: /* func */ - case 416: /* query_or_subquery */ - case 417: /* where_clause_opt */ - case 420: /* explain_options */ - case 421: /* insert_query */ - case 427: /* stream_options */ - case 430: /* subtable_opt */ - case 432: /* expression */ - case 434: /* literal_func */ - case 437: /* expr_or_subquery */ - case 438: /* pseudo_column */ - case 439: /* column_reference */ - case 440: /* function_expression */ - case 441: /* case_when_expression */ - case 446: /* star_func_para */ - case 448: /* case_when_else_opt */ - case 449: /* common_expression */ - case 450: /* when_then_expr */ - case 451: /* predicate */ - case 454: /* in_predicate_value */ - case 455: /* boolean_value_expression */ - case 456: /* boolean_primary */ - case 457: /* from_clause_opt */ - case 458: /* table_reference_list */ - case 459: /* table_reference */ - case 460: /* table_primary */ - case 461: /* joined_table */ - case 463: /* subquery */ - case 464: /* parenthesized_joined_table */ - case 466: /* query_specification */ - case 472: /* range_opt */ - case 473: /* every_opt */ - case 474: /* fill_opt */ - case 475: /* twindow_clause_opt */ - case 477: /* having_clause_opt */ - case 478: /* select_item */ - case 480: /* partition_item */ - case 483: /* query_expression */ - case 484: /* query_simple */ - case 486: /* slimit_clause_opt */ - case 487: /* limit_clause_opt */ - case 488: /* union_query_expression */ - case 489: /* query_simple_or_subquery */ - case 491: /* sort_specification */ + case 343: /* cmd */ + case 346: /* literal */ + case 355: /* with_opt */ + case 361: /* search_condition */ + case 366: /* db_options */ + case 368: /* alter_db_options */ + case 370: /* start_opt */ + case 371: /* end_opt */ + case 375: /* signed */ + case 377: /* retention */ + case 378: /* full_table_name */ + case 381: /* table_options */ + case 385: /* alter_table_clause */ + case 386: /* alter_table_options */ + case 389: /* signed_literal */ + case 390: /* create_subtable_clause */ + case 393: /* drop_table_clause */ + case 395: /* column_def */ + case 399: /* duration_literal */ + case 400: /* rollup_func_name */ + case 402: /* col_name */ + case 405: /* like_pattern_opt */ + case 406: /* db_name_cond_opt */ + case 407: /* table_name_cond */ + case 408: /* from_db_opt */ + case 411: /* tag_item */ + case 413: /* index_options */ + case 414: /* full_index_name */ + case 417: /* sliding_opt */ + case 418: /* sma_stream_opt */ + case 419: /* func */ + case 422: /* query_or_subquery */ + case 423: /* where_clause_opt */ + case 426: /* explain_options */ + case 427: /* insert_query */ + case 433: /* stream_options */ + case 436: /* subtable_opt */ + case 438: /* expression */ + case 440: /* literal_func */ + case 443: /* expr_or_subquery */ + case 444: /* pseudo_column */ + case 445: /* column_reference */ + case 446: /* function_expression */ + case 447: /* case_when_expression */ + case 452: /* star_func_para */ + case 454: /* case_when_else_opt */ + case 455: /* common_expression */ + case 456: /* when_then_expr */ + case 457: /* predicate */ + case 460: /* in_predicate_value */ + case 461: /* boolean_value_expression */ + case 462: /* boolean_primary */ + case 463: /* from_clause_opt */ + case 464: /* table_reference_list */ + case 465: /* table_reference */ + case 466: /* table_primary */ + case 467: /* joined_table */ + case 469: /* subquery */ + case 470: /* parenthesized_joined_table */ + case 472: /* query_specification */ + case 478: /* range_opt */ + case 479: /* every_opt */ + case 480: /* fill_opt */ + case 481: /* twindow_clause_opt */ + case 483: /* having_clause_opt */ + case 484: /* select_item */ + case 486: /* partition_item */ + case 489: /* query_expression */ + case 490: /* query_simple */ + case 492: /* slimit_clause_opt */ + case 493: /* limit_clause_opt */ + case 494: /* union_query_expression */ + case 495: /* query_simple_or_subquery */ + case 497: /* sort_specification */ { #line 7 "sql.y" - nodesDestroyNode((yypminor->yy28)); -#line 3131 "sql.c" -} - break; - case 341: /* account_options */ - case 342: /* alter_account_options */ - case 344: /* alter_account_option */ - case 366: /* speed_opt */ - case 415: /* with_meta */ - case 424: /* bufsize_opt */ -{ -#line 54 "sql.y" - -#line 3143 "sql.c" -} - break; - case 345: /* ip_range_list */ - case 346: /* white_list */ - case 347: /* white_list_opt */ - case 369: /* integer_list */ - case 370: /* variable_list */ - case 371: /* retention_list */ - case 376: /* column_def_list */ - case 377: /* tags_def_opt */ - case 379: /* multi_create_clause */ - case 380: /* tags_def */ - case 381: /* multi_drop_clause */ - case 388: /* specific_cols_opt */ - case 389: /* expression_list */ - case 391: /* col_name_list */ - case 393: /* duration_list */ - case 394: /* rollup_func_list */ - case 404: /* tag_list_opt */ - case 410: /* func_list */ - case 428: /* col_list_opt */ - case 429: /* tag_def_or_ref_opt */ - case 433: /* dnode_list */ - case 435: /* literal_list */ - case 443: /* star_func_para_list */ - case 445: /* other_para_list */ - case 447: /* when_then_list */ - case 467: /* hint_list */ - case 470: /* select_list */ - case 471: /* partition_by_clause_opt */ - case 476: /* group_by_clause_opt */ - case 479: /* partition_list */ - case 482: /* group_by_list */ - case 485: /* order_by_clause_opt */ - case 490: /* sort_specification_list */ -{ -#line 85 "sql.y" - nodesDestroyList((yypminor->yy236)); -#line 3182 "sql.c" -} - break; - case 348: /* user_name */ - case 355: /* db_name */ - case 356: /* table_name */ - case 357: /* topic_name */ - case 359: /* dnode_endpoint */ - case 384: /* column_name */ - case 398: /* function_name */ - case 406: /* column_alias */ - case 409: /* index_name */ - case 414: /* sma_func_name */ - case 418: /* cgroup_name */ - case 425: /* language_opt */ - case 426: /* stream_name */ - case 436: /* table_alias */ - case 442: /* star_func */ - case 444: /* noarg_func */ - case 462: /* alias_opt */ -{ -#line 762 "sql.y" - -#line 3205 "sql.c" -} - break; - case 349: /* sysinfo_opt */ -{ -#line 112 "sql.y" - + nodesDestroyNode((yypminor->yy712)); #line 3212 "sql.c" } break; - case 350: /* privileges */ - case 353: /* priv_type_list */ - case 354: /* priv_type */ + case 344: /* account_options */ + case 345: /* alter_account_options */ + case 347: /* alter_account_option */ + case 369: /* speed_opt */ + case 421: /* with_meta */ + case 430: /* bufsize_opt */ +{ +#line 54 "sql.y" + +#line 3224 "sql.c" +} + break; + case 348: /* ip_range_list */ + case 349: /* white_list */ + case 350: /* white_list_opt */ + case 372: /* integer_list */ + case 373: /* variable_list */ + case 374: /* retention_list */ + case 379: /* column_def_list */ + case 380: /* tags_def_opt */ + case 382: /* multi_create_clause */ + case 383: /* tags_def */ + case 384: /* multi_drop_clause */ + case 391: /* specific_cols_opt */ + case 392: /* expression_list */ + case 394: /* col_name_list */ + case 396: /* duration_list */ + case 397: /* rollup_func_list */ + case 409: /* tag_list_opt */ + case 416: /* func_list */ + case 434: /* col_list_opt */ + case 435: /* tag_def_or_ref_opt */ + case 439: /* dnode_list */ + case 441: /* literal_list */ + case 449: /* star_func_para_list */ + case 451: /* other_para_list */ + case 453: /* when_then_list */ + case 473: /* hint_list */ + case 476: /* select_list */ + case 477: /* partition_by_clause_opt */ + case 482: /* group_by_clause_opt */ + case 485: /* partition_list */ + case 488: /* group_by_list */ + case 491: /* order_by_clause_opt */ + case 496: /* sort_specification_list */ +{ +#line 85 "sql.y" + nodesDestroyList((yypminor->yy424)); +#line 3263 "sql.c" +} + break; + case 351: /* user_name */ + case 358: /* db_name */ + case 359: /* table_name */ + case 360: /* topic_name */ + case 362: /* dnode_endpoint */ + case 387: /* column_name */ + case 401: /* function_name */ + case 412: /* column_alias */ + case 415: /* index_name */ + case 420: /* sma_func_name */ + case 424: /* cgroup_name */ + case 431: /* language_opt */ + case 432: /* stream_name */ + case 442: /* table_alias */ + case 448: /* star_func */ + case 450: /* noarg_func */ + case 468: /* alias_opt */ +{ +#line 785 "sql.y" + +#line 3286 "sql.c" +} + break; + case 352: /* sysinfo_opt */ +{ +#line 112 "sql.y" + +#line 3293 "sql.c" +} + break; + case 353: /* privileges */ + case 356: /* priv_type_list */ + case 357: /* priv_type */ { #line 121 "sql.y" -#line 3221 "sql.c" +#line 3302 "sql.c" } break; - case 351: /* priv_level */ + case 354: /* priv_level */ { #line 137 "sql.y" -#line 3228 "sql.c" +#line 3309 "sql.c" } break; - case 360: /* force_opt */ - case 361: /* unsafe_opt */ - case 362: /* not_exists_opt */ - case 364: /* exists_opt */ - case 419: /* analyze_opt */ - case 422: /* or_replace_opt */ - case 423: /* agg_func_opt */ - case 431: /* ignore_opt */ - case 468: /* set_quantifier_opt */ - case 469: /* tag_mode_opt */ + case 363: /* force_opt */ + case 364: /* unsafe_opt */ + case 365: /* not_exists_opt */ + case 367: /* exists_opt */ + case 425: /* analyze_opt */ + case 428: /* or_replace_opt */ + case 429: /* agg_func_opt */ + case 437: /* ignore_opt */ + case 474: /* set_quantifier_opt */ + case 475: /* tag_mode_opt */ { #line 166 "sql.y" -#line 3244 "sql.c" +#line 3325 "sql.c" } break; - case 373: /* alter_db_option */ - case 395: /* alter_table_option */ + case 376: /* alter_db_option */ + case 398: /* alter_table_option */ { #line 263 "sql.y" -#line 3252 "sql.c" +#line 3333 "sql.c" } break; - case 385: /* type_name */ + case 388: /* type_name */ { #line 384 "sql.y" -#line 3259 "sql.c" +#line 3340 "sql.c" } break; - case 452: /* compare_op */ - case 453: /* in_op */ + case 403: /* db_kind_opt */ + case 410: /* table_kind */ { -#line 950 "sql.y" +#line 545 "sql.y" -#line 3267 "sql.c" +#line 3348 "sql.c" } break; - case 465: /* join_type */ + case 404: /* table_kind_db_name_cond_opt */ { -#line 1026 "sql.y" +#line 510 "sql.y" -#line 3274 "sql.c" +#line 3355 "sql.c" } break; - case 481: /* fill_mode */ + case 458: /* compare_op */ + case 459: /* in_op */ { -#line 1112 "sql.y" +#line 973 "sql.y" -#line 3281 "sql.c" +#line 3363 "sql.c" } break; - case 492: /* ordering_specification_opt */ + case 471: /* join_type */ { -#line 1197 "sql.y" +#line 1049 "sql.y" -#line 3288 "sql.c" +#line 3370 "sql.c" } break; - case 493: /* null_ordering_opt */ + case 487: /* fill_mode */ { -#line 1203 "sql.y" +#line 1135 "sql.y" -#line 3295 "sql.c" +#line 3377 "sql.c" +} + break; + case 498: /* ordering_specification_opt */ +{ +#line 1220 "sql.y" + +#line 3384 "sql.c" +} + break; + case 499: /* null_ordering_opt */ +{ +#line 1226 "sql.y" + +#line 3391 "sql.c" } break; /********* End destructor definitions *****************************************/ @@ -3581,617 +3677,626 @@ static void yy_shift( /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side ** of that rule */ static const YYCODETYPE yyRuleInfoLhs[] = { - 340, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - 340, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - 341, /* (2) account_options ::= */ - 341, /* (3) account_options ::= account_options PPS literal */ - 341, /* (4) account_options ::= account_options TSERIES literal */ - 341, /* (5) account_options ::= account_options STORAGE literal */ - 341, /* (6) account_options ::= account_options STREAMS literal */ - 341, /* (7) account_options ::= account_options QTIME literal */ - 341, /* (8) account_options ::= account_options DBS literal */ - 341, /* (9) account_options ::= account_options USERS literal */ - 341, /* (10) account_options ::= account_options CONNS literal */ - 341, /* (11) account_options ::= account_options STATE literal */ - 342, /* (12) alter_account_options ::= alter_account_option */ - 342, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - 344, /* (14) alter_account_option ::= PASS literal */ - 344, /* (15) alter_account_option ::= PPS literal */ - 344, /* (16) alter_account_option ::= TSERIES literal */ - 344, /* (17) alter_account_option ::= STORAGE literal */ - 344, /* (18) alter_account_option ::= STREAMS literal */ - 344, /* (19) alter_account_option ::= QTIME literal */ - 344, /* (20) alter_account_option ::= DBS literal */ - 344, /* (21) alter_account_option ::= USERS literal */ - 344, /* (22) alter_account_option ::= CONNS literal */ - 344, /* (23) alter_account_option ::= STATE literal */ - 345, /* (24) ip_range_list ::= NK_STRING */ - 345, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ - 346, /* (26) white_list ::= HOST ip_range_list */ - 347, /* (27) white_list_opt ::= */ - 347, /* (28) white_list_opt ::= white_list */ - 340, /* (29) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt white_list_opt */ - 340, /* (30) cmd ::= ALTER USER user_name PASS NK_STRING */ - 340, /* (31) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - 340, /* (32) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - 340, /* (33) cmd ::= ALTER USER user_name ADD white_list */ - 340, /* (34) cmd ::= ALTER USER user_name DROP white_list */ - 340, /* (35) cmd ::= DROP USER user_name */ - 349, /* (36) sysinfo_opt ::= */ - 349, /* (37) sysinfo_opt ::= SYSINFO NK_INTEGER */ - 340, /* (38) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ - 340, /* (39) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ - 350, /* (40) privileges ::= ALL */ - 350, /* (41) privileges ::= priv_type_list */ - 350, /* (42) privileges ::= SUBSCRIBE */ - 353, /* (43) priv_type_list ::= priv_type */ - 353, /* (44) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - 354, /* (45) priv_type ::= READ */ - 354, /* (46) priv_type ::= WRITE */ - 351, /* (47) priv_level ::= NK_STAR NK_DOT NK_STAR */ - 351, /* (48) priv_level ::= db_name NK_DOT NK_STAR */ - 351, /* (49) priv_level ::= db_name NK_DOT table_name */ - 351, /* (50) priv_level ::= topic_name */ - 352, /* (51) with_opt ::= */ - 352, /* (52) with_opt ::= WITH search_condition */ - 340, /* (53) cmd ::= CREATE DNODE dnode_endpoint */ - 340, /* (54) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - 340, /* (55) cmd ::= DROP DNODE NK_INTEGER force_opt */ - 340, /* (56) cmd ::= DROP DNODE dnode_endpoint force_opt */ - 340, /* (57) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ - 340, /* (58) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ - 340, /* (59) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - 340, /* (60) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - 340, /* (61) cmd ::= ALTER ALL DNODES NK_STRING */ - 340, /* (62) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - 340, /* (63) cmd ::= RESTORE DNODE NK_INTEGER */ - 359, /* (64) dnode_endpoint ::= NK_STRING */ - 359, /* (65) dnode_endpoint ::= NK_ID */ - 359, /* (66) dnode_endpoint ::= NK_IPTOKEN */ - 360, /* (67) force_opt ::= */ - 360, /* (68) force_opt ::= FORCE */ - 361, /* (69) unsafe_opt ::= UNSAFE */ - 340, /* (70) cmd ::= ALTER LOCAL NK_STRING */ - 340, /* (71) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - 340, /* (72) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - 340, /* (73) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - 340, /* (74) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ - 340, /* (75) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - 340, /* (76) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - 340, /* (77) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - 340, /* (78) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - 340, /* (79) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - 340, /* (80) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - 340, /* (81) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ - 340, /* (82) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ - 340, /* (83) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - 340, /* (84) cmd ::= DROP DATABASE exists_opt db_name */ - 340, /* (85) cmd ::= USE db_name */ - 340, /* (86) cmd ::= ALTER DATABASE db_name alter_db_options */ - 340, /* (87) cmd ::= FLUSH DATABASE db_name */ - 340, /* (88) cmd ::= TRIM DATABASE db_name speed_opt */ - 340, /* (89) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ - 362, /* (90) not_exists_opt ::= IF NOT EXISTS */ - 362, /* (91) not_exists_opt ::= */ - 364, /* (92) exists_opt ::= IF EXISTS */ - 364, /* (93) exists_opt ::= */ - 363, /* (94) db_options ::= */ - 363, /* (95) db_options ::= db_options BUFFER NK_INTEGER */ - 363, /* (96) db_options ::= db_options CACHEMODEL NK_STRING */ - 363, /* (97) db_options ::= db_options CACHESIZE NK_INTEGER */ - 363, /* (98) db_options ::= db_options COMP NK_INTEGER */ - 363, /* (99) db_options ::= db_options DURATION NK_INTEGER */ - 363, /* (100) db_options ::= db_options DURATION NK_VARIABLE */ - 363, /* (101) db_options ::= db_options MAXROWS NK_INTEGER */ - 363, /* (102) db_options ::= db_options MINROWS NK_INTEGER */ - 363, /* (103) db_options ::= db_options KEEP integer_list */ - 363, /* (104) db_options ::= db_options KEEP variable_list */ - 363, /* (105) db_options ::= db_options PAGES NK_INTEGER */ - 363, /* (106) db_options ::= db_options PAGESIZE NK_INTEGER */ - 363, /* (107) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ - 363, /* (108) db_options ::= db_options PRECISION NK_STRING */ - 363, /* (109) db_options ::= db_options REPLICA NK_INTEGER */ - 363, /* (110) db_options ::= db_options VGROUPS NK_INTEGER */ - 363, /* (111) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - 363, /* (112) db_options ::= db_options RETENTIONS retention_list */ - 363, /* (113) db_options ::= db_options SCHEMALESS NK_INTEGER */ - 363, /* (114) db_options ::= db_options WAL_LEVEL NK_INTEGER */ - 363, /* (115) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ - 363, /* (116) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ - 363, /* (117) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - 363, /* (118) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ - 363, /* (119) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - 363, /* (120) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ - 363, /* (121) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ - 363, /* (122) db_options ::= db_options STT_TRIGGER NK_INTEGER */ - 363, /* (123) db_options ::= db_options TABLE_PREFIX signed */ - 363, /* (124) db_options ::= db_options TABLE_SUFFIX signed */ - 365, /* (125) alter_db_options ::= alter_db_option */ - 365, /* (126) alter_db_options ::= alter_db_options alter_db_option */ - 373, /* (127) alter_db_option ::= BUFFER NK_INTEGER */ - 373, /* (128) alter_db_option ::= CACHEMODEL NK_STRING */ - 373, /* (129) alter_db_option ::= CACHESIZE NK_INTEGER */ - 373, /* (130) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - 373, /* (131) alter_db_option ::= KEEP integer_list */ - 373, /* (132) alter_db_option ::= KEEP variable_list */ - 373, /* (133) alter_db_option ::= PAGES NK_INTEGER */ - 373, /* (134) alter_db_option ::= REPLICA NK_INTEGER */ - 373, /* (135) alter_db_option ::= WAL_LEVEL NK_INTEGER */ - 373, /* (136) alter_db_option ::= STT_TRIGGER NK_INTEGER */ - 373, /* (137) alter_db_option ::= MINROWS NK_INTEGER */ - 373, /* (138) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ - 373, /* (139) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - 373, /* (140) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ - 373, /* (141) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - 369, /* (142) integer_list ::= NK_INTEGER */ - 369, /* (143) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - 370, /* (144) variable_list ::= NK_VARIABLE */ - 370, /* (145) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - 371, /* (146) retention_list ::= retention */ - 371, /* (147) retention_list ::= retention_list NK_COMMA retention */ - 374, /* (148) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - 366, /* (149) speed_opt ::= */ - 366, /* (150) speed_opt ::= BWLIMIT NK_INTEGER */ - 367, /* (151) start_opt ::= */ - 367, /* (152) start_opt ::= START WITH NK_INTEGER */ - 367, /* (153) start_opt ::= START WITH NK_STRING */ - 367, /* (154) start_opt ::= START WITH TIMESTAMP NK_STRING */ - 368, /* (155) end_opt ::= */ - 368, /* (156) end_opt ::= END WITH NK_INTEGER */ - 368, /* (157) end_opt ::= END WITH NK_STRING */ - 368, /* (158) end_opt ::= END WITH TIMESTAMP NK_STRING */ - 340, /* (159) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - 340, /* (160) cmd ::= CREATE TABLE multi_create_clause */ - 340, /* (161) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - 340, /* (162) cmd ::= DROP TABLE multi_drop_clause */ - 340, /* (163) cmd ::= DROP STABLE exists_opt full_table_name */ - 340, /* (164) cmd ::= ALTER TABLE alter_table_clause */ - 340, /* (165) cmd ::= ALTER STABLE alter_table_clause */ - 382, /* (166) alter_table_clause ::= full_table_name alter_table_options */ - 382, /* (167) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - 382, /* (168) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - 382, /* (169) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - 382, /* (170) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - 382, /* (171) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - 382, /* (172) alter_table_clause ::= full_table_name DROP TAG column_name */ - 382, /* (173) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - 382, /* (174) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - 382, /* (175) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - 379, /* (176) multi_create_clause ::= create_subtable_clause */ - 379, /* (177) multi_create_clause ::= multi_create_clause create_subtable_clause */ - 387, /* (178) 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 */ - 381, /* (179) multi_drop_clause ::= drop_table_clause */ - 381, /* (180) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - 390, /* (181) drop_table_clause ::= exists_opt full_table_name */ - 388, /* (182) specific_cols_opt ::= */ - 388, /* (183) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - 375, /* (184) full_table_name ::= table_name */ - 375, /* (185) full_table_name ::= db_name NK_DOT table_name */ - 376, /* (186) column_def_list ::= column_def */ - 376, /* (187) column_def_list ::= column_def_list NK_COMMA column_def */ - 392, /* (188) column_def ::= column_name type_name */ - 385, /* (189) type_name ::= BOOL */ - 385, /* (190) type_name ::= TINYINT */ - 385, /* (191) type_name ::= SMALLINT */ - 385, /* (192) type_name ::= INT */ - 385, /* (193) type_name ::= INTEGER */ - 385, /* (194) type_name ::= BIGINT */ - 385, /* (195) type_name ::= FLOAT */ - 385, /* (196) type_name ::= DOUBLE */ - 385, /* (197) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - 385, /* (198) type_name ::= TIMESTAMP */ - 385, /* (199) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - 385, /* (200) type_name ::= TINYINT UNSIGNED */ - 385, /* (201) type_name ::= SMALLINT UNSIGNED */ - 385, /* (202) type_name ::= INT UNSIGNED */ - 385, /* (203) type_name ::= BIGINT UNSIGNED */ - 385, /* (204) type_name ::= JSON */ - 385, /* (205) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - 385, /* (206) type_name ::= MEDIUMBLOB */ - 385, /* (207) type_name ::= BLOB */ - 385, /* (208) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - 385, /* (209) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - 385, /* (210) type_name ::= DECIMAL */ - 385, /* (211) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - 385, /* (212) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 377, /* (213) tags_def_opt ::= */ - 377, /* (214) tags_def_opt ::= tags_def */ - 380, /* (215) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - 378, /* (216) table_options ::= */ - 378, /* (217) table_options ::= table_options COMMENT NK_STRING */ - 378, /* (218) table_options ::= table_options MAX_DELAY duration_list */ - 378, /* (219) table_options ::= table_options WATERMARK duration_list */ - 378, /* (220) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - 378, /* (221) table_options ::= table_options TTL NK_INTEGER */ - 378, /* (222) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - 378, /* (223) table_options ::= table_options DELETE_MARK duration_list */ - 383, /* (224) alter_table_options ::= alter_table_option */ - 383, /* (225) alter_table_options ::= alter_table_options alter_table_option */ - 395, /* (226) alter_table_option ::= COMMENT NK_STRING */ - 395, /* (227) alter_table_option ::= TTL NK_INTEGER */ - 393, /* (228) duration_list ::= duration_literal */ - 393, /* (229) duration_list ::= duration_list NK_COMMA duration_literal */ - 394, /* (230) rollup_func_list ::= rollup_func_name */ - 394, /* (231) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - 397, /* (232) rollup_func_name ::= function_name */ - 397, /* (233) rollup_func_name ::= FIRST */ - 397, /* (234) rollup_func_name ::= LAST */ - 391, /* (235) col_name_list ::= col_name */ - 391, /* (236) col_name_list ::= col_name_list NK_COMMA col_name */ - 399, /* (237) col_name ::= column_name */ - 340, /* (238) cmd ::= SHOW DNODES */ - 340, /* (239) cmd ::= SHOW USERS */ - 340, /* (240) cmd ::= SHOW USER PRIVILEGES */ - 340, /* (241) cmd ::= SHOW DATABASES */ - 340, /* (242) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - 340, /* (243) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - 340, /* (244) cmd ::= SHOW db_name_cond_opt VGROUPS */ - 340, /* (245) cmd ::= SHOW MNODES */ - 340, /* (246) cmd ::= SHOW QNODES */ - 340, /* (247) cmd ::= SHOW FUNCTIONS */ - 340, /* (248) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - 340, /* (249) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - 340, /* (250) cmd ::= SHOW STREAMS */ - 340, /* (251) cmd ::= SHOW ACCOUNTS */ - 340, /* (252) cmd ::= SHOW APPS */ - 340, /* (253) cmd ::= SHOW CONNECTIONS */ - 340, /* (254) cmd ::= SHOW LICENCES */ - 340, /* (255) cmd ::= SHOW GRANTS */ - 340, /* (256) cmd ::= SHOW CREATE DATABASE db_name */ - 340, /* (257) cmd ::= SHOW CREATE TABLE full_table_name */ - 340, /* (258) cmd ::= SHOW CREATE STABLE full_table_name */ - 340, /* (259) cmd ::= SHOW QUERIES */ - 340, /* (260) cmd ::= SHOW SCORES */ - 340, /* (261) cmd ::= SHOW TOPICS */ - 340, /* (262) cmd ::= SHOW VARIABLES */ - 340, /* (263) cmd ::= SHOW CLUSTER VARIABLES */ - 340, /* (264) cmd ::= SHOW LOCAL VARIABLES */ - 340, /* (265) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - 340, /* (266) cmd ::= SHOW BNODES */ - 340, /* (267) cmd ::= SHOW SNODES */ - 340, /* (268) cmd ::= SHOW CLUSTER */ - 340, /* (269) cmd ::= SHOW TRANSACTIONS */ - 340, /* (270) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - 340, /* (271) cmd ::= SHOW CONSUMERS */ - 340, /* (272) cmd ::= SHOW SUBSCRIPTIONS */ - 340, /* (273) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - 340, /* (274) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - 340, /* (275) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - 340, /* (276) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - 340, /* (277) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - 340, /* (278) cmd ::= SHOW VNODES */ - 340, /* (279) cmd ::= SHOW db_name_cond_opt ALIVE */ - 340, /* (280) cmd ::= SHOW CLUSTER ALIVE */ - 400, /* (281) db_name_cond_opt ::= */ - 400, /* (282) db_name_cond_opt ::= db_name NK_DOT */ - 401, /* (283) like_pattern_opt ::= */ - 401, /* (284) like_pattern_opt ::= LIKE NK_STRING */ - 402, /* (285) table_name_cond ::= table_name */ - 403, /* (286) from_db_opt ::= */ - 403, /* (287) from_db_opt ::= FROM db_name */ - 404, /* (288) tag_list_opt ::= */ - 404, /* (289) tag_list_opt ::= tag_item */ - 404, /* (290) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - 405, /* (291) tag_item ::= TBNAME */ - 405, /* (292) tag_item ::= QTAGS */ - 405, /* (293) tag_item ::= column_name */ - 405, /* (294) tag_item ::= column_name column_alias */ - 405, /* (295) tag_item ::= column_name AS column_alias */ - 340, /* (296) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - 340, /* (297) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - 340, /* (298) cmd ::= DROP INDEX exists_opt full_index_name */ - 408, /* (299) full_index_name ::= index_name */ - 408, /* (300) full_index_name ::= db_name NK_DOT index_name */ - 407, /* (301) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - 407, /* (302) 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 */ - 410, /* (303) func_list ::= func */ - 410, /* (304) func_list ::= func_list NK_COMMA func */ - 413, /* (305) func ::= sma_func_name NK_LP expression_list NK_RP */ - 414, /* (306) sma_func_name ::= function_name */ - 414, /* (307) sma_func_name ::= COUNT */ - 414, /* (308) sma_func_name ::= FIRST */ - 414, /* (309) sma_func_name ::= LAST */ - 414, /* (310) sma_func_name ::= LAST_ROW */ - 412, /* (311) sma_stream_opt ::= */ - 412, /* (312) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - 412, /* (313) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - 412, /* (314) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - 415, /* (315) with_meta ::= AS */ - 415, /* (316) with_meta ::= WITH META AS */ - 415, /* (317) with_meta ::= ONLY META AS */ - 340, /* (318) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - 340, /* (319) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - 340, /* (320) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - 340, /* (321) cmd ::= DROP TOPIC exists_opt topic_name */ - 340, /* (322) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - 340, /* (323) cmd ::= DESC full_table_name */ - 340, /* (324) cmd ::= DESCRIBE full_table_name */ - 340, /* (325) cmd ::= RESET QUERY CACHE */ - 340, /* (326) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - 340, /* (327) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 419, /* (328) analyze_opt ::= */ - 419, /* (329) analyze_opt ::= ANALYZE */ - 420, /* (330) explain_options ::= */ - 420, /* (331) explain_options ::= explain_options VERBOSE NK_BOOL */ - 420, /* (332) explain_options ::= explain_options RATIO NK_FLOAT */ - 340, /* (333) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - 340, /* (334) cmd ::= DROP FUNCTION exists_opt function_name */ - 423, /* (335) agg_func_opt ::= */ - 423, /* (336) agg_func_opt ::= AGGREGATE */ - 424, /* (337) bufsize_opt ::= */ - 424, /* (338) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 425, /* (339) language_opt ::= */ - 425, /* (340) language_opt ::= LANGUAGE NK_STRING */ - 422, /* (341) or_replace_opt ::= */ - 422, /* (342) or_replace_opt ::= OR REPLACE */ - 340, /* (343) 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 */ - 340, /* (344) cmd ::= DROP STREAM exists_opt stream_name */ - 340, /* (345) cmd ::= PAUSE STREAM exists_opt stream_name */ - 340, /* (346) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 428, /* (347) col_list_opt ::= */ - 428, /* (348) col_list_opt ::= NK_LP col_name_list NK_RP */ - 429, /* (349) tag_def_or_ref_opt ::= */ - 429, /* (350) tag_def_or_ref_opt ::= tags_def */ - 429, /* (351) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - 427, /* (352) stream_options ::= */ - 427, /* (353) stream_options ::= stream_options TRIGGER AT_ONCE */ - 427, /* (354) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - 427, /* (355) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - 427, /* (356) stream_options ::= stream_options WATERMARK duration_literal */ - 427, /* (357) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - 427, /* (358) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - 427, /* (359) stream_options ::= stream_options DELETE_MARK duration_literal */ - 427, /* (360) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 430, /* (361) subtable_opt ::= */ - 430, /* (362) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 431, /* (363) ignore_opt ::= */ - 431, /* (364) ignore_opt ::= IGNORE UNTREATED */ - 340, /* (365) cmd ::= KILL CONNECTION NK_INTEGER */ - 340, /* (366) cmd ::= KILL QUERY NK_STRING */ - 340, /* (367) cmd ::= KILL TRANSACTION NK_INTEGER */ - 340, /* (368) cmd ::= BALANCE VGROUP */ - 340, /* (369) cmd ::= BALANCE VGROUP LEADER */ - 340, /* (370) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - 340, /* (371) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - 340, /* (372) cmd ::= SPLIT VGROUP NK_INTEGER */ - 433, /* (373) dnode_list ::= DNODE NK_INTEGER */ - 433, /* (374) dnode_list ::= dnode_list DNODE NK_INTEGER */ - 340, /* (375) cmd ::= DELETE FROM full_table_name where_clause_opt */ - 340, /* (376) cmd ::= query_or_subquery */ - 340, /* (377) cmd ::= insert_query */ - 421, /* (378) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - 421, /* (379) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - 343, /* (380) literal ::= NK_INTEGER */ - 343, /* (381) literal ::= NK_FLOAT */ - 343, /* (382) literal ::= NK_STRING */ - 343, /* (383) literal ::= NK_BOOL */ - 343, /* (384) literal ::= TIMESTAMP NK_STRING */ - 343, /* (385) literal ::= duration_literal */ - 343, /* (386) literal ::= NULL */ - 343, /* (387) literal ::= NK_QUESTION */ - 396, /* (388) duration_literal ::= NK_VARIABLE */ - 372, /* (389) signed ::= NK_INTEGER */ - 372, /* (390) signed ::= NK_PLUS NK_INTEGER */ - 372, /* (391) signed ::= NK_MINUS NK_INTEGER */ - 372, /* (392) signed ::= NK_FLOAT */ - 372, /* (393) signed ::= NK_PLUS NK_FLOAT */ - 372, /* (394) signed ::= NK_MINUS NK_FLOAT */ - 386, /* (395) signed_literal ::= signed */ - 386, /* (396) signed_literal ::= NK_STRING */ - 386, /* (397) signed_literal ::= NK_BOOL */ - 386, /* (398) signed_literal ::= TIMESTAMP NK_STRING */ - 386, /* (399) signed_literal ::= duration_literal */ - 386, /* (400) signed_literal ::= NULL */ - 386, /* (401) signed_literal ::= literal_func */ - 386, /* (402) signed_literal ::= NK_QUESTION */ - 435, /* (403) literal_list ::= signed_literal */ - 435, /* (404) literal_list ::= literal_list NK_COMMA signed_literal */ - 355, /* (405) db_name ::= NK_ID */ - 356, /* (406) table_name ::= NK_ID */ - 384, /* (407) column_name ::= NK_ID */ - 398, /* (408) function_name ::= NK_ID */ - 436, /* (409) table_alias ::= NK_ID */ - 406, /* (410) column_alias ::= NK_ID */ - 348, /* (411) user_name ::= NK_ID */ - 357, /* (412) topic_name ::= NK_ID */ - 426, /* (413) stream_name ::= NK_ID */ - 418, /* (414) cgroup_name ::= NK_ID */ - 409, /* (415) index_name ::= NK_ID */ - 437, /* (416) expr_or_subquery ::= expression */ - 432, /* (417) expression ::= literal */ - 432, /* (418) expression ::= pseudo_column */ - 432, /* (419) expression ::= column_reference */ - 432, /* (420) expression ::= function_expression */ - 432, /* (421) expression ::= case_when_expression */ - 432, /* (422) expression ::= NK_LP expression NK_RP */ - 432, /* (423) expression ::= NK_PLUS expr_or_subquery */ - 432, /* (424) expression ::= NK_MINUS expr_or_subquery */ - 432, /* (425) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - 432, /* (426) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - 432, /* (427) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - 432, /* (428) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - 432, /* (429) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - 432, /* (430) expression ::= column_reference NK_ARROW NK_STRING */ - 432, /* (431) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - 432, /* (432) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - 389, /* (433) expression_list ::= expr_or_subquery */ - 389, /* (434) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - 439, /* (435) column_reference ::= column_name */ - 439, /* (436) column_reference ::= table_name NK_DOT column_name */ - 438, /* (437) pseudo_column ::= ROWTS */ - 438, /* (438) pseudo_column ::= TBNAME */ - 438, /* (439) pseudo_column ::= table_name NK_DOT TBNAME */ - 438, /* (440) pseudo_column ::= QSTART */ - 438, /* (441) pseudo_column ::= QEND */ - 438, /* (442) pseudo_column ::= QDURATION */ - 438, /* (443) pseudo_column ::= WSTART */ - 438, /* (444) pseudo_column ::= WEND */ - 438, /* (445) pseudo_column ::= WDURATION */ - 438, /* (446) pseudo_column ::= IROWTS */ - 438, /* (447) pseudo_column ::= ISFILLED */ - 438, /* (448) pseudo_column ::= QTAGS */ - 440, /* (449) function_expression ::= function_name NK_LP expression_list NK_RP */ - 440, /* (450) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - 440, /* (451) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - 440, /* (452) function_expression ::= literal_func */ - 434, /* (453) literal_func ::= noarg_func NK_LP NK_RP */ - 434, /* (454) literal_func ::= NOW */ - 444, /* (455) noarg_func ::= NOW */ - 444, /* (456) noarg_func ::= TODAY */ - 444, /* (457) noarg_func ::= TIMEZONE */ - 444, /* (458) noarg_func ::= DATABASE */ - 444, /* (459) noarg_func ::= CLIENT_VERSION */ - 444, /* (460) noarg_func ::= SERVER_VERSION */ - 444, /* (461) noarg_func ::= SERVER_STATUS */ - 444, /* (462) noarg_func ::= CURRENT_USER */ - 444, /* (463) noarg_func ::= USER */ - 442, /* (464) star_func ::= COUNT */ - 442, /* (465) star_func ::= FIRST */ - 442, /* (466) star_func ::= LAST */ - 442, /* (467) star_func ::= LAST_ROW */ - 443, /* (468) star_func_para_list ::= NK_STAR */ - 443, /* (469) star_func_para_list ::= other_para_list */ - 445, /* (470) other_para_list ::= star_func_para */ - 445, /* (471) other_para_list ::= other_para_list NK_COMMA star_func_para */ - 446, /* (472) star_func_para ::= expr_or_subquery */ - 446, /* (473) star_func_para ::= table_name NK_DOT NK_STAR */ - 441, /* (474) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - 441, /* (475) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - 447, /* (476) when_then_list ::= when_then_expr */ - 447, /* (477) when_then_list ::= when_then_list when_then_expr */ - 450, /* (478) when_then_expr ::= WHEN common_expression THEN common_expression */ - 448, /* (479) case_when_else_opt ::= */ - 448, /* (480) case_when_else_opt ::= ELSE common_expression */ - 451, /* (481) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - 451, /* (482) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - 451, /* (483) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - 451, /* (484) predicate ::= expr_or_subquery IS NULL */ - 451, /* (485) predicate ::= expr_or_subquery IS NOT NULL */ - 451, /* (486) predicate ::= expr_or_subquery in_op in_predicate_value */ - 452, /* (487) compare_op ::= NK_LT */ - 452, /* (488) compare_op ::= NK_GT */ - 452, /* (489) compare_op ::= NK_LE */ - 452, /* (490) compare_op ::= NK_GE */ - 452, /* (491) compare_op ::= NK_NE */ - 452, /* (492) compare_op ::= NK_EQ */ - 452, /* (493) compare_op ::= LIKE */ - 452, /* (494) compare_op ::= NOT LIKE */ - 452, /* (495) compare_op ::= MATCH */ - 452, /* (496) compare_op ::= NMATCH */ - 452, /* (497) compare_op ::= CONTAINS */ - 453, /* (498) in_op ::= IN */ - 453, /* (499) in_op ::= NOT IN */ - 454, /* (500) in_predicate_value ::= NK_LP literal_list NK_RP */ - 455, /* (501) boolean_value_expression ::= boolean_primary */ - 455, /* (502) boolean_value_expression ::= NOT boolean_primary */ - 455, /* (503) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - 455, /* (504) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - 456, /* (505) boolean_primary ::= predicate */ - 456, /* (506) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - 449, /* (507) common_expression ::= expr_or_subquery */ - 449, /* (508) common_expression ::= boolean_value_expression */ - 457, /* (509) from_clause_opt ::= */ - 457, /* (510) from_clause_opt ::= FROM table_reference_list */ - 458, /* (511) table_reference_list ::= table_reference */ - 458, /* (512) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - 459, /* (513) table_reference ::= table_primary */ - 459, /* (514) table_reference ::= joined_table */ - 460, /* (515) table_primary ::= table_name alias_opt */ - 460, /* (516) table_primary ::= db_name NK_DOT table_name alias_opt */ - 460, /* (517) table_primary ::= subquery alias_opt */ - 460, /* (518) table_primary ::= parenthesized_joined_table */ - 462, /* (519) alias_opt ::= */ - 462, /* (520) alias_opt ::= table_alias */ - 462, /* (521) alias_opt ::= AS table_alias */ - 464, /* (522) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - 464, /* (523) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - 461, /* (524) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - 465, /* (525) join_type ::= */ - 465, /* (526) join_type ::= INNER */ - 466, /* (527) 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 */ - 467, /* (528) hint_list ::= */ - 467, /* (529) hint_list ::= NK_HINT */ - 469, /* (530) tag_mode_opt ::= */ - 469, /* (531) tag_mode_opt ::= TAGS */ - 468, /* (532) set_quantifier_opt ::= */ - 468, /* (533) set_quantifier_opt ::= DISTINCT */ - 468, /* (534) set_quantifier_opt ::= ALL */ - 470, /* (535) select_list ::= select_item */ - 470, /* (536) select_list ::= select_list NK_COMMA select_item */ - 478, /* (537) select_item ::= NK_STAR */ - 478, /* (538) select_item ::= common_expression */ - 478, /* (539) select_item ::= common_expression column_alias */ - 478, /* (540) select_item ::= common_expression AS column_alias */ - 478, /* (541) select_item ::= table_name NK_DOT NK_STAR */ - 417, /* (542) where_clause_opt ::= */ - 417, /* (543) where_clause_opt ::= WHERE search_condition */ - 471, /* (544) partition_by_clause_opt ::= */ - 471, /* (545) partition_by_clause_opt ::= PARTITION BY partition_list */ - 479, /* (546) partition_list ::= partition_item */ - 479, /* (547) partition_list ::= partition_list NK_COMMA partition_item */ - 480, /* (548) partition_item ::= expr_or_subquery */ - 480, /* (549) partition_item ::= expr_or_subquery column_alias */ - 480, /* (550) partition_item ::= expr_or_subquery AS column_alias */ - 475, /* (551) twindow_clause_opt ::= */ - 475, /* (552) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - 475, /* (553) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - 475, /* (554) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - 475, /* (555) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - 475, /* (556) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 411, /* (557) sliding_opt ::= */ - 411, /* (558) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - 474, /* (559) fill_opt ::= */ - 474, /* (560) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - 474, /* (561) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - 474, /* (562) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - 481, /* (563) fill_mode ::= NONE */ - 481, /* (564) fill_mode ::= PREV */ - 481, /* (565) fill_mode ::= NULL */ - 481, /* (566) fill_mode ::= NULL_F */ - 481, /* (567) fill_mode ::= LINEAR */ - 481, /* (568) fill_mode ::= NEXT */ - 476, /* (569) group_by_clause_opt ::= */ - 476, /* (570) group_by_clause_opt ::= GROUP BY group_by_list */ - 482, /* (571) group_by_list ::= expr_or_subquery */ - 482, /* (572) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 477, /* (573) having_clause_opt ::= */ - 477, /* (574) having_clause_opt ::= HAVING search_condition */ - 472, /* (575) range_opt ::= */ - 472, /* (576) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - 472, /* (577) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 473, /* (578) every_opt ::= */ - 473, /* (579) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - 483, /* (580) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - 484, /* (581) query_simple ::= query_specification */ - 484, /* (582) query_simple ::= union_query_expression */ - 488, /* (583) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - 488, /* (584) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - 489, /* (585) query_simple_or_subquery ::= query_simple */ - 489, /* (586) query_simple_or_subquery ::= subquery */ - 416, /* (587) query_or_subquery ::= query_expression */ - 416, /* (588) query_or_subquery ::= subquery */ - 485, /* (589) order_by_clause_opt ::= */ - 485, /* (590) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 486, /* (591) slimit_clause_opt ::= */ - 486, /* (592) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - 486, /* (593) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - 486, /* (594) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 487, /* (595) limit_clause_opt ::= */ - 487, /* (596) limit_clause_opt ::= LIMIT NK_INTEGER */ - 487, /* (597) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - 487, /* (598) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 463, /* (599) subquery ::= NK_LP query_expression NK_RP */ - 463, /* (600) subquery ::= NK_LP subquery NK_RP */ - 358, /* (601) search_condition ::= common_expression */ - 490, /* (602) sort_specification_list ::= sort_specification */ - 490, /* (603) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - 491, /* (604) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 492, /* (605) ordering_specification_opt ::= */ - 492, /* (606) ordering_specification_opt ::= ASC */ - 492, /* (607) ordering_specification_opt ::= DESC */ - 493, /* (608) null_ordering_opt ::= */ - 493, /* (609) null_ordering_opt ::= NULLS FIRST */ - 493, /* (610) null_ordering_opt ::= NULLS LAST */ + 343, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + 343, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + 344, /* (2) account_options ::= */ + 344, /* (3) account_options ::= account_options PPS literal */ + 344, /* (4) account_options ::= account_options TSERIES literal */ + 344, /* (5) account_options ::= account_options STORAGE literal */ + 344, /* (6) account_options ::= account_options STREAMS literal */ + 344, /* (7) account_options ::= account_options QTIME literal */ + 344, /* (8) account_options ::= account_options DBS literal */ + 344, /* (9) account_options ::= account_options USERS literal */ + 344, /* (10) account_options ::= account_options CONNS literal */ + 344, /* (11) account_options ::= account_options STATE literal */ + 345, /* (12) alter_account_options ::= alter_account_option */ + 345, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + 347, /* (14) alter_account_option ::= PASS literal */ + 347, /* (15) alter_account_option ::= PPS literal */ + 347, /* (16) alter_account_option ::= TSERIES literal */ + 347, /* (17) alter_account_option ::= STORAGE literal */ + 347, /* (18) alter_account_option ::= STREAMS literal */ + 347, /* (19) alter_account_option ::= QTIME literal */ + 347, /* (20) alter_account_option ::= DBS literal */ + 347, /* (21) alter_account_option ::= USERS literal */ + 347, /* (22) alter_account_option ::= CONNS literal */ + 347, /* (23) alter_account_option ::= STATE literal */ + 348, /* (24) ip_range_list ::= NK_STRING */ + 348, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ + 349, /* (26) white_list ::= HOST ip_range_list */ + 350, /* (27) white_list_opt ::= */ + 350, /* (28) white_list_opt ::= white_list */ + 343, /* (29) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt white_list_opt */ + 343, /* (30) cmd ::= ALTER USER user_name PASS NK_STRING */ + 343, /* (31) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ + 343, /* (32) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ + 343, /* (33) cmd ::= ALTER USER user_name ADD white_list */ + 343, /* (34) cmd ::= ALTER USER user_name DROP white_list */ + 343, /* (35) cmd ::= DROP USER user_name */ + 352, /* (36) sysinfo_opt ::= */ + 352, /* (37) sysinfo_opt ::= SYSINFO NK_INTEGER */ + 343, /* (38) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ + 343, /* (39) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ + 353, /* (40) privileges ::= ALL */ + 353, /* (41) privileges ::= priv_type_list */ + 353, /* (42) privileges ::= SUBSCRIBE */ + 356, /* (43) priv_type_list ::= priv_type */ + 356, /* (44) priv_type_list ::= priv_type_list NK_COMMA priv_type */ + 357, /* (45) priv_type ::= READ */ + 357, /* (46) priv_type ::= WRITE */ + 354, /* (47) priv_level ::= NK_STAR NK_DOT NK_STAR */ + 354, /* (48) priv_level ::= db_name NK_DOT NK_STAR */ + 354, /* (49) priv_level ::= db_name NK_DOT table_name */ + 354, /* (50) priv_level ::= topic_name */ + 355, /* (51) with_opt ::= */ + 355, /* (52) with_opt ::= WITH search_condition */ + 343, /* (53) cmd ::= CREATE DNODE dnode_endpoint */ + 343, /* (54) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ + 343, /* (55) cmd ::= DROP DNODE NK_INTEGER force_opt */ + 343, /* (56) cmd ::= DROP DNODE dnode_endpoint force_opt */ + 343, /* (57) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ + 343, /* (58) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ + 343, /* (59) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + 343, /* (60) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + 343, /* (61) cmd ::= ALTER ALL DNODES NK_STRING */ + 343, /* (62) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + 343, /* (63) cmd ::= RESTORE DNODE NK_INTEGER */ + 362, /* (64) dnode_endpoint ::= NK_STRING */ + 362, /* (65) dnode_endpoint ::= NK_ID */ + 362, /* (66) dnode_endpoint ::= NK_IPTOKEN */ + 363, /* (67) force_opt ::= */ + 363, /* (68) force_opt ::= FORCE */ + 364, /* (69) unsafe_opt ::= UNSAFE */ + 343, /* (70) cmd ::= ALTER LOCAL NK_STRING */ + 343, /* (71) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + 343, /* (72) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + 343, /* (73) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + 343, /* (74) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ + 343, /* (75) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + 343, /* (76) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + 343, /* (77) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + 343, /* (78) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + 343, /* (79) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + 343, /* (80) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + 343, /* (81) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ + 343, /* (82) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ + 343, /* (83) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + 343, /* (84) cmd ::= DROP DATABASE exists_opt db_name */ + 343, /* (85) cmd ::= USE db_name */ + 343, /* (86) cmd ::= ALTER DATABASE db_name alter_db_options */ + 343, /* (87) cmd ::= FLUSH DATABASE db_name */ + 343, /* (88) cmd ::= TRIM DATABASE db_name speed_opt */ + 343, /* (89) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ + 365, /* (90) not_exists_opt ::= IF NOT EXISTS */ + 365, /* (91) not_exists_opt ::= */ + 367, /* (92) exists_opt ::= IF EXISTS */ + 367, /* (93) exists_opt ::= */ + 366, /* (94) db_options ::= */ + 366, /* (95) db_options ::= db_options BUFFER NK_INTEGER */ + 366, /* (96) db_options ::= db_options CACHEMODEL NK_STRING */ + 366, /* (97) db_options ::= db_options CACHESIZE NK_INTEGER */ + 366, /* (98) db_options ::= db_options COMP NK_INTEGER */ + 366, /* (99) db_options ::= db_options DURATION NK_INTEGER */ + 366, /* (100) db_options ::= db_options DURATION NK_VARIABLE */ + 366, /* (101) db_options ::= db_options MAXROWS NK_INTEGER */ + 366, /* (102) db_options ::= db_options MINROWS NK_INTEGER */ + 366, /* (103) db_options ::= db_options KEEP integer_list */ + 366, /* (104) db_options ::= db_options KEEP variable_list */ + 366, /* (105) db_options ::= db_options PAGES NK_INTEGER */ + 366, /* (106) db_options ::= db_options PAGESIZE NK_INTEGER */ + 366, /* (107) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ + 366, /* (108) db_options ::= db_options PRECISION NK_STRING */ + 366, /* (109) db_options ::= db_options REPLICA NK_INTEGER */ + 366, /* (110) db_options ::= db_options VGROUPS NK_INTEGER */ + 366, /* (111) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + 366, /* (112) db_options ::= db_options RETENTIONS retention_list */ + 366, /* (113) db_options ::= db_options SCHEMALESS NK_INTEGER */ + 366, /* (114) db_options ::= db_options WAL_LEVEL NK_INTEGER */ + 366, /* (115) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ + 366, /* (116) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ + 366, /* (117) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + 366, /* (118) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ + 366, /* (119) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + 366, /* (120) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ + 366, /* (121) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ + 366, /* (122) db_options ::= db_options STT_TRIGGER NK_INTEGER */ + 366, /* (123) db_options ::= db_options TABLE_PREFIX signed */ + 366, /* (124) db_options ::= db_options TABLE_SUFFIX signed */ + 368, /* (125) alter_db_options ::= alter_db_option */ + 368, /* (126) alter_db_options ::= alter_db_options alter_db_option */ + 376, /* (127) alter_db_option ::= BUFFER NK_INTEGER */ + 376, /* (128) alter_db_option ::= CACHEMODEL NK_STRING */ + 376, /* (129) alter_db_option ::= CACHESIZE NK_INTEGER */ + 376, /* (130) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ + 376, /* (131) alter_db_option ::= KEEP integer_list */ + 376, /* (132) alter_db_option ::= KEEP variable_list */ + 376, /* (133) alter_db_option ::= PAGES NK_INTEGER */ + 376, /* (134) alter_db_option ::= REPLICA NK_INTEGER */ + 376, /* (135) alter_db_option ::= WAL_LEVEL NK_INTEGER */ + 376, /* (136) alter_db_option ::= STT_TRIGGER NK_INTEGER */ + 376, /* (137) alter_db_option ::= MINROWS NK_INTEGER */ + 376, /* (138) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ + 376, /* (139) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + 376, /* (140) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ + 376, /* (141) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + 372, /* (142) integer_list ::= NK_INTEGER */ + 372, /* (143) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + 373, /* (144) variable_list ::= NK_VARIABLE */ + 373, /* (145) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + 374, /* (146) retention_list ::= retention */ + 374, /* (147) retention_list ::= retention_list NK_COMMA retention */ + 377, /* (148) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + 369, /* (149) speed_opt ::= */ + 369, /* (150) speed_opt ::= BWLIMIT NK_INTEGER */ + 370, /* (151) start_opt ::= */ + 370, /* (152) start_opt ::= START WITH NK_INTEGER */ + 370, /* (153) start_opt ::= START WITH NK_STRING */ + 370, /* (154) start_opt ::= START WITH TIMESTAMP NK_STRING */ + 371, /* (155) end_opt ::= */ + 371, /* (156) end_opt ::= END WITH NK_INTEGER */ + 371, /* (157) end_opt ::= END WITH NK_STRING */ + 371, /* (158) end_opt ::= END WITH TIMESTAMP NK_STRING */ + 343, /* (159) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + 343, /* (160) cmd ::= CREATE TABLE multi_create_clause */ + 343, /* (161) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + 343, /* (162) cmd ::= DROP TABLE multi_drop_clause */ + 343, /* (163) cmd ::= DROP STABLE exists_opt full_table_name */ + 343, /* (164) cmd ::= ALTER TABLE alter_table_clause */ + 343, /* (165) cmd ::= ALTER STABLE alter_table_clause */ + 385, /* (166) alter_table_clause ::= full_table_name alter_table_options */ + 385, /* (167) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + 385, /* (168) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + 385, /* (169) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + 385, /* (170) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + 385, /* (171) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + 385, /* (172) alter_table_clause ::= full_table_name DROP TAG column_name */ + 385, /* (173) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + 385, /* (174) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + 385, /* (175) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + 382, /* (176) multi_create_clause ::= create_subtable_clause */ + 382, /* (177) multi_create_clause ::= multi_create_clause create_subtable_clause */ + 390, /* (178) 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 */ + 384, /* (179) multi_drop_clause ::= drop_table_clause */ + 384, /* (180) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ + 393, /* (181) drop_table_clause ::= exists_opt full_table_name */ + 391, /* (182) specific_cols_opt ::= */ + 391, /* (183) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + 378, /* (184) full_table_name ::= table_name */ + 378, /* (185) full_table_name ::= db_name NK_DOT table_name */ + 379, /* (186) column_def_list ::= column_def */ + 379, /* (187) column_def_list ::= column_def_list NK_COMMA column_def */ + 395, /* (188) column_def ::= column_name type_name */ + 388, /* (189) type_name ::= BOOL */ + 388, /* (190) type_name ::= TINYINT */ + 388, /* (191) type_name ::= SMALLINT */ + 388, /* (192) type_name ::= INT */ + 388, /* (193) type_name ::= INTEGER */ + 388, /* (194) type_name ::= BIGINT */ + 388, /* (195) type_name ::= FLOAT */ + 388, /* (196) type_name ::= DOUBLE */ + 388, /* (197) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + 388, /* (198) type_name ::= TIMESTAMP */ + 388, /* (199) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + 388, /* (200) type_name ::= TINYINT UNSIGNED */ + 388, /* (201) type_name ::= SMALLINT UNSIGNED */ + 388, /* (202) type_name ::= INT UNSIGNED */ + 388, /* (203) type_name ::= BIGINT UNSIGNED */ + 388, /* (204) type_name ::= JSON */ + 388, /* (205) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + 388, /* (206) type_name ::= MEDIUMBLOB */ + 388, /* (207) type_name ::= BLOB */ + 388, /* (208) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + 388, /* (209) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + 388, /* (210) type_name ::= DECIMAL */ + 388, /* (211) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + 388, /* (212) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 380, /* (213) tags_def_opt ::= */ + 380, /* (214) tags_def_opt ::= tags_def */ + 383, /* (215) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + 381, /* (216) table_options ::= */ + 381, /* (217) table_options ::= table_options COMMENT NK_STRING */ + 381, /* (218) table_options ::= table_options MAX_DELAY duration_list */ + 381, /* (219) table_options ::= table_options WATERMARK duration_list */ + 381, /* (220) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + 381, /* (221) table_options ::= table_options TTL NK_INTEGER */ + 381, /* (222) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + 381, /* (223) table_options ::= table_options DELETE_MARK duration_list */ + 386, /* (224) alter_table_options ::= alter_table_option */ + 386, /* (225) alter_table_options ::= alter_table_options alter_table_option */ + 398, /* (226) alter_table_option ::= COMMENT NK_STRING */ + 398, /* (227) alter_table_option ::= TTL NK_INTEGER */ + 396, /* (228) duration_list ::= duration_literal */ + 396, /* (229) duration_list ::= duration_list NK_COMMA duration_literal */ + 397, /* (230) rollup_func_list ::= rollup_func_name */ + 397, /* (231) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + 400, /* (232) rollup_func_name ::= function_name */ + 400, /* (233) rollup_func_name ::= FIRST */ + 400, /* (234) rollup_func_name ::= LAST */ + 394, /* (235) col_name_list ::= col_name */ + 394, /* (236) col_name_list ::= col_name_list NK_COMMA col_name */ + 402, /* (237) col_name ::= column_name */ + 343, /* (238) cmd ::= SHOW DNODES */ + 343, /* (239) cmd ::= SHOW USERS */ + 343, /* (240) cmd ::= SHOW USER PRIVILEGES */ + 343, /* (241) cmd ::= SHOW db_kind_opt DATABASES */ + 343, /* (242) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ + 343, /* (243) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + 343, /* (244) cmd ::= SHOW db_name_cond_opt VGROUPS */ + 343, /* (245) cmd ::= SHOW MNODES */ + 343, /* (246) cmd ::= SHOW QNODES */ + 343, /* (247) cmd ::= SHOW FUNCTIONS */ + 343, /* (248) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + 343, /* (249) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + 343, /* (250) cmd ::= SHOW STREAMS */ + 343, /* (251) cmd ::= SHOW ACCOUNTS */ + 343, /* (252) cmd ::= SHOW APPS */ + 343, /* (253) cmd ::= SHOW CONNECTIONS */ + 343, /* (254) cmd ::= SHOW LICENCES */ + 343, /* (255) cmd ::= SHOW GRANTS */ + 343, /* (256) cmd ::= SHOW CREATE DATABASE db_name */ + 343, /* (257) cmd ::= SHOW CREATE TABLE full_table_name */ + 343, /* (258) cmd ::= SHOW CREATE STABLE full_table_name */ + 343, /* (259) cmd ::= SHOW QUERIES */ + 343, /* (260) cmd ::= SHOW SCORES */ + 343, /* (261) cmd ::= SHOW TOPICS */ + 343, /* (262) cmd ::= SHOW VARIABLES */ + 343, /* (263) cmd ::= SHOW CLUSTER VARIABLES */ + 343, /* (264) cmd ::= SHOW LOCAL VARIABLES */ + 343, /* (265) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + 343, /* (266) cmd ::= SHOW BNODES */ + 343, /* (267) cmd ::= SHOW SNODES */ + 343, /* (268) cmd ::= SHOW CLUSTER */ + 343, /* (269) cmd ::= SHOW TRANSACTIONS */ + 343, /* (270) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + 343, /* (271) cmd ::= SHOW CONSUMERS */ + 343, /* (272) cmd ::= SHOW SUBSCRIPTIONS */ + 343, /* (273) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + 343, /* (274) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + 343, /* (275) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + 343, /* (276) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + 343, /* (277) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + 343, /* (278) cmd ::= SHOW VNODES */ + 343, /* (279) cmd ::= SHOW db_name_cond_opt ALIVE */ + 343, /* (280) cmd ::= SHOW CLUSTER ALIVE */ + 404, /* (281) table_kind_db_name_cond_opt ::= */ + 404, /* (282) table_kind_db_name_cond_opt ::= table_kind */ + 404, /* (283) table_kind_db_name_cond_opt ::= db_name NK_DOT */ + 404, /* (284) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ + 410, /* (285) table_kind ::= NORMAL */ + 410, /* (286) table_kind ::= CHILD */ + 406, /* (287) db_name_cond_opt ::= */ + 406, /* (288) db_name_cond_opt ::= db_name NK_DOT */ + 405, /* (289) like_pattern_opt ::= */ + 405, /* (290) like_pattern_opt ::= LIKE NK_STRING */ + 407, /* (291) table_name_cond ::= table_name */ + 408, /* (292) from_db_opt ::= */ + 408, /* (293) from_db_opt ::= FROM db_name */ + 409, /* (294) tag_list_opt ::= */ + 409, /* (295) tag_list_opt ::= tag_item */ + 409, /* (296) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + 411, /* (297) tag_item ::= TBNAME */ + 411, /* (298) tag_item ::= QTAGS */ + 411, /* (299) tag_item ::= column_name */ + 411, /* (300) tag_item ::= column_name column_alias */ + 411, /* (301) tag_item ::= column_name AS column_alias */ + 403, /* (302) db_kind_opt ::= */ + 403, /* (303) db_kind_opt ::= USER */ + 403, /* (304) db_kind_opt ::= SYSTEM */ + 343, /* (305) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ + 343, /* (306) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ + 343, /* (307) cmd ::= DROP INDEX exists_opt full_index_name */ + 414, /* (308) full_index_name ::= index_name */ + 414, /* (309) full_index_name ::= db_name NK_DOT index_name */ + 413, /* (310) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + 413, /* (311) 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 */ + 416, /* (312) func_list ::= func */ + 416, /* (313) func_list ::= func_list NK_COMMA func */ + 419, /* (314) func ::= sma_func_name NK_LP expression_list NK_RP */ + 420, /* (315) sma_func_name ::= function_name */ + 420, /* (316) sma_func_name ::= COUNT */ + 420, /* (317) sma_func_name ::= FIRST */ + 420, /* (318) sma_func_name ::= LAST */ + 420, /* (319) sma_func_name ::= LAST_ROW */ + 418, /* (320) sma_stream_opt ::= */ + 418, /* (321) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + 418, /* (322) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + 418, /* (323) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + 421, /* (324) with_meta ::= AS */ + 421, /* (325) with_meta ::= WITH META AS */ + 421, /* (326) with_meta ::= ONLY META AS */ + 343, /* (327) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + 343, /* (328) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + 343, /* (329) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + 343, /* (330) cmd ::= DROP TOPIC exists_opt topic_name */ + 343, /* (331) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + 343, /* (332) cmd ::= DESC full_table_name */ + 343, /* (333) cmd ::= DESCRIBE full_table_name */ + 343, /* (334) cmd ::= RESET QUERY CACHE */ + 343, /* (335) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + 343, /* (336) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 425, /* (337) analyze_opt ::= */ + 425, /* (338) analyze_opt ::= ANALYZE */ + 426, /* (339) explain_options ::= */ + 426, /* (340) explain_options ::= explain_options VERBOSE NK_BOOL */ + 426, /* (341) explain_options ::= explain_options RATIO NK_FLOAT */ + 343, /* (342) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + 343, /* (343) cmd ::= DROP FUNCTION exists_opt function_name */ + 429, /* (344) agg_func_opt ::= */ + 429, /* (345) agg_func_opt ::= AGGREGATE */ + 430, /* (346) bufsize_opt ::= */ + 430, /* (347) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 431, /* (348) language_opt ::= */ + 431, /* (349) language_opt ::= LANGUAGE NK_STRING */ + 428, /* (350) or_replace_opt ::= */ + 428, /* (351) or_replace_opt ::= OR REPLACE */ + 343, /* (352) 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 */ + 343, /* (353) cmd ::= DROP STREAM exists_opt stream_name */ + 343, /* (354) cmd ::= PAUSE STREAM exists_opt stream_name */ + 343, /* (355) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 434, /* (356) col_list_opt ::= */ + 434, /* (357) col_list_opt ::= NK_LP col_name_list NK_RP */ + 435, /* (358) tag_def_or_ref_opt ::= */ + 435, /* (359) tag_def_or_ref_opt ::= tags_def */ + 435, /* (360) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ + 433, /* (361) stream_options ::= */ + 433, /* (362) stream_options ::= stream_options TRIGGER AT_ONCE */ + 433, /* (363) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + 433, /* (364) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + 433, /* (365) stream_options ::= stream_options WATERMARK duration_literal */ + 433, /* (366) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + 433, /* (367) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + 433, /* (368) stream_options ::= stream_options DELETE_MARK duration_literal */ + 433, /* (369) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 436, /* (370) subtable_opt ::= */ + 436, /* (371) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 437, /* (372) ignore_opt ::= */ + 437, /* (373) ignore_opt ::= IGNORE UNTREATED */ + 343, /* (374) cmd ::= KILL CONNECTION NK_INTEGER */ + 343, /* (375) cmd ::= KILL QUERY NK_STRING */ + 343, /* (376) cmd ::= KILL TRANSACTION NK_INTEGER */ + 343, /* (377) cmd ::= BALANCE VGROUP */ + 343, /* (378) cmd ::= BALANCE VGROUP LEADER */ + 343, /* (379) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + 343, /* (380) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + 343, /* (381) cmd ::= SPLIT VGROUP NK_INTEGER */ + 439, /* (382) dnode_list ::= DNODE NK_INTEGER */ + 439, /* (383) dnode_list ::= dnode_list DNODE NK_INTEGER */ + 343, /* (384) cmd ::= DELETE FROM full_table_name where_clause_opt */ + 343, /* (385) cmd ::= query_or_subquery */ + 343, /* (386) cmd ::= insert_query */ + 427, /* (387) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + 427, /* (388) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + 346, /* (389) literal ::= NK_INTEGER */ + 346, /* (390) literal ::= NK_FLOAT */ + 346, /* (391) literal ::= NK_STRING */ + 346, /* (392) literal ::= NK_BOOL */ + 346, /* (393) literal ::= TIMESTAMP NK_STRING */ + 346, /* (394) literal ::= duration_literal */ + 346, /* (395) literal ::= NULL */ + 346, /* (396) literal ::= NK_QUESTION */ + 399, /* (397) duration_literal ::= NK_VARIABLE */ + 375, /* (398) signed ::= NK_INTEGER */ + 375, /* (399) signed ::= NK_PLUS NK_INTEGER */ + 375, /* (400) signed ::= NK_MINUS NK_INTEGER */ + 375, /* (401) signed ::= NK_FLOAT */ + 375, /* (402) signed ::= NK_PLUS NK_FLOAT */ + 375, /* (403) signed ::= NK_MINUS NK_FLOAT */ + 389, /* (404) signed_literal ::= signed */ + 389, /* (405) signed_literal ::= NK_STRING */ + 389, /* (406) signed_literal ::= NK_BOOL */ + 389, /* (407) signed_literal ::= TIMESTAMP NK_STRING */ + 389, /* (408) signed_literal ::= duration_literal */ + 389, /* (409) signed_literal ::= NULL */ + 389, /* (410) signed_literal ::= literal_func */ + 389, /* (411) signed_literal ::= NK_QUESTION */ + 441, /* (412) literal_list ::= signed_literal */ + 441, /* (413) literal_list ::= literal_list NK_COMMA signed_literal */ + 358, /* (414) db_name ::= NK_ID */ + 359, /* (415) table_name ::= NK_ID */ + 387, /* (416) column_name ::= NK_ID */ + 401, /* (417) function_name ::= NK_ID */ + 442, /* (418) table_alias ::= NK_ID */ + 412, /* (419) column_alias ::= NK_ID */ + 351, /* (420) user_name ::= NK_ID */ + 360, /* (421) topic_name ::= NK_ID */ + 432, /* (422) stream_name ::= NK_ID */ + 424, /* (423) cgroup_name ::= NK_ID */ + 415, /* (424) index_name ::= NK_ID */ + 443, /* (425) expr_or_subquery ::= expression */ + 438, /* (426) expression ::= literal */ + 438, /* (427) expression ::= pseudo_column */ + 438, /* (428) expression ::= column_reference */ + 438, /* (429) expression ::= function_expression */ + 438, /* (430) expression ::= case_when_expression */ + 438, /* (431) expression ::= NK_LP expression NK_RP */ + 438, /* (432) expression ::= NK_PLUS expr_or_subquery */ + 438, /* (433) expression ::= NK_MINUS expr_or_subquery */ + 438, /* (434) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + 438, /* (435) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + 438, /* (436) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + 438, /* (437) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + 438, /* (438) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + 438, /* (439) expression ::= column_reference NK_ARROW NK_STRING */ + 438, /* (440) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + 438, /* (441) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + 392, /* (442) expression_list ::= expr_or_subquery */ + 392, /* (443) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + 445, /* (444) column_reference ::= column_name */ + 445, /* (445) column_reference ::= table_name NK_DOT column_name */ + 444, /* (446) pseudo_column ::= ROWTS */ + 444, /* (447) pseudo_column ::= TBNAME */ + 444, /* (448) pseudo_column ::= table_name NK_DOT TBNAME */ + 444, /* (449) pseudo_column ::= QSTART */ + 444, /* (450) pseudo_column ::= QEND */ + 444, /* (451) pseudo_column ::= QDURATION */ + 444, /* (452) pseudo_column ::= WSTART */ + 444, /* (453) pseudo_column ::= WEND */ + 444, /* (454) pseudo_column ::= WDURATION */ + 444, /* (455) pseudo_column ::= IROWTS */ + 444, /* (456) pseudo_column ::= ISFILLED */ + 444, /* (457) pseudo_column ::= QTAGS */ + 446, /* (458) function_expression ::= function_name NK_LP expression_list NK_RP */ + 446, /* (459) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + 446, /* (460) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + 446, /* (461) function_expression ::= literal_func */ + 440, /* (462) literal_func ::= noarg_func NK_LP NK_RP */ + 440, /* (463) literal_func ::= NOW */ + 450, /* (464) noarg_func ::= NOW */ + 450, /* (465) noarg_func ::= TODAY */ + 450, /* (466) noarg_func ::= TIMEZONE */ + 450, /* (467) noarg_func ::= DATABASE */ + 450, /* (468) noarg_func ::= CLIENT_VERSION */ + 450, /* (469) noarg_func ::= SERVER_VERSION */ + 450, /* (470) noarg_func ::= SERVER_STATUS */ + 450, /* (471) noarg_func ::= CURRENT_USER */ + 450, /* (472) noarg_func ::= USER */ + 448, /* (473) star_func ::= COUNT */ + 448, /* (474) star_func ::= FIRST */ + 448, /* (475) star_func ::= LAST */ + 448, /* (476) star_func ::= LAST_ROW */ + 449, /* (477) star_func_para_list ::= NK_STAR */ + 449, /* (478) star_func_para_list ::= other_para_list */ + 451, /* (479) other_para_list ::= star_func_para */ + 451, /* (480) other_para_list ::= other_para_list NK_COMMA star_func_para */ + 452, /* (481) star_func_para ::= expr_or_subquery */ + 452, /* (482) star_func_para ::= table_name NK_DOT NK_STAR */ + 447, /* (483) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + 447, /* (484) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + 453, /* (485) when_then_list ::= when_then_expr */ + 453, /* (486) when_then_list ::= when_then_list when_then_expr */ + 456, /* (487) when_then_expr ::= WHEN common_expression THEN common_expression */ + 454, /* (488) case_when_else_opt ::= */ + 454, /* (489) case_when_else_opt ::= ELSE common_expression */ + 457, /* (490) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + 457, /* (491) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + 457, /* (492) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + 457, /* (493) predicate ::= expr_or_subquery IS NULL */ + 457, /* (494) predicate ::= expr_or_subquery IS NOT NULL */ + 457, /* (495) predicate ::= expr_or_subquery in_op in_predicate_value */ + 458, /* (496) compare_op ::= NK_LT */ + 458, /* (497) compare_op ::= NK_GT */ + 458, /* (498) compare_op ::= NK_LE */ + 458, /* (499) compare_op ::= NK_GE */ + 458, /* (500) compare_op ::= NK_NE */ + 458, /* (501) compare_op ::= NK_EQ */ + 458, /* (502) compare_op ::= LIKE */ + 458, /* (503) compare_op ::= NOT LIKE */ + 458, /* (504) compare_op ::= MATCH */ + 458, /* (505) compare_op ::= NMATCH */ + 458, /* (506) compare_op ::= CONTAINS */ + 459, /* (507) in_op ::= IN */ + 459, /* (508) in_op ::= NOT IN */ + 460, /* (509) in_predicate_value ::= NK_LP literal_list NK_RP */ + 461, /* (510) boolean_value_expression ::= boolean_primary */ + 461, /* (511) boolean_value_expression ::= NOT boolean_primary */ + 461, /* (512) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + 461, /* (513) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + 462, /* (514) boolean_primary ::= predicate */ + 462, /* (515) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + 455, /* (516) common_expression ::= expr_or_subquery */ + 455, /* (517) common_expression ::= boolean_value_expression */ + 463, /* (518) from_clause_opt ::= */ + 463, /* (519) from_clause_opt ::= FROM table_reference_list */ + 464, /* (520) table_reference_list ::= table_reference */ + 464, /* (521) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + 465, /* (522) table_reference ::= table_primary */ + 465, /* (523) table_reference ::= joined_table */ + 466, /* (524) table_primary ::= table_name alias_opt */ + 466, /* (525) table_primary ::= db_name NK_DOT table_name alias_opt */ + 466, /* (526) table_primary ::= subquery alias_opt */ + 466, /* (527) table_primary ::= parenthesized_joined_table */ + 468, /* (528) alias_opt ::= */ + 468, /* (529) alias_opt ::= table_alias */ + 468, /* (530) alias_opt ::= AS table_alias */ + 470, /* (531) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + 470, /* (532) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + 467, /* (533) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + 471, /* (534) join_type ::= */ + 471, /* (535) join_type ::= INNER */ + 472, /* (536) 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 */ + 473, /* (537) hint_list ::= */ + 473, /* (538) hint_list ::= NK_HINT */ + 475, /* (539) tag_mode_opt ::= */ + 475, /* (540) tag_mode_opt ::= TAGS */ + 474, /* (541) set_quantifier_opt ::= */ + 474, /* (542) set_quantifier_opt ::= DISTINCT */ + 474, /* (543) set_quantifier_opt ::= ALL */ + 476, /* (544) select_list ::= select_item */ + 476, /* (545) select_list ::= select_list NK_COMMA select_item */ + 484, /* (546) select_item ::= NK_STAR */ + 484, /* (547) select_item ::= common_expression */ + 484, /* (548) select_item ::= common_expression column_alias */ + 484, /* (549) select_item ::= common_expression AS column_alias */ + 484, /* (550) select_item ::= table_name NK_DOT NK_STAR */ + 423, /* (551) where_clause_opt ::= */ + 423, /* (552) where_clause_opt ::= WHERE search_condition */ + 477, /* (553) partition_by_clause_opt ::= */ + 477, /* (554) partition_by_clause_opt ::= PARTITION BY partition_list */ + 485, /* (555) partition_list ::= partition_item */ + 485, /* (556) partition_list ::= partition_list NK_COMMA partition_item */ + 486, /* (557) partition_item ::= expr_or_subquery */ + 486, /* (558) partition_item ::= expr_or_subquery column_alias */ + 486, /* (559) partition_item ::= expr_or_subquery AS column_alias */ + 481, /* (560) twindow_clause_opt ::= */ + 481, /* (561) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + 481, /* (562) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + 481, /* (563) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + 481, /* (564) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + 481, /* (565) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 417, /* (566) sliding_opt ::= */ + 417, /* (567) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + 480, /* (568) fill_opt ::= */ + 480, /* (569) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + 480, /* (570) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + 480, /* (571) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + 487, /* (572) fill_mode ::= NONE */ + 487, /* (573) fill_mode ::= PREV */ + 487, /* (574) fill_mode ::= NULL */ + 487, /* (575) fill_mode ::= NULL_F */ + 487, /* (576) fill_mode ::= LINEAR */ + 487, /* (577) fill_mode ::= NEXT */ + 482, /* (578) group_by_clause_opt ::= */ + 482, /* (579) group_by_clause_opt ::= GROUP BY group_by_list */ + 488, /* (580) group_by_list ::= expr_or_subquery */ + 488, /* (581) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 483, /* (582) having_clause_opt ::= */ + 483, /* (583) having_clause_opt ::= HAVING search_condition */ + 478, /* (584) range_opt ::= */ + 478, /* (585) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + 478, /* (586) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 479, /* (587) every_opt ::= */ + 479, /* (588) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + 489, /* (589) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + 490, /* (590) query_simple ::= query_specification */ + 490, /* (591) query_simple ::= union_query_expression */ + 494, /* (592) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + 494, /* (593) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + 495, /* (594) query_simple_or_subquery ::= query_simple */ + 495, /* (595) query_simple_or_subquery ::= subquery */ + 422, /* (596) query_or_subquery ::= query_expression */ + 422, /* (597) query_or_subquery ::= subquery */ + 491, /* (598) order_by_clause_opt ::= */ + 491, /* (599) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 492, /* (600) slimit_clause_opt ::= */ + 492, /* (601) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + 492, /* (602) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + 492, /* (603) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 493, /* (604) limit_clause_opt ::= */ + 493, /* (605) limit_clause_opt ::= LIMIT NK_INTEGER */ + 493, /* (606) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + 493, /* (607) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 469, /* (608) subquery ::= NK_LP query_expression NK_RP */ + 469, /* (609) subquery ::= NK_LP subquery NK_RP */ + 361, /* (610) search_condition ::= common_expression */ + 496, /* (611) sort_specification_list ::= sort_specification */ + 496, /* (612) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + 497, /* (613) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 498, /* (614) ordering_specification_opt ::= */ + 498, /* (615) ordering_specification_opt ::= ASC */ + 498, /* (616) ordering_specification_opt ::= DESC */ + 499, /* (617) null_ordering_opt ::= */ + 499, /* (618) null_ordering_opt ::= NULLS FIRST */ + 499, /* (619) null_ordering_opt ::= NULLS LAST */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -4438,8 +4543,8 @@ static const signed char yyRuleInfoNRhs[] = { -2, /* (238) cmd ::= SHOW DNODES */ -2, /* (239) cmd ::= SHOW USERS */ -3, /* (240) cmd ::= SHOW USER PRIVILEGES */ - -2, /* (241) cmd ::= SHOW DATABASES */ - -4, /* (242) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + -3, /* (241) cmd ::= SHOW db_kind_opt DATABASES */ + -4, /* (242) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ -4, /* (243) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -3, /* (244) cmd ::= SHOW db_name_cond_opt VGROUPS */ -2, /* (245) cmd ::= SHOW MNODES */ @@ -4478,336 +4583,345 @@ static const signed char yyRuleInfoNRhs[] = { -2, /* (278) cmd ::= SHOW VNODES */ -3, /* (279) cmd ::= SHOW db_name_cond_opt ALIVE */ -3, /* (280) cmd ::= SHOW CLUSTER ALIVE */ - 0, /* (281) db_name_cond_opt ::= */ - -2, /* (282) db_name_cond_opt ::= db_name NK_DOT */ - 0, /* (283) like_pattern_opt ::= */ - -2, /* (284) like_pattern_opt ::= LIKE NK_STRING */ - -1, /* (285) table_name_cond ::= table_name */ - 0, /* (286) from_db_opt ::= */ - -2, /* (287) from_db_opt ::= FROM db_name */ - 0, /* (288) tag_list_opt ::= */ - -1, /* (289) tag_list_opt ::= tag_item */ - -3, /* (290) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - -1, /* (291) tag_item ::= TBNAME */ - -1, /* (292) tag_item ::= QTAGS */ - -1, /* (293) tag_item ::= column_name */ - -2, /* (294) tag_item ::= column_name column_alias */ - -3, /* (295) tag_item ::= column_name AS column_alias */ - -8, /* (296) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - -9, /* (297) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - -4, /* (298) cmd ::= DROP INDEX exists_opt full_index_name */ - -1, /* (299) full_index_name ::= index_name */ - -3, /* (300) full_index_name ::= db_name NK_DOT index_name */ - -10, /* (301) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - -12, /* (302) 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, /* (303) func_list ::= func */ - -3, /* (304) func_list ::= func_list NK_COMMA func */ - -4, /* (305) func ::= sma_func_name NK_LP expression_list NK_RP */ - -1, /* (306) sma_func_name ::= function_name */ - -1, /* (307) sma_func_name ::= COUNT */ - -1, /* (308) sma_func_name ::= FIRST */ - -1, /* (309) sma_func_name ::= LAST */ - -1, /* (310) sma_func_name ::= LAST_ROW */ - 0, /* (311) sma_stream_opt ::= */ - -3, /* (312) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - -3, /* (313) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - -3, /* (314) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - -1, /* (315) with_meta ::= AS */ - -3, /* (316) with_meta ::= WITH META AS */ - -3, /* (317) with_meta ::= ONLY META AS */ - -6, /* (318) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - -7, /* (319) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - -8, /* (320) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - -4, /* (321) cmd ::= DROP TOPIC exists_opt topic_name */ - -7, /* (322) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - -2, /* (323) cmd ::= DESC full_table_name */ - -2, /* (324) cmd ::= DESCRIBE full_table_name */ - -3, /* (325) cmd ::= RESET QUERY CACHE */ - -4, /* (326) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - -4, /* (327) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 0, /* (328) analyze_opt ::= */ - -1, /* (329) analyze_opt ::= ANALYZE */ - 0, /* (330) explain_options ::= */ - -3, /* (331) explain_options ::= explain_options VERBOSE NK_BOOL */ - -3, /* (332) explain_options ::= explain_options RATIO NK_FLOAT */ - -12, /* (333) 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, /* (334) cmd ::= DROP FUNCTION exists_opt function_name */ - 0, /* (335) agg_func_opt ::= */ - -1, /* (336) agg_func_opt ::= AGGREGATE */ - 0, /* (337) bufsize_opt ::= */ - -2, /* (338) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 0, /* (339) language_opt ::= */ - -2, /* (340) language_opt ::= LANGUAGE NK_STRING */ - 0, /* (341) or_replace_opt ::= */ - -2, /* (342) or_replace_opt ::= OR REPLACE */ - -12, /* (343) 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, /* (344) cmd ::= DROP STREAM exists_opt stream_name */ - -4, /* (345) cmd ::= PAUSE STREAM exists_opt stream_name */ - -5, /* (346) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 0, /* (347) col_list_opt ::= */ - -3, /* (348) col_list_opt ::= NK_LP col_name_list NK_RP */ - 0, /* (349) tag_def_or_ref_opt ::= */ - -1, /* (350) tag_def_or_ref_opt ::= tags_def */ - -4, /* (351) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - 0, /* (352) stream_options ::= */ - -3, /* (353) stream_options ::= stream_options TRIGGER AT_ONCE */ - -3, /* (354) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - -4, /* (355) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - -3, /* (356) stream_options ::= stream_options WATERMARK duration_literal */ - -4, /* (357) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - -3, /* (358) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - -3, /* (359) stream_options ::= stream_options DELETE_MARK duration_literal */ - -4, /* (360) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 0, /* (361) subtable_opt ::= */ - -4, /* (362) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 0, /* (363) ignore_opt ::= */ - -2, /* (364) ignore_opt ::= IGNORE UNTREATED */ - -3, /* (365) cmd ::= KILL CONNECTION NK_INTEGER */ - -3, /* (366) cmd ::= KILL QUERY NK_STRING */ - -3, /* (367) cmd ::= KILL TRANSACTION NK_INTEGER */ - -2, /* (368) cmd ::= BALANCE VGROUP */ - -3, /* (369) cmd ::= BALANCE VGROUP LEADER */ - -4, /* (370) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - -4, /* (371) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - -3, /* (372) cmd ::= SPLIT VGROUP NK_INTEGER */ - -2, /* (373) dnode_list ::= DNODE NK_INTEGER */ - -3, /* (374) dnode_list ::= dnode_list DNODE NK_INTEGER */ - -4, /* (375) cmd ::= DELETE FROM full_table_name where_clause_opt */ - -1, /* (376) cmd ::= query_or_subquery */ - -1, /* (377) cmd ::= insert_query */ - -7, /* (378) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - -4, /* (379) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - -1, /* (380) literal ::= NK_INTEGER */ - -1, /* (381) literal ::= NK_FLOAT */ - -1, /* (382) literal ::= NK_STRING */ - -1, /* (383) literal ::= NK_BOOL */ - -2, /* (384) literal ::= TIMESTAMP NK_STRING */ - -1, /* (385) literal ::= duration_literal */ - -1, /* (386) literal ::= NULL */ - -1, /* (387) literal ::= NK_QUESTION */ - -1, /* (388) duration_literal ::= NK_VARIABLE */ - -1, /* (389) signed ::= NK_INTEGER */ - -2, /* (390) signed ::= NK_PLUS NK_INTEGER */ - -2, /* (391) signed ::= NK_MINUS NK_INTEGER */ - -1, /* (392) signed ::= NK_FLOAT */ - -2, /* (393) signed ::= NK_PLUS NK_FLOAT */ - -2, /* (394) signed ::= NK_MINUS NK_FLOAT */ - -1, /* (395) signed_literal ::= signed */ - -1, /* (396) signed_literal ::= NK_STRING */ - -1, /* (397) signed_literal ::= NK_BOOL */ - -2, /* (398) signed_literal ::= TIMESTAMP NK_STRING */ - -1, /* (399) signed_literal ::= duration_literal */ - -1, /* (400) signed_literal ::= NULL */ - -1, /* (401) signed_literal ::= literal_func */ - -1, /* (402) signed_literal ::= NK_QUESTION */ - -1, /* (403) literal_list ::= signed_literal */ - -3, /* (404) literal_list ::= literal_list NK_COMMA signed_literal */ - -1, /* (405) db_name ::= NK_ID */ - -1, /* (406) table_name ::= NK_ID */ - -1, /* (407) column_name ::= NK_ID */ - -1, /* (408) function_name ::= NK_ID */ - -1, /* (409) table_alias ::= NK_ID */ - -1, /* (410) column_alias ::= NK_ID */ - -1, /* (411) user_name ::= NK_ID */ - -1, /* (412) topic_name ::= NK_ID */ - -1, /* (413) stream_name ::= NK_ID */ - -1, /* (414) cgroup_name ::= NK_ID */ - -1, /* (415) index_name ::= NK_ID */ - -1, /* (416) expr_or_subquery ::= expression */ - -1, /* (417) expression ::= literal */ - -1, /* (418) expression ::= pseudo_column */ - -1, /* (419) expression ::= column_reference */ - -1, /* (420) expression ::= function_expression */ - -1, /* (421) expression ::= case_when_expression */ - -3, /* (422) expression ::= NK_LP expression NK_RP */ - -2, /* (423) expression ::= NK_PLUS expr_or_subquery */ - -2, /* (424) expression ::= NK_MINUS expr_or_subquery */ - -3, /* (425) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - -3, /* (426) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - -3, /* (427) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - -3, /* (428) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - -3, /* (429) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - -3, /* (430) expression ::= column_reference NK_ARROW NK_STRING */ - -3, /* (431) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - -3, /* (432) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - -1, /* (433) expression_list ::= expr_or_subquery */ - -3, /* (434) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - -1, /* (435) column_reference ::= column_name */ - -3, /* (436) column_reference ::= table_name NK_DOT column_name */ - -1, /* (437) pseudo_column ::= ROWTS */ - -1, /* (438) pseudo_column ::= TBNAME */ - -3, /* (439) pseudo_column ::= table_name NK_DOT TBNAME */ - -1, /* (440) pseudo_column ::= QSTART */ - -1, /* (441) pseudo_column ::= QEND */ - -1, /* (442) pseudo_column ::= QDURATION */ - -1, /* (443) pseudo_column ::= WSTART */ - -1, /* (444) pseudo_column ::= WEND */ - -1, /* (445) pseudo_column ::= WDURATION */ - -1, /* (446) pseudo_column ::= IROWTS */ - -1, /* (447) pseudo_column ::= ISFILLED */ - -1, /* (448) pseudo_column ::= QTAGS */ - -4, /* (449) function_expression ::= function_name NK_LP expression_list NK_RP */ - -4, /* (450) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - -6, /* (451) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - -1, /* (452) function_expression ::= literal_func */ - -3, /* (453) literal_func ::= noarg_func NK_LP NK_RP */ - -1, /* (454) literal_func ::= NOW */ - -1, /* (455) noarg_func ::= NOW */ - -1, /* (456) noarg_func ::= TODAY */ - -1, /* (457) noarg_func ::= TIMEZONE */ - -1, /* (458) noarg_func ::= DATABASE */ - -1, /* (459) noarg_func ::= CLIENT_VERSION */ - -1, /* (460) noarg_func ::= SERVER_VERSION */ - -1, /* (461) noarg_func ::= SERVER_STATUS */ - -1, /* (462) noarg_func ::= CURRENT_USER */ - -1, /* (463) noarg_func ::= USER */ - -1, /* (464) star_func ::= COUNT */ - -1, /* (465) star_func ::= FIRST */ - -1, /* (466) star_func ::= LAST */ - -1, /* (467) star_func ::= LAST_ROW */ - -1, /* (468) star_func_para_list ::= NK_STAR */ - -1, /* (469) star_func_para_list ::= other_para_list */ - -1, /* (470) other_para_list ::= star_func_para */ - -3, /* (471) other_para_list ::= other_para_list NK_COMMA star_func_para */ - -1, /* (472) star_func_para ::= expr_or_subquery */ - -3, /* (473) star_func_para ::= table_name NK_DOT NK_STAR */ - -4, /* (474) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - -5, /* (475) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - -1, /* (476) when_then_list ::= when_then_expr */ - -2, /* (477) when_then_list ::= when_then_list when_then_expr */ - -4, /* (478) when_then_expr ::= WHEN common_expression THEN common_expression */ - 0, /* (479) case_when_else_opt ::= */ - -2, /* (480) case_when_else_opt ::= ELSE common_expression */ - -3, /* (481) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - -5, /* (482) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - -6, /* (483) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - -3, /* (484) predicate ::= expr_or_subquery IS NULL */ - -4, /* (485) predicate ::= expr_or_subquery IS NOT NULL */ - -3, /* (486) predicate ::= expr_or_subquery in_op in_predicate_value */ - -1, /* (487) compare_op ::= NK_LT */ - -1, /* (488) compare_op ::= NK_GT */ - -1, /* (489) compare_op ::= NK_LE */ - -1, /* (490) compare_op ::= NK_GE */ - -1, /* (491) compare_op ::= NK_NE */ - -1, /* (492) compare_op ::= NK_EQ */ - -1, /* (493) compare_op ::= LIKE */ - -2, /* (494) compare_op ::= NOT LIKE */ - -1, /* (495) compare_op ::= MATCH */ - -1, /* (496) compare_op ::= NMATCH */ - -1, /* (497) compare_op ::= CONTAINS */ - -1, /* (498) in_op ::= IN */ - -2, /* (499) in_op ::= NOT IN */ - -3, /* (500) in_predicate_value ::= NK_LP literal_list NK_RP */ - -1, /* (501) boolean_value_expression ::= boolean_primary */ - -2, /* (502) boolean_value_expression ::= NOT boolean_primary */ - -3, /* (503) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - -3, /* (504) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - -1, /* (505) boolean_primary ::= predicate */ - -3, /* (506) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - -1, /* (507) common_expression ::= expr_or_subquery */ - -1, /* (508) common_expression ::= boolean_value_expression */ - 0, /* (509) from_clause_opt ::= */ - -2, /* (510) from_clause_opt ::= FROM table_reference_list */ - -1, /* (511) table_reference_list ::= table_reference */ - -3, /* (512) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - -1, /* (513) table_reference ::= table_primary */ - -1, /* (514) table_reference ::= joined_table */ - -2, /* (515) table_primary ::= table_name alias_opt */ - -4, /* (516) table_primary ::= db_name NK_DOT table_name alias_opt */ - -2, /* (517) table_primary ::= subquery alias_opt */ - -1, /* (518) table_primary ::= parenthesized_joined_table */ - 0, /* (519) alias_opt ::= */ - -1, /* (520) alias_opt ::= table_alias */ - -2, /* (521) alias_opt ::= AS table_alias */ - -3, /* (522) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - -3, /* (523) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - -6, /* (524) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - 0, /* (525) join_type ::= */ - -1, /* (526) join_type ::= INNER */ - -14, /* (527) 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, /* (528) hint_list ::= */ - -1, /* (529) hint_list ::= NK_HINT */ - 0, /* (530) tag_mode_opt ::= */ - -1, /* (531) tag_mode_opt ::= TAGS */ - 0, /* (532) set_quantifier_opt ::= */ - -1, /* (533) set_quantifier_opt ::= DISTINCT */ - -1, /* (534) set_quantifier_opt ::= ALL */ - -1, /* (535) select_list ::= select_item */ - -3, /* (536) select_list ::= select_list NK_COMMA select_item */ - -1, /* (537) select_item ::= NK_STAR */ - -1, /* (538) select_item ::= common_expression */ - -2, /* (539) select_item ::= common_expression column_alias */ - -3, /* (540) select_item ::= common_expression AS column_alias */ - -3, /* (541) select_item ::= table_name NK_DOT NK_STAR */ - 0, /* (542) where_clause_opt ::= */ - -2, /* (543) where_clause_opt ::= WHERE search_condition */ - 0, /* (544) partition_by_clause_opt ::= */ - -3, /* (545) partition_by_clause_opt ::= PARTITION BY partition_list */ - -1, /* (546) partition_list ::= partition_item */ - -3, /* (547) partition_list ::= partition_list NK_COMMA partition_item */ - -1, /* (548) partition_item ::= expr_or_subquery */ - -2, /* (549) partition_item ::= expr_or_subquery column_alias */ - -3, /* (550) partition_item ::= expr_or_subquery AS column_alias */ - 0, /* (551) twindow_clause_opt ::= */ - -6, /* (552) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - -4, /* (553) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - -6, /* (554) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - -8, /* (555) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - -7, /* (556) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 0, /* (557) sliding_opt ::= */ - -4, /* (558) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - 0, /* (559) fill_opt ::= */ - -4, /* (560) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - -6, /* (561) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - -6, /* (562) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - -1, /* (563) fill_mode ::= NONE */ - -1, /* (564) fill_mode ::= PREV */ - -1, /* (565) fill_mode ::= NULL */ - -1, /* (566) fill_mode ::= NULL_F */ - -1, /* (567) fill_mode ::= LINEAR */ - -1, /* (568) fill_mode ::= NEXT */ - 0, /* (569) group_by_clause_opt ::= */ - -3, /* (570) group_by_clause_opt ::= GROUP BY group_by_list */ - -1, /* (571) group_by_list ::= expr_or_subquery */ - -3, /* (572) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 0, /* (573) having_clause_opt ::= */ - -2, /* (574) having_clause_opt ::= HAVING search_condition */ - 0, /* (575) range_opt ::= */ - -6, /* (576) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - -4, /* (577) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 0, /* (578) every_opt ::= */ - -4, /* (579) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - -4, /* (580) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - -1, /* (581) query_simple ::= query_specification */ - -1, /* (582) query_simple ::= union_query_expression */ - -4, /* (583) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - -3, /* (584) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - -1, /* (585) query_simple_or_subquery ::= query_simple */ - -1, /* (586) query_simple_or_subquery ::= subquery */ - -1, /* (587) query_or_subquery ::= query_expression */ - -1, /* (588) query_or_subquery ::= subquery */ - 0, /* (589) order_by_clause_opt ::= */ - -3, /* (590) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 0, /* (591) slimit_clause_opt ::= */ - -2, /* (592) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - -4, /* (593) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - -4, /* (594) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 0, /* (595) limit_clause_opt ::= */ - -2, /* (596) limit_clause_opt ::= LIMIT NK_INTEGER */ - -4, /* (597) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - -4, /* (598) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - -3, /* (599) subquery ::= NK_LP query_expression NK_RP */ - -3, /* (600) subquery ::= NK_LP subquery NK_RP */ - -1, /* (601) search_condition ::= common_expression */ - -1, /* (602) sort_specification_list ::= sort_specification */ - -3, /* (603) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - -3, /* (604) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 0, /* (605) ordering_specification_opt ::= */ - -1, /* (606) ordering_specification_opt ::= ASC */ - -1, /* (607) ordering_specification_opt ::= DESC */ - 0, /* (608) null_ordering_opt ::= */ - -2, /* (609) null_ordering_opt ::= NULLS FIRST */ - -2, /* (610) null_ordering_opt ::= NULLS LAST */ + 0, /* (281) table_kind_db_name_cond_opt ::= */ + -1, /* (282) table_kind_db_name_cond_opt ::= table_kind */ + -2, /* (283) table_kind_db_name_cond_opt ::= db_name NK_DOT */ + -3, /* (284) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ + -1, /* (285) table_kind ::= NORMAL */ + -1, /* (286) table_kind ::= CHILD */ + 0, /* (287) db_name_cond_opt ::= */ + -2, /* (288) db_name_cond_opt ::= db_name NK_DOT */ + 0, /* (289) like_pattern_opt ::= */ + -2, /* (290) like_pattern_opt ::= LIKE NK_STRING */ + -1, /* (291) table_name_cond ::= table_name */ + 0, /* (292) from_db_opt ::= */ + -2, /* (293) from_db_opt ::= FROM db_name */ + 0, /* (294) tag_list_opt ::= */ + -1, /* (295) tag_list_opt ::= tag_item */ + -3, /* (296) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + -1, /* (297) tag_item ::= TBNAME */ + -1, /* (298) tag_item ::= QTAGS */ + -1, /* (299) tag_item ::= column_name */ + -2, /* (300) tag_item ::= column_name column_alias */ + -3, /* (301) tag_item ::= column_name AS column_alias */ + 0, /* (302) db_kind_opt ::= */ + -1, /* (303) db_kind_opt ::= USER */ + -1, /* (304) db_kind_opt ::= SYSTEM */ + -8, /* (305) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ + -9, /* (306) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ + -4, /* (307) cmd ::= DROP INDEX exists_opt full_index_name */ + -1, /* (308) full_index_name ::= index_name */ + -3, /* (309) full_index_name ::= db_name NK_DOT index_name */ + -10, /* (310) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + -12, /* (311) 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, /* (312) func_list ::= func */ + -3, /* (313) func_list ::= func_list NK_COMMA func */ + -4, /* (314) func ::= sma_func_name NK_LP expression_list NK_RP */ + -1, /* (315) sma_func_name ::= function_name */ + -1, /* (316) sma_func_name ::= COUNT */ + -1, /* (317) sma_func_name ::= FIRST */ + -1, /* (318) sma_func_name ::= LAST */ + -1, /* (319) sma_func_name ::= LAST_ROW */ + 0, /* (320) sma_stream_opt ::= */ + -3, /* (321) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + -3, /* (322) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + -3, /* (323) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + -1, /* (324) with_meta ::= AS */ + -3, /* (325) with_meta ::= WITH META AS */ + -3, /* (326) with_meta ::= ONLY META AS */ + -6, /* (327) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + -7, /* (328) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + -8, /* (329) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + -4, /* (330) cmd ::= DROP TOPIC exists_opt topic_name */ + -7, /* (331) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + -2, /* (332) cmd ::= DESC full_table_name */ + -2, /* (333) cmd ::= DESCRIBE full_table_name */ + -3, /* (334) cmd ::= RESET QUERY CACHE */ + -4, /* (335) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + -4, /* (336) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 0, /* (337) analyze_opt ::= */ + -1, /* (338) analyze_opt ::= ANALYZE */ + 0, /* (339) explain_options ::= */ + -3, /* (340) explain_options ::= explain_options VERBOSE NK_BOOL */ + -3, /* (341) explain_options ::= explain_options RATIO NK_FLOAT */ + -12, /* (342) 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, /* (343) cmd ::= DROP FUNCTION exists_opt function_name */ + 0, /* (344) agg_func_opt ::= */ + -1, /* (345) agg_func_opt ::= AGGREGATE */ + 0, /* (346) bufsize_opt ::= */ + -2, /* (347) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 0, /* (348) language_opt ::= */ + -2, /* (349) language_opt ::= LANGUAGE NK_STRING */ + 0, /* (350) or_replace_opt ::= */ + -2, /* (351) or_replace_opt ::= OR REPLACE */ + -12, /* (352) 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, /* (353) cmd ::= DROP STREAM exists_opt stream_name */ + -4, /* (354) cmd ::= PAUSE STREAM exists_opt stream_name */ + -5, /* (355) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 0, /* (356) col_list_opt ::= */ + -3, /* (357) col_list_opt ::= NK_LP col_name_list NK_RP */ + 0, /* (358) tag_def_or_ref_opt ::= */ + -1, /* (359) tag_def_or_ref_opt ::= tags_def */ + -4, /* (360) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ + 0, /* (361) stream_options ::= */ + -3, /* (362) stream_options ::= stream_options TRIGGER AT_ONCE */ + -3, /* (363) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + -4, /* (364) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + -3, /* (365) stream_options ::= stream_options WATERMARK duration_literal */ + -4, /* (366) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + -3, /* (367) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + -3, /* (368) stream_options ::= stream_options DELETE_MARK duration_literal */ + -4, /* (369) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 0, /* (370) subtable_opt ::= */ + -4, /* (371) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 0, /* (372) ignore_opt ::= */ + -2, /* (373) ignore_opt ::= IGNORE UNTREATED */ + -3, /* (374) cmd ::= KILL CONNECTION NK_INTEGER */ + -3, /* (375) cmd ::= KILL QUERY NK_STRING */ + -3, /* (376) cmd ::= KILL TRANSACTION NK_INTEGER */ + -2, /* (377) cmd ::= BALANCE VGROUP */ + -3, /* (378) cmd ::= BALANCE VGROUP LEADER */ + -4, /* (379) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + -4, /* (380) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + -3, /* (381) cmd ::= SPLIT VGROUP NK_INTEGER */ + -2, /* (382) dnode_list ::= DNODE NK_INTEGER */ + -3, /* (383) dnode_list ::= dnode_list DNODE NK_INTEGER */ + -4, /* (384) cmd ::= DELETE FROM full_table_name where_clause_opt */ + -1, /* (385) cmd ::= query_or_subquery */ + -1, /* (386) cmd ::= insert_query */ + -7, /* (387) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + -4, /* (388) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + -1, /* (389) literal ::= NK_INTEGER */ + -1, /* (390) literal ::= NK_FLOAT */ + -1, /* (391) literal ::= NK_STRING */ + -1, /* (392) literal ::= NK_BOOL */ + -2, /* (393) literal ::= TIMESTAMP NK_STRING */ + -1, /* (394) literal ::= duration_literal */ + -1, /* (395) literal ::= NULL */ + -1, /* (396) literal ::= NK_QUESTION */ + -1, /* (397) duration_literal ::= NK_VARIABLE */ + -1, /* (398) signed ::= NK_INTEGER */ + -2, /* (399) signed ::= NK_PLUS NK_INTEGER */ + -2, /* (400) signed ::= NK_MINUS NK_INTEGER */ + -1, /* (401) signed ::= NK_FLOAT */ + -2, /* (402) signed ::= NK_PLUS NK_FLOAT */ + -2, /* (403) signed ::= NK_MINUS NK_FLOAT */ + -1, /* (404) signed_literal ::= signed */ + -1, /* (405) signed_literal ::= NK_STRING */ + -1, /* (406) signed_literal ::= NK_BOOL */ + -2, /* (407) signed_literal ::= TIMESTAMP NK_STRING */ + -1, /* (408) signed_literal ::= duration_literal */ + -1, /* (409) signed_literal ::= NULL */ + -1, /* (410) signed_literal ::= literal_func */ + -1, /* (411) signed_literal ::= NK_QUESTION */ + -1, /* (412) literal_list ::= signed_literal */ + -3, /* (413) literal_list ::= literal_list NK_COMMA signed_literal */ + -1, /* (414) db_name ::= NK_ID */ + -1, /* (415) table_name ::= NK_ID */ + -1, /* (416) column_name ::= NK_ID */ + -1, /* (417) function_name ::= NK_ID */ + -1, /* (418) table_alias ::= NK_ID */ + -1, /* (419) column_alias ::= NK_ID */ + -1, /* (420) user_name ::= NK_ID */ + -1, /* (421) topic_name ::= NK_ID */ + -1, /* (422) stream_name ::= NK_ID */ + -1, /* (423) cgroup_name ::= NK_ID */ + -1, /* (424) index_name ::= NK_ID */ + -1, /* (425) expr_or_subquery ::= expression */ + -1, /* (426) expression ::= literal */ + -1, /* (427) expression ::= pseudo_column */ + -1, /* (428) expression ::= column_reference */ + -1, /* (429) expression ::= function_expression */ + -1, /* (430) expression ::= case_when_expression */ + -3, /* (431) expression ::= NK_LP expression NK_RP */ + -2, /* (432) expression ::= NK_PLUS expr_or_subquery */ + -2, /* (433) expression ::= NK_MINUS expr_or_subquery */ + -3, /* (434) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + -3, /* (435) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + -3, /* (436) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + -3, /* (437) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + -3, /* (438) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + -3, /* (439) expression ::= column_reference NK_ARROW NK_STRING */ + -3, /* (440) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + -3, /* (441) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + -1, /* (442) expression_list ::= expr_or_subquery */ + -3, /* (443) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + -1, /* (444) column_reference ::= column_name */ + -3, /* (445) column_reference ::= table_name NK_DOT column_name */ + -1, /* (446) pseudo_column ::= ROWTS */ + -1, /* (447) pseudo_column ::= TBNAME */ + -3, /* (448) pseudo_column ::= table_name NK_DOT TBNAME */ + -1, /* (449) pseudo_column ::= QSTART */ + -1, /* (450) pseudo_column ::= QEND */ + -1, /* (451) pseudo_column ::= QDURATION */ + -1, /* (452) pseudo_column ::= WSTART */ + -1, /* (453) pseudo_column ::= WEND */ + -1, /* (454) pseudo_column ::= WDURATION */ + -1, /* (455) pseudo_column ::= IROWTS */ + -1, /* (456) pseudo_column ::= ISFILLED */ + -1, /* (457) pseudo_column ::= QTAGS */ + -4, /* (458) function_expression ::= function_name NK_LP expression_list NK_RP */ + -4, /* (459) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + -6, /* (460) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + -1, /* (461) function_expression ::= literal_func */ + -3, /* (462) literal_func ::= noarg_func NK_LP NK_RP */ + -1, /* (463) literal_func ::= NOW */ + -1, /* (464) noarg_func ::= NOW */ + -1, /* (465) noarg_func ::= TODAY */ + -1, /* (466) noarg_func ::= TIMEZONE */ + -1, /* (467) noarg_func ::= DATABASE */ + -1, /* (468) noarg_func ::= CLIENT_VERSION */ + -1, /* (469) noarg_func ::= SERVER_VERSION */ + -1, /* (470) noarg_func ::= SERVER_STATUS */ + -1, /* (471) noarg_func ::= CURRENT_USER */ + -1, /* (472) noarg_func ::= USER */ + -1, /* (473) star_func ::= COUNT */ + -1, /* (474) star_func ::= FIRST */ + -1, /* (475) star_func ::= LAST */ + -1, /* (476) star_func ::= LAST_ROW */ + -1, /* (477) star_func_para_list ::= NK_STAR */ + -1, /* (478) star_func_para_list ::= other_para_list */ + -1, /* (479) other_para_list ::= star_func_para */ + -3, /* (480) other_para_list ::= other_para_list NK_COMMA star_func_para */ + -1, /* (481) star_func_para ::= expr_or_subquery */ + -3, /* (482) star_func_para ::= table_name NK_DOT NK_STAR */ + -4, /* (483) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + -5, /* (484) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + -1, /* (485) when_then_list ::= when_then_expr */ + -2, /* (486) when_then_list ::= when_then_list when_then_expr */ + -4, /* (487) when_then_expr ::= WHEN common_expression THEN common_expression */ + 0, /* (488) case_when_else_opt ::= */ + -2, /* (489) case_when_else_opt ::= ELSE common_expression */ + -3, /* (490) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + -5, /* (491) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + -6, /* (492) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + -3, /* (493) predicate ::= expr_or_subquery IS NULL */ + -4, /* (494) predicate ::= expr_or_subquery IS NOT NULL */ + -3, /* (495) predicate ::= expr_or_subquery in_op in_predicate_value */ + -1, /* (496) compare_op ::= NK_LT */ + -1, /* (497) compare_op ::= NK_GT */ + -1, /* (498) compare_op ::= NK_LE */ + -1, /* (499) compare_op ::= NK_GE */ + -1, /* (500) compare_op ::= NK_NE */ + -1, /* (501) compare_op ::= NK_EQ */ + -1, /* (502) compare_op ::= LIKE */ + -2, /* (503) compare_op ::= NOT LIKE */ + -1, /* (504) compare_op ::= MATCH */ + -1, /* (505) compare_op ::= NMATCH */ + -1, /* (506) compare_op ::= CONTAINS */ + -1, /* (507) in_op ::= IN */ + -2, /* (508) in_op ::= NOT IN */ + -3, /* (509) in_predicate_value ::= NK_LP literal_list NK_RP */ + -1, /* (510) boolean_value_expression ::= boolean_primary */ + -2, /* (511) boolean_value_expression ::= NOT boolean_primary */ + -3, /* (512) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + -3, /* (513) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + -1, /* (514) boolean_primary ::= predicate */ + -3, /* (515) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + -1, /* (516) common_expression ::= expr_or_subquery */ + -1, /* (517) common_expression ::= boolean_value_expression */ + 0, /* (518) from_clause_opt ::= */ + -2, /* (519) from_clause_opt ::= FROM table_reference_list */ + -1, /* (520) table_reference_list ::= table_reference */ + -3, /* (521) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + -1, /* (522) table_reference ::= table_primary */ + -1, /* (523) table_reference ::= joined_table */ + -2, /* (524) table_primary ::= table_name alias_opt */ + -4, /* (525) table_primary ::= db_name NK_DOT table_name alias_opt */ + -2, /* (526) table_primary ::= subquery alias_opt */ + -1, /* (527) table_primary ::= parenthesized_joined_table */ + 0, /* (528) alias_opt ::= */ + -1, /* (529) alias_opt ::= table_alias */ + -2, /* (530) alias_opt ::= AS table_alias */ + -3, /* (531) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + -3, /* (532) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + -6, /* (533) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + 0, /* (534) join_type ::= */ + -1, /* (535) join_type ::= INNER */ + -14, /* (536) 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, /* (537) hint_list ::= */ + -1, /* (538) hint_list ::= NK_HINT */ + 0, /* (539) tag_mode_opt ::= */ + -1, /* (540) tag_mode_opt ::= TAGS */ + 0, /* (541) set_quantifier_opt ::= */ + -1, /* (542) set_quantifier_opt ::= DISTINCT */ + -1, /* (543) set_quantifier_opt ::= ALL */ + -1, /* (544) select_list ::= select_item */ + -3, /* (545) select_list ::= select_list NK_COMMA select_item */ + -1, /* (546) select_item ::= NK_STAR */ + -1, /* (547) select_item ::= common_expression */ + -2, /* (548) select_item ::= common_expression column_alias */ + -3, /* (549) select_item ::= common_expression AS column_alias */ + -3, /* (550) select_item ::= table_name NK_DOT NK_STAR */ + 0, /* (551) where_clause_opt ::= */ + -2, /* (552) where_clause_opt ::= WHERE search_condition */ + 0, /* (553) partition_by_clause_opt ::= */ + -3, /* (554) partition_by_clause_opt ::= PARTITION BY partition_list */ + -1, /* (555) partition_list ::= partition_item */ + -3, /* (556) partition_list ::= partition_list NK_COMMA partition_item */ + -1, /* (557) partition_item ::= expr_or_subquery */ + -2, /* (558) partition_item ::= expr_or_subquery column_alias */ + -3, /* (559) partition_item ::= expr_or_subquery AS column_alias */ + 0, /* (560) twindow_clause_opt ::= */ + -6, /* (561) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + -4, /* (562) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + -6, /* (563) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + -8, /* (564) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + -7, /* (565) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 0, /* (566) sliding_opt ::= */ + -4, /* (567) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + 0, /* (568) fill_opt ::= */ + -4, /* (569) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + -6, /* (570) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + -6, /* (571) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + -1, /* (572) fill_mode ::= NONE */ + -1, /* (573) fill_mode ::= PREV */ + -1, /* (574) fill_mode ::= NULL */ + -1, /* (575) fill_mode ::= NULL_F */ + -1, /* (576) fill_mode ::= LINEAR */ + -1, /* (577) fill_mode ::= NEXT */ + 0, /* (578) group_by_clause_opt ::= */ + -3, /* (579) group_by_clause_opt ::= GROUP BY group_by_list */ + -1, /* (580) group_by_list ::= expr_or_subquery */ + -3, /* (581) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 0, /* (582) having_clause_opt ::= */ + -2, /* (583) having_clause_opt ::= HAVING search_condition */ + 0, /* (584) range_opt ::= */ + -6, /* (585) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + -4, /* (586) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 0, /* (587) every_opt ::= */ + -4, /* (588) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + -4, /* (589) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + -1, /* (590) query_simple ::= query_specification */ + -1, /* (591) query_simple ::= union_query_expression */ + -4, /* (592) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + -3, /* (593) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + -1, /* (594) query_simple_or_subquery ::= query_simple */ + -1, /* (595) query_simple_or_subquery ::= subquery */ + -1, /* (596) query_or_subquery ::= query_expression */ + -1, /* (597) query_or_subquery ::= subquery */ + 0, /* (598) order_by_clause_opt ::= */ + -3, /* (599) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 0, /* (600) slimit_clause_opt ::= */ + -2, /* (601) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + -4, /* (602) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + -4, /* (603) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 0, /* (604) limit_clause_opt ::= */ + -2, /* (605) limit_clause_opt ::= LIMIT NK_INTEGER */ + -4, /* (606) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + -4, /* (607) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + -3, /* (608) subquery ::= NK_LP query_expression NK_RP */ + -3, /* (609) subquery ::= NK_LP subquery NK_RP */ + -1, /* (610) search_condition ::= common_expression */ + -1, /* (611) sort_specification_list ::= sort_specification */ + -3, /* (612) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + -3, /* (613) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 0, /* (614) ordering_specification_opt ::= */ + -1, /* (615) ordering_specification_opt ::= ASC */ + -1, /* (616) ordering_specification_opt ::= DESC */ + 0, /* (617) null_ordering_opt ::= */ + -2, /* (618) null_ordering_opt ::= NULLS FIRST */ + -2, /* (619) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -4852,19 +4966,19 @@ static YYACTIONTYPE yy_reduce( case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ #line 50 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 4855 "sql.c" - yy_destructor(yypParser,341,&yymsp[0].minor); +#line 4969 "sql.c" + yy_destructor(yypParser,344,&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 4861 "sql.c" - yy_destructor(yypParser,342,&yymsp[0].minor); +#line 4975 "sql.c" + yy_destructor(yypParser,345,&yymsp[0].minor); break; case 2: /* account_options ::= */ #line 55 "sql.y" { } -#line 4867 "sql.c" +#line 4981 "sql.c" break; case 3: /* account_options ::= account_options PPS literal */ case 4: /* account_options ::= account_options TSERIES literal */ yytestcase(yyruleno==4); @@ -4875,26 +4989,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,341,&yymsp[-2].minor); +{ yy_destructor(yypParser,344,&yymsp[-2].minor); #line 56 "sql.y" { } -#line 4881 "sql.c" - yy_destructor(yypParser,343,&yymsp[0].minor); +#line 4995 "sql.c" + yy_destructor(yypParser,346,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,344,&yymsp[0].minor); +{ yy_destructor(yypParser,347,&yymsp[0].minor); #line 68 "sql.y" { } -#line 4889 "sql.c" +#line 5003 "sql.c" } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,342,&yymsp[-1].minor); +{ yy_destructor(yypParser,345,&yymsp[-1].minor); #line 69 "sql.y" { } -#line 4896 "sql.c" - yy_destructor(yypParser,344,&yymsp[0].minor); +#line 5010 "sql.c" + yy_destructor(yypParser,347,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -4909,715 +5023,715 @@ static YYACTIONTYPE yy_reduce( case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); #line 73 "sql.y" { } -#line 4912 "sql.c" - yy_destructor(yypParser,343,&yymsp[0].minor); +#line 5026 "sql.c" + yy_destructor(yypParser,346,&yymsp[0].minor); break; case 24: /* ip_range_list ::= NK_STRING */ #line 86 "sql.y" -{ yylhsminor.yy236 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 4918 "sql.c" - yymsp[0].minor.yy236 = yylhsminor.yy236; +{ yylhsminor.yy424 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } +#line 5032 "sql.c" + yymsp[0].minor.yy424 = yylhsminor.yy424; break; case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ #line 87 "sql.y" -{ yylhsminor.yy236 = addNodeToList(pCxt, yymsp[-2].minor.yy236, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 4924 "sql.c" - yymsp[-2].minor.yy236 = yylhsminor.yy236; +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } +#line 5038 "sql.c" + yymsp[-2].minor.yy424 = yylhsminor.yy424; break; case 26: /* white_list ::= HOST ip_range_list */ #line 91 "sql.y" -{ yymsp[-1].minor.yy236 = yymsp[0].minor.yy236; } -#line 4930 "sql.c" +{ yymsp[-1].minor.yy424 = yymsp[0].minor.yy424; } +#line 5044 "sql.c" break; case 27: /* white_list_opt ::= */ case 182: /* specific_cols_opt ::= */ yytestcase(yyruleno==182); case 213: /* tags_def_opt ::= */ yytestcase(yyruleno==213); - case 288: /* tag_list_opt ::= */ yytestcase(yyruleno==288); - case 347: /* col_list_opt ::= */ yytestcase(yyruleno==347); - case 349: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==349); - case 544: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==544); - case 569: /* group_by_clause_opt ::= */ yytestcase(yyruleno==569); - case 589: /* order_by_clause_opt ::= */ yytestcase(yyruleno==589); + case 294: /* tag_list_opt ::= */ yytestcase(yyruleno==294); + case 356: /* col_list_opt ::= */ yytestcase(yyruleno==356); + case 358: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==358); + case 553: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==553); + case 578: /* group_by_clause_opt ::= */ yytestcase(yyruleno==578); + case 598: /* order_by_clause_opt ::= */ yytestcase(yyruleno==598); #line 95 "sql.y" -{ yymsp[1].minor.yy236 = NULL; } -#line 4943 "sql.c" +{ yymsp[1].minor.yy424 = NULL; } +#line 5057 "sql.c" break; case 28: /* white_list_opt ::= white_list */ case 214: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==214); - case 350: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==350); - case 469: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==469); + case 359: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==359); + case 478: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==478); #line 96 "sql.y" -{ yylhsminor.yy236 = yymsp[0].minor.yy236; } -#line 4951 "sql.c" - yymsp[0].minor.yy236 = yylhsminor.yy236; +{ yylhsminor.yy424 = yymsp[0].minor.yy424; } +#line 5065 "sql.c" + yymsp[0].minor.yy424 = yylhsminor.yy424; 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.yy889, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy847); - pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy236); + pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-4].minor.yy329, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy903); + pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy424); } -#line 4960 "sql.c" +#line 5074 "sql.c" break; case 30: /* cmd ::= ALTER USER user_name PASS NK_STRING */ #line 104 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy889, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } -#line 4965 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy329, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +#line 5079 "sql.c" break; case 31: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ #line 105 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy889, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } -#line 4970 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy329, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +#line 5084 "sql.c" break; case 32: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ #line 106 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy889, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } -#line 4975 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy329, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +#line 5089 "sql.c" break; case 33: /* cmd ::= ALTER USER user_name ADD white_list */ #line 107 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy889, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy236); } -#line 4980 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy329, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy424); } +#line 5094 "sql.c" break; case 34: /* cmd ::= ALTER USER user_name DROP white_list */ #line 108 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy889, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy236); } -#line 4985 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy329, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy424); } +#line 5099 "sql.c" break; case 35: /* cmd ::= DROP USER user_name */ #line 109 "sql.y" -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy889); } -#line 4990 "sql.c" +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy329); } +#line 5104 "sql.c" break; case 36: /* sysinfo_opt ::= */ #line 113 "sql.y" -{ yymsp[1].minor.yy847 = 1; } -#line 4995 "sql.c" +{ yymsp[1].minor.yy903 = 1; } +#line 5109 "sql.c" break; case 37: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ #line 114 "sql.y" -{ yymsp[-1].minor.yy847 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } -#line 5000 "sql.c" +{ yymsp[-1].minor.yy903 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +#line 5114 "sql.c" break; case 38: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ #line 117 "sql.y" -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy701, &yymsp[-3].minor.yy833, &yymsp[0].minor.yy889, yymsp[-2].minor.yy28); } -#line 5005 "sql.c" +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy109, &yymsp[-3].minor.yy297, &yymsp[0].minor.yy329, yymsp[-2].minor.yy712); } +#line 5119 "sql.c" break; case 39: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ #line 118 "sql.y" -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy701, &yymsp[-3].minor.yy833, &yymsp[0].minor.yy889, yymsp[-2].minor.yy28); } -#line 5010 "sql.c" +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy109, &yymsp[-3].minor.yy297, &yymsp[0].minor.yy329, yymsp[-2].minor.yy712); } +#line 5124 "sql.c" break; case 40: /* privileges ::= ALL */ #line 122 "sql.y" -{ yymsp[0].minor.yy701 = PRIVILEGE_TYPE_ALL; } -#line 5015 "sql.c" +{ yymsp[0].minor.yy109 = PRIVILEGE_TYPE_ALL; } +#line 5129 "sql.c" break; case 41: /* privileges ::= priv_type_list */ case 43: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==43); #line 123 "sql.y" -{ yylhsminor.yy701 = yymsp[0].minor.yy701; } -#line 5021 "sql.c" - yymsp[0].minor.yy701 = yylhsminor.yy701; +{ yylhsminor.yy109 = yymsp[0].minor.yy109; } +#line 5135 "sql.c" + yymsp[0].minor.yy109 = yylhsminor.yy109; break; case 42: /* privileges ::= SUBSCRIBE */ #line 124 "sql.y" -{ yymsp[0].minor.yy701 = PRIVILEGE_TYPE_SUBSCRIBE; } -#line 5027 "sql.c" +{ yymsp[0].minor.yy109 = PRIVILEGE_TYPE_SUBSCRIBE; } +#line 5141 "sql.c" break; case 44: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ #line 129 "sql.y" -{ yylhsminor.yy701 = yymsp[-2].minor.yy701 | yymsp[0].minor.yy701; } -#line 5032 "sql.c" - yymsp[-2].minor.yy701 = yylhsminor.yy701; +{ yylhsminor.yy109 = yymsp[-2].minor.yy109 | yymsp[0].minor.yy109; } +#line 5146 "sql.c" + yymsp[-2].minor.yy109 = yylhsminor.yy109; break; case 45: /* priv_type ::= READ */ #line 133 "sql.y" -{ yymsp[0].minor.yy701 = PRIVILEGE_TYPE_READ; } -#line 5038 "sql.c" +{ yymsp[0].minor.yy109 = PRIVILEGE_TYPE_READ; } +#line 5152 "sql.c" break; case 46: /* priv_type ::= WRITE */ #line 134 "sql.y" -{ yymsp[0].minor.yy701 = PRIVILEGE_TYPE_WRITE; } -#line 5043 "sql.c" +{ yymsp[0].minor.yy109 = PRIVILEGE_TYPE_WRITE; } +#line 5157 "sql.c" break; case 47: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ #line 138 "sql.y" -{ yylhsminor.yy833.first = yymsp[-2].minor.yy0; yylhsminor.yy833.second = yymsp[0].minor.yy0; } -#line 5048 "sql.c" - yymsp[-2].minor.yy833 = yylhsminor.yy833; +{ yylhsminor.yy297.first = yymsp[-2].minor.yy0; yylhsminor.yy297.second = yymsp[0].minor.yy0; } +#line 5162 "sql.c" + yymsp[-2].minor.yy297 = yylhsminor.yy297; break; case 48: /* priv_level ::= db_name NK_DOT NK_STAR */ #line 139 "sql.y" -{ yylhsminor.yy833.first = yymsp[-2].minor.yy889; yylhsminor.yy833.second = yymsp[0].minor.yy0; } -#line 5054 "sql.c" - yymsp[-2].minor.yy833 = yylhsminor.yy833; +{ yylhsminor.yy297.first = yymsp[-2].minor.yy329; yylhsminor.yy297.second = yymsp[0].minor.yy0; } +#line 5168 "sql.c" + yymsp[-2].minor.yy297 = yylhsminor.yy297; break; case 49: /* priv_level ::= db_name NK_DOT table_name */ #line 140 "sql.y" -{ yylhsminor.yy833.first = yymsp[-2].minor.yy889; yylhsminor.yy833.second = yymsp[0].minor.yy889; } -#line 5060 "sql.c" - yymsp[-2].minor.yy833 = yylhsminor.yy833; +{ yylhsminor.yy297.first = yymsp[-2].minor.yy329; yylhsminor.yy297.second = yymsp[0].minor.yy329; } +#line 5174 "sql.c" + yymsp[-2].minor.yy297 = yylhsminor.yy297; break; case 50: /* priv_level ::= topic_name */ #line 141 "sql.y" -{ yylhsminor.yy833.first = yymsp[0].minor.yy889; yylhsminor.yy833.second = nil_token; } -#line 5066 "sql.c" - yymsp[0].minor.yy833 = yylhsminor.yy833; +{ yylhsminor.yy297.first = yymsp[0].minor.yy329; yylhsminor.yy297.second = nil_token; } +#line 5180 "sql.c" + yymsp[0].minor.yy297 = yylhsminor.yy297; break; case 51: /* with_opt ::= */ case 151: /* start_opt ::= */ yytestcase(yyruleno==151); case 155: /* end_opt ::= */ yytestcase(yyruleno==155); - case 283: /* like_pattern_opt ::= */ yytestcase(yyruleno==283); - case 361: /* subtable_opt ::= */ yytestcase(yyruleno==361); - case 479: /* case_when_else_opt ::= */ yytestcase(yyruleno==479); - case 509: /* from_clause_opt ::= */ yytestcase(yyruleno==509); - case 542: /* where_clause_opt ::= */ yytestcase(yyruleno==542); - case 551: /* twindow_clause_opt ::= */ yytestcase(yyruleno==551); - case 557: /* sliding_opt ::= */ yytestcase(yyruleno==557); - case 559: /* fill_opt ::= */ yytestcase(yyruleno==559); - case 573: /* having_clause_opt ::= */ yytestcase(yyruleno==573); - case 575: /* range_opt ::= */ yytestcase(yyruleno==575); - case 578: /* every_opt ::= */ yytestcase(yyruleno==578); - case 591: /* slimit_clause_opt ::= */ yytestcase(yyruleno==591); - case 595: /* limit_clause_opt ::= */ yytestcase(yyruleno==595); + case 289: /* like_pattern_opt ::= */ yytestcase(yyruleno==289); + case 370: /* subtable_opt ::= */ yytestcase(yyruleno==370); + case 488: /* case_when_else_opt ::= */ yytestcase(yyruleno==488); + case 518: /* from_clause_opt ::= */ yytestcase(yyruleno==518); + case 551: /* where_clause_opt ::= */ yytestcase(yyruleno==551); + case 560: /* twindow_clause_opt ::= */ yytestcase(yyruleno==560); + case 566: /* sliding_opt ::= */ yytestcase(yyruleno==566); + case 568: /* fill_opt ::= */ yytestcase(yyruleno==568); + case 582: /* having_clause_opt ::= */ yytestcase(yyruleno==582); + case 584: /* range_opt ::= */ yytestcase(yyruleno==584); + case 587: /* every_opt ::= */ yytestcase(yyruleno==587); + case 600: /* slimit_clause_opt ::= */ yytestcase(yyruleno==600); + case 604: /* limit_clause_opt ::= */ yytestcase(yyruleno==604); #line 143 "sql.y" -{ yymsp[1].minor.yy28 = NULL; } -#line 5087 "sql.c" +{ yymsp[1].minor.yy712 = NULL; } +#line 5201 "sql.c" break; case 52: /* with_opt ::= WITH search_condition */ - case 510: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==510); - case 543: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==543); - case 574: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==574); + case 519: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==519); + case 552: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==552); + case 583: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==583); #line 144 "sql.y" -{ yymsp[-1].minor.yy28 = yymsp[0].minor.yy28; } -#line 5095 "sql.c" +{ yymsp[-1].minor.yy712 = yymsp[0].minor.yy712; } +#line 5209 "sql.c" break; case 53: /* cmd ::= CREATE DNODE dnode_endpoint */ #line 147 "sql.y" -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy889, NULL); } -#line 5100 "sql.c" +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy329, NULL); } +#line 5214 "sql.c" break; case 54: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ #line 148 "sql.y" -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy889, &yymsp[0].minor.yy0); } -#line 5105 "sql.c" +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy0); } +#line 5219 "sql.c" break; case 55: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ #line 149 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy793, false); } -#line 5110 "sql.c" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy737, false); } +#line 5224 "sql.c" break; case 56: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ #line 150 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy889, yymsp[0].minor.yy793, false); } -#line 5115 "sql.c" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy329, yymsp[0].minor.yy737, false); } +#line 5229 "sql.c" break; case 57: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ #line 151 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy793); } -#line 5120 "sql.c" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy737); } +#line 5234 "sql.c" break; case 58: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ #line 152 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy889, false, yymsp[0].minor.yy793); } -#line 5125 "sql.c" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy329, false, yymsp[0].minor.yy737); } +#line 5239 "sql.c" break; case 59: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ #line 153 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } -#line 5130 "sql.c" +#line 5244 "sql.c" break; case 60: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ #line 154 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5135 "sql.c" +#line 5249 "sql.c" break; case 61: /* cmd ::= ALTER ALL DNODES NK_STRING */ #line 155 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); } -#line 5140 "sql.c" +#line 5254 "sql.c" break; case 62: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ #line 156 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5145 "sql.c" +#line 5259 "sql.c" break; case 63: /* cmd ::= RESTORE DNODE NK_INTEGER */ #line 157 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_DNODE_STMT, &yymsp[0].minor.yy0); } -#line 5150 "sql.c" +#line 5264 "sql.c" break; case 64: /* dnode_endpoint ::= NK_STRING */ case 65: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==65); case 66: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==66); - case 307: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==307); - case 308: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==308); - case 309: /* sma_func_name ::= LAST */ yytestcase(yyruleno==309); - case 310: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==310); - case 405: /* db_name ::= NK_ID */ yytestcase(yyruleno==405); - case 406: /* table_name ::= NK_ID */ yytestcase(yyruleno==406); - case 407: /* column_name ::= NK_ID */ yytestcase(yyruleno==407); - case 408: /* function_name ::= NK_ID */ yytestcase(yyruleno==408); - case 409: /* table_alias ::= NK_ID */ yytestcase(yyruleno==409); - case 410: /* column_alias ::= NK_ID */ yytestcase(yyruleno==410); - case 411: /* user_name ::= NK_ID */ yytestcase(yyruleno==411); - case 412: /* topic_name ::= NK_ID */ yytestcase(yyruleno==412); - case 413: /* stream_name ::= NK_ID */ yytestcase(yyruleno==413); - case 414: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==414); - case 415: /* index_name ::= NK_ID */ yytestcase(yyruleno==415); - case 455: /* noarg_func ::= NOW */ yytestcase(yyruleno==455); - case 456: /* noarg_func ::= TODAY */ yytestcase(yyruleno==456); - case 457: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==457); - case 458: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==458); - case 459: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==459); - case 460: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==460); - case 461: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==461); - case 462: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==462); - case 463: /* noarg_func ::= USER */ yytestcase(yyruleno==463); - case 464: /* star_func ::= COUNT */ yytestcase(yyruleno==464); - case 465: /* star_func ::= FIRST */ yytestcase(yyruleno==465); - case 466: /* star_func ::= LAST */ yytestcase(yyruleno==466); - case 467: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==467); + case 316: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==316); + case 317: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==317); + case 318: /* sma_func_name ::= LAST */ yytestcase(yyruleno==318); + case 319: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==319); + case 414: /* db_name ::= NK_ID */ yytestcase(yyruleno==414); + case 415: /* table_name ::= NK_ID */ yytestcase(yyruleno==415); + case 416: /* column_name ::= NK_ID */ yytestcase(yyruleno==416); + case 417: /* function_name ::= NK_ID */ yytestcase(yyruleno==417); + case 418: /* table_alias ::= NK_ID */ yytestcase(yyruleno==418); + case 419: /* column_alias ::= NK_ID */ yytestcase(yyruleno==419); + case 420: /* user_name ::= NK_ID */ yytestcase(yyruleno==420); + case 421: /* topic_name ::= NK_ID */ yytestcase(yyruleno==421); + case 422: /* stream_name ::= NK_ID */ yytestcase(yyruleno==422); + case 423: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==423); + case 424: /* index_name ::= NK_ID */ yytestcase(yyruleno==424); + case 464: /* noarg_func ::= NOW */ yytestcase(yyruleno==464); + case 465: /* noarg_func ::= TODAY */ yytestcase(yyruleno==465); + case 466: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==466); + case 467: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==467); + case 468: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==468); + case 469: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==469); + case 470: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==470); + case 471: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==471); + case 472: /* noarg_func ::= USER */ yytestcase(yyruleno==472); + case 473: /* star_func ::= COUNT */ yytestcase(yyruleno==473); + case 474: /* star_func ::= FIRST */ yytestcase(yyruleno==474); + case 475: /* star_func ::= LAST */ yytestcase(yyruleno==475); + case 476: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==476); #line 161 "sql.y" -{ yylhsminor.yy889 = yymsp[0].minor.yy0; } -#line 5185 "sql.c" - yymsp[0].minor.yy889 = yylhsminor.yy889; +{ yylhsminor.yy329 = yymsp[0].minor.yy0; } +#line 5299 "sql.c" + yymsp[0].minor.yy329 = yylhsminor.yy329; break; case 67: /* force_opt ::= */ case 91: /* not_exists_opt ::= */ yytestcase(yyruleno==91); case 93: /* exists_opt ::= */ yytestcase(yyruleno==93); - case 328: /* analyze_opt ::= */ yytestcase(yyruleno==328); - case 335: /* agg_func_opt ::= */ yytestcase(yyruleno==335); - case 341: /* or_replace_opt ::= */ yytestcase(yyruleno==341); - case 363: /* ignore_opt ::= */ yytestcase(yyruleno==363); - case 530: /* tag_mode_opt ::= */ yytestcase(yyruleno==530); - case 532: /* set_quantifier_opt ::= */ yytestcase(yyruleno==532); + case 337: /* analyze_opt ::= */ yytestcase(yyruleno==337); + case 344: /* agg_func_opt ::= */ yytestcase(yyruleno==344); + case 350: /* or_replace_opt ::= */ yytestcase(yyruleno==350); + case 372: /* ignore_opt ::= */ yytestcase(yyruleno==372); + case 539: /* tag_mode_opt ::= */ yytestcase(yyruleno==539); + case 541: /* set_quantifier_opt ::= */ yytestcase(yyruleno==541); #line 167 "sql.y" -{ yymsp[1].minor.yy793 = false; } -#line 5199 "sql.c" +{ yymsp[1].minor.yy737 = false; } +#line 5313 "sql.c" break; case 68: /* force_opt ::= FORCE */ case 69: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==69); - case 329: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==329); - case 336: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==336); - case 531: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==531); - case 533: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==533); + case 338: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==338); + case 345: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==345); + case 540: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==540); + case 542: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==542); #line 168 "sql.y" -{ yymsp[0].minor.yy793 = true; } -#line 5209 "sql.c" +{ yymsp[0].minor.yy737 = true; } +#line 5323 "sql.c" break; case 70: /* cmd ::= ALTER LOCAL NK_STRING */ #line 175 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 5214 "sql.c" +#line 5328 "sql.c" break; case 71: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */ #line 176 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5219 "sql.c" +#line 5333 "sql.c" break; case 72: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ #line 179 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 5224 "sql.c" +#line 5338 "sql.c" break; case 73: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */ #line 180 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 5229 "sql.c" +#line 5343 "sql.c" break; case 74: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ #line 181 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 5234 "sql.c" +#line 5348 "sql.c" break; case 75: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ #line 184 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); } -#line 5239 "sql.c" +#line 5353 "sql.c" break; case 76: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */ #line 185 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); } -#line 5244 "sql.c" +#line 5358 "sql.c" break; case 77: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ #line 188 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); } -#line 5249 "sql.c" +#line 5363 "sql.c" break; case 78: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */ #line 189 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); } -#line 5254 "sql.c" +#line 5368 "sql.c" break; case 79: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ #line 192 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 5259 "sql.c" +#line 5373 "sql.c" break; case 80: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */ #line 193 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 5264 "sql.c" +#line 5378 "sql.c" break; case 81: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ #line 194 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 5269 "sql.c" +#line 5383 "sql.c" break; case 82: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ #line 197 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); } -#line 5274 "sql.c" +#line 5388 "sql.c" break; case 83: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ #line 200 "sql.y" -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy793, &yymsp[-1].minor.yy889, yymsp[0].minor.yy28); } -#line 5279 "sql.c" +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy737, &yymsp[-1].minor.yy329, yymsp[0].minor.yy712); } +#line 5393 "sql.c" break; case 84: /* cmd ::= DROP DATABASE exists_opt db_name */ #line 201 "sql.y" -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy793, &yymsp[0].minor.yy889); } -#line 5284 "sql.c" +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy737, &yymsp[0].minor.yy329); } +#line 5398 "sql.c" break; case 85: /* cmd ::= USE db_name */ #line 202 "sql.y" -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy889); } -#line 5289 "sql.c" +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy329); } +#line 5403 "sql.c" break; case 86: /* cmd ::= ALTER DATABASE db_name alter_db_options */ #line 203 "sql.y" -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy889, yymsp[0].minor.yy28); } -#line 5294 "sql.c" +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy329, yymsp[0].minor.yy712); } +#line 5408 "sql.c" break; case 87: /* cmd ::= FLUSH DATABASE db_name */ #line 204 "sql.y" -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy889); } -#line 5299 "sql.c" +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy329); } +#line 5413 "sql.c" break; case 88: /* cmd ::= TRIM DATABASE db_name speed_opt */ #line 205 "sql.y" -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy889, yymsp[0].minor.yy956); } -#line 5304 "sql.c" +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy329, yymsp[0].minor.yy860); } +#line 5418 "sql.c" break; case 89: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ #line 206 "sql.y" -{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy889, yymsp[-1].minor.yy28, yymsp[0].minor.yy28); } -#line 5309 "sql.c" +{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy329, yymsp[-1].minor.yy712, yymsp[0].minor.yy712); } +#line 5423 "sql.c" break; case 90: /* not_exists_opt ::= IF NOT EXISTS */ #line 210 "sql.y" -{ yymsp[-2].minor.yy793 = true; } -#line 5314 "sql.c" +{ yymsp[-2].minor.yy737 = true; } +#line 5428 "sql.c" break; case 92: /* exists_opt ::= IF EXISTS */ - case 342: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==342); - case 364: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==364); + case 351: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==351); + case 373: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==373); #line 215 "sql.y" -{ yymsp[-1].minor.yy793 = true; } -#line 5321 "sql.c" +{ yymsp[-1].minor.yy737 = true; } +#line 5435 "sql.c" break; case 94: /* db_options ::= */ #line 218 "sql.y" -{ yymsp[1].minor.yy28 = createDefaultDatabaseOptions(pCxt); } -#line 5326 "sql.c" +{ yymsp[1].minor.yy712 = createDefaultDatabaseOptions(pCxt); } +#line 5440 "sql.c" break; case 95: /* db_options ::= db_options BUFFER NK_INTEGER */ #line 219 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } -#line 5331 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } +#line 5445 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 96: /* db_options ::= db_options CACHEMODEL NK_STRING */ #line 220 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } -#line 5337 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } +#line 5451 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 97: /* db_options ::= db_options CACHESIZE NK_INTEGER */ #line 221 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } -#line 5343 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } +#line 5457 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 98: /* db_options ::= db_options COMP NK_INTEGER */ #line 222 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_COMP, &yymsp[0].minor.yy0); } -#line 5349 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_COMP, &yymsp[0].minor.yy0); } +#line 5463 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 99: /* db_options ::= db_options DURATION NK_INTEGER */ case 100: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==100); #line 223 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } -#line 5356 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } +#line 5470 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 101: /* db_options ::= db_options MAXROWS NK_INTEGER */ #line 225 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } -#line 5362 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } +#line 5476 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 102: /* db_options ::= db_options MINROWS NK_INTEGER */ #line 226 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } -#line 5368 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } +#line 5482 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 103: /* db_options ::= db_options KEEP integer_list */ case 104: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==104); #line 227 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_KEEP, yymsp[0].minor.yy236); } -#line 5375 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_KEEP, yymsp[0].minor.yy424); } +#line 5489 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 105: /* db_options ::= db_options PAGES NK_INTEGER */ #line 229 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } -#line 5381 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } +#line 5495 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 106: /* db_options ::= db_options PAGESIZE NK_INTEGER */ #line 230 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } -#line 5387 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } +#line 5501 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 107: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ #line 231 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } -#line 5393 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } +#line 5507 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 108: /* db_options ::= db_options PRECISION NK_STRING */ #line 232 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } -#line 5399 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } +#line 5513 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 109: /* db_options ::= db_options REPLICA NK_INTEGER */ #line 233 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } -#line 5405 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } +#line 5519 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 110: /* db_options ::= db_options VGROUPS NK_INTEGER */ #line 235 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } -#line 5411 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } +#line 5525 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 111: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ #line 236 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } -#line 5417 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } +#line 5531 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 112: /* db_options ::= db_options RETENTIONS retention_list */ #line 237 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_RETENTIONS, yymsp[0].minor.yy236); } -#line 5423 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_RETENTIONS, yymsp[0].minor.yy424); } +#line 5537 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 113: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ #line 238 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } -#line 5429 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } +#line 5543 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 114: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ #line 239 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_WAL, &yymsp[0].minor.yy0); } -#line 5435 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_WAL, &yymsp[0].minor.yy0); } +#line 5549 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 115: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ #line 240 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } -#line 5441 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } +#line 5555 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 116: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ #line 241 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } -#line 5447 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } +#line 5561 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 117: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ #line 242 "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.yy28 = setDatabaseOption(pCxt, yymsp[-3].minor.yy28, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-3].minor.yy712, DB_OPTION_WAL_RETENTION_PERIOD, &t); } -#line 5457 "sql.c" - yymsp[-3].minor.yy28 = yylhsminor.yy28; +#line 5571 "sql.c" + yymsp[-3].minor.yy712 = yylhsminor.yy712; break; case 118: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ #line 247 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } -#line 5463 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } +#line 5577 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 119: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ #line 248 "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.yy28 = setDatabaseOption(pCxt, yymsp[-3].minor.yy28, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-3].minor.yy712, DB_OPTION_WAL_RETENTION_SIZE, &t); } -#line 5473 "sql.c" - yymsp[-3].minor.yy28 = yylhsminor.yy28; +#line 5587 "sql.c" + yymsp[-3].minor.yy712 = yylhsminor.yy712; break; case 120: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ #line 253 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } -#line 5479 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } +#line 5593 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 121: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ #line 254 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } -#line 5485 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } +#line 5599 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 122: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ #line 255 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } -#line 5491 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } +#line 5605 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 123: /* db_options ::= db_options TABLE_PREFIX signed */ #line 256 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy28); } -#line 5497 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy712); } +#line 5611 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 124: /* db_options ::= db_options TABLE_SUFFIX signed */ #line 257 "sql.y" -{ yylhsminor.yy28 = setDatabaseOption(pCxt, yymsp[-2].minor.yy28, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy28); } -#line 5503 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy712); } +#line 5617 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 125: /* alter_db_options ::= alter_db_option */ #line 259 "sql.y" -{ yylhsminor.yy28 = createAlterDatabaseOptions(pCxt); yylhsminor.yy28 = setAlterDatabaseOption(pCxt, yylhsminor.yy28, &yymsp[0].minor.yy481); } -#line 5509 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = createAlterDatabaseOptions(pCxt); yylhsminor.yy712 = setAlterDatabaseOption(pCxt, yylhsminor.yy712, &yymsp[0].minor.yy245); } +#line 5623 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; break; case 126: /* alter_db_options ::= alter_db_options alter_db_option */ #line 260 "sql.y" -{ yylhsminor.yy28 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy28, &yymsp[0].minor.yy481); } -#line 5515 "sql.c" - yymsp[-1].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy712, &yymsp[0].minor.yy245); } +#line 5629 "sql.c" + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; case 127: /* alter_db_option ::= BUFFER NK_INTEGER */ #line 264 "sql.y" -{ yymsp[-1].minor.yy481.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 5521 "sql.c" +{ yymsp[-1].minor.yy245.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } +#line 5635 "sql.c" break; case 128: /* alter_db_option ::= CACHEMODEL NK_STRING */ #line 265 "sql.y" -{ yymsp[-1].minor.yy481.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 5526 "sql.c" +{ yymsp[-1].minor.yy245.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } +#line 5640 "sql.c" break; case 129: /* alter_db_option ::= CACHESIZE NK_INTEGER */ #line 266 "sql.y" -{ yymsp[-1].minor.yy481.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 5531 "sql.c" +{ yymsp[-1].minor.yy245.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } +#line 5645 "sql.c" break; case 130: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ #line 267 "sql.y" -{ yymsp[-1].minor.yy481.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 5536 "sql.c" +{ yymsp[-1].minor.yy245.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } +#line 5650 "sql.c" break; case 131: /* alter_db_option ::= KEEP integer_list */ case 132: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==132); #line 268 "sql.y" -{ yymsp[-1].minor.yy481.type = DB_OPTION_KEEP; yymsp[-1].minor.yy481.pList = yymsp[0].minor.yy236; } -#line 5542 "sql.c" +{ yymsp[-1].minor.yy245.type = DB_OPTION_KEEP; yymsp[-1].minor.yy245.pList = yymsp[0].minor.yy424; } +#line 5656 "sql.c" break; case 133: /* alter_db_option ::= PAGES NK_INTEGER */ #line 270 "sql.y" -{ yymsp[-1].minor.yy481.type = DB_OPTION_PAGES; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 5547 "sql.c" +{ yymsp[-1].minor.yy245.type = DB_OPTION_PAGES; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } +#line 5661 "sql.c" break; case 134: /* alter_db_option ::= REPLICA NK_INTEGER */ #line 271 "sql.y" -{ yymsp[-1].minor.yy481.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 5552 "sql.c" +{ yymsp[-1].minor.yy245.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } +#line 5666 "sql.c" break; case 135: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ #line 273 "sql.y" -{ yymsp[-1].minor.yy481.type = DB_OPTION_WAL; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 5557 "sql.c" +{ yymsp[-1].minor.yy245.type = DB_OPTION_WAL; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } +#line 5671 "sql.c" break; case 136: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ #line 274 "sql.y" -{ yymsp[-1].minor.yy481.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 5562 "sql.c" +{ yymsp[-1].minor.yy245.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } +#line 5676 "sql.c" break; case 137: /* alter_db_option ::= MINROWS NK_INTEGER */ #line 275 "sql.y" -{ yymsp[-1].minor.yy481.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 5567 "sql.c" +{ yymsp[-1].minor.yy245.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } +#line 5681 "sql.c" break; case 138: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ #line 276 "sql.y" -{ yymsp[-1].minor.yy481.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 5572 "sql.c" +{ yymsp[-1].minor.yy245.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } +#line 5686 "sql.c" break; case 139: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ #line 277 "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.yy481.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy481.val = t; + yymsp[-2].minor.yy245.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy245.val = t; } -#line 5581 "sql.c" +#line 5695 "sql.c" break; case 140: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ #line 282 "sql.y" -{ yymsp[-1].minor.yy481.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 5586 "sql.c" +{ yymsp[-1].minor.yy245.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } +#line 5700 "sql.c" break; case 141: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ #line 283 "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.yy481.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy481.val = t; + yymsp[-2].minor.yy245.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy245.val = t; } -#line 5595 "sql.c" +#line 5709 "sql.c" break; case 142: /* integer_list ::= NK_INTEGER */ #line 291 "sql.y" -{ yylhsminor.yy236 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 5600 "sql.c" - yymsp[0].minor.yy236 = yylhsminor.yy236; +{ yylhsminor.yy424 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 5714 "sql.c" + yymsp[0].minor.yy424 = yylhsminor.yy424; break; case 143: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 374: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==374); + case 383: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==383); #line 292 "sql.y" -{ yylhsminor.yy236 = addNodeToList(pCxt, yymsp[-2].minor.yy236, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 5607 "sql.c" - yymsp[-2].minor.yy236 = yylhsminor.yy236; +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 5721 "sql.c" + yymsp[-2].minor.yy424 = yylhsminor.yy424; break; case 144: /* variable_list ::= NK_VARIABLE */ #line 296 "sql.y" -{ yylhsminor.yy236 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 5613 "sql.c" - yymsp[0].minor.yy236 = yylhsminor.yy236; +{ yylhsminor.yy424 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 5727 "sql.c" + yymsp[0].minor.yy424 = yylhsminor.yy424; break; case 145: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ #line 297 "sql.y" -{ yylhsminor.yy236 = addNodeToList(pCxt, yymsp[-2].minor.yy236, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 5619 "sql.c" - yymsp[-2].minor.yy236 = yylhsminor.yy236; +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 5733 "sql.c" + yymsp[-2].minor.yy424 = yylhsminor.yy424; break; case 146: /* retention_list ::= retention */ case 176: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==176); @@ -5625,1774 +5739,1827 @@ static YYACTIONTYPE yy_reduce( case 186: /* column_def_list ::= column_def */ yytestcase(yyruleno==186); case 230: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==230); case 235: /* col_name_list ::= col_name */ yytestcase(yyruleno==235); - case 289: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==289); - case 303: /* func_list ::= func */ yytestcase(yyruleno==303); - case 403: /* literal_list ::= signed_literal */ yytestcase(yyruleno==403); - case 470: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==470); - case 476: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==476); - case 535: /* select_list ::= select_item */ yytestcase(yyruleno==535); - case 546: /* partition_list ::= partition_item */ yytestcase(yyruleno==546); - case 602: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==602); + case 295: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==295); + case 312: /* func_list ::= func */ yytestcase(yyruleno==312); + case 412: /* literal_list ::= signed_literal */ yytestcase(yyruleno==412); + case 479: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==479); + case 485: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==485); + case 544: /* select_list ::= select_item */ yytestcase(yyruleno==544); + case 555: /* partition_list ::= partition_item */ yytestcase(yyruleno==555); + case 611: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==611); #line 301 "sql.y" -{ yylhsminor.yy236 = createNodeList(pCxt, yymsp[0].minor.yy28); } -#line 5638 "sql.c" - yymsp[0].minor.yy236 = yylhsminor.yy236; +{ yylhsminor.yy424 = createNodeList(pCxt, yymsp[0].minor.yy712); } +#line 5752 "sql.c" + yymsp[0].minor.yy424 = yylhsminor.yy424; break; case 147: /* retention_list ::= retention_list NK_COMMA retention */ case 180: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==180); case 187: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==187); case 231: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==231); case 236: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==236); - case 290: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==290); - case 304: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==304); - case 404: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==404); - case 471: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==471); - case 536: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==536); - case 547: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==547); - case 603: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==603); + case 296: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==296); + case 313: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==313); + case 413: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==413); + case 480: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==480); + case 545: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==545); + case 556: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==556); + case 612: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==612); #line 302 "sql.y" -{ yylhsminor.yy236 = addNodeToList(pCxt, yymsp[-2].minor.yy236, yymsp[0].minor.yy28); } -#line 5655 "sql.c" - yymsp[-2].minor.yy236 = yylhsminor.yy236; +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, yymsp[0].minor.yy712); } +#line 5769 "sql.c" + yymsp[-2].minor.yy424 = yylhsminor.yy424; break; case 148: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ #line 304 "sql.y" -{ yylhsminor.yy28 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 5661 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 5775 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 149: /* speed_opt ::= */ - case 337: /* bufsize_opt ::= */ yytestcase(yyruleno==337); + case 346: /* bufsize_opt ::= */ yytestcase(yyruleno==346); #line 308 "sql.y" -{ yymsp[1].minor.yy956 = 0; } -#line 5668 "sql.c" +{ yymsp[1].minor.yy860 = 0; } +#line 5782 "sql.c" break; case 150: /* speed_opt ::= BWLIMIT NK_INTEGER */ - case 338: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==338); + case 347: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==347); #line 309 "sql.y" -{ yymsp[-1].minor.yy956 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } -#line 5674 "sql.c" +{ yymsp[-1].minor.yy860 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } +#line 5788 "sql.c" break; case 152: /* start_opt ::= START WITH NK_INTEGER */ case 156: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==156); #line 312 "sql.y" -{ yymsp[-2].minor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } -#line 5680 "sql.c" +{ yymsp[-2].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +#line 5794 "sql.c" break; case 153: /* start_opt ::= START WITH NK_STRING */ case 157: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==157); #line 313 "sql.y" -{ yymsp[-2].minor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 5686 "sql.c" +{ yymsp[-2].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 5800 "sql.c" break; case 154: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ case 158: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==158); #line 314 "sql.y" -{ yymsp[-3].minor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 5692 "sql.c" +{ yymsp[-3].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 5806 "sql.c" break; case 159: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 161: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==161); #line 323 "sql.y" -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy793, yymsp[-5].minor.yy28, yymsp[-3].minor.yy236, yymsp[-1].minor.yy236, yymsp[0].minor.yy28); } -#line 5698 "sql.c" +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy737, yymsp[-5].minor.yy712, yymsp[-3].minor.yy424, yymsp[-1].minor.yy424, yymsp[0].minor.yy712); } +#line 5812 "sql.c" break; case 160: /* cmd ::= CREATE TABLE multi_create_clause */ #line 324 "sql.y" -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy236); } -#line 5703 "sql.c" +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy424); } +#line 5817 "sql.c" break; case 162: /* cmd ::= DROP TABLE multi_drop_clause */ #line 327 "sql.y" -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy236); } -#line 5708 "sql.c" +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy424); } +#line 5822 "sql.c" break; case 163: /* cmd ::= DROP STABLE exists_opt full_table_name */ #line 328 "sql.y" -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy793, yymsp[0].minor.yy28); } -#line 5713 "sql.c" +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy737, yymsp[0].minor.yy712); } +#line 5827 "sql.c" break; case 164: /* cmd ::= ALTER TABLE alter_table_clause */ - case 376: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==376); - case 377: /* cmd ::= insert_query */ yytestcase(yyruleno==377); + case 385: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==385); + case 386: /* cmd ::= insert_query */ yytestcase(yyruleno==386); #line 330 "sql.y" -{ pCxt->pRootNode = yymsp[0].minor.yy28; } -#line 5720 "sql.c" +{ pCxt->pRootNode = yymsp[0].minor.yy712; } +#line 5834 "sql.c" break; case 165: /* cmd ::= ALTER STABLE alter_table_clause */ #line 331 "sql.y" -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy28); } -#line 5725 "sql.c" +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy712); } +#line 5839 "sql.c" break; case 166: /* alter_table_clause ::= full_table_name alter_table_options */ #line 333 "sql.y" -{ yylhsminor.yy28 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy28, yymsp[0].minor.yy28); } -#line 5730 "sql.c" - yymsp[-1].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy712, yymsp[0].minor.yy712); } +#line 5844 "sql.c" + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; case 167: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ #line 335 "sql.y" -{ yylhsminor.yy28 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy28, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy889, yymsp[0].minor.yy32); } -#line 5736 "sql.c" - yymsp[-4].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy329, yymsp[0].minor.yy784); } +#line 5850 "sql.c" + yymsp[-4].minor.yy712 = yylhsminor.yy712; break; case 168: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ #line 336 "sql.y" -{ yylhsminor.yy28 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy28, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy889); } -#line 5742 "sql.c" - yymsp[-3].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy712, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy329); } +#line 5856 "sql.c" + yymsp[-3].minor.yy712 = yylhsminor.yy712; break; case 169: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ #line 338 "sql.y" -{ yylhsminor.yy28 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy28, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy889, yymsp[0].minor.yy32); } -#line 5748 "sql.c" - yymsp[-4].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy329, yymsp[0].minor.yy784); } +#line 5862 "sql.c" + yymsp[-4].minor.yy712 = yylhsminor.yy712; break; case 170: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ #line 340 "sql.y" -{ yylhsminor.yy28 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy28, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy889, &yymsp[0].minor.yy889); } -#line 5754 "sql.c" - yymsp[-4].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy329, &yymsp[0].minor.yy329); } +#line 5868 "sql.c" + yymsp[-4].minor.yy712 = yylhsminor.yy712; break; case 171: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ #line 342 "sql.y" -{ yylhsminor.yy28 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy28, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy889, yymsp[0].minor.yy32); } -#line 5760 "sql.c" - yymsp[-4].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy329, yymsp[0].minor.yy784); } +#line 5874 "sql.c" + yymsp[-4].minor.yy712 = yylhsminor.yy712; break; case 172: /* alter_table_clause ::= full_table_name DROP TAG column_name */ #line 343 "sql.y" -{ yylhsminor.yy28 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy28, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy889); } -#line 5766 "sql.c" - yymsp[-3].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy712, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy329); } +#line 5880 "sql.c" + yymsp[-3].minor.yy712 = yylhsminor.yy712; break; case 173: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ #line 345 "sql.y" -{ yylhsminor.yy28 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy28, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy889, yymsp[0].minor.yy32); } -#line 5772 "sql.c" - yymsp[-4].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy329, yymsp[0].minor.yy784); } +#line 5886 "sql.c" + yymsp[-4].minor.yy712 = yylhsminor.yy712; break; case 174: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ #line 347 "sql.y" -{ yylhsminor.yy28 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy28, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy889, &yymsp[0].minor.yy889); } -#line 5778 "sql.c" - yymsp[-4].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy329, &yymsp[0].minor.yy329); } +#line 5892 "sql.c" + yymsp[-4].minor.yy712 = yylhsminor.yy712; break; case 175: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ #line 349 "sql.y" -{ yylhsminor.yy28 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy28, &yymsp[-2].minor.yy889, yymsp[0].minor.yy28); } -#line 5784 "sql.c" - yymsp[-5].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy712, &yymsp[-2].minor.yy329, yymsp[0].minor.yy712); } +#line 5898 "sql.c" + yymsp[-5].minor.yy712 = yylhsminor.yy712; break; case 177: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 477: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==477); + case 486: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==486); #line 354 "sql.y" -{ yylhsminor.yy236 = addNodeToList(pCxt, yymsp[-1].minor.yy236, yymsp[0].minor.yy28); } -#line 5791 "sql.c" - yymsp[-1].minor.yy236 = yylhsminor.yy236; +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-1].minor.yy424, yymsp[0].minor.yy712); } +#line 5905 "sql.c" + yymsp[-1].minor.yy424 = yylhsminor.yy424; break; case 178: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ #line 358 "sql.y" -{ yylhsminor.yy28 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy793, yymsp[-8].minor.yy28, yymsp[-6].minor.yy28, yymsp[-5].minor.yy236, yymsp[-2].minor.yy236, yymsp[0].minor.yy28); } -#line 5797 "sql.c" - yymsp[-9].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy737, yymsp[-8].minor.yy712, yymsp[-6].minor.yy712, yymsp[-5].minor.yy424, yymsp[-2].minor.yy424, yymsp[0].minor.yy712); } +#line 5911 "sql.c" + yymsp[-9].minor.yy712 = yylhsminor.yy712; break; case 181: /* drop_table_clause ::= exists_opt full_table_name */ #line 365 "sql.y" -{ yylhsminor.yy28 = createDropTableClause(pCxt, yymsp[-1].minor.yy793, yymsp[0].minor.yy28); } -#line 5803 "sql.c" - yymsp[-1].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = createDropTableClause(pCxt, yymsp[-1].minor.yy737, yymsp[0].minor.yy712); } +#line 5917 "sql.c" + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; case 183: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ - case 348: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==348); + case 357: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==357); #line 370 "sql.y" -{ yymsp[-2].minor.yy236 = yymsp[-1].minor.yy236; } -#line 5810 "sql.c" +{ yymsp[-2].minor.yy424 = yymsp[-1].minor.yy424; } +#line 5924 "sql.c" break; case 184: /* full_table_name ::= table_name */ #line 372 "sql.y" -{ yylhsminor.yy28 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy889, NULL); } -#line 5815 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy329, NULL); } +#line 5929 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; break; case 185: /* full_table_name ::= db_name NK_DOT table_name */ #line 373 "sql.y" -{ yylhsminor.yy28 = createRealTableNode(pCxt, &yymsp[-2].minor.yy889, &yymsp[0].minor.yy889, NULL); } -#line 5821 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = createRealTableNode(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy329, NULL); } +#line 5935 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 188: /* column_def ::= column_name type_name */ #line 380 "sql.y" -{ yylhsminor.yy28 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy889, yymsp[0].minor.yy32, NULL); } -#line 5827 "sql.c" - yymsp[-1].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy329, yymsp[0].minor.yy784, NULL); } +#line 5941 "sql.c" + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; case 189: /* type_name ::= BOOL */ #line 385 "sql.y" -{ yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_BOOL); } -#line 5833 "sql.c" +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_BOOL); } +#line 5947 "sql.c" break; case 190: /* type_name ::= TINYINT */ #line 386 "sql.y" -{ yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_TINYINT); } -#line 5838 "sql.c" +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_TINYINT); } +#line 5952 "sql.c" break; case 191: /* type_name ::= SMALLINT */ #line 387 "sql.y" -{ yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_SMALLINT); } -#line 5843 "sql.c" +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +#line 5957 "sql.c" break; case 192: /* type_name ::= INT */ case 193: /* type_name ::= INTEGER */ yytestcase(yyruleno==193); #line 388 "sql.y" -{ yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_INT); } -#line 5849 "sql.c" +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_INT); } +#line 5963 "sql.c" break; case 194: /* type_name ::= BIGINT */ #line 390 "sql.y" -{ yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_BIGINT); } -#line 5854 "sql.c" +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_BIGINT); } +#line 5968 "sql.c" break; case 195: /* type_name ::= FLOAT */ #line 391 "sql.y" -{ yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_FLOAT); } -#line 5859 "sql.c" +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_FLOAT); } +#line 5973 "sql.c" break; case 196: /* type_name ::= DOUBLE */ #line 392 "sql.y" -{ yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_DOUBLE); } -#line 5864 "sql.c" +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +#line 5978 "sql.c" break; case 197: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ #line 393 "sql.y" -{ yymsp[-3].minor.yy32 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } -#line 5869 "sql.c" +{ yymsp[-3].minor.yy784 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +#line 5983 "sql.c" break; case 198: /* type_name ::= TIMESTAMP */ #line 394 "sql.y" -{ yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } -#line 5874 "sql.c" +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +#line 5988 "sql.c" break; case 199: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ #line 395 "sql.y" -{ yymsp[-3].minor.yy32 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } -#line 5879 "sql.c" +{ yymsp[-3].minor.yy784 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +#line 5993 "sql.c" break; case 200: /* type_name ::= TINYINT UNSIGNED */ #line 396 "sql.y" -{ yymsp[-1].minor.yy32 = createDataType(TSDB_DATA_TYPE_UTINYINT); } -#line 5884 "sql.c" +{ yymsp[-1].minor.yy784 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +#line 5998 "sql.c" break; case 201: /* type_name ::= SMALLINT UNSIGNED */ #line 397 "sql.y" -{ yymsp[-1].minor.yy32 = createDataType(TSDB_DATA_TYPE_USMALLINT); } -#line 5889 "sql.c" +{ yymsp[-1].minor.yy784 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +#line 6003 "sql.c" break; case 202: /* type_name ::= INT UNSIGNED */ #line 398 "sql.y" -{ yymsp[-1].minor.yy32 = createDataType(TSDB_DATA_TYPE_UINT); } -#line 5894 "sql.c" +{ yymsp[-1].minor.yy784 = createDataType(TSDB_DATA_TYPE_UINT); } +#line 6008 "sql.c" break; case 203: /* type_name ::= BIGINT UNSIGNED */ #line 399 "sql.y" -{ yymsp[-1].minor.yy32 = createDataType(TSDB_DATA_TYPE_UBIGINT); } -#line 5899 "sql.c" +{ yymsp[-1].minor.yy784 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +#line 6013 "sql.c" break; case 204: /* type_name ::= JSON */ #line 400 "sql.y" -{ yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_JSON); } -#line 5904 "sql.c" +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_JSON); } +#line 6018 "sql.c" break; case 205: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ #line 401 "sql.y" -{ yymsp[-3].minor.yy32 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } -#line 5909 "sql.c" +{ yymsp[-3].minor.yy784 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +#line 6023 "sql.c" break; case 206: /* type_name ::= MEDIUMBLOB */ #line 402 "sql.y" -{ yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } -#line 5914 "sql.c" +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +#line 6028 "sql.c" break; case 207: /* type_name ::= BLOB */ #line 403 "sql.y" -{ yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_BLOB); } -#line 5919 "sql.c" +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_BLOB); } +#line 6033 "sql.c" break; case 208: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ #line 404 "sql.y" -{ yymsp[-3].minor.yy32 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } -#line 5924 "sql.c" +{ yymsp[-3].minor.yy784 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +#line 6038 "sql.c" break; case 209: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ #line 405 "sql.y" -{ yymsp[-3].minor.yy32 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } -#line 5929 "sql.c" +{ yymsp[-3].minor.yy784 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } +#line 6043 "sql.c" break; case 210: /* type_name ::= DECIMAL */ #line 406 "sql.y" -{ yymsp[0].minor.yy32 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 5934 "sql.c" +{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +#line 6048 "sql.c" break; case 211: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ #line 407 "sql.y" -{ yymsp[-3].minor.yy32 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 5939 "sql.c" +{ yymsp[-3].minor.yy784 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +#line 6053 "sql.c" break; case 212: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ #line 408 "sql.y" -{ yymsp[-5].minor.yy32 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 5944 "sql.c" +{ yymsp[-5].minor.yy784 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +#line 6058 "sql.c" break; case 215: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ - case 351: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==351); + case 360: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==360); #line 417 "sql.y" -{ yymsp[-3].minor.yy236 = yymsp[-1].minor.yy236; } -#line 5950 "sql.c" +{ yymsp[-3].minor.yy424 = yymsp[-1].minor.yy424; } +#line 6064 "sql.c" break; case 216: /* table_options ::= */ #line 419 "sql.y" -{ yymsp[1].minor.yy28 = createDefaultTableOptions(pCxt); } -#line 5955 "sql.c" +{ yymsp[1].minor.yy712 = createDefaultTableOptions(pCxt); } +#line 6069 "sql.c" break; case 217: /* table_options ::= table_options COMMENT NK_STRING */ #line 420 "sql.y" -{ yylhsminor.yy28 = setTableOption(pCxt, yymsp[-2].minor.yy28, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } -#line 5960 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-2].minor.yy712, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } +#line 6074 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 218: /* table_options ::= table_options MAX_DELAY duration_list */ #line 421 "sql.y" -{ yylhsminor.yy28 = setTableOption(pCxt, yymsp[-2].minor.yy28, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy236); } -#line 5966 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-2].minor.yy712, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy424); } +#line 6080 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 219: /* table_options ::= table_options WATERMARK duration_list */ #line 422 "sql.y" -{ yylhsminor.yy28 = setTableOption(pCxt, yymsp[-2].minor.yy28, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy236); } -#line 5972 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-2].minor.yy712, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy424); } +#line 6086 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 220: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ #line 423 "sql.y" -{ yylhsminor.yy28 = setTableOption(pCxt, yymsp[-4].minor.yy28, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy236); } -#line 5978 "sql.c" - yymsp[-4].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-4].minor.yy712, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy424); } +#line 6092 "sql.c" + yymsp[-4].minor.yy712 = yylhsminor.yy712; break; case 221: /* table_options ::= table_options TTL NK_INTEGER */ #line 424 "sql.y" -{ yylhsminor.yy28 = setTableOption(pCxt, yymsp[-2].minor.yy28, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } -#line 5984 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-2].minor.yy712, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } +#line 6098 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 222: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ #line 425 "sql.y" -{ yylhsminor.yy28 = setTableOption(pCxt, yymsp[-4].minor.yy28, TABLE_OPTION_SMA, yymsp[-1].minor.yy236); } -#line 5990 "sql.c" - yymsp[-4].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-4].minor.yy712, TABLE_OPTION_SMA, yymsp[-1].minor.yy424); } +#line 6104 "sql.c" + yymsp[-4].minor.yy712 = yylhsminor.yy712; break; case 223: /* table_options ::= table_options DELETE_MARK duration_list */ #line 426 "sql.y" -{ yylhsminor.yy28 = setTableOption(pCxt, yymsp[-2].minor.yy28, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy236); } -#line 5996 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-2].minor.yy712, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy424); } +#line 6110 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 224: /* alter_table_options ::= alter_table_option */ #line 428 "sql.y" -{ yylhsminor.yy28 = createAlterTableOptions(pCxt); yylhsminor.yy28 = setTableOption(pCxt, yylhsminor.yy28, yymsp[0].minor.yy481.type, &yymsp[0].minor.yy481.val); } -#line 6002 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = createAlterTableOptions(pCxt); yylhsminor.yy712 = setTableOption(pCxt, yylhsminor.yy712, yymsp[0].minor.yy245.type, &yymsp[0].minor.yy245.val); } +#line 6116 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; break; case 225: /* alter_table_options ::= alter_table_options alter_table_option */ #line 429 "sql.y" -{ yylhsminor.yy28 = setTableOption(pCxt, yymsp[-1].minor.yy28, yymsp[0].minor.yy481.type, &yymsp[0].minor.yy481.val); } -#line 6008 "sql.c" - yymsp[-1].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-1].minor.yy712, yymsp[0].minor.yy245.type, &yymsp[0].minor.yy245.val); } +#line 6122 "sql.c" + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; case 226: /* alter_table_option ::= COMMENT NK_STRING */ #line 433 "sql.y" -{ yymsp[-1].minor.yy481.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 6014 "sql.c" +{ yymsp[-1].minor.yy245.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } +#line 6128 "sql.c" break; case 227: /* alter_table_option ::= TTL NK_INTEGER */ #line 434 "sql.y" -{ yymsp[-1].minor.yy481.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy481.val = yymsp[0].minor.yy0; } -#line 6019 "sql.c" +{ yymsp[-1].minor.yy245.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } +#line 6133 "sql.c" break; case 228: /* duration_list ::= duration_literal */ - case 433: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==433); + case 442: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==442); #line 438 "sql.y" -{ yylhsminor.yy236 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy28)); } -#line 6025 "sql.c" - yymsp[0].minor.yy236 = yylhsminor.yy236; +{ yylhsminor.yy424 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy712)); } +#line 6139 "sql.c" + yymsp[0].minor.yy424 = yylhsminor.yy424; break; case 229: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 434: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==434); + case 443: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==443); #line 439 "sql.y" -{ yylhsminor.yy236 = addNodeToList(pCxt, yymsp[-2].minor.yy236, releaseRawExprNode(pCxt, yymsp[0].minor.yy28)); } -#line 6032 "sql.c" - yymsp[-2].minor.yy236 = yylhsminor.yy236; +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, releaseRawExprNode(pCxt, yymsp[0].minor.yy712)); } +#line 6146 "sql.c" + yymsp[-2].minor.yy424 = yylhsminor.yy424; break; case 232: /* rollup_func_name ::= function_name */ #line 446 "sql.y" -{ yylhsminor.yy28 = createFunctionNode(pCxt, &yymsp[0].minor.yy889, NULL); } -#line 6038 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = createFunctionNode(pCxt, &yymsp[0].minor.yy329, NULL); } +#line 6152 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; break; case 233: /* rollup_func_name ::= FIRST */ case 234: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==234); - case 292: /* tag_item ::= QTAGS */ yytestcase(yyruleno==292); + case 298: /* tag_item ::= QTAGS */ yytestcase(yyruleno==298); #line 447 "sql.y" -{ yylhsminor.yy28 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 6046 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } +#line 6160 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; break; case 237: /* col_name ::= column_name */ - case 293: /* tag_item ::= column_name */ yytestcase(yyruleno==293); + case 299: /* tag_item ::= column_name */ yytestcase(yyruleno==299); #line 455 "sql.y" -{ yylhsminor.yy28 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy889); } -#line 6053 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; +{ yylhsminor.yy712 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy329); } +#line 6167 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; break; case 238: /* cmd ::= SHOW DNODES */ #line 458 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } -#line 6059 "sql.c" +#line 6173 "sql.c" break; case 239: /* cmd ::= SHOW USERS */ #line 459 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } -#line 6064 "sql.c" +#line 6178 "sql.c" break; case 240: /* cmd ::= SHOW USER PRIVILEGES */ #line 460 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } -#line 6069 "sql.c" +#line 6183 "sql.c" break; - case 241: /* cmd ::= SHOW DATABASES */ + case 241: /* cmd ::= SHOW db_kind_opt DATABASES */ #line 461 "sql.y" -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } -#line 6074 "sql.c" +{ + pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); + setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy289); + } +#line 6191 "sql.c" break; - case 242: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -#line 462 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy28, yymsp[0].minor.yy28, OP_TYPE_LIKE); } -#line 6079 "sql.c" + case 242: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ +#line 465 "sql.y" +{ + pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy517, yymsp[0].minor.yy712, OP_TYPE_LIKE); + } +#line 6198 "sql.c" break; case 243: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -#line 463 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy28, yymsp[0].minor.yy28, OP_TYPE_LIKE); } -#line 6084 "sql.c" +#line 468 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy712, yymsp[0].minor.yy712, OP_TYPE_LIKE); } +#line 6203 "sql.c" break; case 244: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -#line 464 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy28, NULL, OP_TYPE_LIKE); } -#line 6089 "sql.c" +#line 469 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy712, NULL, OP_TYPE_LIKE); } +#line 6208 "sql.c" break; case 245: /* cmd ::= SHOW MNODES */ -#line 465 "sql.y" +#line 470 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } -#line 6094 "sql.c" +#line 6213 "sql.c" break; case 246: /* cmd ::= SHOW QNODES */ -#line 467 "sql.y" +#line 472 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } -#line 6099 "sql.c" +#line 6218 "sql.c" break; case 247: /* cmd ::= SHOW FUNCTIONS */ -#line 468 "sql.y" +#line 473 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } -#line 6104 "sql.c" +#line 6223 "sql.c" break; case 248: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -#line 469 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy28, yymsp[-1].minor.yy28, OP_TYPE_EQUAL); } -#line 6109 "sql.c" +#line 474 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy712, yymsp[-1].minor.yy712, OP_TYPE_EQUAL); } +#line 6228 "sql.c" break; case 249: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ -#line 470 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy889), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy889), OP_TYPE_EQUAL); } -#line 6114 "sql.c" +#line 475 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy329), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy329), OP_TYPE_EQUAL); } +#line 6233 "sql.c" break; case 250: /* cmd ::= SHOW STREAMS */ -#line 471 "sql.y" +#line 476 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } -#line 6119 "sql.c" +#line 6238 "sql.c" break; case 251: /* cmd ::= SHOW ACCOUNTS */ -#line 472 "sql.y" +#line 477 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 6124 "sql.c" +#line 6243 "sql.c" break; case 252: /* cmd ::= SHOW APPS */ -#line 473 "sql.y" +#line 478 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } -#line 6129 "sql.c" +#line 6248 "sql.c" break; case 253: /* cmd ::= SHOW CONNECTIONS */ -#line 474 "sql.y" +#line 479 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } -#line 6134 "sql.c" +#line 6253 "sql.c" break; case 254: /* cmd ::= SHOW LICENCES */ case 255: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==255); -#line 475 "sql.y" +#line 480 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } -#line 6140 "sql.c" +#line 6259 "sql.c" break; case 256: /* cmd ::= SHOW CREATE DATABASE db_name */ -#line 477 "sql.y" -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy889); } -#line 6145 "sql.c" +#line 482 "sql.y" +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy329); } +#line 6264 "sql.c" break; case 257: /* cmd ::= SHOW CREATE TABLE full_table_name */ -#line 478 "sql.y" -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy28); } -#line 6150 "sql.c" +#line 483 "sql.y" +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy712); } +#line 6269 "sql.c" break; case 258: /* cmd ::= SHOW CREATE STABLE full_table_name */ -#line 479 "sql.y" -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy28); } -#line 6155 "sql.c" +#line 484 "sql.y" +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy712); } +#line 6274 "sql.c" break; case 259: /* cmd ::= SHOW QUERIES */ -#line 480 "sql.y" +#line 485 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } -#line 6160 "sql.c" +#line 6279 "sql.c" break; case 260: /* cmd ::= SHOW SCORES */ -#line 481 "sql.y" +#line 486 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } -#line 6165 "sql.c" +#line 6284 "sql.c" break; case 261: /* cmd ::= SHOW TOPICS */ -#line 482 "sql.y" +#line 487 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } -#line 6170 "sql.c" +#line 6289 "sql.c" break; case 262: /* cmd ::= SHOW VARIABLES */ case 263: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==263); -#line 483 "sql.y" +#line 488 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } -#line 6176 "sql.c" +#line 6295 "sql.c" break; case 264: /* cmd ::= SHOW LOCAL VARIABLES */ -#line 485 "sql.y" +#line 490 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } -#line 6181 "sql.c" +#line 6300 "sql.c" break; case 265: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ -#line 486 "sql.y" -{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy28); } -#line 6186 "sql.c" +#line 491 "sql.y" +{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy712); } +#line 6305 "sql.c" break; case 266: /* cmd ::= SHOW BNODES */ -#line 487 "sql.y" +#line 492 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } -#line 6191 "sql.c" +#line 6310 "sql.c" break; case 267: /* cmd ::= SHOW SNODES */ -#line 488 "sql.y" +#line 493 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } -#line 6196 "sql.c" +#line 6315 "sql.c" break; case 268: /* cmd ::= SHOW CLUSTER */ -#line 489 "sql.y" +#line 494 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } -#line 6201 "sql.c" +#line 6320 "sql.c" break; case 269: /* cmd ::= SHOW TRANSACTIONS */ -#line 490 "sql.y" +#line 495 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } -#line 6206 "sql.c" +#line 6325 "sql.c" break; case 270: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -#line 491 "sql.y" -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy28); } -#line 6211 "sql.c" +#line 496 "sql.y" +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy712); } +#line 6330 "sql.c" break; case 271: /* cmd ::= SHOW CONSUMERS */ -#line 492 "sql.y" +#line 497 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } -#line 6216 "sql.c" +#line 6335 "sql.c" break; case 272: /* cmd ::= SHOW SUBSCRIPTIONS */ -#line 493 "sql.y" +#line 498 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } -#line 6221 "sql.c" +#line 6340 "sql.c" break; case 273: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -#line 494 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy28, yymsp[-1].minor.yy28, OP_TYPE_EQUAL); } -#line 6226 "sql.c" +#line 499 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy712, yymsp[-1].minor.yy712, OP_TYPE_EQUAL); } +#line 6345 "sql.c" break; case 274: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ -#line 495 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy889), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy889), OP_TYPE_EQUAL); } -#line 6231 "sql.c" +#line 500 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy329), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy329), OP_TYPE_EQUAL); } +#line 6350 "sql.c" break; case 275: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ -#line 496 "sql.y" -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy28, yymsp[0].minor.yy28, yymsp[-3].minor.yy236); } -#line 6236 "sql.c" +#line 501 "sql.y" +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy712, yymsp[0].minor.yy712, yymsp[-3].minor.yy424); } +#line 6355 "sql.c" break; case 276: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ -#line 497 "sql.y" -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy889), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy889), yymsp[-4].minor.yy236); } -#line 6241 "sql.c" +#line 502 "sql.y" +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy329), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy329), yymsp[-4].minor.yy424); } +#line 6360 "sql.c" break; case 277: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ -#line 498 "sql.y" +#line 503 "sql.y" { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } -#line 6246 "sql.c" +#line 6365 "sql.c" break; case 278: /* cmd ::= SHOW VNODES */ -#line 499 "sql.y" +#line 504 "sql.y" { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } -#line 6251 "sql.c" +#line 6370 "sql.c" break; case 279: /* cmd ::= SHOW db_name_cond_opt ALIVE */ -#line 501 "sql.y" -{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy28, QUERY_NODE_SHOW_DB_ALIVE_STMT); } -#line 6256 "sql.c" +#line 506 "sql.y" +{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy712, QUERY_NODE_SHOW_DB_ALIVE_STMT); } +#line 6375 "sql.c" break; case 280: /* cmd ::= SHOW CLUSTER ALIVE */ -#line 502 "sql.y" +#line 507 "sql.y" { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } -#line 6261 "sql.c" - break; - case 281: /* db_name_cond_opt ::= */ - case 286: /* from_db_opt ::= */ yytestcase(yyruleno==286); -#line 504 "sql.y" -{ yymsp[1].minor.yy28 = createDefaultDatabaseCondValue(pCxt); } -#line 6267 "sql.c" - break; - case 282: /* db_name_cond_opt ::= db_name NK_DOT */ -#line 505 "sql.y" -{ yylhsminor.yy28 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy889); } -#line 6272 "sql.c" - yymsp[-1].minor.yy28 = yylhsminor.yy28; - break; - case 284: /* like_pattern_opt ::= LIKE NK_STRING */ -#line 508 "sql.y" -{ yymsp[-1].minor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } -#line 6278 "sql.c" - break; - case 285: /* table_name_cond ::= table_name */ -#line 510 "sql.y" -{ yylhsminor.yy28 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy889); } -#line 6283 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; - break; - case 287: /* from_db_opt ::= FROM db_name */ -#line 513 "sql.y" -{ yymsp[-1].minor.yy28 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy889); } -#line 6289 "sql.c" - break; - case 291: /* tag_item ::= TBNAME */ -#line 521 "sql.y" -{ yylhsminor.yy28 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } -#line 6294 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; - break; - case 294: /* tag_item ::= column_name column_alias */ -#line 524 "sql.y" -{ yylhsminor.yy28 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy889), &yymsp[0].minor.yy889); } -#line 6300 "sql.c" - yymsp[-1].minor.yy28 = yylhsminor.yy28; - break; - case 295: /* tag_item ::= column_name AS column_alias */ -#line 525 "sql.y" -{ yylhsminor.yy28 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy889), &yymsp[0].minor.yy889); } -#line 6306 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; - break; - case 296: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ -#line 529 "sql.y" -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy793, yymsp[-3].minor.yy28, yymsp[-1].minor.yy28, NULL, yymsp[0].minor.yy28); } -#line 6312 "sql.c" - break; - case 297: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ -#line 531 "sql.y" -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy793, yymsp[-5].minor.yy28, yymsp[-3].minor.yy28, yymsp[-1].minor.yy236, NULL); } -#line 6317 "sql.c" - break; - case 298: /* cmd ::= DROP INDEX exists_opt full_index_name */ -#line 532 "sql.y" -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy793, yymsp[0].minor.yy28); } -#line 6322 "sql.c" - break; - case 299: /* full_index_name ::= index_name */ -#line 534 "sql.y" -{ yylhsminor.yy28 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy889); } -#line 6327 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; - break; - case 300: /* full_index_name ::= db_name NK_DOT index_name */ -#line 535 "sql.y" -{ yylhsminor.yy28 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy889, &yymsp[0].minor.yy889); } -#line 6333 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; - break; - case 301: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -#line 538 "sql.y" -{ yymsp[-9].minor.yy28 = createIndexOption(pCxt, yymsp[-7].minor.yy236, releaseRawExprNode(pCxt, yymsp[-3].minor.yy28), NULL, yymsp[-1].minor.yy28, yymsp[0].minor.yy28); } -#line 6339 "sql.c" - break; - case 302: /* 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 541 "sql.y" -{ yymsp[-11].minor.yy28 = createIndexOption(pCxt, yymsp[-9].minor.yy236, releaseRawExprNode(pCxt, yymsp[-5].minor.yy28), releaseRawExprNode(pCxt, yymsp[-3].minor.yy28), yymsp[-1].minor.yy28, yymsp[0].minor.yy28); } -#line 6344 "sql.c" - break; - case 305: /* func ::= sma_func_name NK_LP expression_list NK_RP */ -#line 548 "sql.y" -{ yylhsminor.yy28 = createFunctionNode(pCxt, &yymsp[-3].minor.yy889, yymsp[-1].minor.yy236); } -#line 6349 "sql.c" - yymsp[-3].minor.yy28 = yylhsminor.yy28; - break; - case 306: /* sma_func_name ::= function_name */ - case 520: /* alias_opt ::= table_alias */ yytestcase(yyruleno==520); -#line 552 "sql.y" -{ yylhsminor.yy889 = yymsp[0].minor.yy889; } -#line 6356 "sql.c" - yymsp[0].minor.yy889 = yylhsminor.yy889; - break; - case 311: /* sma_stream_opt ::= */ - case 352: /* stream_options ::= */ yytestcase(yyruleno==352); -#line 558 "sql.y" -{ yymsp[1].minor.yy28 = createStreamOptions(pCxt); } -#line 6363 "sql.c" - break; - case 312: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ -#line 559 "sql.y" -{ ((SStreamOptions*)yymsp[-2].minor.yy28)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy28); yylhsminor.yy28 = yymsp[-2].minor.yy28; } -#line 6368 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; - break; - case 313: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ -#line 560 "sql.y" -{ ((SStreamOptions*)yymsp[-2].minor.yy28)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy28); yylhsminor.yy28 = yymsp[-2].minor.yy28; } -#line 6374 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; - break; - case 314: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ -#line 561 "sql.y" -{ ((SStreamOptions*)yymsp[-2].minor.yy28)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy28); yylhsminor.yy28 = yymsp[-2].minor.yy28; } #line 6380 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 315: /* with_meta ::= AS */ -#line 566 "sql.y" -{ yymsp[0].minor.yy956 = 0; } -#line 6386 "sql.c" + case 281: /* table_kind_db_name_cond_opt ::= */ +#line 511 "sql.y" +{ yymsp[1].minor.yy517.kind = SHOW_KIND_ALL; yymsp[1].minor.yy517.dbName = nil_token; } +#line 6385 "sql.c" break; - case 316: /* with_meta ::= WITH META AS */ -#line 567 "sql.y" -{ yymsp[-2].minor.yy956 = 1; } -#line 6391 "sql.c" + case 282: /* table_kind_db_name_cond_opt ::= table_kind */ +#line 512 "sql.y" +{ yylhsminor.yy517.kind = yymsp[0].minor.yy289; yylhsminor.yy517.dbName = nil_token; } +#line 6390 "sql.c" + yymsp[0].minor.yy517 = yylhsminor.yy517; break; - case 317: /* with_meta ::= ONLY META AS */ -#line 568 "sql.y" -{ yymsp[-2].minor.yy956 = 2; } + case 283: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ +#line 513 "sql.y" +{ yylhsminor.yy517.kind = SHOW_KIND_ALL; yylhsminor.yy517.dbName = yymsp[-1].minor.yy329; } #line 6396 "sql.c" + yymsp[-1].minor.yy517 = yylhsminor.yy517; break; - case 318: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -#line 570 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy793, &yymsp[-2].minor.yy889, yymsp[0].minor.yy28); } -#line 6401 "sql.c" + case 284: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ +#line 514 "sql.y" +{ yylhsminor.yy517.kind = yymsp[-2].minor.yy289; yylhsminor.yy517.dbName = yymsp[-1].minor.yy329; } +#line 6402 "sql.c" + yymsp[-2].minor.yy517 = yylhsminor.yy517; break; - case 319: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ -#line 572 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy793, &yymsp[-3].minor.yy889, &yymsp[0].minor.yy889, yymsp[-2].minor.yy956); } -#line 6406 "sql.c" + case 285: /* table_kind ::= NORMAL */ +#line 518 "sql.y" +{ yymsp[0].minor.yy289 = SHOW_KIND_TABLES_NORMAL; } +#line 6408 "sql.c" break; - case 320: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ -#line 574 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy793, &yymsp[-4].minor.yy889, yymsp[-1].minor.yy28, yymsp[-3].minor.yy956, yymsp[0].minor.yy28); } -#line 6411 "sql.c" + case 286: /* table_kind ::= CHILD */ +#line 519 "sql.y" +{ yymsp[0].minor.yy289 = SHOW_KIND_TABLES_CHILD; } +#line 6413 "sql.c" break; - case 321: /* cmd ::= DROP TOPIC exists_opt topic_name */ -#line 576 "sql.y" -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy793, &yymsp[0].minor.yy889); } -#line 6416 "sql.c" + case 287: /* db_name_cond_opt ::= */ + case 292: /* from_db_opt ::= */ yytestcase(yyruleno==292); +#line 521 "sql.y" +{ yymsp[1].minor.yy712 = createDefaultDatabaseCondValue(pCxt); } +#line 6419 "sql.c" break; - case 322: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -#line 577 "sql.y" -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy793, &yymsp[-2].minor.yy889, &yymsp[0].minor.yy889); } -#line 6421 "sql.c" + case 288: /* db_name_cond_opt ::= db_name NK_DOT */ +#line 522 "sql.y" +{ yylhsminor.yy712 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy329); } +#line 6424 "sql.c" + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; - case 323: /* cmd ::= DESC full_table_name */ - case 324: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==324); -#line 580 "sql.y" -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy28); } -#line 6427 "sql.c" + case 290: /* like_pattern_opt ::= LIKE NK_STRING */ +#line 525 "sql.y" +{ yymsp[-1].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +#line 6430 "sql.c" break; - case 325: /* cmd ::= RESET QUERY CACHE */ + case 291: /* table_name_cond ::= table_name */ +#line 527 "sql.y" +{ yylhsminor.yy712 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy329); } +#line 6435 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; + break; + case 293: /* from_db_opt ::= FROM db_name */ +#line 530 "sql.y" +{ yymsp[-1].minor.yy712 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy329); } +#line 6441 "sql.c" + break; + case 297: /* tag_item ::= TBNAME */ +#line 538 "sql.y" +{ yylhsminor.yy712 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } +#line 6446 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; + break; + case 300: /* tag_item ::= column_name column_alias */ +#line 541 "sql.y" +{ yylhsminor.yy712 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy329), &yymsp[0].minor.yy329); } +#line 6452 "sql.c" + yymsp[-1].minor.yy712 = yylhsminor.yy712; + break; + case 301: /* tag_item ::= column_name AS column_alias */ +#line 542 "sql.y" +{ yylhsminor.yy712 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy329), &yymsp[0].minor.yy329); } +#line 6458 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; + break; + case 302: /* db_kind_opt ::= */ +#line 546 "sql.y" +{ yymsp[1].minor.yy289 = SHOW_KIND_ALL; } +#line 6464 "sql.c" + break; + case 303: /* db_kind_opt ::= USER */ +#line 547 "sql.y" +{ yymsp[0].minor.yy289 = SHOW_KIND_DATABASES_USER; } +#line 6469 "sql.c" + break; + case 304: /* db_kind_opt ::= SYSTEM */ +#line 548 "sql.y" +{ yymsp[0].minor.yy289 = SHOW_KIND_DATABASES_SYSTEM; } +#line 6474 "sql.c" + break; + case 305: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ +#line 552 "sql.y" +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy737, yymsp[-3].minor.yy712, yymsp[-1].minor.yy712, NULL, yymsp[0].minor.yy712); } +#line 6479 "sql.c" + break; + case 306: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ +#line 554 "sql.y" +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy737, yymsp[-5].minor.yy712, yymsp[-3].minor.yy712, yymsp[-1].minor.yy424, NULL); } +#line 6484 "sql.c" + break; + case 307: /* cmd ::= DROP INDEX exists_opt full_index_name */ +#line 555 "sql.y" +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy737, yymsp[0].minor.yy712); } +#line 6489 "sql.c" + break; + case 308: /* full_index_name ::= index_name */ +#line 557 "sql.y" +{ yylhsminor.yy712 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy329); } +#line 6494 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; + break; + case 309: /* full_index_name ::= db_name NK_DOT index_name */ +#line 558 "sql.y" +{ yylhsminor.yy712 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy329); } +#line 6500 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; + break; + case 310: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ +#line 561 "sql.y" +{ yymsp[-9].minor.yy712 = createIndexOption(pCxt, yymsp[-7].minor.yy424, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), NULL, yymsp[-1].minor.yy712, yymsp[0].minor.yy712); } +#line 6506 "sql.c" + break; + case 311: /* 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 564 "sql.y" +{ yymsp[-11].minor.yy712 = createIndexOption(pCxt, yymsp[-9].minor.yy424, releaseRawExprNode(pCxt, yymsp[-5].minor.yy712), releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), yymsp[-1].minor.yy712, yymsp[0].minor.yy712); } +#line 6511 "sql.c" + break; + case 314: /* func ::= sma_func_name NK_LP expression_list NK_RP */ +#line 571 "sql.y" +{ yylhsminor.yy712 = createFunctionNode(pCxt, &yymsp[-3].minor.yy329, yymsp[-1].minor.yy424); } +#line 6516 "sql.c" + yymsp[-3].minor.yy712 = yylhsminor.yy712; + break; + case 315: /* sma_func_name ::= function_name */ + case 529: /* alias_opt ::= table_alias */ yytestcase(yyruleno==529); +#line 575 "sql.y" +{ yylhsminor.yy329 = yymsp[0].minor.yy329; } +#line 6523 "sql.c" + yymsp[0].minor.yy329 = yylhsminor.yy329; + break; + case 320: /* sma_stream_opt ::= */ + case 361: /* stream_options ::= */ yytestcase(yyruleno==361); +#line 581 "sql.y" +{ yymsp[1].minor.yy712 = createStreamOptions(pCxt); } +#line 6530 "sql.c" + break; + case 321: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ +#line 582 "sql.y" +{ ((SStreamOptions*)yymsp[-2].minor.yy712)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy712); yylhsminor.yy712 = yymsp[-2].minor.yy712; } +#line 6535 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; + break; + case 322: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ +#line 583 "sql.y" +{ ((SStreamOptions*)yymsp[-2].minor.yy712)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy712); yylhsminor.yy712 = yymsp[-2].minor.yy712; } +#line 6541 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; + break; + case 323: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ #line 584 "sql.y" -{ pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } -#line 6432 "sql.c" +{ ((SStreamOptions*)yymsp[-2].minor.yy712)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy712); yylhsminor.yy712 = yymsp[-2].minor.yy712; } +#line 6547 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 326: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - case 327: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==327); -#line 587 "sql.y" -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy793, yymsp[-1].minor.yy28, yymsp[0].minor.yy28); } -#line 6438 "sql.c" + case 324: /* with_meta ::= AS */ +#line 589 "sql.y" +{ yymsp[0].minor.yy860 = 0; } +#line 6553 "sql.c" break; - case 330: /* explain_options ::= */ + case 325: /* with_meta ::= WITH META AS */ +#line 590 "sql.y" +{ yymsp[-2].minor.yy860 = 1; } +#line 6558 "sql.c" + break; + case 326: /* with_meta ::= ONLY META AS */ +#line 591 "sql.y" +{ yymsp[-2].minor.yy860 = 2; } +#line 6563 "sql.c" + break; + case 327: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ +#line 593 "sql.y" +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy737, &yymsp[-2].minor.yy329, yymsp[0].minor.yy712); } +#line 6568 "sql.c" + break; + case 328: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ #line 595 "sql.y" -{ yymsp[1].minor.yy28 = createDefaultExplainOptions(pCxt); } -#line 6443 "sql.c" +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy737, &yymsp[-3].minor.yy329, &yymsp[0].minor.yy329, yymsp[-2].minor.yy860); } +#line 6573 "sql.c" break; - case 331: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -#line 596 "sql.y" -{ yylhsminor.yy28 = setExplainVerbose(pCxt, yymsp[-2].minor.yy28, &yymsp[0].minor.yy0); } -#line 6448 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; - break; - case 332: /* explain_options ::= explain_options RATIO NK_FLOAT */ + case 329: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ #line 597 "sql.y" -{ yylhsminor.yy28 = setExplainRatio(pCxt, yymsp[-2].minor.yy28, &yymsp[0].minor.yy0); } -#line 6454 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy737, &yymsp[-4].minor.yy329, yymsp[-1].minor.yy712, yymsp[-3].minor.yy860, yymsp[0].minor.yy712); } +#line 6578 "sql.c" break; - case 333: /* 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 602 "sql.y" -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy793, yymsp[-9].minor.yy793, &yymsp[-6].minor.yy889, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy32, yymsp[-1].minor.yy956, &yymsp[0].minor.yy889, yymsp[-10].minor.yy793); } -#line 6460 "sql.c" + case 330: /* cmd ::= DROP TOPIC exists_opt topic_name */ +#line 599 "sql.y" +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy737, &yymsp[0].minor.yy329); } +#line 6583 "sql.c" break; - case 334: /* cmd ::= DROP FUNCTION exists_opt function_name */ + case 331: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ +#line 600 "sql.y" +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy737, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy329); } +#line 6588 "sql.c" + break; + case 332: /* cmd ::= DESC full_table_name */ + case 333: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==333); #line 603 "sql.y" -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy793, &yymsp[0].minor.yy889); } -#line 6465 "sql.c" +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy712); } +#line 6594 "sql.c" break; - case 339: /* language_opt ::= */ -#line 617 "sql.y" -{ yymsp[1].minor.yy889 = nil_token; } -#line 6470 "sql.c" + case 334: /* cmd ::= RESET QUERY CACHE */ +#line 607 "sql.y" +{ pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } +#line 6599 "sql.c" break; - case 340: /* language_opt ::= LANGUAGE NK_STRING */ -#line 618 "sql.y" -{ yymsp[-1].minor.yy889 = yymsp[0].minor.yy0; } -#line 6475 "sql.c" - break; - case 343: /* 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 628 "sql.y" -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy793, &yymsp[-8].minor.yy889, yymsp[-5].minor.yy28, yymsp[-7].minor.yy28, yymsp[-3].minor.yy236, yymsp[-2].minor.yy28, yymsp[0].minor.yy28, yymsp[-4].minor.yy236); } -#line 6480 "sql.c" - break; - case 344: /* cmd ::= DROP STREAM exists_opt stream_name */ -#line 629 "sql.y" -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy793, &yymsp[0].minor.yy889); } -#line 6485 "sql.c" - break; - case 345: /* cmd ::= PAUSE STREAM exists_opt stream_name */ -#line 630 "sql.y" -{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy793, &yymsp[0].minor.yy889); } -#line 6490 "sql.c" - break; - case 346: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ -#line 631 "sql.y" -{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy793, yymsp[-1].minor.yy793, &yymsp[0].minor.yy889); } -#line 6495 "sql.c" - break; - case 353: /* stream_options ::= stream_options TRIGGER AT_ONCE */ - case 354: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==354); -#line 645 "sql.y" -{ yylhsminor.yy28 = setStreamOptions(pCxt, yymsp[-2].minor.yy28, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } -#line 6501 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; - break; - case 355: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -#line 647 "sql.y" -{ yylhsminor.yy28 = setStreamOptions(pCxt, yymsp[-3].minor.yy28, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy28)); } -#line 6507 "sql.c" - yymsp[-3].minor.yy28 = yylhsminor.yy28; - break; - case 356: /* stream_options ::= stream_options WATERMARK duration_literal */ -#line 648 "sql.y" -{ yylhsminor.yy28 = setStreamOptions(pCxt, yymsp[-2].minor.yy28, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy28)); } -#line 6513 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; - break; - case 357: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -#line 649 "sql.y" -{ yylhsminor.yy28 = setStreamOptions(pCxt, yymsp[-3].minor.yy28, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } -#line 6519 "sql.c" - yymsp[-3].minor.yy28 = yylhsminor.yy28; - break; - case 358: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ -#line 650 "sql.y" -{ yylhsminor.yy28 = setStreamOptions(pCxt, yymsp[-2].minor.yy28, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } -#line 6525 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; - break; - case 359: /* stream_options ::= stream_options DELETE_MARK duration_literal */ -#line 651 "sql.y" -{ yylhsminor.yy28 = setStreamOptions(pCxt, yymsp[-2].minor.yy28, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy28)); } -#line 6531 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; - break; - case 360: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ -#line 652 "sql.y" -{ yylhsminor.yy28 = setStreamOptions(pCxt, yymsp[-3].minor.yy28, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } -#line 6537 "sql.c" - yymsp[-3].minor.yy28 = yylhsminor.yy28; - break; - case 362: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 558: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==558); - case 579: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==579); -#line 655 "sql.y" -{ yymsp[-3].minor.yy28 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy28); } -#line 6545 "sql.c" - break; - case 365: /* cmd ::= KILL CONNECTION NK_INTEGER */ -#line 663 "sql.y" -{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } -#line 6550 "sql.c" - break; - case 366: /* cmd ::= KILL QUERY NK_STRING */ -#line 664 "sql.y" -{ pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } -#line 6555 "sql.c" - break; - case 367: /* cmd ::= KILL TRANSACTION NK_INTEGER */ -#line 665 "sql.y" -{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } -#line 6560 "sql.c" - break; - case 368: /* cmd ::= BALANCE VGROUP */ -#line 668 "sql.y" -{ pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } -#line 6565 "sql.c" - break; - case 369: /* cmd ::= BALANCE VGROUP LEADER */ -#line 669 "sql.y" -{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt); } -#line 6570 "sql.c" - break; - case 370: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ -#line 670 "sql.y" -{ pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 6575 "sql.c" - break; - case 371: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -#line 671 "sql.y" -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy236); } -#line 6580 "sql.c" - break; - case 372: /* cmd ::= SPLIT VGROUP NK_INTEGER */ -#line 672 "sql.y" -{ pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } -#line 6585 "sql.c" - break; - case 373: /* dnode_list ::= DNODE NK_INTEGER */ -#line 676 "sql.y" -{ yymsp[-1].minor.yy236 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 6590 "sql.c" - break; - case 375: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -#line 683 "sql.y" -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy28, yymsp[0].minor.yy28); } -#line 6595 "sql.c" - break; - case 378: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ -#line 692 "sql.y" -{ yymsp[-6].minor.yy28 = createInsertStmt(pCxt, yymsp[-4].minor.yy28, yymsp[-2].minor.yy236, yymsp[0].minor.yy28); } -#line 6600 "sql.c" - break; - case 379: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ -#line 693 "sql.y" -{ yymsp[-3].minor.yy28 = createInsertStmt(pCxt, yymsp[-1].minor.yy28, NULL, yymsp[0].minor.yy28); } + case 335: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + case 336: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==336); +#line 610 "sql.y" +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy737, yymsp[-1].minor.yy712, yymsp[0].minor.yy712); } #line 6605 "sql.c" break; - case 380: /* literal ::= NK_INTEGER */ -#line 696 "sql.y" -{ yylhsminor.yy28 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } + case 339: /* explain_options ::= */ +#line 618 "sql.y" +{ yymsp[1].minor.yy712 = createDefaultExplainOptions(pCxt); } #line 6610 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 381: /* literal ::= NK_FLOAT */ -#line 697 "sql.y" -{ yylhsminor.yy28 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } -#line 6616 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; + case 340: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +#line 619 "sql.y" +{ yylhsminor.yy712 = setExplainVerbose(pCxt, yymsp[-2].minor.yy712, &yymsp[0].minor.yy0); } +#line 6615 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 382: /* literal ::= NK_STRING */ -#line 698 "sql.y" -{ yylhsminor.yy28 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 6622 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; + case 341: /* explain_options ::= explain_options RATIO NK_FLOAT */ +#line 620 "sql.y" +{ yylhsminor.yy712 = setExplainRatio(pCxt, yymsp[-2].minor.yy712, &yymsp[0].minor.yy0); } +#line 6621 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 383: /* literal ::= NK_BOOL */ -#line 699 "sql.y" -{ yylhsminor.yy28 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } -#line 6628 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; + case 342: /* 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 625 "sql.y" +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy737, yymsp[-9].minor.yy737, &yymsp[-6].minor.yy329, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy784, yymsp[-1].minor.yy860, &yymsp[0].minor.yy329, yymsp[-10].minor.yy737); } +#line 6627 "sql.c" break; - case 384: /* literal ::= TIMESTAMP NK_STRING */ -#line 700 "sql.y" -{ yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } -#line 6634 "sql.c" - yymsp[-1].minor.yy28 = yylhsminor.yy28; + case 343: /* cmd ::= DROP FUNCTION exists_opt function_name */ +#line 626 "sql.y" +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy737, &yymsp[0].minor.yy329); } +#line 6632 "sql.c" break; - case 385: /* literal ::= duration_literal */ - case 395: /* signed_literal ::= signed */ yytestcase(yyruleno==395); - case 416: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==416); - case 417: /* expression ::= literal */ yytestcase(yyruleno==417); - case 418: /* expression ::= pseudo_column */ yytestcase(yyruleno==418); - case 419: /* expression ::= column_reference */ yytestcase(yyruleno==419); - case 420: /* expression ::= function_expression */ yytestcase(yyruleno==420); - case 421: /* expression ::= case_when_expression */ yytestcase(yyruleno==421); - case 452: /* function_expression ::= literal_func */ yytestcase(yyruleno==452); - case 501: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==501); - case 505: /* boolean_primary ::= predicate */ yytestcase(yyruleno==505); - case 507: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==507); - case 508: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==508); - case 511: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==511); - case 513: /* table_reference ::= table_primary */ yytestcase(yyruleno==513); - case 514: /* table_reference ::= joined_table */ yytestcase(yyruleno==514); - case 518: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==518); - case 581: /* query_simple ::= query_specification */ yytestcase(yyruleno==581); - case 582: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==582); - case 585: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==585); - case 587: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==587); -#line 701 "sql.y" -{ yylhsminor.yy28 = yymsp[0].minor.yy28; } -#line 6660 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; + case 348: /* language_opt ::= */ +#line 640 "sql.y" +{ yymsp[1].minor.yy329 = nil_token; } +#line 6637 "sql.c" break; - case 386: /* literal ::= NULL */ -#line 702 "sql.y" -{ yylhsminor.yy28 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } -#line 6666 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; + case 349: /* language_opt ::= LANGUAGE NK_STRING */ +#line 641 "sql.y" +{ yymsp[-1].minor.yy329 = yymsp[0].minor.yy0; } +#line 6642 "sql.c" break; - case 387: /* literal ::= NK_QUESTION */ -#line 703 "sql.y" -{ yylhsminor.yy28 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 6672 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; + case 352: /* 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 651 "sql.y" +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy737, &yymsp[-8].minor.yy329, yymsp[-5].minor.yy712, yymsp[-7].minor.yy712, yymsp[-3].minor.yy424, yymsp[-2].minor.yy712, yymsp[0].minor.yy712, yymsp[-4].minor.yy424); } +#line 6647 "sql.c" break; - case 388: /* duration_literal ::= NK_VARIABLE */ -#line 705 "sql.y" -{ yylhsminor.yy28 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 6678 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; + case 353: /* cmd ::= DROP STREAM exists_opt stream_name */ +#line 652 "sql.y" +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy737, &yymsp[0].minor.yy329); } +#line 6652 "sql.c" break; - case 389: /* signed ::= NK_INTEGER */ -#line 707 "sql.y" -{ yylhsminor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } -#line 6684 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; + case 354: /* cmd ::= PAUSE STREAM exists_opt stream_name */ +#line 653 "sql.y" +{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy737, &yymsp[0].minor.yy329); } +#line 6657 "sql.c" break; - case 390: /* signed ::= NK_PLUS NK_INTEGER */ -#line 708 "sql.y" -{ yymsp[-1].minor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } -#line 6690 "sql.c" + case 355: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ +#line 654 "sql.y" +{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy737, yymsp[-1].minor.yy737, &yymsp[0].minor.yy329); } +#line 6662 "sql.c" break; - case 391: /* signed ::= NK_MINUS NK_INTEGER */ -#line 709 "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.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); - } -#line 6699 "sql.c" - yymsp[-1].minor.yy28 = yylhsminor.yy28; + case 362: /* stream_options ::= stream_options TRIGGER AT_ONCE */ + case 363: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==363); +#line 668 "sql.y" +{ yylhsminor.yy712 = setStreamOptions(pCxt, yymsp[-2].minor.yy712, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } +#line 6668 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 392: /* signed ::= NK_FLOAT */ -#line 714 "sql.y" -{ yylhsminor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } -#line 6705 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; + case 364: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +#line 670 "sql.y" +{ yylhsminor.yy712 = setStreamOptions(pCxt, yymsp[-3].minor.yy712, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy712)); } +#line 6674 "sql.c" + yymsp[-3].minor.yy712 = yylhsminor.yy712; break; - case 393: /* signed ::= NK_PLUS NK_FLOAT */ -#line 715 "sql.y" -{ yymsp[-1].minor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } -#line 6711 "sql.c" + case 365: /* stream_options ::= stream_options WATERMARK duration_literal */ +#line 671 "sql.y" +{ yylhsminor.yy712 = setStreamOptions(pCxt, yymsp[-2].minor.yy712, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy712)); } +#line 6680 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 394: /* signed ::= NK_MINUS NK_FLOAT */ -#line 716 "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.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); - } -#line 6720 "sql.c" - yymsp[-1].minor.yy28 = yylhsminor.yy28; + case 366: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +#line 672 "sql.y" +{ yylhsminor.yy712 = setStreamOptions(pCxt, yymsp[-3].minor.yy712, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } +#line 6686 "sql.c" + yymsp[-3].minor.yy712 = yylhsminor.yy712; break; - case 396: /* signed_literal ::= NK_STRING */ -#line 723 "sql.y" -{ yylhsminor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } -#line 6726 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; + case 367: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ +#line 673 "sql.y" +{ yylhsminor.yy712 = setStreamOptions(pCxt, yymsp[-2].minor.yy712, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } +#line 6692 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 397: /* signed_literal ::= NK_BOOL */ -#line 724 "sql.y" -{ yylhsminor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + case 368: /* stream_options ::= stream_options DELETE_MARK duration_literal */ +#line 674 "sql.y" +{ yylhsminor.yy712 = setStreamOptions(pCxt, yymsp[-2].minor.yy712, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy712)); } +#line 6698 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; + break; + case 369: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ +#line 675 "sql.y" +{ yylhsminor.yy712 = setStreamOptions(pCxt, yymsp[-3].minor.yy712, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } +#line 6704 "sql.c" + yymsp[-3].minor.yy712 = yylhsminor.yy712; + break; + case 371: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 567: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==567); + case 588: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==588); +#line 678 "sql.y" +{ yymsp[-3].minor.yy712 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy712); } +#line 6712 "sql.c" + break; + case 374: /* cmd ::= KILL CONNECTION NK_INTEGER */ +#line 686 "sql.y" +{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } +#line 6717 "sql.c" + break; + case 375: /* cmd ::= KILL QUERY NK_STRING */ +#line 687 "sql.y" +{ pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } +#line 6722 "sql.c" + break; + case 376: /* cmd ::= KILL TRANSACTION NK_INTEGER */ +#line 688 "sql.y" +{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } +#line 6727 "sql.c" + break; + case 377: /* cmd ::= BALANCE VGROUP */ +#line 691 "sql.y" +{ pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } #line 6732 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 398: /* signed_literal ::= TIMESTAMP NK_STRING */ -#line 725 "sql.y" -{ yymsp[-1].minor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 6738 "sql.c" + case 378: /* cmd ::= BALANCE VGROUP LEADER */ +#line 692 "sql.y" +{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt); } +#line 6737 "sql.c" break; - case 399: /* signed_literal ::= duration_literal */ - case 401: /* signed_literal ::= literal_func */ yytestcase(yyruleno==401); - case 472: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==472); - case 538: /* select_item ::= common_expression */ yytestcase(yyruleno==538); - case 548: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==548); - case 586: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==586); - case 588: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==588); - case 601: /* search_condition ::= common_expression */ yytestcase(yyruleno==601); -#line 726 "sql.y" -{ yylhsminor.yy28 = releaseRawExprNode(pCxt, yymsp[0].minor.yy28); } -#line 6750 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; + case 379: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ +#line 693 "sql.y" +{ pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } +#line 6742 "sql.c" break; - case 400: /* signed_literal ::= NULL */ -#line 727 "sql.y" -{ yylhsminor.yy28 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } -#line 6756 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; + case 380: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +#line 694 "sql.y" +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy424); } +#line 6747 "sql.c" break; - case 402: /* signed_literal ::= NK_QUESTION */ -#line 729 "sql.y" -{ yylhsminor.yy28 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + case 381: /* cmd ::= SPLIT VGROUP NK_INTEGER */ +#line 695 "sql.y" +{ pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } +#line 6752 "sql.c" + break; + case 382: /* dnode_list ::= DNODE NK_INTEGER */ +#line 699 "sql.y" +{ yymsp[-1].minor.yy424 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 6757 "sql.c" + break; + case 384: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +#line 706 "sql.y" +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy712, yymsp[0].minor.yy712); } #line 6762 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; break; - case 422: /* expression ::= NK_LP expression NK_RP */ - case 506: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==506); - case 600: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==600); -#line 790 "sql.y" -{ yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy28)); } -#line 6770 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; + case 387: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +#line 715 "sql.y" +{ yymsp[-6].minor.yy712 = createInsertStmt(pCxt, yymsp[-4].minor.yy712, yymsp[-2].minor.yy424, yymsp[0].minor.yy712); } +#line 6767 "sql.c" break; - case 423: /* expression ::= NK_PLUS expr_or_subquery */ -#line 791 "sql.y" -{ - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); - yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy28)); + case 388: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ +#line 716 "sql.y" +{ yymsp[-3].minor.yy712 = createInsertStmt(pCxt, yymsp[-1].minor.yy712, NULL, yymsp[0].minor.yy712); } +#line 6772 "sql.c" + break; + case 389: /* literal ::= NK_INTEGER */ +#line 719 "sql.y" +{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } +#line 6777 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; + break; + case 390: /* literal ::= NK_FLOAT */ +#line 720 "sql.y" +{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } +#line 6783 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; + break; + case 391: /* literal ::= NK_STRING */ +#line 721 "sql.y" +{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } +#line 6789 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; + break; + case 392: /* literal ::= NK_BOOL */ +#line 722 "sql.y" +{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } +#line 6795 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; + break; + case 393: /* literal ::= TIMESTAMP NK_STRING */ +#line 723 "sql.y" +{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } +#line 6801 "sql.c" + yymsp[-1].minor.yy712 = yylhsminor.yy712; + break; + case 394: /* literal ::= duration_literal */ + case 404: /* signed_literal ::= signed */ yytestcase(yyruleno==404); + case 425: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==425); + case 426: /* expression ::= literal */ yytestcase(yyruleno==426); + case 427: /* expression ::= pseudo_column */ yytestcase(yyruleno==427); + case 428: /* expression ::= column_reference */ yytestcase(yyruleno==428); + case 429: /* expression ::= function_expression */ yytestcase(yyruleno==429); + case 430: /* expression ::= case_when_expression */ yytestcase(yyruleno==430); + case 461: /* function_expression ::= literal_func */ yytestcase(yyruleno==461); + case 510: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==510); + case 514: /* boolean_primary ::= predicate */ yytestcase(yyruleno==514); + case 516: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==516); + case 517: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==517); + case 520: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==520); + case 522: /* table_reference ::= table_primary */ yytestcase(yyruleno==522); + case 523: /* table_reference ::= joined_table */ yytestcase(yyruleno==523); + case 527: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==527); + case 590: /* query_simple ::= query_specification */ yytestcase(yyruleno==590); + case 591: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==591); + case 594: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==594); + case 596: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==596); +#line 724 "sql.y" +{ yylhsminor.yy712 = yymsp[0].minor.yy712; } +#line 6827 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; + break; + case 395: /* literal ::= NULL */ +#line 725 "sql.y" +{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } +#line 6833 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; + break; + case 396: /* literal ::= NK_QUESTION */ +#line 726 "sql.y" +{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 6839 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; + break; + case 397: /* duration_literal ::= NK_VARIABLE */ +#line 728 "sql.y" +{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 6845 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; + break; + case 398: /* signed ::= NK_INTEGER */ +#line 730 "sql.y" +{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } +#line 6851 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; + break; + case 399: /* signed ::= NK_PLUS NK_INTEGER */ +#line 731 "sql.y" +{ yymsp[-1].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } +#line 6857 "sql.c" + break; + case 400: /* signed ::= NK_MINUS NK_INTEGER */ +#line 732 "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.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } -#line 6779 "sql.c" - yymsp[-1].minor.yy28 = yylhsminor.yy28; +#line 6866 "sql.c" + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; - case 424: /* expression ::= NK_MINUS expr_or_subquery */ -#line 795 "sql.y" -{ - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); - yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy28), NULL)); + case 401: /* signed ::= NK_FLOAT */ +#line 737 "sql.y" +{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } +#line 6872 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; + break; + case 402: /* signed ::= NK_PLUS NK_FLOAT */ +#line 738 "sql.y" +{ yymsp[-1].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } +#line 6878 "sql.c" + break; + case 403: /* signed ::= NK_MINUS NK_FLOAT */ +#line 739 "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.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } -#line 6788 "sql.c" - yymsp[-1].minor.yy28 = yylhsminor.yy28; +#line 6887 "sql.c" + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; - case 425: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ -#line 799 "sql.y" -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); - yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); - } -#line 6798 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; + case 405: /* signed_literal ::= NK_STRING */ +#line 746 "sql.y" +{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +#line 6893 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 426: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ -#line 804 "sql.y" -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); - yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); - } -#line 6808 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; + case 406: /* signed_literal ::= NK_BOOL */ +#line 747 "sql.y" +{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } +#line 6899 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 427: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ -#line 809 "sql.y" -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); - yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); - } -#line 6818 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; + case 407: /* signed_literal ::= TIMESTAMP NK_STRING */ +#line 748 "sql.y" +{ yymsp[-1].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 6905 "sql.c" break; - case 428: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + case 408: /* signed_literal ::= duration_literal */ + case 410: /* signed_literal ::= literal_func */ yytestcase(yyruleno==410); + case 481: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==481); + case 547: /* select_item ::= common_expression */ yytestcase(yyruleno==547); + case 557: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==557); + case 595: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==595); + case 597: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==597); + case 610: /* search_condition ::= common_expression */ yytestcase(yyruleno==610); +#line 749 "sql.y" +{ yylhsminor.yy712 = releaseRawExprNode(pCxt, yymsp[0].minor.yy712); } +#line 6917 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; + break; + case 409: /* signed_literal ::= NULL */ +#line 750 "sql.y" +{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } +#line 6923 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; + break; + case 411: /* signed_literal ::= NK_QUESTION */ +#line 752 "sql.y" +{ yylhsminor.yy712 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } +#line 6929 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; + break; + case 431: /* expression ::= NK_LP expression NK_RP */ + case 515: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==515); + case 609: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==609); +#line 813 "sql.y" +{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy712)); } +#line 6937 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; + break; + case 432: /* expression ::= NK_PLUS expr_or_subquery */ #line 814 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); - yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy712)); } -#line 6828 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; - break; - case 429: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ -#line 819 "sql.y" -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); - yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); - } -#line 6838 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; - break; - case 430: /* expression ::= column_reference NK_ARROW NK_STRING */ -#line 824 "sql.y" -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); - yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); - } -#line 6847 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; - break; - case 431: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ -#line 828 "sql.y" -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); - yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); - } -#line 6857 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; - break; - case 432: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ -#line 833 "sql.y" -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); - yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); - } -#line 6867 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; - break; - case 435: /* column_reference ::= column_name */ -#line 844 "sql.y" -{ yylhsminor.yy28 = createRawExprNode(pCxt, &yymsp[0].minor.yy889, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy889)); } -#line 6873 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; - break; - case 436: /* column_reference ::= table_name NK_DOT column_name */ -#line 845 "sql.y" -{ yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy889, &yymsp[0].minor.yy889, createColumnNode(pCxt, &yymsp[-2].minor.yy889, &yymsp[0].minor.yy889)); } -#line 6879 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; - break; - case 437: /* pseudo_column ::= ROWTS */ - case 438: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==438); - case 440: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==440); - case 441: /* pseudo_column ::= QEND */ yytestcase(yyruleno==441); - case 442: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==442); - case 443: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==443); - case 444: /* pseudo_column ::= WEND */ yytestcase(yyruleno==444); - case 445: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==445); - case 446: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==446); - case 447: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==447); - case 448: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==448); - case 454: /* literal_func ::= NOW */ yytestcase(yyruleno==454); -#line 847 "sql.y" -{ yylhsminor.yy28 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } -#line 6896 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; - break; - case 439: /* pseudo_column ::= table_name NK_DOT TBNAME */ -#line 849 "sql.y" -{ yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy889, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy889)))); } -#line 6902 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; - break; - case 449: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 450: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==450); -#line 860 "sql.y" -{ yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy889, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy889, yymsp[-1].minor.yy236)); } -#line 6909 "sql.c" - yymsp[-3].minor.yy28 = yylhsminor.yy28; - break; - case 451: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ -#line 863 "sql.y" -{ yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy28), yymsp[-1].minor.yy32)); } -#line 6915 "sql.c" - yymsp[-5].minor.yy28 = yylhsminor.yy28; - break; - case 453: /* literal_func ::= noarg_func NK_LP NK_RP */ -#line 866 "sql.y" -{ yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy889, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy889, NULL)); } -#line 6921 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; - break; - case 468: /* star_func_para_list ::= NK_STAR */ -#line 890 "sql.y" -{ yylhsminor.yy236 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } -#line 6927 "sql.c" - yymsp[0].minor.yy236 = yylhsminor.yy236; - break; - case 473: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 541: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==541); -#line 899 "sql.y" -{ yylhsminor.yy28 = createColumnNode(pCxt, &yymsp[-2].minor.yy889, &yymsp[0].minor.yy0); } -#line 6934 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; - break; - case 474: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ -#line 902 "sql.y" -{ yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy236, yymsp[-1].minor.yy28)); } -#line 6940 "sql.c" - yymsp[-3].minor.yy28 = yylhsminor.yy28; - break; - case 475: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -#line 904 "sql.y" -{ yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy28), yymsp[-2].minor.yy236, yymsp[-1].minor.yy28)); } #line 6946 "sql.c" - yymsp[-4].minor.yy28 = yylhsminor.yy28; + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; - case 478: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -#line 911 "sql.y" -{ yymsp[-3].minor.yy28 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28)); } -#line 6952 "sql.c" - break; - case 480: /* case_when_else_opt ::= ELSE common_expression */ -#line 914 "sql.y" -{ yymsp[-1].minor.yy28 = releaseRawExprNode(pCxt, yymsp[0].minor.yy28); } -#line 6957 "sql.c" - break; - case 481: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 486: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==486); -#line 917 "sql.y" + case 433: /* expression ::= NK_MINUS expr_or_subquery */ +#line 818 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); - yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy896, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy712), NULL)); } -#line 6967 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +#line 6955 "sql.c" + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; - case 482: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ -#line 924 "sql.y" + case 434: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ +#line 822 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy28); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); - yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy28), releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } -#line 6977 "sql.c" - yymsp[-4].minor.yy28 = yylhsminor.yy28; +#line 6965 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 483: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ -#line 930 "sql.y" + case 435: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ +#line 827 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy28); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); - yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy28), releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } -#line 6987 "sql.c" - yymsp[-5].minor.yy28 = yylhsminor.yy28; +#line 6975 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 484: /* predicate ::= expr_or_subquery IS NULL */ -#line 935 "sql.y" + case 436: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ +#line 832 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); - yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } -#line 6996 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +#line 6985 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 485: /* predicate ::= expr_or_subquery IS NOT NULL */ -#line 939 "sql.y" + case 437: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ +#line 837 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy28); - yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy28), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); + } +#line 6995 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; + break; + case 438: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ +#line 842 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } #line 7005 "sql.c" - yymsp[-3].minor.yy28 = yylhsminor.yy28; + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 487: /* compare_op ::= NK_LT */ -#line 951 "sql.y" -{ yymsp[0].minor.yy896 = OP_TYPE_LOWER_THAN; } -#line 7011 "sql.c" + case 439: /* expression ::= column_reference NK_ARROW NK_STRING */ +#line 847 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + } +#line 7014 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 488: /* compare_op ::= NK_GT */ -#line 952 "sql.y" -{ yymsp[0].minor.yy896 = OP_TYPE_GREATER_THAN; } -#line 7016 "sql.c" + case 440: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ +#line 851 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); + } +#line 7024 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 489: /* compare_op ::= NK_LE */ -#line 953 "sql.y" -{ yymsp[0].minor.yy896 = OP_TYPE_LOWER_EQUAL; } -#line 7021 "sql.c" + case 441: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ +#line 856 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); + } +#line 7034 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 490: /* compare_op ::= NK_GE */ -#line 954 "sql.y" -{ yymsp[0].minor.yy896 = OP_TYPE_GREATER_EQUAL; } -#line 7026 "sql.c" + case 444: /* column_reference ::= column_name */ +#line 867 "sql.y" +{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy329, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy329)); } +#line 7040 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 491: /* compare_op ::= NK_NE */ -#line 955 "sql.y" -{ yymsp[0].minor.yy896 = OP_TYPE_NOT_EQUAL; } -#line 7031 "sql.c" - break; - case 492: /* compare_op ::= NK_EQ */ -#line 956 "sql.y" -{ yymsp[0].minor.yy896 = OP_TYPE_EQUAL; } -#line 7036 "sql.c" - break; - case 493: /* compare_op ::= LIKE */ -#line 957 "sql.y" -{ yymsp[0].minor.yy896 = OP_TYPE_LIKE; } -#line 7041 "sql.c" - break; - case 494: /* compare_op ::= NOT LIKE */ -#line 958 "sql.y" -{ yymsp[-1].minor.yy896 = OP_TYPE_NOT_LIKE; } + case 445: /* column_reference ::= table_name NK_DOT column_name */ +#line 868 "sql.y" +{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy329, createColumnNode(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy329)); } #line 7046 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 495: /* compare_op ::= MATCH */ -#line 959 "sql.y" -{ yymsp[0].minor.yy896 = OP_TYPE_MATCH; } -#line 7051 "sql.c" + case 446: /* pseudo_column ::= ROWTS */ + case 447: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==447); + case 449: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==449); + case 450: /* pseudo_column ::= QEND */ yytestcase(yyruleno==450); + case 451: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==451); + case 452: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==452); + case 453: /* pseudo_column ::= WEND */ yytestcase(yyruleno==453); + case 454: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==454); + case 455: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==455); + case 456: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==456); + case 457: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==457); + case 463: /* literal_func ::= NOW */ yytestcase(yyruleno==463); +#line 870 "sql.y" +{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } +#line 7063 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 496: /* compare_op ::= NMATCH */ -#line 960 "sql.y" -{ yymsp[0].minor.yy896 = OP_TYPE_NMATCH; } -#line 7056 "sql.c" + case 448: /* pseudo_column ::= table_name NK_DOT TBNAME */ +#line 872 "sql.y" +{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy329)))); } +#line 7069 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 497: /* compare_op ::= CONTAINS */ -#line 961 "sql.y" -{ yymsp[0].minor.yy896 = OP_TYPE_JSON_CONTAINS; } -#line 7061 "sql.c" - break; - case 498: /* in_op ::= IN */ -#line 965 "sql.y" -{ yymsp[0].minor.yy896 = OP_TYPE_IN; } -#line 7066 "sql.c" - break; - case 499: /* in_op ::= NOT IN */ -#line 966 "sql.y" -{ yymsp[-1].minor.yy896 = OP_TYPE_NOT_IN; } -#line 7071 "sql.c" - break; - case 500: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -#line 968 "sql.y" -{ yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy236)); } + case 458: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 459: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==459); +#line 883 "sql.y" +{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy329, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy329, yymsp[-1].minor.yy424)); } #line 7076 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; + yymsp[-3].minor.yy712 = yylhsminor.yy712; break; - case 502: /* boolean_value_expression ::= NOT boolean_primary */ -#line 972 "sql.y" + case 460: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ +#line 886 "sql.y" +{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), yymsp[-1].minor.yy784)); } +#line 7082 "sql.c" + yymsp[-5].minor.yy712 = yylhsminor.yy712; + break; + case 462: /* literal_func ::= noarg_func NK_LP NK_RP */ +#line 889 "sql.y" +{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy329, NULL)); } +#line 7088 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; + break; + case 477: /* star_func_para_list ::= NK_STAR */ +#line 913 "sql.y" +{ yylhsminor.yy424 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } +#line 7094 "sql.c" + yymsp[0].minor.yy424 = yylhsminor.yy424; + break; + case 482: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 550: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==550); +#line 922 "sql.y" +{ yylhsminor.yy712 = createColumnNode(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy0); } +#line 7101 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; + break; + case 483: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +#line 925 "sql.y" +{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy424, yymsp[-1].minor.yy712)); } +#line 7107 "sql.c" + yymsp[-3].minor.yy712 = yylhsminor.yy712; + break; + case 484: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +#line 927 "sql.y" +{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), yymsp[-2].minor.yy424, yymsp[-1].minor.yy712)); } +#line 7113 "sql.c" + yymsp[-4].minor.yy712 = yylhsminor.yy712; + break; + case 487: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +#line 934 "sql.y" +{ yymsp[-3].minor.yy712 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712)); } +#line 7119 "sql.c" + break; + case 489: /* case_when_else_opt ::= ELSE common_expression */ +#line 937 "sql.y" +{ yymsp[-1].minor.yy712 = releaseRawExprNode(pCxt, yymsp[0].minor.yy712); } +#line 7124 "sql.c" + break; + case 490: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 495: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==495); +#line 940 "sql.y" { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); - yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy28), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy540, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } -#line 7085 "sql.c" - yymsp[-1].minor.yy28 = yylhsminor.yy28; +#line 7134 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 503: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ -#line 977 "sql.y" + case 491: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ +#line 947 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); - yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy712), releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } -#line 7095 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +#line 7144 "sql.c" + yymsp[-4].minor.yy712 = yylhsminor.yy712; break; - case 504: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ -#line 983 "sql.y" + case 492: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ +#line 953 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy28); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy28); - yylhsminor.yy28 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy712), releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } -#line 7105 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; +#line 7154 "sql.c" + yymsp[-5].minor.yy712 = yylhsminor.yy712; break; - case 512: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -#line 1001 "sql.y" -{ yylhsminor.yy28 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy28, yymsp[0].minor.yy28, NULL); } -#line 7111 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; - break; - case 515: /* table_primary ::= table_name alias_opt */ -#line 1007 "sql.y" -{ yylhsminor.yy28 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy889, &yymsp[0].minor.yy889); } -#line 7117 "sql.c" - yymsp[-1].minor.yy28 = yylhsminor.yy28; - break; - case 516: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -#line 1008 "sql.y" -{ yylhsminor.yy28 = createRealTableNode(pCxt, &yymsp[-3].minor.yy889, &yymsp[-1].minor.yy889, &yymsp[0].minor.yy889); } -#line 7123 "sql.c" - yymsp[-3].minor.yy28 = yylhsminor.yy28; - break; - case 517: /* table_primary ::= subquery alias_opt */ -#line 1009 "sql.y" -{ yylhsminor.yy28 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy28), &yymsp[0].minor.yy889); } -#line 7129 "sql.c" - yymsp[-1].minor.yy28 = yylhsminor.yy28; - break; - case 519: /* alias_opt ::= */ -#line 1014 "sql.y" -{ yymsp[1].minor.yy889 = nil_token; } -#line 7135 "sql.c" - break; - case 521: /* alias_opt ::= AS table_alias */ -#line 1016 "sql.y" -{ yymsp[-1].minor.yy889 = yymsp[0].minor.yy889; } -#line 7140 "sql.c" - break; - case 522: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 523: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==523); -#line 1018 "sql.y" -{ yymsp[-2].minor.yy28 = yymsp[-1].minor.yy28; } -#line 7146 "sql.c" - break; - case 524: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -#line 1023 "sql.y" -{ yylhsminor.yy28 = createJoinTableNode(pCxt, yymsp[-4].minor.yy152, yymsp[-5].minor.yy28, yymsp[-2].minor.yy28, yymsp[0].minor.yy28); } -#line 7151 "sql.c" - yymsp[-5].minor.yy28 = yylhsminor.yy28; - break; - case 525: /* join_type ::= */ -#line 1027 "sql.y" -{ yymsp[1].minor.yy152 = JOIN_TYPE_INNER; } -#line 7157 "sql.c" - break; - case 526: /* join_type ::= INNER */ -#line 1028 "sql.y" -{ yymsp[0].minor.yy152 = JOIN_TYPE_INNER; } -#line 7162 "sql.c" - break; - case 527: /* 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 1034 "sql.y" + case 493: /* predicate ::= expr_or_subquery IS NULL */ +#line 958 "sql.y" { - yymsp[-13].minor.yy28 = createSelectStmt(pCxt, yymsp[-11].minor.yy793, yymsp[-9].minor.yy236, yymsp[-8].minor.yy28, yymsp[-12].minor.yy236); - yymsp[-13].minor.yy28 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy28, yymsp[-10].minor.yy793); - yymsp[-13].minor.yy28 = addWhereClause(pCxt, yymsp[-13].minor.yy28, yymsp[-7].minor.yy28); - yymsp[-13].minor.yy28 = addPartitionByClause(pCxt, yymsp[-13].minor.yy28, yymsp[-6].minor.yy236); - yymsp[-13].minor.yy28 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy28, yymsp[-2].minor.yy28); - yymsp[-13].minor.yy28 = addGroupByClause(pCxt, yymsp[-13].minor.yy28, yymsp[-1].minor.yy236); - yymsp[-13].minor.yy28 = addHavingClause(pCxt, yymsp[-13].minor.yy28, yymsp[0].minor.yy28); - yymsp[-13].minor.yy28 = addRangeClause(pCxt, yymsp[-13].minor.yy28, yymsp[-5].minor.yy28); - yymsp[-13].minor.yy28 = addEveryClause(pCxt, yymsp[-13].minor.yy28, yymsp[-4].minor.yy28); - yymsp[-13].minor.yy28 = addFillClause(pCxt, yymsp[-13].minor.yy28, yymsp[-3].minor.yy28); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), NULL)); } +#line 7163 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; + break; + case 494: /* predicate ::= expr_or_subquery IS NOT NULL */ +#line 962 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), NULL)); + } +#line 7172 "sql.c" + yymsp[-3].minor.yy712 = yylhsminor.yy712; + break; + case 496: /* compare_op ::= NK_LT */ +#line 974 "sql.y" +{ yymsp[0].minor.yy540 = OP_TYPE_LOWER_THAN; } #line 7178 "sql.c" break; - case 528: /* hint_list ::= */ -#line 1049 "sql.y" -{ yymsp[1].minor.yy236 = createHintNodeList(pCxt, NULL); } + case 497: /* compare_op ::= NK_GT */ +#line 975 "sql.y" +{ yymsp[0].minor.yy540 = OP_TYPE_GREATER_THAN; } #line 7183 "sql.c" break; - case 529: /* hint_list ::= NK_HINT */ -#line 1050 "sql.y" -{ yylhsminor.yy236 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } + case 498: /* compare_op ::= NK_LE */ +#line 976 "sql.y" +{ yymsp[0].minor.yy540 = OP_TYPE_LOWER_EQUAL; } #line 7188 "sql.c" - yymsp[0].minor.yy236 = yylhsminor.yy236; break; - case 534: /* set_quantifier_opt ::= ALL */ -#line 1061 "sql.y" -{ yymsp[0].minor.yy793 = false; } -#line 7194 "sql.c" + case 499: /* compare_op ::= NK_GE */ +#line 977 "sql.y" +{ yymsp[0].minor.yy540 = OP_TYPE_GREATER_EQUAL; } +#line 7193 "sql.c" break; - case 537: /* select_item ::= NK_STAR */ -#line 1068 "sql.y" -{ yylhsminor.yy28 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } -#line 7199 "sql.c" - yymsp[0].minor.yy28 = yylhsminor.yy28; + case 500: /* compare_op ::= NK_NE */ +#line 978 "sql.y" +{ yymsp[0].minor.yy540 = OP_TYPE_NOT_EQUAL; } +#line 7198 "sql.c" break; - case 539: /* select_item ::= common_expression column_alias */ - case 549: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==549); -#line 1070 "sql.y" -{ yylhsminor.yy28 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy28), &yymsp[0].minor.yy889); } -#line 7206 "sql.c" - yymsp[-1].minor.yy28 = yylhsminor.yy28; + case 501: /* compare_op ::= NK_EQ */ +#line 979 "sql.y" +{ yymsp[0].minor.yy540 = OP_TYPE_EQUAL; } +#line 7203 "sql.c" break; - case 540: /* select_item ::= common_expression AS column_alias */ - case 550: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==550); -#line 1071 "sql.y" -{ yylhsminor.yy28 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), &yymsp[0].minor.yy889); } + case 502: /* compare_op ::= LIKE */ +#line 980 "sql.y" +{ yymsp[0].minor.yy540 = OP_TYPE_LIKE; } +#line 7208 "sql.c" + break; + case 503: /* compare_op ::= NOT LIKE */ +#line 981 "sql.y" +{ yymsp[-1].minor.yy540 = OP_TYPE_NOT_LIKE; } #line 7213 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; break; - case 545: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 570: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==570); - case 590: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==590); -#line 1080 "sql.y" -{ yymsp[-2].minor.yy236 = yymsp[0].minor.yy236; } -#line 7221 "sql.c" + case 504: /* compare_op ::= MATCH */ +#line 982 "sql.y" +{ yymsp[0].minor.yy540 = OP_TYPE_MATCH; } +#line 7218 "sql.c" break; - case 552: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -#line 1093 "sql.y" -{ yymsp[-5].minor.yy28 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy28), releaseRawExprNode(pCxt, yymsp[-1].minor.yy28)); } -#line 7226 "sql.c" + case 505: /* compare_op ::= NMATCH */ +#line 983 "sql.y" +{ yymsp[0].minor.yy540 = OP_TYPE_NMATCH; } +#line 7223 "sql.c" break; - case 553: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -#line 1094 "sql.y" -{ yymsp[-3].minor.yy28 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy28)); } -#line 7231 "sql.c" + case 506: /* compare_op ::= CONTAINS */ +#line 984 "sql.y" +{ yymsp[0].minor.yy540 = OP_TYPE_JSON_CONTAINS; } +#line 7228 "sql.c" break; - case 554: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -#line 1096 "sql.y" -{ yymsp[-5].minor.yy28 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy28), NULL, yymsp[-1].minor.yy28, yymsp[0].minor.yy28); } -#line 7236 "sql.c" + case 507: /* in_op ::= IN */ +#line 988 "sql.y" +{ yymsp[0].minor.yy540 = OP_TYPE_IN; } +#line 7233 "sql.c" break; - case 555: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -#line 1099 "sql.y" -{ yymsp[-7].minor.yy28 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy28), releaseRawExprNode(pCxt, yymsp[-3].minor.yy28), yymsp[-1].minor.yy28, yymsp[0].minor.yy28); } -#line 7241 "sql.c" + case 508: /* in_op ::= NOT IN */ +#line 989 "sql.y" +{ yymsp[-1].minor.yy540 = OP_TYPE_NOT_IN; } +#line 7238 "sql.c" break; - case 556: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ -#line 1101 "sql.y" -{ yymsp[-6].minor.yy28 = createEventWindowNode(pCxt, yymsp[-3].minor.yy28, yymsp[0].minor.yy28); } -#line 7246 "sql.c" + case 509: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +#line 991 "sql.y" +{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy424)); } +#line 7243 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 560: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -#line 1107 "sql.y" -{ yymsp[-3].minor.yy28 = createFillNode(pCxt, yymsp[-1].minor.yy322, NULL); } -#line 7251 "sql.c" + case 511: /* boolean_value_expression ::= NOT boolean_primary */ +#line 995 "sql.y" +{ + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy712), NULL)); + } +#line 7252 "sql.c" + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; - case 561: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ -#line 1108 "sql.y" -{ yymsp[-5].minor.yy28 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy236)); } -#line 7256 "sql.c" + case 512: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ +#line 1000 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); + } +#line 7262 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 562: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ -#line 1109 "sql.y" -{ yymsp[-5].minor.yy28 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy236)); } -#line 7261 "sql.c" + case 513: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ +#line 1006 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); + } +#line 7272 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 563: /* fill_mode ::= NONE */ -#line 1113 "sql.y" -{ yymsp[0].minor.yy322 = FILL_MODE_NONE; } -#line 7266 "sql.c" + case 521: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +#line 1024 "sql.y" +{ yylhsminor.yy712 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy712, yymsp[0].minor.yy712, NULL); } +#line 7278 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 564: /* fill_mode ::= PREV */ -#line 1114 "sql.y" -{ yymsp[0].minor.yy322 = FILL_MODE_PREV; } -#line 7271 "sql.c" + case 524: /* table_primary ::= table_name alias_opt */ +#line 1030 "sql.y" +{ yylhsminor.yy712 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy329, &yymsp[0].minor.yy329); } +#line 7284 "sql.c" + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; - case 565: /* fill_mode ::= NULL */ -#line 1115 "sql.y" -{ yymsp[0].minor.yy322 = FILL_MODE_NULL; } -#line 7276 "sql.c" + case 525: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +#line 1031 "sql.y" +{ yylhsminor.yy712 = createRealTableNode(pCxt, &yymsp[-3].minor.yy329, &yymsp[-1].minor.yy329, &yymsp[0].minor.yy329); } +#line 7290 "sql.c" + yymsp[-3].minor.yy712 = yylhsminor.yy712; break; - case 566: /* fill_mode ::= NULL_F */ -#line 1116 "sql.y" -{ yymsp[0].minor.yy322 = FILL_MODE_NULL_F; } -#line 7281 "sql.c" - break; - case 567: /* fill_mode ::= LINEAR */ -#line 1117 "sql.y" -{ yymsp[0].minor.yy322 = FILL_MODE_LINEAR; } -#line 7286 "sql.c" - break; - case 568: /* fill_mode ::= NEXT */ -#line 1118 "sql.y" -{ yymsp[0].minor.yy322 = FILL_MODE_NEXT; } -#line 7291 "sql.c" - break; - case 571: /* group_by_list ::= expr_or_subquery */ -#line 1127 "sql.y" -{ yylhsminor.yy236 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); } + case 526: /* table_primary ::= subquery alias_opt */ +#line 1032 "sql.y" +{ yylhsminor.yy712 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy712), &yymsp[0].minor.yy329); } #line 7296 "sql.c" - yymsp[0].minor.yy236 = yylhsminor.yy236; + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; - case 572: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -#line 1128 "sql.y" -{ yylhsminor.yy236 = addNodeToList(pCxt, yymsp[-2].minor.yy236, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy28))); } + case 528: /* alias_opt ::= */ +#line 1037 "sql.y" +{ yymsp[1].minor.yy329 = nil_token; } #line 7302 "sql.c" - yymsp[-2].minor.yy236 = yylhsminor.yy236; break; - case 576: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ -#line 1135 "sql.y" -{ yymsp[-5].minor.yy28 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy28), releaseRawExprNode(pCxt, yymsp[-1].minor.yy28)); } -#line 7308 "sql.c" + case 530: /* alias_opt ::= AS table_alias */ +#line 1039 "sql.y" +{ yymsp[-1].minor.yy329 = yymsp[0].minor.yy329; } +#line 7307 "sql.c" break; - case 577: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ -#line 1137 "sql.y" -{ yymsp[-3].minor.yy28 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy28)); } + case 531: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 532: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==532); +#line 1041 "sql.y" +{ yymsp[-2].minor.yy712 = yymsp[-1].minor.yy712; } #line 7313 "sql.c" break; - case 580: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ -#line 1144 "sql.y" + case 533: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +#line 1046 "sql.y" +{ yylhsminor.yy712 = createJoinTableNode(pCxt, yymsp[-4].minor.yy412, yymsp[-5].minor.yy712, yymsp[-2].minor.yy712, yymsp[0].minor.yy712); } +#line 7318 "sql.c" + yymsp[-5].minor.yy712 = yylhsminor.yy712; + break; + case 534: /* join_type ::= */ +#line 1050 "sql.y" +{ yymsp[1].minor.yy412 = JOIN_TYPE_INNER; } +#line 7324 "sql.c" + break; + case 535: /* join_type ::= INNER */ +#line 1051 "sql.y" +{ yymsp[0].minor.yy412 = JOIN_TYPE_INNER; } +#line 7329 "sql.c" + break; + case 536: /* 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 1057 "sql.y" { - yylhsminor.yy28 = addOrderByClause(pCxt, yymsp[-3].minor.yy28, yymsp[-2].minor.yy236); - yylhsminor.yy28 = addSlimitClause(pCxt, yylhsminor.yy28, yymsp[-1].minor.yy28); - yylhsminor.yy28 = addLimitClause(pCxt, yylhsminor.yy28, yymsp[0].minor.yy28); + yymsp[-13].minor.yy712 = createSelectStmt(pCxt, yymsp[-11].minor.yy737, yymsp[-9].minor.yy424, yymsp[-8].minor.yy712, yymsp[-12].minor.yy424); + yymsp[-13].minor.yy712 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy712, yymsp[-10].minor.yy737); + yymsp[-13].minor.yy712 = addWhereClause(pCxt, yymsp[-13].minor.yy712, yymsp[-7].minor.yy712); + yymsp[-13].minor.yy712 = addPartitionByClause(pCxt, yymsp[-13].minor.yy712, yymsp[-6].minor.yy424); + yymsp[-13].minor.yy712 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy712, yymsp[-2].minor.yy712); + yymsp[-13].minor.yy712 = addGroupByClause(pCxt, yymsp[-13].minor.yy712, yymsp[-1].minor.yy424); + yymsp[-13].minor.yy712 = addHavingClause(pCxt, yymsp[-13].minor.yy712, yymsp[0].minor.yy712); + yymsp[-13].minor.yy712 = addRangeClause(pCxt, yymsp[-13].minor.yy712, yymsp[-5].minor.yy712); + yymsp[-13].minor.yy712 = addEveryClause(pCxt, yymsp[-13].minor.yy712, yymsp[-4].minor.yy712); + yymsp[-13].minor.yy712 = addFillClause(pCxt, yymsp[-13].minor.yy712, yymsp[-3].minor.yy712); } -#line 7322 "sql.c" - yymsp[-3].minor.yy28 = yylhsminor.yy28; +#line 7345 "sql.c" break; - case 583: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -#line 1154 "sql.y" -{ yylhsminor.yy28 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy28, yymsp[0].minor.yy28); } -#line 7328 "sql.c" - yymsp[-3].minor.yy28 = yylhsminor.yy28; + case 537: /* hint_list ::= */ +#line 1072 "sql.y" +{ yymsp[1].minor.yy424 = createHintNodeList(pCxt, NULL); } +#line 7350 "sql.c" break; - case 584: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -#line 1156 "sql.y" -{ yylhsminor.yy28 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy28, yymsp[0].minor.yy28); } -#line 7334 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; + case 538: /* hint_list ::= NK_HINT */ +#line 1073 "sql.y" +{ yylhsminor.yy424 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } +#line 7355 "sql.c" + yymsp[0].minor.yy424 = yylhsminor.yy424; break; - case 592: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 596: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==596); -#line 1170 "sql.y" -{ yymsp[-1].minor.yy28 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 7341 "sql.c" + case 543: /* set_quantifier_opt ::= ALL */ +#line 1084 "sql.y" +{ yymsp[0].minor.yy737 = false; } +#line 7361 "sql.c" break; - case 593: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 597: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==597); -#line 1171 "sql.y" -{ yymsp[-3].minor.yy28 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } -#line 7347 "sql.c" + case 546: /* select_item ::= NK_STAR */ +#line 1091 "sql.y" +{ yylhsminor.yy712 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } +#line 7366 "sql.c" + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 594: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 598: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==598); -#line 1172 "sql.y" -{ yymsp[-3].minor.yy28 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } -#line 7353 "sql.c" + case 548: /* select_item ::= common_expression column_alias */ + case 558: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==558); +#line 1093 "sql.y" +{ yylhsminor.yy712 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy712), &yymsp[0].minor.yy329); } +#line 7373 "sql.c" + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; - case 599: /* subquery ::= NK_LP query_expression NK_RP */ -#line 1180 "sql.y" -{ yylhsminor.yy28 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy28); } -#line 7358 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; - break; - case 604: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -#line 1194 "sql.y" -{ yylhsminor.yy28 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy28), yymsp[-1].minor.yy734, yymsp[0].minor.yy945); } -#line 7364 "sql.c" - yymsp[-2].minor.yy28 = yylhsminor.yy28; - break; - case 605: /* ordering_specification_opt ::= */ -#line 1198 "sql.y" -{ yymsp[1].minor.yy734 = ORDER_ASC; } -#line 7370 "sql.c" - break; - case 606: /* ordering_specification_opt ::= ASC */ -#line 1199 "sql.y" -{ yymsp[0].minor.yy734 = ORDER_ASC; } -#line 7375 "sql.c" - break; - case 607: /* ordering_specification_opt ::= DESC */ -#line 1200 "sql.y" -{ yymsp[0].minor.yy734 = ORDER_DESC; } + case 549: /* select_item ::= common_expression AS column_alias */ + case 559: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==559); +#line 1094 "sql.y" +{ yylhsminor.yy712 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), &yymsp[0].minor.yy329); } #line 7380 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 608: /* null_ordering_opt ::= */ -#line 1204 "sql.y" -{ yymsp[1].minor.yy945 = NULL_ORDER_DEFAULT; } -#line 7385 "sql.c" + case 554: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 579: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==579); + case 599: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==599); +#line 1103 "sql.y" +{ yymsp[-2].minor.yy424 = yymsp[0].minor.yy424; } +#line 7388 "sql.c" break; - case 609: /* null_ordering_opt ::= NULLS FIRST */ -#line 1205 "sql.y" -{ yymsp[-1].minor.yy945 = NULL_ORDER_FIRST; } -#line 7390 "sql.c" + case 561: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +#line 1116 "sql.y" +{ yymsp[-5].minor.yy712 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), releaseRawExprNode(pCxt, yymsp[-1].minor.yy712)); } +#line 7393 "sql.c" break; - case 610: /* null_ordering_opt ::= NULLS LAST */ -#line 1206 "sql.y" -{ yymsp[-1].minor.yy945 = NULL_ORDER_LAST; } -#line 7395 "sql.c" + case 562: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +#line 1117 "sql.y" +{ yymsp[-3].minor.yy712 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy712)); } +#line 7398 "sql.c" + break; + case 563: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +#line 1119 "sql.y" +{ yymsp[-5].minor.yy712 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), NULL, yymsp[-1].minor.yy712, yymsp[0].minor.yy712); } +#line 7403 "sql.c" + break; + case 564: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +#line 1122 "sql.y" +{ yymsp[-7].minor.yy712 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy712), releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), yymsp[-1].minor.yy712, yymsp[0].minor.yy712); } +#line 7408 "sql.c" + break; + case 565: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ +#line 1124 "sql.y" +{ yymsp[-6].minor.yy712 = createEventWindowNode(pCxt, yymsp[-3].minor.yy712, yymsp[0].minor.yy712); } +#line 7413 "sql.c" + break; + case 569: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +#line 1130 "sql.y" +{ yymsp[-3].minor.yy712 = createFillNode(pCxt, yymsp[-1].minor.yy294, NULL); } +#line 7418 "sql.c" + break; + case 570: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ +#line 1131 "sql.y" +{ yymsp[-5].minor.yy712 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy424)); } +#line 7423 "sql.c" + break; + case 571: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ +#line 1132 "sql.y" +{ yymsp[-5].minor.yy712 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy424)); } +#line 7428 "sql.c" + break; + case 572: /* fill_mode ::= NONE */ +#line 1136 "sql.y" +{ yymsp[0].minor.yy294 = FILL_MODE_NONE; } +#line 7433 "sql.c" + break; + case 573: /* fill_mode ::= PREV */ +#line 1137 "sql.y" +{ yymsp[0].minor.yy294 = FILL_MODE_PREV; } +#line 7438 "sql.c" + break; + case 574: /* fill_mode ::= NULL */ +#line 1138 "sql.y" +{ yymsp[0].minor.yy294 = FILL_MODE_NULL; } +#line 7443 "sql.c" + break; + case 575: /* fill_mode ::= NULL_F */ +#line 1139 "sql.y" +{ yymsp[0].minor.yy294 = FILL_MODE_NULL_F; } +#line 7448 "sql.c" + break; + case 576: /* fill_mode ::= LINEAR */ +#line 1140 "sql.y" +{ yymsp[0].minor.yy294 = FILL_MODE_LINEAR; } +#line 7453 "sql.c" + break; + case 577: /* fill_mode ::= NEXT */ +#line 1141 "sql.y" +{ yymsp[0].minor.yy294 = FILL_MODE_NEXT; } +#line 7458 "sql.c" + break; + case 580: /* group_by_list ::= expr_or_subquery */ +#line 1150 "sql.y" +{ yylhsminor.yy424 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } +#line 7463 "sql.c" + yymsp[0].minor.yy424 = yylhsminor.yy424; + break; + case 581: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +#line 1151 "sql.y" +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } +#line 7469 "sql.c" + yymsp[-2].minor.yy424 = yylhsminor.yy424; + break; + case 585: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +#line 1158 "sql.y" +{ yymsp[-5].minor.yy712 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), releaseRawExprNode(pCxt, yymsp[-1].minor.yy712)); } +#line 7475 "sql.c" + break; + case 586: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ +#line 1160 "sql.y" +{ yymsp[-3].minor.yy712 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy712)); } +#line 7480 "sql.c" + break; + case 589: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ +#line 1167 "sql.y" +{ + yylhsminor.yy712 = addOrderByClause(pCxt, yymsp[-3].minor.yy712, yymsp[-2].minor.yy424); + yylhsminor.yy712 = addSlimitClause(pCxt, yylhsminor.yy712, yymsp[-1].minor.yy712); + yylhsminor.yy712 = addLimitClause(pCxt, yylhsminor.yy712, yymsp[0].minor.yy712); + } +#line 7489 "sql.c" + yymsp[-3].minor.yy712 = yylhsminor.yy712; + break; + case 592: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +#line 1177 "sql.y" +{ yylhsminor.yy712 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy712, yymsp[0].minor.yy712); } +#line 7495 "sql.c" + yymsp[-3].minor.yy712 = yylhsminor.yy712; + break; + case 593: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +#line 1179 "sql.y" +{ yylhsminor.yy712 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy712, yymsp[0].minor.yy712); } +#line 7501 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; + break; + case 601: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 605: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==605); +#line 1193 "sql.y" +{ yymsp[-1].minor.yy712 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } +#line 7508 "sql.c" + break; + case 602: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 606: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==606); +#line 1194 "sql.y" +{ yymsp[-3].minor.yy712 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } +#line 7514 "sql.c" + break; + case 603: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 607: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==607); +#line 1195 "sql.y" +{ yymsp[-3].minor.yy712 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } +#line 7520 "sql.c" + break; + case 608: /* subquery ::= NK_LP query_expression NK_RP */ +#line 1203 "sql.y" +{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy712); } +#line 7525 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; + break; + case 613: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +#line 1217 "sql.y" +{ yylhsminor.yy712 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), yymsp[-1].minor.yy938, yymsp[0].minor.yy857); } +#line 7531 "sql.c" + yymsp[-2].minor.yy712 = yylhsminor.yy712; + break; + case 614: /* ordering_specification_opt ::= */ +#line 1221 "sql.y" +{ yymsp[1].minor.yy938 = ORDER_ASC; } +#line 7537 "sql.c" + break; + case 615: /* ordering_specification_opt ::= ASC */ +#line 1222 "sql.y" +{ yymsp[0].minor.yy938 = ORDER_ASC; } +#line 7542 "sql.c" + break; + case 616: /* ordering_specification_opt ::= DESC */ +#line 1223 "sql.y" +{ yymsp[0].minor.yy938 = ORDER_DESC; } +#line 7547 "sql.c" + break; + case 617: /* null_ordering_opt ::= */ +#line 1227 "sql.y" +{ yymsp[1].minor.yy857 = NULL_ORDER_DEFAULT; } +#line 7552 "sql.c" + break; + case 618: /* null_ordering_opt ::= NULLS FIRST */ +#line 1228 "sql.y" +{ yymsp[-1].minor.yy857 = NULL_ORDER_FIRST; } +#line 7557 "sql.c" + break; + case 619: /* null_ordering_opt ::= NULLS LAST */ +#line 1229 "sql.y" +{ yymsp[-1].minor.yy857 = NULL_ORDER_LAST; } +#line 7562 "sql.c" break; default: break; @@ -7465,7 +7632,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 7468 "sql.c" +#line 7635 "sql.c" /************ End %syntax_error code ******************************************/ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseCTX_STORE diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index 45b2a73822..a3baa5d43a 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -1256,6 +1256,10 @@ static int32_t createPartitionLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pS nodesCloneNode(nodesListGetNode(pCxt->pCurrRoot->pTargets, 0))); } + if (TSDB_CODE_SUCCESS == code) { + code = nodesCollectFuncs(pSelect, SQL_CLAUSE_GROUP_BY, NULL, fmIsAggFunc, &pPartition->pAggFuncs); + } + if (TSDB_CODE_SUCCESS == code) { pPartition->pPartitionKeys = nodesCloneList(pSelect->pPartitionByList); if (NULL == pPartition->pPartitionKeys) { diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index c81ca0b3d1..28e07fe98d 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -171,11 +171,16 @@ static bool scanPathOptMayBeOptimized(SLogicNode* pNode) { } static bool scanPathOptShouldGetFuncs(SLogicNode* pNode) { + if (QUERY_NODE_LOGIC_PLAN_PARTITION == nodeType(pNode)) { + if (pNode->pParent && QUERY_NODE_LOGIC_PLAN_WINDOW == nodeType(pNode->pParent)) { + if (WINDOW_TYPE_INTERVAL == ((SWindowLogicNode*)pNode->pParent)->winType) return true; + } else { + return !scanPathOptHaveNormalCol(((SPartitionLogicNode*)pNode)->pPartitionKeys); + } + } + if ((QUERY_NODE_LOGIC_PLAN_WINDOW == nodeType(pNode) && - WINDOW_TYPE_INTERVAL == ((SWindowLogicNode*)pNode)->winType) || - (QUERY_NODE_LOGIC_PLAN_PARTITION == nodeType(pNode) && pNode->pParent && - QUERY_NODE_LOGIC_PLAN_WINDOW == nodeType(pNode->pParent) && - WINDOW_TYPE_INTERVAL == ((SWindowLogicNode*)pNode->pParent)->winType)) { + WINDOW_TYPE_INTERVAL == ((SWindowLogicNode*)pNode)->winType)) { return true; } if (QUERY_NODE_LOGIC_PLAN_AGG == nodeType(pNode)) { @@ -191,30 +196,17 @@ static SNodeList* scanPathOptGetAllFuncs(SLogicNode* pNode) { return ((SWindowLogicNode*)pNode)->pFuncs; case QUERY_NODE_LOGIC_PLAN_AGG: return ((SAggLogicNode*)pNode)->pAggFuncs; + case QUERY_NODE_LOGIC_PLAN_PARTITION: + return ((SPartitionLogicNode*)pNode)->pAggFuncs; default: break; } return NULL; } -static bool scanPathOptNeedOptimizeDataRequire(const SFunctionNode* pFunc) { - if (!fmIsSpecialDataRequiredFunc(pFunc->funcId)) { - return false; - } - SNode* pPara = NULL; - FOREACH(pPara, pFunc->pParameterList) { - if (QUERY_NODE_COLUMN != nodeType(pPara) && QUERY_NODE_VALUE != nodeType(pPara)) { - return false; - } - } - return true; -} - -static bool scanPathOptNeedDynOptimize(const SFunctionNode* pFunc) { - if (!fmIsDynamicScanOptimizedFunc(pFunc->funcId)) { - return false; - } - SNode* pPara = NULL; +static bool scanPathOptIsSpecifiedFuncType(const SFunctionNode* pFunc, bool (*typeCheckFn)(int32_t)) { + if (!typeCheckFn(pFunc->funcId)) return false; + SNode* pPara; FOREACH(pPara, pFunc->pParameterList) { if (QUERY_NODE_COLUMN != nodeType(pPara) && QUERY_NODE_VALUE != nodeType(pPara)) { return false; @@ -232,10 +224,12 @@ static int32_t scanPathOptGetRelatedFuncs(SScanLogicNode* pScan, SNodeList** pSd FOREACH(pNode, pAllFuncs) { SFunctionNode* pFunc = (SFunctionNode*)pNode; int32_t code = TSDB_CODE_SUCCESS; - if (scanPathOptNeedOptimizeDataRequire(pFunc)) { + if (scanPathOptIsSpecifiedFuncType(pFunc, fmIsSpecialDataRequiredFunc)) { code = nodesListMakeStrictAppend(&pTmpSdrFuncs, nodesCloneNode(pNode)); - } else if (scanPathOptNeedDynOptimize(pFunc)) { + } else if (scanPathOptIsSpecifiedFuncType(pFunc, fmIsDynamicScanOptimizedFunc)) { code = nodesListMakeStrictAppend(&pTmpDsoFuncs, nodesCloneNode(pNode)); + } else if (scanPathOptIsSpecifiedFuncType(pFunc, fmIsSkipScanCheckFunc)) { + continue; } else { otherFunc = true; break; @@ -2849,10 +2843,26 @@ static bool pushDownLimitTo(SLogicNode* pNodeWithLimit, SLogicNode* pNodeLimitPu case QUERY_NODE_LOGIC_PLAN_AGG: { if (nodeType(pNodeWithLimit) == QUERY_NODE_LOGIC_PLAN_PROJECT && (isPartTagAgg((SAggLogicNode*)pNodeLimitPushTo) || isPartTableAgg((SAggLogicNode*)pNodeLimitPushTo))) { - // when part by tag, slimit will be cloned to agg, and it will be pipelined. + // when part by tag/tbname, slimit will be cloned to agg, and it will be pipelined. // The scan below will do scanning with group order return cloneLimit(pNodeWithLimit, pNodeLimitPushTo, CLONE_SLIMIT); } + // else if not part by tag and tbname, the partition node below indicates that results are sorted, the agg node can + // be pipelined. + if (nodeType(pNodeWithLimit) == QUERY_NODE_LOGIC_PLAN_PROJECT && LIST_LENGTH(pNodeLimitPushTo->pChildren) == 1) { + SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pNodeLimitPushTo->pChildren, 0); + if (nodeType(pChild) == QUERY_NODE_LOGIC_PLAN_PARTITION) { + pNodeLimitPushTo->forceCreateNonBlockingOptr = true; + return cloneLimit(pNodeWithLimit, pNodeLimitPushTo, CLONE_SLIMIT); + } + // Currently, partColOpt is executed after pushDownLimitOpt, and partColOpt will replace partition node with + // sort node. + // To avoid dependencies between these two optimizations, we add sort node too. + if (nodeType(pChild) == QUERY_NODE_LOGIC_PLAN_SORT && ((SSortLogicNode*)pChild)->calcGroupId) { + pNodeLimitPushTo->forceCreateNonBlockingOptr = true; + return cloneLimit(pNodeWithLimit, pNodeLimitPushTo, CLONE_SLIMIT); + } + } break; } case QUERY_NODE_LOGIC_PLAN_SCAN: @@ -3599,6 +3609,7 @@ static SSortLogicNode* partColOptCreateSort(SPartitionLogicNode* pPartition) { nodesListMakeAppend(&pSort->pSortKeys, (SNode*)pOrder); pOrder->order = ORDER_ASC; pOrder->pExpr = nodesCloneNode(node); + pOrder->nullOrder = NULL_ORDER_FIRST; if (!pOrder->pExpr) code = TSDB_CODE_OUT_OF_MEMORY; } } diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index 881cc02062..33d6a329ee 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -41,6 +41,8 @@ typedef struct SSplitRule { typedef bool (*FSplFindSplitNode)(SSplitContext* pCxt, SLogicSubplan* pSubplan, SLogicNode* pNode, void* pInfo); +static int32_t stbSplCreateMergeKeys(SNodeList* pSortKeys, SNodeList* pTargets, SNodeList** pOutput); + static void splSetSubplanVgroups(SLogicSubplan* pSubplan, SLogicNode* pNode) { if (QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(pNode)) { TSWAP(pSubplan->pVgroupList, ((SScanLogicNode*)pNode)->pVgroupList); @@ -883,15 +885,119 @@ static int32_t stbSplSplitAggNodeForPartTable(SSplitContext* pCxt, SStableSplitI return code; } +static SFunctionNode* createGroupKeyAggFunc(SColumnNode* pGroupCol) { + SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); + if (pFunc) { + strcpy(pFunc->functionName, "_group_key"); + strcpy(pFunc->node.aliasName, pGroupCol->node.aliasName); + strcpy(pFunc->node.userAlias, pGroupCol->node.userAlias); + int32_t code = nodesListMakeStrictAppend(&pFunc->pParameterList, nodesCloneNode((SNode*)pGroupCol)); + if (code == TSDB_CODE_SUCCESS) { + code = fmGetFuncInfo(pFunc, NULL, 0); + } + if (TSDB_CODE_SUCCESS != code) { + nodesDestroyNode((SNode*)pFunc); + pFunc = NULL; + } + char name[TSDB_FUNC_NAME_LEN + TSDB_NAME_DELIMITER_LEN + TSDB_POINTER_PRINT_BYTES + 1] = {0}; + int32_t len = snprintf(name, sizeof(name) - 1, "%s.%p", pFunc->functionName, pFunc); + taosCreateMD5Hash(name, len); + strncpy(pFunc->node.aliasName, name, TSDB_COL_NAME_LEN - 1); + } + return pFunc; +} + +/** + * @brief For pipelined agg node, add a SortMergeNode to merge result from vnodes. + * For agg + partition, results are sorted by group id, use group sort. + * For agg + sort for group, results are sorted by partition keys, not group id, merges keys should be the same + * as partition keys + */ +static int32_t stbSplAggNodeCreateMerge(SSplitContext* pCtx, SStableSplitInfo* pInfo, SLogicNode* pChildAgg) { + bool groupSort = true; + SNodeList* pMergeKeys = NULL; + int32_t code = TSDB_CODE_SUCCESS; + bool sortForGroup = false; + + if (pChildAgg->pChildren->length != 1) return TSDB_CODE_TSC_INTERNAL_ERROR; + + SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pChildAgg->pChildren, 0); + if (nodeType(pChild) == QUERY_NODE_LOGIC_PLAN_SORT) { + SSortLogicNode* pSort = (SSortLogicNode*)pChild; + if (pSort->calcGroupId) { + SNode *node, *node2; + groupSort = false; + sortForGroup = true; + SNodeList* extraAggFuncs = NULL; + uint32_t originalLen = LIST_LENGTH(pSort->node.pTargets), idx = 0; + code = stbSplCreateMergeKeys(pSort->pSortKeys, pSort->node.pTargets, &pMergeKeys); + if (TSDB_CODE_SUCCESS != code) return code; + + // Create group_key func for all sort keys. + // We only need newly added nodes in pSort.node.pTargets when stbSplCreateMergeKeys + FOREACH(node, pSort->node.pTargets) { + if (idx++ < originalLen) continue; + SFunctionNode* pGroupKeyFunc = createGroupKeyAggFunc((SColumnNode*)node); + if (!pGroupKeyFunc) { + code = TSDB_CODE_OUT_OF_MEMORY; + break; + } + code = nodesListMakeStrictAppend(&extraAggFuncs, (SNode*)pGroupKeyFunc); + if (code != TSDB_CODE_SUCCESS) { + nodesDestroyNode((SNode*)pGroupKeyFunc); + } + } + + if (TSDB_CODE_SUCCESS == code) { + // add these extra group_key funcs into targets + code = createColumnByRewriteExprs(extraAggFuncs, &pChildAgg->pTargets); + } + if (code == TSDB_CODE_SUCCESS) { + nodesListAppendList(((SAggLogicNode*)pChildAgg)->pAggFuncs, extraAggFuncs); + extraAggFuncs = NULL; + } + + if (code == TSDB_CODE_SUCCESS) { + FOREACH(node, pMergeKeys) { + SOrderByExprNode* pOrder = (SOrderByExprNode*)node; + SColumnNode* pCol = (SColumnNode*)pOrder->pExpr; + FOREACH(node2, ((SAggLogicNode*)pChildAgg)->pAggFuncs) { + SFunctionNode* pFunc = (SFunctionNode*)node2; + if (0 != strcmp(pFunc->functionName, "_group_key")) continue; + SNode* pParam = nodesListGetNode(pFunc->pParameterList, 0); + if (!nodesEqualNode(pParam, (SNode*)pCol)) continue; + + // use the colName of group_key func to make sure finding the right slot id for merge keys. + strcpy(pCol->colName, pFunc->node.aliasName); + strcpy(pCol->node.aliasName, pFunc->node.aliasName); + memset(pCol->tableAlias, 0, TSDB_TABLE_NAME_LEN); + break; + } + } + } + if (TSDB_CODE_SUCCESS != code) { + nodesDestroyList(pMergeKeys); + nodesDestroyList(extraAggFuncs); + } + } + } + code = stbSplCreateMergeNode(pCtx, NULL, pInfo->pSplitNode, pMergeKeys, pChildAgg, groupSort); + if (TSDB_CODE_SUCCESS == code && sortForGroup) { + SMergeLogicNode* pMerge = + (SMergeLogicNode*)nodesListGetNode(pInfo->pSplitNode->pChildren, LIST_LENGTH(pInfo->pSplitNode->pChildren) - 1); + pMerge->inputWithGroupId = true; + } + return code; +} + static int32_t stbSplSplitAggNodeForCrossTable(SSplitContext* pCxt, SStableSplitInfo* pInfo) { SLogicNode* pPartAgg = NULL; int32_t code = stbSplCreatePartAggNode((SAggLogicNode*)pInfo->pSplitNode, &pPartAgg); - if (TSDB_CODE_SUCCESS == code) { // if slimit was pushed down to agg, agg will be pipelined mode, add sort merge before parent agg - if ((SAggLogicNode*)pInfo->pSplitNode->pSlimit) - code = stbSplCreateMergeNode(pCxt, NULL, pInfo->pSplitNode, NULL, pPartAgg, true); + if (pInfo->pSplitNode->forceCreateNonBlockingOptr) + code = stbSplAggNodeCreateMerge(pCxt, pInfo, pPartAgg); else code = stbSplCreateExchangeNode(pCxt, pInfo->pSplitNode, pPartAgg); } else { diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c index 19f4ebbeea..0cc8bfb6fe 100644 --- a/source/libs/stream/src/streamBackendRocksdb.c +++ b/source/libs/stream/src/streamBackendRocksdb.c @@ -905,6 +905,7 @@ int32_t streamBackendTriggerChkp(void* arg, char* dst) { } _ERROR: + taosMemoryFree(ppCf); taosReleaseRef(streamBackendId, backendRid); taosArrayDestroy(refs); return code; diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index 652ef7cde7..70371c4add 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -238,6 +238,8 @@ int32_t streamMetaReopen(SStreamMeta* pMeta, int64_t chkpId) { return -1; } } + taosMemoryFree(defaultPath); + taosMemoryFree(newPath); pMeta->streamBackend = streamBackendInit(pMeta->path, pMeta->chkpId); while (pMeta->streamBackend == NULL) { diff --git a/source/libs/stream/src/streamSnapshot.c b/source/libs/stream/src/streamSnapshot.c index 8a4500dd86..1e27aec03b 100644 --- a/source/libs/stream/src/streamSnapshot.c +++ b/source/libs/stream/src/streamSnapshot.c @@ -341,11 +341,15 @@ int32_t streamSnapRead(SStreamSnapReader* pReader, uint8_t** ppData, int64_t* si qDebug("%s start to read file %s, current offset:%" PRId64 ", size:%" PRId64 ", file no.%d", STREAM_STATE_TRANSFER, item->name, (int64_t)pHandle->offset, item->size, pHandle->currFileIdx); uint8_t* buf = taosMemoryCalloc(1, sizeof(SStreamSnapBlockHdr) + kBlockSize); + if(buf == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } int64_t nread = taosPReadFile(pHandle->fd, buf + sizeof(SStreamSnapBlockHdr), kBlockSize, pHandle->offset); if (nread == -1) { code = TAOS_SYSTEM_ERROR(terrno); qError("%s snap failed to read snap, file name:%s, type:%d,reason:%s", STREAM_STATE_TRANSFER, item->name, item->type, tstrerror(code)); + taosMemoryFree(buf); return -1; } else if (nread > 0 && nread <= kBlockSize) { // left bytes less than kBlockSize @@ -368,6 +372,7 @@ int32_t streamSnapRead(SStreamSnapReader* pReader, uint8_t** ppData, int64_t* si // finish *ppData = NULL; *size = 0; + taosMemoryFree(buf); return 0; } item = taosArrayGet(pHandle->pFileList, pHandle->currFileIdx); diff --git a/source/libs/transport/inc/transComm.h b/source/libs/transport/inc/transComm.h index dc8b7a3245..c82b7c0532 100644 --- a/source/libs/transport/inc/transComm.h +++ b/source/libs/transport/inc/transComm.h @@ -420,6 +420,7 @@ void transThreadOnce(); void transInit(); void transCleanup(); +void transPrintEpSet(SEpSet* pEpSet); void transFreeMsg(void* msg); int32_t transCompressMsg(char* msg, int32_t len); diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 3dbb224e79..b66a08bd20 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -2221,7 +2221,9 @@ bool cliResetEpset(STransConnCtx* pCtx, STransMsg* pResp, bool hasEpSet) { } } else { if (!transEpSetIsEqual(&pCtx->epSet, &epSet)) { - tDebug("epset not equal, retry new epset"); + tDebug("epset not equal, retry new epset1"); + transPrintEpSet(&pCtx->epSet); + transPrintEpSet(&epSet); epsetAssign(&pCtx->epSet, &epSet); noDelay = false; } else { @@ -2246,7 +2248,9 @@ bool cliResetEpset(STransConnCtx* pCtx, STransMsg* pResp, bool hasEpSet) { } } else { if (!transEpSetIsEqual(&pCtx->epSet, &epSet)) { - tDebug("epset not equal, retry new epset"); + tDebug("epset not equal, retry new epset2"); + transPrintEpSet(&pCtx->epSet); + transPrintEpSet(&epSet); epsetAssign(&pCtx->epSet, &epSet); noDelay = false; } else { diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c index f7b580345b..30f079d10d 100644 --- a/source/os/src/osFile.c +++ b/source/os/src/osFile.c @@ -456,10 +456,18 @@ int64_t taosPReadFile(TdFilePtr pFile, void *buf, int64_t count, int64_t offset) return -1; } #ifdef WINDOWS - size_t pos = _lseeki64(pFile->fd, 0, SEEK_CUR); - _lseeki64(pFile->fd, offset, SEEK_SET); - int64_t ret = _read(pFile->fd, buf, count); - _lseeki64(pFile->fd, pos, SEEK_SET); + DWORD ret = 0; + OVERLAPPED ol = {0}; + ol.OffsetHigh = (uint32_t)((offset & 0xFFFFFFFF00000000LL) >> 0x20); + ol.Offset = (uint32_t)(offset & 0xFFFFFFFFLL); + + HANDLE handle = (HANDLE)_get_osfhandle(pFile->fd); + SetLastError(0); + BOOL result = ReadFile(handle, buf, count, &ret, &ol); + if (!result && GetLastError() != ERROR_HANDLE_EOF) { + errno = GetLastError(); + ret = -1; + } #else int64_t ret = pread(pFile->fd, buf, count, offset); #endif @@ -523,10 +531,18 @@ int64_t taosPWriteFile(TdFilePtr pFile, const void *buf, int64_t count, int64_t return 0; } #ifdef WINDOWS - size_t pos = _lseeki64(pFile->fd, 0, SEEK_CUR); - _lseeki64(pFile->fd, offset, SEEK_SET); - int64_t ret = _write(pFile->fd, buf, count); - _lseeki64(pFile->fd, pos, SEEK_SET); + DWORD ret = 0; + OVERLAPPED ol = {0}; + ol.OffsetHigh = (uint32_t)((offset & 0xFFFFFFFF00000000LL) >> 0x20); + ol.Offset = (uint32_t)(offset & 0xFFFFFFFFLL); + + HANDLE handle = (HANDLE)_get_osfhandle(pFile->fd); + SetLastError(0); + BOOL result = WriteFile(handle, buf, count, &ret, &ol); + if (!result) { + errno = GetLastError(); + ret = -1; + } #else int64_t ret = pwrite(pFile->fd, buf, count, offset); #endif diff --git a/source/os/src/osThread.c b/source/os/src/osThread.c index 4c4e22bdd9..0dd5374cf0 100644 --- a/source/os/src/osThread.c +++ b/source/os/src/osThread.c @@ -84,34 +84,98 @@ int32_t taosThreadAttrSetStackSize(TdThreadAttr *attr, size_t stacksize) { int32_t taosThreadCancel(TdThread thread) { return pthread_cancel(thread); } -int32_t taosThreadCondDestroy(TdThreadCond *cond) { return pthread_cond_destroy(cond); } +int32_t taosThreadCondDestroy(TdThreadCond *cond) { +#ifdef __USE_WIN_THREAD + return 0; +#else + return pthread_cond_destroy(cond); +#endif +} -int32_t taosThreadCondInit(TdThreadCond *cond, const TdThreadCondAttr *attr) { return pthread_cond_init(cond, attr); } +int32_t taosThreadCondInit(TdThreadCond *cond, const TdThreadCondAttr *attr) { +#ifdef __USE_WIN_THREAD + InitializeConditionVariable(cond); + return 0; +#else + return pthread_cond_init(cond, attr); +#endif +} -int32_t taosThreadCondSignal(TdThreadCond *cond) { return pthread_cond_signal(cond); } +int32_t taosThreadCondSignal(TdThreadCond *cond) { +#ifdef __USE_WIN_THREAD + WakeConditionVariable(cond); + return 0; +#else + return pthread_cond_signal(cond); +#endif +} -int32_t taosThreadCondBroadcast(TdThreadCond *cond) { return pthread_cond_broadcast(cond); } +int32_t taosThreadCondBroadcast(TdThreadCond *cond) { +#ifdef __USE_WIN_THREAD + WakeAllConditionVariable(cond); + return 0; +#else + return pthread_cond_broadcast(cond); +#endif +} int32_t taosThreadCondWait(TdThreadCond *cond, TdThreadMutex *mutex) { +#ifdef __USE_WIN_THREAD + if (!SleepConditionVariableCS(cond, mutex, INFINITE)) { + return EINVAL; + } + return 0; +#else THREAD_PTR_CHECK(mutex) return pthread_cond_wait(cond, mutex); +#endif } int32_t taosThreadCondTimedWait(TdThreadCond *cond, TdThreadMutex *mutex, const struct timespec *abstime) { +#ifdef __USE_WIN_THREAD + if (!abstime) return EINVAL; + if (SleepConditionVariableCS(cond, mutex, (DWORD)(abstime->tv_sec * 1e3 + abstime->tv_nsec / 1e6))) return 0; + if (GetLastError() == ERROR_TIMEOUT) { + return ETIMEDOUT; + } + return EINVAL; +#else THREAD_PTR_CHECK(mutex) return pthread_cond_timedwait(cond, mutex, abstime); +#endif } -int32_t taosThreadCondAttrDestroy(TdThreadCondAttr *attr) { return pthread_condattr_destroy(attr); } +int32_t taosThreadCondAttrDestroy(TdThreadCondAttr *attr) { +#ifdef __USE_WIN_THREAD + return 0; +#else + return pthread_condattr_destroy(attr); +#endif +} int32_t taosThreadCondAttrGetPshared(const TdThreadCondAttr *attr, int32_t *pshared) { +#ifdef __USE_WIN_THREAD + if (pshared) *pshared = PTHREAD_PROCESS_PRIVATE; + return 0; +#else return pthread_condattr_getpshared(attr, pshared); +#endif } -int32_t taosThreadCondAttrInit(TdThreadCondAttr *attr) { return pthread_condattr_init(attr); } +int32_t taosThreadCondAttrInit(TdThreadCondAttr *attr) { +#ifdef __USE_WIN_THREAD + return 0; +#else + return pthread_condattr_init(attr); +#endif +} int32_t taosThreadCondAttrSetPshared(TdThreadCondAttr *attr, int32_t pshared) { +#ifdef __USE_WIN_THREAD + return 0; +#else return pthread_condattr_setpshared(attr, pshared); +#endif } int32_t taosThreadDetach(TdThread thread) { return pthread_detach(thread); } @@ -142,17 +206,37 @@ int32_t taosThreadKill(TdThread thread, int32_t sig) { return pthread_kill(threa // } int32_t taosThreadMutexDestroy(TdThreadMutex *mutex) { +#ifdef __USE_WIN_THREAD + DeleteCriticalSection(mutex); + return 0; +#else THREAD_PTR_CHECK(mutex) return pthread_mutex_destroy(mutex); +#endif } int32_t taosThreadMutexInit(TdThreadMutex *mutex, const TdThreadMutexAttr *attr) { +#ifdef __USE_WIN_THREAD + /** + * Windows Server 2003 and Windows XP: In low memory situations, InitializeCriticalSection can raise a + * STATUS_NO_MEMORY exception. Starting with Windows Vista, this exception was eliminated and + * InitializeCriticalSection always succeeds, even in low memory situations. + */ + InitializeCriticalSection(mutex); + return 0; +#else return pthread_mutex_init(mutex, attr); +#endif } int32_t taosThreadMutexLock(TdThreadMutex *mutex) { +#ifdef __USE_WIN_THREAD + EnterCriticalSection(mutex); + return 0; +#else THREAD_PTR_CHECK(mutex) return pthread_mutex_lock(mutex); +#endif } // int32_t taosThreadMutexTimedLock(TdThreadMutex * mutex, const struct timespec *abstime) { @@ -160,19 +244,40 @@ int32_t taosThreadMutexLock(TdThreadMutex *mutex) { // } int32_t taosThreadMutexTryLock(TdThreadMutex *mutex) { - THREAD_PTR_CHECK(mutex) - return pthread_mutex_trylock(mutex); +#ifdef __USE_WIN_THREAD + if (TryEnterCriticalSection(mutex)) return 0; + return EBUSY; +#else + THREAD_PTR_CHECK(mutex) + return pthread_mutex_trylock(mutex); +#endif } int32_t taosThreadMutexUnlock(TdThreadMutex *mutex) { +#ifdef __USE_WIN_THREAD + LeaveCriticalSection(mutex); + return 0; +#else THREAD_PTR_CHECK(mutex) return pthread_mutex_unlock(mutex); +#endif } -int32_t taosThreadMutexAttrDestroy(TdThreadMutexAttr *attr) { return pthread_mutexattr_destroy(attr); } +int32_t taosThreadMutexAttrDestroy(TdThreadMutexAttr *attr) { +#ifdef __USE_WIN_THREAD + return 0; +#else + return pthread_mutexattr_destroy(attr); +#endif +} int32_t taosThreadMutexAttrGetPshared(const TdThreadMutexAttr *attr, int32_t *pshared) { +#ifdef __USE_WIN_THREAD + if (pshared) *pshared = PTHREAD_PROCESS_PRIVATE; + return 0; +#else return pthread_mutexattr_getpshared(attr, pshared); +#endif } // int32_t taosThreadMutexAttrGetRobust(const TdThreadMutexAttr * attr, int32_t * robust) { @@ -180,13 +285,28 @@ int32_t taosThreadMutexAttrGetPshared(const TdThreadMutexAttr *attr, int32_t *ps // } int32_t taosThreadMutexAttrGetType(const TdThreadMutexAttr *attr, int32_t *kind) { +#ifdef __USE_WIN_THREAD + if (kind) *kind = PTHREAD_MUTEX_NORMAL; + return 0; +#else return pthread_mutexattr_gettype(attr, kind); +#endif } -int32_t taosThreadMutexAttrInit(TdThreadMutexAttr *attr) { return pthread_mutexattr_init(attr); } +int32_t taosThreadMutexAttrInit(TdThreadMutexAttr *attr) { +#ifdef __USE_WIN_THREAD + return 0; +#else + return pthread_mutexattr_init(attr); +#endif +} int32_t taosThreadMutexAttrSetPshared(TdThreadMutexAttr *attr, int32_t pshared) { +#ifdef __USE_WIN_THREAD + return 0; +#else return pthread_mutexattr_setpshared(attr, pshared); +#endif } // int32_t taosThreadMutexAttrSetRobust(TdThreadMutexAttr * attr, int32_t robust) { @@ -194,20 +314,46 @@ int32_t taosThreadMutexAttrSetPshared(TdThreadMutexAttr *attr, int32_t pshared) // } int32_t taosThreadMutexAttrSetType(TdThreadMutexAttr *attr, int32_t kind) { +#ifdef __USE_WIN_THREAD + return 0; +#else return pthread_mutexattr_settype(attr, kind); +#endif } int32_t taosThreadOnce(TdThreadOnce *onceControl, void (*initRoutine)(void)) { return pthread_once(onceControl, initRoutine); } -int32_t taosThreadRwlockDestroy(TdThreadRwlock *rwlock) { return pthread_rwlock_destroy(rwlock); } - -int32_t taosThreadRwlockInit(TdThreadRwlock *rwlock, const TdThreadRwlockAttr *attr) { - return pthread_rwlock_init(rwlock, attr); +int32_t taosThreadRwlockDestroy(TdThreadRwlock *rwlock) { +#ifdef __USE_WIN_THREAD + /* SRWLock does not need explicit destruction so long as there are no waiting threads + * See: https://docs.microsoft.com/windows/win32/api/synchapi/nf-synchapi-initializesrwlock#remarks + */ + return 0; +#else + return pthread_rwlock_destroy(rwlock); +#endif } -int32_t taosThreadRwlockRdlock(TdThreadRwlock *rwlock) { return pthread_rwlock_rdlock(rwlock); } +int32_t taosThreadRwlockInit(TdThreadRwlock *rwlock, const TdThreadRwlockAttr *attr) { +#ifdef __USE_WIN_THREAD + memset(rwlock, 0, sizeof(*rwlock)); + InitializeSRWLock(&rwlock->lock); + return 0; +#else + return pthread_rwlock_init(rwlock, attr); +#endif +} + +int32_t taosThreadRwlockRdlock(TdThreadRwlock *rwlock) { +#ifdef __USE_WIN_THREAD + AcquireSRWLockShared(&rwlock->lock); + return 0; +#else + return pthread_rwlock_rdlock(rwlock); +#endif +} // int32_t taosThreadRwlockTimedRdlock(TdThreadRwlock * rwlock, const struct timespec *abstime) { // return pthread_rwlock_timedrdlock(rwlock, abstime); @@ -217,24 +363,79 @@ int32_t taosThreadRwlockRdlock(TdThreadRwlock *rwlock) { return pthread_rwlock_r // return pthread_rwlock_timedwrlock(rwlock, abstime); // } -int32_t taosThreadRwlockTryRdlock(TdThreadRwlock *rwlock) { return pthread_rwlock_tryrdlock(rwlock); } - -int32_t taosThreadRwlockTryWrlock(TdThreadRwlock *rwlock) { return pthread_rwlock_trywrlock(rwlock); } - -int32_t taosThreadRwlockUnlock(TdThreadRwlock *rwlock) { return pthread_rwlock_unlock(rwlock); } - -int32_t taosThreadRwlockWrlock(TdThreadRwlock *rwlock) { return pthread_rwlock_wrlock(rwlock); } - -int32_t taosThreadRwlockAttrDestroy(TdThreadRwlockAttr *attr) { return pthread_rwlockattr_destroy(attr); } - -int32_t taosThreadRwlockAttrGetPshared(const TdThreadRwlockAttr *attr, int32_t *pshared) { - return pthread_rwlockattr_getpshared(attr, pshared); +int32_t taosThreadRwlockTryRdlock(TdThreadRwlock *rwlock) { +#ifdef __USE_WIN_THREAD + if (!TryAcquireSRWLockShared(&rwlock->lock)) return EBUSY; + return 0; +#else + return pthread_rwlock_tryrdlock(rwlock); +#endif } -int32_t taosThreadRwlockAttrInit(TdThreadRwlockAttr *attr) { return pthread_rwlockattr_init(attr); } +int32_t taosThreadRwlockTryWrlock(TdThreadRwlock *rwlock) { +#ifdef __USE_WIN_THREAD + if (!TryAcquireSRWLockExclusive(&rwlock->lock)) return EBUSY; + atomic_store_8(&rwlock->excl, 1); + return 0; +#else + return pthread_rwlock_trywrlock(rwlock); +#endif +} + +int32_t taosThreadRwlockUnlock(TdThreadRwlock *rwlock) { +#ifdef __USE_WIN_THREAD + if (1 == atomic_val_compare_exchange_8(&rwlock->excl, 1, 0)) { + ReleaseSRWLockExclusive(&rwlock->lock); + } else { + ReleaseSRWLockShared(&rwlock->lock); + } + return 0; +#else + return pthread_rwlock_unlock(rwlock); +#endif +} + +int32_t taosThreadRwlockWrlock(TdThreadRwlock *rwlock) { +#ifdef __USE_WIN_THREAD + AcquireSRWLockExclusive(&rwlock->lock); + atomic_store_8(&rwlock->excl, 1); + return 0; +#else + return pthread_rwlock_wrlock(rwlock); +#endif +} + +int32_t taosThreadRwlockAttrDestroy(TdThreadRwlockAttr *attr) { +#ifdef __USE_WIN_THREAD + return 0; +#else + return pthread_rwlockattr_destroy(attr); +#endif +} + +int32_t taosThreadRwlockAttrGetPshared(const TdThreadRwlockAttr *attr, int32_t *pshared) { +#ifdef __USE_WIN_THREAD + if (pshared) *pshared = PTHREAD_PROCESS_PRIVATE; + return 0; +#else + return pthread_rwlockattr_getpshared(attr, pshared); +#endif +} + +int32_t taosThreadRwlockAttrInit(TdThreadRwlockAttr *attr) { +#ifdef __USE_WIN_THREAD + return 0; +#else + return pthread_rwlockattr_init(attr); +#endif +} int32_t taosThreadRwlockAttrSetPshared(TdThreadRwlockAttr *attr, int32_t pshared) { +#ifdef __USE_WIN_THREAD + return 0; +#else return pthread_rwlockattr_setpshared(attr, pshared); +#endif } TdThread taosThreadSelf(void) { return pthread_self(); } @@ -297,4 +498,4 @@ int32_t taosThreadSpinUnlock(TdThreadSpinlock *lock) { void taosThreadTestCancel(void) { return pthread_testcancel(); } -void taosThreadClear(TdThread *thread) { memset(thread, 0, sizeof(TdThread)); } \ No newline at end of file +void taosThreadClear(TdThread *thread) { memset(thread, 0, sizeof(TdThread)); } diff --git a/source/util/src/tcache.c b/source/util/src/tcache.c index 28d9b412a0..392ac5d8b2 100644 --- a/source/util/src/tcache.c +++ b/source/util/src/tcache.c @@ -25,7 +25,7 @@ static TdThread cacheRefreshWorker = {0}; static TdThreadOnce cacheThreadInit = PTHREAD_ONCE_INIT; -static TdThreadMutex guard = TD_PTHREAD_MUTEX_INITIALIZER; +static TdThreadMutex guard; static SArray *pCacheArrayList = NULL; static bool stopRefreshWorker = false; static bool refreshWorkerNormalStopped = false; @@ -155,6 +155,8 @@ static void *taosCacheTimedRefresh(void *handle); static void doInitRefreshThread(void) { pCacheArrayList = taosArrayInit(4, POINTER_BYTES); + taosThreadMutexInit(&guard, NULL); + TdThreadAttr thattr; taosThreadAttrInit(&thattr); taosThreadAttrSetDetachState(&thattr, PTHREAD_CREATE_JOINABLE); diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 51adfb4d06..cb321e5120 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -53,6 +53,10 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/partition_by_col.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/partition_by_col.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/partition_by_col.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/partition_by_col_agg.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/partition_by_col_agg.py -Q 2 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/partition_by_col_agg.py -Q 3 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/partition_by_col_agg.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqShow.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropStb.py ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/subscribeStb0.py @@ -163,6 +167,9 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqSubscribeStb-r3.py -N 5 ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -N 6 -M 3 -i True ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -N 6 -M 3 -n 3 -i True +,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeTransform.py -N 2 -n 1 +,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeSplit.py -N 2 -n 1 +,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeReplicate.py -M 3 -N 3 -n 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-19201.py ,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py ,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TS-3404.py @@ -331,6 +338,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/hyperloglog.py -R ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/interp.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/interp.py -R +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/fill.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/irate.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/irate.py -R ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/join.py @@ -562,6 +570,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/arctan.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/interp.py -Q 2 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/fill.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/nestedQueryInterval.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/stablity.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/stablity_1.py -Q 2 @@ -691,6 +700,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tsbsQuery.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/interp.py -Q 3 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/fill.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py -Q 3 @@ -787,6 +797,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tsbsQuery.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/interp.py -Q 4 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/fill.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/insert_select.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/insert_select.py -R @@ -1007,8 +1018,10 @@ ,,y,script,./test.sh -f tsim/query/emptyTsRange.sim ,,y,script,./test.sh -f tsim/query/emptyTsRange_scl.sim ,,y,script,./test.sh -f tsim/query/partitionby.sim -,,y,script,./test.sh -f tsim/query/tableCount.sim -,,y,script,./test.sh -f tsim/query/tag_scan.sim +,,y,script,./test.sh -f tsim/query/tableCount.sim +,,y,script,./test.sh -f tsim/query/show_db_table_kind.sim +,,y,script,./test.sh -f tsim/query/bi_star_table.sim +,,y,script,./test.sh -f tsim/query/tag_scan.sim ,,y,script,./test.sh -f tsim/query/nullColSma.sim ,,y,script,./test.sh -f tsim/query/bug3398.sim ,,y,script,./test.sh -f tsim/query/explain_tsorder.sim diff --git a/tests/pytest/util/cluster.py b/tests/pytest/util/cluster.py index 7c653f9f2e..30b70b01fc 100644 --- a/tests/pytest/util/cluster.py +++ b/tests/pytest/util/cluster.py @@ -54,7 +54,7 @@ class ConfigureyCluster: # configure dnoe of independent mnodes if num <= self.mnodeNums and self.mnodeNums != 0 and independentMnode == True : tdLog.info(f"set mnode:{num} supportVnodes 0") - dnode.addExtraCfg("supportVnodes", 0) + dnode.addExtraCfg("supportVnodes", 0) # print(dnode) self.dnodes.append(dnode) return self.dnodes diff --git a/tests/script/api/passwdTest.c b/tests/script/api/passwdTest.c index 06d2d3455f..24059bd35d 100644 --- a/tests/script/api/passwdTest.c +++ b/tests/script/api/passwdTest.c @@ -47,8 +47,10 @@ typedef uint16_t VarDataLenT; void createUsers(TAOS *taos, const char *host, char *qstr); void passVerTestMulti(const char *host, char *qstr); void sysInfoTest(TAOS *taos, const char *host, char *qstr); +void userDroppedTest(TAOS *taos, const char *host, char *qstr); int nPassVerNotified = 0; +int nUserDropped = 0; TAOS *taosu[nRoot] = {0}; char users[nUser][USER_LEN] = {0}; @@ -56,11 +58,16 @@ void __taos_notify_cb(void *param, void *ext, int type) { switch (type) { case TAOS_NOTIFY_PASSVER: { ++nPassVerNotified; - printf("%s:%d type:%d user:%s ver:%d\n", __func__, __LINE__, type, param ? (char *)param : "NULL", *(int *)ext); + printf("%s:%d type:%d user:%s passVer:%d\n", __func__, __LINE__, type, param ? (char *)param : "NULL", *(int *)ext); + break; + } + case TAOS_NOTIFY_USER_DROPPED: { + ++nUserDropped; + printf("%s:%d type:%d user:%s dropped\n", __func__, __LINE__, type, param ? (char *)param : "NULL"); break; } default: - printf("%s:%d unknown type:%d\n", __func__, __LINE__, type); + printf("%s:%d unknown notify type:%d\n", __func__, __LINE__, type); break; } } @@ -202,6 +209,7 @@ int main(int argc, char *argv[]) { createUsers(taos, argv[1], qstr); passVerTestMulti(argv[1], qstr); sysInfoTest(taos, argv[1], qstr); + userDroppedTest(taos, argv[1], qstr); taos_close(taos); taos_cleanup(); @@ -223,9 +231,9 @@ void createUsers(TAOS *taos, const char *host, char *qstr) { int code = taos_set_notify_cb(taosu[i], __taos_notify_cb, users[i], TAOS_NOTIFY_PASSVER); if (code != 0) { - fprintf(stderr, "failed to run: taos_set_notify_cb for user:%s since %d\n", users[i], code); + fprintf(stderr, "failed to run: taos_set_notify_cb(TAOS_NOTIFY_PASSVER) for user:%s since %d\n", users[i], code); } else { - fprintf(stderr, "success to run: taos_set_notify_cb for user:%s\n", users[i]); + fprintf(stderr, "success to run: taos_set_notify_cb(TAOS_NOTIFY_PASSVER) for user:%s\n", users[i]); } // alter pass for users @@ -290,17 +298,19 @@ void passVerTestMulti(const char *host, char *qstr) { } fprintf(stderr, "######## %s #########\n", __func__); - if (nPassVerNotified >= nConn) { - fprintf(stderr, ">>> succeed to get passVer notification since nNotify %d >= nConn %d\n", nPassVerNotified, + if (nPassVerNotified == nConn) { + fprintf(stderr, ">>> succeed to get passVer notification since nNotify %d == nConn %d\n", nPassVerNotified, nConn); } else { - fprintf(stderr, ">>> failed to get passVer notification since nNotify %d < nConn %d\n", nPassVerNotified, nConn); + fprintf(stderr, ">>> failed to get passVer notification since nNotify %d != nConn %d\n", nPassVerNotified, nConn); + exit(1); } fprintf(stderr, "######## %s #########\n", __func__); // sleep(300); } void sysInfoTest(TAOS *taosRoot, const char *host, char *qstr) { + fprintf(stderr, "######## %s entry #########\n", __func__); TAOS *taos[nRoot] = {0}; char userName[USER_LEN] = "user0"; @@ -376,4 +386,56 @@ _REP: fprintf(stderr, "######## %s #########\n", __func__); fprintf(stderr, ">>> succeed to run sysInfoTest\n"); fprintf(stderr, "######## %s #########\n", __func__); +} + +void userDroppedTest(TAOS *taos, const char *host, char *qstr) { + // users + int nTestUsers = nUser; + for (int i = 0; i < nTestUsers; ++i) { + // sprintf(users[i], "user%d", i); + taosu[i] = taos_connect(host, users[i], "taos", NULL, 0); + if (taosu[i] == NULL) { + printf("failed to connect to server, user:%s, reason:%s\n", users[i], "null taos" /*taos_errstr(taos)*/); + exit(1); + } + int code = taos_set_notify_cb(taosu[i], __taos_notify_cb, users[i], TAOS_NOTIFY_USER_DROPPED); + if (code != 0) { + fprintf(stderr, "failed to run: taos_set_notify_cb:%d for user:%s since %d\n", TAOS_NOTIFY_USER_DROPPED, users[i], + code); + } else { + fprintf(stderr, "success to run: taos_set_notify_cb:%d for user:%s\n", TAOS_NOTIFY_USER_DROPPED, users[i]); + } + } + + for (int i = 0; i < nTestUsers; ++i) { + // drop user0 ... user${nUser} + sprintf(qstr, "drop user %s", users[i]); + queryDB(taos, qstr); + } + + // calculate the nUserDropped for users + int nConn = nTestUsers; + + for (int i = 0; i < 15; ++i) { + printf("%s:%d [%d] second(s) elasped, user dropped notification received:%d, total:%d\n", __func__, __LINE__, i, + nUserDropped, nConn); + if (nUserDropped >= nConn) break; + sleep(1); + } + + for (int i = 0; i < nTestUsers; ++i) { + taos_close(taosu[i]); + printf("%s:%d close taosu[%d]\n", __func__, __LINE__, i); + sleep(1); + } + + fprintf(stderr, "######## %s #########\n", __func__); + if (nUserDropped == nConn) { + fprintf(stderr, ">>> succeed to get user dropped notification since nNotify %d == nConn %d\n", nUserDropped, nConn); + } else { + fprintf(stderr, ">>> failed to get user dropped notification since nNotify %d != nConn %d\n", nUserDropped, nConn); + exit(1); + } + fprintf(stderr, "######## %s #########\n", __func__); + // sleep(300); } \ No newline at end of file diff --git a/tests/script/tsim/parser/limit.sim b/tests/script/tsim/parser/limit.sim index e79640f3af..900ca220ad 100644 --- a/tests/script/tsim/parser/limit.sim +++ b/tests/script/tsim/parser/limit.sim @@ -40,16 +40,19 @@ while $i < $halfNum $c = $x / 10 $c = $c * 10 $c = $x - $c + $c2 = $c $binary = 'binary . $c $binary = $binary . ' $nchar = 'nchar . $c $nchar = $nchar . ' $ts = $ts + $i + print insert into $tb values ( $ts , $c , $c , $c , $c , $c , $c , true, $binary , $nchar ) sql insert into $tb values ( $ts , $c , $c , $c , $c , $c , $c , true, $binary , $nchar ) $ts = $ts + $halfNum - sql insert into $tb1 values ( $ts , $c , NULL , $c , NULL , $c , $c , true, $binary , $nchar ) + print insert into $tb1 values ( $ts , $c2 , NULL , $c2 , NULL , $c2 , $c2 , true, $binary , $nchar ) + sql insert into $tb1 values ( $ts , $c2 , NULL , $c2 , NULL , $c2 , $c2 , true, $binary , $nchar ) $x = $x + 1 endw diff --git a/tests/script/tsim/parser/limit_stb.sim b/tests/script/tsim/parser/limit_stb.sim index 46bd6260c3..7d6aff3b51 100644 --- a/tests/script/tsim/parser/limit_stb.sim +++ b/tests/script/tsim/parser/limit_stb.sim @@ -32,11 +32,13 @@ sql select * from $stb limit 5 if $rows != 5 then return -1 endi -sql select * from $stb limit 5 offset 1 +print select * from $stb order by ts limit 5 offset 1 +sql select * from $stb order by ts limit 5 offset 1 if $rows != 5 then return -1 endi -if $data01 != 1 then +print $data01 $data41 +if $data01 != 0 then return -1 endi #if $data41 != 5 then @@ -48,10 +50,12 @@ if $rows != 5 then return -1 endi +print select * from $stb order by ts desc limit 5 offset 1 sql select * from $stb order by ts desc limit 5 offset 1 if $rows != 5 then return -1 endi +print $data01 $data11 $data41 if $data01 != 9 then return -1 endi diff --git a/tests/script/tsim/query/bi_star_table.sim b/tests/script/tsim/query/bi_star_table.sim new file mode 100644 index 0000000000..6bd6938678 --- /dev/null +++ b/tests/script/tsim/query/bi_star_table.sim @@ -0,0 +1,111 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql drop database if exists db1; +sql create database db1 vgroups 3; +sql create database db1; +sql use db1; +sql create stable sta (ts timestamp, f1 int, f2 binary(200)) tags(t1 int, t2 int, t3 int); +sql create stable stb (ts timestamp, f1 int, f2 binary(200)) tags(t1 int, t2 int, t3 int); +sql create table tba1 using sta tags(1, 1, 1); +sql create table tba2 using sta tags(2, 2, 2); +sql insert into tba1 values(now, 1, "1"); +sql insert into tba2 values(now + 1s, 2, "2"); +sql create table tbn1 (ts timestamp, f1 int); +sql create database db2 vgroups 3; +sql create database db2; +sql use db2; +sql create stable sta (ts timestamp, f1 int, f2 binary(200)) tags(t1 int, t2 int, t3 int); +sql create stable stb (ts timestamp, f1 int, f2 binary(200)) tags(t1 int, t2 int, t3 int); +sql create table tba1 using sta tags(1, 1, 1); +sql create table tba2 using sta tags(2, 2, 2); + +set_bi_mode 1 +sql select * from db1.sta order by ts; +if $cols != 7 then + return -1 +endi + +if $data06 != tba1 then + return -1 +endi + +sql select last(*) from db1.sta; +if $cols != 4 then + return -1 +endi + +if $data03 != tba2 then + return -1 +endi + +sql select last_row(*) from db1.sta; +if $cols != 4 then + return -1 +endi + +if $data03 != tba2 then + return -1 +endi + +sql select first(*) from db1.sta; +if $cols != 4 then + return -1 +endi + +if $data03 != tba1 then + return -1 +endi + +print "=====table star =====================" + +sql select b.* from db1.sta b order by ts; +if $cols != 7 then + return -1 +endi + +if $data06 != tba1 then + return -1 +endi + +sql select last(b.*) from db1.sta b; +if $cols != 4 then + return -1 +endi + +if $data03 != tba2 then + return -1 +endi + +sql select last_row(b.*) from db1.sta b; +if $cols != 4 then + return -1 +endi + +if $data03 != tba2 then + return -1 +endi + +sql select first(b.*) from db1.sta b; +if $cols != 4 then + return -1 +endi + +if $data03 != tba1 then + return -1 +endi + +sql select * from (select f1 from db1.sta); +if $cols != 1 then + return -1 +endi + +set_bi_mode 0 +sql select * from db1.sta order by ts; +if $cols != 6 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/query/show_db_table_kind.sim b/tests/script/tsim/query/show_db_table_kind.sim new file mode 100644 index 0000000000..9be2d36fd1 --- /dev/null +++ b/tests/script/tsim/query/show_db_table_kind.sim @@ -0,0 +1,97 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql drop database if exists db1; +sql create database db1 vgroups 3; +sql create database db1; +sql use db1; +sql create stable sta (ts timestamp, f1 int, f2 binary(200)) tags(t1 int, t2 int, t3 int); +sql create stable stb (ts timestamp, f1 int, f2 binary(200)) tags(t1 int, t2 int, t3 int); +sql create table tba1 using sta tags(1, 1, 1); +sql create table tba2 using sta tags(2, 2, 2); +sql create table tba3 using sta tags(3, 3, 3); +sql create table tba4 using sta tags(3, 3, 3); +sql create table tba5 using sta tags(3, 3, 3); +sql create table tba6 using sta tags(3, 3, 3); +sql create table tba7 using sta tags(3, 3, 3); +sql create table tba8 using sta tags(3, 3, 3); +sql create table tbb1 using stb tags(4, 4, 4); +sql create table tbb2 using stb tags(5, 5, 5); +sql create table tbb3 using stb tags(6, 6, 6); +sql create table tbb4 using stb tags(4, 4, 4); +sql create table tbb5 using stb tags(5, 5, 5); +sql create table tbb6 using stb tags(6, 6, 6); +sql create table tbb7 using stb tags(7, 7, 7); +sql create table tbb8 using stb tags(8, 8, 8); +sql create table tbn1 (ts timestamp, f1 int); +sql create database db2 vgroups 3; +sql create database db2; +sql use db2; +sql create stable sta (ts timestamp, f1 int, f2 binary(200)) tags(t1 int, t2 int, t3 int); +sql create stable stb (ts timestamp, f1 int, f2 binary(200)) tags(t1 int, t2 int, t3 int); +sql create table tba1 using sta tags(1, 1, 1); +sql create table tba2 using sta tags(2, 2, 2); +sql create table tbb1 using stb tags(4, 4, 4); +sql create table tbb2 using stb tags(5, 5, 5); +sql create table tbb3 using stb tags(6, 6, 6); + +sql show user databases; +print $rows +if $rows != 2 then + return -1 +endi + +sql show system databases; +print $rows +if $rows != 2 then + return -1 +endi + +sql show databases; +print $rows +if $rows != 4 then + return -1 +endi + +sql use db1 + +sql show tables +print $rows +if $rows != 17 then + return -1 +endi + +sql show normal tables; +print $rows +if $rows != 1 then + return -1 +endi +print $data00 +if $data00 != @tbn1@ then + return -1 +endi + +sql show child tables; +print $rows +if $rows != 16 then + return -1 +endi + +sql show db2.tables; +print $rows +if $rows != 5 then + return -1 +endi +sql show normal db2.tables +print $rows +if $rows != 0 then + return -1 +endi +sql show child db2.tables +print $rows +if $rows != 5 then + return -1 +endi +system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/system-test/2-query/fill.py b/tests/system-test/2-query/fill.py new file mode 100644 index 0000000000..f5cd2d5855 --- /dev/null +++ b/tests/system-test/2-query/fill.py @@ -0,0 +1,262 @@ +import taos +import sys + +from util.log import * +from util.sql import * +from util.cases import * + + + +class TDTestCase: + + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + #tdSql.init(conn.cursor()) + tdSql.init(conn.cursor(), logSql) # output sql.txt file + + def run(self): + dbname = "db" + tbname = "tb" + + tdSql.prepare() + + tdLog.printNoPrefix("==========step1:create table") + + tdSql.execute( + f'''create table if not exists {dbname}.{tbname} + (ts timestamp, c0 int, c1 bool, c2 varchar(100), c3 nchar(100), c4 varbinary(100)) + ''' + ) + + tdLog.printNoPrefix("==========step2:insert data") + + tdSql.execute(f"use db") + + tdSql.execute(f"insert into {dbname}.{tbname} values ('2020-02-01 00:00:05', 5, true, 'varchar', 'nchar', 'varbinary')") + tdSql.execute(f"insert into {dbname}.{tbname} values ('2020-02-01 00:00:10', 10, true, 'varchar', 'nchar', 'varbinary')") + tdSql.execute(f"insert into {dbname}.{tbname} values ('2020-02-01 00:00:15', 15, NULL, NULL, NULL, NULL)") + + tdLog.printNoPrefix("==========step3:fill data") + tdSql.query(f"select avg(c0), last(c1) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(value, 9, 'xx');") + tdSql.checkRows(5) + tdSql.checkData(0, 0, 9) + tdSql.checkData(1, 0, 5) + tdSql.checkData(2, 0, 10) + tdSql.checkData(3, 0, 15) + tdSql.checkData(4, 0, 9) + tdSql.checkData(0, 1, False) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, True) + tdSql.checkData(3, 1, False) + tdSql.checkData(4, 1, False) + + tdSql.query(f"select avg(c0), last(c1) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(value, 9, True);") + tdSql.checkRows(5) + tdSql.checkData(0, 1, True) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, True) + tdSql.checkData(3, 1, True) + tdSql.checkData(4, 1, True) + + tdSql.query(f"select avg(c0), last(c1) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(value, 9, False);") + tdSql.checkRows(5) + tdSql.checkData(0, 1, False) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, True) + tdSql.checkData(3, 1, False) + tdSql.checkData(4, 1, False) + + tdSql.query(f"select avg(c0), last(c2) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(value, 9, 'abc');") + tdSql.checkRows(5) + tdSql.checkData(0, 1, "abc") + tdSql.checkData(1, 1, 'varchar') + tdSql.checkData(2, 1, 'varchar') + tdSql.checkData(3, 1, "abc") + tdSql.checkData(4, 1, "abc") + + tdSql.query(f"select avg(c0), last(c2) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(value, 9, '我是#$^中文');") + tdSql.checkRows(5) + tdSql.checkData(0, 1, '我是#$^中文') + tdSql.checkData(1, 1, 'varchar') + tdSql.checkData(2, 1, 'varchar') + tdSql.checkData(3, 1, "我是#$^中文") + tdSql.checkData(4, 1, "我是#$^中文") + + tdSql.query(f"select avg(c0), last(c3) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(value, 9, '我是#$^中文');") + tdSql.checkRows(5) + tdSql.checkData(0, 1, '我是#$^中文') + tdSql.checkData(1, 1, 'nchar') + tdSql.checkData(2, 1, 'nchar') + tdSql.checkData(3, 1, "我是#$^中文") + tdSql.checkData(4, 1, "我是#$^中文") + + tdSql.query(f"select avg(c0), last(c4) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(value, 9, '我是中文');") + tdSql.checkRows(5) + tdSql.checkData(0, 1, b'\xe6\x88\x91\xe6\x98\xaf\xe4\xb8\xad\xe6\x96\x87') + tdSql.checkData(1, 1, b'varbinary') + tdSql.checkData(2, 1, b'varbinary') + tdSql.checkData(3, 1, b'\xe6\x88\x91\xe6\x98\xaf\xe4\xb8\xad\xe6\x96\x87') + tdSql.checkData(4, 1, b'\xe6\x88\x91\xe6\x98\xaf\xe4\xb8\xad\xe6\x96\x87') + + tdLog.printNoPrefix("==========step4:fill null") + tdSql.query(f"select avg(c0), last(c1) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(value, NULL, NULL);") + tdSql.checkRows(5) + tdSql.checkData(0, 0, None) + tdSql.checkData(1, 0, 5) + tdSql.checkData(2, 0, 10) + tdSql.checkData(3, 0, 15) + tdSql.checkData(4, 0, None) + tdSql.checkData(0, 1, None) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, True) + tdSql.checkData(3, 1, None) + tdSql.checkData(4, 1, None) + + tdSql.query(f"select avg(c0), last(c1) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(value, 9, NULL);") + tdSql.checkRows(5) + tdSql.checkData(0, 1, None) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, True) + tdSql.checkData(3, 1, None) + tdSql.checkData(4, 1, None) + + tdSql.query(f"select avg(c0), last(c2) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(value, 9, NULL);") + tdSql.checkRows(5) + tdSql.checkData(0, 1, None) + tdSql.checkData(1, 1, 'varchar') + tdSql.checkData(2, 1, 'varchar') + tdSql.checkData(3, 1, None) + tdSql.checkData(4, 1, None) + + tdSql.query(f"select avg(c0), last(c3) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(value, 9, NULL);") + tdSql.checkRows(5) + tdSql.checkData(0, 1, None) + tdSql.checkData(1, 1, 'nchar') + tdSql.checkData(2, 1, 'nchar') + tdSql.checkData(3, 1, None) + tdSql.checkData(4, 1, None) + + tdSql.query(f"select avg(c0), last(c4) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(value, 9, NULL);") + tdSql.checkRows(5) + tdSql.checkData(0, 1, None) + tdSql.checkData(1, 1, b'varbinary') + tdSql.checkData(2, 1, b'varbinary') + tdSql.checkData(3, 1, None) + tdSql.checkData(4, 1, None) + + tdLog.printNoPrefix("==========step5:fill prev") + tdSql.query(f"select avg(c0), last(c1) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(PREV);") + tdSql.checkRows(5) + tdSql.checkData(0, 0, None) + tdSql.checkData(1, 0, 5) + tdSql.checkData(2, 0, 10) + tdSql.checkData(3, 0, 15) + tdSql.checkData(4, 0, 15) + tdSql.checkData(0, 1, None) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, True) + tdSql.checkData(3, 1, True) + tdSql.checkData(4, 1, True) + + tdSql.query(f"select avg(c0), last(c2) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(PREV);") + tdSql.checkRows(5) + tdSql.checkData(0, 1, None) + tdSql.checkData(1, 1, 'varchar') + tdSql.checkData(2, 1, 'varchar') + tdSql.checkData(3, 1, 'varchar') + tdSql.checkData(4, 1, 'varchar') + + tdSql.query(f"select avg(c0), last(c3) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(PREV);") + tdSql.checkRows(5) + tdSql.checkData(0, 1, None) + tdSql.checkData(1, 1, 'nchar') + tdSql.checkData(2, 1, 'nchar') + tdSql.checkData(3, 1, 'nchar') + tdSql.checkData(4, 1, 'nchar') + + tdSql.query(f"select avg(c0), last(c4) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(PREV);") + tdSql.checkRows(5) + tdSql.checkData(0, 1, None) + tdSql.checkData(1, 1, b'varbinary') + tdSql.checkData(2, 1, b'varbinary') + tdSql.checkData(3, 1, b'varbinary') + tdSql.checkData(4, 1, b'varbinary') + + tdLog.printNoPrefix("==========step6:fill next") + tdSql.query(f"select avg(c0), last(c1) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(NEXT);") + tdSql.checkRows(5) + tdSql.checkData(0, 0, 5) + tdSql.checkData(1, 0, 5) + tdSql.checkData(2, 0, 10) + tdSql.checkData(3, 0, 15) + tdSql.checkData(4, 0, None) + tdSql.checkData(0, 1, True) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, True) + tdSql.checkData(3, 1, None) + tdSql.checkData(4, 1, None) + + tdSql.query(f"select avg(c0), last(c2) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(NEXT);") + tdSql.checkRows(5) + tdSql.checkData(0, 1, 'varchar') + tdSql.checkData(1, 1, 'varchar') + tdSql.checkData(2, 1, 'varchar') + tdSql.checkData(3, 1, None) + tdSql.checkData(4, 1, None) + + tdSql.query(f"select avg(c0), last(c3) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(NEXT);") + tdSql.checkRows(5) + tdSql.checkData(0, 1, 'nchar') + tdSql.checkData(1, 1, 'nchar') + tdSql.checkData(2, 1, 'nchar') + tdSql.checkData(3, 1, None) + tdSql.checkData(4, 1, None) + + tdSql.query(f"select avg(c0), last(c4) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(NEXT);") + tdSql.checkRows(5) + tdSql.checkData(0, 1, b'varbinary') + tdSql.checkData(1, 1, b'varbinary') + tdSql.checkData(2, 1, b'varbinary') + tdSql.checkData(3, 1, None) + tdSql.checkData(4, 1, None) + + tdSql.execute(f"insert into {dbname}.{tbname} values ('2020-02-01 00:00:20', 15, False, '中文', '中文', '中文');") + tdLog.printNoPrefix("==========step6:fill next") + tdSql.query(f"select avg(c0), last(c1) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(NEXT);") + tdSql.checkRows(5) + tdSql.checkData(0, 1, True) + tdSql.checkData(1, 1, True) + tdSql.checkData(2, 1, True) + tdSql.checkData(3, 1, False) + tdSql.checkData(4, 1, False) + + tdSql.query(f"select avg(c0), last(c2) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(NEXT);") + tdSql.checkRows(5) + tdSql.checkData(0, 1, 'varchar') + tdSql.checkData(1, 1, 'varchar') + tdSql.checkData(2, 1, 'varchar') + tdSql.checkData(3, 1, '中文') + tdSql.checkData(4, 1, '中文') + + tdSql.query(f"select avg(c0), last(c3) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(NEXT);") + tdSql.checkRows(5) + tdSql.checkData(0, 1, 'nchar') + tdSql.checkData(1, 1, 'nchar') + tdSql.checkData(2, 1, 'nchar') + tdSql.checkData(3, 1, '中文') + tdSql.checkData(4, 1, '中文') + + tdSql.query(f"select avg(c0), last(c4) from {dbname}.{tbname} where ts>='2020-02-01 00:00:00' and ts<='2020-02-01 00:00:20' interval(5s) fill(NEXT);") + tdSql.checkRows(5) + tdSql.checkData(0, 1, b'varbinary') + tdSql.checkData(1, 1, b'varbinary') + tdSql.checkData(2, 1, b'varbinary') + tdSql.checkData(3, 1, b'\xe4\xb8\xad\xe6\x96\x87') + tdSql.checkData(4, 1, b'\xe4\xb8\xad\xe6\x96\x87') + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/2-query/interp.py b/tests/system-test/2-query/interp.py index c2eb7bee2e..86d010209d 100644 --- a/tests/system-test/2-query/interp.py +++ b/tests/system-test/2-query/interp.py @@ -375,6 +375,22 @@ class TDTestCase: tdSql.checkData(11, 0, True) tdSql.checkData(12, 0, True) + tdSql.query(f"select interp(c6) from {dbname}.{tbname} range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(value, false)") + tdSql.checkRows(13) + tdSql.checkData(0, 0, False) + tdSql.checkData(1, 0, True) + tdSql.checkData(2, 0, False) + tdSql.checkData(3, 0, False) + tdSql.checkData(4, 0, False) + tdSql.checkData(5, 0, False) + tdSql.checkData(6, 0, True) + tdSql.checkData(7, 0, False) + tdSql.checkData(8, 0, False) + tdSql.checkData(9, 0, False) + tdSql.checkData(10, 0, False) + tdSql.checkData(11, 0, True) + tdSql.checkData(12, 0, False) + tdSql.query(f"select interp(c6) from {dbname}.{tbname} range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(value, NULL)") tdSql.checkRows(13) tdSql.checkData(0, 0, None) diff --git a/tests/system-test/2-query/limit.py b/tests/system-test/2-query/limit.py index 4774602d69..fb5595a8be 100644 --- a/tests/system-test/2-query/limit.py +++ b/tests/system-test/2-query/limit.py @@ -291,8 +291,8 @@ class TDTestCase: tdSql.checkData(0, 7, 1) tdSql.checkData(0, 8, "binary5") tdSql.checkData(0, 9, "nchar5") - tdSql.checkData(1, 8, None) - tdSql.checkData(1, 9, None) + tdSql.checkData(1, 8, "-8") + tdSql.checkData(1, 9, "-9") limit = paraDict["rowsPerTbl"] diff --git a/tests/system-test/2-query/partition_by_col_agg.py b/tests/system-test/2-query/partition_by_col_agg.py new file mode 100644 index 0000000000..c522eb1e2b --- /dev/null +++ b/tests/system-test/2-query/partition_by_col_agg.py @@ -0,0 +1,252 @@ +import taos +import sys +import time +import socket +import os +import threading +import math +from datetime import datetime + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.common import * +# from tmqCommon import * + +COMPARE_DATA = 0 +COMPARE_LEN = 1 + +class TDTestCase: + def __init__(self): + self.vgroups = 4 + self.ctbNum = 10 + self.rowsPerTbl = 10000 + self.duraion = '1h' + + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + + def create_database(self,tsql, dbName,dropFlag=1,vgroups=2,replica=1, duration:str='1d'): + if dropFlag == 1: + tsql.execute("drop database if exists %s"%(dbName)) + + tsql.execute("create database if not exists %s vgroups %d replica %d duration %s"%(dbName, vgroups, replica, duration)) + tdLog.debug("complete to create database %s"%(dbName)) + return + + def create_stable(self,tsql, paraDict): + colString = tdCom.gen_column_type_str(colname_prefix=paraDict["colPrefix"], column_elm_list=paraDict["colSchema"]) + tagString = tdCom.gen_tag_type_str(tagname_prefix=paraDict["tagPrefix"], tag_elm_list=paraDict["tagSchema"]) + sqlString = f"create table if not exists %s.%s (%s) tags (%s)"%(paraDict["dbName"], paraDict["stbName"], colString, tagString) + tdLog.debug("%s"%(sqlString)) + tsql.execute(sqlString) + return + + def create_ctable(self,tsql=None, dbName='dbx',stbName='stb',ctbPrefix='ctb',ctbNum=1,ctbStartIdx=0): + for i in range(ctbNum): + sqlString = "create table %s.%s%d using %s.%s tags(%d, 'tb%d', 'tb%d', %d, %d, %d)" % \ + (dbName,ctbPrefix,i+ctbStartIdx,dbName,stbName,(i+ctbStartIdx) % 5,i+ctbStartIdx,i+ctbStartIdx,i+ctbStartIdx,i+ctbStartIdx,i+ctbStartIdx) + tsql.execute(sqlString) + + tdLog.debug("complete to create %d child tables by %s.%s" %(ctbNum, dbName, stbName)) + return + + def insert_data(self,tsql,dbName,ctbPrefix,ctbNum,rowsPerTbl,batchNum,startTs,tsStep): + tdLog.debug("start to insert data ............") + tsql.execute("use %s" %dbName) + pre_insert = "insert into " + sql = pre_insert + + for i in range(ctbNum): + rowsBatched = 0 + sql += " %s%d values "%(ctbPrefix,i) + for j in range(rowsPerTbl): + if (i < ctbNum/2): + sql += "(%d, %d, %d, %d,%d,%d,%d,true,'binary%d', 'nchar%d') "%(startTs + j*tsStep, j%1000, j%500, j%1000, j%5000, j%5400, j%128, j%10000, j%1000) + else: + sql += "(%d, %d, NULL, %d,NULL,%d,%d,true,'binary%d', 'nchar%d') "%(startTs + j*tsStep, j%1000, j%500, j%1000, j%128, j%10000, j%1000) + rowsBatched += 1 + if ((rowsBatched == batchNum) or (j == rowsPerTbl - 1)): + tsql.execute(sql) + rowsBatched = 0 + if j < rowsPerTbl - 1: + sql = "insert into %s%d values " %(ctbPrefix,i) + else: + sql = "insert into " + if sql != pre_insert: + tsql.execute(sql) + tdLog.debug("insert data ............ [OK]") + return + + def prepareTestEnv(self): + tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") + paraDict = {'dbName': 'test', + 'dropFlag': 1, + 'vgroups': 2, + 'stbName': 'meters', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1}, + {'type': 'BIGINT', 'count':1}, + {'type': 'FLOAT', 'count':1}, + {'type': 'DOUBLE', 'count':1}, + {'type': 'smallint', 'count':1}, + {'type': 'tinyint', 'count':1}, + {'type': 'bool', 'count':1}, + {'type': 'binary', 'len':10, 'count':1}, + {'type': 'nchar', 'len':10, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'nchar', 'len':20, 'count':1},{'type': 'binary', 'len':20, 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'smallint', 'count':1},{'type': 'DOUBLE', 'count':1}], + 'ctbPrefix': 't', + 'ctbStartIdx': 0, + 'ctbNum': 100, + 'rowsPerTbl': 10000, + 'batchNum': 3000, + 'startTs': 1537146000000, + 'tsStep': 600000} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tdLog.info("create database") + self.create_database(tsql=tdSql, dbName=paraDict["dbName"], dropFlag=paraDict["dropFlag"], vgroups=paraDict["vgroups"], replica=self.replicaVar, duration=self.duraion) + + tdLog.info("create stb") + self.create_stable(tsql=tdSql, paraDict=paraDict) + + tdLog.info("create child tables") + self.create_ctable(tsql=tdSql, dbName=paraDict["dbName"], \ + stbName=paraDict["stbName"],ctbPrefix=paraDict["ctbPrefix"],\ + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict["ctbStartIdx"]) + self.insert_data(tsql=tdSql, dbName=paraDict["dbName"],\ + ctbPrefix=paraDict["ctbPrefix"],ctbNum=paraDict["ctbNum"],\ + rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"],\ + startTs=paraDict["startTs"],tsStep=paraDict["tsStep"]) + return + + def check_explain_res_has_row(self, plan_str_expect: str, rows): + plan_found = False + for row in rows: + if str(row).find(plan_str_expect) >= 0: + tdLog.debug("plan: [%s] found in: [%s]" % (plan_str_expect, str(row))) + plan_found = True + break + if not plan_found: + tdLog.exit("plan: %s not found in res: [%s]" % (plan_str_expect, str(rows))) + + + def test_sort_for_partition_hint(self): + pass + + def add_order_by(self, sql: str, order_by: str, select_list: str = "*") -> str: + return "select %s from (%s)t order by %s" % (select_list, sql, order_by) + + def add_hint(self, sql: str) -> str: + return "select /*+ sort_for_group() */ %s" % sql[6:] + + def query_with_time(self, sql): + start = datetime.now() + tdSql.query(sql, queryTimes=1) + return (datetime.now().timestamp() - start.timestamp()) * 1000 + + def explain_sql(self, sql: str): + sql = "explain verbose true " + sql + tdSql.query(sql, queryTimes=1) + return tdSql.queryResult + + def query_and_compare_res(self, sql1, sql2, compare_what: int = 0): + dur = self.query_with_time(sql1) + tdLog.debug("sql1 query with time: [%f]" % dur) + res1 = tdSql.queryResult + dur = self.query_with_time(sql2) + tdLog.debug("sql2 query with time: [%f]" % dur) + res2 = tdSql.queryResult + if res1 is None or res2 is None: + tdLog.exit("res1 or res2 is None") + if compare_what <= COMPARE_LEN: + if len(res1) != len(res2): + tdLog.exit("query and copare failed cause different rows, sql1: [%s], rows: [%d], sql2: [%s], rows: [%d]" % (sql1, len(res1), sql2, len(res2))) + if compare_what == COMPARE_DATA: + for i in range(0, len(res1)): + if res1[i] != res2[i]: + tdLog.exit("compare failed for row: [%d], sqls: [%s] res1: [%s], sql2 : [%s] res2: [%s]" % (i, sql1, res1[i], sql2, res2[i])) + tdLog.debug("sql: [%s] and sql: [%s] have same results, rows: [%d]" % (sql1, sql2, len(res1))) + + def query_and_compare_first_rows(self, sql1, sql2): + dur = self.query_with_time(sql1) + tdLog.debug("sql1 query with time: [%f]" % dur) + res1 = tdSql.queryResult + dur = self.query_with_time(sql2) + tdLog.debug("sql2 query with time: [%f]" % dur) + res2 = tdSql.queryResult + if res1 is None or res2 is None: + tdLog.exit("res1 or res2 is None") + for i in range(0, min(len(res1), len(res2))): + if res1[i] != res2[i]: + tdLog.exit("compare failed for row: [%d], sqls: [%s] res1: [%s], sql2 : [%s] res2: [%s]" % (i, sql1, res1[i], sql2, res2[i])) + tdLog.debug("sql: [%s] and sql: [%s] have same results, rows: [%d]" % (sql1, sql2, min(len(res1), len(res2)))) + + def prepare_and_query_and_compare(self, sqls: [], order_by: str, select_list: str = "*", compare_what: int = 0): + for sql in sqls: + sql_hint = self.add_order_by(self.add_hint(sql), order_by, select_list) + sql = self.add_order_by(sql, order_by, select_list) + self.check_explain_res_has_row("Sort", self.explain_sql(sql_hint)) + self.check_explain_res_has_row("Partition", self.explain_sql(sql)) + self.query_and_compare_res(sql, sql_hint, compare_what=compare_what) + + def check_explain(self, sql): + sql_hint = self.add_hint(sql) + explain_res = self.explain_sql(sql) + self.check_explain_res_has_row('SortMerge', explain_res) + self.check_explain_res_has_row("blocking=0", explain_res) + explain_res = self.explain_sql(sql_hint) + self.check_explain_res_has_row('SortMerge', explain_res) + self.check_explain_res_has_row('blocking=0', explain_res) + + def test_pipelined_agg_plan_with_slimit(self): + sql = 'select count(*), %s from meters partition by %s slimit 1' + self.check_explain(sql % ('c1','c1')) + self.check_explain(sql % ('c1,c2', 'c1,c2')) + + # should fail + # self.check_explain(sql % ('t1', 'c1,t1')) + # self.check_explain(sql % ('t1', 'c1,tbname')) + + def test_pipelined_agg_data_with_slimit(self): + sql_template = 'select %s from meters partition by %s %s' + + sql_elems = [ + ['count(*), min(c1), c2', 'c2', 'slimit 10', 'c2'], + ['count(*), c1, c2', 'c1, c2', 'slimit 100', 'c1,c2'], + ['count(*), c2, c1', 'c1, c2', 'slimit 1000', 'c1,c2'], + ['count(*), c4,c3', 'c3, c4', 'slimit 2000', 'c3,c4'], + ['count(*), c8,c6', 'c8, c6', 'slimit 3000', 'c8,c6'], + ['count(*), c1 +1 as a,c6', 'c1, c6', 'slimit 3000', 'a,c6'], + ['count(*), c1 +1 as a,c6', 'c1+1, c6', 'slimit 3000', 'a, c6'], + ] + + for ele in sql_elems: + sql = sql_template % (ele[0], ele[1], ele[2]) + sql_hint = self.add_hint(sql) + sql = self.add_order_by(sql, ele[3]) + sql_no_slimit = sql_template % (ele[0], ele[1], '') + sql_no_slimit = self.add_order_by(sql_no_slimit, ele[3]) + self.query_and_compare_first_rows(sql_hint, sql_no_slimit) + + def run(self): + self.prepareTestEnv() + #time.sleep(99999999) + self.test_pipelined_agg_plan_with_slimit() + self.test_pipelined_agg_data_with_slimit() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/7-tmq/tmqCommon.py b/tests/system-test/7-tmq/tmqCommon.py index 087e5a7c62..059744caf0 100644 --- a/tests/system-test/7-tmq/tmqCommon.py +++ b/tests/system-test/7-tmq/tmqCommon.py @@ -45,9 +45,9 @@ class TMQCom: tdSql.init(conn.cursor()) # tdSql.init(conn.cursor(), logSql) # output sql.txt file - def initConsumerTable(self,cdbName='cdb'): + def initConsumerTable(self,cdbName='cdb', replicaVar=1): tdLog.info("create consume database, and consume info table, and consume result table") - tdSql.query("create database if not exists %s vgroups 1"%(cdbName)) + tdSql.query("create database if not exists %s vgroups 1 replica %d"%(cdbName,replicaVar)) tdSql.query("drop table if exists %s.consumeinfo "%(cdbName)) tdSql.query("drop table if exists %s.consumeresult "%(cdbName)) tdSql.query("drop table if exists %s.notifyinfo "%(cdbName)) diff --git a/tests/system-test/7-tmq/tmqDropConsumer.py b/tests/system-test/7-tmq/tmqDropConsumer.py index 137b5c6584..e3e9906ecf 100644 --- a/tests/system-test/7-tmq/tmqDropConsumer.py +++ b/tests/system-test/7-tmq/tmqDropConsumer.py @@ -12,7 +12,7 @@ sys.path.append("./7-tmq") from tmqCommon import * class TDTestCase: - updatecfgDict = {'debugFlag': 135} + # updatecfgDict = {'debugFlag': 135} def __init__(self): self.vgroups = 2 @@ -252,7 +252,6 @@ class TDTestCase: break tdLog.info("all consumers status into 'lost'") - # drop consumer groups tdLog.info("drop all consumers") for i in range(len(groupIdList)): diff --git a/tests/system-test/7-tmq/tmqVnodeReplicate.py b/tests/system-test/7-tmq/tmqVnodeReplicate.py new file mode 100644 index 0000000000..fd8ece02e0 --- /dev/null +++ b/tests/system-test/7-tmq/tmqVnodeReplicate.py @@ -0,0 +1,173 @@ + +import taos +import sys +import time +import socket +import os +import threading +import math + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.common import * +from util.cluster import * +sys.path.append("./7-tmq") +from tmqCommon import * + +class TDTestCase: + def __init__(self): + self.vgroups = 1 + self.ctbNum = 10 + self.rowsPerTbl = 10000 + + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + + def prepareTestEnv(self): + tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 1, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 10, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 20, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tmqCom.initConsumerTable() + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], wal_retention_period=36000,vgroups=paraDict["vgroups"],replica=self.replicaVar) + tdLog.info("create stb") + tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"]) + tdLog.info("create ctb") + tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) + tdLog.info("insert data") + tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + tdLog.info("restart taosd to ensure that the data falls into the disk") + # tdDnodes.stop(1) + # tdDnodes.start(1) + tdSql.query("flush database %s"%(paraDict['dbName'])) + return + + def tmqCase1(self): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 1, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctbn', + 'ctbStartIdx': 0, + 'ctbNum': 10, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 20, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tdLog.info("create ctb") + tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) + tdLog.info("insert data") + pInsertThread = tmqCom.asyncInsertDataByInterlace(paraDict) + + topicNameList = ['topic1'] + # expectRowsList = [] + tmqCom.initConsumerTable("cdb", self.replicaVar) + + tdLog.info("create topics from stb with filter") + queryString = "select * from %s.%s"%(paraDict['dbName'], paraDict['stbName']) + # sqlString = "create topic %s as stable %s" %(topicNameList[0], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[0], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + # tdSql.query(queryString) + # expectRowsList.append(tdSql.getRows()) + + # init consume info, and start tmq_sim, then check consume result + tdLog.info("insert consume info to consume processor") + consumerId = 0 + expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2 + topicList = topicNameList[0] + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + tdLog.info("wait the consume result") + + tmqCom.getStartConsumeNotifyFromTmqsim() + tmqCom.getStartCommitNotifyFromTmqsim() + + tdSql.query("select * from information_schema.ins_vnodes") + # tdLog.debug(tdSql.queryResult) + tdDnodes = cluster.dnodes + for result in tdSql.queryResult: + if result[2] == 'dbt' and result[3] == 'leader': + tdLog.debug("leader is %d"%(result[0] - 1)) + tdDnodes[result[0] - 1].stoptaosd() + break + + pInsertThread.join() + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + if expectrowcnt > resultList[0]: + tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectrowcnt, resultList[0])) + tdLog.exit("%d tmq consume rows error!"%consumerId) + + # tmqCom.checkFileContent(consumerId, queryString) + + time.sleep(10) + for i in range(len(topicNameList)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 1 end ...... ") + + def run(self): + tdSql.prepare() + self.prepareTestEnv() + self.tmqCase1() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/7-tmq/tmqVnodeSplit.py b/tests/system-test/7-tmq/tmqVnodeSplit.py new file mode 100644 index 0000000000..c6cdc2bf83 --- /dev/null +++ b/tests/system-test/7-tmq/tmqVnodeSplit.py @@ -0,0 +1,210 @@ + +import taos +import sys +import time +import socket +import os +import threading +import math + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.common import * +from util.cluster import * +sys.path.append("./7-tmq") +from tmqCommon import * + +class TDTestCase: + def __init__(self): + self.vgroups = 1 + self.ctbNum = 10 + self.rowsPerTbl = 10000 + + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + + def getDataPath(self): + selfPath = tdCom.getBuildPath() + + return selfPath + '/../sim/dnode%d/data/vnode/vnode%d/wal/*'; + + def prepareTestEnv(self): + tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 1, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 10, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 60, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tdCom.drop_all_db(); + tmqCom.initConsumerTable() + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], wal_retention_period=36000,vgroups=paraDict["vgroups"],replica=self.replicaVar) + tdLog.info("create stb") + tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"]) + return + + def restartAndRemoveWal(self, deleteWal): + tdDnodes = cluster.dnodes + tdSql.query("select * from information_schema.ins_vnodes") + for result in tdSql.queryResult: + if result[2] == 'dbt': + tdLog.debug("dnode is %d"%(result[0])) + dnodeId = result[0] + vnodeId = result[1] + + tdDnodes[dnodeId - 1].stoptaosd() + time.sleep(1) + dataPath = self.getDataPath() + dataPath = dataPath%(dnodeId,vnodeId) + tdLog.debug("dataPath:%s"%dataPath) + if deleteWal: + if os.system('rm -rf ' + dataPath) != 0: + tdLog.exit("rm error") + + tdDnodes[dnodeId - 1].starttaosd() + time.sleep(1) + break + tdLog.debug("restart dnode ok") + + def splitVgroups(self): + tdSql.query("select * from information_schema.ins_vnodes") + vnodeId = 0 + for result in tdSql.queryResult: + if result[2] == 'dbt': + vnodeId = result[1] + tdLog.debug("vnode is %d"%(vnodeId)) + break + splitSql = "split vgroup %d" %(vnodeId) + tdLog.debug("splitSql:%s"%(splitSql)) + tdSql.query(splitSql) + tdLog.debug("splitSql ok") + + def tmqCase1(self, deleteWal=False): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 1, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 10, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 60, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + topicNameList = ['topic1'] + # expectRowsList = [] + tmqCom.initConsumerTable() + + tdLog.info("create topics from stb with filter") + queryString = "select * from %s.%s"%(paraDict['dbName'], paraDict['stbName']) + # sqlString = "create topic %s as stable %s" %(topicNameList[0], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[0], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + # tdSql.query(queryString) + # expectRowsList.append(tdSql.getRows()) + + # init consume info, and start tmq_sim, then check consume result + tdLog.info("insert consume info to consume processor") + consumerId = 0 + expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2 + topicList = topicNameList[0] + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + tdLog.info("wait the consume result") + + tdLog.info("create ctb1") + tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) + tdLog.info("insert data") + pInsertThread = tmqCom.asyncInsertDataByInterlace(paraDict) + + tmqCom.getStartConsumeNotifyFromTmqsim() + tmqCom.getStartCommitNotifyFromTmqsim() + + #restart dnode & remove wal + self.restartAndRemoveWal(deleteWal) + + # split vgroup + self.splitVgroups() + + tdLog.info("create ctb2") + paraDict['ctbPrefix'] = "ctbn" + tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) + tdLog.info("insert data") + pInsertThread1 = tmqCom.asyncInsertDataByInterlace(paraDict) + pInsertThread.join() + pInsertThread1.join() + + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + if expectrowcnt / 2 >= resultList[0]: + tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectrowcnt / 2, resultList[0])) + tdLog.exit("%d tmq consume rows error!"%consumerId) + + # tmqCom.checkFileContent(consumerId, queryString) + + time.sleep(2) + for i in range(len(topicNameList)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 1 end ...... ") + + def run(self): + tdSql.prepare() + self.prepareTestEnv() + self.tmqCase1(True) + self.prepareTestEnv() + self.tmqCase1(False) + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/7-tmq/tmqVnodeTransform.py b/tests/system-test/7-tmq/tmqVnodeTransform.py new file mode 100644 index 0000000000..fa50e46853 --- /dev/null +++ b/tests/system-test/7-tmq/tmqVnodeTransform.py @@ -0,0 +1,339 @@ + +import taos +import sys +import time +import socket +import os +import threading +import math + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.common import * +from util.cluster import * +sys.path.append("./7-tmq") +from tmqCommon import * + +class TDTestCase: + def __init__(self): + self.vgroups = 1 + self.ctbNum = 10 + self.rowsPerTbl = 10000 + + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + + def getDataPath(self): + selfPath = tdCom.getBuildPath() + + return selfPath + '/../sim/dnode%d/data/vnode/vnode%d/wal/*'; + + def prepareTestEnv(self): + tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 1, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 10, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 60, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + tdCom.drop_all_db(); + tmqCom.initConsumerTable() + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], wal_retention_period=36000,vgroups=paraDict["vgroups"],replica=self.replicaVar) + tdLog.info("create stb") + tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"]) + # tdLog.info("create ctb") + # tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], + # ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) + # tdLog.info("insert data") + # tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + # ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + # startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + # tdLog.info("restart taosd to ensure that the data falls into the disk") + # tdDnodes.stop(1) + # tdDnodes.start(1) + # tdSql.query("flush database %s"%(paraDict['dbName'])) + return + + def restartAndRemoveWal(self): + tdDnodes = cluster.dnodes + tdSql.query("select * from information_schema.ins_vnodes") + for result in tdSql.queryResult: + if result[2] == 'dbt': + tdLog.debug("dnode is %d"%(result[0])) + dnodeId = result[0] + vnodeId = result[1] + + tdDnodes[dnodeId - 1].stoptaosd() + time.sleep(1) + dataPath = self.getDataPath() + dataPath = dataPath%(dnodeId,vnodeId) + os.system('rm -rf ' + dataPath) + tdLog.debug("dataPath:%s"%dataPath) + tdDnodes[dnodeId - 1].starttaosd() + time.sleep(1) + break + tdLog.debug("restart dnode ok") + + def redistributeVgroups(self): + dnodesList = [] + tdSql.query("show dnodes") + for result in tdSql.queryResult: + dnodesList.append(result[0]) + + tdSql.query("select * from information_schema.ins_vnodes") + vnodeId = 0 + for result in tdSql.queryResult: + if result[2] == 'dbt': + tdLog.debug("dnode is %d"%(result[0])) + dnodesList.remove(result[0]) + vnodeId = result[1] + break + redistributeSql = "redistribute vgroup %d dnode %d" %(vnodeId, dnodesList[0]) + tdLog.debug("redistributeSql:%s"%(redistributeSql)) + tdSql.query(redistributeSql) + tdLog.debug("redistributeSql ok") + + def tmqCase1(self): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 1, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 10, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 60, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + topicNameList = ['topic1'] + # expectRowsList = [] + tmqCom.initConsumerTable() + + tdLog.info("create topics from stb with filter") + queryString = "select * from %s.%s"%(paraDict['dbName'], paraDict['stbName']) + # sqlString = "create topic %s as stable %s" %(topicNameList[0], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[0], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + # tdSql.query(queryString) + # expectRowsList.append(tdSql.getRows()) + + # init consume info, and start tmq_sim, then check consume result + tdLog.info("insert consume info to consume processor") + consumerId = 0 + expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2 + topicList = topicNameList[0] + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + tdLog.info("wait the consume result") + + tdLog.info("create ctb1") + tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) + tdLog.info("insert data") + pInsertThread = tmqCom.asyncInsertDataByInterlace(paraDict) + + tmqCom.getStartConsumeNotifyFromTmqsim() + tmqCom.getStartCommitNotifyFromTmqsim() + + #restart dnode & remove wal + self.restartAndRemoveWal() + + # redistribute vgroup + self.redistributeVgroups(); + + tdLog.info("create ctb2") + paraDict['ctbPrefix'] = "ctbn" + tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) + tdLog.info("insert data") + pInsertThread1 = tmqCom.asyncInsertDataByInterlace(paraDict) + pInsertThread.join() + pInsertThread1.join() + + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + if expectrowcnt / 2 >= resultList[0]: + tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectrowcnt / 2, resultList[0])) + tdLog.exit("%d tmq consume rows error!"%consumerId) + + # tmqCom.checkFileContent(consumerId, queryString) + + time.sleep(10) + for i in range(len(topicNameList)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 1 end ...... ") + + def tmqCase2(self): + tdLog.printNoPrefix("======== test case 2: ") + paraDict = {'dbName':'dbt'} + + ntbName = "ntb" + + topicNameList = ['topic2'] + tmqCom.initConsumerTable() + + sqlString = "create table %s.%s(ts timestamp, i nchar(8))" %(paraDict['dbName'], ntbName) + tdLog.info("create nomal table sql: %s"%sqlString) + tdSql.execute(sqlString) + + tdLog.info("create topics from nomal table") + queryString = "select * from %s.%s"%(paraDict['dbName'], ntbName) + sqlString = "create topic %s as %s" %(topicNameList[0], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + tdSql.query("flush database %s"%(paraDict['dbName'])) + #restart dnode & remove wal + self.restartAndRemoveWal() + + # redistribute vgroup + self.redistributeVgroups(); + + sqlString = "alter table %s.%s modify column i nchar(16)" %(paraDict['dbName'], ntbName) + tdLog.info("alter table sql: %s"%sqlString) + tdSql.error(sqlString) + + time.sleep(1) + for i in range(len(topicNameList)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 2 end ...... ") + + def tmqCase3(self): + tdLog.printNoPrefix("======== test case 3: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 1, + 'stbName': 'stbn', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 10, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 2, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 0} + + paraDict['vgroups'] = self.vgroups + paraDict['ctbNum'] = self.ctbNum + paraDict['rowsPerTbl'] = self.rowsPerTbl + + topicNameList = ['topic3'] + tmqCom.initConsumerTable() + + tdLog.info("create stb") + tmqCom.create_stable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"]) + + tdLog.info("create ctb") + tmqCom.create_ctable(tdSql, dbName=paraDict["dbName"],stbName=paraDict["stbName"],ctbPrefix=paraDict['ctbPrefix'], + ctbNum=paraDict["ctbNum"],ctbStartIdx=paraDict['ctbStartIdx']) + tdLog.info("insert data") + tmqCom.insert_data_interlaceByMultiTbl(tsql=tdSql,dbName=paraDict["dbName"],ctbPrefix=paraDict["ctbPrefix"], + ctbNum=paraDict["ctbNum"],rowsPerTbl=paraDict["rowsPerTbl"],batchNum=paraDict["batchNum"], + startTs=paraDict["startTs"],ctbStartIdx=paraDict['ctbStartIdx']) + + tdLog.info("create topics from stb with filter") + queryString = "select * from %s.%s"%(paraDict['dbName'], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[0], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + + # init consume info, and start tmq_sim, then check consume result + tdLog.info("insert consume info to consume processor") + consumerId = 0 + expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] + topicList = topicNameList[0] + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + tdLog.info("wait the consume result") + + time.sleep(5) + #restart dnode & remove wal + self.restartAndRemoveWal() + + # redistribute vgroup + self.redistributeVgroups(); + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + tdLog.info("wait the consume result") + + time.sleep(10) + for i in range(len(topicNameList)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 3 end ...... ") + + def run(self): + + tdSql.prepare() + self.prepareTestEnv() + self.tmqCase1() + self.tmqCase2() + self.prepareTestEnv() + self.tmqCase3() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/runAllOne.sh b/tests/system-test/runAllOne.sh index a870e36935..6d4c80c388 100644 --- a/tests/system-test/runAllOne.sh +++ b/tests/system-test/runAllOne.sh @@ -210,6 +210,7 @@ python3 ./test.py -f 2-query/hyperloglog.py -P python3 ./test.py -f 2-query/hyperloglog.py -P -R python3 ./test.py -f 2-query/interp.py -P python3 ./test.py -f 2-query/interp.py -P -R +python3 ./test.py -f 2-query/fill.py -P python3 ./test.py -f 2-query/irate.py -P python3 ./test.py -f 2-query/irate.py -P -R python3 ./test.py -f 2-query/join.py -P @@ -450,6 +451,7 @@ python3 ./test.py -f 2-query/arccos.py -P -Q 2 python3 ./test.py -f 2-query/arctan.py -P -Q 2 python3 ./test.py -f 2-query/query_cols_tags_and_or.py -P -Q 2 python3 ./test.py -f 2-query/interp.py -P -Q 2 +python3 ./test.py -f 2-query/fill.py -P -Q 2 python3 ./test.py -f 2-query/nestedQueryInterval.py -P -Q 2 python3 ./test.py -f 2-query/stablity.py -P -Q 2 python3 ./test.py -f 2-query/stablity_1.py -P -Q 2 @@ -579,6 +581,7 @@ python3 ./test.py -f 2-query/last_row.py -P -Q 3 python3 ./test.py -f 2-query/tsbsQuery.py -P -Q 3 python3 ./test.py -f 2-query/sml.py -P -Q 3 python3 ./test.py -f 2-query/interp.py -P -Q 3 +python3 ./test.py -f 2-query/fill.py -P -Q 3 python3 ./test.py -f 2-query/case_when.py -P -Q 3 python3 ./test.py -f 2-query/blockSMA.py -P -Q 3 python3 ./test.py -f 2-query/projectionDesc.py -P -Q 3 @@ -675,6 +678,7 @@ python3 ./test.py -f 2-query/last_row.py -P -Q 4 python3 ./test.py -f 2-query/tsbsQuery.py -P -Q 4 python3 ./test.py -f 2-query/sml.py -P -Q 4 python3 ./test.py -f 2-query/interp.py -P -Q 4 +python3 ./test.py -f 2-query/fill.py -P -Q 4 python3 ./test.py -f 2-query/case_when.py -P -Q 4 python3 ./test.py -f 2-query/insert_select.py -P python3 ./test.py -f 2-query/insert_select.py -P -R diff --git a/tests/system-test/win-test-file b/tests/system-test/win-test-file index 443c27fd7e..3daf65b406 100644 --- a/tests/system-test/win-test-file +++ b/tests/system-test/win-test-file @@ -271,6 +271,7 @@ python3 ./test.py -f 2-query/hyperloglog.py python3 ./test.py -f 2-query/hyperloglog.py -R python3 ./test.py -f 2-query/interp.py python3 ./test.py -f 2-query/interp.py -R +python3 ./test.py -f 2-query/fill.py python3 ./test.py -f 2-query/irate.py python3 ./test.py -f 2-query/irate.py -R python3 ./test.py -f 2-query/join.py @@ -496,6 +497,7 @@ python3 ./test.py -f 2-query/arccos.py -Q 2 python3 ./test.py -f 2-query/arctan.py -Q 2 python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 2 python3 ./test.py -f 2-query/interp.py -Q 2 +python3 ./test.py -f 2-query/fill.py -Q 2 python3 ./test.py -f 2-query/nestedQueryInterval.py -Q 2 python3 ./test.py -f 2-query/stablity.py -Q 2 python3 ./test.py -f 2-query/stablity_1.py -Q 2 @@ -624,6 +626,7 @@ python3 ./test.py -f 2-query/last_row.py -Q 3 python3 ./test.py -f 2-query/tsbsQuery.py -Q 3 python3 ./test.py -f 2-query/sml.py -Q 3 python3 ./test.py -f 2-query/interp.py -Q 3 +python3 ./test.py -f 2-query/fill.py -Q 3 python3 ./test.py -f 2-query/case_when.py -Q 3 python3 ./test.py -f 2-query/blockSMA.py -Q 3 python3 ./test.py -f 2-query/projectionDesc.py -Q 3 @@ -717,6 +720,7 @@ python3 ./test.py -f 2-query/last_row.py -Q 4 python3 ./test.py -f 2-query/tsbsQuery.py -Q 4 python3 ./test.py -f 2-query/sml.py -Q 4 python3 ./test.py -f 2-query/interp.py -Q 4 +python3 ./test.py -f 2-query/fill.py -Q 4 python3 ./test.py -f 2-query/case_when.py -Q 4 python3 ./test.py -f 2-query/insert_select.py python3 ./test.py -f 2-query/insert_select.py -R diff --git a/utils/tsim/inc/simInt.h b/utils/tsim/inc/simInt.h index 8ff3f3b183..02c7540cde 100644 --- a/utils/tsim/inc/simInt.h +++ b/utils/tsim/inc/simInt.h @@ -123,6 +123,7 @@ enum { SIM_CMD_RETURN, SIM_CMD_LINE_INSERT, SIM_CMD_LINE_INSERT_ERROR, + SIM_CMD_SET_BI_MODE, SIM_CMD_END }; @@ -161,6 +162,7 @@ typedef struct _script_t { bool killed; void *taos; char rows[12]; // number of rows data retrieved + char cols[12]; // number of columns data retrieved char data[MAX_QUERY_ROW_NUM][MAX_QUERY_COL_NUM][MAX_QUERY_VALUE_LEN]; // query results char system_exit_code[12]; char system_ret_content[MAX_SYSTEM_RESULT_LEN]; @@ -210,6 +212,7 @@ bool simExecuteSqlSlowCmd(SScript *script, char *option); bool simExecuteRestfulCmd(SScript *script, char *rest); bool simExecuteLineInsertCmd(SScript *script, char *option); bool simExecuteLineInsertErrorCmd(SScript *script, char *option); +bool simExecuteSetBIModeCmd(SScript *script, char *option); void simVisuallizeOption(SScript *script, char *src, char *dst); #endif /*_TD_SIM_INT_H_*/ diff --git a/utils/tsim/src/simExe.c b/utils/tsim/src/simExe.c index 9a0a156717..ac17fad36b 100644 --- a/utils/tsim/src/simExe.c +++ b/utils/tsim/src/simExe.c @@ -93,6 +93,8 @@ char *simGetVariable(SScript *script, char *varName, int32_t varLen) { if (strncmp(varName, "rows", varLen) == 0) return script->rows; + if (strncmp(varName, "cols", varLen) == 0) return script->cols; + if (strncmp(varName, "system_exit", varLen) == 0) return script->system_exit_code; if (strncmp(varName, "system_content", varLen) == 0) return script->system_ret_content; @@ -502,6 +504,26 @@ bool simExecuteSystemContentCmd(SScript *script, char *option) { return true; } +bool simExecuteSetBIModeCmd(SScript *script, char *option) { + char buf[1024]; + + simVisuallizeOption(script, option, buf); + option = buf; + + int32_t mode = atoi(option); + + simInfo("script:%s, set bi mode %d", script->fileName, mode); + + if (mode != 0) { + taos_set_conn_mode(script->taos, TAOS_CONN_MODE_BI, 1); + } else { + taos_set_conn_mode(script->taos, TAOS_CONN_MODE_BI, 0); + } + + script->linePos++; + return true; +} + bool simExecutePrintCmd(SScript *script, char *rest) { char buf[65536]; @@ -808,6 +830,7 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) { taos_free_result(pSql); sprintf(script->rows, "%d", numOfRows); + sprintf(script->cols, "%d", num_fields); script->linePos++; return true; @@ -822,6 +845,7 @@ bool simExecuteSqlImpCmd(SScript *script, char *rest, bool isSlow) { simDebug("script:%s, exec:%s", script->fileName, rest); strcpy(script->rows, "-1"); + strcpy(script->cols, "-1"); for (int32_t row = 0; row < MAX_QUERY_ROW_NUM; ++row) { for (int32_t col = 0; col < MAX_QUERY_COL_NUM; ++col) { strcpy(script->data[row][col], "null"); @@ -918,6 +942,7 @@ bool simExecuteSqlErrorCmd(SScript *script, char *rest) { simDebug("script:%s, exec:%s", script->fileName, rest); strcpy(script->rows, "-1"); + strcpy(script->cols, "-1"); for (int32_t row = 0; row < MAX_QUERY_ROW_NUM; ++row) { for (int32_t col = 0; col < MAX_QUERY_COL_NUM; ++col) { strcpy(script->data[row][col], "null"); diff --git a/utils/tsim/src/simParse.c b/utils/tsim/src/simParse.c index cdd918ac00..fbaf08bf3b 100644 --- a/utils/tsim/src/simParse.c +++ b/utils/tsim/src/simParse.c @@ -745,6 +745,25 @@ bool simParseSystemContentCmd(char *rest, SCommand *pCmd, int32_t lineNum) { return true; } +bool simParseSetBIModeCmd(char *rest, SCommand *pCmd, int32_t lineNum) { + char *token; + int32_t tokenLen; + + cmdLine[numOfLines].cmdno = SIM_CMD_SET_BI_MODE; + cmdLine[numOfLines].lineNum = lineNum; + + paGetToken(rest, &token, &tokenLen); + if (tokenLen > 0) { + cmdLine[numOfLines].optionOffset = optionOffset; + memcpy(optionBuffer + optionOffset, token, tokenLen); + optionOffset += tokenLen + 1; + *(optionBuffer + optionOffset - 1) = 0; + } + + numOfLines++; + return true; +} + bool simParseSleepCmd(char *rest, SCommand *pCmd, int32_t lineNum) { char *token; int32_t tokenLen; @@ -1074,6 +1093,14 @@ void simInitsimCmdList() { simCmdList[cmdno].executeCmd = simExecuteReturnCmd; simAddCmdIntoHash(&(simCmdList[cmdno])); + cmdno = SIM_CMD_SET_BI_MODE; + simCmdList[cmdno].cmdno = cmdno; + strcpy(simCmdList[cmdno].name, "set_bi_mode"); + simCmdList[cmdno].nlen = (int16_t)strlen(simCmdList[cmdno].name); + simCmdList[cmdno].parseCmd = simParseSetBIModeCmd; + simCmdList[cmdno].executeCmd = simExecuteSetBIModeCmd; + simAddCmdIntoHash(&(simCmdList[cmdno])); + #if 0 cmdno = SIM_CMD_LINE_INSERT; simCmdList[cmdno].cmdno = cmdno;