diff --git a/deps/mips/dm_static/libdmodule.a b/deps/mips/dm_static/libdmodule.a new file mode 100644 index 0000000000..d4b0582498 Binary files /dev/null and b/deps/mips/dm_static/libdmodule.a differ diff --git a/docs/en/12-taos-sql/10-function.md b/docs/en/12-taos-sql/10-function.md index fbdae3445b..b4f1cf65da 100644 --- a/docs/en/12-taos-sql/10-function.md +++ b/docs/en/12-taos-sql/10-function.md @@ -491,6 +491,8 @@ TO_CHAR(ts, format_str_literal) **Description**: Convert a ts column to string as the format specified +**Version**: Since ver-3.2.2.0 + **Return value type**: VARCHAR **Applicable column types**: TIMESTAMP @@ -550,6 +552,8 @@ TO_TIMESTAMP(ts_str_literal, format_str_literal) **Description**: Convert a formated timestamp string to a timestamp +**Version**: Since ver-3.2.2.0 + **Return value type**: TIMESTAMP **Applicable column types**: VARCHAR diff --git a/docs/en/12-taos-sql/18-escape.md b/docs/en/12-taos-sql/18-escape.md index a44b21db43..2d067b2ad9 100644 --- a/docs/en/12-taos-sql/18-escape.md +++ b/docs/en/12-taos-sql/18-escape.md @@ -7,14 +7,14 @@ description: This document describes the usage of escape characters in TDengine. | Escape Character | **Actual Meaning** | | :--------------: | ------------------------ | -| `\'` | Single quote ' | -| `\"` | Double quote " | -| \n | Line Break | -| \r | Carriage Return | -| \t | tab | -| `\\` | Back Slash \ | -| `\%` | % see below for details | -| `\_` | \_ see below for details | +| `\'` | Single quote `'` | +| `\"` | Double quote `"` | +| `\n` | Line Break | +| `\r` | Carriage Return | +| `\t` | tab | +| `\\` | Back Slash `\ ` | +| `\%` | `%` see below for details | +| `\_` | `_` see below for details | ## Restrictions @@ -22,5 +22,5 @@ description: This document describes the usage of escape characters in TDengine. - Identifier without ``: Error will be returned because identifier must be constituted of digits, ASCII characters or underscore and can't be started with digits - Identifier quoted with ``: Original content is kept, no escaping 2. If there are escape characters in values - - The escape characters will be escaped as the above table. If the escape character doesn't match any supported one, the escape character "\" will be ignored. - - "%" and "\_" are used as wildcards in `like`. `\%` and `\_` should be used to represent literal "%" and "\_" in `like`,. If `\%` and `\_` are used out of `like` context, the evaluation result is "`\%`"and "`\_`", instead of "%" and "\_". + - The escape characters will be escaped as the above table. If the escape character doesn't match any supported one, the escape character `\ ` will be ignored(`\x` remaining). + - `%` and `_` are used as wildcards in `like`. `\%` and `\_` should be used to represent literal `%` and `_` in `like`. If `\%` and `\_` are used out of `like` context, the evaluation result is `\%` and `\_`, instead of `%` and `_`. diff --git a/docs/zh/07-develop/07-tmq.mdx b/docs/zh/07-develop/07-tmq.mdx index 50913e87c8..df651eab96 100644 --- a/docs/zh/07-develop/07-tmq.mdx +++ b/docs/zh/07-develop/07-tmq.mdx @@ -15,334 +15,62 @@ import Node from "./_sub_node.mdx"; import CSharp from "./_sub_cs.mdx"; import CDemo from "./_sub_c.mdx"; -为了帮助应用实时获取写入 TDengine 的数据,或者以事件到达顺序处理数据,TDengine 提供了类似消息队列产品的数据订阅、消费接口。这样在很多场景下,采用 TDengine 的时序数据处理系统不再需要集成消息队列产品,比如 kafka, 从而简化系统设计的复杂度,降低运营维护成本。 -与 kafka 一样,你需要定义 *topic*, 但 TDengine 的 *topic* 是基于一个已经存在的超级表、子表或普通表的查询条件,即一个 `SELECT` 语句。你可以使用 SQL 对标签、表名、列、表达式等条件进行过滤,以及对数据进行标量函数与 UDF 计算(不包括数据聚合)。与其他消息队列软件相比,这是 TDengine 数据订阅功能的最大的优势,它提供了更大的灵活性,数据的颗粒度可以由应用随时调整,而且数据的过滤与预处理交给 TDengine,而不是应用完成,有效的减少传输的数据量与应用的复杂度。 +为了帮助应用实时获取写入 TDengine 的数据,或者以事件到达顺序处理数据,TDengine 提供了类似 kafka 的数据订阅功能。这样在很多场景下,采用 TDengine 的时序数据处理系统不再需要集成消息队列产品,比如 kafka, 从而简化系统设计的复杂度,降低运营维护成本。 -消费者订阅 *topic* 后,可以实时获得最新的数据。多个消费者可以组成一个消费者组 (consumer group), 一个消费者组里的多个消费者共享消费进度,便于多线程、分布式地消费数据,提高消费速度。但不同消费者组中的消费者即使消费同一个 topic, 并不共享消费进度。一个消费者可以订阅多个 topic。如果订阅的是超级表,数据可能会分布在多个不同的 vnode 上,也就是多个 shard 上,这样一个消费组里有多个消费者可以提高消费效率。TDengine 的消息队列提供了消息的 ACK 机制,在宕机、重启等复杂环境下确保 at least once 消费。 +# 介绍 +## 主题 +与 kafka 一样,你需要定义 topic, TDengine 的 topic 有三种,可以是数据库,超级表,或者一个 `SELECT` 语句,具体的语法参见 [CREATE TOPIC](../../12-taos-sql/13-tmq)。与其他消息队列软件相比,这是 TDengine 数据订阅功能的最大的优势,它提供了更大的灵活性,数据的颗粒度可以由应用随时调整,而且数据的过滤与预处理交给 TDengine,而不是应用完成,有效的减少传输的数据量与应用的复杂度。 -为了实现上述功能,TDengine 会为 WAL (Write-Ahead-Log) 文件自动创建索引以支持快速随机访问,并提供了灵活可配置的文件切换与保留机制:用户可以按需指定 WAL 文件保留的时间以及大小(详见 create database 语句)。通过以上方式将 WAL 改造成了一个保留事件到达顺序的、可持久化的存储引擎(但由于 TSDB 具有远比 WAL 更高的压缩率,我们不推荐保留太长时间,一般来说,不超过几天)。 对于以 topic 形式创建的查询,TDengine 将对接 WAL 而不是 TSDB 作为其存储引擎。在消费时,TDengine 根据当前消费进度从 WAL 直接读取数据,并使用统一的查询引擎实现过滤、变换等操作,将数据推送给消费者。 +如下图,每个 topic 涉及到的数据表可能分布在多个 vnode(相当于 kafka 里的 partition) 上,每个 vnode 上的数据保存在 WAL(Write-Ahead-Log) 文件中,WAL 文件里的数据是顺序写入的(由于 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 等广泛使用的消息队列类产品的行为相似; +![img_5.png](img_5.png) -本文档不对消息队列本身的知识做更多的介绍,如果需要了解,请自行搜索。 +TDengine 会为 WAL 文件自动创建索引以支持快速随机访问,并提供了灵活可配置的文件切换与保留机制,用户可以按需指定 WAL 文件保留的时间以及大小(详见 [CREATE DATABASE](../../12-taos-sql/02-database) 语句,由于消费是通过 WAL 实现的,所以应该根据写入消费速度来确定 WAL 的保存时长)。通过以上方式将 WAL 改造成了一个保留事件到达顺序的、可持久化的存储引擎。 -说明: +对于 `SELECT` 语句形式的 topic,在消费时,TDengine 根据当前消费进度从 WAL 直接读取数据,并使用统一的查询引擎实现过滤、变换等操作,将数据推送给消费者。 + +## 生产者 +写入 topic 相关联的数据表中数据的都是生产者,生产者实际生产的数据写入到了子表或普通表中,即表所在 vnode 的 WAL 里。 + +## 消费者 +### 消费者组 +消费者订阅 topic 后,可以消费 topic 里的所有数据(这些数据所在的表可能分布在多个 vnode 上,即 db 所在的所有 vnode)。订阅 topic 时,需要指定一个消费者组 (consumer group),如果这个消费者组里只有一个消费者,那么这个消费者会顺序的消费这些 vnode 上的数据。 + +为了提高消费速度,便于多线程、分布式地消费数据,可以在一个消费组里添加多个消费者,这些消费者将均分数据所在的 vnode 进行消费(比如数据分布在 4 个 vnode 上,有 2 个消费者的话,那么每个消费者消费 2 个 vnode;有 3 个消费者的话,2 个消费者各消费 1 个 vnode,1 个消费者消费 2 个 vnode;有 5 个消费者的话,4 个各分配 1 个 vnode 消费,另外 1 个不消费),如下图: + +![img_6.png](img_6.png) + +在一个消费组里添加一个消费者后,在 Mnode 上通过 rebalance 的机制实现消费者的重新分配,该操作对用户是透明的。 + +一个消费者可以订阅多个 topic。TDengine 的数据订阅在宕机、重启等复杂环境下确保 at least once 消费。 +### 消费进度 +在 topic 的一个消费组的一个 vnode 上有消费进度。消费者消费的同时,可以提交消费进度,消费进度即 vnode 上 WAL 的版本号(对于 kafka 里的 offset),消费进度可以手动提交,也可以通过参数(auto.commit.interval.ms)设置为周期性自动提交。 + +首次消费数据时通过订阅参数(auto.offset.reset)来确定消费位置为最新数据(latest)还是最旧数据(earliest)。 + +消费进度在一个 vnode 上对于同一个 topic 和 消费者组是唯一的。所以如果同一个 topic 和 消费者组在一个 vnode 上的消费者退出了,并且提交了消费进度。然后同一个 topic 和 消费者组里重新建了一个新的消费者消费这个 vnode,那么这个新消费者将继承之前的消费进度继续消费。 + +如果之前的消费者没有提交消费进度,那个新的消费者将根据订阅参数(auto.offset.reset)设置的值来确定起始消费位置。 + +不同消费者组中的消费者即使消费同一个 topic, 并不共享消费进度。 + +![img_7.png](img_7.png) + +作为一个数据库产品, WAL 文件中存储的不全是数据,也包括其他写入消息,元数据等,所以消费进度不是连续的。 + +##说明 从3.2.0.0版本开始,数据订阅支持vnode迁移和分裂。 -由于数据订阅依赖wal文件,而在vnode迁移和分裂的过程中,wal并不会同步过去,所以迁移或分裂后,之前没消费完的wal数据后消费不到。所以请保证之前把数据全部消费完后,再进行vnode迁移或分裂,否则,消费会丢失数据。 -## 主要数据结构和 API +由于数据订阅依赖wal文件,而在vnode迁移和分裂的过程中,wal并不会同步过去,所以迁移或分裂后,之前没消费完的wal数据后消费不到。所以请保证迁移和分裂之前把数据全部消费完后,再进行vnode迁移或分裂,否则,消费会丢失数据。 -不同语言下, TMQ 订阅相关的 API 及数据结构如下(注意consumer结构不是线程安全的,在一个线程使用consumer时,不要在另一个线程close这个consumer): +# 语法说明 - - +具体的语法参见 [数据订阅](../../12-taos-sql/13-tmq) -```c - typedef struct tmq_t tmq_t; - typedef struct tmq_conf_t tmq_conf_t; - typedef struct tmq_list_t tmq_list_t; +# 消费参数 - typedef void(tmq_commit_cb(tmq_t *tmq, int32_t code, void *param)); - - typedef enum tmq_conf_res_t { - TMQ_CONF_UNKNOWN = -2, - TMQ_CONF_INVALID = -1, - TMQ_CONF_OK = 0, - } tmq_conf_res_t; - - typedef struct tmq_topic_assignment { - int32_t vgId; - int64_t currentOffset; - int64_t begin; - int64_t end; - } tmq_topic_assignment; - - DLL_EXPORT tmq_conf_t *tmq_conf_new(); - DLL_EXPORT tmq_conf_res_t tmq_conf_set(tmq_conf_t *conf, const char *key, const char *value); - DLL_EXPORT void tmq_conf_destroy(tmq_conf_t *conf); - DLL_EXPORT void tmq_conf_set_auto_commit_cb(tmq_conf_t *conf, tmq_commit_cb *cb, void *param); - - DLL_EXPORT tmq_list_t *tmq_list_new(); - DLL_EXPORT int32_t tmq_list_append(tmq_list_t *, const char *); - DLL_EXPORT void tmq_list_destroy(tmq_list_t *); - DLL_EXPORT int32_t tmq_list_get_size(const tmq_list_t *); - DLL_EXPORT char **tmq_list_to_c_array(const tmq_list_t *); - - DLL_EXPORT tmq_t *tmq_consumer_new(tmq_conf_t *conf, char *errstr, int32_t errstrLen); - DLL_EXPORT int32_t tmq_subscribe(tmq_t *tmq, const tmq_list_t *topic_list); - DLL_EXPORT int32_t tmq_unsubscribe(tmq_t *tmq); - DLL_EXPORT int32_t tmq_subscription(tmq_t *tmq, tmq_list_t **topics); - DLL_EXPORT TAOS_RES *tmq_consumer_poll(tmq_t *tmq, int64_t timeout); - DLL_EXPORT int32_t tmq_consumer_close(tmq_t *tmq); - DLL_EXPORT int32_t tmq_commit_sync(tmq_t *tmq, const TAOS_RES *msg); - DLL_EXPORT void tmq_commit_async(tmq_t *tmq, const TAOS_RES *msg, tmq_commit_cb *cb, void *param); - DLL_EXPORT int32_t tmq_commit_offset_sync(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset); - DLL_EXPORT void tmq_commit_offset_async(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset, tmq_commit_cb *cb, void *param); - DLL_EXPORT int32_t tmq_get_topic_assignment(tmq_t *tmq, const char *pTopicName, tmq_topic_assignment **assignment,int32_t *numOfAssignment); - DLL_EXPORT void tmq_free_assignment(tmq_topic_assignment* pAssignment); - DLL_EXPORT int32_t tmq_offset_seek(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset); - DLL_EXPORT int64_t tmq_position(tmq_t *tmq, const char *pTopicName, int32_t vgId); - DLL_EXPORT int64_t tmq_committed(tmq_t *tmq, const char *pTopicName, int32_t vgId); - - DLL_EXPORT const char *tmq_get_topic_name(TAOS_RES *res); - DLL_EXPORT const char *tmq_get_db_name(TAOS_RES *res); - DLL_EXPORT int32_t tmq_get_vgroup_id(TAOS_RES *res); - DLL_EXPORT int64_t tmq_get_vgroup_offset(TAOS_RES* res); - DLL_EXPORT const char *tmq_err2str(int32_t code); -``` - -下面介绍一下它们的具体用法(超级表和子表结构请参考“数据建模”一节),完整的示例代码请见下面 C 语言的示例代码。 - - - - -```java -void subscribe(Collection topics) throws SQLException; - -void unsubscribe() throws SQLException; - -Set subscription() throws SQLException; - -ConsumerRecords poll(Duration timeout) throws SQLException; - -Set assignment() throws SQLException; -long position(TopicPartition partition) throws SQLException; -Map position(String topic) throws SQLException; -Map beginningOffsets(String topic) throws SQLException; -Map endOffsets(String topic) throws SQLException; -Map committed(Set partitions) throws SQLException; - -void seek(TopicPartition partition, long offset) throws SQLException; -void seekToBeginning(Collection partitions) throws SQLException; -void seekToEnd(Collection partitions) throws SQLException; - -void commitSync() throws SQLException; -void commitSync(Map offsets) throws SQLException; - -void close() throws SQLException; -``` - - - - - -```python -class Consumer: - def subscribe(self, topics): - pass - - def unsubscribe(self): - pass - - def poll(self, timeout: float = 1.0): - pass - - def assignment(self): - pass - - def seek(self, partition): - pass - - def close(self): - pass - - def commit(self, message): - pass -``` - - - - - -```go -func NewConsumer(conf *tmq.ConfigMap) (*Consumer, error) - -// 出于兼容目的保留 rebalanceCb 参数,当前未使用 -func (c *Consumer) Subscribe(topic string, rebalanceCb RebalanceCb) error - -// 出于兼容目的保留 rebalanceCb 参数,当前未使用 -func (c *Consumer) SubscribeTopics(topics []string, rebalanceCb RebalanceCb) error - -func (c *Consumer) Poll(timeoutMs int) tmq.Event - -// 出于兼容目的保留 tmq.TopicPartition 参数,当前未使用 -func (c *Consumer) Commit() ([]tmq.TopicPartition, error) - -func (c *Consumer) Unsubscribe() error - -func (c *Consumer) Close() error -``` - - - - - -```rust -impl TBuilder for TmqBuilder - fn from_dsn(dsn: D) -> Result - fn build(&self) -> Result - -impl AsAsyncConsumer for Consumer - async fn subscribe, I: IntoIterator + Send>( - &mut self, - topics: I, - ) -> Result<(), Self::Error>; - fn stream( - &self, - ) -> Pin< - Box< - dyn '_ - + Send - + futures::Stream< - Item = Result<(Self::Offset, MessageSet), Self::Error>, - >, - >, - >; - async fn commit(&self, offset: Self::Offset) -> Result<(), Self::Error>; - - async fn unsubscribe(self); -``` - -可在 上查看详细 API 说明。 - - - - - -```js -function TMQConsumer(config) - -function subscribe(topic) - -function consume(timeout) - -function subscription() - -function unsubscribe() - -function commit(msg) - -function close() -``` - - - - - -```csharp -class ConsumerBuilder - -ConsumerBuilder(IEnumerable> config) - -public IConsumer Build() - -void Subscribe(IEnumerable topics) - -void Subscribe(string topic) - -ConsumeResult Consume(int millisecondsTimeout) - -List Subscription() - -void Unsubscribe() - -List Commit() - -void Close() -``` - - - - -## 写入数据 - -首先完成建库、建一张超级表和多张子表操作,然后就可以写入数据了,比如: - -```sql -DROP DATABASE IF EXISTS tmqdb; -CREATE DATABASE tmqdb WAL_RETENTION_PERIOD 3600; -CREATE TABLE tmqdb.stb (ts TIMESTAMP, c1 INT, c2 FLOAT, c3 VARCHAR(16)) TAGS(t1 INT, t3 VARCHAR(16)); -CREATE TABLE tmqdb.ctb0 USING tmqdb.stb TAGS(0, "subtable0"); -CREATE TABLE tmqdb.ctb1 USING tmqdb.stb TAGS(1, "subtable1"); -INSERT INTO tmqdb.ctb0 VALUES(now, 0, 0, 'a0')(now+1s, 0, 0, 'a00'); -INSERT INTO tmqdb.ctb1 VALUES(now, 1, 1, 'a1')(now+1s, 11, 11, 'a11'); -``` - -## 创建 *topic* - -TDengine 使用 SQL 创建一个 topic: - -```sql -CREATE TOPIC topic_name AS SELECT ts, c1, c2, c3 FROM tmqdb.stb WHERE c1 > 1; -``` -- topic创建个数有上限,通过参数 tmqMaxTopicNum 控制,默认 20 个 - -TMQ 支持多种订阅类型: - -### 列订阅 - -语法: - -```sql -CREATE TOPIC topic_name as subquery -``` - -通过 `SELECT` 语句订阅(包括 `SELECT *`,或 `SELECT ts, c1` 等指定列订阅,可以带条件过滤、标量函数计算,但不支持聚合函数、不支持时间窗口聚合)。需要注意的是: - -- 该类型 TOPIC 一旦创建则订阅数据的结构确定。 -- 被订阅或用于计算的列或标签不可被删除(`ALTER table DROP`)、修改(`ALTER table MODIFY`)。 -- 若发生表结构变更,新增的列不出现在结果中。 - -### 超级表订阅 - -语法: - -```sql -CREATE TOPIC topic_name [with meta] AS STABLE stb_name [where_condition] -``` - -与 `SELECT * from stbName` 订阅的区别是: - -- 不会限制用户的表结构变更。 -- 返回的是非结构化的数据:返回数据的结构会随之超级表的表结构变化而变化。 -- with meta 参数可选,选择时将返回创建超级表,子表等语句,主要用于taosx做超级表迁移 -- where_condition 参数可选,选择时将用来过滤符合条件的子表,订阅这些子表。where 条件里不能有普通列,只能是tag或tbname,where条件里可以用函数,用来过滤tag,但是不能是聚合函数,因为子表tag值无法做聚合。也可以是常量表达式,比如 2 > 1(订阅全部子表),或者 false(订阅0个子表) -- 返回数据不包含标签。 - -### 数据库订阅 - -语法: - -```sql -CREATE TOPIC topic_name [with meta] AS DATABASE db_name; -``` - -通过该语句可创建一个包含数据库所有表数据的订阅 - -- with meta 参数可选,选择时将返回创建数据库里所有超级表,子表的语句,主要用于taosx做数据库迁移 - -## 创建消费者 *consumer* - -消费者需要通过一系列配置选项创建,基础配置项如下表所示: +消费参数主要用于消费者创建时指定,基础配置项如下表所示: | 参数名称 | 类型 | 参数说明 | 备注 | | :----------------------------: | :-----: | -------------------------------------------------------- | ------------------------------------------- | @@ -358,515 +86,714 @@ CREATE TOPIC topic_name [with meta] AS DATABASE db_name; | `msg.with.table.name` | boolean | 是否允许从消息中解析表名, 不适用于列订阅(列订阅时可将 tbname 作为列写入 subquery 语句)(从3.2.0.0版本该参数废弃,恒为true) |默认关闭 | | `enable.replay` | boolean | 是否开启数据回放功能 |默认关闭 | -对于不同编程语言,其设置方式如下: +# 主要数据结构和 API 接口 + +不同语言下, TMQ 订阅相关的 API 及数据结构如下(详细的接口说明可以参考连接器章节,注意consumer结构不是线程安全的,在一个线程使用consumer时,不要在另一个线程close这个consumer): - + -```c -/* 根据需要,设置消费组 (group.id)、自动提交 (enable.auto.commit)、 - 自动提交时间间隔 (auto.commit.interval.ms)、用户名 (td.connect.user)、密码 (td.connect.pass) 等参数 */ -tmq_conf_t* conf = tmq_conf_new(); -tmq_conf_set(conf, "enable.auto.commit", "true"); -tmq_conf_set(conf, "auto.commit.interval.ms", "1000"); -tmq_conf_set(conf, "group.id", "cgrpName"); -tmq_conf_set(conf, "td.connect.user", "root"); -tmq_conf_set(conf, "td.connect.pass", "taosdata"); -tmq_conf_set(conf, "auto.offset.reset", "latest"); -tmq_conf_set(conf, "msg.with.table.name", "true"); -tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL); + ```c + typedef struct tmq_t tmq_t; + typedef struct tmq_conf_t tmq_conf_t; + typedef struct tmq_list_t tmq_list_t; -tmq_t* tmq = tmq_consumer_new(conf, NULL, 0); -tmq_conf_destroy(conf); + typedef void(tmq_commit_cb(tmq_t *tmq, int32_t code, void *param)); + + typedef enum tmq_conf_res_t { + TMQ_CONF_UNKNOWN = -2, + TMQ_CONF_INVALID = -1, + TMQ_CONF_OK = 0, + } tmq_conf_res_t; + + typedef struct tmq_topic_assignment { + int32_t vgId; + int64_t currentOffset; + int64_t begin; + int64_t end; + } tmq_topic_assignment; + + DLL_EXPORT tmq_conf_t *tmq_conf_new(); + DLL_EXPORT tmq_conf_res_t tmq_conf_set(tmq_conf_t *conf, const char *key, const char *value); + DLL_EXPORT void tmq_conf_destroy(tmq_conf_t *conf); + DLL_EXPORT void tmq_conf_set_auto_commit_cb(tmq_conf_t *conf, tmq_commit_cb *cb, void *param); + + DLL_EXPORT tmq_list_t *tmq_list_new(); + DLL_EXPORT int32_t tmq_list_append(tmq_list_t *, const char *); + DLL_EXPORT void tmq_list_destroy(tmq_list_t *); + DLL_EXPORT int32_t tmq_list_get_size(const tmq_list_t *); + DLL_EXPORT char **tmq_list_to_c_array(const tmq_list_t *); + + DLL_EXPORT tmq_t *tmq_consumer_new(tmq_conf_t *conf, char *errstr, int32_t errstrLen); + DLL_EXPORT int32_t tmq_subscribe(tmq_t *tmq, const tmq_list_t *topic_list); + DLL_EXPORT int32_t tmq_unsubscribe(tmq_t *tmq); + DLL_EXPORT int32_t tmq_subscription(tmq_t *tmq, tmq_list_t **topics); + DLL_EXPORT TAOS_RES *tmq_consumer_poll(tmq_t *tmq, int64_t timeout); + DLL_EXPORT int32_t tmq_consumer_close(tmq_t *tmq); + DLL_EXPORT int32_t tmq_commit_sync(tmq_t *tmq, const TAOS_RES *msg); + DLL_EXPORT void tmq_commit_async(tmq_t *tmq, const TAOS_RES *msg, tmq_commit_cb *cb, void *param); + DLL_EXPORT int32_t tmq_commit_offset_sync(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset); + DLL_EXPORT void tmq_commit_offset_async(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset, tmq_commit_cb *cb, void *param); + DLL_EXPORT int32_t tmq_get_topic_assignment(tmq_t *tmq, const char *pTopicName, tmq_topic_assignment **assignment,int32_t *numOfAssignment); + DLL_EXPORT void tmq_free_assignment(tmq_topic_assignment* pAssignment); + DLL_EXPORT int32_t tmq_offset_seek(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset); + DLL_EXPORT int64_t tmq_position(tmq_t *tmq, const char *pTopicName, int32_t vgId); + DLL_EXPORT int64_t tmq_committed(tmq_t *tmq, const char *pTopicName, int32_t vgId); + + DLL_EXPORT const char *tmq_get_topic_name(TAOS_RES *res); + DLL_EXPORT const char *tmq_get_db_name(TAOS_RES *res); + DLL_EXPORT int32_t tmq_get_vgroup_id(TAOS_RES *res); + DLL_EXPORT int64_t tmq_get_vgroup_offset(TAOS_RES* res); + DLL_EXPORT const char *tmq_err2str(int32_t code); + ``` + + + + + ```java + void subscribe(Collection topics) throws SQLException; + + void unsubscribe() throws SQLException; + + Set subscription() throws SQLException; + + ConsumerRecords poll(Duration timeout) throws SQLException; + + Set assignment() throws SQLException; + long position(TopicPartition partition) throws SQLException; + Map position(String topic) throws SQLException; + Map beginningOffsets(String topic) throws SQLException; + Map endOffsets(String topic) throws SQLException; + Map committed(Set partitions) throws SQLException; + + void seek(TopicPartition partition, long offset) throws SQLException; + void seekToBeginning(Collection partitions) throws SQLException; + void seekToEnd(Collection partitions) throws SQLException; + + void commitSync() throws SQLException; + void commitSync(Map offsets) throws SQLException; + + void close() throws SQLException; + ``` + + + + + + ```python + class Consumer: + def subscribe(self, topics): + pass + + def unsubscribe(self): + pass + + def poll(self, timeout: float = 1.0): + pass + + def assignment(self): + pass + + def seek(self, partition): + pass + + def close(self): + pass + + def commit(self, message): + pass + ``` + + + + + + ```go + func NewConsumer(conf *tmq.ConfigMap) (*Consumer, error) + + // 出于兼容目的保留 rebalanceCb 参数,当前未使用 + func (c *Consumer) Subscribe(topic string, rebalanceCb RebalanceCb) error + + // 出于兼容目的保留 rebalanceCb 参数,当前未使用 + func (c *Consumer) SubscribeTopics(topics []string, rebalanceCb RebalanceCb) error + + func (c *Consumer) Poll(timeoutMs int) tmq.Event + + // 出于兼容目的保留 tmq.TopicPartition 参数,当前未使用 + func (c *Consumer) Commit() ([]tmq.TopicPartition, error) + + func (c *Consumer) Unsubscribe() error + + func (c *Consumer) Close() error + ``` + + + + + + ```rust + impl TBuilder for TmqBuilder + fn from_dsn(dsn: D) -> Result + fn build(&self) -> Result + + impl AsAsyncConsumer for Consumer + async fn subscribe, I: IntoIterator + Send>( + &mut self, + topics: I, + ) -> Result<(), Self::Error>; + fn stream( + &self, + ) -> Pin< + Box< + dyn '_ + + Send + + futures::Stream< + Item = Result<(Self::Offset, MessageSet), Self::Error>, + >, + >, + >; + async fn commit(&self, offset: Self::Offset) -> Result<(), Self::Error>; + + async fn unsubscribe(self); + ``` + + 可在 上查看详细 API 说明。 + + + + + + ```js + function TMQConsumer(config) + + function subscribe(topic) + + function consume(timeout) + + function subscription() + + function unsubscribe() + + function commit(msg) + + function close() + ``` + + + + + + ```csharp + class ConsumerBuilder + + ConsumerBuilder(IEnumerable> config) + + public IConsumer Build() + + void Subscribe(IEnumerable topics) + + void Subscribe(string topic) + + ConsumeResult Consume(int millisecondsTimeout) + + List Subscription() + + void Unsubscribe() + + List Commit() + + void Close() + ``` + + + + + # 数据订阅示例 + ## 写入数据 + + 首先完成建库、建一张超级表和多张子表操作,然后就可以写入数据了,比如: + + ```sql + DROP DATABASE IF EXISTS tmqdb; + CREATE DATABASE tmqdb WAL_RETENTION_PERIOD 3600; + CREATE TABLE tmqdb.stb (ts TIMESTAMP, c1 INT, c2 FLOAT, c3 VARCHAR(16)) TAGS(t1 INT, t3 VARCHAR(16)); + CREATE TABLE tmqdb.ctb0 USING tmqdb.stb TAGS(0, "subtable0"); + CREATE TABLE tmqdb.ctb1 USING tmqdb.stb TAGS(1, "subtable1"); + INSERT INTO tmqdb.ctb0 VALUES(now, 0, 0, 'a0')(now+1s, 0, 0, 'a00'); +INSERT INTO tmqdb.ctb1 VALUES(now, 1, 1, 'a1')(now+1s, 11, 11, 'a11'); ``` +## 创建 topic - - + 使用 SQL 创建一个 topic: -对于 Java 程序,还可以使用如下配置项: + ```sql + CREATE TOPIC topic_name AS SELECT ts, c1, c2, c3 FROM tmqdb.stb WHERE c1 > 1; + ``` -| 参数名称 | 类型 | 参数说明 | -| ----------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------- | -| `td.connect.type` | string | 连接类型,"jni" 指原生连接,"ws" 指 websocket 连接,默认值为 "jni" | -| `bootstrap.servers` | string | 连接地址,如 `localhost:6030` | -| `value.deserializer` | string | 值解析方法,使用此方法应实现 `com.taosdata.jdbc.tmq.Deserializer` 接口或继承 `com.taosdata.jdbc.tmq.ReferenceDeserializer` 类 | -| `value.deserializer.encoding` | string | 指定字符串解析的字符集 | | + ## 创建消费者 *consumer* -需要注意:此处使用 `bootstrap.servers` 替代 `td.connect.ip` 和 `td.connect.port`,以提供与 Kafka 一致的接口。 + 对于不同编程语言,其设置方式如下: -```java -Properties properties = new Properties(); -properties.setProperty("enable.auto.commit", "true"); -properties.setProperty("auto.commit.interval.ms", "1000"); -properties.setProperty("group.id", "cgrpName"); -properties.setProperty("bootstrap.servers", "127.0.0.1:6030"); -properties.setProperty("td.connect.user", "root"); -properties.setProperty("td.connect.pass", "taosdata"); -properties.setProperty("auto.offset.reset", "latest"); -properties.setProperty("msg.with.table.name", "true"); -properties.setProperty("value.deserializer", "com.taos.example.MetersDeserializer"); + + -TaosConsumer consumer = new TaosConsumer<>(properties); + ```c + /* 根据需要,设置消费组 (group.id)、自动提交 (enable.auto.commit)、 + 自动提交时间间隔 (auto.commit.interval.ms)、用户名 (td.connect.user)、密码 (td.connect.pass) 等参数 */ + tmq_conf_t* conf = tmq_conf_new(); + tmq_conf_set(conf, "enable.auto.commit", "true"); + tmq_conf_set(conf, "auto.commit.interval.ms", "1000"); + tmq_conf_set(conf, "group.id", "cgrpName"); + tmq_conf_set(conf, "td.connect.user", "root"); + tmq_conf_set(conf, "td.connect.pass", "taosdata"); + tmq_conf_set(conf, "auto.offset.reset", "latest"); + tmq_conf_set(conf, "msg.with.table.name", "true"); + tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL); -/* value deserializer definition. */ -import com.taosdata.jdbc.tmq.ReferenceDeserializer; + tmq_t* tmq = tmq_consumer_new(conf, NULL, 0); + tmq_conf_destroy(conf); + ``` -public class MetersDeserializer extends ReferenceDeserializer { -} -``` + + - + 对于 Java 程序,还可以使用如下配置项: - + | 参数名称 | 类型 | 参数说明 | + | ----------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------- | + | `td.connect.type` | string | 连接类型,"jni" 指原生连接,"ws" 指 websocket 连接,默认值为 "jni" | + | `bootstrap.servers` | string | 连接地址,如 `localhost:6030` | + | `value.deserializer` | string | 值解析方法,使用此方法应实现 `com.taosdata.jdbc.tmq.Deserializer` 接口或继承 `com.taosdata.jdbc.tmq.ReferenceDeserializer` 类 | + | `value.deserializer.encoding` | string | 指定字符串解析的字符集 | | -```go -conf := &tmq.ConfigMap{ - "group.id": "test", - "auto.offset.reset": "latest", - "td.connect.ip": "127.0.0.1", - "td.connect.user": "root", - "td.connect.pass": "taosdata", - "td.connect.port": "6030", - "client.id": "test_tmq_c", - "enable.auto.commit": "false", - "msg.with.table.name": "true", -} -consumer, err := NewConsumer(conf) -``` + 需要注意:此处使用 `bootstrap.servers` 替代 `td.connect.ip` 和 `td.connect.port`,以提供与 Kafka 一致的接口。 - + ```java + Properties properties = new Properties(); + properties.setProperty("enable.auto.commit", "true"); + properties.setProperty("auto.commit.interval.ms", "1000"); + properties.setProperty("group.id", "cgrpName"); + properties.setProperty("bootstrap.servers", "127.0.0.1:6030"); + properties.setProperty("td.connect.user", "root"); + properties.setProperty("td.connect.pass", "taosdata"); + properties.setProperty("auto.offset.reset", "latest"); + properties.setProperty("msg.with.table.name", "true"); + properties.setProperty("value.deserializer", "com.taos.example.MetersDeserializer"); - + TaosConsumer consumer = new TaosConsumer<>(properties); -```rust -let mut dsn: Dsn = "taos://".parse()?; -dsn.set("group.id", "group1"); -dsn.set("client.id", "test"); -dsn.set("auto.offset.reset", "latest"); + /* value deserializer definition. */ + import com.taosdata.jdbc.tmq.ReferenceDeserializer; -let tmq = TmqBuilder::from_dsn(dsn)?; + public class MetersDeserializer extends ReferenceDeserializer { + } + ``` -let mut consumer = tmq.build()?; -``` + - + - + ```go + conf := &tmq.ConfigMap{ + "group.id": "test", + "auto.offset.reset": "latest", + "td.connect.ip": "127.0.0.1", + "td.connect.user": "root", + "td.connect.pass": "taosdata", + "td.connect.port": "6030", + "client.id": "test_tmq_c", + "enable.auto.commit": "false", + "msg.with.table.name": "true", + } + consumer, err := NewConsumer(conf) + ``` -Python 语言下引入 `taos` 库的 `Consumer` 类,创建一个 Consumer 示例: + -```python -from taos.tmq import Consumer + -# Syntax: `consumer = Consumer(configs)` -# -# Example: -consumer = Consumer( - { - "group.id": "local", - "client.id": "1", - "enable.auto.commit": "true", - "auto.commit.interval.ms": "1000", - "td.connect.ip": "127.0.0.1", - "td.connect.user": "root", - "td.connect.pass": "taosdata", - "auto.offset.reset": "latest", - "msg.with.table.name": "true", - } -) -``` + ```rust + let mut dsn: Dsn = "taos://".parse()?; + dsn.set("group.id", "group1"); + dsn.set("client.id", "test"); + dsn.set("auto.offset.reset", "latest"); - + let tmq = TmqBuilder::from_dsn(dsn)?; - + let mut consumer = tmq.build()?; + ``` -```js -// 根据需要,设置消费组 (group.id)、自动提交 (enable.auto.commit)、 -// 自动提交时间间隔 (auto.commit.interval.ms)、用户名 (td.connect.user)、密码 (td.connect.pass) 等参数 + -let consumer = taos.consumer({ - 'enable.auto.commit': 'true', + + + Python 语言下引入 `taos` 库的 `Consumer` 类,创建一个 Consumer 示例: + + ```python + from taos.tmq import Consumer + + # Syntax: `consumer = Consumer(configs)` + # + # Example: + consumer = Consumer( + { + "group.id": "local", + "client.id": "1", + "enable.auto.commit": "true", + "auto.commit.interval.ms": "1000", + "td.connect.ip": "127.0.0.1", + "td.connect.user": "root", + "td.connect.pass": "taosdata", + "auto.offset.reset": "latest", + "msg.with.table.name": "true", + } + ) + ``` + + + + + + ```js + // 根据需要,设置消费组 (group.id)、自动提交 (enable.auto.commit)、 + // 自动提交时间间隔 (auto.commit.interval.ms)、用户名 (td.connect.user)、密码 (td.connect.pass) 等参数 + + let consumer = taos.consumer({ +'enable.auto.commit': 'true', 'auto.commit.interval.ms','1000', - 'group.id': 'tg2', + 'group.id': 'tg2', 'td.connect.user': 'root', 'td.connect.pass': 'taosdata', 'auto.offset.reset','latest', 'msg.with.table.name': 'true', 'td.connect.ip','127.0.0.1', - 'td.connect.port','6030' - }); -``` + 'td.connect.port','6030' + }); + ``` -```csharp -var cfg = new Dictionary() -{ - { "group.id", "group1" }, - { "auto.offset.reset", "latest" }, - { "td.connect.ip", "127.0.0.1" }, - { "td.connect.user", "root" }, - { "td.connect.pass", "taosdata" }, - { "td.connect.port", "6030" }, - { "client.id", "tmq_example" }, - { "enable.auto.commit", "true" }, - { "msg.with.table.name", "false" }, -}; -var consumer = new ConsumerBuilder>(cfg).Build(); -``` + ```csharp + var cfg = new Dictionary() + { + { "group.id", "group1" }, + { "auto.offset.reset", "latest" }, + { "td.connect.ip", "127.0.0.1" }, + { "td.connect.user", "root" }, + { "td.connect.pass", "taosdata" }, + { "td.connect.port", "6030" }, + { "client.id", "tmq_example" }, + { "enable.auto.commit", "true" }, + { "msg.with.table.name", "false" }, + }; + var consumer = new ConsumerBuilder>(cfg).Build(); + ``` - + - + -上述配置中包括 consumer group ID,如果多个 consumer 指定的 consumer group ID 一样,则自动形成一个 consumer group,共享消费进度。 + 上述配置中包括 consumer group ID,如果多个 consumer 指定的 consumer group ID 一样,则自动形成一个 consumer group,共享消费进度。 -数据回放功能说明: -- 订阅增加 replay 功能,按照数据写入的时间回放。 - 比如,如下时间写入三条数据 - ```sql - 2023/09/22 00:00:00.000 - 2023/09/22 00:00:05.000 - 2023/09/22 00:00:08.000 - ``` - 则订阅出第一条数据 5s 后返回第二条数据,获取第二条数据 3s 后返回第三条数据。 -- 仅列订阅支持数据回放 - - 回放需要保证独立时间线 - - 如果是子表订阅或者普通表订阅,只有一个vnode上有数据,保证是一个时间线 - - 如果超级表订阅,则需保证该 DB 只有一个vnode,否则报错(因为多个vnode上订阅出的数据不在一个时间线上) -- 超级表和库订阅不支持回放 -- 增加 enable.replay 参数,true表示开启订阅回放功能,false表示不开启订阅回放功能,默认不开启。 -- 回放不支持进度保存,所以回放参数 enable.replay = true 时,auto commit 自动关闭 -- 因为数据回放本身需要处理时间,所以回放的精度存在几十ms的误差 + ## 订阅 *topics* -## 订阅 *topics* + 一个 consumer 支持同时订阅多个 topic。 -一个 consumer 支持同时订阅多个 topic。 - - - + + ```c -// 创建订阅 topics 列表 -tmq_list_t* topicList = tmq_list_new(); -tmq_list_append(topicList, "topicName"); -// 启动订阅 -tmq_subscribe(tmq, topicList); -tmq_list_destroy(topicList); - -``` + // 创建订阅 topics 列表 + tmq_list_t* topicList = tmq_list_new(); + tmq_list_append(topicList, "topicName"); + // 启动订阅 + tmq_subscribe(tmq, topicList); + tmq_list_destroy(topicList); + + ``` -```java -List topics = new ArrayList<>(); -topics.add("tmq_topic"); -consumer.subscribe(topics); -``` + ```java + List topics = new ArrayList<>(); + topics.add("tmq_topic"); + consumer.subscribe(topics); + ``` -```go -err = consumer.Subscribe("example_tmq_topic", nil) -if err != nil { - panic(err) -} -``` + ```go + err = consumer.Subscribe("example_tmq_topic", nil) + if err != nil { + panic(err) + } + ``` - - + + ```rust -consumer.subscribe(["tmq_meters"]).await?; -``` + consumer.subscribe(["tmq_meters"]).await?; + ``` - + - + ```python -consumer.subscribe(['topic1', 'topic2']) -``` + consumer.subscribe(['topic1', 'topic2']) + ``` - + - + ```js -// 创建订阅 topics 列表 -let topics = ['topic_test'] + // 创建订阅 topics 列表 + let topics = ['topic_test'] -// 启动订阅 -consumer.subscribe(topics); -``` + // 启动订阅 + consumer.subscribe(topics); + ``` - + - + ```csharp -// 创建订阅 topics 列表 -List topics = new List(); -topics.add("tmq_topic"); -// 启动订阅 -consumer.Subscribe(topics); -``` + // 创建订阅 topics 列表 + List topics = new List(); + topics.add("tmq_topic"); + // 启动订阅 + consumer.Subscribe(topics); + ``` - + - + -## 消费 + ## 消费 -以下代码展示了不同语言下如何对 TMQ 消息进行消费。 + 以下代码展示了不同语言下如何对 TMQ 消息进行消费。 - - + + ```c -// 消费数据 -while (running) { - TAOS_RES* msg = tmq_consumer_poll(tmq, timeOut); - msg_process(msg); -} -``` + // 消费数据 + while (running) { + TAOS_RES* msg = tmq_consumer_poll(tmq, timeOut); + msg_process(msg); + } + ``` 这里是一个 **while** 循环,每调用一次 tmq_consumer_poll(),获取一个消息,该消息与普通查询返回的结果集完全相同,可以使用相同的解析 API 完成消息内容的解析。 -```java -while(running){ - ConsumerRecords meters = consumer.poll(Duration.ofMillis(100)); - for (Meters meter : meters) { - processMsg(meter); - } -} -``` + ```java + while(running){ + ConsumerRecords meters = consumer.poll(Duration.ofMillis(100)); + for (Meters meter : meters) { + processMsg(meter); + } + } + ``` -```go -for { - ev := consumer.Poll(0) - if ev != nil { - switch e := ev.(type) { - case *tmqcommon.DataMessage: - fmt.Println(e.Value()) - case tmqcommon.Error: - fmt.Fprintf(os.Stderr, "%% Error: %v: %v\n", e.Code(), e) - panic(e) - } - consumer.Commit() - } -} -``` + ```go + for { + ev := consumer.Poll(0) + if ev != nil { + switch e := ev.(type) { + case *tmqcommon.DataMessage: + fmt.Println(e.Value()) + case tmqcommon.Error: + fmt.Fprintf(os.Stderr, "%% Error: %v: %v\n", e.Code(), e) + panic(e) + } + consumer.Commit() + } + } + ``` -```rust -{ - let mut stream = consumer.stream(); + ```rust + { + let mut stream = consumer.stream(); - while let Some((offset, message)) = stream.try_next().await? { - // get information from offset + while let Some((offset, message)) = stream.try_next().await? { + // get information from offset - // the topic - let topic = offset.topic(); - // the vgroup id, like partition id in kafka. - let vgroup_id = offset.vgroup_id(); - println!("* in vgroup id {vgroup_id} of topic {topic}\n"); + // the topic + let topic = offset.topic(); + // the vgroup id, like partition id in kafka. + let vgroup_id = offset.vgroup_id(); + println!("* in vgroup id {vgroup_id} of topic {topic}\n"); - if let Some(data) = message.into_data() { + if let Some(data) = message.into_data() { while let Some(block) = data.fetch_raw_block().await? { - // one block for one table, get table name if needed - let name = block.table_name(); - let records: Vec = block.deserialize().try_collect()?; - println!( - "** table: {}, got {} records: {:#?}\n", - name.unwrap(), - records.len(), - records - ); - } + // one block for one table, get table name if needed + let name = block.table_name(); + let records: Vec = block.deserialize().try_collect()?; + println!( + "** table: {}, got {} records: {:#?}\n", + name.unwrap(), + records.len(), + records + ); } - consumer.commit(offset).await?; - } -} -``` + } + consumer.commit(offset).await?; + } + } + ``` -```python -while True: - res = consumer.poll(100) - if not res: + ```python + while True: + res = consumer.poll(100) + if not res: continue - err = res.error() - if err is not None: + err = res.error() + if err is not None: raise err - val = res.value() + val = res.value() - for block in val: + for block in val: print(block.fetchall()) -``` + ``` -```js -while(true){ - msg = consumer.consume(200); - // process message(consumeResult) - console.log(msg.topicPartition); - console.log(msg.block); - console.log(msg.fields) -} -``` + ```js + while(true){ + msg = consumer.consume(200); + // process message(consumeResult) + console.log(msg.topicPartition); + console.log(msg.block); + console.log(msg.fields) + } + ``` - + - + ```csharp -// 消费数据 -while (true) -{ - using (var result = consumer.Consume(500)) - { - if (result == null) continue; - ProcessMsg(result); - consumer.Commit(); - } -} -``` + // 消费数据 + while (true) + { + using (var result = consumer.Consume(500)) + { + if (result == null) continue; + ProcessMsg(result); + consumer.Commit(); + } + } + ``` - + - + -## 结束消费 + ## 结束消费 -消费结束后,应当取消订阅。 + 消费结束后,应当取消订阅。 - - + + ```c -/* 取消订阅 */ -tmq_unsubscribe(tmq); + /* 取消订阅 */ + tmq_unsubscribe(tmq); -/* 关闭消费者对象 */ -tmq_consumer_close(tmq); -``` + /* 关闭消费者对象 */ + tmq_consumer_close(tmq); + ``` - - + + ```java -/* 取消订阅 */ -consumer.unsubscribe(); + /* 取消订阅 */ + consumer.unsubscribe(); -/* 关闭消费 */ -consumer.close(); -``` + /* 关闭消费 */ + consumer.close(); + ``` - + - + ```go -/* Unsubscribe */ -_ = consumer.Unsubscribe() + /* Unsubscribe */ + _ = consumer.Unsubscribe() -/* Close consumer */ -_ = consumer.Close() -``` + /* Close consumer */ + _ = consumer.Close() + ``` - + - + ```rust -consumer.unsubscribe().await; -``` + consumer.unsubscribe().await; + ``` - + - + ```py -# 取消订阅 -consumer.unsubscribe() -# 关闭消费 -consumer.close() -``` + # 取消订阅 + consumer.unsubscribe() + # 关闭消费 + consumer.close() + ``` - - + + ```js -consumer.unsubscribe(); -consumer.close(); -``` + consumer.unsubscribe(); + consumer.close(); + ``` - + - + ```csharp -// 取消订阅 -consumer.Unsubscribe(); + // 取消订阅 + consumer.Unsubscribe(); -// 关闭消费 -consumer.Close(); -``` + // 关闭消费 + consumer.Close(); + ``` -## 删除 *topic* - -如果不再需要订阅数据,可以删除 topic,需要注意:只有当前未在订阅中的 TOPIC 才能被删除。 - -```sql -/* 删除 topic */ -DROP TOPIC topic_name; -``` - -## 状态查看 - -1、*topics*:查询已经创建的 topic - -```sql -SHOW TOPICS; -``` - -2、consumers:查询 consumer 的状态及其订阅的 topic - -```sql -SHOW CONSUMERS; -``` - -3、subscriptions:查询 consumer 与 vgroup 之间的分配关系 - -```sql -SHOW SUBSCRIPTIONS; -``` - -## 示例代码 +## 完整示例代码 以下是各语言的完整示例代码。 @@ -908,3 +835,22 @@ SHOW SUBSCRIPTIONS; + +#订阅高级功能 +##数据回放 +- 订阅支持 replay 功能,按照数据写入的时间回放。 + 比如,如下时间写入三条数据 + ```sql + 2023/09/22 00:00:00.000 + 2023/09/22 00:00:05.000 + 2023/09/22 00:00:08.000 + ``` + 则订阅出第一条数据 5s 后返回第二条数据,获取第二条数据 3s 后返回第三条数据。 +- 仅查询订阅支持数据回放 + - 回放需要保证独立时间线 + - 如果是子表订阅或者普通表订阅,只有一个vnode上有数据,保证是一个时间线 + - 如果超级表订阅,则需保证该 DB 只有一个vnode,否则报错(因为多个vnode上订阅出的数据不在一个时间线上) +- 超级表和库订阅不支持回放 +- enable.replay 参数,true表示开启订阅回放功能,false表示不开启订阅回放功能,默认不开启。 +- 回放不支持进度保存,所以回放参数 enable.replay = true 时,auto commit 自动关闭 +- 因为数据回放本身需要处理时间,所以回放的精度存在几十ms的误差 \ No newline at end of file diff --git a/docs/zh/07-develop/img_5.png b/docs/zh/07-develop/img_5.png new file mode 100644 index 0000000000..d9306cdb74 Binary files /dev/null and b/docs/zh/07-develop/img_5.png differ diff --git a/docs/zh/07-develop/img_6.png b/docs/zh/07-develop/img_6.png new file mode 100644 index 0000000000..0c9a061107 Binary files /dev/null and b/docs/zh/07-develop/img_6.png differ diff --git a/docs/zh/07-develop/img_7.png b/docs/zh/07-develop/img_7.png new file mode 100644 index 0000000000..0ddb005d66 Binary files /dev/null and b/docs/zh/07-develop/img_7.png differ diff --git a/docs/zh/12-taos-sql/10-function.md b/docs/zh/12-taos-sql/10-function.md index 66322d55f1..0482022d95 100644 --- a/docs/zh/12-taos-sql/10-function.md +++ b/docs/zh/12-taos-sql/10-function.md @@ -491,6 +491,8 @@ TO_CHAR(ts, format_str_literal) **功能说明**: 将timestamp类型按照指定格式转换为字符串 +**版本**: ver-3.2.2.0 + **返回结果数据类型**: VARCHAR **应用字段**: TIMESTAMP @@ -550,6 +552,8 @@ TO_TIMESTAMP(ts_str_literal, format_str_literal) **功能说明**: 将字符串按照指定格式转化为时间戳. +**版本**: ver-3.2.2.0 + **返回结果数据类型**: TIMESTAMP **应用字段**: VARCHAR diff --git a/docs/zh/12-taos-sql/13-tmq.md b/docs/zh/12-taos-sql/13-tmq.md index 571300ad8c..61135a3422 100644 --- a/docs/zh/12-taos-sql/13-tmq.md +++ b/docs/zh/12-taos-sql/13-tmq.md @@ -6,32 +6,68 @@ description: TDengine 消息队列提供的数据订阅功能 TDengine 3.0.0.0 开始对消息队列做了大幅的优化和增强以简化用户的解决方案。 -## 创建订阅主题 +## 创建 topic + +TDengine 创建 topic 的个数上限通过参数 tmqMaxTopicNum 控制,默认 20 个。 + +TDengine 使用 SQL 创建一个 topic,共有三种类型的 topic: + +### 查询 topic + +语法: ```sql -CREATE TOPIC [IF NOT EXISTS] topic_name AS subquery; +CREATE TOPIC [IF NOT EXISTS] topic_name as subquery ``` +通过 `SELECT` 语句订阅(包括 `SELECT *`,或 `SELECT ts, c1` 等指定查询订阅,可以带条件过滤、标量函数计算,但不支持聚合函数、不支持时间窗口聚合)。需要注意的是: -TOPIC 支持过滤和标量函数和 UDF 标量函数,不支持 JOIN、GROUP BY、窗口切分子句、聚合函数和 UDF 聚合函数。列订阅规则如下: +- 该类型 TOPIC 一旦创建则订阅数据的结构确定。 +- 被订阅或用于计算的列或标签不可被删除(`ALTER table DROP`)、修改(`ALTER table MODIFY`)。 +- 若发生表结构变更,新增的列不出现在结果中。 +- 对于 select \*,则订阅展开为创建时所有的列(子表、普通表为数据列,超级表为数据列加标签列) +### 超级表 topic -1. TOPIC 一旦创建则返回结果的字段确定 -2. 被订阅或用于计算的列不可被删除、修改 -3. 列可以新增,但新增的列不出现在订阅结果字段中 -4. 对于 select \*,则订阅展开为创建时所有的列(子表、普通表为数据列,超级表为数据列加标签列) - - -## 删除订阅主题 +语法: ```sql +CREATE TOPIC [IF NOT EXISTS] topic_name [with meta] AS STABLE stb_name [where_condition] +``` + +与 `SELECT * from stbName` 订阅的区别是: + +- 不会限制用户的表结构变更。 +- 返回的是非结构化的数据:返回数据的结构会随之超级表的表结构变化而变化。 +- with meta 参数可选,选择时将返回创建超级表,子表等语句,主要用于taosx做超级表迁移 +- where_condition 参数可选,选择时将用来过滤符合条件的子表,订阅这些子表。where 条件里不能有普通列,只能是tag或tbname,where条件里可以用函数,用来过滤tag,但是不能是聚合函数,因为子表tag值无法做聚合。也可以是常量表达式,比如 2 > 1(订阅全部子表),或者 false(订阅0个子表) +- 返回数据不包含标签。 + +### 数据库 topic + +语法: + +```sql +CREATE TOPIC [IF NOT EXISTS] topic_name [with meta] AS DATABASE db_name; +``` + +通过该语句可创建一个包含数据库所有表数据的订阅 + +- with meta 参数可选,选择时将返回创建数据库里所有超级表,子表的语句,主要用于taosx做数据库迁移 + +说明: 超级表订阅和库订阅属于高级订阅模式,容易出错,如确实要使用,请咨询专业人员。 + +## 删除 topic + +如果不再需要订阅数据,可以删除 topic,需要注意:只有当前未在订阅中的 TOPIC 才能被删除。 + +```sql +/* 删除 topic */ DROP TOPIC [IF EXISTS] topic_name; ``` 此时如果该订阅主题上存在 consumer,则此 consumer 会收到一个错误。 -## 查看订阅主题 - -## SHOW TOPICS +## 查看 topic ```sql SHOW TOPICS; @@ -58,3 +94,11 @@ SHOW CONSUMERS; ``` 显示当前数据库下所有活跃的消费者的信息。 + +## 查看订阅信息 + +```sql +SHOW SUBSCRIPTIONS; +``` + +显示 consumer 与 vgroup 之间的分配关系和消费信息 \ No newline at end of file diff --git a/docs/zh/12-taos-sql/18-escape.md b/docs/zh/12-taos-sql/18-escape.md index 5e0d292d39..81e4179042 100644 --- a/docs/zh/12-taos-sql/18-escape.md +++ b/docs/zh/12-taos-sql/18-escape.md @@ -8,16 +8,15 @@ description: TDengine 中使用转义字符的详细规则 | 字符序列 | **代表的字符** | | :------: | -------------- | -| `\'` | 单引号' | -| `\"` | 双引号" | -| \n | 换行符 | -| \r | 回车符 | -| \t | tab 符 | -| `\\` | 斜杠\ | -| `\%` | % 规则见下 | -| `\_` | \_ 规则见下 | +| `\'` | 单引号`'` | +| `\"` | 双引号`"` | +| `\n` | 换行符 | +| `\r` | 回车符 | +| `\t` | tab 符 | +| `\\` | 斜杠 `\ ` | +| `\%` | `%` 规则见下 | +| `\_` | `_` 规则见下 | -::: ## 转义字符使用规则 @@ -25,5 +24,5 @@ description: TDengine 中使用转义字符的详细规则 1. 普通标识符: 直接提示错误的标识符,因为标识符规定必须是数字、字母和下划线,并且不能以数字开头。 2. 反引号``标识符: 保持原样,不转义 2. 数据里有转义字符 - 1. 遇到上面定义的转义字符会转义(%和\_见下面说明),如果没有匹配的转义字符会忽略掉转义符\。 - 2. 对于%和\_,因为在 like 里这两个字符是通配符,所以在模式匹配 like 里用`\%`%和`\_`表示字符里本身的%和\_,如果在 like 模式匹配上下文之外使用`\%`或`\_`,则它们的计算结果为字符串`\%`和`\_`,而不是%和\_。 + 1. 遇到上面定义的转义字符会转义(`%`和`_`见下面说明),如果没有匹配的转义字符会忽略掉转义符`\ `(`\x`保持原样)。 + 2. 对于`%`和`_`,因为在`like`里这两个字符是通配符,所以在模式匹配`like`里用`\%`和`\_`表示字符里本身的`%`和`_`,如果在`like`模式匹配上下文之外使用`\%`或`\_`,则它们的计算结果为字符串`\%`和`\_`,而不是`%`和`_`。 diff --git a/include/common/systable.h b/include/common/systable.h index 92e7915424..f0f8ac8cf6 100644 --- a/include/common/systable.h +++ b/include/common/systable.h @@ -52,6 +52,9 @@ extern "C" { #define TSDB_INS_TABLE_VIEWS "ins_views" #define TSDB_INS_TABLE_COMPACTS "ins_compacts" #define TSDB_INS_TABLE_COMPACT_DETAILS "ins_compact_details" +#define TSDB_INS_TABLE_GRANTS_FULL "ins_grants_full" +#define TSDB_INS_TABLE_GRANTS_LOGS "ins_grants_logs" +#define TSDB_INS_TABLE_MACHINES "ins_machines" #define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema" #define TSDB_PERFS_TABLE_SMAS "perf_smas" @@ -62,6 +65,11 @@ extern "C" { #define TSDB_PERFS_TABLE_TRANS "perf_trans" #define TSDB_PERFS_TABLE_APPS "perf_apps" +#define TSDB_AUDIT_DB "audit" +#define TSDB_AUDIT_STB_OPERATION "operations" +#define TSDB_AUDIT_CTB_OPERATION "t_operations_" +#define TSDB_AUDIT_CTB_OPERATION_LEN 13 + typedef struct SSysDbTableSchema { const char* name; const int32_t type; diff --git a/include/common/tcommon.h b/include/common/tcommon.h index 24e5d186b9..7e7e9b0481 100644 --- a/include/common/tcommon.h +++ b/include/common/tcommon.h @@ -171,6 +171,7 @@ typedef enum EStreamType { STREAM_CHECKPOINT, STREAM_CREATE_CHILD_TABLE, STREAM_TRANS_STATE, + STREAM_MID_RETRIEVE, } EStreamType; #pragma pack(push, 1) @@ -206,6 +207,7 @@ typedef struct SDataBlockInfo { int16_t hasVarCol; int16_t dataLoad; // denote if the data is loaded or not uint8_t scanFlag; + bool blankFill; // TODO: optimize and remove following int64_t version; // used for stream, and need serialization diff --git a/include/common/tglobal.h b/include/common/tglobal.h index f23bb4d51b..ef3e61e1a2 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -211,6 +211,7 @@ extern int32_t tsUptimeInterval; extern bool tsDisableStream; extern int64_t tsStreamBufferSize; +extern int tsStreamAggCnt; extern bool tsFilterScalarMode; extern int32_t tsMaxStreamBackendCache; extern int32_t tsPQSortMemThreshold; @@ -232,7 +233,7 @@ struct SConfig *taosGetCfg(); void taosSetAllDebugFlag(int32_t flag); void taosSetDebugFlag(int32_t *pFlagPtr, const char *flagName, int32_t flagVal); void taosLocalCfgForbiddenToChange(char *name, bool *forbidden); -int8_t taosGranted(); +int8_t taosGranted(int8_t type); #ifdef __cplusplus } diff --git a/include/common/tgrant.h b/include/common/tgrant.h index f06fca8014..6d11608d21 100644 --- a/include/common/tgrant.h +++ b/include/common/tgrant.h @@ -22,15 +22,17 @@ extern "C" { #include "os.h" #include "taoserror.h" -#ifdef GRANTS_CFG -#include "tgrantCfg.h" -#endif +#include "tdef.h" #ifndef GRANTS_COL_MAX_LEN #define GRANTS_COL_MAX_LEN 196 #endif #define GRANT_HEART_BEAT_MIN 2 +#define GRANT_ACTIVE_CODE "activeCode" +#define GRANT_FLAG_ALL (0x01) +#define GRANT_FLAG_AUDIT (0x02) +#define GRANT_FLAG_VIEW (0x04) typedef enum { TSDB_GRANT_ALL, @@ -48,63 +50,55 @@ typedef enum { TSDB_GRANT_CPU_CORES, TSDB_GRANT_STABLE, TSDB_GRANT_TABLE, + TSDB_GRANT_SUBSCRIPTION, + TSDB_GRANT_AUDIT, + TSDB_GRANT_CSV, + TSDB_GRANT_VIEW, + TSDB_GRANT_MULTI_TIER, + TSDB_GRANT_BACKUP_RESTORE, } EGrantType; int32_t grantCheck(EGrantType grant); -int32_t grantAlterActiveCode(int32_t did, const char* old, const char* newer, char* out, int8_t type); +int32_t grantCheckExpire(EGrantType grant); +char* tGetMachineId(); +#ifdef TD_UNIQ_GRANT +int32_t grantCheckLE(EGrantType grant); +#endif -#ifndef GRANTS_CFG +// #ifndef GRANTS_CFG #ifdef TD_ENTERPRISE -#define GRANTS_SCHEMA \ - static const SSysDbTableSchema grantsSchema[] = { \ - {.name = "version", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "expire_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "expired", .bytes = 5 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "storage", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "timeseries", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "databases", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "users", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "accounts", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "dnodes", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "connections", .bytes = 11 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "streams", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "cpu_cores", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "speed", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "querytime", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "opc_da", .bytes = GRANTS_COL_MAX_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "opc_ua", .bytes = GRANTS_COL_MAX_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "pi", .bytes = GRANTS_COL_MAX_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "kafka", .bytes = GRANTS_COL_MAX_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "influxdb", .bytes = GRANTS_COL_MAX_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "mqtt", .bytes = GRANTS_COL_MAX_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ +#define GRANTS_SCHEMA \ + static const SSysDbTableSchema grantsSchema[] = { \ + {.name = "version", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ + {.name = "expire_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ + {.name = "service_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ + {.name = "expired", .bytes = 5 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ + {.name = "state", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ + {.name = "timeseries", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ + {.name = "dnodes", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ + {.name = "cpu_cores", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ } #else -#define GRANTS_SCHEMA \ - static const SSysDbTableSchema grantsSchema[] = { \ - {.name = "version", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "expire_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "expired", .bytes = 5 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "storage", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "timeseries", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "databases", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "users", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "accounts", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "dnodes", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "connections", .bytes = 11 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "streams", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "cpu_cores", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "speed", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ - {.name = "querytime", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ +#define GRANTS_SCHEMA \ + static const SSysDbTableSchema grantsSchema[] = { \ + {.name = "version", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ + {.name = "expire_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ + {.name = "service_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ + {.name = "expired", .bytes = 5 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ + {.name = "state", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ + {.name = "timeseries", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ + {.name = "dnodes", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ + {.name = "cpu_cores", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \ } #endif -#define GRANT_CFG_ADD -#define GRANT_CFG_SET -#define GRANT_CFG_GET -#define GRANT_CFG_CHECK -#define GRANT_CFG_SKIP -#define GRANT_CFG_DECLARE -#define GRANT_CFG_EXTERN -#endif +// #define GRANT_CFG_ADD +// #define GRANT_CFG_SET +// #define GRANT_CFG_GET +// #define GRANT_CFG_CHECK +// #define GRANT_CFG_SKIP +// #define GRANT_CFG_DECLARE +// #define GRANT_CFG_EXTERN +// #endif #ifdef __cplusplus } diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 71a5fe9f74..db75d0e7d7 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -147,6 +147,9 @@ typedef enum _mgmt_table { TSDB_MGMT_TABLE_VIEWS, TSDB_MGMT_TABLE_COMPACT, TSDB_MGMT_TABLE_COMPACT_DETAIL, + TSDB_MGMT_TABLE_GRANTS_FULL, + TSDB_MGMT_TABLE_GRANTS_LOGS, + TSDB_MGMT_TABLE_MACHINES, TSDB_MGMT_TABLE_MAX, } EShowType; @@ -299,7 +302,8 @@ typedef enum ENodeType { QUERY_NODE_SYNCDB_STMT, QUERY_NODE_GRANT_STMT, QUERY_NODE_REVOKE_STMT, - // placeholder for [152, 180] + QUERY_NODE_ALTER_CLUSTER_STMT, + // placeholder for [153, 180] QUERY_NODE_SHOW_CREATE_VIEW_STMT = 181, QUERY_NODE_SHOW_CREATE_DATABASE_STMT, QUERY_NODE_SHOW_CREATE_TABLE_STMT, @@ -360,6 +364,9 @@ typedef enum ENodeType { QUERY_NODE_SHOW_VIEWS_STMT, QUERY_NODE_SHOW_COMPACTS_STMT, QUERY_NODE_SHOW_COMPACT_DETAILS_STMT, + QUERY_NODE_SHOW_GRANTS_FULL_STMT, + QUERY_NODE_SHOW_GRANTS_LOGS_STMT, + QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT, // logic plan node QUERY_NODE_LOGIC_PLAN_SCAN = 1000, @@ -425,7 +432,8 @@ typedef enum ENodeType { QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT, QUERY_NODE_PHYSICAL_PLAN_HASH_JOIN, QUERY_NODE_PHYSICAL_PLAN_GROUP_CACHE, - QUERY_NODE_PHYSICAL_PLAN_DYN_QUERY_CTRL + QUERY_NODE_PHYSICAL_PLAN_DYN_QUERY_CTRL, + QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL } ENodeType; typedef struct { @@ -1558,9 +1566,11 @@ typedef struct { int64_t updateTime; float numOfCores; int32_t numOfSupportVnodes; + int32_t numOfDiskCfg; int64_t memTotal; int64_t memAvail; char dnodeEp[TSDB_EP_LEN]; + char machineId[TSDB_MACHINE_ID_LEN + 1]; SMnodeLoad mload; SQnodeLoad qload; SClusterCfg clusterCfg; @@ -1601,6 +1611,7 @@ typedef struct { SEp ep; char active[TSDB_ACTIVE_KEY_LEN]; char connActive[TSDB_CONN_ACTIVE_KEY_LEN]; + char machineId[TSDB_MACHINE_ID_LEN + 1]; } SDnodeInfo; typedef struct { @@ -2032,6 +2043,17 @@ int32_t tSerializeSExplainRsp(void* buf, int32_t bufLen, SExplainRsp* pRsp); int32_t tDeserializeSExplainRsp(void* buf, int32_t bufLen, SExplainRsp* pRsp); void tFreeSExplainRsp(SExplainRsp* pRsp); +typedef struct { + char config[TSDB_DNODE_CONFIG_LEN]; + char value[TSDB_CLUSTER_VALUE_LEN]; + int32_t sqlLen; + char* sql; +} SMCfgClusterReq; + +int32_t tSerializeSMCfgClusterReq(void* buf, int32_t bufLen, SMCfgClusterReq* pReq); +int32_t tDeserializeSMCfgClusterReq(void* buf, int32_t bufLen, SMCfgClusterReq* pReq); +void tFreeSMCfgClusterReq(SMCfgClusterReq* pReq); + typedef struct { char fqdn[TSDB_FQDN_LEN]; // end point, hostname:port int32_t port; @@ -2409,6 +2431,11 @@ typedef struct SColLocation { int8_t type; } SColLocation; +typedef struct SVgroupVer { + int32_t vgId; + int64_t ver; +} SVgroupVer; + typedef struct { char name[TSDB_STREAM_FNAME_LEN]; char sourceDB[TSDB_DB_FNAME_LEN]; @@ -2432,6 +2459,7 @@ typedef struct { int64_t deleteMark; int8_t igUpdate; int64_t lastTs; + SArray* pVgroupVerList; } SCMCreateStreamReq; typedef struct { @@ -3612,6 +3640,7 @@ typedef struct { int64_t timeout; STqOffsetVal reqOffset; int8_t enableReplay; + int8_t sourceExcluded; } SMqPollReq; int32_t tSerializeSMqPollReq(void* buf, int32_t bufLen, SMqPollReq* pReq); @@ -3741,6 +3770,7 @@ typedef struct { int32_t vgId; STqOffsetVal offset; int64_t rows; + int64_t ever; } OffsetRows; typedef struct { @@ -3755,7 +3785,12 @@ typedef struct { } SMqHbReq; typedef struct { - int8_t reserved; + char topic[TSDB_TOPIC_FNAME_LEN]; + int8_t noPrivilege; +} STopicPrivilege; + +typedef struct { + SArray* topicPrivileges; // SArray } SMqHbRsp; typedef struct { @@ -3774,18 +3809,6 @@ typedef struct { SVCreateTbReq cTbReq; } SVSubmitBlk; -typedef struct { - int32_t flags; - int32_t nBlocks; - union { - SArray* pArray; - SVSubmitBlk* pBlocks; - }; -} SVSubmitReq; - -int32_t tEncodeSVSubmitReq(SEncoder* pCoder, const SVSubmitReq* pReq); -int32_t tDecodeSVSubmitReq(SDecoder* pCoder, SVSubmitReq* pReq); - typedef struct { SMsgHead header; uint64_t sId; @@ -3894,11 +3917,19 @@ int32_t tSerializeSMqHbReq(void* buf, int32_t bufLen, SMqHbReq* pReq); int32_t tDeserializeSMqHbReq(void* buf, int32_t bufLen, SMqHbReq* pReq); int32_t tDeatroySMqHbReq(SMqHbReq* pReq); +int32_t tSerializeSMqHbRsp(void* buf, int32_t bufLen, SMqHbRsp* pRsp); +int32_t tDeserializeSMqHbRsp(void* buf, int32_t bufLen, SMqHbRsp* pRsp); +int32_t tDeatroySMqHbRsp(SMqHbRsp* pRsp); + int32_t tSerializeSMqSeekReq(void* buf, int32_t bufLen, SMqSeekReq* pReq); int32_t tDeserializeSMqSeekReq(void* buf, int32_t bufLen, SMqSeekReq* pReq); #define SUBMIT_REQ_AUTO_CREATE_TABLE 0x1 #define SUBMIT_REQ_COLUMN_DATA_FORMAT 0x2 +#define SUBMIT_REQ_FROM_FILE 0x4 + +#define SOURCE_NULL 0 +#define SOURCE_TAOSX 1 typedef struct { int32_t flags; @@ -3910,7 +3941,8 @@ typedef struct { SArray* aRowP; SArray* aCol; }; - int64_t ctimeMs; + int64_t ctimeMs; + int8_t source; } SSubmitTbData; typedef struct { diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h index 3bf22ec339..dc5cb24564 100644 --- a/include/common/tmsgdef.h +++ b/include/common/tmsgdef.h @@ -218,6 +218,7 @@ TD_DEF_MSG_TYPE(TDMT_MND_KILL_COMPACT, "kill-compact", SKillCompactReq, NULL) TD_DEF_MSG_TYPE(TDMT_MND_COMPACT_TIMER, "compact-tmr", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_STREAM_REQ_CHKPT, "stream-req-checkpoint", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_CONFIG_CLUSTER, "config-cluster", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_MAX_MSG, "mnd-max", NULL, NULL) TD_CLOSE_MSG_SEG(TDMT_END_MND_MSG) @@ -337,8 +338,9 @@ TD_DEF_MSG_TYPE(TDMT_SYNC_LOCAL_CMD, "sync-local-cmd", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SYNC_PREP_SNAPSHOT, "sync-prep-snapshot", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SYNC_PREP_SNAPSHOT_REPLY, "sync-prep-snapshot-reply", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_SYNC_MAX_MSG, "sync-max", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SYNC_UNUSED_CODE, "sync-unused", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_SYNC_FORCE_FOLLOWER, "sync-force-become-follower", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SYNC_MAX_MSG, "sync-max", NULL, NULL) TD_CLOSE_MSG_SEG(TDMT_END_SYNC_MSG) TD_NEW_MSG_SEG(TDMT_VND_STREAM_MSG) //7 << 8 diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 33aba5e242..519da6d116 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -73,306 +73,306 @@ #define TK_NK_IPTOKEN 55 #define TK_FORCE 56 #define TK_UNSAFE 57 -#define TK_LOCAL 58 -#define TK_QNODE 59 -#define TK_BNODE 60 -#define TK_SNODE 61 -#define TK_MNODE 62 -#define TK_VNODE 63 -#define TK_DATABASE 64 -#define TK_USE 65 -#define TK_FLUSH 66 -#define TK_TRIM 67 -#define TK_COMPACT 68 -#define TK_IF 69 -#define TK_NOT 70 -#define TK_EXISTS 71 -#define TK_BUFFER 72 -#define TK_CACHEMODEL 73 -#define TK_CACHESIZE 74 -#define TK_COMP 75 -#define TK_DURATION 76 -#define TK_NK_VARIABLE 77 -#define TK_MAXROWS 78 -#define TK_MINROWS 79 -#define TK_KEEP 80 -#define TK_PAGES 81 -#define TK_PAGESIZE 82 -#define TK_TSDB_PAGESIZE 83 -#define TK_PRECISION 84 -#define TK_REPLICA 85 -#define TK_VGROUPS 86 -#define TK_SINGLE_STABLE 87 -#define TK_RETENTIONS 88 -#define TK_SCHEMALESS 89 -#define TK_WAL_LEVEL 90 -#define TK_WAL_FSYNC_PERIOD 91 -#define TK_WAL_RETENTION_PERIOD 92 -#define TK_WAL_RETENTION_SIZE 93 -#define TK_WAL_ROLL_PERIOD 94 -#define TK_WAL_SEGMENT_SIZE 95 -#define TK_STT_TRIGGER 96 -#define TK_TABLE_PREFIX 97 -#define TK_TABLE_SUFFIX 98 -#define TK_KEEP_TIME_OFFSET 99 -#define TK_NK_COLON 100 -#define TK_BWLIMIT 101 -#define TK_START 102 -#define TK_TIMESTAMP 103 -#define TK_END 104 -#define TK_TABLE 105 -#define TK_NK_LP 106 -#define TK_NK_RP 107 -#define TK_STABLE 108 -#define TK_COLUMN 109 -#define TK_MODIFY 110 -#define TK_RENAME 111 -#define TK_TAG 112 -#define TK_SET 113 -#define TK_NK_EQ 114 -#define TK_USING 115 -#define TK_TAGS 116 -#define TK_BOOL 117 -#define TK_TINYINT 118 -#define TK_SMALLINT 119 -#define TK_INT 120 -#define TK_INTEGER 121 -#define TK_BIGINT 122 -#define TK_FLOAT 123 -#define TK_DOUBLE 124 -#define TK_BINARY 125 -#define TK_NCHAR 126 -#define TK_UNSIGNED 127 -#define TK_JSON 128 -#define TK_VARCHAR 129 -#define TK_MEDIUMBLOB 130 -#define TK_BLOB 131 -#define TK_VARBINARY 132 -#define TK_GEOMETRY 133 -#define TK_DECIMAL 134 -#define TK_COMMENT 135 -#define TK_MAX_DELAY 136 -#define TK_WATERMARK 137 -#define TK_ROLLUP 138 -#define TK_TTL 139 -#define TK_SMA 140 -#define TK_DELETE_MARK 141 -#define TK_FIRST 142 -#define TK_LAST 143 -#define TK_SHOW 144 -#define TK_PRIVILEGES 145 -#define TK_DATABASES 146 -#define TK_TABLES 147 -#define TK_STABLES 148 -#define TK_MNODES 149 -#define TK_QNODES 150 -#define TK_FUNCTIONS 151 -#define TK_INDEXES 152 -#define TK_ACCOUNTS 153 -#define TK_APPS 154 -#define TK_CONNECTIONS 155 -#define TK_LICENCES 156 -#define TK_GRANTS 157 -#define TK_QUERIES 158 -#define TK_SCORES 159 -#define TK_TOPICS 160 -#define TK_VARIABLES 161 -#define TK_CLUSTER 162 -#define TK_BNODES 163 -#define TK_SNODES 164 -#define TK_TRANSACTIONS 165 -#define TK_DISTRIBUTED 166 -#define TK_CONSUMERS 167 -#define TK_SUBSCRIPTIONS 168 -#define TK_VNODES 169 -#define TK_ALIVE 170 -#define TK_VIEWS 171 -#define TK_VIEW 172 -#define TK_COMPACTS 173 -#define TK_NORMAL 174 -#define TK_CHILD 175 -#define TK_LIKE 176 -#define TK_TBNAME 177 -#define TK_QTAGS 178 -#define TK_AS 179 -#define TK_SYSTEM 180 -#define TK_INDEX 181 -#define TK_FUNCTION 182 -#define TK_INTERVAL 183 -#define TK_COUNT 184 -#define TK_LAST_ROW 185 -#define TK_META 186 -#define TK_ONLY 187 -#define TK_TOPIC 188 -#define TK_CONSUMER 189 -#define TK_GROUP 190 -#define TK_DESC 191 -#define TK_DESCRIBE 192 -#define TK_RESET 193 -#define TK_QUERY 194 -#define TK_CACHE 195 -#define TK_EXPLAIN 196 -#define TK_ANALYZE 197 -#define TK_VERBOSE 198 -#define TK_NK_BOOL 199 -#define TK_RATIO 200 -#define TK_NK_FLOAT 201 -#define TK_OUTPUTTYPE 202 -#define TK_AGGREGATE 203 -#define TK_BUFSIZE 204 -#define TK_LANGUAGE 205 -#define TK_REPLACE 206 -#define TK_STREAM 207 -#define TK_INTO 208 -#define TK_PAUSE 209 -#define TK_RESUME 210 -#define TK_TRIGGER 211 -#define TK_AT_ONCE 212 -#define TK_WINDOW_CLOSE 213 -#define TK_IGNORE 214 -#define TK_EXPIRED 215 -#define TK_FILL_HISTORY 216 -#define TK_UPDATE 217 -#define TK_SUBTABLE 218 -#define TK_UNTREATED 219 -#define TK_KILL 220 -#define TK_CONNECTION 221 -#define TK_TRANSACTION 222 -#define TK_BALANCE 223 -#define TK_VGROUP 224 -#define TK_LEADER 225 -#define TK_MERGE 226 -#define TK_REDISTRIBUTE 227 -#define TK_SPLIT 228 -#define TK_DELETE 229 -#define TK_INSERT 230 -#define TK_NULL 231 -#define TK_NK_QUESTION 232 -#define TK_NK_ALIAS 233 -#define TK_NK_ARROW 234 -#define TK_ROWTS 235 -#define TK_QSTART 236 -#define TK_QEND 237 -#define TK_QDURATION 238 -#define TK_WSTART 239 -#define TK_WEND 240 -#define TK_WDURATION 241 -#define TK_IROWTS 242 -#define TK_ISFILLED 243 -#define TK_CAST 244 -#define TK_NOW 245 -#define TK_TODAY 246 -#define TK_TIMEZONE 247 -#define TK_CLIENT_VERSION 248 -#define TK_SERVER_VERSION 249 -#define TK_SERVER_STATUS 250 -#define TK_CURRENT_USER 251 -#define TK_CASE 252 -#define TK_WHEN 253 -#define TK_THEN 254 -#define TK_ELSE 255 -#define TK_BETWEEN 256 -#define TK_IS 257 -#define TK_NK_LT 258 -#define TK_NK_GT 259 -#define TK_NK_LE 260 -#define TK_NK_GE 261 -#define TK_NK_NE 262 -#define TK_MATCH 263 -#define TK_NMATCH 264 -#define TK_CONTAINS 265 -#define TK_IN 266 -#define TK_JOIN 267 -#define TK_INNER 268 -#define TK_LEFT 269 -#define TK_RIGHT 270 -#define TK_FULL 271 -#define TK_OUTER 272 -#define TK_SEMI 273 -#define TK_ANTI 274 -#define TK_ASOF 275 -#define TK_WINDOW 276 -#define TK_WINDOW_OFFSET 277 -#define TK_JLIMIT 278 -#define TK_SELECT 279 -#define TK_NK_HINT 280 -#define TK_DISTINCT 281 -#define TK_WHERE 282 -#define TK_PARTITION 283 -#define TK_BY 284 -#define TK_SESSION 285 -#define TK_STATE_WINDOW 286 -#define TK_EVENT_WINDOW 287 -#define TK_SLIDING 288 -#define TK_FILL 289 -#define TK_VALUE 290 -#define TK_VALUE_F 291 -#define TK_NONE 292 -#define TK_PREV 293 -#define TK_NULL_F 294 -#define TK_LINEAR 295 -#define TK_NEXT 296 -#define TK_HAVING 297 -#define TK_RANGE 298 -#define TK_EVERY 299 -#define TK_ORDER 300 -#define TK_SLIMIT 301 -#define TK_SOFFSET 302 -#define TK_LIMIT 303 -#define TK_OFFSET 304 -#define TK_ASC 305 -#define TK_NULLS 306 -#define TK_ABORT 307 -#define TK_AFTER 308 -#define TK_ATTACH 309 -#define TK_BEFORE 310 -#define TK_BEGIN 311 -#define TK_BITAND 312 -#define TK_BITNOT 313 -#define TK_BITOR 314 -#define TK_BLOCKS 315 -#define TK_CHANGE 316 -#define TK_COMMA 317 -#define TK_CONCAT 318 -#define TK_CONFLICT 319 -#define TK_COPY 320 -#define TK_DEFERRED 321 -#define TK_DELIMITERS 322 -#define TK_DETACH 323 -#define TK_DIVIDE 324 -#define TK_DOT 325 -#define TK_EACH 326 -#define TK_FAIL 327 -#define TK_FILE 328 -#define TK_FOR 329 -#define TK_GLOB 330 -#define TK_ID 331 -#define TK_IMMEDIATE 332 -#define TK_IMPORT 333 -#define TK_INITIALLY 334 -#define TK_INSTEAD 335 -#define TK_ISNULL 336 -#define TK_KEY 337 -#define TK_MODULES 338 -#define TK_NK_BITNOT 339 -#define TK_NK_SEMI 340 -#define TK_NOTNULL 341 -#define TK_OF 342 -#define TK_PLUS 343 -#define TK_PRIVILEGE 344 -#define TK_RAISE 345 -#define TK_RESTRICT 346 -#define TK_ROW 347 -#define TK_STAR 348 -#define TK_STATEMENT 349 -#define TK_STRICT 350 -#define TK_STRING 351 -#define TK_TIMES 352 -#define TK_VALUES 353 -#define TK_VARIABLE 354 -#define TK_WAL 355 - - +#define TK_CLUSTER 58 +#define TK_LOCAL 59 +#define TK_QNODE 60 +#define TK_BNODE 61 +#define TK_SNODE 62 +#define TK_MNODE 63 +#define TK_VNODE 64 +#define TK_DATABASE 65 +#define TK_USE 66 +#define TK_FLUSH 67 +#define TK_TRIM 68 +#define TK_COMPACT 69 +#define TK_IF 70 +#define TK_NOT 71 +#define TK_EXISTS 72 +#define TK_BUFFER 73 +#define TK_CACHEMODEL 74 +#define TK_CACHESIZE 75 +#define TK_COMP 76 +#define TK_DURATION 77 +#define TK_NK_VARIABLE 78 +#define TK_MAXROWS 79 +#define TK_MINROWS 80 +#define TK_KEEP 81 +#define TK_PAGES 82 +#define TK_PAGESIZE 83 +#define TK_TSDB_PAGESIZE 84 +#define TK_PRECISION 85 +#define TK_REPLICA 86 +#define TK_VGROUPS 87 +#define TK_SINGLE_STABLE 88 +#define TK_RETENTIONS 89 +#define TK_SCHEMALESS 90 +#define TK_WAL_LEVEL 91 +#define TK_WAL_FSYNC_PERIOD 92 +#define TK_WAL_RETENTION_PERIOD 93 +#define TK_WAL_RETENTION_SIZE 94 +#define TK_WAL_ROLL_PERIOD 95 +#define TK_WAL_SEGMENT_SIZE 96 +#define TK_STT_TRIGGER 97 +#define TK_TABLE_PREFIX 98 +#define TK_TABLE_SUFFIX 99 +#define TK_KEEP_TIME_OFFSET 100 +#define TK_NK_COLON 101 +#define TK_BWLIMIT 102 +#define TK_START 103 +#define TK_TIMESTAMP 104 +#define TK_END 105 +#define TK_TABLE 106 +#define TK_NK_LP 107 +#define TK_NK_RP 108 +#define TK_STABLE 109 +#define TK_COLUMN 110 +#define TK_MODIFY 111 +#define TK_RENAME 112 +#define TK_TAG 113 +#define TK_SET 114 +#define TK_NK_EQ 115 +#define TK_USING 116 +#define TK_TAGS 117 +#define TK_BOOL 118 +#define TK_TINYINT 119 +#define TK_SMALLINT 120 +#define TK_INT 121 +#define TK_INTEGER 122 +#define TK_BIGINT 123 +#define TK_FLOAT 124 +#define TK_DOUBLE 125 +#define TK_BINARY 126 +#define TK_NCHAR 127 +#define TK_UNSIGNED 128 +#define TK_JSON 129 +#define TK_VARCHAR 130 +#define TK_MEDIUMBLOB 131 +#define TK_BLOB 132 +#define TK_VARBINARY 133 +#define TK_GEOMETRY 134 +#define TK_DECIMAL 135 +#define TK_COMMENT 136 +#define TK_MAX_DELAY 137 +#define TK_WATERMARK 138 +#define TK_ROLLUP 139 +#define TK_TTL 140 +#define TK_SMA 141 +#define TK_DELETE_MARK 142 +#define TK_FIRST 143 +#define TK_LAST 144 +#define TK_SHOW 145 +#define TK_PRIVILEGES 146 +#define TK_DATABASES 147 +#define TK_TABLES 148 +#define TK_STABLES 149 +#define TK_MNODES 150 +#define TK_QNODES 151 +#define TK_FUNCTIONS 152 +#define TK_INDEXES 153 +#define TK_ACCOUNTS 154 +#define TK_APPS 155 +#define TK_CONNECTIONS 156 +#define TK_LICENCES 157 +#define TK_GRANTS 158 +#define TK_FULL 159 +#define TK_LOGS 160 +#define TK_MACHINES 161 +#define TK_QUERIES 162 +#define TK_SCORES 163 +#define TK_TOPICS 164 +#define TK_VARIABLES 165 +#define TK_BNODES 166 +#define TK_SNODES 167 +#define TK_TRANSACTIONS 168 +#define TK_DISTRIBUTED 169 +#define TK_CONSUMERS 170 +#define TK_SUBSCRIPTIONS 171 +#define TK_VNODES 172 +#define TK_ALIVE 173 +#define TK_VIEWS 174 +#define TK_VIEW 175 +#define TK_COMPACTS 176 +#define TK_NORMAL 177 +#define TK_CHILD 178 +#define TK_LIKE 179 +#define TK_TBNAME 180 +#define TK_QTAGS 181 +#define TK_AS 182 +#define TK_SYSTEM 183 +#define TK_INDEX 184 +#define TK_FUNCTION 185 +#define TK_INTERVAL 186 +#define TK_COUNT 187 +#define TK_LAST_ROW 188 +#define TK_META 189 +#define TK_ONLY 190 +#define TK_TOPIC 191 +#define TK_CONSUMER 192 +#define TK_GROUP 193 +#define TK_DESC 194 +#define TK_DESCRIBE 195 +#define TK_RESET 196 +#define TK_QUERY 197 +#define TK_CACHE 198 +#define TK_EXPLAIN 199 +#define TK_ANALYZE 200 +#define TK_VERBOSE 201 +#define TK_NK_BOOL 202 +#define TK_RATIO 203 +#define TK_NK_FLOAT 204 +#define TK_OUTPUTTYPE 205 +#define TK_AGGREGATE 206 +#define TK_BUFSIZE 207 +#define TK_LANGUAGE 208 +#define TK_REPLACE 209 +#define TK_STREAM 210 +#define TK_INTO 211 +#define TK_PAUSE 212 +#define TK_RESUME 213 +#define TK_TRIGGER 214 +#define TK_AT_ONCE 215 +#define TK_WINDOW_CLOSE 216 +#define TK_IGNORE 217 +#define TK_EXPIRED 218 +#define TK_FILL_HISTORY 219 +#define TK_UPDATE 220 +#define TK_SUBTABLE 221 +#define TK_UNTREATED 222 +#define TK_KILL 223 +#define TK_CONNECTION 224 +#define TK_TRANSACTION 225 +#define TK_BALANCE 226 +#define TK_VGROUP 227 +#define TK_LEADER 228 +#define TK_MERGE 229 +#define TK_REDISTRIBUTE 230 +#define TK_SPLIT 231 +#define TK_DELETE 232 +#define TK_INSERT 233 +#define TK_NULL 234 +#define TK_NK_QUESTION 235 +#define TK_NK_ALIAS 236 +#define TK_NK_ARROW 237 +#define TK_ROWTS 238 +#define TK_QSTART 239 +#define TK_QEND 240 +#define TK_QDURATION 241 +#define TK_WSTART 242 +#define TK_WEND 243 +#define TK_WDURATION 244 +#define TK_IROWTS 245 +#define TK_ISFILLED 246 +#define TK_CAST 247 +#define TK_NOW 248 +#define TK_TODAY 249 +#define TK_TIMEZONE 250 +#define TK_CLIENT_VERSION 251 +#define TK_SERVER_VERSION 252 +#define TK_SERVER_STATUS 253 +#define TK_CURRENT_USER 254 +#define TK_CASE 255 +#define TK_WHEN 256 +#define TK_THEN 257 +#define TK_ELSE 258 +#define TK_BETWEEN 259 +#define TK_IS 260 +#define TK_NK_LT 261 +#define TK_NK_GT 262 +#define TK_NK_LE 263 +#define TK_NK_GE 264 +#define TK_NK_NE 265 +#define TK_MATCH 266 +#define TK_NMATCH 267 +#define TK_CONTAINS 268 +#define TK_IN 269 +#define TK_JOIN 270 +#define TK_INNER 271 +#define TK_LEFT 272 +#define TK_RIGHT 273 +#define TK_OUTER 274 +#define TK_SEMI 275 +#define TK_ANTI 276 +#define TK_ASOF 277 +#define TK_WINDOW 278 +#define TK_WINDOW_OFFSET 279 +#define TK_JLIMIT 280 +#define TK_SELECT 281 +#define TK_NK_HINT 282 +#define TK_DISTINCT 283 +#define TK_WHERE 284 +#define TK_PARTITION 285 +#define TK_BY 286 +#define TK_SESSION 287 +#define TK_STATE_WINDOW 288 +#define TK_EVENT_WINDOW 289 +#define TK_SLIDING 290 +#define TK_FILL 291 +#define TK_VALUE 292 +#define TK_VALUE_F 293 +#define TK_NONE 294 +#define TK_PREV 295 +#define TK_NULL_F 296 +#define TK_LINEAR 297 +#define TK_NEXT 298 +#define TK_HAVING 299 +#define TK_RANGE 300 +#define TK_EVERY 301 +#define TK_ORDER 302 +#define TK_SLIMIT 303 +#define TK_SOFFSET 304 +#define TK_LIMIT 305 +#define TK_OFFSET 306 +#define TK_ASC 307 +#define TK_NULLS 308 +#define TK_ABORT 309 +#define TK_AFTER 310 +#define TK_ATTACH 311 +#define TK_BEFORE 312 +#define TK_BEGIN 313 +#define TK_BITAND 314 +#define TK_BITNOT 315 +#define TK_BITOR 316 +#define TK_BLOCKS 317 +#define TK_CHANGE 318 +#define TK_COMMA 319 +#define TK_CONCAT 320 +#define TK_CONFLICT 321 +#define TK_COPY 322 +#define TK_DEFERRED 323 +#define TK_DELIMITERS 324 +#define TK_DETACH 325 +#define TK_DIVIDE 326 +#define TK_DOT 327 +#define TK_EACH 328 +#define TK_FAIL 329 +#define TK_FILE 330 +#define TK_FOR 331 +#define TK_GLOB 332 +#define TK_ID 333 +#define TK_IMMEDIATE 334 +#define TK_IMPORT 335 +#define TK_INITIALLY 336 +#define TK_INSTEAD 337 +#define TK_ISNULL 338 +#define TK_KEY 339 +#define TK_MODULES 340 +#define TK_NK_BITNOT 341 +#define TK_NK_SEMI 342 +#define TK_NOTNULL 343 +#define TK_OF 344 +#define TK_PLUS 345 +#define TK_PRIVILEGE 346 +#define TK_RAISE 347 +#define TK_RESTRICT 348 +#define TK_ROW 349 +#define TK_STAR 350 +#define TK_STATEMENT 351 +#define TK_STRICT 352 +#define TK_STRING 353 +#define TK_TIMES 354 +#define TK_VALUES 355 +#define TK_VARIABLE 356 +#define TK_WAL 357 #define TK_NK_SPACE 600 diff --git a/include/dnode/vnode/tqCommon.h b/include/dnode/vnode/tqCommon.h index dc145819ca..fc9b88340f 100644 --- a/include/dnode/vnode/tqCommon.h +++ b/include/dnode/vnode/tqCommon.h @@ -18,7 +18,7 @@ // message process int32_t tqStreamTaskStartAsync(SStreamMeta* pMeta, SMsgCb* cb, bool restart); -int32_t tqStreamOneTaskStartAsync(SStreamMeta* pMeta, SMsgCb* cb, int64_t streamId, int32_t taskId); +int32_t tqStreamStartOneTaskAsync(SStreamMeta* pMeta, SMsgCb* cb, int64_t streamId, int32_t taskId); int32_t tqStreamTaskProcessUpdateReq(SStreamMeta* pMeta, SMsgCb* cb, SRpcMsg* pMsg, bool restored); int32_t tqStreamTaskProcessDispatchReq(SStreamMeta* pMeta, SRpcMsg* pMsg); int32_t tqStreamTaskProcessDispatchRsp(SStreamMeta* pMeta, SRpcMsg* pMsg); diff --git a/include/libs/catalog/catalog.h b/include/libs/catalog/catalog.h index b34b998d76..1957bcbb24 100644 --- a/include/libs/catalog/catalog.h +++ b/include/libs/catalog/catalog.h @@ -358,7 +358,7 @@ int32_t catalogGetUdfInfo(SCatalog* pCtg, SRequestConnInfo* pConn, const char* f int32_t catalogChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, SUserAuthInfo *pAuth, SUserAuthRes* pRes); -int32_t catalogChkAuthFromCache(SCatalog* pCtg, SUserAuthInfo *pAuth, SUserAuthRes* pRes, bool* exists); +int32_t catalogChkAuthFromCache(SCatalog* pCtg, SUserAuthInfo *pAuth, SUserAuthRes* pRes, bool* exists); int32_t catalogUpdateUserAuthInfo(SCatalog* pCtg, SGetUserAuthRsp* pAuth); diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index f78b7a3126..e06a08acba 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -197,6 +197,8 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT void qStreamSetOpen(qTaskInfo_t tinfo); +void qStreamSetSourceExcluded(qTaskInfo_t tinfo, int8_t sourceExcluded); + void qStreamExtractOffset(qTaskInfo_t tinfo, STqOffsetVal* pOffset); SMqMetaRsp* qStreamExtractMetaMsg(qTaskInfo_t tinfo); diff --git a/include/libs/executor/storageapi.h b/include/libs/executor/storageapi.h index 669340f9e5..9987dab166 100644 --- a/include/libs/executor/storageapi.h +++ b/include/libs/executor/storageapi.h @@ -211,6 +211,7 @@ typedef struct SStoreTqReader { bool (*tqNextBlockImpl)(); // todo remove it SSDataBlock* (*tqGetResultBlock)(); int64_t (*tqGetResultBlockTime)(); + int32_t (*tqGetStreamExecProgress)(); void (*tqReaderSetColIdList)(); int32_t (*tqReaderSetQueryTableList)(); @@ -266,16 +267,11 @@ typedef struct SStoreMeta { // support filter and non-filter cases. [vnodeGetCtbIdList & vnodeGetCtbIdListByFilter] int32_t (*getChildTableList)(void* pVnode, int64_t suid, SArray* list); int32_t (*storeGetTableList)(void* pVnode, int8_t type, SArray* pList); - void* storeGetVersionRange; - void* storeGetLastTimestamp; - - int32_t (*getTableSchema)(void* pVnode, int64_t uid, STSchema** pSchema, int64_t* suid); // tsdbGetTableSchema + int32_t (*getTableSchema)(void* pVnode, int64_t uid, STSchema** pSchema, int64_t* suid); int32_t (*getNumOfChildTables)(void* pVnode, int64_t uid, int64_t* numOfTables, int32_t* numOfCols); void (*getBasicInfo)(void* pVnode, const char** dbname, int32_t* vgId, int64_t* numOfTables, int64_t* numOfNormalTables); - int64_t (*getNumOfRowsInMem)(void* pVnode); - SMCtbCursor* (*openCtbCursor)(void* pVnode, tb_uid_t uid, int lock); int32_t (*resumeCtbCursor)(SMCtbCursor* pCtbCur, int8_t first); void (*pauseCtbCursor)(SMCtbCursor* pCtbCur); diff --git a/include/libs/function/function.h b/include/libs/function/function.h index 8863201094..0fa84c99c6 100644 --- a/include/libs/function/function.h +++ b/include/libs/function/function.h @@ -114,6 +114,7 @@ typedef struct SInputColumnInfoData { int32_t totalRows; // total rows in current columnar data int32_t startRowIndex; // handle started row index int64_t numOfRows; // the number of rows needs to be handled + bool blankFill; // fill blank data to block for empty table int32_t numOfInputCols; // PTS is not included bool colDataSMAIsSet; // if agg is set or not SColumnInfoData *pPTS; // primary timestamp column diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index a0b5d938e3..3836c631d5 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -126,6 +126,7 @@ typedef enum EFunctionType { FUNCTION_TYPE_TAGS, FUNCTION_TYPE_TBUID, FUNCTION_TYPE_VGID, + FUNCTION_TYPE_VGVER, // internal function FUNCTION_TYPE_SELECT_VALUE = 3750, @@ -243,7 +244,7 @@ bool fmIsSkipScanCheckFunc(int32_t funcId); void getLastCacheDataType(SDataType* pType); SFunctionNode* createFunction(const char* pName, SNodeList* pParameterList); -int32_t fmGetDistMethod(const SFunctionNode* pFunc, SFunctionNode** pPartialFunc, SFunctionNode** pMergeFunc); +int32_t fmGetDistMethod(const SFunctionNode* pFunc, SFunctionNode** pPartialFunc, SFunctionNode** pMidFunc, SFunctionNode** pMergeFunc); typedef enum EFuncDataRequired { FUNC_DATA_REQUIRED_DATA_LOAD = 1, diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index 6aa1796963..9a12d7b98f 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -420,6 +420,12 @@ typedef struct SDropCGroupStmt { bool ignoreNotExists; } SDropCGroupStmt; +typedef struct SAlterClusterStmt { + ENodeType type; + char config[TSDB_DNODE_CONFIG_LEN]; + char value[TSDB_CLUSTER_VALUE_LEN]; +} SAlterClusterStmt; + typedef struct SAlterLocalStmt { ENodeType type; char config[TSDB_DNODE_CONFIG_LEN]; diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index dc133b465f..1e5276495d 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -262,6 +262,7 @@ typedef enum EWindowAlgorithm { SESSION_ALGO_STREAM_FINAL, SESSION_ALGO_STREAM_SINGLE, SESSION_ALGO_MERGE, + INTERVAL_ALGO_STREAM_MID, } EWindowAlgorithm; typedef struct SWindowLogicNode { @@ -607,6 +608,7 @@ typedef SIntervalPhysiNode SMergeAlignedIntervalPhysiNode; typedef SIntervalPhysiNode SStreamIntervalPhysiNode; typedef SIntervalPhysiNode SStreamFinalIntervalPhysiNode; typedef SIntervalPhysiNode SStreamSemiIntervalPhysiNode; +typedef SIntervalPhysiNode SStreamMidIntervalPhysiNode; typedef struct SFillPhysiNode { SPhysiNode node; @@ -733,8 +735,10 @@ typedef struct SSubplan { SNode* pTagCond; SNode* pTagIndexCond; bool showRewrite; - int32_t rowsThreshold; + bool isView; + bool isAudit; bool dynamicRowThreshold; + int32_t rowsThreshold; } SSubplan; typedef enum EExplainMode { EXPLAIN_MODE_DISABLE = 1, EXPLAIN_MODE_STATIC, EXPLAIN_MODE_ANALYZE } EExplainMode; diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h index bb206b5a02..2ac2c3ccbd 100644 --- a/include/libs/parser/parser.h +++ b/include/libs/parser/parser.h @@ -86,8 +86,10 @@ typedef struct SParseContext { bool enableSysInfo; bool async; bool hasInvisibleCol; - const char* svrVer; + bool isView; + bool isAudit; bool nodeOffline; + const char* svrVer; SArray* pTableMetaPos; // sql table pos => catalog data pos SArray* pTableVgroupPos; // sql table pos => catalog data pos int64_t allocatorId; @@ -106,7 +108,7 @@ int32_t qAnalyseSqlSemantic(SParseContext* pCxt, const struct SCatalogReq* pCata const struct SMetaData* pMetaData, SQuery* pQuery); int32_t qContinueParseSql(SParseContext* pCxt, struct SCatalogReq* pCatalogReq, const struct SMetaData* pMetaData, SQuery* pQuery); -int32_t qContinueParsePostQuery(SParseContext* pCxt, SQuery* pQuery, void** pResRow); +int32_t qContinueParsePostQuery(SParseContext* pCxt, SQuery* pQuery, SSDataBlock* pBlock); void qDestroyParseContext(SParseContext* pCxt); diff --git a/include/libs/planner/planner.h b/include/libs/planner/planner.h index 1b523c0323..707d70b71b 100644 --- a/include/libs/planner/planner.h +++ b/include/libs/planner/planner.h @@ -32,6 +32,8 @@ typedef struct SPlanContext { bool streamQuery; bool rSmaQuery; bool showRewrite; + bool isView; + bool isAudit; int8_t triggerType; int64_t watermark; int64_t deleteMark; diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index 2744b12b5a..705aad6fa9 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -66,7 +66,11 @@ typedef enum { #define QUERY_RSP_POLICY_QUICK 1 #define QUERY_MSG_MASK_SHOW_REWRITE() (1 << 0) -#define TEST_SHOW_REWRITE_MASK(m) (((m)&QUERY_MSG_MASK_SHOW_REWRITE()) != 0) +#define QUERY_MSG_MASK_AUDIT() (1 << 1) +#define QUERY_MSG_MASK_VIEW() (1 << 2) +#define TEST_SHOW_REWRITE_MASK(m) (((m) & QUERY_MSG_MASK_SHOW_REWRITE()) != 0) +#define TEST_AUDIT_MASK(m) (((m) & QUERY_MSG_MASK_AUDIT()) != 0) +#define TEST_VIEW_MASK(m) (((m) & QUERY_MSG_MASK_VIEW()) != 0) typedef struct STableComInfo { uint8_t numOfTags; // the number of tags in schema @@ -339,6 +343,11 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t #define IS_SYS_DBNAME(_dbname) (IS_INFORMATION_SCHEMA_DB(_dbname) || IS_PERFORMANCE_SCHEMA_DB(_dbname)) +#define IS_AUDIT_DBNAME(_dbname) ((*(_dbname) == 'a') && (0 == strcmp(_dbname, TSDB_AUDIT_DB))) +#define IS_AUDIT_STB_NAME(_stbname) ((*(_stbname) == 'o') && (0 == strcmp(_stbname, TSDB_AUDIT_STB_OPERATION))) +#define IS_AUDIT_CTB_NAME(_ctbname) \ + ((*(_ctbname) == 't') && (0 == strncmp(_ctbname, TSDB_AUDIT_CTB_OPERATION, TSDB_AUDIT_CTB_OPERATION_LEN))) + #define qFatal(...) \ do { \ if (qDebugFlag & DEBUG_FATAL) { \ diff --git a/include/libs/scalar/scalar.h b/include/libs/scalar/scalar.h index 789ba554e2..5e946357db 100644 --- a/include/libs/scalar/scalar.h +++ b/include/libs/scalar/scalar.h @@ -96,9 +96,7 @@ int32_t winDurFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOu int32_t qStartTsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); int32_t qEndTsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); -int32_t qTbnameFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); -int32_t qTbUidFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); -int32_t qVgIdFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); +int32_t qPseudoTagFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); /* Aggregation functions */ int32_t countScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); diff --git a/include/libs/stream/streamState.h b/include/libs/stream/streamState.h index 24222677a4..c2f7c6de2f 100644 --- a/include/libs/stream/streamState.h +++ b/include/libs/stream/streamState.h @@ -13,6 +13,9 @@ * along with this program. If not, see . */ +#ifndef _STREAM_STATE_H_ +#define _STREAM_STATE_H_ + #include "tdatablock.h" #include "rocksdb/c.h" @@ -20,9 +23,6 @@ #include "tsimplehash.h" #include "tstreamFileState.h" -#ifndef _STREAM_STATE_H_ -#define _STREAM_STATE_H_ - #ifdef __cplusplus extern "C" { #endif diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h index 9b3ce36bdd..d6d89d1d30 100644 --- a/include/libs/stream/tstream.h +++ b/include/libs/stream/tstream.h @@ -13,6 +13,9 @@ * along with this program. If not, see . */ +#ifndef _STREAM_H_ +#define _STREAM_H_ + #include "os.h" #include "streamState.h" #include "tdatablock.h" @@ -26,9 +29,6 @@ extern "C" { #endif -#ifndef _STREAM_H_ -#define _STREAM_H_ - #define ONE_MiB_F (1048576.0) #define ONE_KiB_F (1024.0) #define SIZE_IN_MiB(_v) ((_v) / ONE_MiB_F) @@ -313,7 +313,7 @@ typedef struct SCheckpointInfo { int64_t failedId; // record the latest failed checkpoint id int64_t checkpointingId; int32_t downstreamAlignNum; - int32_t checkpointNotReadyTasks; + int32_t numOfNotReady; bool dispatchCheckpointTrigger; int64_t msgVer; int32_t transId; @@ -324,12 +324,13 @@ typedef struct SStreamStatus { int8_t taskStatus; int8_t downstreamReady; // downstream tasks are all ready now, if this flag is set int8_t schedStatus; - int32_t schedIdleTime; // idle time before invoke again - int64_t lastExecTs; // last exec time stamp int8_t statusBackup; - bool appendTranstateBlock; // has append the transfer state data block already - int32_t timerActive; // timer is active + int32_t schedIdleTime; // idle time before invoke again + int32_t timerActive; // timer is active + int64_t lastExecTs; // last exec time stamp int32_t inScanHistorySentinel; + bool appendTranstateBlock; // has append the transfer state data block already + bool supplementaryWalscan; // complete the supplementary wal scan or not } SStreamStatus; typedef struct SDataRange { @@ -530,7 +531,7 @@ typedef struct SStreamMeta { int32_t tEncodeStreamEpInfo(SEncoder* pEncoder, const SStreamChildEpInfo* pInfo); int32_t tDecodeStreamEpInfo(SDecoder* pDecoder, SStreamChildEpInfo* pInfo); -SStreamTask* tNewStreamTask(int64_t streamId, int8_t taskLevel, bool fillHistory, int64_t triggerParam, +SStreamTask* tNewStreamTask(int64_t streamId, int8_t taskLevel, SEpSet* pEpset, bool fillHistory, int64_t triggerParam, SArray* pTaskList, bool hasFillhistory); int32_t tEncodeStreamTask(SEncoder* pEncoder, const SStreamTask* pTask); int32_t tDecodeStreamTask(SDecoder* pDecoder, SStreamTask* pTask); @@ -746,7 +747,6 @@ int32_t tEncodeStreamDispatchReq(SEncoder* pEncoder, const SStreamDispatchReq* p int32_t tDecodeStreamDispatchReq(SDecoder* pDecoder, SStreamDispatchReq* pReq); int32_t tDecodeStreamRetrieveReq(SDecoder* pDecoder, SStreamRetrieveReq* pReq); -void tDeleteStreamRetrieveReq(SStreamRetrieveReq* pReq); void tDeleteStreamDispatchReq(SStreamDispatchReq* pReq); typedef struct SStreamTaskCheckpointReq { @@ -763,7 +763,7 @@ int32_t streamSetupScheduleTrigger(SStreamTask* pTask); int32_t streamProcessDispatchMsg(SStreamTask* pTask, SStreamDispatchReq* pReq, SRpcMsg* pMsg); int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp, int32_t code); -int32_t streamProcessRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* pReq, SRpcMsg* pMsg); +int32_t streamProcessRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* pReq); SStreamChildEpInfo* streamTaskGetUpstreamTaskEpInfo(SStreamTask* pTask, int32_t taskId); void streamTaskInputFail(SStreamTask* pTask); @@ -889,6 +889,9 @@ int32_t buildCheckpointSourceRsp(SStreamCheckpointSourceReq* pReq, SRpcHandleInf SStreamTaskSM* streamCreateStateMachine(SStreamTask* pTask); void* streamDestroyStateMachine(SStreamTaskSM* pSM); + +int32_t broadcastRetrieveMsg(SStreamTask* pTask, SStreamRetrieveReq *req); +void sendRetrieveRsp(SStreamRetrieveReq *pReq, SRpcMsg* pRsp); #ifdef __cplusplus } #endif diff --git a/include/os/osDef.h b/include/os/osDef.h index 1a831f2e86..335b151cac 100644 --- a/include/os/osDef.h +++ b/include/os/osDef.h @@ -222,6 +222,10 @@ void syslog(int unused, const char *format, ...); do { \ prctl(PR_SET_NAME, (name)); \ } while (0) +#define getThreadName(name) \ + do { \ + prctl(PR_GET_NAME, (name)); \ + } while (0) #endif #else // Windows diff --git a/include/os/osThread.h b/include/os/osThread.h index f0b79ac2c9..4ef4550419 100644 --- a/include/os/osThread.h +++ b/include/os/osThread.h @@ -69,6 +69,19 @@ typedef pthread_key_t TdThreadKey; #define taosThreadCleanupPush pthread_cleanup_push #define taosThreadCleanupPop pthread_cleanup_pop +#if !defined(WINDOWS) +#if defined(_TD_DARWIN_64) // MACOS +#define taosThreadRwlockAttrSetKindNP(A, B) ((void)0) +#else // LINUX +#if _XOPEN_SOURCE >= 500 || _POSIX_C_SOURCE >= 200809L +#define taosThreadRwlockAttrSetKindNP(A, B) pthread_rwlockattr_setkind_np(A, B) +#else +#define taosThreadRwlockAttrSetKindNP(A, B) ((void)0) +#endif +#endif +#else // WINDOWS +#define taosThreadRwlockAttrSetKindNP(A, B) ((void)0) +#endif #if defined(WINDOWS) && !defined(__USE_PTHREAD) #define TD_PTHREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER_FORBID diff --git a/include/util/taoserror.h b/include/util/taoserror.h index df52423ed9..da44481dd5 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -414,6 +414,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_MNODE_ONLY_TWO_MNODE TAOS_DEF_ERROR_CODE(0, 0x0414) // internal #define TSDB_CODE_MNODE_NO_NEED_RESTORE TAOS_DEF_ERROR_CODE(0, 0x0415) // internal #define TSDB_CODE_DNODE_ONLY_USE_WHEN_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x0416) +#define TSDB_CODE_DNODE_NO_MACHINE_CODE TAOS_DEF_ERROR_CODE(0, 0x0417) // mnode-sma #define TSDB_CODE_MND_SMA_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0480) @@ -531,7 +532,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_QRY_TASK_DROPPED TAOS_DEF_ERROR_CODE(0, 0x0725) #define TSDB_CODE_QRY_TASK_CANCELLING TAOS_DEF_ERROR_CODE(0, 0x0726) #define TSDB_CODE_QRY_TASK_DROPPING TAOS_DEF_ERROR_CODE(0, 0x0727) -#define TSDB_CODE_QRY_DUPLICATTED_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0728) +#define TSDB_CODE_QRY_DUPLICATED_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0728) #define TSDB_CODE_QRY_TASK_MSG_ERROR TAOS_DEF_ERROR_CODE(0, 0x0729) #define TSDB_CODE_QRY_JOB_FREED TAOS_DEF_ERROR_CODE(0, 0x072A) #define TSDB_CODE_QRY_TASK_STATUS_ERROR TAOS_DEF_ERROR_CODE(0, 0x072B) @@ -555,7 +556,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_GRANT_STREAM_LIMITED TAOS_DEF_ERROR_CODE(0, 0x0807) #define TSDB_CODE_GRANT_SPEED_LIMITED TAOS_DEF_ERROR_CODE(0, 0x0808) #define TSDB_CODE_GRANT_STORAGE_LIMITED TAOS_DEF_ERROR_CODE(0, 0x0809) -#define TSDB_CODE_GRANT_QUERYTIME_LIMITED TAOS_DEF_ERROR_CODE(0, 0x080A) +#define TSDB_CODE_GRANT_SUBSCRIPTION_LIMITED TAOS_DEF_ERROR_CODE(0, 0x080A) #define TSDB_CODE_GRANT_CPU_LIMITED TAOS_DEF_ERROR_CODE(0, 0x080B) #define TSDB_CODE_GRANT_STABLE_LIMITED TAOS_DEF_ERROR_CODE(0, 0x080C) #define TSDB_CODE_GRANT_TABLE_LIMITED TAOS_DEF_ERROR_CODE(0, 0x080D) @@ -564,8 +565,17 @@ int32_t* taosGetErrno(); #define TSDB_CODE_GRANT_PAR_DEC_IVLD_KEY TAOS_DEF_ERROR_CODE(0, 0x0810) #define TSDB_CODE_GRANT_PAR_DEC_IVLD_KLEN TAOS_DEF_ERROR_CODE(0, 0x0811) #define TSDB_CODE_GRANT_GEN_IVLD_KEY TAOS_DEF_ERROR_CODE(0, 0x0812) -#define TSDB_CODE_GRANT_GEN_APP_LIMIT TAOS_DEF_ERROR_CODE(0, 0x0813) +#define TSDB_CODE_GRANT_GEN_ACTIVE_LEN TAOS_DEF_ERROR_CODE(0, 0x0813) #define TSDB_CODE_GRANT_GEN_ENC_IVLD_KLEN TAOS_DEF_ERROR_CODE(0, 0x0814) +#define TSDB_CODE_GRANT_PAR_IVLD_DIST TAOS_DEF_ERROR_CODE(0, 0x0815) +#define TSDB_CODE_GRANT_UNLICENSED_CLUSTER TAOS_DEF_ERROR_CODE(0, 0x0816) +#define TSDB_CODE_GRANT_LACK_OF_BASIC TAOS_DEF_ERROR_CODE(0, 0x0817) +#define TSDB_CODE_GRANT_OBJ_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0818) +#define TSDB_CODE_GRANT_LAST_ACTIVE_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x0819) +#define TSDB_CODE_GRANT_MACHINES_MISMATCH TAOS_DEF_ERROR_CODE(0, 0x0820) +#define TSDB_CODE_GRANT_OPT_EXPIRE_TOO_LARGE TAOS_DEF_ERROR_CODE(0, 0x0821) +#define TSDB_CODE_GRANT_DUPLICATED_ACTIVE TAOS_DEF_ERROR_CODE(0, 0x0822) +#define TSDB_CODE_GRANT_VIEW_LIMITED TAOS_DEF_ERROR_CODE(0, 0x0823) // sync // #define TSDB_CODE_SYN_INVALID_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0900) // 2.x diff --git a/include/util/tbase58.h b/include/util/tbase58.h new file mode 100644 index 0000000000..e1b03f8a8f --- /dev/null +++ b/include/util/tbase58.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef _TD_UTIL_BASE58_H_ +#define _TD_UTIL_BASE58_H_ + +#include "os.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint8_t *base58_decode(const char *value, size_t inlen, int32_t *outlen); +char *base58_encode(const uint8_t *value, int32_t vlen); + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_UTIL_BASE58_H_*/ \ No newline at end of file diff --git a/include/util/tdef.h b/include/util/tdef.h index 2bdbcf27f9..0e053d4baa 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -265,6 +265,7 @@ typedef enum ELogicConditionType { #define TSDB_JOB_STATUS_LEN 32 #define TSDB_CLUSTER_ID_LEN 40 +#define TSDB_MACHINE_ID_LEN 24 #define TSDB_FQDN_LEN 128 #define TSDB_EP_LEN (TSDB_FQDN_LEN + 6) #define TSDB_IPv4ADDR_LEN 16 @@ -286,6 +287,9 @@ typedef enum ELogicConditionType { #define TSDB_DNODE_CONFIG_LEN 128 #define TSDB_DNODE_VALUE_LEN 256 +#define TSDB_CLUSTER_VALUE_LEN 1000 +#define TSDB_GRANT_LOG_COL_LEN 15600 + #define TSDB_ACTIVE_KEY_LEN 109 #define TSDB_CONN_ACTIVE_KEY_LEN 255 diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index f1e9e36433..87f8c6be67 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -681,8 +681,9 @@ void taos_init_imp(void) { snprintf(logDirName, 64, "taoslog"); #endif if (taosCreateLog(logDirName, 10, configDir, NULL, NULL, NULL, NULL, 1) != 0) { - // ignore create log failed, only print printf(" WARING: Create %s failed:%s. configDir=%s\n", logDirName, strerror(errno), configDir); + tscInitRes = -1; + return; } if (taosInitCfg(configDir, NULL, NULL, NULL, NULL, 1) != 0) { @@ -750,8 +751,11 @@ int taos_options_imp(TSDB_OPTION option, const char *str) { tstrncpy(configDir, str, PATH_MAX); tscInfo("set cfg:%s to %s", configDir, str); return 0; - } else { - taos_init(); // initialize global config + } + + // initialize global config + if (taos_init() != 0) { + return -1; } SConfig *pCfg = taosGetCfg(); diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index 63a65d7c95..a146712cab 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -843,7 +843,7 @@ int32_t hbGetExpiredViewInfo(SClientHbKey *connKey, struct SCatalog *pCatalog, S view->version = htonl(view->version); } - tscDebug("hb got %d expired view, valueLen:%lu", viewNum, sizeof(SViewVersion) * viewNum); + tscDebug("hb got %u expired view, valueLen:%lu", viewNum, sizeof(SViewVersion) * viewNum); if (NULL == req->info) { req->info = taosHashInit(64, hbKeyHashFunc, 1, HASH_ENTRY_LOCK); diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 9800d233e9..d3d8ee1dc1 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -880,19 +880,21 @@ static bool incompletaFileParsing(SNode* pStmt) { return QUERY_NODE_VNODE_MODIFY_STMT != nodeType(pStmt) ? false : ((SVnodeModifyOpStmt*)pStmt)->fileProcessing; } -void continuePostSubQuery(SRequestObj* pRequest, TAOS_ROW row) { +void continuePostSubQuery(SRequestObj* pRequest, SSDataBlock* pBlock) { SSqlCallbackWrapper* pWrapper = pRequest->pWrapper; - int32_t code = nodesAcquireAllocator(pWrapper->pParseCtx->allocatorId); + + int32_t code = nodesAcquireAllocator(pWrapper->pParseCtx->allocatorId); if (TSDB_CODE_SUCCESS == code) { int64_t analyseStart = taosGetTimestampUs(); - code = qContinueParsePostQuery(pWrapper->pParseCtx, pRequest->pQuery, (void**)row); + code = qContinueParsePostQuery(pWrapper->pParseCtx, pRequest->pQuery, pBlock); pRequest->metric.analyseCostUs += taosGetTimestampUs() - analyseStart; } + if (TSDB_CODE_SUCCESS == code) { code = qContinuePlanPostQuery(pRequest->pPostPlan); } - nodesReleaseAllocator(pWrapper->pParseCtx->allocatorId); + nodesReleaseAllocator(pWrapper->pParseCtx->allocatorId); handleQueryAnslyseRes(pWrapper, NULL, code); } @@ -916,6 +918,43 @@ void returnToUser(SRequestObj* pRequest) { } } +static SSDataBlock* createResultBlock(TAOS_RES* pRes, int32_t numOfRows) { + int64_t lastTs = 0; + + TAOS_FIELD* pResFields = taos_fetch_fields(pRes); + int32_t numOfFields = taos_num_fields(pRes); + + SSDataBlock* pBlock = createDataBlock(); + + for(int32_t i = 0; i < numOfFields; ++i) { + SColumnInfoData colInfoData = createColumnInfoData(pResFields[i].type, pResFields[i].bytes, i + 1); + blockDataAppendColInfo(pBlock, &colInfoData); + } + + blockDataEnsureCapacity(pBlock, numOfRows); + + for (int32_t i = 0; i < numOfRows; ++i) { + TAOS_ROW pRow = taos_fetch_row(pRes); + int64_t ts = *(int64_t*)pRow[0]; + if (lastTs < ts) { + lastTs = ts; + } + + for(int32_t j = 0; j < numOfFields; ++j) { + SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, j); + colDataSetVal(pColInfoData, i, pRow[j], false); + } + + tscDebug("lastKey:%" PRId64 " vgId:%d, vgVer:%" PRId64, ts, *(int32_t*)pRow[1], *(int64_t*)pRow[2]); + } + + pBlock->info.window.ekey = lastTs; + pBlock->info.rows = numOfRows; + + tscDebug("lastKey:%"PRId64" numOfRows:%d from all vgroups", lastTs, numOfRows); + return pBlock; +} + void postSubQueryFetchCb(void* param, TAOS_RES* res, int32_t rowNum) { SRequestObj* pRequest = (SRequestObj*)res; if (pRequest->code) { @@ -923,19 +962,17 @@ void postSubQueryFetchCb(void* param, TAOS_RES* res, int32_t rowNum) { return; } - TAOS_ROW row = NULL; - if (rowNum > 0) { - row = taos_fetch_row(res); // for single row only now - } - + SSDataBlock* pBlock = createResultBlock(res, rowNum); SRequestObj* pNextReq = acquireRequest(pRequest->relation.nextRefId); if (pNextReq) { - continuePostSubQuery(pNextReq, row); + continuePostSubQuery(pNextReq, pBlock); releaseRequest(pRequest->relation.nextRefId); } else { tscError("0x%" PRIx64 ", next req ref 0x%" PRIx64 " is not there, reqId:0x%" PRIx64, pRequest->self, pRequest->relation.nextRefId, pRequest->requestId); } + + blockDataDestroy(pBlock); } void handlePostSubQuery(SSqlCallbackWrapper* pWrapper) { @@ -1117,6 +1154,8 @@ static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaDat .mgmtEpSet = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp), .pAstRoot = pQuery->pRoot, .showRewrite = pQuery->showRewrite, + .isView = pWrapper->pParseCtx->isView, + .isAudit = pWrapper->pParseCtx->isAudit, .pMsg = pRequest->msgBuf, .msgLen = ERROR_MSG_BUF_DEFAULT_SIZE, .pUser = pRequest->pTscObj->user, diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index 69681b9ae0..3c3aee3032 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -63,6 +63,7 @@ struct tmq_conf_t { int8_t withTbName; int8_t snapEnable; int8_t replayEnable; + int8_t sourceExcluded; // do not consume, bit uint16_t port; int32_t autoCommitInterval; char* ip; @@ -82,6 +83,7 @@ struct tmq_t { int32_t autoCommitInterval; int8_t resetOffsetCfg; int8_t replayEnable; + int8_t sourceExcluded; // do not consume, bit uint64_t consumerId; tmq_commit_cb* commitCb; void* commitCbUserParam; @@ -155,6 +157,7 @@ typedef struct { char db[TSDB_DB_FNAME_LEN]; SArray* vgs; // SArray SSchemaWrapper schema; + int8_t noPrivilege; } SMqClientTopic; typedef struct { @@ -384,6 +387,10 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value return TMQ_CONF_INVALID; } } + if (strcasecmp(key, "msg.consume.excluded") == 0) { + conf->sourceExcluded = taosStr2int64(value); + return TMQ_CONF_OK; + } if (strcasecmp(key, "td.connect.db") == 0) { return TMQ_CONF_OK; @@ -739,6 +746,30 @@ void tmqAssignDelayedCommitTask(void* param, void* tmrId) { int32_t tmqHbCb(void* param, SDataBuf* pMsg, int32_t code) { if (pMsg) { + SMqHbRsp rsp = {0}; + tDeserializeSMqHbRsp(pMsg->pData, pMsg->len, &rsp); + + int64_t refId = *(int64_t*)param; + tmq_t* tmq = taosAcquireRef(tmqMgmt.rsetId, refId); + if (tmq != NULL) { + taosWLockLatch(&tmq->lock); + for(int32_t i = 0; i < taosArrayGetSize(rsp.topicPrivileges); i++){ + STopicPrivilege* privilege = taosArrayGet(rsp.topicPrivileges, i); + if(privilege->noPrivilege == 1){ + int32_t topicNumCur = taosArrayGetSize(tmq->clientTopics); + for (int32_t j = 0; j < topicNumCur; j++) { + SMqClientTopic* pTopicCur = taosArrayGet(tmq->clientTopics, j); + if(strcmp(pTopicCur->topicName, privilege->topic) == 0){ + tscInfo("consumer:0x%" PRIx64 ", has no privilege, topic:%s", tmq->consumerId, privilege->topic); + pTopicCur->noPrivilege = 1; + } + } + } + } + taosWUnLockLatch(&tmq->lock); + taosReleaseRef(tmqMgmt.rsetId, refId); + } + tDeatroySMqHbRsp(&rsp); taosMemoryFree(pMsg->pData); taosMemoryFree(pMsg->pEpSet); } @@ -758,27 +789,26 @@ void tmqSendHbReq(void* param, void* tmrId) { req.consumerId = tmq->consumerId; req.epoch = tmq->epoch; taosRLockLatch(&tmq->lock); -// if(tmq->needReportOffsetRows){ - req.topics = taosArrayInit(taosArrayGetSize(tmq->clientTopics), sizeof(TopicOffsetRows)); - for(int i = 0; i < taosArrayGetSize(tmq->clientTopics); i++){ - SMqClientTopic* pTopic = taosArrayGet(tmq->clientTopics, i); - int32_t numOfVgroups = taosArrayGetSize(pTopic->vgs); - TopicOffsetRows* data = taosArrayReserve(req.topics, 1); - strcpy(data->topicName, pTopic->topicName); - data->offsetRows = taosArrayInit(numOfVgroups, sizeof(OffsetRows)); - for(int j = 0; j < numOfVgroups; j++){ - SMqClientVg* pVg = taosArrayGet(pTopic->vgs, j); - OffsetRows* offRows = taosArrayReserve(data->offsetRows, 1); - offRows->vgId = pVg->vgId; - offRows->rows = pVg->numOfRows; - offRows->offset = pVg->offsetInfo.beginOffset; - char buf[TSDB_OFFSET_LEN] = {0}; - tFormatOffset(buf, TSDB_OFFSET_LEN, &offRows->offset); - tscInfo("consumer:0x%" PRIx64 ",report offset: vgId:%d, offset:%s, rows:%"PRId64, tmq->consumerId, offRows->vgId, buf, offRows->rows); - } + req.topics = taosArrayInit(taosArrayGetSize(tmq->clientTopics), sizeof(TopicOffsetRows)); + for(int i = 0; i < taosArrayGetSize(tmq->clientTopics); i++){ + SMqClientTopic* pTopic = taosArrayGet(tmq->clientTopics, i); + int32_t numOfVgroups = taosArrayGetSize(pTopic->vgs); + TopicOffsetRows* data = taosArrayReserve(req.topics, 1); + strcpy(data->topicName, pTopic->topicName); + data->offsetRows = taosArrayInit(numOfVgroups, sizeof(OffsetRows)); + for(int j = 0; j < numOfVgroups; j++){ + SMqClientVg* pVg = taosArrayGet(pTopic->vgs, j); + OffsetRows* offRows = taosArrayReserve(data->offsetRows, 1); + offRows->vgId = pVg->vgId; + offRows->rows = pVg->numOfRows; + offRows->offset = pVg->offsetInfo.endOffset; + offRows->ever = pVg->offsetInfo.walVerEnd; + char buf[TSDB_OFFSET_LEN] = {0}; + tFormatOffset(buf, TSDB_OFFSET_LEN, &offRows->offset); + tscInfo("consumer:0x%" PRIx64 ",report offset, group:%s vgId:%d, offset:%s/%"PRId64", rows:%"PRId64, + tmq->consumerId, tmq->groupId, offRows->vgId, buf, offRows->ever, offRows->rows); } -// tmq->needReportOffsetRows = false; -// } + } taosRUnLockLatch(&tmq->lock); int32_t tlen = tSerializeSMqHbReq(NULL, 0, &req); @@ -809,7 +839,9 @@ void tmqSendHbReq(void* param, void* tmrId) { sendInfo->requestId = generateRequestId(); sendInfo->requestObjRefId = 0; - sendInfo->param = NULL; + sendInfo->paramFreeFp = taosMemoryFree; + sendInfo->param = taosMemoryMalloc(sizeof(int64_t)); + *(int64_t *)sendInfo->param = refId; sendInfo->fp = tmqHbCb; sendInfo->msgType = TDMT_MND_TMQ_HB; @@ -1081,6 +1113,7 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) { pTmq->commitCbUserParam = conf->commitCbUserParam; pTmq->resetOffsetCfg = conf->resetOffset; pTmq->replayEnable = conf->replayEnable; + pTmq->sourceExcluded = conf->sourceExcluded; if(conf->replayEnable){ pTmq->autoCommit = false; } @@ -1549,6 +1582,7 @@ void tmqBuildConsumeReqImpl(SMqPollReq* pReq, tmq_t* tmq, int64_t timeout, SMqCl pReq->useSnapshot = tmq->useSnapshot; pReq->reqId = generateRequestId(); pReq->enableReplay = tmq->replayEnable; + pReq->sourceExcluded = tmq->sourceExcluded; } SMqMetaRspObj* tmqBuildMetaRspFromWrapper(SMqPollRspWrapper* pWrapper) { @@ -1705,7 +1739,10 @@ static int32_t tmqPollImpl(tmq_t* tmq, int64_t timeout) { for (int i = 0; i < numOfTopics; i++) { SMqClientTopic* pTopic = taosArrayGet(tmq->clientTopics, i); int32_t numOfVg = taosArrayGetSize(pTopic->vgs); - + if(pTopic->noPrivilege){ + tscDebug("consumer:0x%" PRIx64 " has no privilegr for topic:%s", tmq->consumerId, pTopic->topicName); + continue; + } for (int j = 0; j < numOfVg; j++) { SMqClientVg* pVg = taosArrayGet(pTopic->vgs, j); if (taosGetTimestampMs() - pVg->emptyBlockReceiveTs < EMPTY_BLOCK_POLL_IDLE_DURATION) { // less than 10ms diff --git a/source/client/test/clientTests.cpp b/source/client/test/clientTests.cpp index e6519a436e..c1adc49d48 100644 --- a/source/client/test/clientTests.cpp +++ b/source/client/test/clientTests.cpp @@ -829,7 +829,10 @@ TEST(clientCase, projection_query_tables) { TAOS_RES* pRes = taos_query(pConn, "use abc1"); taos_free_result(pRes); - pRes = taos_query(pConn, "create stable st2 (ts timestamp, k int, f varchar(4096)) tags(a int)"); +// TAOS_RES* pRes = taos_query(pConn, "select tbname, last(ts) from abc1.stable_1 group by tbname"); +// taos_free_result(pRes); + + pRes = taos_query(pConn, "create stream stream_1 trigger at_once fill_history 1 ignore expired 0 into str_res1 as select _wstart as ts, count(*) from stable_1 interval(10s);"); if (taos_errno(pRes) != 0) { printf("failed to create table tu, reason:%s\n", taos_errstr(pRes)); } diff --git a/source/common/src/systable.c b/source/common/src/systable.c index 75a54a0cd5..47eac317ec 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -37,8 +37,7 @@ static const SSysDbTableSchema dnodesSchema[] = { {.name = "reboot_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true}, {.name = "note", .bytes = 256 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, #ifdef TD_ENTERPRISE - {.name = "active_code", .bytes = TSDB_ACTIVE_KEY_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, - {.name = "c_active_code", .bytes = TSDB_CONN_ACTIVE_KEY_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, + {.name = "machine_id", .bytes = TSDB_MACHINE_ID_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, #endif }; @@ -349,6 +348,24 @@ static const SSysDbTableSchema userCompactsDetailSchema[] = { {.name = "start_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false}, }; +static const SSysDbTableSchema useGrantsFullSchema[] = { + {.name = "grant_name", .bytes = 32 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, + {.name = "display_name", .bytes = 256 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, + {.name = "expire", .bytes = 32 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, + {.name = "limits", .bytes = 512 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, +}; + +static const SSysDbTableSchema useGrantsLogsSchema[] = { + {.name = "state", .bytes = 1536 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, + {.name = "active", .bytes = 512 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, + {.name = "machine", .bytes = TSDB_GRANT_LOG_COL_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, +}; + +static const SSysDbTableSchema useMachinesSchema[] = { + {.name = "id", .bytes = TSDB_CLUSTER_ID_LEN + 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, + {.name = "machine", .bytes = 7552 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, +}; + static const SSysTableMeta infosMeta[] = { {TSDB_INS_TABLE_DNODES, dnodesSchema, tListLen(dnodesSchema), true}, {TSDB_INS_TABLE_MNODES, mnodesSchema, tListLen(mnodesSchema), true}, @@ -378,6 +395,9 @@ static const SSysTableMeta infosMeta[] = { {TSDB_INS_TABLE_VIEWS, userViewsSchema, tListLen(userViewsSchema), false}, {TSDB_INS_TABLE_COMPACTS, userCompactsSchema, tListLen(userCompactsSchema), false}, {TSDB_INS_TABLE_COMPACT_DETAILS, userCompactsDetailSchema, tListLen(userCompactsDetailSchema), false}, + {TSDB_INS_TABLE_GRANTS_FULL, useGrantsFullSchema, tListLen(useGrantsFullSchema), false}, + {TSDB_INS_TABLE_GRANTS_LOGS, useGrantsLogsSchema, tListLen(useGrantsLogsSchema), false}, + {TSDB_INS_TABLE_MACHINES, useMachinesSchema, tListLen(useMachinesSchema), false}, }; static const SSysDbTableSchema connectionsSchema[] = { diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index a7d80fe5db..baa2a233d5 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -27,7 +27,7 @@ #include "cus_name.h" #endif -GRANT_CFG_DECLARE; +// GRANT_CFG_DECLARE; SConfig *tsCfg = NULL; @@ -58,7 +58,7 @@ int32_t tsNumOfMnodeQueryThreads = 4; int32_t tsNumOfMnodeFetchThreads = 1; int32_t tsNumOfMnodeReadThreads = 1; int32_t tsNumOfVnodeQueryThreads = 4; -float tsRatioOfVnodeStreamThreads = 1.0; +float tsRatioOfVnodeStreamThreads = 0.5F; int32_t tsNumOfVnodeFetchThreads = 4; int32_t tsNumOfVnodeRsmaThreads = 2; int32_t tsNumOfQnodeQueryThreads = 4; @@ -265,6 +265,7 @@ bool tsDisableStream = false; int64_t tsStreamBufferSize = 128 * 1024 * 1024; bool tsFilterScalarMode = false; int tsResolveFQDNRetryTime = 100; // seconds +int tsStreamAggCnt = 1000; char tsS3Endpoint[TSDB_FQDN_LEN] = ""; char tsS3AccessKey[TSDB_FQDN_LEN] = ""; @@ -622,7 +623,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { 0) return -1; - if (cfgAddFloat(pCfg, "ratioOfVnodeStreamThreads", tsRatioOfVnodeStreamThreads, 0.01, 10, CFG_SCOPE_SERVER, + if (cfgAddFloat(pCfg, "ratioOfVnodeStreamThreads", tsRatioOfVnodeStreamThreads, 0.01, 4, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1; @@ -750,6 +751,8 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddBool(pCfg, "disableStream", tsDisableStream, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER) != 0) return -1; if (cfgAddInt64(pCfg, "streamBufferSize", tsStreamBufferSize, 0, INT64_MAX, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) return -1; + if (cfgAddInt64(pCfg, "streamAggCnt", tsStreamAggCnt, 2, INT32_MAX, CFG_SCOPE_SERVER, CFG_DYN_NONE) != 0) + return -1; if (cfgAddInt32(pCfg, "checkpointInterval", tsStreamCheckpointInterval, 60, 1200, CFG_SCOPE_SERVER, CFG_DYN_ENT_SERVER) != 0) @@ -804,7 +807,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddBool(pCfg, "experimental", tsExperimental, CFG_SCOPE_BOTH, CFG_DYN_BOTH) != 0) return -1; - GRANT_CFG_ADD; + // GRANT_CFG_ADD; return 0; } @@ -1213,6 +1216,8 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsDisableStream = cfgGetItem(pCfg, "disableStream")->bval; tsStreamBufferSize = cfgGetItem(pCfg, "streamBufferSize")->i64; + tsStreamAggCnt = cfgGetItem(pCfg, "streamAggCnt")->i32; + tsStreamBufferSize = cfgGetItem(pCfg, "streamBufferSize")->i64; tsStreamCheckpointInterval = cfgGetItem(pCfg, "checkpointInterval")->i32; tsSinkDataRate = cfgGetItem(pCfg, "streamSinkDataRate")->fval; @@ -1229,7 +1234,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsExperimental = cfgGetItem(pCfg, "experimental")->bval; - GRANT_CFG_GET; + // GRANT_CFG_GET; return 0; } @@ -1801,4 +1806,17 @@ void taosSetAllDebugFlag(int32_t flag) { if (terrno == TSDB_CODE_CFG_NOT_FOUND) terrno = TSDB_CODE_SUCCESS; // ignore not exist } -int8_t taosGranted() { return atomic_load_8(&tsGrant); } +int8_t taosGranted(int8_t type) { + switch (type) { + case TSDB_GRANT_ALL: + return atomic_load_8(&tsGrant) & GRANT_FLAG_ALL; + case TSDB_GRANT_AUDIT: + return atomic_load_8(&tsGrant) & GRANT_FLAG_AUDIT; + case TSDB_GRANT_VIEW: + return atomic_load_8(&tsGrant) & GRANT_FLAG_VIEW; + default: + ASSERTS(0, "undefined grant type:%" PRIi8, type); + break; + } + return 0; +} \ No newline at end of file diff --git a/source/common/src/tgrant.c b/source/common/src/tgrant.c index 74a59fd580..2b5d91788e 100644 --- a/source/common/src/tgrant.c +++ b/source/common/src/tgrant.c @@ -19,5 +19,13 @@ #ifndef _GRANT int32_t grantCheck(EGrantType grant) { return TSDB_CODE_SUCCESS; } +int32_t grantCheckExpire(EGrantType grant) { return TSDB_CODE_SUCCESS; } +#ifdef TD_UNIQ_GRANT +int32_t grantCheckLE(EGrantType grant) { return TSDB_CODE_SUCCESS; } +#endif +#else +#ifdef TD_UNIQ_GRANT +int32_t grantCheckExpire(EGrantType grant) { return TSDB_CODE_SUCCESS; } +#endif #endif \ No newline at end of file diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index c9e2908e8a..2ffa12f2c1 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -1163,9 +1163,11 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) { if (tEncodeI64(&encoder, pReq->updateTime) < 0) return -1; if (tEncodeFloat(&encoder, pReq->numOfCores) < 0) return -1; if (tEncodeI32(&encoder, pReq->numOfSupportVnodes) < 0) return -1; + if (tEncodeI32v(&encoder, pReq->numOfDiskCfg) < 0) return -1; if (tEncodeI64(&encoder, pReq->memTotal) < 0) return -1; if (tEncodeI64(&encoder, pReq->memAvail) < 0) return -1; if (tEncodeCStr(&encoder, pReq->dnodeEp) < 0) return -1; + if (tEncodeCStr(&encoder, pReq->machineId) < 0) return -1; // cluster cfg if (tEncodeI32(&encoder, pReq->clusterCfg.statusInterval) < 0) return -1; @@ -1253,9 +1255,11 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) { if (tDecodeI64(&decoder, &pReq->updateTime) < 0) return -1; if (tDecodeFloat(&decoder, &pReq->numOfCores) < 0) return -1; if (tDecodeI32(&decoder, &pReq->numOfSupportVnodes) < 0) return -1; + if (tDecodeI32v(&decoder, &pReq->numOfDiskCfg) < 0) return -1; if (tDecodeI64(&decoder, &pReq->memTotal) < 0) return -1; if (tDecodeI64(&decoder, &pReq->memAvail) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->dnodeEp) < 0) return -1; + if (tDecodeCStrTo(&decoder, pReq->machineId) < 0) return -1; // cluster cfg if (tDecodeI32(&decoder, &pReq->clusterCfg.statusInterval) < 0) return -1; @@ -2266,6 +2270,37 @@ int32_t tDeserializeSGetUserWhiteListRsp(void *buf, int32_t bufLen, SGetUserWhit void tFreeSGetUserWhiteListRsp(SGetUserWhiteListRsp *pRsp) { taosMemoryFree(pRsp->pWhiteLists); } +int32_t tSerializeSMCfgClusterReq(void *buf, int32_t bufLen, SMCfgClusterReq *pReq) { + SEncoder encoder = {0}; + tEncoderInit(&encoder, buf, bufLen); + + if (tStartEncode(&encoder) < 0) return -1; + if (tEncodeCStr(&encoder, pReq->config) < 0) return -1; + if (tEncodeCStr(&encoder, pReq->value) < 0) return -1; + ENCODESQL(); + tEndEncode(&encoder); + + int32_t tlen = encoder.pos; + tEncoderClear(&encoder); + return tlen; +} + +int32_t tDeserializeSMCfgClusterReq(void *buf, int32_t bufLen, SMCfgClusterReq *pReq) { + SDecoder decoder = {0}; + tDecoderInit(&decoder, buf, bufLen); + + if (tStartDecode(&decoder) < 0) return -1; + if (tDecodeCStrTo(&decoder, pReq->config) < 0) return -1; + if (tDecodeCStrTo(&decoder, pReq->value) < 0) return -1; + DECODESQL(); + tEndDecode(&decoder); + + tDecoderClear(&decoder); + return 0; +} + +void tFreeSMCfgClusterReq(SMCfgClusterReq *pReq) { FREESQL(); } + int32_t tSerializeSCreateDropMQSNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) { SEncoder encoder = {0}; tEncoderInit(&encoder, buf, bufLen); @@ -6139,6 +6174,55 @@ int32_t tDeserializeSMqAskEpReq(void *buf, int32_t bufLen, SMqAskEpReq *pReq) { return 0; } +int32_t tDeatroySMqHbRsp(SMqHbRsp *pRsp) { + taosArrayDestroy(pRsp->topicPrivileges); + return 0; +} + +int32_t tSerializeSMqHbRsp(void *buf, int32_t bufLen, SMqHbRsp *pRsp) { + SEncoder encoder = {0}; + tEncoderInit(&encoder, buf, bufLen); + if (tStartEncode(&encoder) < 0) return -1; + + int32_t sz = taosArrayGetSize(pRsp->topicPrivileges); + if (tEncodeI32(&encoder, sz) < 0) return -1; + for (int32_t i = 0; i < sz; ++i) { + STopicPrivilege *privilege = (STopicPrivilege *)taosArrayGet(pRsp->topicPrivileges, i); + if (tEncodeCStr(&encoder, privilege->topic) < 0) return -1; + if (tEncodeI8(&encoder, privilege->noPrivilege) < 0) return -1; + } + + tEndEncode(&encoder); + + int32_t tlen = encoder.pos; + tEncoderClear(&encoder); + + return tlen; +} + +int32_t tDeserializeSMqHbRsp(void *buf, int32_t bufLen, SMqHbRsp *pRsp) { + SDecoder decoder = {0}; + tDecoderInit(&decoder, (char *)buf, bufLen); + + if (tStartDecode(&decoder) < 0) return -1; + + int32_t sz = 0; + if (tDecodeI32(&decoder, &sz) < 0) return -1; + if (sz > 0) { + pRsp->topicPrivileges = taosArrayInit(sz, sizeof(STopicPrivilege)); + if (NULL == pRsp->topicPrivileges) return -1; + for (int32_t i = 0; i < sz; ++i) { + STopicPrivilege *data = taosArrayReserve(pRsp->topicPrivileges, 1); + if (tDecodeCStrTo(&decoder, data->topic) < 0) return -1; + if (tDecodeI8(&decoder, &data->noPrivilege) < 0) return -1; + } + } + tEndDecode(&decoder); + + tDecoderClear(&decoder); + return 0; +} + int32_t tDeatroySMqHbReq(SMqHbReq *pReq) { for (int i = 0; i < taosArrayGetSize(pReq->topics); i++) { TopicOffsetRows *vgs = taosArrayGet(pReq->topics, i); @@ -6168,6 +6252,7 @@ int32_t tSerializeSMqHbReq(void *buf, int32_t bufLen, SMqHbReq *pReq) { if (tEncodeI32(&encoder, offRows->vgId) < 0) return -1; if (tEncodeI64(&encoder, offRows->rows) < 0) return -1; if (tEncodeSTqOffsetVal(&encoder, &offRows->offset) < 0) return -1; + if (tEncodeI64(&encoder, offRows->ever) < 0) return -1; } } @@ -6194,7 +6279,7 @@ int32_t tDeserializeSMqHbReq(void *buf, int32_t bufLen, SMqHbReq *pReq) { if (NULL == pReq->topics) return -1; for (int32_t i = 0; i < sz; ++i) { TopicOffsetRows *data = taosArrayReserve(pReq->topics, 1); - tDecodeCStrTo(&decoder, data->topicName); + if (tDecodeCStrTo(&decoder, data->topicName) < 0) return -1; int32_t szVgs = 0; if (tDecodeI32(&decoder, &szVgs) < 0) return -1; if (szVgs > 0) { @@ -6205,6 +6290,7 @@ int32_t tDeserializeSMqHbReq(void *buf, int32_t bufLen, SMqHbReq *pReq) { if (tDecodeI32(&decoder, &offRows->vgId) < 0) return -1; if (tDecodeI64(&decoder, &offRows->rows) < 0) return -1; if (tDecodeSTqOffsetVal(&decoder, &offRows->offset) < 0) return -1; + if (tDecodeI64(&decoder, &offRows->ever) < 0) return -1; } } } @@ -6516,6 +6602,7 @@ int32_t tSerializeSMqPollReq(void *buf, int32_t bufLen, SMqPollReq *pReq) { if (tEncodeI64(&encoder, pReq->timeout) < 0) return -1; if (tSerializeSTqOffsetVal(&encoder, &pReq->reqOffset) < 0) return -1; if (tEncodeI8(&encoder, pReq->enableReplay) < 0) return -1; + if (tEncodeI8(&encoder, pReq->sourceExcluded) < 0) return -1; tEndEncode(&encoder); @@ -6556,6 +6643,10 @@ int32_t tDeserializeSMqPollReq(void *buf, int32_t bufLen, SMqPollReq *pReq) { if (tDecodeI8(&decoder, &pReq->enableReplay) < 0) return -1; } + if (!tDecodeIsEnd(&decoder)) { + if (tDecodeI8(&decoder, &pReq->sourceExcluded) < 0) return -1; + } + tEndDecode(&decoder); tDecoderClear(&decoder); @@ -7168,6 +7259,7 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS if (tEncodeI8(&encoder, pReq->createStb) < 0) return -1; if (tEncodeU64(&encoder, pReq->targetStbUid) < 0) return -1; + if (tEncodeI32(&encoder, taosArrayGetSize(pReq->fillNullCols)) < 0) return -1; for (int32_t i = 0; i < taosArrayGetSize(pReq->fillNullCols); ++i) { SColLocation *pCol = taosArrayGet(pReq->fillNullCols, i); @@ -7175,10 +7267,19 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS if (tEncodeI16(&encoder, pCol->colId) < 0) return -1; if (tEncodeI8(&encoder, pCol->type) < 0) return -1; } + if (tEncodeI64(&encoder, pReq->deleteMark) < 0) return -1; if (tEncodeI8(&encoder, pReq->igUpdate) < 0) return -1; if (tEncodeI64(&encoder, pReq->lastTs) < 0) return -1; + if (tEncodeI32(&encoder, taosArrayGetSize(pReq->pVgroupVerList)) < 0) return -1; + + for(int32_t i = 0; i < taosArrayGetSize(pReq->pVgroupVerList); ++i) { + SVgroupVer* p = taosArrayGet(pReq->pVgroupVerList, i); + if (tEncodeI32(&encoder, p->vgId) < 0) return -1; + if (tEncodeI64(&encoder, p->ver) < 0) return -1; + } + tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -7189,6 +7290,8 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStreamReq *pReq) { int32_t sqlLen = 0; int32_t astLen = 0; + int32_t numOfFillNullCols = 0; + int32_t numOfVgVer = 0; SDecoder decoder = {0}; tDecoderInit(&decoder, buf, bufLen); @@ -7240,7 +7343,6 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea } if (tDecodeI8(&decoder, &pReq->createStb) < 0) return -1; if (tDecodeU64(&decoder, &pReq->targetStbUid) < 0) return -1; - int32_t numOfFillNullCols = 0; if (tDecodeI32(&decoder, &numOfFillNullCols) < 0) return -1; if (numOfFillNullCols > 0) { pReq->fillNullCols = taosArrayInit(numOfFillNullCols, sizeof(SColLocation)); @@ -7265,9 +7367,28 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea if (tDecodeI8(&decoder, &pReq->igUpdate) < 0) return -1; if (tDecodeI64(&decoder, &pReq->lastTs) < 0) return -1; - tEndDecode(&decoder); + if (tDecodeI32(&decoder, &numOfVgVer) < 0) return -1; + if (numOfVgVer > 0) { + pReq->pVgroupVerList = taosArrayInit(numOfVgVer, sizeof(SVgroupVer)); + if (pReq->pVgroupVerList == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + for (int32_t i = 0; i < numOfVgVer; ++i) { + SVgroupVer v = {0}; + if (tDecodeI32(&decoder, &v.vgId) < 0) return -1; + if (tDecodeI64(&decoder, &v.ver) < 0) return -1; + if (taosArrayPush(pReq->pVgroupVerList, &v) == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + } + } + + tEndDecode(&decoder); tDecoderClear(&decoder); + return 0; } @@ -7339,10 +7460,11 @@ void tFreeSCMCreateStreamReq(SCMCreateStreamReq *pReq) { if (NULL == pReq) { return; } - taosArrayDestroy(pReq->pTags); taosMemoryFreeClear(pReq->sql); taosMemoryFreeClear(pReq->ast); + taosArrayDestroy(pReq->pTags); taosArrayDestroy(pReq->fillNullCols); + taosArrayDestroy(pReq->pVgroupVerList); } int32_t tEncodeSRSmaParam(SEncoder *pCoder, const SRSmaParam *pRSmaParam) { @@ -7753,36 +7875,6 @@ static int32_t tDecodeSVSubmitBlk(SDecoder *pCoder, SVSubmitBlk *pBlock, int32_t return 0; } -int32_t tEncodeSVSubmitReq(SEncoder *pCoder, const SVSubmitReq *pReq) { - int32_t nBlocks = taosArrayGetSize(pReq->pArray); - - if (tStartEncode(pCoder) < 0) return -1; - - if (tEncodeI32v(pCoder, pReq->flags) < 0) return -1; - if (tEncodeI32v(pCoder, nBlocks) < 0) return -1; - for (int32_t iBlock = 0; iBlock < nBlocks; iBlock++) { - if (tEncodeSVSubmitBlk(pCoder, (SVSubmitBlk *)taosArrayGet(pReq->pArray, iBlock), pReq->flags) < 0) return -1; - } - - tEndEncode(pCoder); - return 0; -} - -int32_t tDecodeSVSubmitReq(SDecoder *pCoder, SVSubmitReq *pReq) { - if (tStartDecode(pCoder) < 0) return -1; - - if (tDecodeI32v(pCoder, &pReq->flags) < 0) return -1; - if (tDecodeI32v(pCoder, &pReq->nBlocks) < 0) return -1; - pReq->pBlocks = tDecoderMalloc(pCoder, sizeof(SVSubmitBlk) * pReq->nBlocks); - if (pReq->pBlocks == NULL) return -1; - for (int32_t iBlock = 0; iBlock < pReq->nBlocks; iBlock++) { - if (tDecodeSVSubmitBlk(pCoder, pReq->pBlocks + iBlock, pReq->flags) < 0) return -1; - } - - tEndDecode(pCoder); - return 0; -} - static int32_t tEncodeSSubmitBlkRsp(SEncoder *pEncoder, const SSubmitBlkRsp *pBlock) { if (tStartEncode(pEncoder) < 0) return -1; @@ -8578,6 +8670,7 @@ static int32_t tEncodeSSubmitTbData(SEncoder *pCoder, const SSubmitTbData *pSubm } } if (tEncodeI64(pCoder, pSubmitTbData->ctimeMs) < 0) return -1; + if (tEncodeI8(pCoder, pSubmitTbData->source) < 0) return -1; tEndEncode(pCoder); return 0; @@ -8665,6 +8758,12 @@ static int32_t tDecodeSSubmitTbData(SDecoder *pCoder, SSubmitTbData *pSubmitTbDa goto _exit; } } + if (!tDecodeIsEnd(pCoder)) { + if (tDecodeI8(pCoder, &pSubmitTbData->source) < 0) { + code = TSDB_CODE_INVALID_MSG; + goto _exit; + } + } tEndDecode(pCoder); diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index 14853009e0..a3a29f6f77 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -114,9 +114,15 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) { req.updateTime = pMgmt->pData->updateTime; req.numOfCores = tsNumOfCores; req.numOfSupportVnodes = tsNumOfSupportVnodes; + req.numOfDiskCfg = tsDiskCfgNum; req.memTotal = tsTotalMemoryKB * 1024; req.memAvail = req.memTotal - tsRpcQueueMemoryAllowed - 16 * 1024 * 1024; tstrncpy(req.dnodeEp, tsLocalEp, TSDB_EP_LEN); + char *machine = tGetMachineId(); + if (machine) { + tstrncpy(req.machineId, machine, TSDB_MACHINE_ID_LEN + 1); + taosMemoryFreeClear(machine); + } req.clusterCfg.statusInterval = tsStatusInterval; req.clusterCfg.checkTime = 0; @@ -319,7 +325,7 @@ int32_t dmAppendVariablesToBlock(SSDataBlock *pBlock, int32_t dnodeId) { for (int32_t i = 0, c = 0; i < numOfCfg; ++i, c = 0) { SConfigItem *pItem = taosArrayGet(tsCfg->array, i); - GRANT_CFG_SKIP; + // GRANT_CFG_SKIP; SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, c++); colDataSetVal(pColInfo, i, (const char *)&dnodeId, false); @@ -429,7 +435,7 @@ SArray *dmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_DND_CONFIG_DNODE, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_DND_SERVER_STATUS, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_DND_SYSTABLE_RETRIEVE, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_DND_ALTER_MNODE_TYPE, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_DND_ALTER_MNODE_TYPE, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER; // Requests handled by MNODE if (dmSetMgmtHandle(pArray, TDMT_MND_GRANT, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c index ec79e1f6c4..531e6f4b3d 100644 --- a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c +++ b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c @@ -163,7 +163,6 @@ SArray *mmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_STREAM, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_PAUSE_STREAM, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_RESUME_STREAM, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_MND_GRANT_RSP, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_RETRIEVE_IP_WHITE, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_GET_USER_WHITELIST, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; @@ -193,6 +192,7 @@ SArray *mmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_VIEW, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_VIEW_META, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_KILL_COMPACT, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_MND_CONFIG_CLUSTER, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY_COMPACT_PROGRESS_RSP, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY, mmPutMsgToQueryQueue, 1) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h b/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h index cb3395dcc2..bc6a4652e7 100644 --- a/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h +++ b/source/dnode/mgmt/node_mgmt/inc/dmMgmt.h @@ -72,7 +72,6 @@ typedef struct SUdfdData { int32_t dnodeId; } SUdfdData; -#ifndef TD_MODULE_OPTIMIZE typedef struct SDnode { int8_t once; bool stop; @@ -86,21 +85,6 @@ typedef struct SDnode { SMgmtWrapper wrappers[NODE_END]; SDnodeTrans trans; } SDnode; -#else -typedef struct SDnode { - int8_t once; - bool stop; - EDndRunStatus status; - SStartupInfo startup; - SDnodeTrans trans; - SUdfdData udfdData; - TdThreadMutex mutex; - TdFilePtr lockfile; - SDnodeData data; - STfs *pTfs; - SMgmtWrapper wrappers[NODE_END]; -} SDnode; -#endif // dmEnv.c SDnode *dmInstance(); @@ -115,12 +99,7 @@ int32_t dmMarkWrapper(SMgmtWrapper *pWrapper); void dmReleaseWrapper(SMgmtWrapper *pWrapper); int32_t dmInitVars(SDnode *pDnode); void dmClearVars(SDnode *pDnode); -#ifdef TD_MODULE_OPTIMIZE -int32_t dmInitModule(SDnode *pDnode, SMgmtWrapper *wrappers); -bool dmRequireNode(SDnode *pDnode, SMgmtWrapper *pWrapper); -#else -int32_t dmInitModule(SDnode *pDnode); -#endif +int32_t dmInitModule(SDnode *pDnode); SMgmtInputOpt dmBuildMgmtInputOpt(SMgmtWrapper *pWrapper); void dmSetStatus(SDnode *pDnode, EDndRunStatus stype); void dmProcessServerStartupStatus(SDnode *pDnode, SRpcMsg *pMsg); @@ -143,11 +122,7 @@ void dmCleanupClient(SDnode *pDnode); void dmCleanupStatusClient(SDnode *pDnode); void dmCleanupSyncClient(SDnode *pDnode); SMsgCb dmGetMsgcb(SDnode *pDnode); -#ifdef TD_MODULE_OPTIMIZE -int32_t dmInitMsgHandle(SDnode *pDnode, SMgmtWrapper *wrappers); -#else int32_t dmInitMsgHandle(SDnode *pDnode); -#endif int32_t dmProcessNodeMsg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg); // dmMonitor.c diff --git a/source/dnode/mgmt/node_mgmt/src/dmMgmt.c b/source/dnode/mgmt/node_mgmt/src/dmMgmt.c index 1a222a3fd4..6cbf31b15f 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmMgmt.c +++ b/source/dnode/mgmt/node_mgmt/src/dmMgmt.c @@ -24,7 +24,6 @@ #include "tglobal.h" #endif -#ifndef TD_MODULE_OPTIMIZE static bool dmRequireNode(SDnode *pDnode, SMgmtWrapper *pWrapper) { SMgmtInputOpt input = dmBuildMgmtInputOpt(pWrapper); @@ -38,7 +37,6 @@ static bool dmRequireNode(SDnode *pDnode, SMgmtWrapper *pWrapper) { return required; } -#endif int32_t dmInitDnode(SDnode *pDnode) { dDebug("start to create dnode"); @@ -81,15 +79,9 @@ int32_t dmInitDnode(SDnode *pDnode) { if (pDnode->lockfile == NULL) { goto _OVER; } -#ifdef TD_MODULE_OPTIMIZE - if (dmInitModule(pDnode, pDnode->wrappers) != 0) { - goto _OVER; - } -#else if (dmInitModule(pDnode) != 0) { goto _OVER; } -#endif indexInit(tsNumOfCommitThreads); streamMetaInit(); diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index 479b3b6aa3..1a31f08801 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -251,33 +251,6 @@ _OVER: dmReleaseWrapper(pWrapper); } -#ifdef TD_MODULE_OPTIMIZE -int32_t dmInitMsgHandle(SDnode *pDnode, SMgmtWrapper *wrappers) { - SDnodeTrans *pTrans = &pDnode->trans; - - for (EDndNodeType ntype = DNODE; ntype < NODE_END; ++ntype) { - SMgmtWrapper *pWrapper = wrappers + ntype; - SArray *pArray = (*pWrapper->func.getHandlesFp)(); - if (pArray == NULL) return -1; - - for (int32_t i = 0; i < taosArrayGetSize(pArray); ++i) { - SMgmtHandle *pMgmt = taosArrayGet(pArray, i); - SDnodeHandle *pHandle = &pTrans->msgHandles[TMSG_INDEX(pMgmt->msgType)]; - if (pMgmt->needCheckVgId) { - pHandle->needCheckVgId = pMgmt->needCheckVgId; - } - if (!pMgmt->needCheckVgId) { - pHandle->defaultNtype = ntype; - } - pWrapper->msgFps[TMSG_INDEX(pMgmt->msgType)] = pMgmt->msgFp; - } - - taosArrayDestroy(pArray); - } - - return 0; -} -#else int32_t dmInitMsgHandle(SDnode *pDnode) { SDnodeTrans *pTrans = &pDnode->trans; @@ -303,7 +276,6 @@ int32_t dmInitMsgHandle(SDnode *pDnode) { return 0; } -#endif static inline int32_t dmSendReq(const SEpSet *pEpSet, SRpcMsg *pMsg) { SDnode *pDnode = dmInstance(); diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index b056d561c7..19de4561d6 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -76,6 +76,7 @@ typedef enum { MND_OPER_DROP_TOPIC, MND_OPER_CREATE_VIEW, MND_OPER_DROP_VIEW, + MND_OPER_CONFIG_CLUSTER, } EOperType; typedef enum { @@ -204,6 +205,7 @@ typedef struct { int32_t numOfVnodes; int32_t numOfOtherNodes; int32_t numOfSupportVnodes; + int32_t numOfDiskCfg; float numOfCores; int64_t memTotal; int64_t memAvail; @@ -214,6 +216,7 @@ typedef struct { char ep[TSDB_EP_LEN]; char active[TSDB_ACTIVE_KEY_LEN]; char connActive[TSDB_CONN_ACTIVE_KEY_LEN]; + char machineId[TSDB_MACHINE_ID_LEN + 1]; } SDnodeObj; typedef struct { @@ -553,7 +556,7 @@ typedef struct { } SMqConsumerObj; SMqConsumerObj* tNewSMqConsumerObj(int64_t consumerId, char cgroup[TSDB_CGROUP_LEN]); -void tDeleteSMqConsumerObj(SMqConsumerObj* pConsumer, bool delete); +void tDeleteSMqConsumerObj(SMqConsumerObj* pConsumer, bool isDeleted); int32_t tEncodeSMqConsumerObj(void** buf, const SMqConsumerObj* pConsumer); void* tDecodeSMqConsumerObj(const void* buf, SMqConsumerObj* pConsumer, int8_t sver); @@ -694,6 +697,8 @@ typedef struct { // 3.0.5. int64_t checkpointId; + + int32_t indexForMultiAggBalance; char reserve[256]; } SStreamObj; @@ -753,6 +758,77 @@ typedef struct { SArray* compactDetail; } SCompactObj; +// SGrantLogObj +typedef enum { + GRANT_STATE_INIT = 0, + GRANT_STATE_UNGRANTED = 1, + GRANT_STATE_GRANTED = 2, + GRANT_STATE_EXPIRED = 3, + GRANT_STATE_REVOKED = 4, + GRANT_STATE_MAX, +} EGrantState; + +typedef enum { + GRANT_STATE_REASON_INIT = 0, + GRANT_STATE_REASON_ALTER = 1, // alter activeCode 'revoked' or 'xxx' + GRANT_STATE_REASON_MISMATCH = 2, // dnode machine mismatch + GRANT_STATE_REASON_EXPIRE = 3, // expire + GRANT_STATE_REASON_MAX, +} EGrantStateReason; + +#define GRANT_STATE_NUM 30 +#define GRANT_ACTIVE_NUM 10 +#define GRANT_ACTIVE_HEAD_LEN 30 + +typedef struct { + union { + int64_t u0; + struct { + int64_t ts : 40; + int64_t lastState : 4; + int64_t state : 4; + int64_t reason : 8; + int64_t reserve : 8; + }; + }; +} SGrantState; + +typedef struct { + union { + int64_t u0; + struct { + int64_t ts : 40; + int64_t reserve : 24; + }; + }; + char active[GRANT_ACTIVE_HEAD_LEN + 1]; +} SGrantActive; + +typedef struct { + union { + int64_t u0; + struct { + int64_t ts : 40; + int64_t id : 24; + }; + }; + char machine[TSDB_MACHINE_ID_LEN + 1]; +} SGrantMachine; + +typedef struct { + int32_t id; + int8_t nStates; + int8_t nActives; + int64_t createTime; + int64_t updateTime; + int64_t upgradeTime; + SGrantState states[GRANT_STATE_NUM]; + SGrantActive actives[GRANT_ACTIVE_NUM]; + char* active; + SArray* pMachines; // SGrantMachine + SRWLatch lock; +} SGrantLogObj; + #ifdef __cplusplus } #endif diff --git a/source/dnode/mnode/impl/inc/mndGrant.h b/source/dnode/mnode/impl/inc/mndGrant.h index 88f118cb8f..3d51738c70 100644 --- a/source/dnode/mnode/impl/inc/mndGrant.h +++ b/source/dnode/mnode/impl/inc/mndGrant.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_GTANT_H -#define TDENGINE_GTANT_H +#ifndef _TD_MND_GRANT_H_ +#define _TD_MND_GRANT_H_ #ifdef __cplusplus "C" { @@ -29,6 +29,24 @@ void grantAdd(EGrantType grant, uint64_t value); void grantRestore(EGrantType grant, uint64_t value); +#ifdef TD_ENTERPRISE + SSdbRaw *mndGrantActionEncode(SGrantLogObj * pGrant); + SSdbRow *mndGrantActionDecode(SSdbRaw * pRaw); + int32_t mndGrantActionInsert(SSdb * pSdb, SGrantLogObj * pGrant); + int32_t mndGrantActionDelete(SSdb * pSdb, SGrantLogObj * pGrant); + int32_t mndGrantActionUpdate(SSdb * pSdb, SGrantLogObj * pOldGrant, SGrantLogObj * pNewGrant); + + int32_t grantAlterActiveCode(SMnode * pMnode, SGrantLogObj * pObj, const char *oldActive, const char *newActive, + char **mergeActive); + + int32_t mndProcessConfigGrantReq(SMnode * pMnode, SRpcMsg * pReq, SMCfgClusterReq * pCfg); + int32_t mndProcessUpdGrantLog(SMnode * pMnode, SRpcMsg * pReq, SArray * pMachines, SGrantState * pState); + + int32_t mndGrantGetLastState(SMnode * pMnode, SGrantState * pState); + SGrantLogObj *mndAcquireGrant(SMnode * pMnode, void **ppIter); + void mndReleaseGrant(SMnode * pMnode, SGrantLogObj * pGrant, void *pIter); +#endif + #ifdef __cplusplus } #endif diff --git a/source/dnode/mnode/impl/inc/mndPrivilege.h b/source/dnode/mnode/impl/inc/mndPrivilege.h index 4a8fb20715..6f74ea3b36 100644 --- a/source/dnode/mnode/impl/inc/mndPrivilege.h +++ b/source/dnode/mnode/impl/inc/mndPrivilege.h @@ -30,7 +30,6 @@ int32_t mndCheckDbPrivilege(SMnode *pMnode, const char *user, EOperType operType int32_t mndCheckDbPrivilegeByName(SMnode *pMnode, const char *user, EOperType operType, const char *dbname); int32_t mndCheckViewPrivilege(SMnode *pMnode, const char *user, EOperType operType, const char *pViewFName); int32_t mndCheckTopicPrivilege(SMnode *pMnode, const char *user, EOperType operType, SMqTopicObj *pTopic); -int32_t mndCheckTopicPrivilegeByName(SMnode *pMnode, const char *user, EOperType operType, const char *topicName); int32_t mndCheckShowPrivilege(SMnode *pMnode, const char *user, EShowType showType, const char *dbname); int32_t mndCheckAlterUserPrivilege(SUserObj *pOperUser, SUserObj *pUser, SAlterUserReq *pAlter); int32_t mndSetUserAuthRsp(SMnode *pMnode, SUserObj *pUser, SGetUserAuthRsp *pRsp); diff --git a/source/dnode/mnode/impl/inc/mndScheduler.h b/source/dnode/mnode/impl/inc/mndScheduler.h index cba52c6b45..3c51f34fee 100644 --- a/source/dnode/mnode/impl/inc/mndScheduler.h +++ b/source/dnode/mnode/impl/inc/mndScheduler.h @@ -27,7 +27,7 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib int32_t mndConvertRsmaTask(char** pDst, int32_t* pDstLen, const char* ast, int64_t uid, int8_t triggerType, int64_t watermark, int64_t deleteMark); -int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream, int64_t nextWindowSkey); +int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream, int64_t skey, SArray* pVerList); #ifdef __cplusplus } diff --git a/source/dnode/mnode/impl/inc/mndStream.h b/source/dnode/mnode/impl/inc/mndStream.h index d884227249..4d1125a340 100644 --- a/source/dnode/mnode/impl/inc/mndStream.h +++ b/source/dnode/mnode/impl/inc/mndStream.h @@ -26,9 +26,17 @@ extern "C" { #define MND_STREAM_RESERVE_SIZE 64 #define MND_STREAM_VER_NUMBER 4 +#define MND_STREAM_CREATE_NAME "stream-create" +#define MND_STREAM_CHECKPOINT_NAME "stream-checkpoint" +#define MND_STREAM_PAUSE_NAME "stream-pause" +#define MND_STREAM_RESUME_NAME "stream-resume" +#define MND_STREAM_DROP_NAME "stream-drop" +#define MND_STREAM_TASK_RESET_NAME "stream-task-reset" +#define MND_STREAM_TASK_UPDATE_NAME "stream-task-update" + typedef struct SStreamTransInfo { int64_t startTime; - int64_t streamUid; + int64_t streamId; const char *name; int32_t transId; } SStreamTransInfo; @@ -41,7 +49,7 @@ typedef struct SVgroupChangeInfo { // time to generated the checkpoint, if now() - checkpointTs >= tsCheckpointInterval, this checkpoint will be discard // to avoid too many checkpoints for a taskk in the waiting list typedef struct SCheckpointCandEntry { - char * pName; + char *pName; int64_t streamId; int64_t checkpointTs; int64_t checkpointId; @@ -62,6 +70,9 @@ typedef struct SStreamExecInfo { SHashObj *pTransferStateStreams; } SStreamExecInfo; +extern SStreamExecInfo execInfo; +typedef struct SStreamTaskIter SStreamTaskIter; + typedef struct SNodeEntry { int32_t nodeId; bool stageUpdated; // the stage has been updated due to the leader/follower change or node reboot. @@ -69,15 +80,11 @@ typedef struct SNodeEntry { int64_t hbTimestamp; // second } SNodeEntry; -#define MND_STREAM_CREATE_NAME "stream-create" -#define MND_STREAM_CHECKPOINT_NAME "stream-checkpoint" -#define MND_STREAM_PAUSE_NAME "stream-pause" -#define MND_STREAM_RESUME_NAME "stream-resume" -#define MND_STREAM_DROP_NAME "stream-drop" -#define MND_STREAM_TASK_RESET_NAME "stream-task-reset" -#define MND_STREAM_TASK_UPDATE_NAME "stream-task-update" - -extern SStreamExecInfo execInfo; +typedef struct SOrphanTask { + int64_t streamId; + int32_t taskId; + int32_t nodeId; +} SOrphanTask; int32_t mndInitStream(SMnode *pMnode); void mndCleanupStream(SMnode *pMnode); @@ -85,41 +92,39 @@ SStreamObj *mndAcquireStream(SMnode *pMnode, char *streamName); void mndReleaseStream(SMnode *pMnode, SStreamObj *pStream); int32_t mndDropStreamByDb(SMnode *pMnode, STrans *pTrans, SDbObj *pDb); int32_t mndPersistStream(STrans *pTrans, SStreamObj *pStream); +int32_t mndStreamRegisterTrans(STrans *pTrans, const char *pTransName, int64_t streamId); +int32_t mndAddtoCheckpointWaitingList(SStreamObj *pStream, int64_t checkpointId); +bool mndStreamTransConflictCheck(SMnode *pMnode, int64_t streamId, const char *pTransName, bool lock); +int32_t mndStreamGetRelTrans(SMnode *pMnode, int64_t streamId); -int32_t mndStreamRegisterTrans(STrans* pTrans, const char* pTransName, int64_t streamUid); -int32_t mndAddtoCheckpointWaitingList(SStreamObj *pStream, int64_t checkpointId); -bool mndStreamTransConflictCheck(SMnode *pMnode, int64_t streamUid, const char *pTransName, bool lock); -int32_t mndStreamGetRelTrans(SMnode *pMnode, int64_t streamUid); - -typedef struct SOrphanTask { - int64_t streamId; - int32_t taskId; - int32_t nodeId; -} SOrphanTask; - -// for sma -// TODO refactor -int32_t mndGetNumOfStreams(SMnode *pMnode, char *dbName, int32_t *pNumOfStreams); -int32_t mndGetNumOfStreamTasks(const SStreamObj *pStream); -SArray *mndTakeVgroupSnapshot(SMnode *pMnode, bool *allReady); -void mndKillTransImpl(SMnode *pMnode, int32_t transId, const char *pDbName); -int32_t setTransAction(STrans *pTrans, void *pCont, int32_t contLen, int32_t msgType, const SEpSet *pEpset, - int32_t retryCode); -STrans *doCreateTrans(SMnode *pMnode, SStreamObj *pStream, SRpcMsg *pReq, const char *name, const char *pMsg); -int32_t mndPersistTransLog(SStreamObj *pStream, STrans *pTrans, int32_t status); -SSdbRaw *mndStreamActionEncode(SStreamObj *pStream); -void killAllCheckpointTrans(SMnode *pMnode, SVgroupChangeInfo *pChangeInfo); -int32_t mndStreamSetUpdateEpsetAction(SStreamObj *pStream, SVgroupChangeInfo *pInfo, STrans *pTrans); +int32_t mndGetNumOfStreams(SMnode *pMnode, char *dbName, int32_t *pNumOfStreams); +int32_t mndGetNumOfStreamTasks(const SStreamObj *pStream); +SArray *mndTakeVgroupSnapshot(SMnode *pMnode, bool *allReady); +void mndKillTransImpl(SMnode *pMnode, int32_t transId, const char *pDbName); +int32_t setTransAction(STrans *pTrans, void *pCont, int32_t contLen, int32_t msgType, const SEpSet *pEpset, + int32_t retryCode); +STrans *doCreateTrans(SMnode *pMnode, SStreamObj *pStream, SRpcMsg *pReq, const char *name, const char *pMsg); +int32_t mndPersistTransLog(SStreamObj *pStream, STrans *pTrans, int32_t status); +SSdbRaw *mndStreamActionEncode(SStreamObj *pStream); +void killAllCheckpointTrans(SMnode *pMnode, SVgroupChangeInfo *pChangeInfo); +int32_t mndStreamSetUpdateEpsetAction(SStreamObj *pStream, SVgroupChangeInfo *pInfo, STrans *pTrans); SStreamObj *mndGetStreamObj(SMnode *pMnode, int64_t streamId); int32_t extractNodeEpset(SMnode *pMnode, SEpSet *pEpSet, bool *hasEpset, int32_t taskId, int32_t nodeId); int32_t mndProcessStreamHb(SRpcMsg *pReq); void saveStreamTasksInfo(SStreamObj *pStream, SStreamExecInfo *pExecNode); int32_t initStreamNodeList(SMnode *pMnode); -int32_t mndStreamSetResumeAction(STrans *pTrans, SMnode *pMnode, SStreamObj* pStream, int8_t igUntreated); +int32_t mndStreamSetResumeAction(STrans *pTrans, SMnode *pMnode, SStreamObj *pStream, int8_t igUntreated); int32_t mndStreamSetPauseAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream); int32_t mndStreamSetDropAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream); int32_t mndStreamSetDropActionFromList(SMnode *pMnode, STrans *pTrans, SArray *pList); +int32_t mndStreamSetResetTaskAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream); + +SStreamTaskIter *createStreamTaskIter(SStreamObj *pStream); +void destroyStreamTaskIter(SStreamTaskIter *pIter); +bool streamTaskIterNextTask(SStreamTaskIter *pIter); +SStreamTask *streamTaskIterGetCurrent(SStreamTaskIter *pIter); +void mndInitExecInfo(); #ifdef __cplusplus } diff --git a/source/dnode/mnode/impl/inc/mndTrans.h b/source/dnode/mnode/impl/inc/mndTrans.h index 1bd39a2299..59eaa915bc 100644 --- a/source/dnode/mnode/impl/inc/mndTrans.h +++ b/source/dnode/mnode/impl/inc/mndTrans.h @@ -82,9 +82,11 @@ void mndTransSetSerial(STrans *pTrans); void mndTransSetParallel(STrans *pTrans); void mndTransSetOper(STrans *pTrans, EOperType oper); int32_t mndTransCheckConflict(SMnode *pMnode, STrans *pTrans); +#ifndef BUILD_NO_CALL static int32_t mndTrancCheckConflict(SMnode *pMnode, STrans *pTrans) { return mndTransCheckConflict(pMnode, pTrans); } +#endif int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans); int32_t mndTransProcessRsp(SRpcMsg *pRsp); void mndTransPullup(SMnode *pMnode); diff --git a/source/dnode/mnode/impl/src/mndCluster.c b/source/dnode/mnode/impl/src/mndCluster.c index 4c799e1e1e..f2b279276e 100644 --- a/source/dnode/mnode/impl/src/mndCluster.c +++ b/source/dnode/mnode/impl/src/mndCluster.c @@ -14,7 +14,10 @@ */ #define _DEFAULT_SOURCE +#include "audit.h" #include "mndCluster.h" +#include "mndGrant.h" +#include "mndPrivilege.h" #include "mndShow.h" #include "mndTrans.h" @@ -31,6 +34,8 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode); static int32_t mndRetrieveClusters(SRpcMsg *pMsg, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); static void mndCancelGetNextCluster(SMnode *pMnode, void *pIter); static int32_t mndProcessUptimeTimer(SRpcMsg *pReq); +static int32_t mndProcessConfigClusterReq(SRpcMsg *pReq); +static int32_t mndProcessConfigClusterRsp(SRpcMsg *pReq); int32_t mndInitCluster(SMnode *pMnode) { SSdbTable table = { @@ -45,6 +50,8 @@ int32_t mndInitCluster(SMnode *pMnode) { }; mndSetMsgHandle(pMnode, TDMT_MND_UPTIME_TIMER, mndProcessUptimeTimer); + mndSetMsgHandle(pMnode, TDMT_MND_CONFIG_CLUSTER, mndProcessConfigClusterReq); + mndSetMsgHandle(pMnode, TDMT_MND_CONFIG_CLUSTER_RSP, mndProcessConfigClusterRsp); mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_CLUSTER, mndRetrieveClusters); mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_CLUSTER, mndCancelGetNextCluster); @@ -147,6 +154,7 @@ static SSdbRaw *mndClusterActionEncode(SClusterObj *pCluster) { SDB_SET_BINARY(pRaw, dataPos, pCluster->name, TSDB_CLUSTER_ID_LEN, _OVER) SDB_SET_INT32(pRaw, dataPos, pCluster->upTime, _OVER) SDB_SET_RESERVE(pRaw, dataPos, CLUSTER_RESERVE_SIZE, _OVER) + SDB_SET_DATALEN(pRaw, dataPos, _OVER); terrno = 0; @@ -164,7 +172,7 @@ _OVER: static SSdbRow *mndClusterActionDecode(SSdbRaw *pRaw) { terrno = TSDB_CODE_OUT_OF_MEMORY; SClusterObj *pCluster = NULL; - SSdbRow *pRow = NULL; + SSdbRow *pRow = NULL; int8_t sver = 0; if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER; @@ -359,3 +367,62 @@ static int32_t mndProcessUptimeTimer(SRpcMsg *pReq) { mndTransDrop(pTrans); return 0; } + +int32_t mndProcessConfigClusterReq(SRpcMsg *pReq) { + int32_t code = 0; + SMnode *pMnode = pReq->info.node; + SMCfgClusterReq cfgReq = {0}; + if (tDeserializeSMCfgClusterReq(pReq->pCont, pReq->contLen, &cfgReq) != 0) { + terrno = TSDB_CODE_INVALID_MSG; + return -1; + } + + mInfo("cluster: start to config, option:%s, value:%s", cfgReq.config, cfgReq.value); + if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CONFIG_CLUSTER) != 0) { + code = terrno != 0 ? terrno : TSDB_CODE_MND_NO_RIGHTS; + goto _exit; + } + + SClusterObj clusterObj = {0}; + void *pIter = NULL; + SClusterObj *pCluster = mndAcquireCluster(pMnode, &pIter); + if (!pCluster || pCluster->id <= 0) { + code = TSDB_CODE_APP_IS_STARTING; + if (pCluster) mndReleaseCluster(pMnode, pCluster, pIter); + goto _exit; + } + memcpy(&clusterObj, pCluster, sizeof(SClusterObj)); + mndReleaseCluster(pMnode, pCluster, pIter); + + if (strncmp(cfgReq.config, GRANT_ACTIVE_CODE, TSDB_DNODE_CONFIG_LEN) == 0) { +#ifdef TD_ENTERPRISE + if (0 != (code = mndProcessConfigGrantReq(pMnode, pReq, &cfgReq))) { + goto _exit; + } +#else + code = TSDB_CODE_OPS_NOT_SUPPORT; + goto _exit; +#endif + } else { + code = TSDB_CODE_OPS_NOT_SUPPORT; + goto _exit; + } + + { // audit + auditRecord(pReq, pMnode->clusterId, "alterCluster", "", "", cfgReq.sql, TMIN(cfgReq.sqlLen, GRANT_ACTIVE_HEAD_LEN << 1)); + } +_exit: + tFreeSMCfgClusterReq(&cfgReq); + if (code != 0) { + terrno = code; + mError("cluster: failed to config:%s %s since %s", cfgReq.config, cfgReq.value, terrstr()); + } else { + mInfo("cluster: success to config:%s %s", cfgReq.config, cfgReq.value); + } + return code; +} + +int32_t mndProcessConfigClusterRsp(SRpcMsg *pRsp) { + mInfo("config rsp from cluster"); + return 0; +} \ No newline at end of file diff --git a/source/dnode/mnode/impl/src/mndCompact.c b/source/dnode/mnode/impl/src/mndCompact.c index 101022a44f..4e71684372 100644 --- a/source/dnode/mnode/impl/src/mndCompact.c +++ b/source/dnode/mnode/impl/src/mndCompact.c @@ -599,7 +599,8 @@ static int32_t mndSaveCompactProgress(SMnode *pMnode, int32_t compactId) { pDetail->compactId, pDetail->vgId, pDetail->dnodeId, pDetail->numberFileset, pDetail->finished, pDetail->newNumberFileset, pDetail->newFinished); - if(pDetail->numberFileset < pDetail->newNumberFileset || pDetail->finished < pDetail->newFinished) + //these 2 number will jump back after dnode restart, so < is not used here + if(pDetail->numberFileset != pDetail->newNumberFileset || pDetail->finished != pDetail->newFinished) needSave = true; } diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 4db000287c..c7ae36b02c 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -102,7 +102,13 @@ static int32_t validateTopics(STrans *pTrans, const SArray *pTopicList, SMnode * } if (mndCheckTopicPrivilege(pMnode, pUser, MND_OPER_SUBSCRIBE, pTopic) != 0) { - code = -1; + code = TSDB_CODE_MND_NO_RIGHTS; + terrno = TSDB_CODE_MND_NO_RIGHTS; + goto FAILED; + } + + if ((terrno = grantCheckExpire(TSDB_GRANT_SUBSCRIPTION)) < 0) { + code = terrno; goto FAILED; } @@ -220,22 +226,54 @@ FAIL: return -1; } +static int32_t checkPrivilege(SMnode *pMnode, SMqConsumerObj *pConsumer, SMqHbRsp *rsp, char* user){ + rsp->topicPrivileges = taosArrayInit(taosArrayGetSize(pConsumer->currentTopics), sizeof(STopicPrivilege)); + if(rsp->topicPrivileges == NULL){ + terrno = TSDB_CODE_OUT_OF_MEMORY; + return terrno; + } + for(int32_t i = 0; i < taosArrayGetSize(pConsumer->currentTopics); i++){ + char *topic = taosArrayGetP(pConsumer->currentTopics, i); + SMqTopicObj* pTopic = mndAcquireTopic(pMnode, topic); + if (pTopic == NULL) { // terrno has been set by callee function + continue; + } + STopicPrivilege *data = taosArrayReserve(rsp->topicPrivileges, 1); + strcpy(data->topic, topic); + if (mndCheckTopicPrivilege(pMnode, user, MND_OPER_SUBSCRIBE, pTopic) != 0 || + grantCheckExpire(TSDB_GRANT_SUBSCRIPTION) < 0) { + data->noPrivilege = 1; + } else { + data->noPrivilege = 0; + } + mndReleaseTopic(pMnode, pTopic); + } + return 0; +} + static int32_t mndProcessMqHbReq(SRpcMsg *pMsg) { int32_t code = 0; SMnode *pMnode = pMsg->info.node; SMqHbReq req = {0}; + SMqHbRsp rsp = {0}; + SMqConsumerObj *pConsumer = NULL; - if ((code = tDeserializeSMqHbReq(pMsg->pCont, pMsg->contLen, &req)) < 0) { + if (tDeserializeSMqHbReq(pMsg->pCont, pMsg->contLen, &req) < 0) { terrno = TSDB_CODE_OUT_OF_MEMORY; + code = TSDB_CODE_OUT_OF_MEMORY; goto end; } int64_t consumerId = req.consumerId; - SMqConsumerObj *pConsumer = mndAcquireConsumer(pMnode, consumerId); + pConsumer = mndAcquireConsumer(pMnode, consumerId); if (pConsumer == NULL) { mError("consumer:0x%" PRIx64 " not exist", consumerId); terrno = TSDB_CODE_MND_CONSUMER_NOT_EXIST; - code = -1; + code = TSDB_CODE_MND_CONSUMER_NOT_EXIST; + goto end; + } + code = checkPrivilege(pMnode, pConsumer, &rsp, pMsg->info.conn.user); + if(code != 0){ goto end; } @@ -280,9 +318,22 @@ static int32_t mndProcessMqHbReq(SRpcMsg *pMsg) { mndReleaseSubscribe(pMnode, pSub); } - mndReleaseConsumer(pMnode, pConsumer); + // encode rsp + int32_t tlen = tSerializeSMqHbRsp(NULL, 0, &rsp); + void *buf = rpcMallocCont(tlen); + if (buf == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + code = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } + + tSerializeSMqHbRsp(buf, tlen, &rsp); + pMsg->info.rsp = buf; + pMsg->info.rspLen = tlen; end: + tDeatroySMqHbRsp(&rsp); + mndReleaseConsumer(pMnode, pConsumer); tDeatroySMqHbReq(&req); return code; } @@ -499,6 +550,12 @@ static void freeItem(void *param) { int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) { SMnode *pMnode = pMsg->info.node; char *msgStr = pMsg->pCont; + int32_t code = -1; + + if ((terrno = grantCheck(TSDB_GRANT_SUBSCRIPTION)) < 0) { + code = terrno; + return code; + } SCMSubscribeReq subscribe = {0}; tDeserializeSCMSubscribeReq(msgStr, &subscribe); @@ -509,7 +566,7 @@ int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) { SMqConsumerObj *pConsumerNew = NULL; STrans *pTrans = NULL; - int32_t code = -1; + SArray *pTopicList = subscribe.topicNames; taosArraySort(pTopicList, taosArrayCompareString); taosArrayRemoveDuplicate(pTopicList, taosArrayCompareString, freeItem); @@ -525,7 +582,7 @@ int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) { } // check topic existence - pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pMsg, "subscribe"); + pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_TOPIC_INSIDE, pMsg, "subscribe"); if (pTrans == NULL) { goto _over; } diff --git a/source/dnode/mnode/impl/src/mndDef.c b/source/dnode/mnode/impl/src/mndDef.c index 172c3952ad..d59354286d 100644 --- a/source/dnode/mnode/impl/src/mndDef.c +++ b/source/dnode/mnode/impl/src/mndDef.c @@ -422,27 +422,12 @@ void *tDecodeSMqConsumerObj(const void *buf, SMqConsumerObj *pConsumer, int8_t s return (void *)buf; } -// SMqConsumerEp *tCloneSMqConsumerEp(const SMqConsumerEp *pConsumerEpOld) { -// SMqConsumerEp *pConsumerEpNew = taosMemoryMalloc(sizeof(SMqConsumerEp)); -// if (pConsumerEpNew == NULL) return NULL; -// pConsumerEpNew->consumerId = pConsumerEpOld->consumerId; -// pConsumerEpNew->vgs = taosArrayDup(pConsumerEpOld->vgs, NULL); -// return pConsumerEpNew; -// } -// -// void tDeleteSMqConsumerEp(void *data) { -// SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)data; -// taosArrayDestroy(pConsumerEp->vgs); -// } - -int32_t tEncodeSMqConsumerEp(void **buf, const SMqConsumerEp *pConsumerEp) { +int32_t tEncodeOffRows(void **buf, SArray *offsetRows){ int32_t tlen = 0; - tlen += taosEncodeFixedI64(buf, pConsumerEp->consumerId); - tlen += taosEncodeArray(buf, pConsumerEp->vgs, (FEncode)tEncodeSMqVgEp); - int32_t szVgs = taosArrayGetSize(pConsumerEp->offsetRows); + int32_t szVgs = taosArrayGetSize(offsetRows); tlen += taosEncodeFixedI32(buf, szVgs); for (int32_t j = 0; j < szVgs; ++j) { - OffsetRows *offRows = taosArrayGet(pConsumerEp->offsetRows, j); + OffsetRows *offRows = taosArrayGet(offsetRows, j); tlen += taosEncodeFixedI32(buf, offRows->vgId); tlen += taosEncodeFixedI64(buf, offRows->rows); tlen += taosEncodeFixedI8(buf, offRows->offset.type); @@ -454,53 +439,54 @@ int32_t tEncodeSMqConsumerEp(void **buf, const SMqConsumerEp *pConsumerEp) { } else { // do nothing } + tlen += taosEncodeFixedI64(buf, offRows->ever); } - // #if 0 - // int32_t sz = taosArrayGetSize(pConsumerEp->vgs); - // tlen += taosEncodeFixedI32(buf, sz); - // for (int32_t i = 0; i < sz; i++) { - // SMqVgEp *pVgEp = taosArrayGetP(pConsumerEp->vgs, i); - // tlen += tEncodeSMqVgEp(buf, pVgEp); - // } - // #endif + return tlen; } +int32_t tEncodeSMqConsumerEp(void **buf, const SMqConsumerEp *pConsumerEp) { + int32_t tlen = 0; + tlen += taosEncodeFixedI64(buf, pConsumerEp->consumerId); + tlen += taosEncodeArray(buf, pConsumerEp->vgs, (FEncode)tEncodeSMqVgEp); + + + return tlen + tEncodeOffRows(buf, pConsumerEp->offsetRows); +} + +void *tDecodeOffRows(const void *buf, SArray **offsetRows, int8_t sver){ + int32_t szVgs = 0; + buf = taosDecodeFixedI32(buf, &szVgs); + if (szVgs > 0) { + *offsetRows = taosArrayInit(szVgs, sizeof(OffsetRows)); + if (NULL == *offsetRows) return NULL; + for (int32_t j = 0; j < szVgs; ++j) { + OffsetRows *offRows = taosArrayReserve(*offsetRows, 1); + buf = taosDecodeFixedI32(buf, &offRows->vgId); + buf = taosDecodeFixedI64(buf, &offRows->rows); + buf = taosDecodeFixedI8(buf, &offRows->offset.type); + if (offRows->offset.type == TMQ_OFFSET__SNAPSHOT_DATA || offRows->offset.type == TMQ_OFFSET__SNAPSHOT_META) { + buf = taosDecodeFixedI64(buf, &offRows->offset.uid); + buf = taosDecodeFixedI64(buf, &offRows->offset.ts); + } else if (offRows->offset.type == TMQ_OFFSET__LOG) { + buf = taosDecodeFixedI64(buf, &offRows->offset.version); + } else { + // do nothing + } + if(sver > 2){ + buf = taosDecodeFixedI64(buf, &offRows->ever); + } + } + } + return (void *)buf; +} + void *tDecodeSMqConsumerEp(const void *buf, SMqConsumerEp *pConsumerEp, int8_t sver) { buf = taosDecodeFixedI64(buf, &pConsumerEp->consumerId); buf = taosDecodeArray(buf, &pConsumerEp->vgs, (FDecode)tDecodeSMqVgEp, sizeof(SMqVgEp), sver); if (sver > 1) { - int32_t szVgs = 0; - buf = taosDecodeFixedI32(buf, &szVgs); - if (szVgs > 0) { - pConsumerEp->offsetRows = taosArrayInit(szVgs, sizeof(OffsetRows)); - if (NULL == pConsumerEp->offsetRows) return NULL; - for (int32_t j = 0; j < szVgs; ++j) { - OffsetRows *offRows = taosArrayReserve(pConsumerEp->offsetRows, 1); - buf = taosDecodeFixedI32(buf, &offRows->vgId); - buf = taosDecodeFixedI64(buf, &offRows->rows); - buf = taosDecodeFixedI8(buf, &offRows->offset.type); - if (offRows->offset.type == TMQ_OFFSET__SNAPSHOT_DATA || offRows->offset.type == TMQ_OFFSET__SNAPSHOT_META) { - buf = taosDecodeFixedI64(buf, &offRows->offset.uid); - buf = taosDecodeFixedI64(buf, &offRows->offset.ts); - } else if (offRows->offset.type == TMQ_OFFSET__LOG) { - buf = taosDecodeFixedI64(buf, &offRows->offset.version); - } else { - // do nothing - } - } - } + buf = tDecodeOffRows(buf, &pConsumerEp->offsetRows, sver); } - // #if 0 - // int32_t sz; - // buf = taosDecodeFixedI32(buf, &sz); - // pConsumerEp->vgs = taosArrayInit(sz, sizeof(void *)); - // for (int32_t i = 0; i < sz; i++) { - // SMqVgEp *pVgEp = taosMemoryMalloc(sizeof(SMqVgEp)); - // buf = tDecodeSMqVgEp(buf, pVgEp); - // taosArrayPush(pConsumerEp->vgs, &pVgEp); - // } - // #endif return (void *)buf; } @@ -596,22 +582,7 @@ int32_t tEncodeSubscribeObj(void **buf, const SMqSubscribeObj *pSub) { tlen += taosEncodeArray(buf, pSub->unassignedVgs, (FEncode)tEncodeSMqVgEp); tlen += taosEncodeString(buf, pSub->dbName); - int32_t szVgs = taosArrayGetSize(pSub->offsetRows); - tlen += taosEncodeFixedI32(buf, szVgs); - for (int32_t j = 0; j < szVgs; ++j) { - OffsetRows *offRows = taosArrayGet(pSub->offsetRows, j); - tlen += taosEncodeFixedI32(buf, offRows->vgId); - tlen += taosEncodeFixedI64(buf, offRows->rows); - tlen += taosEncodeFixedI8(buf, offRows->offset.type); - if (offRows->offset.type == TMQ_OFFSET__SNAPSHOT_DATA || offRows->offset.type == TMQ_OFFSET__SNAPSHOT_META) { - tlen += taosEncodeFixedI64(buf, offRows->offset.uid); - tlen += taosEncodeFixedI64(buf, offRows->offset.ts); - } else if (offRows->offset.type == TMQ_OFFSET__LOG) { - tlen += taosEncodeFixedI64(buf, offRows->offset.version); - } else { - // do nothing - } - } + tlen += tEncodeOffRows(buf, pSub->offsetRows); tlen += taosEncodeString(buf, pSub->qmsg); return tlen; } @@ -639,26 +610,7 @@ void *tDecodeSubscribeObj(const void *buf, SMqSubscribeObj *pSub, int8_t sver) { buf = taosDecodeStringTo(buf, pSub->dbName); if (sver > 1) { - int32_t szVgs = 0; - buf = taosDecodeFixedI32(buf, &szVgs); - if (szVgs > 0) { - pSub->offsetRows = taosArrayInit(szVgs, sizeof(OffsetRows)); - if (NULL == pSub->offsetRows) return NULL; - for (int32_t j = 0; j < szVgs; ++j) { - OffsetRows *offRows = taosArrayReserve(pSub->offsetRows, 1); - buf = taosDecodeFixedI32(buf, &offRows->vgId); - buf = taosDecodeFixedI64(buf, &offRows->rows); - buf = taosDecodeFixedI8(buf, &offRows->offset.type); - if (offRows->offset.type == TMQ_OFFSET__SNAPSHOT_DATA || offRows->offset.type == TMQ_OFFSET__SNAPSHOT_META) { - buf = taosDecodeFixedI64(buf, &offRows->offset.uid); - buf = taosDecodeFixedI64(buf, &offRows->offset.ts); - } else if (offRows->offset.type == TMQ_OFFSET__LOG) { - buf = taosDecodeFixedI64(buf, &offRows->offset.version); - } else { - // do nothing - } - } - } + buf = tDecodeOffRows(buf, &pSub->offsetRows, sver); buf = taosDecodeString(buf, &pSub->qmsg); } else { pSub->qmsg = taosStrdup(""); diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 6585e70533..cb8a24e675 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -136,6 +136,16 @@ static int32_t mndCreateDefaultDnode(SMnode *pMnode) { tstrncpy(dnodeObj.fqdn, tsLocalFqdn, TSDB_FQDN_LEN); dnodeObj.fqdn[TSDB_FQDN_LEN - 1] = 0; snprintf(dnodeObj.ep, TSDB_EP_LEN - 1, "%s:%u", tsLocalFqdn, tsServerPort); + char *machineId = tGetMachineId(); + if (machineId) { + memcpy(dnodeObj.machineId, machineId, TSDB_MACHINE_ID_LEN); + taosMemoryFreeClear(machineId); + } else { +#ifdef TD_ENTERPRISE + terrno = TSDB_CODE_DNODE_NO_MACHINE_CODE; + goto _OVER; +#endif + } pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, NULL, "create-dnode"); if (pTrans == NULL) goto _OVER; @@ -402,6 +412,7 @@ void mndGetDnodeData(SMnode *pMnode, SArray *pDnodeInfo) { tstrncpy(dInfo.ep.fqdn, pDnode->fqdn, TSDB_FQDN_LEN); tstrncpy(dInfo.active, pDnode->active, TSDB_ACTIVE_KEY_LEN); tstrncpy(dInfo.connActive, pDnode->connActive, TSDB_CONN_ACTIVE_KEY_LEN); + tstrncpy(dInfo.machineId, pDnode->machineId, TSDB_MACHINE_ID_LEN + 1); sdbRelease(pSdb, pDnode); if (mndIsMnode(pMnode, pDnode->id)) { dInfo.isMnode = 1; @@ -657,8 +668,12 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) { pDnode->rebootTime = statusReq.rebootTime; pDnode->numOfCores = statusReq.numOfCores; pDnode->numOfSupportVnodes = statusReq.numOfSupportVnodes; + pDnode->numOfDiskCfg = statusReq.numOfDiskCfg; pDnode->memAvail = statusReq.memAvail; pDnode->memTotal = statusReq.memTotal; + if (pDnode->machineId[0] == 0 && statusReq.machineId[0] != 0) { + tstrncpy(pDnode->machineId, statusReq.machineId, TSDB_MACHINE_ID_LEN + 1); + } SStatusRsp statusRsp = {0}; statusRsp.statusSeq++; @@ -761,109 +776,6 @@ _OVER: return code; } -static int32_t mndConfigDnode(SMnode *pMnode, SRpcMsg *pReq, SMCfgDnodeReq *pCfgReq, int8_t action) { - SSdbRaw *pRaw = NULL; - STrans *pTrans = NULL; - SDnodeObj *pDnode = NULL; - SArray *failRecord = NULL; - bool cfgAll = pCfgReq->dnodeId == -1; - int32_t cfgAllErr = 0; - int32_t iter = 0; - - SSdb *pSdb = pMnode->pSdb; - void *pIter = NULL; - while (1) { - if (cfgAll) { - pIter = sdbFetch(pSdb, SDB_DNODE, pIter, (void **)&pDnode); - if (pIter == NULL) break; - ++iter; - } else if (!(pDnode = mndAcquireDnode(pMnode, pCfgReq->dnodeId))) { - goto _OVER; - } - - SDnodeObj tmpDnode = *pDnode; - if (action == DND_ACTIVE_CODE) { - if (grantAlterActiveCode(pDnode->id, pDnode->active, pCfgReq->value, tmpDnode.active, 0) != 0) { - if (TSDB_CODE_DUP_KEY != terrno) { - mError("dnode:%d, config dnode:%d, app:%p config:%s value:%s failed since %s", pDnode->id, pCfgReq->dnodeId, - pReq->info.ahandle, pCfgReq->config, pCfgReq->value, terrstr()); - if (cfgAll) { // alter all dnodes: - if (!failRecord) failRecord = taosArrayInit(1, sizeof(int32_t)); - if (failRecord) taosArrayPush(failRecord, &pDnode->id); - if (0 == cfgAllErr) cfgAllErr = terrno; // output 1st terrno. - } - } else { - terrno = 0; // no action for dup active code - } - if (cfgAll) continue; - goto _OVER; - } - } else if (action == DND_CONN_ACTIVE_CODE) { - if (grantAlterActiveCode(pDnode->id, pDnode->connActive, pCfgReq->value, tmpDnode.connActive, 1) != 0) { - if (TSDB_CODE_DUP_KEY != terrno) { - mError("dnode:%d, config dnode:%d, app:%p config:%s value:%s failed since %s", pDnode->id, pCfgReq->dnodeId, - pReq->info.ahandle, pCfgReq->config, pCfgReq->value, terrstr()); - if (cfgAll) { - if (!failRecord) failRecord = taosArrayInit(1, sizeof(int32_t)); - if (failRecord) taosArrayPush(failRecord, &pDnode->id); - if (0 == cfgAllErr) cfgAllErr = terrno; - } - } else { - terrno = 0; - } - if (cfgAll) continue; - goto _OVER; - } - } else { - terrno = TSDB_CODE_INVALID_CFG; - goto _OVER; - } - - if (!pTrans) { - pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq, "config-dnode"); - if (!pTrans) goto _OVER; - if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER; - } - - pRaw = mndDnodeActionEncode(&tmpDnode); - if (pRaw == NULL || mndTransAppendCommitlog(pTrans, pRaw) != 0) goto _OVER; - (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY); - pRaw = NULL; - - mInfo("dnode:%d, config dnode:%d, app:%p config:%s value:%s", pDnode->id, pCfgReq->dnodeId, pReq->info.ahandle, - pCfgReq->config, pCfgReq->value); - - if (cfgAll) { - sdbRelease(pSdb, pDnode); - pDnode = NULL; - } else { - break; - } - } - - if (pTrans && mndTransPrepare(pMnode, pTrans) != 0) goto _OVER; - tsGrantHBInterval = TMIN(TMAX(5, iter / 2), 30); - terrno = 0; - -_OVER: - if (cfgAll) { - sdbRelease(pSdb, pDnode); - if (cfgAllErr != 0) terrno = cfgAllErr; - int32_t nFail = taosArrayGetSize(failRecord); - if (nFail > 0) { - mError("config dnode, cfg:%d, app:%p config:%s value:%s. total:%d, fail:%d", pCfgReq->dnodeId, pReq->info.ahandle, - pCfgReq->config, pCfgReq->value, iter, nFail); - } - } else { - mndReleaseDnode(pMnode, pDnode); - } - sdbCancelFetch(pSdb, pIter); - mndTransDrop(pTrans); - sdbFreeRaw(pRaw); - taosArrayDestroy(failRecord); - return terrno; -} - static int32_t mndProcessDnodeListReq(SRpcMsg *pReq) { SMnode *pMnode = pReq->info.node; SSdb *pSdb = pMnode->pSdb; @@ -1013,8 +925,10 @@ static int32_t mndProcessCreateDnodeReq(SRpcMsg *pReq) { } code = mndCreateDnode(pMnode, pReq, &createReq); - if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS; - tsGrantHBInterval = 5; + if (code == 0) { + code = TSDB_CODE_ACTION_IN_PROGRESS; + tsGrantHBInterval = 5; + } char obj[200] = {0}; sprintf(obj, "%s:%d", createReq.fqdn, createReq.port); @@ -1310,34 +1224,6 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) { strcpy(dcfgReq.config, "supportvnodes"); snprintf(dcfgReq.value, TSDB_DNODE_VALUE_LEN, "%d", flag); - } else if (strncasecmp(cfgReq.config, "activeCode", 10) == 0 || strncasecmp(cfgReq.config, "cActiveCode", 11) == 0) { - int8_t opt = strncasecmp(cfgReq.config, "a", 1) == 0 ? DND_ACTIVE_CODE : DND_CONN_ACTIVE_CODE; - int8_t index = opt == DND_ACTIVE_CODE ? 10 : 11; - if (' ' != cfgReq.config[index] && 0 != cfgReq.config[index]) { - mError("dnode:%d, failed to config activeCode since invalid conf:%s", cfgReq.dnodeId, cfgReq.config); - terrno = TSDB_CODE_INVALID_CFG; - goto _err_out; - } - int32_t vlen = strlen(cfgReq.value); - if (vlen > 0 && ((opt == DND_ACTIVE_CODE && vlen != (TSDB_ACTIVE_KEY_LEN - 1)) || - (opt == DND_CONN_ACTIVE_CODE && - (vlen > (TSDB_CONN_ACTIVE_KEY_LEN - 1) || vlen < (TSDB_ACTIVE_KEY_LEN - 1))))) { - mError("dnode:%d, failed to config activeCode since invalid vlen:%d. conf:%s, val:%s", cfgReq.dnodeId, vlen, - cfgReq.config, cfgReq.value); - terrno = TSDB_CODE_INVALID_CFG; - goto _err_out; - } - - strcpy(dcfgReq.config, opt == DND_ACTIVE_CODE ? "activeCode" : "cActiveCode"); - snprintf(dcfgReq.value, TSDB_DNODE_VALUE_LEN, "%s", cfgReq.value); - - if (mndConfigDnode(pMnode, pReq, &cfgReq, opt) != 0) { - mError("dnode:%d, failed to config activeCode since %s", cfgReq.dnodeId, terrstr()); - terrno = TSDB_CODE_INVALID_CFG; - goto _err_out; - } - tFreeSMCfgDnodeReq(&cfgReq); - return 0; } else if (strncasecmp(cfgReq.config, "s3blocksize", 11) == 0) { int32_t optLen = strlen("s3blocksize"); int32_t flag = -1; @@ -1497,11 +1383,7 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB taosMemoryFreeClear(b); #ifdef TD_ENTERPRISE - STR_TO_VARSTR(buf, pDnode->active); - pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, buf, false); - - STR_TO_VARSTR(buf, pDnode->connActive); + STR_TO_VARSTR(buf, pDnode->machineId); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, buf, false); #endif diff --git a/source/dnode/mnode/impl/src/mndGrant.c b/source/dnode/mnode/impl/src/mndGrant.c index c4e1894263..2ec6e09d12 100644 --- a/source/dnode/mnode/impl/src/mndGrant.c +++ b/source/dnode/mnode/impl/src/mndGrant.c @@ -19,6 +19,15 @@ #ifndef _GRANT +#define GRANT_ITEM_SHOW(display) \ + do { \ + cols++; \ + pColInfo = taosArrayGet(pBlock->pDataBlock, cols); \ + src = (display); \ + STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32); \ + colDataSetVal(pColInfo, numOfRows, tmp, false); \ + } while (0) + static int32_t mndRetrieveGrant(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { int32_t numOfRows = 0; int32_t cols = 0; @@ -31,95 +40,32 @@ static int32_t mndRetrieveGrant(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32); colDataSetVal(pColInfo, numOfRows, tmp, false); - cols++; - pColInfo = taosArrayGet(pBlock->pDataBlock, cols); - src = "unlimited"; - STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32); - colDataSetVal(pColInfo, numOfRows, tmp, false); + GRANT_ITEM_SHOW("unlimited"); + GRANT_ITEM_SHOW("limited"); + GRANT_ITEM_SHOW("false"); + GRANT_ITEM_SHOW("ungranted"); + GRANT_ITEM_SHOW("unlimited"); + GRANT_ITEM_SHOW("unlimited"); + GRANT_ITEM_SHOW("unlimited"); - cols++; - pColInfo = taosArrayGet(pBlock->pDataBlock, cols); - src = "false"; - STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32); - colDataSetVal(pColInfo, numOfRows, tmp, false); - - cols++; - pColInfo = taosArrayGet(pBlock->pDataBlock, cols); - src = "unlimited"; - STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32); - colDataSetVal(pColInfo, numOfRows, tmp, false); - - cols++; - pColInfo = taosArrayGet(pBlock->pDataBlock, cols); - src = "unlimited"; - STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32); - colDataSetVal(pColInfo, numOfRows, tmp, false); - - cols++; - pColInfo = taosArrayGet(pBlock->pDataBlock, cols); - src = "unlimited"; - STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32); - colDataSetVal(pColInfo, numOfRows, tmp, false); - - cols++; - pColInfo = taosArrayGet(pBlock->pDataBlock, cols); - src = "unlimited"; - STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32); - colDataSetVal(pColInfo, numOfRows, tmp, false); - - cols++; - pColInfo = taosArrayGet(pBlock->pDataBlock, cols); - src = "unlimited"; - STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32); - colDataSetVal(pColInfo, numOfRows, tmp, false); - - cols++; - pColInfo = taosArrayGet(pBlock->pDataBlock, cols); - src = "unlimited"; - STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32); - colDataSetVal(pColInfo, numOfRows, tmp, false); - - cols++; - pColInfo = taosArrayGet(pBlock->pDataBlock, cols); - src = "unlimited"; - STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32); - colDataSetVal(pColInfo, numOfRows, tmp, false); - - cols++; - pColInfo = taosArrayGet(pBlock->pDataBlock, cols); - src = "unlimited"; - STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32); - colDataSetVal(pColInfo, numOfRows, tmp, false); - - cols++; - pColInfo = taosArrayGet(pBlock->pDataBlock, cols); - src = "unlimited"; - STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32); - colDataSetVal(pColInfo, numOfRows, tmp, false); - - cols++; - pColInfo = taosArrayGet(pBlock->pDataBlock, cols); - src = "unlimited"; - STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32); - colDataSetVal(pColInfo, numOfRows, tmp, false); - - cols++; - pColInfo = taosArrayGet(pBlock->pDataBlock, cols); - src = "unlimited"; - STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32); - colDataSetVal(pColInfo, numOfRows, tmp, false); - - numOfRows++; + ++numOfRows; } pShow->numOfRows += numOfRows; return numOfRows; } +static int32_t mndRetrieveGrantFull(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { return 0; } +static int32_t mndRetrieveGrantLogs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { return 0; } +static int32_t mndRetrieveMachines(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { return 0; } + static int32_t mndProcessGrantHB(SRpcMsg *pReq) { return TSDB_CODE_SUCCESS; } int32_t mndInitGrant(SMnode *pMnode) { mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_GRANTS, mndRetrieveGrant); + mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_GRANTS_FULL, mndRetrieveGrantFull); + mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_GRANTS_LOGS, mndRetrieveGrantLogs); + mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_MACHINES, mndRetrieveMachines); mndSetMsgHandle(pMnode, TDMT_MND_GRANT_HB_TIMER, mndProcessGrantHB); return 0; } @@ -129,12 +75,10 @@ void grantParseParameter() { mError("can't parsed parameter k"); } void grantReset(SMnode *pMnode, EGrantType grant, uint64_t value) {} void grantAdd(EGrantType grant, uint64_t value) {} void grantRestore(EGrantType grant, uint64_t value) {} +char *tGetMachineId() { return NULL; }; int32_t dmProcessGrantReq(void *pInfo, SRpcMsg *pMsg) { return TSDB_CODE_SUCCESS; } int32_t dmProcessGrantNotify(void *pInfo, SRpcMsg *pMsg) { return TSDB_CODE_SUCCESS; } -int32_t grantAlterActiveCode(int32_t did, const char *old, const char *new, char *out, int8_t type) { - return TSDB_CODE_SUCCESS; -} - +int32_t mndProcessConfigGrantReq(SMnode *pMnode, SRpcMsg *pReq, SMCfgClusterReq *pCfg) { return 0; } #endif -void mndGenerateMachineCode() { grantParseParameter(); } +void mndGenerateMachineCode() { grantParseParameter(); } \ No newline at end of file diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index 30a9118274..a39e9e93c6 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -193,7 +193,7 @@ static void mndPullupGrant(SMnode *pMnode) { if (pReq != NULL) { SRpcMsg rpcMsg = { .msgType = TDMT_MND_GRANT_HB_TIMER, .pCont = pReq, .contLen = contLen, .info.ahandle = (void *)0x9527}; - tmsgPutToQueue(&pMnode->msgCb, READ_QUEUE, &rpcMsg); + tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg); } } diff --git a/source/dnode/mnode/impl/src/mndPrivilege.c b/source/dnode/mnode/impl/src/mndPrivilege.c index d4c0a6b36b..13a80cb1a6 100644 --- a/source/dnode/mnode/impl/src/mndPrivilege.c +++ b/source/dnode/mnode/impl/src/mndPrivilege.c @@ -30,9 +30,6 @@ int32_t mndCheckDbPrivilegeByName(SMnode *pMnode, const char *user, EOperType op } int32_t mndCheckTopicPrivilege(SMnode *pMnode, const char *user, EOperType operType, SMqTopicObj *pTopic) { return 0; } -int32_t mndCheckTopicPrivilegeByName(SMnode *pMnode, const char *user, EOperType operType, const char *topicName) { - return 0; -} int32_t mndSetUserWhiteListRsp(SMnode *pMnode, SUserObj *pUser, SGetUserWhiteListRsp *pWhiteListRsp) { diff --git a/source/dnode/mnode/impl/src/mndScheduler.c b/source/dnode/mnode/impl/src/mndScheduler.c index 39121cecd9..88d326a5c4 100644 --- a/source/dnode/mnode/impl/src/mndScheduler.c +++ b/source/dnode/mnode/impl/src/mndScheduler.c @@ -27,9 +27,6 @@ #define SINK_NODE_LEVEL (0) extern bool tsDeployOnSnode; -static int32_t doAddSinkTask(SStreamObj* pStream, SArray* pTaskList, SMnode* pMnode, int32_t vgId, SVgObj* pVgroup, - SEpSet* pEpset, bool isFillhistory); - int32_t mndConvertRsmaTask(char** pDst, int32_t* pDstLen, const char* ast, int64_t uid, int8_t triggerType, int64_t watermark, int64_t deleteMark) { SNode* pAst = NULL; @@ -89,6 +86,8 @@ END: int32_t mndSetSinkTaskInfo(SStreamObj* pStream, SStreamTask* pTask) { STaskOutputInfo* pInfo = &pTask->outputInfo; + mDebug("mndSetSinkTaskInfo to sma or table, taskId:%s", pTask->id.idStr); + if (pStream->smaId != 0) { pInfo->type = TASK_OUTPUT__SMA; pInfo->smaSink.smaId = pStream->smaId; @@ -157,12 +156,7 @@ int32_t mndAssignStreamTaskToVgroup(SMnode* pMnode, SStreamTask* pTask, SSubplan plan->execNode.nodeId = pTask->info.nodeId; plan->execNode.epSet = pTask->info.epSet; - if (qSubPlanToString(plan, &pTask->exec.qmsg, &msgLen) < 0) { - terrno = TSDB_CODE_QRY_INVALID_INPUT; - return -1; - } - - return 0; + return qSubPlanToString(plan, &pTask->exec.qmsg, &msgLen); } SSnodeObj* mndSchedFetchOneSnode(SMnode* pMnode) { @@ -184,32 +178,79 @@ int32_t mndAssignStreamTaskToSnode(SMnode* pMnode, SStreamTask* pTask, SSubplan* plan->execNode.epSet = pTask->info.epSet; mDebug("s-task:0x%x set the agg task to snode:%d", pTask->id.taskId, SNODE_HANDLE); - if (qSubPlanToString(plan, &pTask->exec.qmsg, &msgLen) < 0) { - terrno = TSDB_CODE_QRY_INVALID_INPUT; - return -1; - } - return 0; + return qSubPlanToString(plan, &pTask->exec.qmsg, &msgLen); } -// todo random choose a node to do compute -SVgObj* mndSchedFetchOneVg(SMnode* pMnode, int64_t dbUid) { +// random choose a node to do compute +SVgObj* mndSchedFetchOneVg(SMnode* pMnode, SStreamObj* pStream) { + SDbObj* pDbObj = mndAcquireDb(pMnode, pStream->sourceDb); + if (pDbObj == NULL) { + terrno = TSDB_CODE_QRY_INVALID_INPUT; + return NULL; + } + + if(pStream->indexForMultiAggBalance == -1){ + taosSeedRand(taosSafeRand()); + pStream->indexForMultiAggBalance = taosRand() % pDbObj->cfg.numOfVgroups; + } + + int32_t index = 0; void* pIter = NULL; SVgObj* pVgroup = NULL; while (1) { pIter = sdbFetch(pMnode->pSdb, SDB_VGROUP, pIter, (void**)&pVgroup); if (pIter == NULL) break; - if (pVgroup->dbUid != dbUid) { + if (pVgroup->dbUid != pStream->sourceDbUid) { sdbRelease(pMnode->pSdb, pVgroup); continue; } - sdbCancelFetch(pMnode->pSdb, pIter); - return pVgroup; + if (index++ == pStream->indexForMultiAggBalance){ + pStream->indexForMultiAggBalance++; + pStream->indexForMultiAggBalance %= pDbObj->cfg.numOfVgroups; + sdbCancelFetch(pMnode->pSdb, pIter); + break; + } + sdbRelease(pMnode->pSdb, pVgroup); } + sdbRelease(pMnode->pSdb, pDbObj); + return pVgroup; } +static int32_t doAddSinkTask(SStreamObj* pStream, SMnode* pMnode, SVgObj* pVgroup, + SEpSet* pEpset, bool isFillhistory) { + int64_t uid = (isFillhistory) ? pStream->hTaskUid : pStream->uid; + SArray** pTaskList = (isFillhistory) ? taosArrayGetLast(pStream->pHTasksList) : taosArrayGetLast(pStream->tasks); + + SStreamTask* pTask = tNewStreamTask(uid, TASK_LEVEL__SINK, pEpset, isFillhistory, 0, *pTaskList, pStream->conf.fillHistory); + if (pTask == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return terrno; + } + + mDebug("doAddSinkTask taskId:%s, vgId:%d, isFillHistory:%d", pTask->id.idStr, pVgroup->vgId, isFillhistory); + + pTask->info.nodeId = pVgroup->vgId; + pTask->info.epSet = mndGetVgroupEpset(pMnode, pVgroup); + return mndSetSinkTaskInfo(pStream, pTask); +} + +static int32_t doAddSinkTaskToVg(SMnode* pMnode, SStreamObj* pStream, SEpSet* pEpset, SVgObj* vgObj){ + int32_t code = doAddSinkTask(pStream, pMnode, vgObj, pEpset, false); + if (code != 0) { + return code; + } + if(pStream->conf.fillHistory){ + code = doAddSinkTask(pStream, pMnode, vgObj, pEpset, true); + if (code != 0) { + return code; + } + } + return TDB_CODE_SUCCESS; +} + // create sink node for each vgroup. -int32_t doAddShuffleSinkTask(SMnode* pMnode, SArray* pTaskList, SStreamObj* pStream, SEpSet* pEpset, bool fillHistory) { +static int32_t doAddShuffleSinkTask(SMnode* pMnode, SStreamObj* pStream, SEpSet* pEpset) { SSdb* pSdb = pMnode->pSdb; void* pIter = NULL; @@ -225,73 +266,89 @@ int32_t doAddShuffleSinkTask(SMnode* pMnode, SArray* pTaskList, SStreamObj* pStr continue; } - doAddSinkTask(pStream, pTaskList, pMnode, pVgroup->vgId, pVgroup, pEpset, fillHistory); + int32_t code = doAddSinkTaskToVg(pMnode, pStream, pEpset, pVgroup); + if(code != 0){ + sdbRelease(pSdb, pVgroup); + return code; + } + sdbRelease(pSdb, pVgroup); } - return 0; + return TDB_CODE_SUCCESS; } -int32_t doAddSinkTask(SStreamObj* pStream, SArray* pTaskList, SMnode* pMnode, int32_t vgId, SVgObj* pVgroup, - SEpSet* pEpset, bool isFillhistory) { - int64_t uid = (isFillhistory)? pStream->hTaskUid:pStream->uid; - SStreamTask* pTask = tNewStreamTask(uid, TASK_LEVEL__SINK, isFillhistory, 0, pTaskList, pStream->conf.fillHistory); - if (pTask == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return -1; +static int64_t getVgroupLastVer(const SArray* pList, int32_t vgId) { + for(int32_t i = 0; i < taosArrayGetSize(pList); ++i) { + SVgroupVer* pVer = taosArrayGet(pList, i); + if (pVer->vgId == vgId) { + return pVer->ver; + } } - epsetAssign(&(pTask)->info.mnodeEpset, pEpset); - - pTask->info.nodeId = vgId; - pTask->info.epSet = mndGetVgroupEpset(pMnode, pVgroup); - mndSetSinkTaskInfo(pStream, pTask); - return 0; + mError("failed to find the vgId:%d for extract last version", vgId); + return -1; } -static int32_t addSourceTask(SMnode* pMnode, SVgObj* pVgroup, SArray* pTaskList, SArray* pSinkTaskList, - SStreamObj* pStream, SSubplan* plan, uint64_t uid, SEpSet* pEpset, bool fillHistory, - bool hasExtraSink, int64_t nextWindowSkey, bool hasFillHistory) { - SStreamTask* pTask = - tNewStreamTask(uid, TASK_LEVEL__SOURCE, fillHistory, pStream->conf.triggerParam, pTaskList, hasFillHistory); - if (pTask == NULL) { - return terrno; +static void streamTaskSetDataRange(SStreamTask* pTask, int64_t skey, SArray* pVerList, int32_t vgId) { + int64_t latestVer = getVgroupLastVer(pVerList, vgId); + if (latestVer < 0) { + latestVer = 0; } - epsetAssign(&pTask->info.mnodeEpset, pEpset); - STimeWindow* pWindow = &pTask->dataRange.window; + // set the correct ts, which is the last key of queried table. + SDataRange* pRange = &pTask->dataRange; + STimeWindow* pWindow = &pRange->window; - pWindow->skey = INT64_MIN; - pWindow->ekey = nextWindowSkey - 1; - mDebug("add source task 0x%x window:%" PRId64 " - %" PRId64, pTask->id.taskId, pWindow->skey, pWindow->ekey); + if (pTask->info.fillHistory) { + pWindow->skey = INT64_MIN; + pWindow->ekey = skey - 1; - // sink or dispatch - if (hasExtraSink) { - mndAddDispatcherForInternalTask(pMnode, pStream, pSinkTaskList, pTask); + pRange->range.minVer = 0; + pRange->range.maxVer = latestVer; + mDebug("add fill-history source task 0x%x timeWindow:%" PRId64 "-%" PRId64 " verRange:%" PRId64 "-%" PRId64, + pTask->id.taskId, pWindow->skey, pWindow->ekey, pRange->range.minVer, pRange->range.maxVer); } else { - mndSetSinkTaskInfo(pStream, pTask); - } + pWindow->skey = skey; + pWindow->ekey = INT64_MAX; - if (mndAssignStreamTaskToVgroup(pMnode, pTask, plan, pVgroup) < 0) { - return terrno; - } + pRange->range.minVer = latestVer + 1; + pRange->range.maxVer = INT64_MAX; - for(int32_t i = 0; i < taosArrayGetSize(pSinkTaskList); ++i) { - SStreamTask* pSinkTask = taosArrayGetP(pSinkTaskList, i); - streamTaskSetUpstreamInfo(pSinkTask, pTask); + mDebug("add source task 0x%x timeWindow:%" PRId64 "-%" PRId64 " verRange:%" PRId64 "-%" PRId64, + pTask->id.taskId, pWindow->skey, pWindow->ekey, pRange->range.minVer, pRange->range.maxVer); } - - return TSDB_CODE_SUCCESS; } -static SArray* addNewTaskList(SArray* pTasksList) { +static SStreamTask* buildSourceTask(SStreamObj* pStream, SEpSet* pEpset, + bool isFillhistory, bool useTriggerParam) { + uint64_t uid = (isFillhistory) ? pStream->hTaskUid : pStream->uid; + SArray** pTaskList = (isFillhistory) ? taosArrayGetLast(pStream->pHTasksList) : taosArrayGetLast(pStream->tasks); + + SStreamTask* pTask = tNewStreamTask(uid, TASK_LEVEL__SOURCE, pEpset, + isFillhistory, useTriggerParam ? pStream->conf.triggerParam : 0, + *pTaskList, pStream->conf.fillHistory); + if (pTask == NULL) { + return NULL; + } + + return pTask; +} + +static void addNewTaskList(SStreamObj* pStream){ SArray* pTaskList = taosArrayInit(0, POINTER_BYTES); - taosArrayPush(pTasksList, &pTaskList); - return pTaskList; + taosArrayPush(pStream->tasks, &pTaskList); + if (pStream->conf.fillHistory) { + pTaskList = taosArrayInit(0, POINTER_BYTES); + taosArrayPush(pStream->pHTasksList, &pTaskList); + } } // set the history task id -static void setHTasksId(SArray* pTaskList, const SArray* pHTaskList) { +static void setHTasksId(SStreamObj* pStream) { + SArray* pTaskList = *(SArray**)taosArrayGetLast(pStream->tasks); + SArray* pHTaskList = *(SArray**)taosArrayGetLast(pStream->pHTasksList); + for (int32_t i = 0; i < taosArrayGetSize(pTaskList); ++i) { SStreamTask** pStreamTask = taosArrayGet(pTaskList, i); SStreamTask** pHTask = taosArrayGet(pHTaskList, i); @@ -307,30 +364,63 @@ static void setHTasksId(SArray* pTaskList, const SArray* pHTaskList) { } } -static int32_t addSourceTasksForOneLevelStream(SMnode* pMnode, const SQueryPlan* pPlan, SStreamObj* pStream, - SEpSet* pEpset, bool hasExtraSink, int64_t nextWindowSkey) { - // create exec stream task, since only one level, the exec task is also the source task - SArray* pTaskList = addNewTaskList(pStream->tasks); - SSdb* pSdb = pMnode->pSdb; - - SArray* pHTaskList = NULL; - if (pStream->conf.fillHistory) { - pHTaskList = addNewTaskList(pStream->pHTasksList); +static int32_t doAddSourceTask(SMnode* pMnode, SSubplan* plan, SStreamObj* pStream, SEpSet* pEpset, + int64_t skey, SArray* pVerList, SVgObj* pVgroup, bool isFillhistory, bool useTriggerParam ){ + // new stream task + SStreamTask* pTask = buildSourceTask(pStream, pEpset, isFillhistory, useTriggerParam); + if(pTask == NULL){ + terrno = TSDB_CODE_OUT_OF_MEMORY; + return terrno; } + mDebug("doAddSourceTask taskId:%s, vgId:%d, isFillHistory:%d", pTask->id.idStr, pVgroup->vgId, isFillhistory); - SNodeListNode* inner = (SNodeListNode*)nodesListGetNode(pPlan->pSubplans, 0); + streamTaskSetDataRange(pTask, skey, pVerList, pVgroup->vgId); + + int32_t code = mndAssignStreamTaskToVgroup(pMnode, pTask, plan, pVgroup); + if(code != 0){ + terrno = code; + return terrno; + } + return TDB_CODE_SUCCESS; +} + +static SSubplan* getScanSubPlan(const SQueryPlan* pPlan){ + int32_t numOfPlanLevel = LIST_LENGTH(pPlan->pSubplans); + SNodeListNode* inner = (SNodeListNode*)nodesListGetNode(pPlan->pSubplans, numOfPlanLevel - 1); if (LIST_LENGTH(inner->pNodeList) != 1) { terrno = TSDB_CODE_QRY_INVALID_INPUT; - return -1; + return NULL; } SSubplan* plan = (SSubplan*)nodesListGetNode(inner->pNodeList, 0); if (plan->subplanType != SUBPLAN_TYPE_SCAN) { terrno = TSDB_CODE_QRY_INVALID_INPUT; - return -1; + return NULL; + } + return plan; +} + +static SSubplan* getAggSubPlan(const SQueryPlan* pPlan, int index){ + SNodeListNode* inner = (SNodeListNode*)nodesListGetNode(pPlan->pSubplans, index); + if (LIST_LENGTH(inner->pNodeList) != 1) { + terrno = TSDB_CODE_QRY_INVALID_INPUT; + return NULL; } + SSubplan* plan = (SSubplan*)nodesListGetNode(inner->pNodeList, 0); + if (plan->subplanType != SUBPLAN_TYPE_MERGE) { + terrno = TSDB_CODE_QRY_INVALID_INPUT; + return NULL; + } + return plan; +} + +static int32_t addSourceTask(SMnode* pMnode, SSubplan* plan, SStreamObj* pStream, + SEpSet* pEpset, int64_t nextWindowSkey, SArray* pVerList, bool useTriggerParam) { + addNewTaskList(pStream); + void* pIter = NULL; + SSdb* pSdb = pMnode->pSdb; while (1) { SVgObj* pVgroup; pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void**)&pVgroup); @@ -343,196 +433,15 @@ static int32_t addSourceTasksForOneLevelStream(SMnode* pMnode, const SQueryPlan* continue; } - // new stream task - SArray** pSinkTaskList = taosArrayGet(pStream->tasks, SINK_NODE_LEVEL); - int32_t code = addSourceTask(pMnode, pVgroup, pTaskList, *pSinkTaskList, pStream, plan, pStream->uid, pEpset, - false, hasExtraSink, nextWindowSkey, pStream->conf.fillHistory); - if (code != TSDB_CODE_SUCCESS) { + int code = doAddSourceTask(pMnode, plan, pStream, pEpset, nextWindowSkey, pVerList, pVgroup, false, useTriggerParam); + if(code != 0){ sdbRelease(pSdb, pVgroup); - return -1; - } - - if (pStream->conf.fillHistory) { - SArray** pHSinkTaskList = taosArrayGet(pStream->pHTasksList, SINK_NODE_LEVEL); - code = addSourceTask(pMnode, pVgroup, pHTaskList, *pHSinkTaskList, pStream, plan, pStream->hTaskUid, - pEpset, true, hasExtraSink, nextWindowSkey, true); - } - - sdbRelease(pSdb, pVgroup); - if (code != TSDB_CODE_SUCCESS) { - return -1; - } - } - - if (pStream->conf.fillHistory) { - setHTasksId(pTaskList, pHTaskList); - } - - return TSDB_CODE_SUCCESS; -} - -static int32_t doAddSourceTask(SArray* pTaskList, bool isFillhistory, int64_t uid, SStreamTask* pDownstreamTask, - SMnode* pMnode, SSubplan* pPlan, SVgObj* pVgroup, SEpSet* pEpset, - int64_t nextWindowSkey, bool hasFillHistory) { - SStreamTask* pTask = tNewStreamTask(uid, TASK_LEVEL__SOURCE, isFillhistory, 0, pTaskList, hasFillHistory); - if (pTask == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return -1; - } - - epsetAssign(&(pTask)->info.mnodeEpset, pEpset); - - // set the correct ts, which is the last key of queried table. - STimeWindow* pWindow = &pTask->dataRange.window; - pWindow->skey = INT64_MIN; - pWindow->ekey = nextWindowSkey - 1; - - mDebug("s-task:0x%x level:%d set time window:%" PRId64 " - %" PRId64, pTask->id.taskId, pTask->info.taskLevel, - pWindow->skey, pWindow->ekey); - - // all the source tasks dispatch result to a single agg node. - streamTaskSetFixedDownstreamInfo(pTask, pDownstreamTask); - if (mndAssignStreamTaskToVgroup(pMnode, pTask, pPlan, pVgroup) < 0) { - return -1; - } - - return streamTaskSetUpstreamInfo(pDownstreamTask, pTask); -} - -static int32_t doAddAggTask(uint64_t uid, SArray* pTaskList, SArray* pSinkNodeList, SMnode* pMnode, SStreamObj* pStream, - SEpSet* pEpset, bool fillHistory, SStreamTask** pAggTask, bool hasFillhistory) { - *pAggTask = tNewStreamTask(uid, TASK_LEVEL__AGG, fillHistory, pStream->conf.triggerParam, pTaskList, hasFillhistory); - if (*pAggTask == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return -1; - } - - epsetAssign(&(*pAggTask)->info.mnodeEpset, pEpset); - - // dispatch - if (mndAddDispatcherForInternalTask(pMnode, pStream, pSinkNodeList, *pAggTask) < 0) { - return -1; - } - - return 0; -} - -static int32_t addAggTask(SStreamObj* pStream, SMnode* pMnode, SQueryPlan* pPlan, SEpSet* pEpset, - SStreamTask** pAggTask, SStreamTask** pHAggTask) { - SArray* pAggTaskList = addNewTaskList(pStream->tasks); - SSdb* pSdb = pMnode->pSdb; - - SNodeListNode* pInnerNode = (SNodeListNode*)nodesListGetNode(pPlan->pSubplans, 0); - SSubplan* plan = (SSubplan*)nodesListGetNode(pInnerNode->pNodeList, 0); - if (plan->subplanType != SUBPLAN_TYPE_MERGE) { - terrno = TSDB_CODE_QRY_INVALID_INPUT; - return -1; - } - - *pAggTask = NULL; - SArray* pSinkNodeList = taosArrayGetP(pStream->tasks, SINK_NODE_LEVEL); - - int32_t code = doAddAggTask(pStream->uid, pAggTaskList, pSinkNodeList, pMnode, pStream, pEpset, false, pAggTask, - pStream->conf.fillHistory); - if (code != TSDB_CODE_SUCCESS) { - return -1; - } - - SVgObj* pVgroup = NULL; - SSnodeObj* pSnode = NULL; - - if (tsDeployOnSnode) { - pSnode = mndSchedFetchOneSnode(pMnode); - if (pSnode == NULL) { - pVgroup = mndSchedFetchOneVg(pMnode, pStream->sourceDbUid); - } - } else { - pVgroup = mndSchedFetchOneVg(pMnode, pStream->sourceDbUid); - } - - if (pSnode != NULL) { - code = mndAssignStreamTaskToSnode(pMnode, *pAggTask, plan, pSnode); - } else { - code = mndAssignStreamTaskToVgroup(pMnode, *pAggTask, plan, pVgroup); - } - - if (pStream->conf.fillHistory) { - SArray* pHAggTaskList = addNewTaskList(pStream->pHTasksList); - SArray* pHSinkNodeList = taosArrayGetP(pStream->pHTasksList, SINK_NODE_LEVEL); - - *pHAggTask = NULL; - code = doAddAggTask(pStream->hTaskUid, pHAggTaskList, pHSinkNodeList, pMnode, pStream, pEpset, pStream->conf.fillHistory, - pHAggTask, pStream->conf.fillHistory); - if (code != TSDB_CODE_SUCCESS) { - if (pSnode != NULL) { - sdbRelease(pSdb, pSnode); - } else { - sdbRelease(pSdb, pVgroup); - } return code; } - if (pSnode != NULL) { - code = mndAssignStreamTaskToSnode(pMnode, *pHAggTask, plan, pSnode); - } else { - code = mndAssignStreamTaskToVgroup(pMnode, *pHAggTask, plan, pVgroup); - } - - setHTasksId(pAggTaskList, pHAggTaskList); - } - - if (pSnode != NULL) { - sdbRelease(pSdb, pSnode); - } else { - sdbRelease(pSdb, pVgroup); - } - - return code; -} - -static int32_t addSourceTasksForMultiLevelStream(SMnode* pMnode, SQueryPlan* pPlan, SStreamObj* pStream, - SStreamTask* pDownstreamTask, SStreamTask* pHDownstreamTask, - SEpSet* pEpset, int64_t nextWindowSkey) { - SArray* pSourceTaskList = addNewTaskList(pStream->tasks); - - SArray* pHSourceTaskList = NULL; - if (pStream->conf.fillHistory) { - pHSourceTaskList = addNewTaskList(pStream->pHTasksList); - } - - SSdb* pSdb = pMnode->pSdb; - SNodeListNode* inner = (SNodeListNode*)nodesListGetNode(pPlan->pSubplans, 1); - SSubplan* plan = (SSubplan*)nodesListGetNode(inner->pNodeList, 0); - if (plan->subplanType != SUBPLAN_TYPE_SCAN) { - terrno = TSDB_CODE_QRY_INVALID_INPUT; - return -1; - } - - void* pIter = NULL; - while (1) { - SVgObj* pVgroup; - pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void**)&pVgroup); - if (pIter == NULL) { - break; - } - - if (!mndVgroupInDb(pVgroup, pStream->sourceDbUid)) { - sdbRelease(pSdb, pVgroup); - continue; - } - - int32_t code = doAddSourceTask(pSourceTaskList, false, pStream->uid, pDownstreamTask, pMnode, plan, pVgroup, pEpset, - nextWindowSkey, pStream->conf.fillHistory); - if (code != TSDB_CODE_SUCCESS) { - sdbRelease(pSdb, pVgroup); - terrno = code; - return -1; - } - if (pStream->conf.fillHistory) { - code = doAddSourceTask(pHSourceTaskList, true, pStream->hTaskUid, pHDownstreamTask, pMnode, plan, pVgroup, pEpset, - nextWindowSkey, pStream->conf.fillHistory); - if (code != TSDB_CODE_SUCCESS) { + code = doAddSourceTask(pMnode, plan, pStream, pEpset, nextWindowSkey, pVerList, pVgroup, true, useTriggerParam); + if(code != 0){ sdbRelease(pSdb, pVgroup); return code; } @@ -542,48 +451,160 @@ static int32_t addSourceTasksForMultiLevelStream(SMnode* pMnode, SQueryPlan* pPl } if (pStream->conf.fillHistory) { - setHTasksId(pSourceTaskList, pHSourceTaskList); + setHTasksId(pStream); } return TSDB_CODE_SUCCESS; } -static int32_t addSinkTasks(SArray* pTasksList, SMnode* pMnode, SStreamObj* pStream, SArray** pCreatedTaskList, - SEpSet* pEpset, bool fillHistory) { - SArray* pSinkTaskList = addNewTaskList(pTasksList); - if (pStream->fixedSinkVgId == 0) { - if (doAddShuffleSinkTask(pMnode, pSinkTaskList, pStream, pEpset, fillHistory) < 0) { - // TODO free - return -1; +static SStreamTask* buildAggTask(SStreamObj* pStream, SEpSet* pEpset, bool isFillhistory, bool useTriggerParam) { + uint64_t uid = (isFillhistory) ? pStream->hTaskUid : pStream->uid; + SArray** pTaskList = (isFillhistory) ? taosArrayGetLast(pStream->pHTasksList) : taosArrayGetLast(pStream->tasks); + + SStreamTask* pAggTask = tNewStreamTask(uid, TASK_LEVEL__AGG, pEpset, isFillhistory, + useTriggerParam ? pStream->conf.triggerParam : 0, + *pTaskList, pStream->conf.fillHistory); + if (pAggTask == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + + return pAggTask; +} + +static int32_t doAddAggTask(SStreamObj* pStream, SMnode* pMnode, SSubplan* plan, SEpSet* pEpset, + SVgObj* pVgroup, SSnodeObj* pSnode, bool isFillhistory, bool useTriggerParam){ + int32_t code = 0; + SStreamTask* pTask = buildAggTask(pStream, pEpset, isFillhistory, useTriggerParam); + if (pTask == NULL) { + return terrno; + } + if (pSnode != NULL) { + code = mndAssignStreamTaskToSnode(pMnode, pTask, plan, pSnode); + mDebug("doAddAggTask taskId:%s, snode id:%d, isFillHistory:%d", pTask->id.idStr, pSnode->id, isFillhistory); + + } else { + code = mndAssignStreamTaskToVgroup(pMnode, pTask, plan, pVgroup); + mDebug("doAddAggTask taskId:%s, vgId:%d, isFillHistory:%d", pTask->id.idStr, pVgroup->vgId, isFillhistory); + } + return code; +} + +static int32_t addAggTask(SStreamObj* pStream, SMnode* pMnode, SSubplan* plan, SEpSet* pEpset, bool useTriggerParam){ + SVgObj* pVgroup = NULL; + SSnodeObj* pSnode = NULL; + int32_t code = 0; + if (tsDeployOnSnode) { + pSnode = mndSchedFetchOneSnode(pMnode); + if (pSnode == NULL) { + pVgroup = mndSchedFetchOneVg(pMnode, pStream); } } else { - if (doAddSinkTask(pStream, pSinkTaskList, pMnode, pStream->fixedSinkVgId, &pStream->fixedSinkVg, pEpset, - fillHistory) < 0) { - // TODO free - return -1; + pVgroup = mndSchedFetchOneVg(pMnode, pStream); + } + + code = doAddAggTask(pStream, pMnode, plan, pEpset, pVgroup, pSnode, false, useTriggerParam); + if(code != 0){ + goto END; + } + + if (pStream->conf.fillHistory) { + code = doAddAggTask(pStream, pMnode, plan, pEpset, pVgroup, pSnode, true, useTriggerParam); + if(code != 0){ + goto END; + } + + setHTasksId(pStream); + } + + END: + if (pSnode != NULL) { + sdbRelease(pMnode->pSdb, pSnode); + } else { + sdbRelease(pMnode->pSdb, pVgroup); + } + return code; +} + +static int32_t addSinkTask(SMnode* pMnode, SStreamObj* pStream, SEpSet* pEpset){ + int32_t code = 0; + addNewTaskList(pStream); + + if (pStream->fixedSinkVgId == 0) { + code = doAddShuffleSinkTask(pMnode, pStream, pEpset); + if (code != 0) { + return code; + } + } else { + code = doAddSinkTaskToVg(pMnode, pStream, pEpset, &pStream->fixedSinkVg); + if (code != 0) { + return code; } } - *pCreatedTaskList = pSinkTaskList; - return TSDB_CODE_SUCCESS; + if (pStream->conf.fillHistory) { + setHTasksId(pStream); + } + return TDB_CODE_SUCCESS; } -static void setSinkTaskUpstreamInfo(SArray* pTasksList, const SStreamTask* pUpstreamTask) { - if (taosArrayGetSize(pTasksList) < SINK_NODE_LEVEL || pUpstreamTask == NULL) { - return; +static void bindTaskToSinkTask(SStreamObj* pStream, SMnode* pMnode, SArray* pSinkTaskList, SStreamTask* task){ + mndAddDispatcherForInternalTask(pMnode, pStream, pSinkTaskList, task); + for(int32_t k = 0; k < taosArrayGetSize(pSinkTaskList); k++) { + SStreamTask* pSinkTask = taosArrayGetP(pSinkTaskList, k); + streamTaskSetUpstreamInfo(pSinkTask, task); } + mDebug("bindTaskToSinkTask taskId:%s to sink task list", task->id.idStr); +} - SArray* pSinkTaskList = taosArrayGetP(pTasksList, SINK_NODE_LEVEL); - for(int32_t i = 0; i < taosArrayGetSize(pSinkTaskList); ++i) { - SStreamTask* pSinkTask = taosArrayGetP(pSinkTaskList, i); - streamTaskSetUpstreamInfo(pSinkTask, pUpstreamTask); +static void bindAggSink(SStreamObj* pStream, SMnode* pMnode, SArray* tasks) { + SArray* pSinkTaskList = taosArrayGetP(tasks, SINK_NODE_LEVEL); + SArray** pAggTaskList = taosArrayGetLast(tasks); + + for(int i = 0; i < taosArrayGetSize(*pAggTaskList); i++){ + SStreamTask* pAggTask = taosArrayGetP(*pAggTaskList, i); + bindTaskToSinkTask(pStream, pMnode, pSinkTaskList, pAggTask); + mDebug("bindAggSink taskId:%s to sink task list", pAggTask->id.idStr); } } -static int32_t doScheduleStream(SStreamObj* pStream, SMnode* pMnode, SQueryPlan* pPlan, int64_t nextWindowSkey, SEpSet* pEpset) { +static void bindSourceSink(SStreamObj* pStream, SMnode* pMnode, SArray* tasks, bool hasExtraSink) { + SArray* pSinkTaskList = taosArrayGetP(tasks, SINK_NODE_LEVEL); + SArray* pSourceTaskList = taosArrayGetP(tasks, hasExtraSink ? SINK_NODE_LEVEL + 1 : SINK_NODE_LEVEL); + + for(int i = 0; i < taosArrayGetSize(pSourceTaskList); i++){ + SStreamTask* pSourceTask = taosArrayGetP(pSourceTaskList, i); + mDebug("bindSourceSink taskId:%s to sink task list", pSourceTask->id.idStr); + + if (hasExtraSink) { + bindTaskToSinkTask(pStream, pMnode, pSinkTaskList, pSourceTask); + } else { + mndSetSinkTaskInfo(pStream, pSourceTask); + } + } +} + +static void bindTwoLevel(SArray* tasks, int32_t begin, int32_t end) { + size_t size = taosArrayGetSize(tasks); + ASSERT(size >= 2); + SArray* pDownTaskList = taosArrayGetP(tasks, size - 1); + SArray* pUpTaskList = taosArrayGetP(tasks, size - 2); + + SStreamTask** pDownTask = taosArrayGetLast(pDownTaskList); + end = end > taosArrayGetSize(pUpTaskList) ? taosArrayGetSize(pUpTaskList): end; + for(int i = begin; i < end; i++){ + SStreamTask* pUpTask = taosArrayGetP(pUpTaskList, i); + pUpTask->info.selfChildId = i - begin; + streamTaskSetFixedDownstreamInfo(pUpTask, *pDownTask); + streamTaskSetUpstreamInfo(*pDownTask, pUpTask); + } + mDebug("bindTwoLevel task list(%d-%d) to taskId:%s", begin, end - 1, (*(pDownTask))->id.idStr); +} + +static int32_t doScheduleStream(SStreamObj* pStream, SMnode* pMnode, SQueryPlan* pPlan, SEpSet* pEpset, int64_t skey, + SArray* pVerList) { SSdb* pSdb = pMnode->pSdb; int32_t numOfPlanLevel = LIST_LENGTH(pPlan->pSubplans); - bool hasExtraSink = false; bool externalTargetDB = strcmp(pStream->sourceDb, pStream->targetDb) != 0; SDbObj* pDbObj = mndAcquireDb(pMnode, pStream->targetDb); @@ -595,57 +616,93 @@ static int32_t doScheduleStream(SStreamObj* pStream, SMnode* pMnode, SQueryPlan* bool multiTarget = (pDbObj->cfg.numOfVgroups > 1); sdbRelease(pSdb, pDbObj); + mDebug("doScheduleStream numOfPlanLevel:%d, exDb:%d, multiTarget:%d, fix vgId:%d, physicalPlan:%s", + numOfPlanLevel, externalTargetDB, multiTarget, pStream->fixedSinkVgId, pStream->physicalPlan); pStream->tasks = taosArrayInit(numOfPlanLevel + 1, POINTER_BYTES); pStream->pHTasksList = taosArrayInit(numOfPlanLevel + 1, POINTER_BYTES); - if (numOfPlanLevel == 2 || externalTargetDB || multiTarget || pStream->fixedSinkVgId) { + if (numOfPlanLevel > 1 || externalTargetDB || multiTarget || pStream->fixedSinkVgId) { // add extra sink hasExtraSink = true; - - SArray* pSinkTaskList = NULL; - int32_t code = addSinkTasks(pStream->tasks, pMnode, pStream, &pSinkTaskList, pEpset, 0); + int32_t code = addSinkTask(pMnode, pStream, pEpset); if (code != TSDB_CODE_SUCCESS) { return code; } - - // check for fill history - if (pStream->conf.fillHistory) { - SArray* pHSinkTaskList = NULL; - code = addSinkTasks(pStream->pHTasksList, pMnode, pStream, &pHSinkTaskList, pEpset, 1); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - - setHTasksId(pSinkTaskList, pHSinkTaskList); - } } pStream->totalLevel = numOfPlanLevel + hasExtraSink; - if (numOfPlanLevel > 1) { - SStreamTask* pAggTask = NULL; - SStreamTask* pHAggTask = NULL; - - int32_t code = addAggTask(pStream, pMnode, pPlan, pEpset, &pAggTask, &pHAggTask); - if (code != TSDB_CODE_SUCCESS) { - return code; - } - - setSinkTaskUpstreamInfo(pStream->tasks, pAggTask); - if (pHAggTask != NULL) { - setSinkTaskUpstreamInfo(pStream->pHTasksList, pHAggTask); - } - - // source level - return addSourceTasksForMultiLevelStream(pMnode, pPlan, pStream, pAggTask, pHAggTask, pEpset, nextWindowSkey); - } else if (numOfPlanLevel == 1) { - return addSourceTasksForOneLevelStream(pMnode, pPlan, pStream, pEpset, hasExtraSink, nextWindowSkey); + SSubplan* plan = getScanSubPlan(pPlan); // source plan + if (plan == NULL) { + return terrno; + } + int32_t code = addSourceTask(pMnode, plan, pStream, pEpset, skey, pVerList, numOfPlanLevel == 1); + if (code != TSDB_CODE_SUCCESS) { + return code; } - return 0; + if (numOfPlanLevel == 1) { + bindSourceSink(pStream, pMnode, pStream->tasks, hasExtraSink); + if (pStream->conf.fillHistory) { + bindSourceSink(pStream, pMnode, pStream->pHTasksList, hasExtraSink); + } + return TDB_CODE_SUCCESS; + } + + if(numOfPlanLevel == 3){ + plan = getAggSubPlan(pPlan, 1); // middle agg plan + if (plan == NULL) { + return terrno; + } + do{ + SArray** list = taosArrayGetLast(pStream->tasks); + float size = (float)taosArrayGetSize(*list); + size_t cnt = (size_t)ceil(size/tsStreamAggCnt); + if(cnt <= 1) break; + + mDebug("doScheduleStream add middle agg, size:%d, cnt:%d", (int)size, (int)cnt); + addNewTaskList(pStream); + + for(int j = 0; j < cnt; j++){ + code = addAggTask(pStream, pMnode, plan, pEpset, false); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + bindTwoLevel(pStream->tasks, j*tsStreamAggCnt, (j+1)*tsStreamAggCnt); + if (pStream->conf.fillHistory) { + bindTwoLevel(pStream->pHTasksList, j*tsStreamAggCnt, (j+1)*tsStreamAggCnt); + } + } + }while(1); + } + + plan = getAggSubPlan(pPlan, 0); + if (plan == NULL) { + return terrno; + } + + mDebug("doScheduleStream add final agg"); + SArray** list = taosArrayGetLast(pStream->tasks); + size_t size = taosArrayGetSize(*list); + addNewTaskList(pStream); + code = addAggTask(pStream, pMnode, plan, pEpset, true); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + bindTwoLevel(pStream->tasks, 0, size); + if (pStream->conf.fillHistory) { + bindTwoLevel(pStream->pHTasksList, 0, size); + } + + bindAggSink(pStream, pMnode, pStream->tasks); + if (pStream->conf.fillHistory) { + bindAggSink(pStream, pMnode, pStream->pHTasksList); + } + return TDB_CODE_SUCCESS; } -int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream, int64_t nextWindowSkey) { +int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream, int64_t skey, SArray* pVgVerList) { SQueryPlan* pPlan = qStringToQueryPlan(pStream->physicalPlan); if (pPlan == NULL) { terrno = TSDB_CODE_QRY_INVALID_INPUT; @@ -655,7 +712,7 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream, int64_t nextWindo SEpSet mnodeEpset = {0}; mndGetMnodeEpSet(pMnode, &mnodeEpset); - int32_t code = doScheduleStream(pStream, pMnode, pPlan, nextWindowSkey, &mnodeEpset); + int32_t code = doScheduleStream(pStream, pMnode, pPlan, &mnodeEpset, skey, pVgVerList); qDestroyQueryPlan(pPlan); return code; diff --git a/source/dnode/mnode/impl/src/mndShow.c b/source/dnode/mnode/impl/src/mndShow.c index 8e7e72aa0e..f887d05d37 100644 --- a/source/dnode/mnode/impl/src/mndShow.c +++ b/source/dnode/mnode/impl/src/mndShow.c @@ -123,6 +123,12 @@ static int32_t convertToRetrieveType(char *name, int32_t len) { type = TSDB_MGMT_TABLE_COMPACT; } else if (strncasecmp(name, TSDB_INS_TABLE_COMPACT_DETAILS, len) == 0) { type = TSDB_MGMT_TABLE_COMPACT_DETAIL; + } else if (strncasecmp(name, TSDB_INS_TABLE_GRANTS_FULL, len) == 0) { + type = TSDB_MGMT_TABLE_GRANTS_FULL; + } else if (strncasecmp(name, TSDB_INS_TABLE_GRANTS_LOGS, len) == 0) { + type = TSDB_MGMT_TABLE_GRANTS_LOGS; + } else if (strncasecmp(name, TSDB_INS_TABLE_MACHINES, len) == 0) { + type = TSDB_MGMT_TABLE_MACHINES; } else { mError("invalid show name:%s len:%d", name, len); } diff --git a/source/dnode/mnode/impl/src/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c index e6027a0332..1e92b1a181 100644 --- a/source/dnode/mnode/impl/src/mndSma.c +++ b/source/dnode/mnode/impl/src/mndSma.c @@ -566,6 +566,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea streamObj.conf.trigger = STREAM_TRIGGER_WINDOW_CLOSE; streamObj.conf.triggerParam = pCreate->maxDelay; streamObj.ast = taosStrdup(smaObj.ast); + streamObj.indexForMultiAggBalance = -1; // check the maxDelay if (streamObj.conf.triggerParam < TSDB_MIN_ROLLUP_MAX_DELAY) { @@ -638,7 +639,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea if (mndSetCreateSmaVgroupCommitLogs(pMnode, pTrans, &streamObj.fixedSinkVg) != 0) goto _OVER; if (mndSetUpdateSmaStbCommitLogs(pMnode, pTrans, pStb) != 0) goto _OVER; if (mndSetCreateSmaVgroupRedoActions(pMnode, pTrans, pDb, &streamObj.fixedSinkVg, &smaObj) != 0) goto _OVER; - if (mndScheduleStream(pMnode, &streamObj, 1685959190000) != 0) goto _OVER; + if (mndScheduleStream(pMnode, &streamObj, 1685959190000, NULL) != 0) goto _OVER; if (mndPersistStream(pTrans, &streamObj) != 0) goto _OVER; if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER; diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 46c7a06079..190b4f28ce 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -62,8 +62,6 @@ static SVgroupChangeInfo mndFindChangedNodeInfo(SMnode *pMnode, const SArray *pP static void removeStreamTasksInBuf(SStreamObj *pStream, SStreamExecInfo *pExecNode); static int32_t removeExpirednodeEntryAndTask(SArray *pNodeSnapshot); static int32_t doKillCheckpointTrans(SMnode *pMnode, const char *pDbName, size_t len); -static void freeCheckpointCandEntry(void *); -static void freeTaskList(void *param); static SSdbRow *mndStreamActionDecode(SSdbRaw *pRaw); SSdbRaw *mndStreamSeqActionEncode(SStreamObj *pStream); @@ -121,17 +119,7 @@ int32_t mndInitStream(SMnode *pMnode) { mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_STREAM_TASKS, mndRetrieveStreamTask); mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_STREAM_TASKS, mndCancelGetNextStreamTask); - taosThreadMutexInit(&execInfo.lock, NULL); - _hash_fn_t fn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR); - - execInfo.pTaskList = taosArrayInit(4, sizeof(STaskId)); - execInfo.pTaskMap = taosHashInit(64, fn, true, HASH_NO_LOCK); - execInfo.transMgmt.pDBTrans = taosHashInit(32, fn, true, HASH_NO_LOCK); - execInfo.transMgmt.pWaitingList = taosHashInit(32, fn, true, HASH_NO_LOCK); - execInfo.pTransferStateStreams = taosHashInit(32, fn, true, HASH_NO_LOCK); - - taosHashSetFreeFp(execInfo.transMgmt.pWaitingList, freeCheckpointCandEntry); - taosHashSetFreeFp(execInfo.pTransferStateStreams, freeTaskList); + mndInitExecInfo(); if (sdbSetTable(pMnode->pSdb, table) != 0) { return -1; @@ -309,6 +297,7 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj, pObj->updateTime = pObj->createTime; pObj->version = 1; pObj->smaId = 0; + pObj->indexForMultiAggBalance = -1; pObj->uid = mndGenerateUid(pObj->name, strlen(pObj->name)); @@ -476,22 +465,20 @@ int32_t mndPersistTaskDeployReq(STrans *pTrans, SStreamTask *pTask) { } int32_t mndPersistStreamTasks(STrans *pTrans, SStreamObj *pStream) { - int32_t level = taosArrayGetSize(pStream->tasks); - for (int32_t i = 0; i < level; i++) { - SArray *pLevel = taosArrayGetP(pStream->tasks, i); - - int32_t numOfTasks = taosArrayGetSize(pLevel); - for (int32_t j = 0; j < numOfTasks; j++) { - SStreamTask *pTask = taosArrayGetP(pLevel, j); - if (mndPersistTaskDeployReq(pTrans, pTask) < 0) { - return -1; - } + SStreamTaskIter *pIter = createStreamTaskIter(pStream); + while (streamTaskIterNextTask(pIter)) { + SStreamTask *pTask = streamTaskIterGetCurrent(pIter); + if (mndPersistTaskDeployReq(pTrans, pTask) < 0) { + destroyStreamTaskIter(pIter); + return -1; } } + destroyStreamTaskIter(pIter); + // persistent stream task for already stored ts data if (pStream->conf.fillHistory) { - level = taosArrayGetSize(pStream->pHTasksList); + int32_t level = taosArrayGetSize(pStream->pHTasksList); for (int32_t i = 0; i < level; i++) { SArray *pLevel = taosArrayGetP(pStream->pHTasksList, i); @@ -646,8 +633,12 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) { int32_t sqlLen = 0; terrno = TSDB_CODE_SUCCESS; - SCMCreateStreamReq createStreamReq = {0}; - if (tDeserializeSCMCreateStreamReq(pReq->pCont, pReq->contLen, &createStreamReq) != 0) { + if ((terrno = grantCheck(TSDB_GRANT_STREAMS)) < 0) { + goto _OVER; + } + + SCMCreateStreamReq createReq = {0}; + if (tDeserializeSCMCreateStreamReq(pReq->pCont, pReq->contLen, &createReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; goto _OVER; } @@ -656,17 +647,17 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) { terrno = TSDB_CODE_MND_INVALID_PLATFORM; goto _OVER; #endif - mInfo("stream:%s, start to create, sql:%s", createStreamReq.name, createStreamReq.sql); + mInfo("stream:%s, start to create, sql:%s", createReq.name, createReq.sql); - if (mndCheckCreateStreamReq(&createStreamReq) != 0) { - mError("stream:%s, failed to create since %s", createStreamReq.name, terrstr()); + if (mndCheckCreateStreamReq(&createReq) != 0) { + mError("stream:%s, failed to create since %s", createReq.name, terrstr()); goto _OVER; } - pStream = mndAcquireStream(pMnode, createStreamReq.name); + pStream = mndAcquireStream(pMnode, createReq.name); if (pStream != NULL) { - if (createStreamReq.igExists) { - mInfo("stream:%s, already exist, ignore exist is set", createStreamReq.name); + if (createReq.igExists) { + mInfo("stream:%s, already exist, ignore exist is set", createReq.name); goto _OVER; } else { terrno = TSDB_CODE_MND_STREAM_ALREADY_EXIST; @@ -676,16 +667,16 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) { goto _OVER; } - if (createStreamReq.sql != NULL) { - sqlLen = strlen(createStreamReq.sql); + if (createReq.sql != NULL) { + sqlLen = strlen(createReq.sql); sql = taosMemoryMalloc(sqlLen + 1); memset(sql, 0, sqlLen + 1); - memcpy(sql, createStreamReq.sql, sqlLen); + memcpy(sql, createReq.sql, sqlLen); } // build stream obj from request - if (mndBuildStreamObjFromCreateReq(pMnode, &streamObj, &createStreamReq) < 0) { - mError("stream:%s, failed to create since %s", createStreamReq.name, terrstr()); + if (mndBuildStreamObjFromCreateReq(pMnode, &streamObj, &createReq) < 0) { + mError("stream:%s, failed to create since %s", createReq.name, terrstr()); goto _OVER; } @@ -699,23 +690,23 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) { } // create stb for stream - if (createStreamReq.createStb == STREAM_CREATE_STABLE_TRUE && + if (createReq.createStb == STREAM_CREATE_STABLE_TRUE && mndCreateStbForStream(pMnode, pTrans, &streamObj, pReq->info.conn.user) < 0) { - mError("trans:%d, failed to create stb for stream %s since %s", pTrans->id, createStreamReq.name, terrstr()); + mError("trans:%d, failed to create stb for stream %s since %s", pTrans->id, createReq.name, terrstr()); mndTransDrop(pTrans); goto _OVER; } // schedule stream task for stream obj - if (mndScheduleStream(pMnode, &streamObj, createStreamReq.lastTs) < 0) { - mError("stream:%s, failed to schedule since %s", createStreamReq.name, terrstr()); + if (mndScheduleStream(pMnode, &streamObj, createReq.lastTs, createReq.pVgroupVerList) < 0) { + mError("stream:%s, failed to schedule since %s", createReq.name, terrstr()); mndTransDrop(pTrans); goto _OVER; } // add stream to trans if (mndPersistStream(pTrans, &streamObj) < 0) { - mError("stream:%s, failed to schedule since %s", createStreamReq.name, terrstr()); + mError("stream:%s, failed to schedule since %s", createReq.name, terrstr()); mndTransDrop(pTrans); goto _OVER; } @@ -746,10 +737,10 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) { taosThreadMutexUnlock(&execInfo.lock); SName dbname = {0}; - tNameFromString(&dbname, createStreamReq.sourceDB, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE); + tNameFromString(&dbname, createReq.sourceDB, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE); SName name = {0}; - tNameFromString(&name, createStreamReq.name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE); + tNameFromString(&name, createReq.name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE); // reuse this function for stream if (sql != NULL && sqlLen > 0) { @@ -762,11 +753,11 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) { _OVER: if (terrno != TSDB_CODE_SUCCESS && terrno != TSDB_CODE_ACTION_IN_PROGRESS) { - mError("stream:%s, failed to create since %s", createStreamReq.name, terrstr()); + mError("stream:%s, failed to create since %s", createReq.name, terrstr()); } mndReleaseStream(pMnode, pStream); - tFreeSCMCreateStreamReq(&createStreamReq); + tFreeSCMCreateStreamReq(&createReq); tFreeStreamObj(&streamObj); if (sql != NULL) { taosMemoryFreeClear(sql); @@ -856,6 +847,32 @@ static int32_t mndBuildStreamCheckpointSourceReq(void **pBuf, int32_t *pLen, int return 0; } +static int32_t doSetCheckpointAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask, int64_t checkpointId, + int8_t mndTrigger) { + void *buf; + int32_t tlen; + if (mndBuildStreamCheckpointSourceReq(&buf, &tlen, pTask->info.nodeId, checkpointId, pTask->id.streamId, + pTask->id.taskId, pTrans->id, mndTrigger) < 0) { + taosMemoryFree(buf); + return -1; + } + + SEpSet epset = {0}; + bool hasEpset = false; + int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId); + if (code != TSDB_CODE_SUCCESS || !hasEpset) { + taosMemoryFree(buf); + return -1; + } + + code = setTransAction(pTrans, buf, tlen, TDMT_VND_STREAM_CHECK_POINT_SOURCE, &epset, TSDB_CODE_SYN_PROPOSE_NOT_READY); + if (code != 0) { + taosMemoryFree(buf); + } + + return code; +} + static int32_t mndProcessStreamCheckpointTrans(SMnode *pMnode, SStreamObj *pStream, int64_t checkpointId, int8_t mndTrigger, bool lock) { int32_t code = -1; @@ -865,6 +882,7 @@ static int32_t mndProcessStreamCheckpointTrans(SMnode *pMnode, SStreamObj *pStre return -1; } + bool conflict = mndStreamTransConflictCheck(pMnode, pStream->uid, MND_STREAM_CHECKPOINT_NAME, lock); if (conflict) { mndAddtoCheckpointWaitingList(pStream, checkpointId); @@ -887,8 +905,8 @@ static int32_t mndProcessStreamCheckpointTrans(SMnode *pMnode, SStreamObj *pStre pStream->currentTick = 1; // 1. redo action: broadcast checkpoint source msg for all source vg - int32_t totLevel = taosArrayGetSize(pStream->tasks); - for (int32_t i = 0; i < totLevel; i++) { + int32_t totalLevel = taosArrayGetSize(pStream->tasks); + for (int32_t i = 0; i < totalLevel; i++) { SArray *pLevel = taosArrayGetP(pStream->tasks, i); SStreamTask *p = taosArrayGetP(pLevel, 0); @@ -896,28 +914,9 @@ static int32_t mndProcessStreamCheckpointTrans(SMnode *pMnode, SStreamObj *pStre int32_t sz = taosArrayGetSize(pLevel); for (int32_t j = 0; j < sz; j++) { SStreamTask *pTask = taosArrayGetP(pLevel, j); + code = doSetCheckpointAction(pMnode, pTrans, pTask, checkpointId, mndTrigger); - void *buf; - int32_t tlen; - if (mndBuildStreamCheckpointSourceReq(&buf, &tlen, pTask->info.nodeId, checkpointId, pTask->id.streamId, - pTask->id.taskId, pTrans->id, mndTrigger) < 0) { - taosWUnLockLatch(&pStream->lock); - goto _ERR; - } - - SEpSet epset = {0}; - bool hasEpset = false; - code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId); - if (code != TSDB_CODE_SUCCESS || !hasEpset) { - taosMemoryFree(buf); - taosWUnLockLatch(&pStream->lock); - goto _ERR; - } - - code = setTransAction(pTrans, buf, tlen, TDMT_VND_STREAM_CHECK_POINT_SOURCE, &epset, - TSDB_CODE_SYN_PROPOSE_NOT_READY); - if (code != 0) { - taosMemoryFree(buf); + if (code != TSDB_CODE_SUCCESS) { taosWUnLockLatch(&pStream->lock); goto _ERR; } @@ -1500,21 +1499,19 @@ static int32_t mndRetrieveStreamTask(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock } // add row for each task - for (int32_t i = 0; i < taosArrayGetSize(pStream->tasks); i++) { - SArray *pLevel = taosArrayGetP(pStream->tasks, i); + SStreamTaskIter *pIter = createStreamTaskIter(pStream); + while (streamTaskIterNextTask(pIter)) { + SStreamTask *pTask = streamTaskIterGetCurrent(pIter); - int32_t numOfLevels = taosArrayGetSize(pLevel); - for (int32_t j = 0; j < numOfLevels; j++) { - SStreamTask *pTask = taosArrayGetP(pLevel, j); - int32_t code = setTaskAttrInResBlock(pStream, pTask, pBlock, numOfRows); - if (code == TSDB_CODE_SUCCESS) { - numOfRows++; - } + int32_t code = setTaskAttrInResBlock(pStream, pTask, pBlock, numOfRows); + if (code == TSDB_CODE_SUCCESS) { + numOfRows++; } } - // unlock + destroyStreamTaskIter(pIter); taosRUnLockLatch(&pStream->lock); + sdbRelease(pSdb, pStream); } @@ -1620,21 +1617,26 @@ static int32_t mndProcessResumeStreamReq(SRpcMsg *pReq) { SMnode *pMnode = pReq->info.node; SStreamObj *pStream = NULL; - SMResumeStreamReq pauseReq = {0}; - if (tDeserializeSMResumeStreamReq(pReq->pCont, pReq->contLen, &pauseReq) < 0) { + if(grantCheckExpire(TSDB_GRANT_STREAMS) < 0){ + terrno = TSDB_CODE_GRANT_EXPIRED; + return -1; + } + + SMResumeStreamReq resumeReq = {0}; + if (tDeserializeSMResumeStreamReq(pReq->pCont, pReq->contLen, &resumeReq) < 0) { terrno = TSDB_CODE_INVALID_MSG; return -1; } - pStream = mndAcquireStream(pMnode, pauseReq.name); + pStream = mndAcquireStream(pMnode, resumeReq.name); if (pStream == NULL) { - if (pauseReq.igNotExists) { - mInfo("stream:%s not exist, not resume stream", pauseReq.name); + if (resumeReq.igNotExists) { + mInfo("stream:%s not exist, not resume stream", resumeReq.name); sdbRelease(pMnode->pSdb, pStream); return 0; } else { - mError("stream:%s not exist, failed to resume stream", pauseReq.name); + mError("stream:%s not exist, failed to resume stream", resumeReq.name); terrno = TSDB_CODE_MND_STREAM_NOT_EXIST; return -1; } @@ -1659,7 +1661,7 @@ static int32_t mndProcessResumeStreamReq(SRpcMsg *pReq) { STrans* pTrans = doCreateTrans(pMnode, pStream, pReq, MND_STREAM_RESUME_NAME, "resume the stream"); if (pTrans == NULL) { - mError("stream:%s, failed to resume stream since %s", pauseReq.name, terrstr()); + mError("stream:%s, failed to resume stream since %s", resumeReq.name, terrstr()); sdbRelease(pMnode->pSdb, pStream); return -1; } @@ -1667,8 +1669,8 @@ static int32_t mndProcessResumeStreamReq(SRpcMsg *pReq) { int32_t code = mndStreamRegisterTrans(pTrans, MND_STREAM_RESUME_NAME, pStream->uid); // set the resume action - if (mndStreamSetResumeAction(pTrans, pMnode, pStream, pauseReq.igUntreated) < 0) { - mError("stream:%s, failed to drop task since %s", pauseReq.name, terrstr()); + if (mndStreamSetResumeAction(pTrans, pMnode, pStream, resumeReq.igUntreated) < 0) { + mError("stream:%s, failed to drop task since %s", resumeReq.name, terrstr()); sdbRelease(pMnode->pSdb, pStream); mndTransDrop(pTrans); return -1; @@ -1829,6 +1831,11 @@ static int32_t mndProcessVgroupChange(SMnode *pMnode, SVgroupChangeInfo *pChange } } + // no need to build the trans to handle the vgroup upddate + if (pTrans == NULL) { + return 0; + } + if (mndTransPrepare(pMnode, pTrans) != 0) { mError("trans:%d, failed to prepare update stream trans since %s", pTrans->id, terrstr()); sdbRelease(pMnode->pSdb, pStream); @@ -1854,22 +1861,19 @@ static SArray *extractNodeListFromStream(SMnode *pMnode) { } taosWLockLatch(&pStream->lock); - int32_t numOfLevels = taosArrayGetSize(pStream->tasks); - for (int32_t j = 0; j < numOfLevels; ++j) { - SArray *pLevel = taosArrayGetP(pStream->tasks, j); + SStreamTaskIter *pTaskIter = createStreamTaskIter(pStream); + while (streamTaskIterNextTask(pTaskIter)) { + SStreamTask *pTask = streamTaskIterGetCurrent(pTaskIter); - int32_t numOfTasks = taosArrayGetSize(pLevel); - for (int32_t k = 0; k < numOfTasks; ++k) { - SStreamTask *pTask = taosArrayGetP(pLevel, k); - - SNodeEntry entry = {.hbTimestamp = -1, .nodeId = pTask->info.nodeId}; - epsetAssign(&entry.epset, &pTask->info.epSet); - taosHashPut(pHash, &entry.nodeId, sizeof(entry.nodeId), &entry, sizeof(entry)); - } + SNodeEntry entry = {.hbTimestamp = -1, .nodeId = pTask->info.nodeId}; + epsetAssign(&entry.epset, &pTask->info.epSet); + taosHashPut(pHash, &entry.nodeId, sizeof(entry.nodeId), &entry, sizeof(entry)); } + destroyStreamTaskIter(pTaskIter); taosWUnLockLatch(&pStream->lock); + sdbRelease(pSdb, pStream); } @@ -2055,71 +2059,53 @@ static int32_t mndProcessNodeCheck(SRpcMsg *pReq) { } void saveStreamTasksInfo(SStreamObj *pStream, SStreamExecInfo *pExecNode) { - int32_t level = taosArrayGetSize(pStream->tasks); + SStreamTaskIter *pIter = createStreamTaskIter(pStream); + while (streamTaskIterNextTask(pIter)) { + SStreamTask *pTask = streamTaskIterGetCurrent(pIter); - for (int32_t i = 0; i < level; i++) { - SArray *pLevel = taosArrayGetP(pStream->tasks, i); + STaskId id = {.streamId = pTask->id.streamId, .taskId = pTask->id.taskId}; + void *p = taosHashGet(pExecNode->pTaskMap, &id, sizeof(id)); + if (p == NULL) { + STaskStatusEntry entry = {0}; + streamTaskStatusInit(&entry, pTask); - int32_t numOfTasks = taosArrayGetSize(pLevel); - for (int32_t j = 0; j < numOfTasks; j++) { - SStreamTask *pTask = taosArrayGetP(pLevel, j); - - STaskId id = {.streamId = pTask->id.streamId, .taskId = pTask->id.taskId}; - void *p = taosHashGet(pExecNode->pTaskMap, &id, sizeof(id)); - if (p == NULL) { - STaskStatusEntry entry = {0}; - streamTaskStatusInit(&entry, pTask); - - taosHashPut(pExecNode->pTaskMap, &id, sizeof(id), &entry, sizeof(entry)); - taosArrayPush(pExecNode->pTaskList, &id); - mInfo("s-task:0x%x add into task buffer, total:%d", (int32_t)entry.id.taskId, - (int32_t)taosArrayGetSize(pExecNode->pTaskList)); - } + taosHashPut(pExecNode->pTaskMap, &id, sizeof(id), &entry, sizeof(entry)); + taosArrayPush(pExecNode->pTaskList, &id); + mInfo("s-task:0x%x add into task buffer, total:%d", (int32_t)entry.id.taskId, + (int32_t)taosArrayGetSize(pExecNode->pTaskList)); } } + + destroyStreamTaskIter(pIter); } void removeStreamTasksInBuf(SStreamObj *pStream, SStreamExecInfo *pExecNode) { - int32_t level = taosArrayGetSize(pStream->tasks); - for (int32_t i = 0; i < level; i++) { - SArray *pLevel = taosArrayGetP(pStream->tasks, i); + SStreamTaskIter *pIter = createStreamTaskIter(pStream); + while (streamTaskIterNextTask(pIter)) { + SStreamTask *pTask = streamTaskIterGetCurrent(pIter); - int32_t numOfTasks = taosArrayGetSize(pLevel); - for (int32_t j = 0; j < numOfTasks; j++) { - SStreamTask *pTask = taosArrayGetP(pLevel, j); + STaskId id = {.streamId = pTask->id.streamId, .taskId = pTask->id.taskId}; + void *p = taosHashGet(pExecNode->pTaskMap, &id, sizeof(id)); + if (p != NULL) { + taosHashRemove(pExecNode->pTaskMap, &id, sizeof(id)); - STaskId id = {.streamId = pTask->id.streamId, .taskId = pTask->id.taskId}; - void *p = taosHashGet(pExecNode->pTaskMap, &id, sizeof(id)); - if (p != NULL) { - taosHashRemove(pExecNode->pTaskMap, &id, sizeof(id)); + for (int32_t k = 0; k < taosArrayGetSize(pExecNode->pTaskList); ++k) { + STaskId *pId = taosArrayGet(pExecNode->pTaskList, k); + if (pId->taskId == id.taskId && pId->streamId == id.streamId) { + taosArrayRemove(pExecNode->pTaskList, k); - for (int32_t k = 0; k < taosArrayGetSize(pExecNode->pTaskList); ++k) { - STaskId *pId = taosArrayGet(pExecNode->pTaskList, k); - if (pId->taskId == id.taskId && pId->streamId == id.streamId) { - taosArrayRemove(pExecNode->pTaskList, k); - - int32_t num = taosArrayGetSize(pExecNode->pTaskList); - mInfo("s-task:0x%x removed from buffer, remain:%d", (int32_t)id.taskId, num); - break; - } + int32_t num = taosArrayGetSize(pExecNode->pTaskList); + mInfo("s-task:0x%x removed from buffer, remain:%d", (int32_t)id.taskId, num); + break; } } } } + destroyStreamTaskIter(pIter); ASSERT(taosHashGetSize(pExecNode->pTaskMap) == taosArrayGetSize(pExecNode->pTaskList)); } -void freeCheckpointCandEntry(void *param) { - SCheckpointCandEntry *pEntry = param; - taosMemoryFreeClear(pEntry->pName); -} - -void freeTaskList(void* param) { - SArray** pList = (SArray **)param; - taosArrayDestroy(*pList); -} - static void doAddTaskId(SArray* pList, int32_t taskId, int64_t uid, int32_t numOfTotal) { int32_t num = taosArrayGetSize(pList); for(int32_t i = 0; i < num; ++i) { @@ -2137,7 +2123,6 @@ static void doAddTaskId(SArray* pList, int32_t taskId, int64_t uid, int32_t numO int32_t mndProcessStreamReqCheckpoint(SRpcMsg *pReq) { SMnode *pMnode = pReq->info.node; - SStreamTaskCheckpointReq req = {0}; SDecoder decoder = {0}; @@ -2196,4 +2181,4 @@ int32_t mndProcessStreamReqCheckpoint(SRpcMsg *pReq) { taosThreadMutexUnlock(&execInfo.lock); return 0; -} \ No newline at end of file +} diff --git a/source/dnode/mnode/impl/src/mndStreamHb.c b/source/dnode/mnode/impl/src/mndStreamHb.c index 5a6faadebb..5de442951c 100644 --- a/source/dnode/mnode/impl/src/mndStreamHb.c +++ b/source/dnode/mnode/impl/src/mndStreamHb.c @@ -65,61 +65,24 @@ static void addIntoCheckpointList(SArray* pList, const SFailedCheckpointInfo* pI taosArrayPush(pList, pInfo); } -static int32_t createStreamResetStatusTrans(SMnode *pMnode, SStreamObj *pStream) { +int32_t createStreamResetStatusTrans(SMnode *pMnode, SStreamObj *pStream) { STrans *pTrans = doCreateTrans(pMnode, pStream, NULL, MND_STREAM_TASK_RESET_NAME, " reset from failed checkpoint"); if (pTrans == NULL) { return terrno; } /*int32_t code = */mndStreamRegisterTrans(pTrans, MND_STREAM_TASK_RESET_NAME, pStream->uid); - - taosWLockLatch(&pStream->lock); - int32_t numOfLevels = taosArrayGetSize(pStream->tasks); - - for (int32_t j = 0; j < numOfLevels; ++j) { - SArray *pLevel = taosArrayGetP(pStream->tasks, j); - - int32_t numOfTasks = taosArrayGetSize(pLevel); - for (int32_t k = 0; k < numOfTasks; ++k) { - SStreamTask *pTask = taosArrayGetP(pLevel, k); - - // todo extract method, with pause stream task - SVResetStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVResetStreamTaskReq)); - if (pReq == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - mError("failed to malloc in reset stream, size:%" PRIzu ", code:%s", sizeof(SVResetStreamTaskReq), - tstrerror(TSDB_CODE_OUT_OF_MEMORY)); - taosWUnLockLatch(&pStream->lock); - return terrno; - } - - pReq->head.vgId = htonl(pTask->info.nodeId); - pReq->taskId = pTask->id.taskId; - pReq->streamId = pTask->id.streamId; - - SEpSet epset = {0}; - bool hasEpset = false; - int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId); - if (code != TSDB_CODE_SUCCESS || !hasEpset) { - taosMemoryFree(pReq); - continue; - } - - code = setTransAction(pTrans, pReq, sizeof(SVResetStreamTaskReq), TDMT_VND_STREAM_TASK_RESET, &epset, 0); - if (code != 0) { - taosMemoryFree(pReq); - taosWUnLockLatch(&pStream->lock); - mndTransDrop(pTrans); - return terrno; - } - } + int32_t code = mndStreamSetResetTaskAction(pMnode, pTrans, pStream); + if (code != 0) { + sdbRelease(pMnode->pSdb, pStream); + mndTransDrop(pTrans); + return code; } - taosWUnLockLatch(&pStream->lock); - - int32_t code = mndPersistTransLog(pStream, pTrans, SDB_STATUS_READY); + code = mndPersistTransLog(pStream, pTrans, SDB_STATUS_READY); if (code != TSDB_CODE_SUCCESS) { sdbRelease(pMnode->pSdb, pStream); + mndTransDrop(pTrans); return -1; } @@ -219,7 +182,40 @@ static int32_t mndDropOrphanTasks(SMnode* pMnode, SArray* pList) { mndTransDrop(pTrans); return -1; } + mndTransDrop(pTrans); + return 0; +} +int32_t suspendAllStreams(SMnode *pMnode, SRpcHandleInfo* info){ + SSdb *pSdb = pMnode->pSdb; + SStreamObj *pStream = NULL; + void* pIter = NULL; + while(1) { + pIter = sdbFetch(pSdb, SDB_STREAM, pIter, (void **)&pStream); + if (pIter == NULL) break; + + if(pStream->status != STREAM_STATUS__PAUSE){ + SMPauseStreamReq reqPause = {0}; + strcpy(reqPause.name, pStream->name); + reqPause.igNotExists = 1; + + int32_t contLen = tSerializeSMPauseStreamReq(NULL, 0, &reqPause); + void * pHead = rpcMallocCont(contLen); + tSerializeSMPauseStreamReq(pHead, contLen, &reqPause); + + SRpcMsg rpcMsg = { + .msgType = TDMT_MND_PAUSE_STREAM, + .pCont = pHead, + .contLen = contLen, + .info = *info, + }; + + tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg); + mInfo("receive pause stream:%s, %s, %p, because grant expired", pStream->name, reqPause.name, reqPause.name); + } + + sdbRelease(pSdb, pStream); + } return 0; } @@ -229,6 +225,12 @@ int32_t mndProcessStreamHb(SRpcMsg *pReq) { SArray *pFailedTasks = taosArrayInit(4, sizeof(SFailedCheckpointInfo)); SArray *pOrphanTasks = taosArrayInit(3, sizeof(SOrphanTask)); + if(grantCheckExpire(TSDB_GRANT_STREAMS) < 0){ + if(suspendAllStreams(pMnode, &pReq->info) < 0){ + return -1; + } + } + SDecoder decoder = {0}; tDecoderInit(&decoder, pReq->pCont, pReq->contLen); @@ -314,16 +316,20 @@ int32_t mndProcessStreamHb(SRpcMsg *pReq) { // current checkpoint is failed, rollback from the checkpoint trans // kill the checkpoint trans and then set all tasks status to be normal if (taosArrayGetSize(pFailedTasks) > 0) { - bool allReady = true; - SArray *p = mndTakeVgroupSnapshot(pMnode, &allReady); - taosArrayDestroy(p); + bool allReady = true; + if (pMnode != NULL) { + SArray *p = mndTakeVgroupSnapshot(pMnode, &allReady); + taosArrayDestroy(p); + } else { + allReady = false; + } if (allReady || snodeChanged) { // if the execInfo.activeCheckpoint == 0, the checkpoint is restoring from wal for(int32_t i = 0; i < taosArrayGetSize(pFailedTasks); ++i) { SFailedCheckpointInfo *pInfo = taosArrayGet(pFailedTasks, i); mInfo("checkpointId:%" PRId64 " transId:%d failed, issue task-reset trans to reset all tasks status", - pInfo->checkpointId, pInfo->transId); + pInfo->checkpointId, pInfo->transId); mndResetStatusFromCheckpoint(pMnode, pInfo->streamUid, pInfo->transId); } diff --git a/source/dnode/mnode/impl/src/mndStreamTrans.c b/source/dnode/mnode/impl/src/mndStreamTrans.c index 0a7397827e..5bfd3933b5 100644 --- a/source/dnode/mnode/impl/src/mndStreamTrans.c +++ b/source/dnode/mnode/impl/src/mndStreamTrans.c @@ -23,10 +23,10 @@ typedef struct SKeyInfo { static int32_t clearFinishedTrans(SMnode* pMnode); -int32_t mndStreamRegisterTrans(STrans* pTrans, const char* pTransName, int64_t streamUid) { +int32_t mndStreamRegisterTrans(STrans* pTrans, const char* pTransName, int64_t streamId) { SStreamTransInfo info = { - .transId = pTrans->id, .startTime = taosGetTimestampMs(), .name = pTransName, .streamUid = streamUid}; - taosHashPut(execInfo.transMgmt.pDBTrans, &streamUid, sizeof(streamUid), &info, sizeof(SStreamTransInfo)); + .transId = pTrans->id, .startTime = taosGetTimestampMs(), .name = pTransName, .streamId = streamId}; + taosHashPut(execInfo.transMgmt.pDBTrans, &streamId, sizeof(streamId), &info, sizeof(SStreamTransInfo)); return 0; } @@ -65,7 +65,7 @@ int32_t clearFinishedTrans(SMnode* pMnode) { return 0; } -bool mndStreamTransConflictCheck(SMnode* pMnode, int64_t streamUid, const char* pTransName, bool lock) { +bool mndStreamTransConflictCheck(SMnode* pMnode, int64_t streamId, const char* pTransName, bool lock) { if (lock) { taosThreadMutexLock(&execInfo.lock); } @@ -80,7 +80,7 @@ bool mndStreamTransConflictCheck(SMnode* pMnode, int64_t streamUid, const char* clearFinishedTrans(pMnode); - SStreamTransInfo *pEntry = taosHashGet(execInfo.transMgmt.pDBTrans, &streamUid, sizeof(streamUid)); + SStreamTransInfo *pEntry = taosHashGet(execInfo.transMgmt.pDBTrans, &streamId, sizeof(streamId)); if (pEntry != NULL) { SStreamTransInfo tInfo = *pEntry; @@ -90,7 +90,7 @@ bool mndStreamTransConflictCheck(SMnode* pMnode, int64_t streamUid, const char* if (strcmp(tInfo.name, MND_STREAM_CHECKPOINT_NAME) == 0) { if ((strcmp(pTransName, MND_STREAM_DROP_NAME) != 0) && (strcmp(pTransName, MND_STREAM_TASK_RESET_NAME) != 0)) { - mWarn("conflict with other transId:%d streamUid:0x%" PRIx64 ", trans:%s", tInfo.transId, tInfo.streamUid, + mWarn("conflict with other transId:%d streamUid:0x%" PRIx64 ", trans:%s", tInfo.transId, tInfo.streamId, tInfo.name); terrno = TSDB_CODE_MND_TRANS_CONFLICT; return true; @@ -99,13 +99,13 @@ bool mndStreamTransConflictCheck(SMnode* pMnode, int64_t streamUid, const char* } } else if ((strcmp(tInfo.name, MND_STREAM_CREATE_NAME) == 0) || (strcmp(tInfo.name, MND_STREAM_DROP_NAME) == 0) || (strcmp(tInfo.name, MND_STREAM_TASK_RESET_NAME) == 0)) { - mWarn("conflict with other transId:%d streamUid:0x%" PRIx64 ", trans:%s", tInfo.transId, tInfo.streamUid, + mWarn("conflict with other transId:%d streamUid:0x%" PRIx64 ", trans:%s", tInfo.transId, tInfo.streamId, tInfo.name); terrno = TSDB_CODE_MND_TRANS_CONFLICT; return true; } } else { - mDebug("stream:0x%"PRIx64" no conflict trans existed, continue create trans", streamUid); + mDebug("stream:0x%"PRIx64" no conflict trans existed, continue create trans", streamId); } if (lock) { @@ -301,86 +301,4 @@ void killAllCheckpointTrans(SMnode *pMnode, SVgroupChangeInfo *pChangeInfo) { mDebug("complete clear checkpoints in Dbs"); } -static void initNodeUpdateMsg(SStreamTaskNodeUpdateMsg *pMsg, const SVgroupChangeInfo *pInfo, SStreamTaskId *pId, - int32_t transId) { - pMsg->streamId = pId->streamId; - pMsg->taskId = pId->taskId; - pMsg->transId = transId; - pMsg->pNodeList = taosArrayInit(taosArrayGetSize(pInfo->pUpdateNodeList), sizeof(SNodeUpdateInfo)); - taosArrayAddAll(pMsg->pNodeList, pInfo->pUpdateNodeList); -} -static int32_t doBuildStreamTaskUpdateMsg(void **pBuf, int32_t *pLen, SVgroupChangeInfo *pInfo, int32_t nodeId, - SStreamTaskId *pId, int32_t transId) { - SStreamTaskNodeUpdateMsg req = {0}; - initNodeUpdateMsg(&req, pInfo, pId, transId); - - int32_t code = 0; - int32_t blen; - - tEncodeSize(tEncodeStreamTaskUpdateMsg, &req, blen, code); - if (code < 0) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - taosArrayDestroy(req.pNodeList); - return -1; - } - - int32_t tlen = sizeof(SMsgHead) + blen; - - void *buf = taosMemoryMalloc(tlen); - if (buf == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - taosArrayDestroy(req.pNodeList); - return -1; - } - - void *abuf = POINTER_SHIFT(buf, sizeof(SMsgHead)); - SEncoder encoder; - tEncoderInit(&encoder, abuf, tlen); - tEncodeStreamTaskUpdateMsg(&encoder, &req); - - SMsgHead *pMsgHead = (SMsgHead *)buf; - pMsgHead->contLen = htonl(tlen); - pMsgHead->vgId = htonl(nodeId); - - tEncoderClear(&encoder); - - *pBuf = buf; - *pLen = tlen; - - taosArrayDestroy(req.pNodeList); - return TSDB_CODE_SUCCESS; -} - -// todo extract method: traverse stream tasks -// build trans to update the epset -int32_t mndStreamSetUpdateEpsetAction(SStreamObj *pStream, SVgroupChangeInfo *pInfo, STrans *pTrans) { - mDebug("stream:0x%" PRIx64 " set tasks epset update action", pStream->uid); - - taosWLockLatch(&pStream->lock); - int32_t numOfLevels = taosArrayGetSize(pStream->tasks); - - for (int32_t j = 0; j < numOfLevels; ++j) { - SArray *pLevel = taosArrayGetP(pStream->tasks, j); - - int32_t numOfTasks = taosArrayGetSize(pLevel); - for (int32_t k = 0; k < numOfTasks; ++k) { - SStreamTask *pTask = taosArrayGetP(pLevel, k); - - void *pBuf = NULL; - int32_t len = 0; - streamTaskUpdateEpsetInfo(pTask, pInfo->pUpdateNodeList); - doBuildStreamTaskUpdateMsg(&pBuf, &len, pInfo, pTask->info.nodeId, &pTask->id, pTrans->id); - - int32_t code = setTransAction(pTrans, pBuf, len, TDMT_VND_STREAM_TASK_UPDATE, &pTask->info.epSet, 0); - if (code != TSDB_CODE_SUCCESS) { - taosMemoryFree(pBuf); - taosWUnLockLatch(&pStream->lock); - return -1; - } - } - } - - taosWUnLockLatch(&pStream->lock); - return 0; -} \ No newline at end of file diff --git a/source/dnode/mnode/impl/src/mndStreamUtil.c b/source/dnode/mnode/impl/src/mndStreamUtil.c index 5d6e34856b..3cabce2201 100644 --- a/source/dnode/mnode/impl/src/mndStreamUtil.c +++ b/source/dnode/mnode/impl/src/mndStreamUtil.c @@ -18,15 +18,15 @@ #include "tmisce.h" #include "mndVgroup.h" -typedef struct SStreamTaskIter { +struct SStreamTaskIter { SStreamObj *pStream; int32_t level; int32_t ordinalIndex; int32_t totalLevel; SStreamTask *pTask; -} SStreamTaskIter; +}; -SStreamTaskIter* createTaskIter(SStreamObj* pStream) { +SStreamTaskIter* createStreamTaskIter(SStreamObj* pStream) { SStreamTaskIter* pIter = taosMemoryCalloc(1, sizeof(SStreamTaskIter)); if (pIter == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -42,7 +42,7 @@ SStreamTaskIter* createTaskIter(SStreamObj* pStream) { return pIter; } -bool taskIterNextTask(SStreamTaskIter* pIter) { +bool streamTaskIterNextTask(SStreamTaskIter* pIter) { if (pIter->level >= pIter->totalLevel) { pIter->pTask = NULL; return false; @@ -70,11 +70,11 @@ bool taskIterNextTask(SStreamTaskIter* pIter) { return false; } -SStreamTask* taskIterGetCurrent(SStreamTaskIter* pIter) { +SStreamTask* streamTaskIterGetCurrent(SStreamTaskIter* pIter) { return pIter->pTask; } -void destroyTaskIter(SStreamTaskIter* pIter) { +void destroyStreamTaskIter(SStreamTaskIter* pIter) { taosMemoryFree(pIter); } @@ -235,18 +235,16 @@ static int32_t doSetResumeAction(STrans *pTrans, SMnode *pMnode, SStreamTask *pT } SStreamTask *mndGetStreamTask(STaskId *pId, SStreamObj *pStream) { - for (int32_t i = 0; i < taosArrayGetSize(pStream->tasks); i++) { - SArray *pLevel = taosArrayGetP(pStream->tasks, i); - - int32_t numOfLevels = taosArrayGetSize(pLevel); - for (int32_t j = 0; j < numOfLevels; j++) { - SStreamTask *pTask = taosArrayGetP(pLevel, j); - if (pTask->id.taskId == pId->taskId) { - return pTask; - } + SStreamTaskIter *pIter = createStreamTaskIter(pStream); + while (streamTaskIterNextTask(pIter)) { + SStreamTask *pTask = streamTaskIterGetCurrent(pIter); + if (pTask->id.taskId == pId->taskId) { + destroyStreamTaskIter(pIter); + return pTask; } } + destroyStreamTaskIter(pIter); return NULL; } @@ -261,21 +259,20 @@ int32_t mndGetNumOfStreamTasks(const SStreamObj *pStream) { } int32_t mndStreamSetResumeAction(STrans *pTrans, SMnode *pMnode, SStreamObj *pStream, int8_t igUntreated) { - int32_t size = taosArrayGetSize(pStream->tasks); - for (int32_t i = 0; i < size; i++) { - SArray *pTasks = taosArrayGetP(pStream->tasks, i); - int32_t sz = taosArrayGetSize(pTasks); - for (int32_t j = 0; j < sz; j++) { - SStreamTask *pTask = taosArrayGetP(pTasks, j); - if (doSetResumeAction(pTrans, pMnode, pTask, igUntreated) < 0) { - return -1; - } + SStreamTaskIter *pIter = createStreamTaskIter(pStream); - if (atomic_load_8(&pTask->status.taskStatus) == TASK_STATUS__PAUSE) { - atomic_store_8(&pTask->status.taskStatus, pTask->status.statusBackup); - } + while (streamTaskIterNextTask(pIter)) { + SStreamTask *pTask = streamTaskIterGetCurrent(pIter); + if (doSetResumeAction(pTrans, pMnode, pTask, igUntreated) < 0) { + destroyStreamTaskIter(pIter); + return -1; + } + + if (atomic_load_8(&pTask->status.taskStatus) == TASK_STATUS__PAUSE) { + atomic_store_8(&pTask->status.taskStatus, pTask->status.statusBackup); } } + destroyStreamTaskIter(pIter); return 0; } @@ -311,12 +308,12 @@ static int32_t doSetPauseAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTa } int32_t mndStreamSetPauseAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) { - SStreamTaskIter *pIter = createTaskIter(pStream); + SStreamTaskIter *pIter = createStreamTaskIter(pStream); - while (taskIterNextTask(pIter)) { - SStreamTask *pTask = taskIterGetCurrent(pIter); + while (streamTaskIterNextTask(pIter)) { + SStreamTask *pTask = streamTaskIterGetCurrent(pIter); if (doSetPauseAction(pMnode, pTrans, pTask) < 0) { - destroyTaskIter(pIter); + destroyStreamTaskIter(pIter); return -1; } @@ -326,7 +323,7 @@ int32_t mndStreamSetPauseAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStr } } - destroyTaskIter(pIter); + destroyStreamTaskIter(pIter); return 0; } @@ -360,16 +357,16 @@ static int32_t doSetDropAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTas } int32_t mndStreamSetDropAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) { - SStreamTaskIter *pIter = createTaskIter(pStream); + SStreamTaskIter *pIter = createStreamTaskIter(pStream); - while(taskIterNextTask(pIter)) { - SStreamTask *pTask = taskIterGetCurrent(pIter); + while(streamTaskIterNextTask(pIter)) { + SStreamTask *pTask = streamTaskIterGetCurrent(pIter); if (doSetDropAction(pMnode, pTrans, pTask) < 0) { - destroyTaskIter(pIter); + destroyStreamTaskIter(pIter); return -1; } } - destroyTaskIter(pIter); + destroyStreamTaskIter(pIter); return 0; } @@ -410,4 +407,163 @@ int32_t mndStreamSetDropActionFromList(SMnode *pMnode, STrans *pTrans, SArray* p doSetDropActionFromId(pMnode, pTrans, pTask); } return 0; -} \ No newline at end of file +} + +static void initNodeUpdateMsg(SStreamTaskNodeUpdateMsg *pMsg, const SVgroupChangeInfo *pInfo, SStreamTaskId *pId, + int32_t transId) { + pMsg->streamId = pId->streamId; + pMsg->taskId = pId->taskId; + pMsg->transId = transId; + pMsg->pNodeList = taosArrayInit(taosArrayGetSize(pInfo->pUpdateNodeList), sizeof(SNodeUpdateInfo)); + taosArrayAddAll(pMsg->pNodeList, pInfo->pUpdateNodeList); +} + +static int32_t doBuildStreamTaskUpdateMsg(void **pBuf, int32_t *pLen, SVgroupChangeInfo *pInfo, int32_t nodeId, + SStreamTaskId *pId, int32_t transId) { + SStreamTaskNodeUpdateMsg req = {0}; + initNodeUpdateMsg(&req, pInfo, pId, transId); + + int32_t code = 0; + int32_t blen; + + tEncodeSize(tEncodeStreamTaskUpdateMsg, &req, blen, code); + if (code < 0) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + taosArrayDestroy(req.pNodeList); + return -1; + } + + int32_t tlen = sizeof(SMsgHead) + blen; + + void *buf = taosMemoryMalloc(tlen); + if (buf == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + taosArrayDestroy(req.pNodeList); + return -1; + } + + void *abuf = POINTER_SHIFT(buf, sizeof(SMsgHead)); + SEncoder encoder; + tEncoderInit(&encoder, abuf, tlen); + tEncodeStreamTaskUpdateMsg(&encoder, &req); + + SMsgHead *pMsgHead = (SMsgHead *)buf; + pMsgHead->contLen = htonl(tlen); + pMsgHead->vgId = htonl(nodeId); + + tEncoderClear(&encoder); + + *pBuf = buf; + *pLen = tlen; + + taosArrayDestroy(req.pNodeList); + return TSDB_CODE_SUCCESS; +} + +static int32_t doSetUpdateTaskAction(STrans *pTrans, SStreamTask *pTask, SVgroupChangeInfo *pInfo) { + void *pBuf = NULL; + int32_t len = 0; + streamTaskUpdateEpsetInfo(pTask, pInfo->pUpdateNodeList); + + doBuildStreamTaskUpdateMsg(&pBuf, &len, pInfo, pTask->info.nodeId, &pTask->id, pTrans->id); + + int32_t code = setTransAction(pTrans, pBuf, len, TDMT_VND_STREAM_TASK_UPDATE, &pTask->info.epSet, 0); + if (code != TSDB_CODE_SUCCESS) { + taosMemoryFree(pBuf); + } + + return code; +} + +// build trans to update the epset +int32_t mndStreamSetUpdateEpsetAction(SStreamObj *pStream, SVgroupChangeInfo *pInfo, STrans *pTrans) { + mDebug("stream:0x%" PRIx64 " set tasks epset update action", pStream->uid); + taosWLockLatch(&pStream->lock); + + SStreamTaskIter *pIter = createStreamTaskIter(pStream); + while (streamTaskIterNextTask(pIter)) { + SStreamTask *pTask = streamTaskIterGetCurrent(pIter); + int32_t code = doSetUpdateTaskAction(pTrans, pTask, pInfo); + if (code != TSDB_CODE_SUCCESS) { + destroyStreamTaskIter(pIter); + taosWUnLockLatch(&pStream->lock); + return -1; + } + } + + destroyStreamTaskIter(pIter); + taosWUnLockLatch(&pStream->lock); + return 0; +} + +static int32_t doSetResetAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask) { + SVResetStreamTaskReq *pReq = taosMemoryCalloc(1, sizeof(SVResetStreamTaskReq)); + if (pReq == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + mError("failed to malloc in reset stream, size:%" PRIzu ", code:%s", sizeof(SVResetStreamTaskReq), + tstrerror(TSDB_CODE_OUT_OF_MEMORY)); + return terrno; + } + + pReq->head.vgId = htonl(pTask->info.nodeId); + pReq->taskId = pTask->id.taskId; + pReq->streamId = pTask->id.streamId; + + SEpSet epset = {0}; + bool hasEpset = false; + int32_t code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId); + if (code != TSDB_CODE_SUCCESS || !hasEpset) { + taosMemoryFree(pReq); + return code; + } + + code = setTransAction(pTrans, pReq, sizeof(SVResetStreamTaskReq), TDMT_VND_STREAM_TASK_RESET, &epset, 0); + if (code != TSDB_CODE_SUCCESS) { + taosMemoryFree(pReq); + } + + return code; +} + +int32_t mndStreamSetResetTaskAction(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) { + taosWLockLatch(&pStream->lock); + + SStreamTaskIter *pIter = createStreamTaskIter(pStream); + while (streamTaskIterNextTask(pIter)) { + SStreamTask *pTask = streamTaskIterGetCurrent(pIter); + int32_t code = doSetResetAction(pMnode, pTrans, pTask); + if (code != TSDB_CODE_SUCCESS) { + destroyStreamTaskIter(pIter); + taosWUnLockLatch(&pStream->lock); + return -1; + } + } + + destroyStreamTaskIter(pIter); + taosWUnLockLatch(&pStream->lock); + return 0; +} + +static void freeCheckpointCandEntry(void *param) { + SCheckpointCandEntry *pEntry = param; + taosMemoryFreeClear(pEntry->pName); +} + +static void freeTaskList(void* param) { + SArray** pList = (SArray **)param; + taosArrayDestroy(*pList); +} + +void mndInitExecInfo() { + taosThreadMutexInit(&execInfo.lock, NULL); + _hash_fn_t fn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR); + + execInfo.pTaskList = taosArrayInit(4, sizeof(STaskId)); + execInfo.pTaskMap = taosHashInit(64, fn, true, HASH_NO_LOCK); + execInfo.transMgmt.pDBTrans = taosHashInit(32, fn, true, HASH_NO_LOCK); + execInfo.transMgmt.pWaitingList = taosHashInit(32, fn, true, HASH_NO_LOCK); + execInfo.pTransferStateStreams = taosHashInit(32, fn, true, HASH_NO_LOCK); + + taosHashSetFreeFp(execInfo.transMgmt.pWaitingList, freeCheckpointCandEntry); + taosHashSetFreeFp(execInfo.pTransferStateStreams, freeTaskList); +} diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 0909003201..fbdfd81cdf 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -24,7 +24,7 @@ #include "tcompare.h" #include "tname.h" -#define MND_SUBSCRIBE_VER_NUMBER 2 +#define MND_SUBSCRIBE_VER_NUMBER 3 #define MND_SUBSCRIBE_RESERVE_SIZE 64 #define MND_CONSUMER_LOST_HB_CNT 6 @@ -530,51 +530,50 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR } } -// if(taosHashGetSize(pOutput->pSub->consumerHash) == 0) { // if all consumer is removed - SMqSubscribeObj *pSub = mndAcquireSubscribeByKey(pMnode, pInput->pRebInfo->key); // put all offset rows - if (pSub) { - taosRLockLatch(&pSub->lock); - if (pOutput->pSub->offsetRows == NULL) { - pOutput->pSub->offsetRows = taosArrayInit(4, sizeof(OffsetRows)); - } - pIter = NULL; - while (1) { - pIter = taosHashIterate(pSub->consumerHash, pIter); - if (pIter == NULL) break; - SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter; - SMqConsumerEp *pConsumerEpNew = taosHashGet(pOutput->pSub->consumerHash, &pConsumerEp->consumerId, sizeof(int64_t)); + SMqSubscribeObj *pSub = mndAcquireSubscribeByKey(pMnode, pInput->pRebInfo->key); // put all offset rows + if (pSub) { + taosRLockLatch(&pSub->lock); + if (pOutput->pSub->offsetRows == NULL) { + pOutput->pSub->offsetRows = taosArrayInit(4, sizeof(OffsetRows)); + } + pIter = NULL; + while (1) { + pIter = taosHashIterate(pSub->consumerHash, pIter); + if (pIter == NULL) break; + SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter; + SMqConsumerEp *pConsumerEpNew = taosHashGet(pOutput->pSub->consumerHash, &pConsumerEp->consumerId, sizeof(int64_t)); - for (int j = 0; j < taosArrayGetSize(pConsumerEp->offsetRows); j++) { - OffsetRows *d1 = taosArrayGet(pConsumerEp->offsetRows, j); - bool jump = false; - for (int i = 0; pConsumerEpNew && i < taosArrayGetSize(pConsumerEpNew->vgs); i++){ - SMqVgEp *pVgEp = taosArrayGetP(pConsumerEpNew->vgs, i); - if(pVgEp->vgId == d1->vgId){ - jump = true; - mInfo("pSub->offsetRows jump, because consumer id:0x%"PRIx64 " and vgId:%d not change", pConsumerEp->consumerId, pVgEp->vgId); - break; - } - } - if(jump) continue; - bool find = false; - for (int i = 0; i < taosArrayGetSize(pOutput->pSub->offsetRows); i++) { - OffsetRows *d2 = taosArrayGet(pOutput->pSub->offsetRows, i); - if (d1->vgId == d2->vgId) { - d2->rows += d1->rows; - d2->offset = d1->offset; - find = true; - mInfo("pSub->offsetRows add vgId:%d, after:%"PRId64", before:%"PRId64, d2->vgId, d2->rows, d1->rows); - break; - } - } - if(!find){ - taosArrayPush(pOutput->pSub->offsetRows, d1); + for (int j = 0; j < taosArrayGetSize(pConsumerEp->offsetRows); j++) { + OffsetRows *d1 = taosArrayGet(pConsumerEp->offsetRows, j); + bool jump = false; + for (int i = 0; pConsumerEpNew && i < taosArrayGetSize(pConsumerEpNew->vgs); i++){ + SMqVgEp *pVgEp = taosArrayGetP(pConsumerEpNew->vgs, i); + if(pVgEp->vgId == d1->vgId){ + jump = true; + mInfo("pSub->offsetRows jump, because consumer id:0x%"PRIx64 " and vgId:%d not change", pConsumerEp->consumerId, pVgEp->vgId); + break; } } + if(jump) continue; + bool find = false; + for (int i = 0; i < taosArrayGetSize(pOutput->pSub->offsetRows); i++) { + OffsetRows *d2 = taosArrayGet(pOutput->pSub->offsetRows, i); + if (d1->vgId == d2->vgId) { + d2->rows += d1->rows; + d2->offset = d1->offset; + d2->ever = d1->ever; + find = true; + mInfo("pSub->offsetRows add vgId:%d, after:%"PRId64", before:%"PRId64, d2->vgId, d2->rows, d1->rows); + break; + } + } + if(!find){ + taosArrayPush(pOutput->pSub->offsetRows, d1); + } } - taosRUnLockLatch(&pSub->lock); - mndReleaseSubscribe(pMnode, pSub); -// } + } + taosRUnLockLatch(&pSub->lock); + mndReleaseSubscribe(pMnode, pSub); } // 8. generate logs @@ -1405,8 +1404,9 @@ static int32_t buildResult(SSDataBlock *pBlock, int32_t* numOfRows, int64_t cons } if(data){ // vg id - char buf[TSDB_OFFSET_LEN + VARSTR_HEADER_SIZE] = {0}; + char buf[TSDB_OFFSET_LEN*2 + VARSTR_HEADER_SIZE] = {0}; tFormatOffset(varDataVal(buf), TSDB_OFFSET_LEN, &data->offset); + sprintf(varDataVal(buf) + strlen(varDataVal(buf)), "/%"PRId64, data->ever); varDataSetLen(buf, strlen(varDataVal(buf))); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, *numOfRows, (const char *)buf, false); diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 9075f0145c..1adc4ed4bf 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -599,6 +599,8 @@ STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict, pTrans->originRpcType = pReq->msgType; } + mInfo("trans:%d, create transaction:%s, origin:%s", pTrans->id, pTrans->opername, opername); + mTrace("trans:%d, local object is created, data:%p", pTrans->id, pTrans); return pTrans; } @@ -845,6 +847,8 @@ int32_t mndTransCheckConflict(SMnode *pMnode, STrans *pTrans) { } int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) { + if(pTrans == NULL) return -1; + if (mndTransCheckConflict(pMnode, pTrans) != 0) { return -1; } diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index 0e3b544508..5e5a3626a4 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -1925,6 +1925,7 @@ static int32_t mndProcessAlterUserPrivilegesReq(SAlterUserReq *pAlterReq, SMnode return -1; } taosHashPut(pNewUser->topics, pTopic->name, len, pTopic->name, TSDB_TOPIC_FNAME_LEN); + mndReleaseTopic(pMnode, pTopic); } if (ALTER_USER_DEL_SUBSCRIBE_TOPIC_PRIV(pAlterReq->alterType, pAlterReq->privileges)) { @@ -1935,6 +1936,7 @@ static int32_t mndProcessAlterUserPrivilegesReq(SAlterUserReq *pAlterReq, SMnode return -1; } taosHashRemove(pNewUser->topics, pAlterReq->objname, len); + mndReleaseTopic(pMnode, pTopic); } return TSDB_CODE_SUCCESS; diff --git a/source/dnode/mnode/impl/test/CMakeLists.txt b/source/dnode/mnode/impl/test/CMakeLists.txt index a002b20bde..bc5b5125f1 100644 --- a/source/dnode/mnode/impl/test/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/CMakeLists.txt @@ -4,7 +4,7 @@ add_subdirectory(acct) #add_subdirectory(db) #add_subdirectory(dnode) add_subdirectory(func) -#add_subdirectory(mnode) +add_subdirectory(stream) add_subdirectory(profile) add_subdirectory(qnode) add_subdirectory(sdb) diff --git a/source/dnode/mnode/impl/test/stream/CMakeLists.txt b/source/dnode/mnode/impl/test/stream/CMakeLists.txt new file mode 100644 index 0000000000..bfc138c9d7 --- /dev/null +++ b/source/dnode/mnode/impl/test/stream/CMakeLists.txt @@ -0,0 +1,13 @@ +SET(CMAKE_CXX_STANDARD 11) + +aux_source_directory(. MNODE_STREAM_TEST_SRC) +add_executable(streamTest ${MNODE_STREAM_TEST_SRC}) +target_link_libraries( + streamTest + PRIVATE dnode nodes planner gtest qcom +) + +add_test( + NAME streamTest + COMMAND streamTest +) diff --git a/source/dnode/mnode/impl/test/stream/stream.cpp b/source/dnode/mnode/impl/test/stream/stream.cpp new file mode 100644 index 0000000000..e3bfdb5d6c --- /dev/null +++ b/source/dnode/mnode/impl/test/stream/stream.cpp @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include +#include +#include "nodes.h" +#include "planner.h" + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wwrite-strings" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wsign-compare" + +#include +#include +#include "../../inc/mndStream.h" + +namespace { +SRpcMsg buildHbReq() { + SStreamHbMsg msg = {0}; + msg.vgId = 1; + msg.numOfTasks = 5; + msg.pTaskStatus = taosArrayInit(4, sizeof(STaskStatusEntry)); + + for (int32_t i = 0; i < 4; ++i) { + STaskStatusEntry entry = {0}; + entry.nodeId = i + 1; + entry.stage = 1; + entry.id.taskId = i + 1; + entry.id.streamId = 999; + + if (i == 0) { + entry.stage = 4; + } + + taosArrayPush(msg.pTaskStatus, &entry); + } + + // (p->checkpointId != 0) && p->checkpointFailed + // add failed checkpoint info + { + STaskStatusEntry entry = {0}; + entry.nodeId = 5; + entry.stage = 1; + + entry.id.taskId = 5; + entry.id.streamId = 999; + + entry.checkpointId = 1; + entry.checkpointFailed = true; + + taosArrayPush(msg.pTaskStatus, &entry); + } + + int32_t tlen = 0; + int32_t code = 0; + SEncoder encoder; + void* buf = NULL; + SRpcMsg msg1 = {0}; + msg1.info.noResp = 1; + + tEncodeSize(tEncodeStreamHbMsg, &msg, tlen, code); + if (code < 0) { + goto _end; + } + + buf = rpcMallocCont(tlen); + if (buf == NULL) { + goto _end; + } + + tEncoderInit(&encoder, (uint8_t*)buf, tlen); + if ((code = tEncodeStreamHbMsg(&encoder, &msg)) < 0) { + rpcFreeCont(buf); + goto _end; + } + tEncoderClear(&encoder); + + initRpcMsg(&msg1, TDMT_MND_STREAM_HEARTBEAT, buf, tlen); + + taosArrayDestroy(msg.pTaskStatus); + return msg1; + +_end: + return msg1; +} + +void setTask(SStreamTask* pTask, int32_t nodeId, int64_t streamId, int32_t taskId) { + SStreamExecInfo* pExecNode = &execInfo; + + pTask->id.streamId = streamId; + pTask->id.taskId = taskId; + pTask->info.nodeId = nodeId; + + STaskId id; + id.streamId = pTask->id.streamId; + id.taskId = pTask->id.taskId; + + STaskStatusEntry entry; + streamTaskStatusInit(&entry, pTask); + + entry.stage = 1; + entry.status = TASK_STATUS__READY; + + taosHashPut(pExecNode->pTaskMap, &id, sizeof(id), &entry, sizeof(entry)); + taosArrayPush(pExecNode->pTaskList, &id); +} +void initStreamExecInfo() { + SStreamExecInfo* pExecNode = &execInfo; + + SStreamTask task = {0}; + setTask(&task, 1, 999, 1); + setTask(&task, 1, 999, 2); + setTask(&task, 1, 999, 3); + setTask(&task, 1, 999, 4); + setTask(&task, 2, 999, 5); +} + +void initNodeInfo() { + execInfo.pNodeList = taosArrayInit(4, sizeof(SNodeEntry)); + SNodeEntry entry = {0}; + entry.nodeId = 2; + entry.stageUpdated = true; + taosArrayPush(execInfo.pNodeList, &entry); +} +} // namespace + +int main(int argc, char** argv) { + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + +TEST(mndHbTest, handle_error_in_hb) { + mndInitExecInfo(); + initStreamExecInfo(); + initNodeInfo(); + + SRpcMsg msg = buildHbReq(); + int32_t code = mndProcessStreamHb(&msg); + + rpcFreeCont(msg.pCont); +} + +TEST(testCase, plan_Test) { + char* ast = "{\"NodeType\":\"101\",\"Name\":\"SelectStmt\",\"SelectStmt\":{\"Distinct\":false,\"Projections\":[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"#expr_1\",\"UserAlias\":\"_wstart\",\"Name\":\"_wstart\",\"Id\":\"89\",\"Type\":\"3505\",\"UdfBufSize\":\"0\"}},{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"5\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"#expr_2\",\"UserAlias\":\"sum(voltage)\",\"Name\":\"sum\",\"Id\":\"1\",\"Type\":\"14\",\"Parameters\":[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"voltage\",\"UserAlias\":\"voltage\",\"TableId\":\"6555383776122680534\",\"TableType\":\"1\",\"ColId\":\"3\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"test\",\"TableName\":\"meters\",\"TableAlias\":\"meters\",\"ColName\":\"voltage\",\"DataBlockId\":\"0\",\"SlotId\":\"0\"}}],\"UdfBufSize\":\"0\"}},{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"#expr_3\",\"UserAlias\":\"groupid\",\"Name\":\"_group_key\",\"Id\":\"96\",\"Type\":\"3754\",\"Parameters\":[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"#expr_3\",\"UserAlias\":\"groupid\",\"TableId\":\"6555383776122680534\",\"TableType\":\"1\",\"ColId\":\"5\",\"ProjId\":\"0\",\"ColType\":\"2\",\"DbName\":\"test\",\"TableName\":\"meters\",\"TableAlias\":\"meters\",\"ColName\":\"groupid\",\"DataBlockId\":\"0\",\"SlotId\":\"0\"}}],\"UdfBufSize\":\"0\"}}],\"From\":{\"NodeType\":\"6\",\"Name\":\"RealTable\",\"RealTable\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"0\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"DbName\":\"test\",\"tableName\":\"meters\",\"tableAlias\":\"meters\",\"MetaSize\":\"475\",\"Meta\":{\"VgId\":\"0\",\"TableType\":\"1\",\"Uid\":\"6555383776122680534\",\"Suid\":\"6555383776122680534\",\"Sversion\":\"1\",\"Tversion\":\"1\",\"ComInfo\":{\"NumOfTags\":\"2\",\"Precision\":\"0\",\"NumOfColumns\":\"4\",\"RowSize\":\"20\"},\"ColSchemas\":[{\"Type\":\"9\",\"ColId\":\"1\",\"bytes\":\"8\",\"Name\":\"ts\"},{\"Type\":\"6\",\"ColId\":\"2\",\"bytes\":\"4\",\"Name\":\"current\"},{\"Type\":\"4\",\"ColId\":\"3\",\"bytes\":\"4\",\"Name\":\"voltage\"},{\"Type\":\"6\",\"ColId\":\"4\",\"bytes\":\"4\",\"Name\":\"phase\"},{\"Type\":\"4\",\"ColId\":\"5\",\"bytes\":\"4\",\"Name\":\"groupid\"},{\"Type\":\"8\",\"ColId\":\"6\",\"bytes\":\"26\",\"Name\":\"location\"}]},\"VgroupsInfoSize\":\"1340\",\"VgroupsInfo\":{\"Num\":\"2\",\"Vgroups\":[{\"VgId\":\"2\",\"HashBegin\":\"0\",\"HashEnd\":\"2147483646\",\"EpSet\":{\"InUse\":\"0\",\"NumOfEps\":\"1\",\"Eps\":[{\"Fqdn\":\"localhost\",\"Port\":\"6030\"}]},\"NumOfTable\":\"0\"},{\"VgId\":\"3\",\"HashBegin\":\"2147483647\",\"HashEnd\":\"4294967295\",\"EpSet\":{\"InUse\":\"0\",\"NumOfEps\":\"1\",\"Eps\":[{\"Fqdn\":\"localhost\",\"Port\":\"6030\"}]},\"NumOfTable\":\"0\"}]}}},\"PartitionBy\":[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"groupid\",\"UserAlias\":\"groupid\",\"TableId\":\"6555383776122680534\",\"TableType\":\"1\",\"ColId\":\"5\",\"ProjId\":\"0\",\"ColType\":\"2\",\"DbName\":\"test\",\"TableName\":\"meters\",\"TableAlias\":\"meters\",\"ColName\":\"groupid\",\"DataBlockId\":\"0\",\"SlotId\":\"0\"}}],\"Window\":{\"NodeType\":\"14\",\"Name\":\"IntervalWindow\",\"IntervalWindow\":{\"Interval\":{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"5\",\"Precision\":\"0\",\"Scale\":\"115\",\"Bytes\":\"8\"},\"AliasName\":\"c804c3a15ebe05b5baf40ad5ee12be1f\",\"UserAlias\":\"2s\",\"LiteralSize\":\"2\",\"Literal\":\"2s\",\"Duration\":true,\"Translate\":true,\"NotReserved\":false,\"IsNull\":false,\"Unit\":\"115\",\"Datum\":\"2000\"}},\"TsPk\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"ts\",\"UserAlias\":\"ts\",\"TableId\":\"6555383776122680534\",\"TableType\":\"1\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"test\",\"TableName\":\"meters\",\"TableAlias\":\"meters\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\"}}}},\"StmtName\":\"0x1580095ba\",\"HasAggFuncs\":true}}"; + // char* ast = "{\"NodeType\":\"101\",\"Name\":\"SelectStmt\",\"SelectStmt\":{\"Distinct\":false,\"Projections\":[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"#expr_1\",\"UserAlias\":\"wstart\",\"Name\":\"_wstart\",\"Id\":\"89\",\"Type\":\"3505\",\"UdfBufSize\":\"0\"}},{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"2\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"#expr_2\",\"UserAlias\":\"min(c1)\",\"Name\":\"min\",\"Id\":\"2\",\"Type\":\"8\",\"Parameters\":[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"2\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"c1\",\"UserAlias\":\"c1\",\"TableId\":\"5129202035162885657\",\"TableType\":\"1\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"test\",\"TableName\":\"at_once_interval_ext_stb\",\"TableAlias\":\"at_once_interval_ext_stb\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"0\"}}],\"UdfBufSize\":\"0\"}},{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"3\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"2\"},\"AliasName\":\"#expr_3\",\"UserAlias\":\"max(c2)\",\"Name\":\"max\",\"Id\":\"3\",\"Type\":\"7\",\"Parameters\":[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"3\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"2\"},\"AliasName\":\"c2\",\"UserAlias\":\"c2\",\"TableId\":\"5129202035162885657\",\"TableType\":\"1\",\"ColId\":\"3\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"test\",\"TableName\":\"at_once_interval_ext_stb\",\"TableAlias\":\"at_once_interval_ext_stb\",\"ColName\":\"c2\",\"DataBlockId\":\"0\",\"SlotId\":\"0\"}}],\"UdfBufSize\":\"0\"}},{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"Name\":\"cast\",\"Id\":\"77\",\"Type\":\"2000\",\"Parameters\":[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"5\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"#expr_4\",\"UserAlias\":\"sum(c3)\",\"Name\":\"sum\",\"Id\":\"1\",\"Type\":\"14\",\"Parameters\":[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"4\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"c3\",\"UserAlias\":\"c3\",\"TableId\":\"5129202035162885657\",\"TableType\":\"1\",\"ColId\":\"4\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"test\",\"TableName\":\"at_once_interval_ext_stb\",\"TableAlias\":\"at_once_interval_ext_stb\",\"ColName\":\"c3\",\"DataBlockId\":\"0\",\"SlotId\":\"0\"}}],\"UdfBufSize\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"2\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"LiteralSize\":\"0\",\"Duration\":false,\"Translate\":true,\"NotReserved\":true,\"IsNull\":false,\"Unit\":\"0\",\"Datum\":\"0\"}}],\"UdfBufSize\":\"0\"}},{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"5\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"#expr_5\",\"UserAlias\":\"first(c4)\",\"Name\":\"first\",\"Id\":\"33\",\"Type\":\"504\",\"Parameters\":[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"5\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"c4\",\"UserAlias\":\"c4\",\"TableId\":\"5129202035162885657\",\"TableType\":\"1\",\"ColId\":\"5\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"test\",\"TableName\":\"at_once_interval_ext_stb\",\"TableAlias\":\"at_once_interval_ext_stb\",\"ColName\":\"c4\",\"DataBlockId\":\"0\",\"SlotId\":\"0\"}},{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"ts\",\"UserAlias\":\"ts\",\"TableId\":\"5129202035162885657\",\"TableType\":\"1\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"test\",\"TableName\":\"at_once_interval_ext_stb\",\"TableAlias\":\"at_once_interval_ext_stb\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\"}}],\"UdfBufSize\":\"0\"}},{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"11\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"#expr_6\",\"UserAlias\":\"last(c5)\",\"Name\":\"last\",\"Id\":\"36\",\"Type\":\"506\",\"Parameters\":[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"11\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"c5\",\"UserAlias\":\"c5\",\"TableId\":\"5129202035162885657\",\"TableType\":\"1\",\"ColId\":\"6\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"test\",\"TableName\":\"at_once_interval_ext_stb\",\"TableAlias\":\"at_once_interval_ext_stb\",\"ColName\":\"c5\",\"DataBlockId\":\"0\",\"SlotId\":\"0\"}},{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"ts\",\"UserAlias\":\"ts\",\"TableId\":\"5129202035162885657\",\"TableType\":\"1\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"test\",\"TableName\":\"at_once_interval_ext_stb\",\"TableAlias\":\"at_once_interval_ext_stb\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\"}}],\"UdfBufSize\":\"0\"}},{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"12\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"2\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"Name\":\"cast\",\"Id\":\"77\",\"Type\":\"2000\",\"Parameters\":[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"7\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"#expr_7\",\"UserAlias\":\"apercentile(c6, 50)\",\"Name\":\"apercentile\",\"Id\":\"12\",\"Type\":\"1\",\"Parameters\":[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"12\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"2\"},\"AliasName\":\"c6\",\"UserAlias\":\"c6\",\"TableId\":\"5129202035162885657\",\"TableType\":\"1\",\"ColId\":\"7\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"test\",\"TableName\":\"at_once_interval_ext_stb\",\"TableAlias\":\"at_once_interval_ext_stb\",\"ColName\":\"c6\",\"DataBlockId\":\"0\",\"SlotId\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"5\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"c0c7c76d30bd3dcaefc96f40275bdc0a\",\"UserAlias\":\"50\",\"LiteralSize\":\"2\",\"Literal\":\"50\",\"Duration\":false,\"Translate\":true,\"NotReserved\":true,\"IsNull\":false,\"Unit\":\"0\",\"Datum\":\"50\"}}],\"UdfBufSize\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"2\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"LiteralSize\":\"0\",\"Duration\":false,\"Translate\":true,\"NotReserved\":true,\"IsNull\":false,\"Unit\":\"0\",\"Datum\":\"0\"}}],\"UdfBufSize\":\"0\"}},{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"13\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"Name\":\"cast\",\"Id\":\"77\",\"Type\":\"2000\",\"Parameters\":[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"7\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"#expr_8\",\"UserAlias\":\"avg(c7)\",\"Name\":\"avg\",\"Id\":\"8\",\"Type\":\"2\",\"Parameters\":[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"13\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"c7\",\"UserAlias\":\"c7\",\"TableId\":\"5129202035162885657\",\"TableType\":\"1\",\"ColId\":\"8\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"test\",\"TableName\":\"at_once_interval_ext_stb\",\"TableAlias\":\"at_once_interval_ext_stb\",\"ColName\":\"c7\",\"DataBlockId\":\"0\",\"SlotId\":\"0\"}}],\"UdfBufSize\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"2\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"LiteralSize\":\"0\",\"Duration\":false,\"Translate\":true,\"NotReserved\":true,\"IsNull\":false,\"Unit\":\"0\",\"Datum\":\"0\"}}],\"UdfBufSize\":\"0\"}},{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"14\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"Name\":\"cast\",\"Id\":\"77\",\"Type\":\"2000\",\"Parameters\":[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"5\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"#expr_9\",\"UserAlias\":\"count(c8)\",\"Name\":\"count\",\"Id\":\"0\",\"Type\":\"3\",\"Parameters\":[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"14\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"c8\",\"UserAlias\":\"c8\",\"TableId\":\"5129202035162885657\",\"TableType\":\"1\",\"ColId\":\"9\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"test\",\"TableName\":\"at_once_interval_ext_stb\",\"TableAlias\":\"at_once_interval_ext_stb\",\"ColName\":\"c8\",\"DataBlockId\":\"0\",\"SlotId\":\"0\"}}],\"UdfBufSize\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"2\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"LiteralSize\":\"0\",\"Duration\":false,\"Translate\":true,\"NotReserved\":true,\"IsNull\":false,\"Unit\":\"0\",\"Datum\":\"0\"}}],\"UdfBufSize\":\"0\"}},{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"6\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"4\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"Name\":\"cast\",\"Id\":\"77\",\"Type\":\"2000\",\"Parameters\":[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"7\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"#expr_10\",\"UserAlias\":\"spread(c1)\",\"Name\":\"spread\",\"Id\":\"17\",\"Type\":\"11\",\"Parameters\":[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"2\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"c1\",\"UserAlias\":\"c1\",\"TableId\":\"5129202035162885657\",\"TableType\":\"1\",\"ColId\":\"2\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"test\",\"TableName\":\"at_once_interval_ext_stb\",\"TableAlias\":\"at_once_interval_ext_stb\",\"ColName\":\"c1\",\"DataBlockId\":\"0\",\"SlotId\":\"0\"}}],\"UdfBufSize\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"2\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"LiteralSize\":\"0\",\"Duration\":false,\"Translate\":true,\"NotReserved\":true,\"IsNull\":false,\"Unit\":\"0\",\"Datum\":\"0\"}}],\"UdfBufSize\":\"0\"}},{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"7\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"#expr_11\",\"UserAlias\":\"stddev(c2)\",\"Name\":\"stddev\",\"Id\":\"4\",\"Type\":\"12\",\"Parameters\":[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"3\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"2\"},\"AliasName\":\"c2\",\"UserAlias\":\"c2\",\"TableId\":\"5129202035162885657\",\"TableType\":\"1\",\"ColId\":\"3\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"test\",\"TableName\":\"at_once_interval_ext_stb\",\"TableAlias\":\"at_once_interval_ext_stb\",\"ColName\":\"c2\",\"DataBlockId\":\"0\",\"SlotId\":\"0\"}}],\"UdfBufSize\":\"0\"}},{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"Name\":\"cast\",\"Id\":\"77\",\"Type\":\"2000\",\"Parameters\":[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"5\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"#expr_12\",\"UserAlias\":\"hyperloglog(c11)\",\"Name\":\"hyperloglog\",\"Id\":\"43\",\"Type\":\"17\",\"Parameters\":[{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"c11\",\"UserAlias\":\"c11\",\"TableId\":\"5129202035162885657\",\"TableType\":\"1\",\"ColId\":\"12\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"test\",\"TableName\":\"at_once_interval_ext_stb\",\"TableAlias\":\"at_once_interval_ext_stb\",\"ColName\":\"c11\",\"DataBlockId\":\"0\",\"SlotId\":\"0\"}}],\"UdfBufSize\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"2\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"LiteralSize\":\"0\",\"Duration\":false,\"Translate\":true,\"NotReserved\":true,\"IsNull\":false,\"Unit\":\"0\",\"Datum\":\"0\"}}],\"UdfBufSize\":\"0\"}},{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"10\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"26\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"Name\":\"cast\",\"Id\":\"77\",\"Type\":\"2000\",\"Parameters\":[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"5\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"#expr_13\",\"UserAlias\":\"timediff(1, 0, 1h)\",\"Name\":\"timediff\",\"Id\":\"81\",\"Type\":\"2501\",\"Parameters\":[{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"5\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"c4ca4238a0b923820dcc509a6f75849b\",\"UserAlias\":\"1\",\"LiteralSize\":\"1\",\"Literal\":\"1\",\"Duration\":false,\"Translate\":true,\"NotReserved\":false,\"IsNull\":false,\"Unit\":\"0\",\"Datum\":\"1\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"5\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"cfcd208495d565ef66e7dff9f98764da\",\"UserAlias\":\"0\",\"LiteralSize\":\"1\",\"Literal\":\"0\",\"Duration\":false,\"Translate\":true,\"NotReserved\":false,\"IsNull\":false,\"Unit\":\"0\",\"Datum\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"5\",\"Precision\":\"0\",\"Scale\":\"104\",\"Bytes\":\"8\"},\"AliasName\":\"7c68645d71b803bf0ba2f22519f73e08\",\"UserAlias\":\"1h\",\"LiteralSize\":\"2\",\"Literal\":\"1h\",\"Duration\":true,\"Translate\":true,\"NotReserved\":false,\"IsNull\":false,\"Unit\":\"104\",\"Datum\":\"3600000\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"2\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"LiteralSize\":\"0\",\"Duration\":false,\"Translate\":true,\"NotReserved\":true,\"IsNull\":false,\"Unit\":\"0\",\"Datum\":\"0\"}}],\"UdfBufSize\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"2\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"LiteralSize\":\"0\",\"Duration\":false,\"Translate\":true,\"NotReserved\":true,\"IsNull\":false,\"Unit\":\"0\",\"Datum\":\"0\"}}],\"UdfBufSize\":\"0\"}},{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"1\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"Name\":\"cast\",\"Id\":\"77\",\"Type\":\"2000\",\"Parameters\":[{\"NodeType\":\"5\",\"Name\":\"Function\",\"Function\":{\"DataType\":{\"Type\":\"8\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"96\"},\"AliasName\":\"#expr_14\",\"UserAlias\":\"timezone()\",\"Name\":\"timezone\",\"Id\":\"84\",\"Type\":\"2503\",\"UdfBufSize\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"2\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"LiteralSize\":\"0\",\"Duration\":false,\"Translate\":true,\"NotReserved\":true,\"IsNull\":false,\"Unit\":\"0\",\"Datum\":\"0\"}}],\"UdfBufSize\":\"0\"}}],\"From\":{\"NodeType\":\"6\",\"Name\":\"RealTable\",\"RealTable\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"0\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"DbName\":\"test\",\"tableName\":\"at_once_interval_ext_stb\",\"tableAlias\":\"at_once_interval_ext_stb\",\"MetaSize\":\"2008\",\"Meta\":{\"VgId\":\"0\",\"TableType\":\"1\",\"Uid\":\"5129202035162885657\",\"Suid\":\"5129202035162885657\",\"Sversion\":\"1\",\"Tversion\":\"1\",\"ComInfo\":{\"NumOfTags\":\"13\",\"Precision\":\"0\",\"NumOfColumns\":\"14\",\"RowSize\":\"85\"},\"ColSchemas\":[{\"Type\":\"9\",\"ColId\":\"1\",\"bytes\":\"8\",\"Name\":\"ts\"},{\"Type\":\"2\",\"ColId\":\"2\",\"bytes\":\"1\",\"Name\":\"c1\"},{\"Type\":\"3\",\"ColId\":\"3\",\"bytes\":\"2\",\"Name\":\"c2\"},{\"Type\":\"4\",\"ColId\":\"4\",\"bytes\":\"4\",\"Name\":\"c3\"},{\"Type\":\"5\",\"ColId\":\"5\",\"bytes\":\"8\",\"Name\":\"c4\"},{\"Type\":\"11\",\"ColId\":\"6\",\"bytes\":\"1\",\"Name\":\"c5\"},{\"Type\":\"12\",\"ColId\":\"7\",\"bytes\":\"2\",\"Name\":\"c6\"},{\"Type\":\"13\",\"ColId\":\"8\",\"bytes\":\"4\",\"Name\":\"c7\"},{\"Type\":\"14\",\"ColId\":\"9\",\"bytes\":\"8\",\"Name\":\"c8\"},{\"Type\":\"6\",\"ColId\":\"10\",\"bytes\":\"4\",\"Name\":\"c9\"},{\"Type\":\"7\",\"ColId\":\"11\",\"bytes\":\"8\",\"Name\":\"c10\"},{\"Type\":\"8\",\"ColId\":\"12\",\"bytes\":\"8\",\"Name\":\"c11\"},{\"Type\":\"10\",\"ColId\":\"13\",\"bytes\":\"26\",\"Name\":\"c12\"},{\"Type\":\"1\",\"ColId\":\"14\",\"bytes\":\"1\",\"Name\":\"c13\"},{\"Type\":\"2\",\"ColId\":\"15\",\"bytes\":\"1\",\"Name\":\"t1\"},{\"Type\":\"3\",\"ColId\":\"16\",\"bytes\":\"2\",\"Name\":\"t2\"},{\"Type\":\"4\",\"ColId\":\"17\",\"bytes\":\"4\",\"Name\":\"t3\"},{\"Type\":\"5\",\"ColId\":\"18\",\"bytes\":\"8\",\"Name\":\"t4\"},{\"Type\":\"11\",\"ColId\":\"19\",\"bytes\":\"1\",\"Name\":\"t5\"},{\"Type\":\"12\",\"ColId\":\"20\",\"bytes\":\"2\",\"Name\":\"t6\"},{\"Type\":\"13\",\"ColId\":\"21\",\"bytes\":\"4\",\"Name\":\"t7\"},{\"Type\":\"14\",\"ColId\":\"22\",\"bytes\":\"8\",\"Name\":\"t8\"},{\"Type\":\"6\",\"ColId\":\"23\",\"bytes\":\"4\",\"Name\":\"t9\"},{\"Type\":\"7\",\"ColId\":\"24\",\"bytes\":\"8\",\"Name\":\"t10\"},{\"Type\":\"8\",\"ColId\":\"25\",\"bytes\":\"8\",\"Name\":\"t11\"},{\"Type\":\"10\",\"ColId\":\"26\",\"bytes\":\"26\",\"Name\":\"t12\"},{\"Type\":\"1\",\"ColId\":\"27\",\"bytes\":\"1\",\"Name\":\"t13\"}]},\"VgroupsInfoSize\":\"1340\",\"VgroupsInfo\":{\"Num\":\"2\",\"Vgroups\":[{\"VgId\":\"14\",\"HashBegin\":\"0\",\"HashEnd\":\"2147483646\",\"EpSet\":{\"InUse\":\"0\",\"NumOfEps\":\"1\",\"Eps\":[{\"Fqdn\":\"localhost\",\"Port\":\"6030\"}]},\"NumOfTable\":\"0\"},{\"VgId\":\"15\",\"HashBegin\":\"2147483647\",\"HashEnd\":\"4294967295\",\"EpSet\":{\"InUse\":\"0\",\"NumOfEps\":\"1\",\"Eps\":[{\"Fqdn\":\"localhost\",\"Port\":\"6030\"}]},\"NumOfTable\":\"0\"}]}}},\"Tags\":[{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"LiteralSize\":\"0\",\"Duration\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"LiteralSize\":\"0\",\"Duration\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"LiteralSize\":\"0\",\"Duration\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"LiteralSize\":\"0\",\"Duration\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"LiteralSize\":\"0\",\"Duration\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"LiteralSize\":\"0\",\"Duration\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"LiteralSize\":\"0\",\"Duration\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"LiteralSize\":\"0\",\"Duration\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"LiteralSize\":\"0\",\"Duration\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"LiteralSize\":\"0\",\"Duration\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"LiteralSize\":\"0\",\"Duration\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"LiteralSize\":\"0\",\"Duration\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}},{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"0\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"1\"},\"AliasName\":\"\",\"UserAlias\":\"\",\"LiteralSize\":\"0\",\"Duration\":false,\"Translate\":false,\"NotReserved\":false,\"IsNull\":true,\"Unit\":\"0\"}}],\"Window\":{\"NodeType\":\"14\",\"Name\":\"IntervalWindow\",\"IntervalWindow\":{\"Interval\":{\"NodeType\":\"2\",\"Name\":\"Value\",\"Value\":{\"DataType\":{\"Type\":\"5\",\"Precision\":\"0\",\"Scale\":\"115\",\"Bytes\":\"8\"},\"AliasName\":\"1fd7635317edfeca9054894ac9ef9b5e\",\"UserAlias\":\"14s\",\"LiteralSize\":\"3\",\"Literal\":\"14s\",\"Duration\":true,\"Translate\":true,\"NotReserved\":false,\"IsNull\":false,\"Unit\":\"115\",\"Datum\":\"14000\"}},\"TsPk\":{\"NodeType\":\"1\",\"Name\":\"Column\",\"Column\":{\"DataType\":{\"Type\":\"9\",\"Precision\":\"0\",\"Scale\":\"0\",\"Bytes\":\"8\"},\"AliasName\":\"ts\",\"UserAlias\":\"ts\",\"TableId\":\"5129202035162885657\",\"TableType\":\"1\",\"ColId\":\"1\",\"ProjId\":\"0\",\"ColType\":\"1\",\"DbName\":\"test\",\"TableName\":\"at_once_interval_ext_stb\",\"TableAlias\":\"at_once_interval_ext_stb\",\"ColName\":\"ts\",\"DataBlockId\":\"0\",\"SlotId\":\"0\"}}}},\"StmtName\":\"0x150146d14\",\"HasAggFuncs\":true}}"; + SNode * pAst = NULL; + SQueryPlan *pPlan = NULL; + + if (taosCreateLog("taoslog", 10, "/etc/taos", NULL, NULL, NULL, NULL, 1) != 0) { + // ignore create log failed, only print + printf(" WARING: Create failed:%s. configDir\n", strerror(errno)); + } + + if (nodesStringToNode(ast, &pAst) < 0) { + ASSERT(0); + } + + SPlanContext cxt = { 0 }; + cxt.pAstRoot = pAst; + cxt.topicQuery = false; + cxt.streamQuery = true; + cxt.triggerType = STREAM_TRIGGER_WINDOW_CLOSE; + cxt.watermark = 1; + cxt.igExpired = 1; + cxt.deleteMark = 1; + cxt.igCheckUpdate = 1; + + // using ast and param to build physical plan + if (qCreateQueryPlan(&cxt, &pPlan, NULL) < 0) { + ASSERT(0); + } + if (pAst != NULL) nodesDestroyNode(pAst); + nodesDestroyNode((SNode *)pPlan); +} + +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/source/dnode/mnode/sdb/inc/sdb.h b/source/dnode/mnode/sdb/inc/sdb.h index e1beaaa910..9d1125dad2 100644 --- a/source/dnode/mnode/sdb/inc/sdb.h +++ b/source/dnode/mnode/sdb/inc/sdb.h @@ -152,7 +152,8 @@ typedef enum { SDB_STREAM_SEQ = 23, SDB_COMPACT = 24, SDB_COMPACT_DETAIL = 25, - SDB_MAX = 26 + SDB_GRANT = 26, // grant log + SDB_MAX = 27 } ESdbType; typedef struct SSdbRaw { diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index 97cf0ffebc..294e75602e 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -90,6 +90,8 @@ 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); +int32_t vnodeGetTableSchema(void *pVnode, int64_t uid, STSchema **pSchema, int64_t *suid); + void vnodeResetLoad(SVnode *pVnode, SVnodeLoad *pLoad); int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad); int32_t vnodeGetLoadLite(SVnode *pVnode, SVnodeLoadLite *pLoad); @@ -180,7 +182,6 @@ int32_t tsdbCacherowsReaderOpen(void *pVnode, int32_t type, void *pTableIdList, int32_t tsdbRetrieveCacheRows(void *pReader, SSDataBlock *pResBlock, const int32_t *slotIds, const int32_t *dstSlotIds, SArray *pTableUids); void *tsdbCacherowsReaderClose(void *pReader); -int32_t tsdbGetTableSchema(void *pVnode, int64_t uid, STSchema **pSchema, int64_t *suid); void tsdbCacheSetCapacity(SVnode *pVnode, size_t capacity); size_t tsdbCacheGetCapacity(SVnode *pVnode); @@ -222,7 +223,7 @@ bool tqReaderIsQueriedTable(STqReader *pReader, uint64_t uid); bool tqCurrentBlockConsumed(const STqReader *pReader); int32_t tqReaderSeek(STqReader *pReader, int64_t ver, const char *id); -bool tqNextBlockInWal(STqReader *pReader, const char *idstr); +bool tqNextBlockInWal(STqReader *pReader, const char *idstr, int sourceExcluded); bool tqNextBlockImpl(STqReader *pReader, const char *idstr); SWalReader *tqGetWalReader(STqReader *pReader); SSDataBlock *tqGetResultBlock(STqReader *pReader); @@ -233,6 +234,7 @@ int32_t tqReaderSetSubmitMsg(STqReader *pReader, void *msgStr, int32_t msgLen, i bool tqNextDataBlockFilterOut(STqReader *pReader, SHashObj *filterOutUids); int32_t tqRetrieveDataBlock(STqReader *pReader, SSDataBlock **pRes, const char *idstr); int32_t tqRetrieveTaosxBlock(STqReader *pReader, SArray *blocks, SArray *schemas, SSubmitTbData **pSubmitTbDataRet); +int32_t tqGetStreamExecInfo(SVnode* pVnode, int64_t streamId, int64_t* pDelay, bool* fhFinished); // sma int32_t smaGetTSmaDays(SVnodeCfg *pCfg, void *pCont, uint32_t contLen, int32_t *days); diff --git a/source/dnode/vnode/src/inc/tq.h b/source/dnode/vnode/src/inc/tq.h index cded4ddd7c..2a076cfc61 100644 --- a/source/dnode/vnode/src/inc/tq.h +++ b/source/dnode/vnode/src/inc/tq.h @@ -97,7 +97,6 @@ typedef struct { struct STQ { SVnode* pVnode; char* path; - int64_t walLogLastVer; SRWLatch lock; SHashObj* pPushMgr; // subKey -> STqHandle SHashObj* pHandle; // subKey -> STqHandle @@ -119,7 +118,7 @@ int32_t tqScanData(STQ* pTq, STqHandle* pHandle, SMqDataRsp* pRsp, STqOffsetVal* int32_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, uint64_t reqId); // tqExec -int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxRsp* pRsp, int32_t* totalRows); +int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxRsp* pRsp, int32_t* totalRows, int8_t sourceExcluded); int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, SMqDataRsp* pRsp, int32_t numOfCols, int8_t precision); int32_t tqSendDataRsp(STqHandle* pHandle, const SRpcMsg* pMsg, const SMqPollReq* pReq, const SMqDataRsp* pRsp, int32_t type, int32_t vgId); @@ -153,14 +152,14 @@ char* tqOffsetBuildFName(const char* path, int32_t fVer); int32_t tqOffsetRestoreFromFile(STqOffsetStore* pStore, const char* fname); // tq util -int32_t extractDelDataBlock(const void* pData, int32_t len, int64_t ver, void** pRefBlock, int32_t type); +int32_t tqExtractDelDataBlock(const void* pData, int32_t len, int64_t ver, void** pRefBlock, int32_t type); int32_t tqExtractDataForMq(STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequest, SRpcMsg* pMsg); int32_t tqDoSendDataRsp(const SRpcHandleInfo* pRpcHandleInfo, const SMqDataRsp* pRsp, int32_t epoch, int64_t consumerId, int32_t type, int64_t sver, int64_t ever); int32_t tqInitDataRsp(SMqDataRsp* pRsp, STqOffsetVal pOffset); void tqUpdateNodeStage(STQ* pTq, bool isLeader); -int32_t setDstTableDataPayload(uint64_t suid, const STSchema* pTSchema, int32_t blockIndex, SSDataBlock* pDataBlock, - SSubmitTbData* pTableData, const char* id); +int32_t tqSetDstTableDataPayload(uint64_t suid, const STSchema* pTSchema, int32_t blockIndex, SSDataBlock* pDataBlock, + SSubmitTbData* pTableData, const char* id); int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, const char* id); SVCreateTbReq* buildAutoCreateTableReq(const char* stbFullName, int64_t suid, int32_t numOfCols, diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index 9d8d5013fa..cac3be9ee3 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -279,6 +279,7 @@ int32_t tsdbReadDelIdx(SDelFReader *pReader, SArray *aDelIdx); // tsdbRead.c ============================================================================================== int32_t tsdbTakeReadSnap2(STsdbReader *pReader, _query_reseek_func_t reseek, STsdbReadSnap **ppSnap); void tsdbUntakeReadSnap2(STsdbReader *pReader, STsdbReadSnap *pSnap, bool proactive); +int32_t tsdbGetTableSchema(SMeta* pMeta, int64_t uid, STSchema** pSchema, int64_t* suid); // tsdbMerge.c ============================================================================================== typedef struct { @@ -970,8 +971,6 @@ static FORCE_INLINE TSDBROW *tsdbTbDataIterGet(STbDataIter *pIter) { return pIter->pRow; } -int32_t tRowInfoCmprFn(const void *p1, const void *p2); - typedef struct { int64_t suid; int64_t uid; diff --git a/source/dnode/vnode/src/meta/metaIdx.c b/source/dnode/vnode/src/meta/metaIdx.c index efa06d2d1f..dc62ab2b9f 100644 --- a/source/dnode/vnode/src/meta/metaIdx.c +++ b/source/dnode/vnode/src/meta/metaIdx.c @@ -62,6 +62,7 @@ int metaOpenIdx(SMeta *pMeta) { return 0; } +#ifdef BUILD_NO_CALL void metaCloseIdx(SMeta *pMeta) { /* TODO */ #if 0 if (pMeta->pIdx) { @@ -114,3 +115,4 @@ int metaRemoveTableFromIdx(SMeta *pMeta, tb_uid_t uid) { // TODO return 0; } +#endif \ No newline at end of file diff --git a/source/dnode/vnode/src/meta/metaOpen.c b/source/dnode/vnode/src/meta/metaOpen.c index 8cab17c417..8055d6e139 100644 --- a/source/dnode/vnode/src/meta/metaOpen.c +++ b/source/dnode/vnode/src/meta/metaOpen.c @@ -27,7 +27,14 @@ static int taskIdxKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int k static int btimeIdxCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2); static int ncolIdxCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2); -static int32_t metaInitLock(SMeta *pMeta) { return taosThreadRwlockInit(&pMeta->lock, NULL); } +static int32_t metaInitLock(SMeta *pMeta) { + TdThreadRwlockAttr attr; + taosThreadRwlockAttrInit(&attr); + taosThreadRwlockAttrSetKindNP(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); + taosThreadRwlockInit(&pMeta->lock, &attr); + taosThreadRwlockAttrDestroy(&attr); + return 0; +} static int32_t metaDestroyLock(SMeta *pMeta) { return taosThreadRwlockDestroy(&pMeta->lock); } static void metaCleanup(SMeta **ppMeta); @@ -273,7 +280,9 @@ static void metaCleanup(SMeta **ppMeta) { if (pMeta) { if (pMeta->pEnv) metaAbort(pMeta); if (pMeta->pCache) metaCacheClose(pMeta); +#ifdef BUILD_NO_CALL if (pMeta->pIdx) metaCloseIdx(pMeta); +#endif if (pMeta->pStreamDb) tdbTbClose(pMeta->pStreamDb); if (pMeta->pNcolIdx) tdbTbClose(pMeta->pNcolIdx); if (pMeta->pBtimeIdx) tdbTbClose(pMeta->pBtimeIdx); diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index 138bcbb133..621651507e 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -1554,7 +1554,7 @@ static int32_t tdRSmaBatchExec(SSma *pSma, SRSmaInfo *pInfo, STaosQall *qall, SA } _resume_delete: version = RSMA_EXEC_MSG_VER(msg); - if ((terrno = extractDelDataBlock(RSMA_EXEC_MSG_BODY(msg), RSMA_EXEC_MSG_LEN(msg), version, + if ((terrno = tqExtractDelDataBlock(RSMA_EXEC_MSG_BODY(msg), RSMA_EXEC_MSG_LEN(msg), version, &packData.pDataBlock, 1))) { taosFreeQitem(msg); goto _err; diff --git a/source/dnode/vnode/src/sma/smaTimeRange.c b/source/dnode/vnode/src/sma/smaTimeRange.c index f537ede8c1..54d859992c 100644 --- a/source/dnode/vnode/src/sma/smaTimeRange.c +++ b/source/dnode/vnode/src/sma/smaTimeRange.c @@ -193,7 +193,7 @@ int32_t smaBlockToSubmit(SVnode *pVnode, const SArray *pBlocks, const STSchema * continue; } - SSubmitTbData tbData = {.suid = suid, .uid = 0, .sver = pTSchema->version, .flags = SUBMIT_REQ_AUTO_CREATE_TABLE,}; + SSubmitTbData tbData = {.suid = suid, .uid = 0, .sver = pTSchema->version, .flags = SUBMIT_REQ_AUTO_CREATE_TABLE, .source = SOURCE_NULL}; int32_t cid = taosArrayGetSize(pDataBlock->pDataBlock) + 1; tbData.pCreateTbReq = buildAutoCreateTableReq(stbFullName, suid, cid, pDataBlock, tagArray, true); @@ -203,7 +203,7 @@ int32_t smaBlockToSubmit(SVnode *pVnode, const SArray *pBlocks, const STSchema * int32_t *index = taosHashGet(pTableIndexMap, &groupId, sizeof(groupId)); if (index == NULL) { // no data yet, append it - code = setDstTableDataPayload(suid, pTSchema, i, pDataBlock, &tbData, ""); + code = tqSetDstTableDataPayload(suid, pTSchema, i, pDataBlock, &tbData, ""); if (code != TSDB_CODE_SUCCESS) { continue; } @@ -213,7 +213,7 @@ int32_t smaBlockToSubmit(SVnode *pVnode, const SArray *pBlocks, const STSchema * int32_t size = (int32_t)taosArrayGetSize(pReq->aSubmitTbData) - 1; taosHashPut(pTableIndexMap, &groupId, sizeof(groupId), &size, sizeof(size)); } else { - code = setDstTableDataPayload(suid, pTSchema, i, pDataBlock, &tbData, ""); + code = tqSetDstTableDataPayload(suid, pTSchema, i, pDataBlock, &tbData, ""); if (code != TSDB_CODE_SUCCESS) { continue; } diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index a689932754..bde6889ecd 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -66,7 +66,6 @@ STQ* tqOpen(const char* path, SVnode* pVnode) { pTq->path = taosStrdup(path); pTq->pVnode = pVnode; - pTq->walLogLastVer = pVnode->pWal->vers.lastVer; pTq->pHandle = taosHashInit(64, MurmurHash3_32, true, HASH_ENTRY_LOCK); taosHashSetFreeFp(pTq->pHandle, tqDestroyTqHandle); @@ -738,10 +737,9 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t nextProcessVer) { if (pTask->pState == NULL) { tqError("s-task:%s (vgId:%d) failed to open state for task", pTask->id.idStr, vgId); return -1; - } else { - tqDebug("s-task:%s state:%p", pTask->id.idStr, pTask->pState); } + tqDebug("s-task:%s state:%p", pTask->id.idStr, pTask->pState); if (pTask->info.fillHistory) { restoreStreamTaskId(pTask, &taskId); } @@ -835,8 +833,8 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t nextProcessVer) { SCheckpointInfo* pChkInfo = &pTask->chkInfo; // checkpoint ver is the kept version, handled data should be the next version. - if (pTask->chkInfo.checkpointId != 0) { - pTask->chkInfo.nextProcessVer = pTask->chkInfo.checkpointVer + 1; + if (pChkInfo->checkpointId != 0) { + pChkInfo->nextProcessVer = pChkInfo->checkpointVer + 1; tqInfo("s-task:%s restore from the checkpointId:%" PRId64 " ver:%" PRId64 " currentVer:%" PRId64, pTask->id.idStr, pChkInfo->checkpointId, pChkInfo->checkpointVer, pChkInfo->nextProcessVer); } @@ -846,17 +844,19 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t nextProcessVer) { if (pTask->info.fillHistory) { tqInfo("vgId:%d expand stream task, s-task:%s, checkpointId:%" PRId64 " checkpointVer:%" PRId64 " nextProcessVer:%" PRId64 - " child id:%d, level:%d, status:%s fill-history:%d, related stream task:0x%x trigger:%" PRId64 " ms", + " child id:%d, level:%d, status:%s fill-history:%d, related stream task:0x%x trigger:%" PRId64 + " ms, inputVer:%" PRId64, vgId, pTask->id.idStr, pChkInfo->checkpointId, pChkInfo->checkpointVer, pChkInfo->nextProcessVer, pTask->info.selfChildId, pTask->info.taskLevel, p, pTask->info.fillHistory, - (int32_t)pTask->streamTaskId.taskId, pTask->info.triggerParam); + (int32_t)pTask->streamTaskId.taskId, pTask->info.triggerParam, nextProcessVer); } else { tqInfo("vgId:%d expand stream task, s-task:%s, checkpointId:%" PRId64 " checkpointVer:%" PRId64 " nextProcessVer:%" PRId64 - " child id:%d, level:%d, status:%s fill-history:%d, related fill-task:0x%x trigger:%" PRId64 " ms", + " child id:%d, level:%d, status:%s fill-history:%d, related fill-task:0x%x trigger:%" PRId64 + " ms, inputVer:%" PRId64, vgId, pTask->id.idStr, pChkInfo->checkpointId, pChkInfo->checkpointVer, pChkInfo->nextProcessVer, pTask->info.selfChildId, pTask->info.taskLevel, p, pTask->info.fillHistory, - (int32_t)pTask->hTaskInfo.id.taskId, pTask->info.triggerParam); + (int32_t)pTask->hTaskInfo.id.taskId, pTask->info.triggerParam, nextProcessVer); } return 0; @@ -876,12 +876,11 @@ int32_t tqProcessTaskDeployReq(STQ* pTq, int64_t sversion, char* msg, int32_t ms } static void doStartFillhistoryStep2(SStreamTask* pTask, SStreamTask* pStreamTask, STQ* pTq) { - const char* id = pTask->id.idStr; - int64_t nextProcessedVer = pStreamTask->hTaskInfo.haltVer; - - // if it's an source task, extract the last version in wal. + const char* id = pTask->id.idStr; + int64_t nextProcessedVer = pStreamTask->hTaskInfo.haltVer; SVersionRange* pRange = &pTask->dataRange.range; + // if it's an source task, extract the last version in wal. bool done = streamHistoryTaskSetVerRangeStep2(pTask, nextProcessedVer); pTask->execInfo.step2Start = taosGetTimestampMs(); @@ -1055,7 +1054,7 @@ int32_t tqProcessTaskRunReq(STQ* pTq, SRpcMsg* pMsg) { int32_t code = tqStreamTaskProcessRunReq(pTq->pStreamMeta, pMsg, vnodeIsRoleLeader(pTq->pVnode)); // let's continue scan data in the wal files - if(code == 0 && pReq->reqType >= 0){ + if (code == 0 && (pReq->reqType >= 0 || pReq->reqType == STREAM_EXEC_T_RESUME_TASK)) { tqScanWalAsync(pTq, false); } diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 383a636f71..3ae007ce34 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -344,7 +344,7 @@ int32_t extractMsgFromWal(SWalReader* pReader, void** pItem, int64_t maxVer, con void* pBody = POINTER_SHIFT(pCont->body, sizeof(SMsgHead)); int32_t len = pCont->bodyLen - sizeof(SMsgHead); - code = extractDelDataBlock(pBody, len, ver, (void**)pItem, 0); + code = tqExtractDelDataBlock(pBody, len, ver, (void**)pItem, 0); if (code == TSDB_CODE_SUCCESS) { if (*pItem == NULL) { tqDebug("s-task:%s empty delete msg, discard it, len:%d, ver:%" PRId64, id, len, ver); @@ -368,7 +368,7 @@ int32_t extractMsgFromWal(SWalReader* pReader, void** pItem, int64_t maxVer, con } // todo ignore the error in wal? -bool tqNextBlockInWal(STqReader* pReader, const char* id) { +bool tqNextBlockInWal(STqReader* pReader, const char* id, int sourceExcluded) { SWalReader* pWalReader = pReader->pWalReader; SSDataBlock* pDataBlock = NULL; @@ -391,7 +391,10 @@ bool tqNextBlockInWal(STqReader* pReader, const char* id) { numOfBlocks, pReader->msg.msgLen, pReader->msg.ver); SSubmitTbData* pSubmitTbData = taosArrayGet(pReader->submit.aSubmitTbData, pReader->nextBlk); - + if ((pSubmitTbData->source & sourceExcluded) != 0){ + pReader->nextBlk += 1; + continue; + } if (pReader->tbIdHash == NULL || taosHashGet(pReader->tbIdHash, &pSubmitTbData->uid, sizeof(int64_t)) != NULL) { tqTrace("tq reader return submit block, uid:%" PRId64, pSubmitTbData->uid); SSDataBlock* pRes = NULL; diff --git a/source/dnode/vnode/src/tq/tqScan.c b/source/dnode/vnode/src/tq/tqScan.c index 5432637482..d86c0a0474 100644 --- a/source/dnode/vnode/src/tq/tqScan.c +++ b/source/dnode/vnode/src/tq/tqScan.c @@ -93,6 +93,7 @@ int32_t tqScanData(STQ* pTq, STqHandle* pHandle, SMqDataRsp* pRsp, STqOffsetVal* return -1; } + qStreamSetSourceExcluded(task, pRequest->sourceExcluded); while (1) { SSDataBlock* pDataBlock = NULL; code = getDataBlock(task, pHandle, vgId, &pDataBlock); @@ -249,7 +250,7 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta return 0; } -int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxRsp* pRsp, int32_t* totalRows) { +int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxRsp* pRsp, int32_t* totalRows, int8_t sourceExcluded) { STqExecHandle* pExec = &pHandle->execHandle; SArray* pBlocks = taosArrayInit(0, sizeof(SSDataBlock)); SArray* pSchemas = taosArrayInit(0, sizeof(void*)); @@ -264,6 +265,10 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxR if (tqRetrieveTaosxBlock(pReader, pBlocks, pSchemas, &pSubmitTbDataRet) < 0) { if (terrno == TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND) goto loop_table; } + + if ((pSubmitTbDataRet->source & sourceExcluded) != 0){ + goto loop_table; + } if (pRsp->withTbName) { int64_t uid = pExec->pTqReader->lastBlkUid; if (tqAddTbNameToRsp(pTq, uid, pRsp, taosArrayGetSize(pBlocks)) < 0) { @@ -328,6 +333,10 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxR if (tqRetrieveTaosxBlock(pReader, pBlocks, pSchemas, &pSubmitTbDataRet) < 0) { if (terrno == TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND) goto loop_db; } + + if ((pSubmitTbDataRet->source & sourceExcluded) != 0){ + goto loop_db; + } if (pRsp->withTbName) { int64_t uid = pExec->pTqReader->lastBlkUid; if (tqAddTbNameToRsp(pTq, uid, pRsp, taosArrayGetSize(pBlocks)) < 0) { diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c index 7fcb86d84a..b438b2dc0a 100644 --- a/source/dnode/vnode/src/tq/tqSink.c +++ b/source/dnode/vnode/src/tq/tqSink.c @@ -746,7 +746,7 @@ int32_t setDstTableDataUid(SVnode* pVnode, SStreamTask* pTask, SSDataBlock* pDat return TDB_CODE_SUCCESS; } -int32_t setDstTableDataPayload(uint64_t suid, const STSchema *pTSchema, int32_t blockIndex, SSDataBlock* pDataBlock, +int32_t tqSetDstTableDataPayload(uint64_t suid, const STSchema *pTSchema, int32_t blockIndex, SSDataBlock* pDataBlock, SSubmitTbData* pTableData, const char* id) { int32_t numOfRows = pDataBlock->info.rows; @@ -815,13 +815,13 @@ void tqSinkDataIntoDstTable(SStreamTask* pTask, void* vnode, void* data) { return; } - SSubmitTbData tbData = {.suid = suid, .uid = 0, .sver = pTSchema->version}; + SSubmitTbData tbData = {.suid = suid, .uid = 0, .sver = pTSchema->version, .source = SOURCE_NULL}; code = setDstTableDataUid(pVnode, pTask, pDataBlock, stbFullName, &tbData); if (code != TSDB_CODE_SUCCESS) { continue; } - code = setDstTableDataPayload(suid, pTSchema, i, pDataBlock, &tbData, id); + code = tqSetDstTableDataPayload(suid, pTSchema, i, pDataBlock, &tbData, id); if (code != TSDB_CODE_SUCCESS) { continue; } @@ -859,7 +859,7 @@ void tqSinkDataIntoDstTable(SStreamTask* pTask, void* vnode, void* data) { pTask->execInfo.sink.numOfBlocks += 1; uint64_t groupId = pDataBlock->info.id.groupId; - SSubmitTbData tbData = {.suid = suid, .uid = 0, .sver = pTSchema->version}; + SSubmitTbData tbData = {.suid = suid, .uid = 0, .sver = pTSchema->version, .source = SOURCE_NULL}; int32_t* index = taosHashGet(pTableIndexMap, &groupId, sizeof(groupId)); if (index == NULL) { // no data yet, append it @@ -868,7 +868,7 @@ void tqSinkDataIntoDstTable(SStreamTask* pTask, void* vnode, void* data) { continue; } - code = setDstTableDataPayload(suid, pTSchema, i, pDataBlock, &tbData, id); + code = tqSetDstTableDataPayload(suid, pTSchema, i, pDataBlock, &tbData, id); if (code != TSDB_CODE_SUCCESS) { continue; } @@ -878,7 +878,7 @@ void tqSinkDataIntoDstTable(SStreamTask* pTask, void* vnode, void* data) { int32_t size = (int32_t)taosArrayGetSize(submitReq.aSubmitTbData) - 1; taosHashPut(pTableIndexMap, &groupId, sizeof(groupId), &size, sizeof(size)); } else { - code = setDstTableDataPayload(suid, pTSchema, i, pDataBlock, &tbData, id); + code = tqSetDstTableDataPayload(suid, pTSchema, i, pDataBlock, &tbData, id); if (code != TSDB_CODE_SUCCESS) { continue; } diff --git a/source/dnode/vnode/src/tq/tqUtil.c b/source/dnode/vnode/src/tq/tqUtil.c index d18455d221..72a73c0ff2 100644 --- a/source/dnode/vnode/src/tq/tqUtil.c +++ b/source/dnode/vnode/src/tq/tqUtil.c @@ -250,7 +250,7 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, .ver = pHead->version, }; - code = tqTaosxScanLog(pTq, pHandle, submit, &taosxRsp, &totalRows); + code = tqTaosxScanLog(pTq, pHandle, submit, &taosxRsp, &totalRows, pRequest->sourceExcluded); if (code < 0) { tqError("tmq poll: tqTaosxScanLog error %" PRId64 ", in vgId:%d, subkey %s", pRequest->consumerId, vgId, pRequest->subKey); @@ -388,7 +388,7 @@ int32_t tqDoSendDataRsp(const SRpcHandleInfo* pRpcHandleInfo, const SMqDataRsp* return 0; } -int32_t extractDelDataBlock(const void* pData, int32_t len, int64_t ver, void** pRefBlock, int32_t type) { +int32_t tqExtractDelDataBlock(const void* pData, int32_t len, int64_t ver, void** pRefBlock, int32_t type) { SDecoder* pCoder = &(SDecoder){0}; SDeleteRes* pRes = &(SDeleteRes){0}; @@ -449,3 +449,73 @@ int32_t extractDelDataBlock(const void* pData, int32_t len, int64_t ver, void** return TSDB_CODE_SUCCESS; } + +int32_t tqGetStreamExecInfo(SVnode* pVnode, int64_t streamId, int64_t* pDelay, bool* fhFinished) { + SStreamMeta* pMeta = pVnode->pTq->pStreamMeta; + int32_t numOfTasks = taosArrayGetSize(pMeta->pTaskList); + int32_t code = TSDB_CODE_SUCCESS; + + if (pDelay != NULL) { + *pDelay = 0; + } + + *fhFinished = false; + + if (numOfTasks <= 0) { + return code; + } + + // extract the required source task for a given stream, identified by streamId + for (int32_t i = 0; i < numOfTasks; ++i) { + STaskId* pId = taosArrayGet(pMeta->pTaskList, i); + if (pId->streamId != streamId) { + continue; + } + + SStreamTask** ppTask = taosHashGet(pMeta->pTasksMap, pId, sizeof(*pId)); + if (ppTask == NULL) { + tqError("vgId:%d failed to acquire task:0x%" PRIx64 " in retrieving progress", pMeta->vgId, pId->taskId); + continue; + } + + if ((*ppTask)->info.taskLevel != TASK_LEVEL__SOURCE) { + continue; + } + + // here we get the required stream source task + SStreamTask* pTask = *ppTask; + *fhFinished = !HAS_RELATED_FILLHISTORY_TASK(pTask); + + int64_t ver = walReaderGetCurrentVer(pTask->exec.pWalReader); + + SVersionRange verRange = {0}; + walReaderValidVersionRange(pTask->exec.pWalReader, &verRange.minVer, &verRange.maxVer); + + SWalReader* pReader = walOpenReader(pTask->exec.pWalReader->pWal, NULL, 0); + if (pReader == NULL) { + tqError("failed to open wal reader to extract exec progress, vgId:%d", pMeta->vgId); + continue; + } + + int64_t cur = 0; + int64_t latest = 0; + + code = walFetchHead(pReader, ver); + if (code != TSDB_CODE_SUCCESS) { + cur = pReader->pHead->head.ingestTs; + } + + code = walFetchHead(pReader, verRange.maxVer); + if (code != TSDB_CODE_SUCCESS) { + latest = pReader->pHead->head.ingestTs; + } + + if (pDelay != NULL) { // delay in ms + *pDelay = (latest - cur) / 1000; + } + + walCloseReader(pReader); + } + + return TSDB_CODE_SUCCESS; +} diff --git a/source/dnode/vnode/src/tqCommon/tqCommon.c b/source/dnode/vnode/src/tqCommon/tqCommon.c index 21bc09eba0..9a22bc303b 100644 --- a/source/dnode/vnode/src/tqCommon/tqCommon.c +++ b/source/dnode/vnode/src/tqCommon/tqCommon.c @@ -49,7 +49,7 @@ int32_t tqStreamTaskStartAsync(SStreamMeta* pMeta, SMsgCb* cb, bool restart) { return 0; } -int32_t tqStreamOneTaskStartAsync(SStreamMeta* pMeta, SMsgCb* cb, int64_t streamId, int32_t taskId) { +int32_t tqStreamStartOneTaskAsync(SStreamMeta* pMeta, SMsgCb* cb, int64_t streamId, int32_t taskId) { int32_t vgId = pMeta->vgId; int32_t numOfTasks = taosArrayGetSize(pMeta->pTaskList); @@ -317,15 +317,25 @@ int32_t tqStreamTaskProcessRetrieveReq(SStreamMeta* pMeta, SRpcMsg* pMsg) { if (pTask == NULL) { tqError("vgId:%d process retrieve req, failed to acquire task:0x%x, it may have been dropped already", pMeta->vgId, req.dstTaskId); + taosMemoryFree(req.pRetrieve); return -1; } + int32_t code = 0; + if(pTask->info.taskLevel == TASK_LEVEL__SOURCE){ + code = streamProcessRetrieveReq(pTask, &req); + }else{ + req.srcNodeId = pTask->info.nodeId; + req.srcTaskId = pTask->id.taskId; + code = broadcastRetrieveMsg(pTask, &req); + } + SRpcMsg rsp = {.info = pMsg->info, .code = 0}; - streamProcessRetrieveReq(pTask, &req, &rsp); + sendRetrieveRsp(&req, &rsp); streamMetaReleaseTask(pMeta, pTask); - tDeleteStreamRetrieveReq(&req); - return 0; + taosMemoryFree(req.pRetrieve); + return code; } int32_t tqStreamTaskProcessCheckReq(SStreamMeta* pMeta, SRpcMsg* pMsg) { @@ -547,7 +557,7 @@ int32_t tqStreamTaskProcessDeployReq(SStreamMeta* pMeta, SMsgCb* cb, int64_t sve streamMetaWUnLock(pMeta); if (code < 0) { - tqError("failed to add s-task:0x%x into vgId:%d meta, total:%d, code:%s", vgId, taskId, numOfTasks, + tqError("failed to add s-task:0x%x into vgId:%d meta, existed:%d, code:%s", vgId, taskId, numOfTasks, tstrerror(code)); tFreeStreamTask(pTask); return code; @@ -562,9 +572,10 @@ int32_t tqStreamTaskProcessDeployReq(SStreamMeta* pMeta, SMsgCb* cb, int64_t sve if (restored) { SStreamTask* p = streamMetaAcquireTask(pMeta, streamId, taskId); - if (p != NULL && (p->info.fillHistory == 0)) { - tqStreamOneTaskStartAsync(pMeta, cb, streamId, taskId); + if ((p != NULL) && (p->info.fillHistory == 0)) { + tqStreamStartOneTaskAsync(pMeta, cb, streamId, taskId); } + if (p != NULL) { streamMetaReleaseTask(pMeta, p); } diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index cc0bf2b774..7390baa487 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -719,7 +719,7 @@ static int32_t mergeLastCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SC static int32_t mergeLastRowCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCacheRowsReader *pr, int16_t *aCols, int nCols, int16_t *slotIds); -#if 1 +#ifdef BUILD_NO_CALL int32_t tsdbCacheGetSlow(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCacheRowsReader *pr, int8_t ltype) { rocksdb_writebatch_t *wb = NULL; int32_t code = 0; @@ -821,7 +821,6 @@ int32_t tsdbCacheGetSlow(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCacheR return code; } -#endif static SLastCol *tsdbCacheLoadCol(STsdb *pTsdb, SCacheRowsReader *pr, int16_t slotid, tb_uid_t uid, int16_t cid, int8_t ltype) { @@ -880,6 +879,7 @@ static SLastCol *tsdbCacheLoadCol(STsdb *pTsdb, SCacheRowsReader *pr, int16_t sl return pLastCol; } +#endif static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SArray *remainCols, SCacheRowsReader *pr, int8_t ltype) { @@ -1359,6 +1359,7 @@ static void getTableCacheKey(tb_uid_t uid, int cacheType, char *key, int *len) { *len = sizeof(uint64_t); } +#ifdef BUILD_NO_CALL static void deleteTableCacheLast(const void *key, size_t keyLen, void *value, void *ud) { (void)ud; SArray *pLastArray = (SArray *)value; @@ -1670,6 +1671,7 @@ int32_t tsdbCacheInsertLast(SLRUCache *pCache, tb_uid_t uid, TSDBROW *row, STsdb return code; } +#endif static tb_uid_t getTableSuidByUid(tb_uid_t uid, STsdb *pTsdb) { tb_uid_t suid = 0; @@ -1715,6 +1717,7 @@ static int32_t getTableDelDataFromTbData(STbData *pTbData, SArray *aDelData) { return code; } +#ifdef BUILD_NO_CALL static int32_t getTableDelData(STbData *pMem, STbData *pIMem, SDelFReader *pDelReader, SDelIdx *pDelIdx, SArray *aDelData) { int32_t code = 0; @@ -1759,6 +1762,7 @@ _err: } return code; } +#endif static void freeTableInfoFunc(void *param) { void **p = (void **)param; @@ -2716,6 +2720,7 @@ _err: return code; } +#ifdef BUILD_NO_CALL static int32_t initLastColArray(STSchema *pTSchema, SArray **ppColArray) { SArray *pColArray = taosArrayInit(pTSchema->numOfCols, sizeof(SLastCol)); if (NULL == pColArray) { @@ -2729,6 +2734,7 @@ static int32_t initLastColArray(STSchema *pTSchema, SArray **ppColArray) { *ppColArray = pColArray; return TSDB_CODE_SUCCESS; } +#endif static int32_t initLastColArrayPartial(STSchema *pTSchema, SArray **ppColArray, int16_t *slotIds, int nCols) { SArray *pColArray = taosArrayInit(nCols, sizeof(SLastCol)); @@ -3089,7 +3095,9 @@ void tsdbCacheSetCapacity(SVnode *pVnode, size_t capacity) { taosLRUCacheSetCapacity(pVnode->pTsdb->lruCache, capacity); } +#ifdef BUILD_NO_CALL size_t tsdbCacheGetCapacity(SVnode *pVnode) { return taosLRUCacheGetCapacity(pVnode->pTsdb->lruCache); } +#endif size_t tsdbCacheGetUsage(SVnode *pVnode) { size_t usage = 0; @@ -3185,6 +3193,7 @@ int32_t tsdbCacheGetBlockIdx(SLRUCache *pCache, SDataFReader *pFileReader, LRUHa return code; } +#ifdef BUILD_NO_CALL int32_t tsdbBICacheRelease(SLRUCache *pCache, LRUHandle *h) { int32_t code = 0; @@ -3193,6 +3202,7 @@ int32_t tsdbBICacheRelease(SLRUCache *pCache, LRUHandle *h) { return code; } +#endif // block cache static void getBCacheKey(int32_t fid, int64_t commitID, int64_t blkno, char *key, int *len) { diff --git a/source/dnode/vnode/src/tsdb/tsdbDataIter.c b/source/dnode/vnode/src/tsdb/tsdbDataIter.c index 8215c1ac29..e1e6bd5f1f 100644 --- a/source/dnode/vnode/src/tsdb/tsdbDataIter.c +++ b/source/dnode/vnode/src/tsdb/tsdbDataIter.c @@ -16,6 +16,7 @@ #include "tsdb.h" #include "vnodeInt.h" +#ifdef BUILD_NO_CALL // STsdbDataIter2 /* open */ int32_t tsdbOpenDataFileDataIter(SDataFReader* pReader, STsdbDataIter2** ppIter) { @@ -451,6 +452,7 @@ int32_t tsdbDataIterNext2(STsdbDataIter2* pIter, STsdbFilterInfo* pFilterInfo) { return code; } } +#endif /* get */ diff --git a/source/dnode/vnode/src/tsdb/tsdbRead2.c b/source/dnode/vnode/src/tsdb/tsdbRead2.c index 609f38cead..86f58717e2 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead2.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead2.c @@ -2294,6 +2294,7 @@ void updateComposedBlockInfo(STsdbReader* pReader, double el, STableBlockScanInf pResBlock->info.id.uid = (pBlockScanInfo != NULL) ? pBlockScanInfo->uid : 0; pResBlock->info.dataLoad = 1; + pResBlock->info.version = pReader->info.verRange.maxVer; blockDataUpdateTsWindow(pResBlock, pReader->suppInfo.slotId[0]); setComposedBlockFlag(pReader, true); @@ -2627,6 +2628,58 @@ static bool moveToNextTableForPreFileSetMem(SReaderStatus* pStatus) { return (pStatus->pProcMemTableIter != NULL); } +static void buildCleanBlockFromSttFiles(STsdbReader* pReader, STableBlockScanInfo* pScanInfo) { + SReaderStatus* pStatus = &pReader->status; + SSttBlockReader* pSttBlockReader = pStatus->fileIter.pSttBlockReader; + SSDataBlock* pResBlock = pReader->resBlockInfo.pResBlock; + + bool asc = ASCENDING_TRAVERSE(pReader->info.order); + + SDataBlockInfo* pInfo = &pResBlock->info; + blockDataEnsureCapacity(pResBlock, pScanInfo->numOfRowsInStt); + + pInfo->rows = pScanInfo->numOfRowsInStt; + pInfo->id.uid = pScanInfo->uid; + pInfo->dataLoad = 1; + pInfo->window = pScanInfo->sttWindow; + + setComposedBlockFlag(pReader, true); + + pScanInfo->sttKeyInfo.nextProcKey = asc ? pScanInfo->sttWindow.ekey + 1 : pScanInfo->sttWindow.skey - 1; + pScanInfo->sttKeyInfo.status = STT_FILE_NO_DATA; + pScanInfo->lastProcKey = asc ? pScanInfo->sttWindow.ekey : pScanInfo->sttWindow.skey; + pScanInfo->sttBlockReturned = true; + + pSttBlockReader->mergeTree.pIter = NULL; + + tsdbDebug("%p uid:%" PRId64 " return clean stt block as one, brange:%" PRId64 "-%" PRId64 " rows:%" PRId64 " %s", + pReader, pResBlock->info.id.uid, pResBlock->info.window.skey, pResBlock->info.window.ekey, + pResBlock->info.rows, pReader->idStr); +} + +static void buildCleanBlockFromDataFiles(STsdbReader* pReader, STableBlockScanInfo* pScanInfo, + SFileDataBlockInfo* pBlockInfo, int32_t blockIndex) { + // whole block is required, return it directly + SReaderStatus* pStatus = &pReader->status; + SDataBlockInfo* pInfo = &pReader->resBlockInfo.pResBlock->info; + bool asc = ASCENDING_TRAVERSE(pReader->info.order); + + pInfo->rows = pBlockInfo->numRow; + pInfo->id.uid = pScanInfo->uid; + pInfo->dataLoad = 0; + pInfo->version = pReader->info.verRange.maxVer; + pInfo->window = (STimeWindow){.skey = pBlockInfo->firstKey, .ekey = pBlockInfo->lastKey}; + setComposedBlockFlag(pReader, false); + setBlockAllDumped(&pStatus->fBlockDumpInfo, pBlockInfo->lastKey, pReader->info.order); + + // update the last key for the corresponding table + pScanInfo->lastProcKey = asc ? pInfo->window.ekey : pInfo->window.skey; + tsdbDebug("%p uid:%" PRIu64 " clean file block retrieved from file, global index:%d, " + "table index:%d, rows:%d, brange:%" PRId64 "-%" PRId64 ", %s", + pReader, pScanInfo->uid, blockIndex, pBlockInfo->tbBlockIdx, pBlockInfo->numRow, pBlockInfo->firstKey, + pBlockInfo->lastKey, pReader->idStr); +} + static int32_t doLoadSttBlockSequentially(STsdbReader* pReader) { SReaderStatus* pStatus = &pReader->status; SSttBlockReader* pSttBlockReader = pStatus->fileIter.pSttBlockReader; @@ -2679,28 +2732,7 @@ static int32_t doLoadSttBlockSequentially(STsdbReader* pReader) { // if only require the total rows, no need to load data from stt file if it is clean stt blocks if (pReader->info.execMode == READER_EXEC_ROWS && pScanInfo->cleanSttBlocks) { - bool asc = ASCENDING_TRAVERSE(pReader->info.order); - - SDataBlockInfo* pInfo = &pResBlock->info; - blockDataEnsureCapacity(pResBlock, pScanInfo->numOfRowsInStt); - - pInfo->rows = pScanInfo->numOfRowsInStt; - pInfo->id.uid = pScanInfo->uid; - pInfo->dataLoad = 1; - pInfo->window = pScanInfo->sttWindow; - - setComposedBlockFlag(pReader, true); - - pScanInfo->sttKeyInfo.nextProcKey = asc ? pScanInfo->sttWindow.ekey + 1 : pScanInfo->sttWindow.skey - 1; - pScanInfo->sttKeyInfo.status = STT_FILE_NO_DATA; - pScanInfo->lastProcKey = asc ? pScanInfo->sttWindow.ekey : pScanInfo->sttWindow.skey; - pScanInfo->sttBlockReturned = true; - - pSttBlockReader->mergeTree.pIter = NULL; - - tsdbDebug("%p uid:%" PRId64 " return clean stt block as one, brange:%" PRId64 "-%" PRId64 " rows:%" PRId64 " %s", - pReader, pResBlock->info.id.uid, pResBlock->info.window.skey, pResBlock->info.window.ekey, - pResBlock->info.rows, pReader->idStr); + buildCleanBlockFromSttFiles(pReader, pScanInfo); return TSDB_CODE_SUCCESS; } @@ -2740,10 +2772,11 @@ static int32_t doLoadSttBlockSequentially(STsdbReader* pReader) { } } -static bool notOverlapWithSttFiles(SFileDataBlockInfo* pBlockInfo, STableBlockScanInfo* pScanInfo, bool asc) { +// current active data block not overlap with the stt-files/stt-blocks +static bool notOverlapWithFiles(SFileDataBlockInfo* pBlockInfo, STableBlockScanInfo* pScanInfo, bool asc) { ASSERT(pScanInfo->sttKeyInfo.status != STT_FILE_READER_UNINIT); - if (pScanInfo->sttKeyInfo.status == STT_FILE_NO_DATA) { + if ((!hasDataInSttBlock(pScanInfo)) || (pScanInfo->cleanSttBlocks == true)) { return true; } else { int64_t keyInStt = pScanInfo->sttKeyInfo.nextProcKey; @@ -2793,23 +2826,32 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) { int64_t endKey = getBoarderKeyInFiles(pBlockInfo, pScanInfo, pReader->info.order); code = buildDataBlockFromBuf(pReader, pScanInfo, endKey); } else { - if (notOverlapWithSttFiles(pBlockInfo, pScanInfo, asc)) { - // whole block is required, return it directly - SDataBlockInfo* pInfo = &pReader->resBlockInfo.pResBlock->info; - pInfo->rows = pBlockInfo->numRow; - pInfo->id.uid = pScanInfo->uid; - pInfo->dataLoad = 0; - pInfo->window = (STimeWindow){.skey = pBlockInfo->firstKey, .ekey = pBlockInfo->lastKey}; - setComposedBlockFlag(pReader, false); - setBlockAllDumped(&pStatus->fBlockDumpInfo, pBlockInfo->lastKey, pReader->info.order); + if (notOverlapWithFiles(pBlockInfo, pScanInfo, asc)) { + int64_t keyInStt = pScanInfo->sttKeyInfo.nextProcKey; - // update the last key for the corresponding table - pScanInfo->lastProcKey = asc ? pInfo->window.ekey : pInfo->window.skey; - tsdbDebug("%p uid:%" PRIu64 - " clean file block retrieved from file, global index:%d, " - "table index:%d, rows:%d, brange:%" PRId64 "-%" PRId64 ", %s", - pReader, pScanInfo->uid, pBlockIter->index, pBlockInfo->tbBlockIdx, pBlockInfo->numRow, - pBlockInfo->firstKey, pBlockInfo->lastKey, pReader->idStr); + if ((!hasDataInSttBlock(pScanInfo)) || (asc && pBlockInfo->lastKey < keyInStt) || + (!asc && pBlockInfo->firstKey > keyInStt)) { + if (pScanInfo->cleanSttBlocks && hasDataInSttBlock(pScanInfo)) { + if (asc) { // file block is located before the stt block + ASSERT(pScanInfo->sttWindow.skey > pBlockInfo->lastKey); + } else { // stt block is before the file block + ASSERT(pScanInfo->sttWindow.ekey < pBlockInfo->firstKey); + } + } + + buildCleanBlockFromDataFiles(pReader, pScanInfo, pBlockInfo, pBlockIter->index); + } else { // clean stt block + if (asc) { + ASSERT(pScanInfo->sttWindow.ekey < pBlockInfo->firstKey); + } else { + ASSERT(pScanInfo->sttWindow.skey > pBlockInfo->lastKey); + } + + // return the stt file block + ASSERT(pReader->info.execMode == READER_EXEC_ROWS && pSttBlockReader->mergeTree.pIter == NULL); + buildCleanBlockFromSttFiles(pReader, pScanInfo); + return TSDB_CODE_SUCCESS; + } } else { SBlockData* pBData = &pReader->status.fileBlockData; tBlockDataReset(pBData); @@ -2820,7 +2862,6 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) { int64_t st = taosGetTimestampUs(); // let's load data from stt files, make sure clear the cleanStt block flag before load the data from stt files - pScanInfo->cleanSttBlocks = false; initSttBlockReader(pSttBlockReader, pScanInfo, pReader); // no data in stt block, no need to proceed. @@ -2838,8 +2879,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) { // data in stt now overlaps with current active file data block, need to composed with file data block. int64_t lastKeyInStt = getCurrentKeyInSttBlock(pSttBlockReader); - if ((lastKeyInStt >= pBlockInfo->firstKey && asc) || - (lastKeyInStt <= pBlockInfo->lastKey && (!asc))) { + if ((lastKeyInStt >= pBlockInfo->firstKey && asc) || (lastKeyInStt <= pBlockInfo->lastKey && (!asc))) { tsdbDebug("%p lastKeyInStt:%" PRId64 ", overlap with file block, brange:%" PRId64 "-%" PRId64 " %s", pReader, lastKeyInStt, pBlockInfo->firstKey, pBlockInfo->lastKey, pReader->idStr); break; @@ -4993,9 +5033,9 @@ int64_t tsdbGetNumOfRowsInMemTable2(STsdbReader* pReader) { return rows; } -int32_t tsdbGetTableSchema(void* pVnode, int64_t uid, STSchema** pSchema, int64_t* suid) { +int32_t tsdbGetTableSchema(SMeta* pMeta, int64_t uid, STSchema** pSchema, int64_t* suid) { SMetaReader mr = {0}; - metaReaderDoInit(&mr, ((SVnode*)pVnode)->pMeta, 0); + metaReaderDoInit(&mr, pMeta, 0); int32_t code = metaReaderGetTableEntryByUidCache(&mr, uid); if (code != TSDB_CODE_SUCCESS) { terrno = TSDB_CODE_TDB_INVALID_TABLE_ID; @@ -5025,7 +5065,7 @@ int32_t tsdbGetTableSchema(void* pVnode, int64_t uid, STSchema** pSchema, int64_ metaReaderClear(&mr); // get the newest table schema version - code = metaGetTbTSchemaEx(((SVnode*)pVnode)->pMeta, *suid, uid, -1, pSchema); + code = metaGetTbTSchemaEx(pMeta, *suid, uid, -1, pSchema); return code; } diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil.c b/source/dnode/vnode/src/tsdb/tsdbUtil.c index 87917cd243..44621bf4e6 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbUtil.c @@ -29,6 +29,7 @@ void tMapDataClear(SMapData *pMapData) { pMapData->aOffset = NULL; } +#ifdef BUILD_NO_CALL int32_t tMapDataPutItem(SMapData *pMapData, void *pItem, int32_t (*tPutItemFn)(uint8_t *, void *)) { int32_t code = 0; int32_t offset = pMapData->nData; @@ -95,12 +96,14 @@ int32_t tMapDataSearch(SMapData *pMapData, void *pSearchItem, int32_t (*tGetItem _exit: return code; } +#endif void tMapDataGetItemByIdx(SMapData *pMapData, int32_t idx, void *pItem, int32_t (*tGetItemFn)(uint8_t *, void *)) { ASSERT(idx >= 0 && idx < pMapData->nItem); tGetItemFn(pMapData->pData + pMapData->aOffset[idx], pItem); } +#ifdef BUILD_NO_CALL int32_t tMapDataToArray(SMapData *pMapData, int32_t itemSize, int32_t (*tGetItemFn)(uint8_t *, void *), SArray **ppArray) { int32_t code = 0; @@ -140,6 +143,7 @@ int32_t tPutMapData(uint8_t *p, SMapData *pMapData) { return n; } +#endif int32_t tGetMapData(uint8_t *p, SMapData *pMapData) { int32_t n = 0; @@ -167,6 +171,7 @@ int32_t tGetMapData(uint8_t *p, SMapData *pMapData) { return n; } +#ifdef BUILD_NO_CALL // TABLEID ======================================================================= int32_t tTABLEIDCmprFn(const void *p1, const void *p2) { TABLEID *pId1 = (TABLEID *)p1; @@ -199,6 +204,7 @@ int32_t tPutBlockIdx(uint8_t *p, void *ph) { return n; } +#endif int32_t tGetBlockIdx(uint8_t *p, void *ph) { int32_t n = 0; @@ -212,6 +218,7 @@ int32_t tGetBlockIdx(uint8_t *p, void *ph) { return n; } +#ifdef BUILD_NO_CALL int32_t tCmprBlockIdx(void const *lhs, void const *rhs) { SBlockIdx *lBlockIdx = (SBlockIdx *)lhs; SBlockIdx *rBlockIdx = (SBlockIdx *)rhs; @@ -280,6 +287,7 @@ int32_t tPutDataBlk(uint8_t *p, void *ph) { return n; } +#endif int32_t tGetDataBlk(uint8_t *p, void *ph) { int32_t n = 0; @@ -310,6 +318,7 @@ int32_t tGetDataBlk(uint8_t *p, void *ph) { return n; } +#ifdef BUILD_NO_CALL int32_t tDataBlkCmprFn(const void *p1, const void *p2) { SDataBlk *pBlock1 = (SDataBlk *)p1; SDataBlk *pBlock2 = (SDataBlk *)p2; @@ -349,6 +358,7 @@ int32_t tPutSttBlk(uint8_t *p, void *ph) { return n; } +#endif int32_t tGetSttBlk(uint8_t *p, void *ph) { int32_t n = 0; @@ -438,6 +448,7 @@ int32_t tGetBlockCol(uint8_t *p, void *ph) { return n; } +#ifdef BUILD_NO_CALL int32_t tBlockColCmprFn(const void *p1, const void *p2) { if (((SBlockCol *)p1)->cid < ((SBlockCol *)p2)->cid) { return -1; @@ -479,6 +490,7 @@ int32_t tPutDelIdx(uint8_t *p, void *ph) { return n; } +#endif int32_t tGetDelIdx(uint8_t *p, void *ph) { SDelIdx *pDelIdx = (SDelIdx *)ph; @@ -492,6 +504,7 @@ int32_t tGetDelIdx(uint8_t *p, void *ph) { return n; } +#ifdef BUILD_NO_CALL // SDelData ====================================================== int32_t tPutDelData(uint8_t *p, void *ph) { SDelData *pDelData = (SDelData *)ph; @@ -503,6 +516,7 @@ int32_t tPutDelData(uint8_t *p, void *ph) { return n; } +#endif int32_t tGetDelData(uint8_t *p, void *ph) { SDelData *pDelData = (SDelData *)ph; @@ -1269,6 +1283,7 @@ _exit: return code; } +#ifdef BUILD_NO_CALL int32_t tBlockDataTryUpsertRow(SBlockData *pBlockData, TSDBROW *pRow, int64_t uid) { if (pBlockData->nRow == 0) { return 1; @@ -1286,6 +1301,7 @@ int32_t tBlockDataUpsertRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTS return tBlockDataAppendRow(pBlockData, pRow, pTSchema, uid); } } +#endif void tBlockDataGetColData(SBlockData *pBlockData, int16_t cid, SColData **ppColData) { ASSERT(cid != PRIMARYKEY_TIMESTAMP_COL_ID); diff --git a/source/dnode/vnode/src/vnd/vnodeInitApi.c b/source/dnode/vnode/src/vnd/vnodeInitApi.c index c323a81093..2392716bbf 100644 --- a/source/dnode/vnode/src/vnd/vnodeInitApi.c +++ b/source/dnode/vnode/src/vnd/vnodeInitApi.c @@ -91,7 +91,7 @@ void initMetadataAPI(SStoreMeta* pMeta) { pMeta->getTableTypeByName = metaGetTableTypeByName; pMeta->getTableNameByUid = metaGetTableNameByUid; - pMeta->getTableSchema = tsdbGetTableSchema; // todo refactor + pMeta->getTableSchema = vnodeGetTableSchema; pMeta->storeGetTableList = vnodeGetTableList; pMeta->getCachedTableList = metaGetCachedTableUidList; @@ -135,7 +135,9 @@ void initTqAPI(SStoreTqReader* pTq) { pTq->tqReaderNextBlockFilterOut = tqNextDataBlockFilterOut; pTq->tqGetResultBlockTime = tqGetResultBlockTime; -} + + pTq->tqGetStreamExecProgress = tqGetStreamExecInfo; + } void initStateStoreAPI(SStateStore* pStore) { pStore->streamFileStateInit = streamFileStateInit; diff --git a/source/dnode/vnode/src/vnd/vnodeQuery.c b/source/dnode/vnode/src/vnd/vnodeQuery.c index b6a9360afd..4fc7a88494 100644 --- a/source/dnode/vnode/src/vnd/vnodeQuery.c +++ b/source/dnode/vnode/src/vnd/vnodeQuery.c @@ -14,6 +14,7 @@ */ #include "vnd.h" +#include "tsdb.h" #define VNODE_GET_LOAD_RESET_VALS(pVar, oVal, vType, tags) \ do { \ @@ -703,3 +704,7 @@ void *vnodeGetIvtIdx(void *pVnode) { } return metaGetIvtIdx(((SVnode *)pVnode)->pMeta); } + +int32_t vnodeGetTableSchema(void *pVnode, int64_t uid, STSchema **pSchema, int64_t *suid) { + return tsdbGetTableSchema(((SVnode*)pVnode)->pMeta, uid, pSchema, suid); +} diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 3ec6adee41..e4d7b11176 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -238,6 +238,11 @@ static int32_t vnodePreProcessSubmitTbData(SVnode *pVnode, SDecoder *pCoder, int TSDB_CHECK_CODE(code, lino, _exit); } + if (submitTbData.flags & SUBMIT_REQ_FROM_FILE) { + code = grantCheck(TSDB_GRANT_CSV); + TSDB_CHECK_CODE(code, lino, _exit); + } + int64_t uid; if (submitTbData.flags & SUBMIT_REQ_AUTO_CREATE_TABLE) { code = vnodePreprocessCreateTableReq(pVnode, pCoder, btimeMs, &uid); diff --git a/source/libs/catalog/src/ctgRent.c b/source/libs/catalog/src/ctgRent.c index 457285b147..a19eb19c02 100755 --- a/source/libs/catalog/src/ctgRent.c +++ b/source/libs/catalog/src/ctgRent.c @@ -300,7 +300,3 @@ int32_t ctgUpdateRentViewVersion(SCatalog *pCtg, char *dbFName, char *viewName, return TSDB_CODE_SUCCESS; } - - - - diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index 6bae0e1022..c45a8931d2 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -886,7 +886,7 @@ int32_t setLocalVariablesResultIntoDataBlock(SSDataBlock* pBlock) { for (int32_t i = 0, c = 0; i < numOfCfg; ++i, c = 0) { SConfigItem* pItem = taosArrayGet(tsCfg->array, i); - GRANT_CFG_SKIP; + // GRANT_CFG_SKIP; char name[TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE] = {0}; STR_WITH_MAXSIZE_TO_VARSTR(name, pItem->name, TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE); diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h index b1d1680d7d..1f0a047b99 100644 --- a/source/libs/executor/inc/executorInt.h +++ b/source/libs/executor/inc/executorInt.h @@ -279,7 +279,6 @@ typedef struct STableScanInfo { int8_t assignBlockUid; uint8_t countState; // empty table count state bool hasGroupByTag; - bool countOnly; bool filesetDelimited; bool needCountEmptyTable; } STableScanInfo; @@ -557,6 +556,11 @@ typedef struct SStreamIntervalOperatorInfo { bool reCkBlock; SSDataBlock* pCheckpointRes; struct SUpdateInfo* pUpdateInfo; + bool recvRetrive; + SSDataBlock* pMidRetriveRes; + bool recvPullover; + SSDataBlock* pMidPulloverRes; + bool clearState; } SStreamIntervalOperatorInfo; typedef struct SDataGroupInfo { @@ -758,10 +762,12 @@ extern void doDestroyExchangeOperatorInfo(void* param); int32_t doFilterImpl(SSDataBlock* pBlock, SFilterInfo* pFilterInfo, SColMatchInfo* pColMatchInfo, SColumnInfoData** pResCol); int32_t doFilter(SSDataBlock* pBlock, SFilterInfo* pFilterInfo, SColMatchInfo* pColMatchInfo); int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int32_t numOfExpr, SSDataBlock* pBlock, - int32_t rows, const char* idStr, STableMetaCacheInfo* pCache); + int32_t rows, SExecTaskInfo* pTask, STableMetaCacheInfo* pCache); void appendOneRowToDataBlock(SSDataBlock* pBlock, STupleHandle* pTupleHandle); void setTbNameColData(const SSDataBlock* pBlock, SColumnInfoData* pColInfoData, int32_t functionId, const char* name); +void setVgIdColData(const SSDataBlock* pBlock, SColumnInfoData* pColInfoData, int32_t functionId, int32_t vgId); +void setVgVerColData(const SSDataBlock* pBlock, SColumnInfoData* pColInfoData, int32_t functionId, int64_t vgVer); void setResultRowInitCtx(SResultRow* pResult, SqlFunctionCtx* pCtx, int32_t numOfOutput, int32_t* rowEntryInfoOffset); void clearResultRowInitFlag(SqlFunctionCtx* pCtx, int32_t numOfOutput); diff --git a/source/libs/executor/inc/querytask.h b/source/libs/executor/inc/querytask.h index fcafd5a4e3..0c9a5e3197 100644 --- a/source/libs/executor/inc/querytask.h +++ b/source/libs/executor/inc/querytask.h @@ -59,6 +59,7 @@ typedef struct STaskStopInfo { typedef struct { STqOffsetVal currentOffset; // for tmq SMqMetaRsp metaRsp; // for tmq fetching meta + int8_t sourceExcluded; int64_t snapshotVer; SSchemaWrapper* schema; char tbName[TSDB_TABLE_NAME_LEN]; // this is the current scan table: todo refactor diff --git a/source/libs/executor/src/cachescanoperator.c b/source/libs/executor/src/cachescanoperator.c index 63fcfba7c1..e4fa9f7580 100644 --- a/source/libs/executor/src/cachescanoperator.c +++ b/source/libs/executor/src/cachescanoperator.c @@ -250,7 +250,7 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) { SExprSupp* pSup = &pInfo->pseudoExprSup; int32_t code = addTagPseudoColumnData(&pInfo->readHandle, pSup->pExprInfo, pSup->numOfExprs, pRes, - pRes->info.rows, GET_TASKID(pTaskInfo), NULL); + pRes->info.rows, pTaskInfo, NULL); if (code != TSDB_CODE_SUCCESS) { pTaskInfo->code = code; return NULL; @@ -313,7 +313,7 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) { if (taosArrayGetSize(pInfo->pUidList) > 0) { pInfo->pRes->info.id.uid = *(tb_uid_t*)taosArrayGet(pInfo->pUidList, 0); code = addTagPseudoColumnData(&pInfo->readHandle, pSup->pExprInfo, pSup->numOfExprs, pInfo->pRes, - pInfo->pRes->info.rows, GET_TASKID(pTaskInfo), NULL); + pInfo->pRes->info.rows, pTaskInfo, NULL); if (code != TSDB_CODE_SUCCESS) { pTaskInfo->code = code; return NULL; diff --git a/source/libs/executor/src/eventwindowoperator.c b/source/libs/executor/src/eventwindowoperator.c index 3cfd0ab582..2cba6e3241 100644 --- a/source/libs/executor/src/eventwindowoperator.c +++ b/source/libs/executor/src/eventwindowoperator.c @@ -220,7 +220,6 @@ static int32_t setSingleOutputTupleBufv1(SResultRowInfo* pResultRowInfo, STimeWi (*pResult)->win = *win; - clearResultRowInitFlag(pExprSup->pCtx, pExprSup->numOfExprs); setResultRowInitCtx(*pResult, pExprSup->pCtx, pExprSup->numOfExprs, pExprSup->rowEntryInfoOffset); return TSDB_CODE_SUCCESS; } @@ -262,6 +261,7 @@ int32_t eventWindowAggImpl(SOperatorInfo* pOperator, SEventWindowOperatorInfo* p } else if (pInfo->groupId != gid) { // this is a new group, reset the info pInfo->inWindow = false; + pInfo->groupId = gid; } SFilterColumnParam param1 = {.numOfCols = taosArrayGetSize(pBlock->pDataBlock), .pDataBlock = pBlock->pDataBlock}; @@ -319,6 +319,9 @@ int32_t eventWindowAggImpl(SOperatorInfo* pOperator, SEventWindowOperatorInfo* p doKeepNewWindowStartInfo(pRowSup, tsList, rowIndex, gid); pInfo->inWindow = true; startIndex = rowIndex; + if (pInfo->pRow != NULL) { + clearResultRowInitFlag(pSup->pCtx, pSup->numOfExprs); + } break; } } diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 1751109ff3..8bd83ee0fb 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -2229,6 +2229,8 @@ char* getStreamOpName(uint16_t opType) { return "interval final"; case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL: return "interval semi"; + case QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL: + return "interval mid"; case QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL: return "stream fill"; case QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION: diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 3472f4e14d..6d80b79d9d 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -947,7 +947,7 @@ int32_t qSetStreamOperatorOptionForScanHistory(qTaskInfo_t tinfo) { while (1) { int32_t type = pOperator->operatorType; if (type == QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL || type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL || - type == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL) { + type == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL || type == QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL) { SStreamIntervalOperatorInfo* pInfo = pOperator->info; STimeWindowAggSupp* pSup = &pInfo->twAggSup; @@ -1035,7 +1035,7 @@ int32_t qRestoreStreamOperatorOption(qTaskInfo_t tinfo) { while (1) { uint16_t type = pOperator->operatorType; if (type == QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL || type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL || - type == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL) { + type == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL || type == QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL) { SStreamIntervalOperatorInfo* pInfo = pOperator->info; pInfo->twAggSup.calTrigger = pInfo->twAggSup.calTriggerSaved; pInfo->twAggSup.deleteMark = pInfo->twAggSup.deleteMarkSaved; @@ -1080,7 +1080,7 @@ bool qStreamScanhistoryFinished(qTaskInfo_t tinfo) { int32_t qStreamInfoResetTimewindowFilter(qTaskInfo_t tinfo) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - STimeWindow* pWindow = &pTaskInfo->streamInfo.fillHistoryWindow; + STimeWindow* pWindow = &pTaskInfo->streamInfo.fillHistoryWindow; qDebug("%s remove timeWindow filter:%" PRId64 "-%" PRId64 ", set new window:%" PRId64 "-%" PRId64, GET_TASKID(pTaskInfo), pWindow->skey, pWindow->ekey, INT64_MIN, INT64_MAX); @@ -1152,6 +1152,11 @@ void qStreamSetOpen(qTaskInfo_t tinfo) { pOperator->status = OP_NOT_OPENED; } +void qStreamSetSourceExcluded(qTaskInfo_t tinfo, int8_t sourceExcluded) { + SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; + pTaskInfo->streamInfo.sourceExcluded = sourceExcluded; +} + int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subType) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; SStorageAPI* pAPI = &pTaskInfo->storageAPI; diff --git a/source/libs/executor/src/executorInt.c b/source/libs/executor/src/executorInt.c index a082edb85c..7cd4feb561 100644 --- a/source/libs/executor/src/executorInt.c +++ b/source/libs/executor/src/executorInt.c @@ -310,6 +310,7 @@ static int32_t doSetInputDataBlock(SExprSupp* pExprSup, SSDataBlock* pBlock, int pInput->totalRows = pBlock->info.rows; pInput->numOfRows = pBlock->info.rows; pInput->startRowIndex = 0; + pInput->blankFill = pBlock->info.blankFill; // NOTE: the last parameter is the primary timestamp column // todo: refactor this @@ -324,6 +325,7 @@ static int32_t doSetInputDataBlock(SExprSupp* pExprSup, SSDataBlock* pBlock, int pInput->totalRows = pBlock->info.rows; pInput->numOfRows = pBlock->info.rows; pInput->startRowIndex = 0; + pInput->blankFill = pBlock->info.blankFill; code = doCreateConstantValColumnInfo(pInput, pFuncParam, j, pBlock->info.rows); if (code != TSDB_CODE_SUCCESS) { diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index 1e9771edd6..87b8cd366c 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -287,7 +287,6 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) { terrno = TSDB_CODE_SUCCESS; int32_t num = 0; - uint64_t groupId = 0; for (int32_t j = 0; j < pBlock->info.rows; ++j) { // Compare with the previous row of this column, and do not set the output buffer again if they are identical. if (!pInfo->isInit) { @@ -478,20 +477,6 @@ static SSDataBlock* hashGroupbyAggregate(SOperatorInfo* pOperator) { pOperator->status = OP_RES_TO_RETURN; -#if 0 - if(pOperator->fpSet.encodeResultRow){ - char *result = NULL; - int32_t length = 0; - pOperator->fpSet.encodeResultRow(pOperator, &result, &length); - SAggSupporter* pSup = &pInfo->aggSup; - taosHashClear(pSup->pResultRowHashTable); - pInfo->binfo.resultRowInfo.size = 0; - pOperator->fpSet.decodeResultRow(pOperator, result); - if(result){ - taosMemoryFree(result); - } - } -#endif // initGroupedResultInfo(&pInfo->groupResInfo, pInfo->aggSup.pResultRowHashTable, 0); if (pGroupResInfo->pRows != NULL) { taosArrayDestroy(pGroupResInfo->pRows); diff --git a/source/libs/executor/src/operator.c b/source/libs/executor/src/operator.c index 69a8acb3d7..fd4b3cd7db 100644 --- a/source/libs/executor/src/operator.c +++ b/source/libs/executor/src/operator.c @@ -489,6 +489,9 @@ SOperatorInfo* createOperator(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, SR } else if (QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL == type) { int32_t children = 0; pOptr = createStreamFinalIntervalOperatorInfo(ops[0], pPhyNode, pTaskInfo, children, pHandle); + } else if (QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL == type) { + int32_t children = pHandle->numOfVgroups; + pOptr = createStreamFinalIntervalOperatorInfo(ops[0], pPhyNode, pTaskInfo, children, pHandle); } else if (QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL == type) { int32_t children = pHandle->numOfVgroups; pOptr = createStreamFinalIntervalOperatorInfo(ops[0], pPhyNode, pTaskInfo, children, pHandle); diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index ec1d6b9f75..cb6ec56235 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -21,7 +21,6 @@ #include "querynodes.h" #include "systable.h" #include "tname.h" -#include "ttime.h" #include "tdatablock.h" #include "tmsg.h" @@ -252,7 +251,7 @@ static void doSetTagColumnData(STableScanBase* pTableScanInfo, SSDataBlock* pBlo SExprSupp* pSup = &pTableScanInfo->pseudoSup; int32_t code = addTagPseudoColumnData(&pTableScanInfo->readHandle, pSup->pExprInfo, pSup->numOfExprs, pBlock, rows, - GET_TASKID(pTaskInfo), &pTableScanInfo->metaCache); + pTaskInfo, &pTableScanInfo->metaCache); // ignore the table not exists error, since this table may have been dropped during the scan procedure. if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_PAR_TABLE_NOT_EXIST) { T_LONG_JMP(pTaskInfo->env, code); @@ -295,8 +294,8 @@ bool applyLimitOffset(SLimitInfo* pLimitInfo, SSDataBlock* pBlock, SExecTaskInfo static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanBase* pTableScanInfo, SSDataBlock* pBlock, uint32_t* status) { - SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; - SStorageAPI* pAPI = &pTaskInfo->storageAPI; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + SStorageAPI* pAPI = &pTaskInfo->storageAPI; SFileBlockLoadRecorder* pCost = &pTableScanInfo->readRecorder; @@ -482,24 +481,25 @@ static void doSetNullValue(SSDataBlock* pBlock, const SExprInfo* pExpr, int32_t } int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int32_t numOfExpr, SSDataBlock* pBlock, - int32_t rows, const char* idStr, STableMetaCacheInfo* pCache) { + int32_t rows, SExecTaskInfo* pTask, STableMetaCacheInfo* pCache) { + int32_t code = 0; + bool freeReader = false; + LRUHandle* h = NULL; + STableCachedVal val = {0}; + SMetaReader mr = {0}; + const char* idStr = pTask->id.str; + // currently only the tbname pseudo column if (numOfExpr <= 0) { return TSDB_CODE_SUCCESS; } - int32_t code = 0; - bool freeReader = false; + // todo: opt if only require the vgId and the vgVer; // backup the rows int32_t backupRows = pBlock->info.rows; pBlock->info.rows = rows; - STableCachedVal val = {0}; - - SMetaReader mr = {0}; - LRUHandle* h = NULL; - // todo refactor: extract method // the handling of the null data should be packed in the extracted method @@ -586,7 +586,14 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int // this is to handle the tbname if (fmIsScanPseudoColumnFunc(functionId)) { - setTbNameColData(pBlock, pColInfoData, functionId, val.pName); + int32_t fType = pExpr1->pExpr->_function.functionType; + if (fType == FUNCTION_TYPE_TBNAME) { + setTbNameColData(pBlock, pColInfoData, functionId, val.pName); + } else if (fType == FUNCTION_TYPE_VGID) { + setVgIdColData(pBlock, pColInfoData, functionId, pTask->id.vgId); + } else if (fType == FUNCTION_TYPE_VGVER) { + setVgVerColData(pBlock, pColInfoData, functionId, pBlock->info.version); + } } else { // these are tags STagVal tagVal = {0}; tagVal.cid = pExpr1->base.pParam[0].pCol->colId; @@ -655,6 +662,47 @@ void setTbNameColData(const SSDataBlock* pBlock, SColumnInfoData* pColInfoData, colDataDestroy(&infoData); } +void setVgIdColData(const SSDataBlock* pBlock, SColumnInfoData* pColInfoData, int32_t functionId, int32_t vgId) { + struct SScalarFuncExecFuncs fpSet = {0}; + fmGetScalarFuncExecFuncs(functionId, &fpSet); + + SColumnInfoData infoData = createColumnInfoData(pColInfoData->info.type, pColInfoData->info.bytes, 1); + + colInfoDataEnsureCapacity(&infoData, 1, false); + colDataSetVal(&infoData, 0, (const char*)&vgId, false); + + SScalarParam srcParam = {.numOfRows = pBlock->info.rows, .columnData = &infoData}; + SScalarParam param = {.columnData = pColInfoData}; + + if (fpSet.process != NULL) { + fpSet.process(&srcParam, 1, ¶m); + } else { + qError("failed to get the corresponding callback function, functionId:%d", functionId); + } + + colDataDestroy(&infoData); +} + +void setVgVerColData(const SSDataBlock* pBlock, SColumnInfoData* pColInfoData, int32_t functionId, int64_t vgVer) { + struct SScalarFuncExecFuncs fpSet = {0}; + fmGetScalarFuncExecFuncs(functionId, &fpSet); + + SColumnInfoData infoData = createColumnInfoData(pColInfoData->info.type, pColInfoData->info.bytes, 1); + + colInfoDataEnsureCapacity(&infoData, 1, false); + colDataSetVal(&infoData, 0, (const char*)&vgVer, false); + + SScalarParam srcParam = {.numOfRows = pBlock->info.rows, .columnData = &infoData}; + SScalarParam param = {.columnData = pColInfoData}; + + if (fpSet.process != NULL) { + fpSet.process(&srcParam, 1, ¶m); + } else { + qError("failed to get the corresponding callback function, functionId:%d", functionId); + } + + colDataDestroy(&infoData); +} static void initNextGroupScan(STableScanInfo* pInfo, STableKeyInfo** pKeyInfo, int32_t* size) { tableListGetGroupList(pInfo->base.pTableListInfo, pInfo->currentGroupId, pKeyInfo, size); @@ -663,6 +711,8 @@ static void initNextGroupScan(STableScanInfo* pInfo, STableKeyInfo** pKeyInfo, i pInfo->tableEndIndex = (pInfo->tableStartIndex + (*size) - 1); + pInfo->pResBlock->info.blankFill = false; + if (!pInfo->needCountEmptyTable) { pInfo->countState = TABLE_COUNT_STATE_END; } else { @@ -687,6 +737,7 @@ static SSDataBlock* getOneRowResultBlock(SExecTaskInfo* pTaskInfo, STableScanBas pBlock->info.rows = 1; pBlock->info.id.uid = tbInfo->uid; pBlock->info.id.groupId = tbInfo->groupId; + pBlock->info.blankFill = true; // only one row: set all col data to null & hasNull int32_t col_num = blockDataGetNumOfCols(pBlock); @@ -696,7 +747,7 @@ static SSDataBlock* getOneRowResultBlock(SExecTaskInfo* pTaskInfo, STableScanBas } // set tag/tbname - doSetTagColumnData(pBase, pBlock, pTaskInfo, pBlock->info.rows); + doSetTagColumnData(pBase, pBlock, pTaskInfo, 1); return pBlock; } @@ -963,13 +1014,11 @@ static SSDataBlock* groupSeqTableScan(SOperatorInfo* pOperator) { STableKeyInfo* pList = NULL; if (pInfo->currentGroupId == -1) { - int32_t numOfTables = tableListGetSize(pInfo->base.pTableListInfo); if ((++pInfo->currentGroupId) >= tableListGetOutputGroups(pInfo->base.pTableListInfo)) { setOperatorCompleted(pOperator); return NULL; } - initNextGroupScan(pInfo, &pList, &num); ASSERT(pInfo->base.dataReader == NULL); @@ -1172,10 +1221,6 @@ SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, goto _error; } - if (scanDebug) { - pInfo->countOnly = true; - } - pInfo->filesetDelimited = pTableScanNode->filesetDelimited; taosLRUCacheSetStrictCapacity(pInfo->base.metaCache.pTableMetaEntryCache, false); @@ -1227,6 +1272,7 @@ static bool isStateWindow(SStreamScanInfo* pInfo) { static bool isIntervalWindow(SStreamScanInfo* pInfo) { return pInfo->windowSup.parentType == QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL || pInfo->windowSup.parentType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL || + pInfo->windowSup.parentType == QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL || pInfo->windowSup.parentType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL; } @@ -1901,7 +1947,7 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock // currently only the tbname pseudo column if (pInfo->numOfPseudoExpr > 0) { int32_t code = addTagPseudoColumnData(&pInfo->readHandle, pInfo->pPseudoExpr, pInfo->numOfPseudoExpr, pInfo->pRes, - pBlockInfo->rows, id, &pTableScanInfo->base.metaCache); + pBlockInfo->rows, pTaskInfo, &pTableScanInfo->base.metaCache); // ignore the table not exists error, since this table may have been dropped during the scan procedure. if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_PAR_TABLE_NOT_EXIST) { blockDataFreeRes((SSDataBlock*)pBlock); @@ -1965,7 +2011,7 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) { if (pTaskInfo->streamInfo.currentOffset.type == TMQ_OFFSET__LOG) { while (1) { - bool hasResult = pAPI->tqReaderFn.tqReaderNextBlockInWal(pInfo->tqReader, id); + bool hasResult = pAPI->tqReaderFn.tqReaderNextBlockInWal(pInfo->tqReader, id, pTaskInfo->streamInfo.sourceExcluded); SSDataBlock* pRes = pAPI->tqReaderFn.tqGetResultBlock(pInfo->tqReader); struct SWalReader* pWalReader = pAPI->tqReaderFn.tqReaderGetWalReader(pInfo->tqReader); @@ -2134,7 +2180,7 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { pTSInfo->base.cond.endVersion = pStreamInfo->fillHistoryVer.maxVer; pTSInfo->base.cond.twindows = pStreamInfo->fillHistoryWindow; - qDebug("stream recover step1, verRange:%" PRId64 "-%" PRId64 " window:%"PRId64"-%"PRId64", %s", pTSInfo->base.cond.startVersion, + qDebug("stream scan step1, verRange:%" PRId64 "-%" PRId64 " window:%"PRId64"-%"PRId64", %s", pTSInfo->base.cond.startVersion, pTSInfo->base.cond.endVersion, pTSInfo->base.cond.twindows.skey, pTSInfo->base.cond.twindows.ekey, id); pStreamInfo->recoverStep = STREAM_RECOVER_STEP__SCAN1; pStreamInfo->recoverScanFinished = false; diff --git a/source/libs/executor/src/streameventwindowoperator.c b/source/libs/executor/src/streameventwindowoperator.c index 8aca76597b..4a2fe2416f 100644 --- a/source/libs/executor/src/streameventwindowoperator.c +++ b/source/libs/executor/src/streameventwindowoperator.c @@ -349,6 +349,7 @@ static void doStreamEventAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl } if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE) { + curWin.winInfo.pStatePos->beUpdated = true; SSessionKey key = {0}; getSessionHashKey(&curWin.winInfo.sessionWin, &key); tSimpleHashPut(pAggSup->pResultRows, &key, sizeof(SSessionKey), &curWin.winInfo, sizeof(SResultWindowInfo)); @@ -725,7 +726,6 @@ SOperatorInfo* createStreamEventAggOperatorInfo(SOperatorInfo* downstream, SPhys } if (pInfo->isHistoryOp) { - _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); pInfo->pAllUpdated = tSimpleHashInit(64, hashFn); } else { pInfo->pAllUpdated = NULL; diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c index 02f8b90864..b3f18d08ac 100644 --- a/source/libs/executor/src/streamtimewindowoperator.c +++ b/source/libs/executor/src/streamtimewindowoperator.c @@ -28,6 +28,7 @@ #include "ttime.h" #define IS_FINAL_INTERVAL_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL) +#define IS_MID_INTERVAL_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL) #define IS_FINAL_SESSION_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) #define DEAULT_DELETE_MARK INT64_MAX #define STREAM_INTERVAL_OP_STATE_NAME "StreamIntervalHistoryState" @@ -48,6 +49,8 @@ typedef struct SPullWindowInfo { STimeWindow calWin; } SPullWindowInfo; +static SSDataBlock* doStreamMidIntervalAgg(SOperatorInfo* pOperator); + typedef int32_t (*__compare_fn_t)(void* pKey, void* data, int32_t index); static int32_t binarySearchCom(void* keyList, int num, void* pKey, int order, __compare_fn_t comparefn) { @@ -235,7 +238,7 @@ static void doDeleteWindows(SOperatorInfo* pOperator, SInterval* pInterval, SSDa dumyInfo.cur.pageId = -1; STimeWindow win = {0}; - if (IS_FINAL_INTERVAL_OP(pOperator)) { + if (IS_FINAL_INTERVAL_OP(pOperator) || IS_MID_INTERVAL_OP(pOperator)) { win.skey = startTsCols[i]; win.ekey = endTsCols[i]; } else { @@ -407,6 +410,8 @@ void destroyStreamFinalIntervalOperatorInfo(void* param) { blockDataDestroy(pInfo->pPullDataRes); taosArrayDestroy(pInfo->pDelWins); blockDataDestroy(pInfo->pDelRes); + blockDataDestroy(pInfo->pMidRetriveRes); + blockDataDestroy(pInfo->pMidPulloverRes); pInfo->stateStore.streamFileStateDestroy(pInfo->pState->pFileState); if (pInfo->pState->dump == 1) { @@ -599,7 +604,7 @@ static void doBuildPullDataBlock(SArray* array, int32_t* pIndex, SSDataBlock* pB blockDataUpdateTsWindow(pBlock, 0); } -void processPullOver(SSDataBlock* pBlock, SHashObj* pMap, SHashObj* pFinalMap, SInterval* pInterval, SArray* pPullWins, +static bool processPullOver(SSDataBlock* pBlock, SHashObj* pMap, SHashObj* pFinalMap, SInterval* pInterval, SArray* pPullWins, int32_t numOfCh, SOperatorInfo* pOperator) { SColumnInfoData* pStartCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); TSKEY* tsData = (TSKEY*)pStartCol->pData; @@ -608,6 +613,7 @@ void processPullOver(SSDataBlock* pBlock, SHashObj* pMap, SHashObj* pFinalMap, S SColumnInfoData* pGroupCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX); uint64_t* groupIdData = (uint64_t*)pGroupCol->pData; int32_t chId = getChildIndex(pBlock); + bool res = false; for (int32_t i = 0; i < pBlock->info.rows; i++) { TSKEY winTs = tsData[i]; while (winTs <= tsEndData[i]) { @@ -623,6 +629,7 @@ void processPullOver(SSDataBlock* pBlock, SHashObj* pMap, SHashObj* pFinalMap, S // pull data is over taosArrayDestroy(chArray); taosHashRemove(pMap, &winRes, sizeof(SWinKey)); + res =true; qDebug("===stream===retrive pull data over.window %" PRId64, winRes.ts); void* pFinalCh = taosHashGet(pFinalMap, &winRes, sizeof(SWinKey)); @@ -646,6 +653,7 @@ void processPullOver(SSDataBlock* pBlock, SHashObj* pMap, SHashObj* pFinalMap, S winTs = taosTimeAdd(winTs, pInterval->sliding, pInterval->slidingUnit, pInterval->precision); } } + return res; } static void addRetriveWindow(SArray* wins, SStreamIntervalOperatorInfo* pInfo, int32_t childId) { @@ -1182,6 +1190,12 @@ static SSDataBlock* buildIntervalResult(SOperatorInfo* pOperator) { printDataBlock(pInfo->binfo.pRes, getStreamOpName(opType), GET_TASKID(pTaskInfo)); return pInfo->binfo.pRes; } + + if (pInfo->recvPullover) { + pInfo->recvPullover = false; + printDataBlock(pInfo->pMidPulloverRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); + return pInfo->pMidPulloverRes; + } return NULL; } @@ -1236,11 +1250,15 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { return NULL; } else { if (!IS_FINAL_INTERVAL_OP(pOperator)) { - doBuildDeleteResult(pInfo, pInfo->pDelWins, &pInfo->delIndex, pInfo->pDelRes); - if (pInfo->pDelRes->info.rows != 0) { - // process the rest of the data - printDataBlock(pInfo->pDelRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); - return pInfo->pDelRes; + SSDataBlock* resBlock = buildIntervalResult(pOperator); + if (resBlock != NULL) { + return resBlock; + } + + if (pInfo->recvRetrive) { + pInfo->recvRetrive = false; + printDataBlock(pInfo->pMidRetriveRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); + return pInfo->pMidRetriveRes; } } } @@ -1314,9 +1332,12 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { pInfo->recvGetAll = true; getAllIntervalWindow(pInfo->aggSup.pResultRowHashTable, pInfo->pUpdatedMap); continue; - } else if (pBlock->info.type == STREAM_RETRIEVE && !IS_FINAL_INTERVAL_OP(pOperator)) { - doDeleteWindows(pOperator, &pInfo->interval, pBlock, NULL, pInfo->pUpdatedMap); - if (taosArrayGetSize(pInfo->pUpdated) > 0) { + } else if (pBlock->info.type == STREAM_RETRIEVE) { + if(!IS_FINAL_INTERVAL_OP(pOperator)) { + pInfo->recvRetrive = true; + copyDataBlock(pInfo->pMidRetriveRes, pBlock); + pInfo->pMidRetriveRes->info.type = STREAM_MID_RETRIEVE; + doDeleteWindows(pOperator, &pInfo->interval, pBlock, NULL, pInfo->pUpdatedMap); break; } continue; @@ -1331,6 +1352,8 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { doStreamIntervalSaveCheckpoint(pOperator); copyDataBlock(pInfo->pCheckpointRes, pBlock); continue; + } else if (IS_FINAL_INTERVAL_OP(pOperator) && pBlock->info.type == STREAM_MID_RETRIEVE) { + continue; } else { ASSERTS(pBlock->info.type == STREAM_INVALID, "invalid SSDataBlock type"); } @@ -1359,7 +1382,18 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { pInfo->pUpdated = NULL; blockDataEnsureCapacity(pInfo->binfo.pRes, pOperator->resultInfo.capacity); - return buildIntervalResult(pOperator); + SSDataBlock* resBlock = buildIntervalResult(pOperator); + if (resBlock != NULL) { + return resBlock; + } + + if (pInfo->recvRetrive) { + pInfo->recvRetrive = false; + printDataBlock(pInfo->pMidRetriveRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); + return pInfo->pMidRetriveRes; + } + + return NULL; } int64_t getDeleteMark(SWindowPhysiNode* pWinPhyNode, int64_t interval) { @@ -1400,7 +1434,8 @@ static int32_t getMaxFunResSize(SExprSupp* pSup, int32_t numOfCols) { } static void streamIntervalReleaseState(SOperatorInfo* pOperator) { - if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL) { + if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL && + pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL) { SStreamIntervalOperatorInfo* pInfo = pOperator->info; int32_t resSize = sizeof(TSKEY); pInfo->stateStore.streamStateSaveInfo(pInfo->pState, STREAM_INTERVAL_OP_STATE_NAME, @@ -1417,7 +1452,8 @@ static void streamIntervalReleaseState(SOperatorInfo* pOperator) { void streamIntervalReloadState(SOperatorInfo* pOperator) { SStreamIntervalOperatorInfo* pInfo = pOperator->info; - if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL) { + if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL && + pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL) { int32_t size = 0; void* pBuf = NULL; int32_t code = pInfo->stateStore.streamStateGetInfo(pInfo->pState, STREAM_INTERVAL_OP_STATE_NAME, @@ -1442,6 +1478,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, SIntervalPhysiNode* pIntervalPhyNode = (SIntervalPhysiNode*)pPhyNode; SStreamIntervalOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamIntervalOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); + int32_t code = 0; if (pInfo == NULL || pOperator == NULL) { goto _error; } @@ -1471,7 +1508,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, if (pIntervalPhyNode->window.pExprs != NULL) { int32_t numOfScalar = 0; SExprInfo* pScalarExprInfo = createExprInfo(pIntervalPhyNode->window.pExprs, NULL, &numOfScalar); - int32_t code = initExprSupp(&pInfo->scalarSupp, pScalarExprInfo, numOfScalar, &pTaskInfo->storageAPI.functionStore); + code = initExprSupp(&pInfo->scalarSupp, pScalarExprInfo, numOfScalar, &pTaskInfo->storageAPI.functionStore); if (code != TSDB_CODE_SUCCESS) { goto _error; } @@ -1490,7 +1527,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, qInfo("copy state %p to %p", pTaskInfo->streamInfo.pState, pInfo->pState); pAPI->stateStore.streamStateSetNumber(pInfo->pState, -1); - int32_t code = initAggSup(&pOperator->exprSupp, &pInfo->aggSup, pExprInfo, numOfCols, keyBufSize, pTaskInfo->id.str, + code = initAggSup(&pOperator->exprSupp, &pInfo->aggSup, pExprInfo, numOfCols, keyBufSize, pTaskInfo->id.str, pInfo->pState, &pTaskInfo->storageAPI.functionStore); if (code != TSDB_CODE_SUCCESS) { goto _error; @@ -1526,6 +1563,10 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, pInfo->stateStore = pTaskInfo->storageAPI.stateStore; pInfo->recvGetAll = false; pInfo->pCheckpointRes = createSpecialDataBlock(STREAM_CHECKPOINT); + pInfo->recvRetrive = false; + pInfo->pMidRetriveRes = createSpecialDataBlock(STREAM_MID_RETRIEVE); + pInfo->pMidPulloverRes = createSpecialDataBlock(STREAM_MID_RETRIEVE); + pInfo->clearState = false; pOperator->operatorType = pPhyNode->type; if (!IS_FINAL_INTERVAL_OP(pOperator) || numOfChild == 0) { @@ -1536,10 +1577,16 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, pOperator->status = OP_NOT_OPENED; pOperator->info = pInfo; - pOperator->fpSet = createOperatorFpSet(NULL, doStreamFinalIntervalAgg, NULL, destroyStreamFinalIntervalOperatorInfo, - optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL); + if (pPhyNode->type == QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL) { + pOperator->fpSet = createOperatorFpSet(NULL, doStreamMidIntervalAgg, NULL, destroyStreamFinalIntervalOperatorInfo, + optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL); + } else { + pOperator->fpSet = createOperatorFpSet(NULL, doStreamFinalIntervalAgg, NULL, destroyStreamFinalIntervalOperatorInfo, + optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL); + } setOperatorStreamStateFn(pOperator, streamIntervalReleaseState, streamIntervalReloadState); - if (pPhyNode->type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL) { + if (pPhyNode->type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL || + pPhyNode->type == QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL) { initIntervalDownStream(downstream, pPhyNode->type, pInfo); } code = appendDownstream(pOperator, &downstream, 1); @@ -2083,6 +2130,7 @@ static void doStreamSessionAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSData } } if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE) { + winInfo.pStatePos->beUpdated = true; SSessionKey key = {0}; getSessionHashKey(&winInfo.sessionWin, &key); tSimpleHashPut(pAggSup->pResultRows, &key, sizeof(SSessionKey), &winInfo, sizeof(SResultWindowInfo)); @@ -2286,6 +2334,10 @@ int32_t getAllSessionWindow(SSHashObj* pHashMap, SSHashObj* pStUpdated) { int32_t iter = 0; while ((pIte = tSimpleHashIterate(pHashMap, pIte, &iter)) != NULL) { SResultWindowInfo* pWinInfo = pIte; + if (!pWinInfo->pStatePos->beUpdated) { + continue; + } + pWinInfo->pStatePos->beUpdated = false; saveResult(*pWinInfo, pStUpdated); } return TSDB_CODE_SUCCESS; @@ -3425,6 +3477,7 @@ static void doStreamStateAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl } if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE) { + curWin.winInfo.pStatePos->beUpdated = true; SSessionKey key = {0}; getSessionHashKey(&curWin.winInfo.sessionWin, &key); tSimpleHashPut(pAggSup->pResultRows, &key, sizeof(SSessionKey), &curWin.winInfo, sizeof(SResultWindowInfo)); @@ -4108,6 +4161,285 @@ _error: return NULL; } +static void doStreamMidIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBlock, SSHashObj* pUpdatedMap) { + SStreamIntervalOperatorInfo* pInfo = (SStreamIntervalOperatorInfo*)pOperator->info; + pInfo->dataVersion = TMAX(pInfo->dataVersion, pSDataBlock->info.version); + + SResultRowInfo* pResultRowInfo = &(pInfo->binfo.resultRowInfo); + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + SExprSupp* pSup = &pOperator->exprSupp; + int32_t numOfOutput = pSup->numOfExprs; + int32_t step = 1; + SRowBuffPos* pResPos = NULL; + SResultRow* pResult = NULL; + int32_t forwardRows = 1; + uint64_t groupId = pSDataBlock->info.id.groupId; + SColumnInfoData* pColDataInfo = taosArrayGet(pSDataBlock->pDataBlock, pInfo->primaryTsIndex); + TSKEY* tsCol = (int64_t*)pColDataInfo->pData; + + int32_t startPos = 0; + TSKEY ts = getStartTsKey(&pSDataBlock->info.window, tsCol); + STimeWindow nextWin = getFinalTimeWindow(ts, &pInfo->interval); + + while (1) { + SWinKey key = { + .ts = nextWin.skey, + .groupId = groupId, + }; + void* chIds = taosHashGet(pInfo->pPullDataMap, &key, sizeof(SWinKey)); + int32_t index = -1; + SArray* chArray = NULL; + int32_t chId = 0; + if (chIds) { + chArray = *(void**)chIds; + chId = getChildIndex(pSDataBlock); + index = taosArraySearchIdx(chArray, &chId, compareInt32Val, TD_EQ); + } + if (!(index == -1 || pSDataBlock->info.type == STREAM_PULL_DATA)) { + startPos = getNextQualifiedFinalWindow(&pInfo->interval, &nextWin, &pSDataBlock->info, tsCol, startPos); + if (startPos < 0) { + break; + } + continue; + } + + if (!inSlidingWindow(&pInfo->interval, &nextWin, &pSDataBlock->info)) { + startPos = getNexWindowPos(&pInfo->interval, &pSDataBlock->info, tsCol, startPos, nextWin.ekey, &nextWin); + if (startPos < 0) { + break; + } + continue; + } + + int32_t code = setIntervalOutputBuf(pInfo->pState, &nextWin, &pResPos, groupId, pSup->pCtx, numOfOutput, + pSup->rowEntryInfoOffset, &pInfo->aggSup, &pInfo->stateStore); + pResult = (SResultRow*)pResPos->pRowBuff; + if (code != TSDB_CODE_SUCCESS || pResult == NULL) { + T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY); + } + + if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE) { + saveWinResult(&key, pResPos, pUpdatedMap); + } + + if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE) { + tSimpleHashPut(pInfo->aggSup.pResultRowHashTable, &key, sizeof(SWinKey), &pResPos, POINTER_BYTES); + } + + updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &nextWin, 1); + applyAggFunctionOnPartialTuples(pTaskInfo, pSup->pCtx, &pInfo->twAggSup.timeWindowData, startPos, forwardRows, + pSDataBlock->info.rows, numOfOutput); + key.ts = nextWin.skey; + + if (pInfo->delKey.ts > key.ts) { + pInfo->delKey = key; + } + int32_t prevEndPos = (forwardRows - 1) * step + startPos; + if (pSDataBlock->info.window.skey <= 0 || pSDataBlock->info.window.ekey <= 0) { + qError("table uid %" PRIu64 " data block timestamp range may not be calculated! minKey %" PRId64 + ",maxKey %" PRId64, + pSDataBlock->info.id.uid, pSDataBlock->info.window.skey, pSDataBlock->info.window.ekey); + blockDataUpdateTsWindow(pSDataBlock, 0); + + // timestamp of the data is incorrect + if (pSDataBlock->info.window.skey <= 0 || pSDataBlock->info.window.ekey <= 0) { + qError("table uid %" PRIu64 " data block timestamp is out of range! minKey %" PRId64 ",maxKey %" PRId64, + pSDataBlock->info.id.uid, pSDataBlock->info.window.skey, pSDataBlock->info.window.ekey); + } + } + startPos = getNextQualifiedFinalWindow(&pInfo->interval, &nextWin, &pSDataBlock->info, tsCol, prevEndPos); + if (startPos < 0) { + break; + } + } +} + +static void addMidRetriveWindow(SArray* wins, SHashObj* pMidPullMap, int32_t numOfChild) { + int32_t size = taosArrayGetSize(wins); + for (int32_t i = 0; i < size; i++) { + SWinKey* winKey = taosArrayGet(wins, i); + void* chIds = taosHashGet(pMidPullMap, winKey, sizeof(SWinKey)); + if (!chIds) { + addPullWindow(pMidPullMap, winKey, numOfChild); + qDebug("===stream===prepare mid operator retrive for delete %" PRId64 ", size:%d", winKey->ts, numOfChild); + } + } +} + +static SSDataBlock* doStreamMidIntervalAgg(SOperatorInfo* pOperator) { + SStreamIntervalOperatorInfo* pInfo = pOperator->info; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI; + SOperatorInfo* downstream = pOperator->pDownstream[0]; + SExprSupp* pSup = &pOperator->exprSupp; + + qDebug("stask:%s %s status: %d", GET_TASKID(pTaskInfo), getStreamOpName(pOperator->operatorType), pOperator->status); + + if (pOperator->status == OP_EXEC_DONE) { + return NULL; + } else if (pOperator->status == OP_RES_TO_RETURN) { + SSDataBlock* resBlock = buildIntervalResult(pOperator); + if (resBlock != NULL) { + return resBlock; + } + + setOperatorCompleted(pOperator); + clearFunctionContext(&pOperator->exprSupp); + clearStreamIntervalOperator(pInfo); + qDebug("stask:%s ===stream===%s clear", GET_TASKID(pTaskInfo), getStreamOpName(pOperator->operatorType)); + return NULL; + } else { + SSDataBlock* resBlock = buildIntervalResult(pOperator); + if (resBlock != NULL) { + return resBlock; + } + + if (pInfo->recvRetrive) { + pInfo->recvRetrive = false; + printDataBlock(pInfo->pMidRetriveRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); + return pInfo->pMidRetriveRes; + } + + if (pInfo->clearState) { + pInfo->clearState = false; + clearFunctionContext(&pOperator->exprSupp); + clearStreamIntervalOperator(pInfo); + } + } + + if (!pInfo->pUpdated) { + pInfo->pUpdated = taosArrayInit(4096, POINTER_BYTES); + } + if (!pInfo->pUpdatedMap) { + _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); + pInfo->pUpdatedMap = tSimpleHashInit(4096, hashFn); + } + + while (1) { + if (isTaskKilled(pTaskInfo)) { + if (pInfo->pUpdated != NULL) { + pInfo->pUpdated = taosArrayDestroy(pInfo->pUpdated); + } + + if (pInfo->pUpdatedMap != NULL) { + tSimpleHashCleanup(pInfo->pUpdatedMap); + pInfo->pUpdatedMap = NULL; + } + + T_LONG_JMP(pTaskInfo->env, pTaskInfo->code); + } + + SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream); + if (pBlock == NULL) { + pOperator->status = OP_RES_TO_RETURN; + qDebug("===stream===return data:%s. recv datablock num:%" PRIu64, getStreamOpName(pOperator->operatorType), + pInfo->numOfDatapack); + pInfo->numOfDatapack = 0; + break; + } + pInfo->numOfDatapack++; + printSpecDataBlock(pBlock, getStreamOpName(pOperator->operatorType), "recv", GET_TASKID(pTaskInfo)); + + if (pBlock->info.type == STREAM_NORMAL || pBlock->info.type == STREAM_PULL_DATA) { + pInfo->binfo.pRes->info.type = pBlock->info.type; + } else if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT || + pBlock->info.type == STREAM_CLEAR) { + SArray* delWins = taosArrayInit(8, sizeof(SWinKey)); + doDeleteWindows(pOperator, &pInfo->interval, pBlock, delWins, pInfo->pUpdatedMap); + removeResults(delWins, pInfo->pUpdatedMap); + taosArrayAddAll(pInfo->pDelWins, delWins); + taosArrayDestroy(delWins); + + doBuildDeleteResult(pInfo, pInfo->pDelWins, &pInfo->delIndex, pInfo->pDelRes); + if (pInfo->pDelRes->info.rows != 0) { + // process the rest of the data + printDataBlock(pInfo->pDelRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); + if (pBlock->info.type == STREAM_CLEAR) { + pInfo->pDelRes->info.type = STREAM_CLEAR; + } else { + pInfo->pDelRes->info.type = STREAM_DELETE_RESULT; + } + ASSERT(taosArrayGetSize(pInfo->pUpdated) == 0); + return pInfo->pDelRes; + } + continue; + } else if (pBlock->info.type == STREAM_CREATE_CHILD_TABLE) { + return pBlock; + } else if (pBlock->info.type == STREAM_PULL_OVER) { + pInfo->recvPullover = processPullOver(pBlock, pInfo->pPullDataMap, pInfo->pFinalPullDataMap, &pInfo->interval, + pInfo->pPullWins, pInfo->numOfChild, pOperator); + if (pInfo->recvPullover) { + copyDataBlock(pInfo->pMidPulloverRes, pBlock); + pInfo->clearState = true; + break; + } + continue; + } else if (pBlock->info.type == STREAM_CHECKPOINT) { + pAPI->stateStore.streamStateCommit(pInfo->pState); + doStreamIntervalSaveCheckpoint(pOperator); + copyDataBlock(pInfo->pCheckpointRes, pBlock); + continue; + } else if (pBlock->info.type == STREAM_MID_RETRIEVE) { + SArray* delWins = taosArrayInit(8, sizeof(SWinKey)); + doDeleteWindows(pOperator, &pInfo->interval, pBlock, delWins, pInfo->pUpdatedMap); + addMidRetriveWindow(delWins, pInfo->pPullDataMap, pInfo->numOfChild); + taosArrayDestroy(delWins); + pInfo->recvRetrive = true; + copyDataBlock(pInfo->pMidRetriveRes, pBlock); + pInfo->pMidRetriveRes->info.type = STREAM_MID_RETRIEVE; + pInfo->clearState = true; + break; + } else { + ASSERTS(pBlock->info.type == STREAM_INVALID, "invalid SSDataBlock type"); + } + + if (pInfo->scalarSupp.pExprInfo != NULL) { + SExprSupp* pExprSup = &pInfo->scalarSupp; + projectApplyFunctions(pExprSup->pExprInfo, pBlock, pBlock, pExprSup->pCtx, pExprSup->numOfExprs, NULL); + } + setInputDataBlock(pSup, pBlock, TSDB_ORDER_ASC, MAIN_SCAN, true); + doStreamMidIntervalAggImpl(pOperator, pBlock, pInfo->pUpdatedMap); + pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, pBlock->info.window.ekey); + pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, pBlock->info.watermark); + pInfo->twAggSup.minTs = TMIN(pInfo->twAggSup.minTs, pBlock->info.window.skey); + } + + removeDeleteResults(pInfo->pUpdatedMap, pInfo->pDelWins); + pInfo->binfo.pRes->info.watermark = pInfo->twAggSup.maxTs; + + void* pIte = NULL; + int32_t iter = 0; + while ((pIte = tSimpleHashIterate(pInfo->pUpdatedMap, pIte, &iter)) != NULL) { + taosArrayPush(pInfo->pUpdated, pIte); + } + + tSimpleHashCleanup(pInfo->pUpdatedMap); + pInfo->pUpdatedMap = NULL; + taosArraySort(pInfo->pUpdated, winPosCmprImpl); + + initMultiResInfoFromArrayList(&pInfo->groupResInfo, pInfo->pUpdated); + pInfo->pUpdated = NULL; + blockDataEnsureCapacity(pInfo->binfo.pRes, pOperator->resultInfo.capacity); + + SSDataBlock* resBlock = buildIntervalResult(pOperator); + if (resBlock != NULL) { + return resBlock; + } + + if (pInfo->recvRetrive) { + pInfo->recvRetrive = false; + printDataBlock(pInfo->pMidRetriveRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo)); + return pInfo->pMidRetriveRes; + } + + if (pInfo->clearState) { + pInfo->clearState = false; + clearFunctionContext(&pOperator->exprSupp); + clearStreamIntervalOperator(pInfo); + } + return NULL; +} + void setStreamOperatorCompleted(SOperatorInfo* pOperator) { setOperatorCompleted(pOperator); qDebug("stask:%s %s status: %d. set completed", GET_TASKID(pOperator->pTaskInfo), getStreamOpName(pOperator->operatorType), pOperator->status); diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c index db9266cb8f..3559e57ebc 100644 --- a/source/libs/executor/src/tsort.c +++ b/source/libs/executor/src/tsort.c @@ -1334,7 +1334,6 @@ static bool tsortOpenForBufMergeSort(SSortHandle* pHandle) { int32_t tsortClose(SSortHandle* pHandle) { atomic_val_compare_exchange_8(&pHandle->closed, 0, 1); - taosMsleep(10); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/function/inc/builtins.h b/source/libs/function/inc/builtins.h index 6181a9b929..4c1e46dbba 100644 --- a/source/libs/function/inc/builtins.h +++ b/source/libs/function/inc/builtins.h @@ -45,6 +45,7 @@ typedef struct SBuiltinFuncDefinition { #endif FExecCombine combineFunc; const char* pPartialFunc; + const char* pMiddleFunc; const char* pMergeFunc; FCreateMergeFuncParameters createMergeParaFuc; FEstimateReturnRows estimateReturnRowsFunc; diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 5d5a06df0d..8143544bb2 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -431,6 +431,20 @@ static int32_t translateAvgPartial(SFunctionNode* pFunc, char* pErrBuf, int32_t return TSDB_CODE_SUCCESS; } +static int32_t translateAvgMiddle(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + if (1 != LIST_LENGTH(pFunc->pParameterList)) { + return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); + } + + uint8_t paraType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type; + if (TSDB_DATA_TYPE_BINARY != paraType) { + return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); + } + + pFunc->node.resType = (SDataType){.bytes = getAvgInfoSize() + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}; + return TSDB_CODE_SUCCESS; +} + static int32_t translateAvgMerge(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { if (1 != LIST_LENGTH(pFunc->pParameterList)) { return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); @@ -705,18 +719,20 @@ static int32_t translateTbnameColumn(SFunctionNode* pFunc, char* pErrBuf, int32_ static int32_t translateTbUidColumn(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { // pseudo column do not need to check parameters - pFunc->node.resType = - (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; + pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; return TSDB_CODE_SUCCESS; } static int32_t translateVgIdColumn(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { // pseudo column do not need to check parameters - pFunc->node.resType = - (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_INT].bytes, .type = TSDB_DATA_TYPE_INT}; + pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_INT].bytes, .type = TSDB_DATA_TYPE_INT}; return TSDB_CODE_SUCCESS; } +static int32_t translateVgVerColumn(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; + return TSDB_CODE_SUCCESS; +} static int32_t translateTopBot(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); @@ -2511,6 +2527,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { #endif .combineFunc = avgCombine, .pPartialFunc = "_avg_partial", + .pMiddleFunc = "_avg_middle", .pMergeFunc = "_avg_merge" }, { @@ -3451,7 +3468,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .translateFunc = translateTbnameColumn, .getEnvFunc = NULL, .initFunc = NULL, - .sprocessFunc = qTbnameFunction, + .sprocessFunc = qPseudoTagFunction, .finalizeFunc = NULL }, { @@ -3738,11 +3755,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .translateFunc = translateTbUidColumn, .getEnvFunc = NULL, .initFunc = NULL, -#ifdef BUILD_NO_CALL - .sprocessFunc = qTbUidFunction, -#else - .sprocessFunc = NULL, -#endif + .sprocessFunc = qPseudoTagFunction, .finalizeFunc = NULL }, { @@ -3752,11 +3765,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .translateFunc = translateVgIdColumn, .getEnvFunc = NULL, .initFunc = NULL, -#ifdef BUILD_NO_CALL - .sprocessFunc = qVgIdFunction, -#else - .sprocessFunc = NULL, -#endif + .sprocessFunc = qPseudoTagFunction, .finalizeFunc = NULL }, { @@ -3779,7 +3788,31 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .sprocessFunc = toCharFunction, .finalizeFunc = NULL }, - + { + .name = "_avg_middle", + .type = FUNCTION_TYPE_AVG_PARTIAL, + .classification = FUNC_MGT_AGG_FUNC, + .translateFunc = translateAvgMiddle, + .dataRequiredFunc = statisDataRequired, + .getEnvFunc = getAvgFuncEnv, + .initFunc = avgFunctionSetup, + .processFunc = avgFunctionMerge, + .finalizeFunc = avgPartialFinalize, +#ifdef BUILD_NO_CALL + .invertFunc = avgInvertFunction, +#endif + .combineFunc = avgCombine, + }, + { + .name = "_vgver", + .type = FUNCTION_TYPE_VGVER, + .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_SCAN_PC_FUNC | FUNC_MGT_KEEP_ORDER_FUNC, + .translateFunc = translateVgVerColumn, + .getEnvFunc = NULL, + .initFunc = NULL, + .sprocessFunc = qPseudoTagFunction, + .finalizeFunc = NULL + } }; // clang-format on diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 000f634fe5..5ab6d5e075 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -499,6 +499,9 @@ static int64_t getNumOfElems(SqlFunctionCtx* pCtx) { */ SInputColumnInfoData* pInput = &pCtx->input; SColumnInfoData* pInputCol = pInput->pData[0]; + if(1 == pInput->numOfRows && pInput->blankFill) { + return 0; + } if (pInput->colDataSMAIsSet && pInput->totalRows == pInput->numOfRows) { numOfElem = pInput->numOfRows - pInput->pColumnDataAgg[0]->numOfNull; } else { @@ -6022,7 +6025,7 @@ int32_t groupKeyFunction(SqlFunctionCtx* pCtx) { goto _group_key_over; } - if (colDataIsNull_s(pInputCol, startIndex)) { + if (pInputCol->pData == NULL || colDataIsNull_s(pInputCol, startIndex)) { pInfo->isNull = true; pInfo->hasResult = true; goto _group_key_over; diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c index 7bb863839a..068d1532c0 100644 --- a/source/libs/function/src/functionMgt.c +++ b/source/libs/function/src/functionMgt.c @@ -424,6 +424,35 @@ static int32_t createMergeFuncPara(const SFunctionNode* pSrcFunc, const SFunctio } } +static int32_t createMidFunction(const SFunctionNode* pSrcFunc, const SFunctionNode* pPartialFunc, + SFunctionNode** pMidFunc) { + SNodeList* pParameterList = NULL; + SFunctionNode* pFunc = NULL; + + int32_t code = createMergeFuncPara(pSrcFunc, pPartialFunc, &pParameterList); + if (TSDB_CODE_SUCCESS == code) { + if(funcMgtBuiltins[pSrcFunc->funcId].pMiddleFunc != NULL){ + pFunc = createFunction(funcMgtBuiltins[pSrcFunc->funcId].pMiddleFunc, pParameterList); + }else{ + pFunc = createFunction(funcMgtBuiltins[pSrcFunc->funcId].pMergeFunc, pParameterList); + } + if (NULL == pFunc) { + code = TSDB_CODE_OUT_OF_MEMORY; + } + } + if (TSDB_CODE_SUCCESS == code) { + strcpy(pFunc->node.aliasName, pPartialFunc->node.aliasName); + } + + if (TSDB_CODE_SUCCESS == code) { + *pMidFunc = pFunc; + } else { + nodesDestroyList(pParameterList); + } + + return code; +} + static int32_t createMergeFunction(const SFunctionNode* pSrcFunc, const SFunctionNode* pPartialFunc, SFunctionNode** pMergeFunc) { SNodeList* pParameterList = NULL; @@ -453,18 +482,22 @@ static int32_t createMergeFunction(const SFunctionNode* pSrcFunc, const SFunctio return code; } -int32_t fmGetDistMethod(const SFunctionNode* pFunc, SFunctionNode** pPartialFunc, SFunctionNode** pMergeFunc) { +int32_t fmGetDistMethod(const SFunctionNode* pFunc, SFunctionNode** pPartialFunc, SFunctionNode** pMidFunc, SFunctionNode** pMergeFunc) { if (!fmIsDistExecFunc(pFunc->funcId)) { return TSDB_CODE_FAILED; } int32_t code = createPartialFunction(pFunc, pPartialFunc); + if (TSDB_CODE_SUCCESS == code) { + code = createMidFunction(pFunc, *pPartialFunc, pMidFunc); + } if (TSDB_CODE_SUCCESS == code) { code = createMergeFunction(pFunc, *pPartialFunc, pMergeFunc); } if (TSDB_CODE_SUCCESS != code) { nodesDestroyNode((SNode*)*pPartialFunc); + nodesDestroyNode((SNode*)*pMidFunc); nodesDestroyNode((SNode*)*pMergeFunc); } diff --git a/source/libs/index/src/indexFstRegex.c b/source/libs/index/src/indexFstRegex.c index 8b513bfb2b..7af4b17e79 100644 --- a/source/libs/index/src/indexFstRegex.c +++ b/source/libs/index/src/indexFstRegex.c @@ -42,6 +42,7 @@ void regexDestroy(FstRegex *regex) { taosMemoryFree(regex); } +#ifdef BUILD_NO_CALL uint32_t regexAutomStart(FstRegex *regex) { ///// no nothing return 0; @@ -65,3 +66,4 @@ bool regexAutomAccept(FstRegex *regex, uint32_t state, uint8_t byte, uint32_t *r } return dfaAccept(regex->dfa, state, byte, result); } +#endif \ No newline at end of file diff --git a/source/libs/index/src/indexTfile.c b/source/libs/index/src/indexTfile.c index 8f8b5c7768..84d17681b4 100644 --- a/source/libs/index/src/indexTfile.c +++ b/source/libs/index/src/indexTfile.c @@ -684,12 +684,14 @@ int idxTFileSearch(void* tfile, SIndexTermQuery* query, SIdxTRslt* result) { return tfileReaderSearch(reader, query, result); } +#ifdef BUILD_NO_CALL int idxTFilePut(void* tfile, SIndexTerm* term, uint64_t uid) { // TFileWriterOpt wOpt = {.suid = term->suid, .colType = term->colType, .colName = term->colName, .nColName = // term->nColName, .version = 1}; return 0; } +#endif static bool tfileIteratorNext(Iterate* iiter) { IterateValue* iv = &iiter->val; iterateValueDestroy(iv, false); diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index 6a772c2718..3addacae77 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -976,6 +976,7 @@ SNode* nodesCloneNode(const SNode* pNode) { case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL: case QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL: case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL: code = physiIntervalCopy((const SIntervalPhysiNode*)pNode, (SIntervalPhysiNode*)pDst); break; case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION: diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index 7472bb62f3..c727e613f3 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -195,6 +195,8 @@ const char* nodesNodeName(ENodeType type) { return "GrantStmt"; case QUERY_NODE_REVOKE_STMT: return "RevokeStmt"; + case QUERY_NODE_ALTER_CLUSTER_STMT: + return "AlterClusterStmt"; case QUERY_NODE_SHOW_DNODES_STMT: return "ShowDnodesStmt"; case QUERY_NODE_SHOW_MNODES_STMT: @@ -264,7 +266,13 @@ const char* nodesNodeName(ENodeType type) { case QUERY_NODE_SHOW_COMPACTS_STMT: return "ShowCompactsStmt"; case QUERY_NODE_SHOW_COMPACT_DETAILS_STMT: - return "ShowCompactDetailsStmt"; + return "ShowCompactDetailsStmt"; + case QUERY_NODE_SHOW_GRANTS_FULL_STMT: + return "ShowGrantsFullStmt"; + case QUERY_NODE_SHOW_GRANTS_LOGS_STMT: + return "ShowGrantsLogsStmt"; + case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT: + return "ShowClusterMachinesStmt"; case QUERY_NODE_DELETE_STMT: return "DeleteStmt"; case QUERY_NODE_INSERT_STMT: @@ -363,6 +371,8 @@ const char* nodesNodeName(ENodeType type) { return "PhysiStreamFinalInterval"; case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL: return "PhysiStreamSemiInterval"; + case QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL: + return "PhysiStreamMidInterval"; case QUERY_NODE_PHYSICAL_PLAN_FILL: case QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL: return "PhysiFill"; @@ -3380,6 +3390,8 @@ static const char* jkSubplanTagIndexCond = "TagIndexCond"; static const char* jkSubplanShowRewrite = "ShowRewrite"; static const char* jkSubplanRowsThreshold = "RowThreshold"; static const char* jkSubplanDynamicRowsThreshold = "DyRowThreshold"; +static const char* jkSubplanIsView = "IsView"; +static const char* jkSubplanIsAudit = "IsAudit"; static int32_t subplanToJson(const void* pObj, SJson* pJson) { const SSubplan* pNode = (const SSubplan*)pObj; @@ -3418,6 +3430,12 @@ static int32_t subplanToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddBoolToObject(pJson, jkSubplanShowRewrite, pNode->showRewrite); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddBoolToObject(pJson, jkSubplanIsView, pNode->isView); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddBoolToObject(pJson, jkSubplanIsAudit, pNode->isAudit); + } if (TSDB_CODE_SUCCESS == code) { code = tjsonAddIntegerToObject(pJson, jkSubplanRowsThreshold, pNode->rowsThreshold); } @@ -3465,6 +3483,12 @@ static int32_t jsonToSubplan(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetBoolValue(pJson, jkSubplanShowRewrite, &pNode->showRewrite); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetBoolValue(pJson, jkSubplanIsView, &pNode->isView); + } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetBoolValue(pJson, jkSubplanIsAudit, &pNode->isAudit); + } if (TSDB_CODE_SUCCESS == code) { code = tjsonGetIntValue(pJson, jkSubplanRowsThreshold, &pNode->rowsThreshold); } @@ -6286,6 +6310,31 @@ static int32_t jsonToDropConsumerGroupStmt(const SJson* pJson, void* pObj) { return code; } +static const char* jkAlterClusterStmtConfig = "Config"; +static const char* jkAlterClusterStmtValue = "Value"; + +static int32_t alterClusterStmtToJson(const void* pObj, SJson* pJson) { + const SAlterClusterStmt* pNode = (const SAlterClusterStmt*)pObj; + + int32_t code = tjsonAddStringToObject(pJson, jkAlterClusterStmtConfig, pNode->config); + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddStringToObject(pJson, jkAlterClusterStmtValue, pNode->value); + } + + return code; +} + +static int32_t jsonToAlterClusterStmt(const SJson* pJson, void* pObj) { + SAlterClusterStmt* pNode = (SAlterClusterStmt*)pObj; + + int32_t code = tjsonGetStringValue(pJson, jkAlterClusterStmtConfig, pNode->config); + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetStringValue(pJson, jkAlterClusterStmtValue, pNode->value); + } + + return code; +} + static const char* jkAlterLocalStmtConfig = "Config"; static const char* jkAlterLocalStmtValue = "Value"; @@ -6683,6 +6732,18 @@ static int32_t showVariablesStmtToJson(const void* pObj, SJson* pJson) { return static int32_t jsonToShowVariablesStmt(const SJson* pJson, void* pObj) { return jsonToShowStmt(pJson, pObj); } +static int32_t showGrantsFullStmtToJson(const void* pObj, SJson* pJson) { return showStmtToJson(pObj, pJson); } + +static int32_t jsonToShowGrantsFullStmt(const SJson* pJson, void* pObj) { return jsonToShowStmt(pJson, pObj); } + +static int32_t showGrantsLogsStmtToJson(const void* pObj, SJson* pJson) { return showStmtToJson(pObj, pJson); } + +static int32_t showClusterMachinesStmtToJson(const void* pObj, SJson* pJson) { return showStmtToJson(pObj, pJson); } + +static int32_t jsonToShowGrantsLogsStmt(const SJson* pJson, void* pObj) { return jsonToShowStmt(pJson, pObj); } + +static int32_t jsonToShowClusterMachinesStmt(const SJson* pJson, void* pObj) { return jsonToShowStmt(pJson, pObj); } + static const char* jkShowDnodeVariablesStmtDnodeId = "DnodeId"; static const char* jkShowDnodeVariablesStmtLikePattern = "LikePattern"; @@ -7140,6 +7201,8 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) { return grantStmtToJson(pObj, pJson); case QUERY_NODE_REVOKE_STMT: return revokeStmtToJson(pObj, pJson); + case QUERY_NODE_ALTER_CLUSTER_STMT: + return alterClusterStmtToJson(pObj, pJson); case QUERY_NODE_SHOW_DNODES_STMT: return showDnodesStmtToJson(pObj, pJson); case QUERY_NODE_SHOW_MNODES_STMT: @@ -7170,6 +7233,12 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) { return showConsumersStmtToJson(pObj, pJson); case QUERY_NODE_SHOW_VARIABLES_STMT: return showVariablesStmtToJson(pObj, pJson); + case QUERY_NODE_SHOW_GRANTS_FULL_STMT: + return showGrantsFullStmtToJson(pObj, pJson); + case QUERY_NODE_SHOW_GRANTS_LOGS_STMT: + return showGrantsLogsStmtToJson(pObj, pJson); + case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT: + return showClusterMachinesStmtToJson(pObj, pJson); case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT: return showDnodeVariablesStmtToJson(pObj, pJson); case QUERY_NODE_SHOW_TRANSACTIONS_STMT: @@ -7265,6 +7334,7 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) { case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL: case QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL: case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL: return physiIntervalNodeToJson(pObj, pJson); case QUERY_NODE_PHYSICAL_PLAN_FILL: case QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL: @@ -7465,6 +7535,8 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) { return jsonToGrantStmt(pJson, pObj); case QUERY_NODE_REVOKE_STMT: return jsonToRevokeStmt(pJson, pObj); + case QUERY_NODE_ALTER_CLUSTER_STMT: + return jsonToAlterClusterStmt(pJson, pObj); case QUERY_NODE_SHOW_DNODES_STMT: return jsonToShowDnodesStmt(pJson, pObj); case QUERY_NODE_SHOW_MNODES_STMT: @@ -7495,6 +7567,12 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) { return jsonToShowConsumersStmt(pJson, pObj); case QUERY_NODE_SHOW_VARIABLES_STMT: return jsonToShowVariablesStmt(pJson, pObj); + case QUERY_NODE_SHOW_GRANTS_FULL_STMT: + return jsonToShowGrantsFullStmt(pJson, pObj); + case QUERY_NODE_SHOW_GRANTS_LOGS_STMT: + return jsonToShowGrantsLogsStmt(pJson, pObj); + case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT: + return jsonToShowClusterMachinesStmt(pJson, pObj); case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT: return jsonToShowDnodeVariablesStmt(pJson, pObj); case QUERY_NODE_SHOW_TRANSACTIONS_STMT: @@ -7598,6 +7676,7 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) { case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL: case QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL: case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL: return jsonToPhysiIntervalNode(pJson, pObj); case QUERY_NODE_PHYSICAL_PLAN_FILL: case QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL: diff --git a/source/libs/nodes/src/nodesMsgFuncs.c b/source/libs/nodes/src/nodesMsgFuncs.c index a4e8e74b34..8435ff3254 100644 --- a/source/libs/nodes/src/nodesMsgFuncs.c +++ b/source/libs/nodes/src/nodesMsgFuncs.c @@ -4056,6 +4056,12 @@ static int32_t subplanInlineToMsg(const void* pObj, STlvEncoder* pEncoder) { if (TSDB_CODE_SUCCESS == code) { code = tlvEncodeValueBool(pEncoder, pNode->dynamicRowThreshold); } + if (TSDB_CODE_SUCCESS == code) { + code = tlvEncodeValueBool(pEncoder, pNode->isView); + } + if (TSDB_CODE_SUCCESS == code) { + code = tlvEncodeValueBool(pEncoder, pNode->isAudit); + } return code; } @@ -4111,7 +4117,12 @@ static int32_t msgToSubplanInline(STlvDecoder* pDecoder, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tlvDecodeValueBool(pDecoder, &pNode->dynamicRowThreshold); } - + if (TSDB_CODE_SUCCESS == code) { + code = tlvDecodeValueBool(pDecoder, &pNode->isView); + } + if (TSDB_CODE_SUCCESS == code) { + code = tlvDecodeValueBool(pDecoder, &pNode->isAudit); + } return code; } @@ -4297,6 +4308,7 @@ static int32_t specificNodeToMsg(const void* pObj, STlvEncoder* pEncoder) { case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL: case QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL: case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL: code = physiIntervalNodeToMsg(pObj, pEncoder); break; case QUERY_NODE_PHYSICAL_PLAN_FILL: @@ -4454,6 +4466,7 @@ static int32_t msgToSpecificNode(STlvDecoder* pDecoder, void* pObj) { case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL: case QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL: case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL: code = msgToPhysiIntervalNode(pDecoder, pObj); break; case QUERY_NODE_PHYSICAL_PLAN_FILL: diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 007ebbeb5b..ff4010fbe3 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -31,7 +31,7 @@ typedef struct SNodeMemChunk { struct SNodeMemChunk* pNext; } SNodeMemChunk; -typedef struct SNodeAllocator { +struct SNodeAllocator { int64_t self; int64_t queryId; int32_t chunkSize; @@ -39,7 +39,7 @@ typedef struct SNodeAllocator { SNodeMemChunk* pCurrChunk; SNodeMemChunk* pChunks; TdThreadMutex mutex; -} SNodeAllocator; +}; static threadlocal SNodeAllocator* g_pNodeAllocator; static int32_t g_allocatorReqRefPool = -1; @@ -480,6 +480,8 @@ SNode* nodesMakeNode(ENodeType type) { return makeNode(type, sizeof(SGrantStmt)); case QUERY_NODE_REVOKE_STMT: return makeNode(type, sizeof(SRevokeStmt)); + case QUERY_NODE_ALTER_CLUSTER_STMT: + return makeNode(type, sizeof(SAlterClusterStmt)); case QUERY_NODE_SHOW_DNODES_STMT: case QUERY_NODE_SHOW_MNODES_STMT: case QUERY_NODE_SHOW_MODULES_STMT: @@ -510,6 +512,9 @@ SNode* nodesMakeNode(ENodeType type) { case QUERY_NODE_SHOW_TAGS_STMT: case QUERY_NODE_SHOW_USER_PRIVILEGES_STMT: case QUERY_NODE_SHOW_VIEWS_STMT: + case QUERY_NODE_SHOW_GRANTS_FULL_STMT: + case QUERY_NODE_SHOW_GRANTS_LOGS_STMT: + case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT: return makeNode(type, sizeof(SShowStmt)); case QUERY_NODE_SHOW_TABLE_TAGS_STMT: return makeNode(type, sizeof(SShowTableTagsStmt)); @@ -630,6 +635,8 @@ SNode* nodesMakeNode(ENodeType type) { return makeNode(type, sizeof(SStreamFinalIntervalPhysiNode)); case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL: return makeNode(type, sizeof(SStreamSemiIntervalPhysiNode)); + case QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL: + return makeNode(type, sizeof(SStreamMidIntervalPhysiNode)); case QUERY_NODE_PHYSICAL_PLAN_FILL: case QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL: return makeNode(type, sizeof(SFillPhysiNode)); @@ -1126,6 +1133,8 @@ void nodesDestroyNode(SNode* pNode) { case QUERY_NODE_REVOKE_STMT: nodesDestroyNode(((SRevokeStmt*)pNode)->pTagCond); break; + case QUERY_NODE_ALTER_CLUSTER_STMT: // no pointer field + break; case QUERY_NODE_SHOW_DNODES_STMT: case QUERY_NODE_SHOW_MNODES_STMT: case QUERY_NODE_SHOW_MODULES_STMT: @@ -1155,7 +1164,10 @@ void nodesDestroyNode(SNode* pNode) { case QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT: case QUERY_NODE_SHOW_TAGS_STMT: case QUERY_NODE_SHOW_USER_PRIVILEGES_STMT: - case QUERY_NODE_SHOW_VIEWS_STMT: { + case QUERY_NODE_SHOW_VIEWS_STMT: + case QUERY_NODE_SHOW_GRANTS_FULL_STMT: + case QUERY_NODE_SHOW_GRANTS_LOGS_STMT: + case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT: { SShowStmt* pStmt = (SShowStmt*)pNode; nodesDestroyNode(pStmt->pDbName); nodesDestroyNode(pStmt->pTbName); @@ -1472,6 +1484,7 @@ void nodesDestroyNode(SNode* pNode) { case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL: case QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL: case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL: destroyWinodwPhysiNode((SWindowPhysiNode*)pNode); break; case QUERY_NODE_PHYSICAL_PLAN_FILL: diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 430fcf0fdb..b0b4b3eefc 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -229,6 +229,7 @@ SNode* createCreateTopicStmtUseTable(SAstCreateContext* pCxt, bool ignoreExists, int8_t withMeta, SNode* pWhere); SNode* createDropTopicStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pTopicName); SNode* createDropCGroupStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pCGroupId, SToken* pTopicName); +SNode* createAlterClusterStmt(SAstCreateContext* pCxt, const SToken* pConfig, const SToken* pValue); SNode* createAlterLocalStmt(SAstCreateContext* pCxt, const SToken* pConfig, const SToken* pValue); SNode* createDefaultExplainOptions(SAstCreateContext* pCxt); SNode* setExplainVerbose(SAstCreateContext* pCxt, SNode* pOptions, const SToken* pVal); diff --git a/source/libs/parser/inc/parInt.h b/source/libs/parser/inc/parInt.h index cfad073f48..d88554442b 100644 --- a/source/libs/parser/inc/parInt.h +++ b/source/libs/parser/inc/parInt.h @@ -35,8 +35,8 @@ int32_t authenticate(SParseContext* pParseCxt, SQuery* pQuery, SParseMetaCache* int32_t translate(SParseContext* pParseCxt, SQuery* pQuery, SParseMetaCache* pMetaCache); int32_t extractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pSchema); 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); +int32_t translatePostCreateStream(SParseContext* pParseCxt, SQuery* pQuery, SSDataBlock* pBlock); +int32_t translatePostCreateSmaIndex(SParseContext* pParseCxt, SQuery* pQuery, SSDataBlock* pBlock); int32_t buildQueryAfterParse(SQuery** pQuery, SNode* pRootNode, int16_t placeholderNo, SArray** pPlaceholderValues); int32_t translateTable(STranslateContext* pCxt, SNode** pTable, SNode* pJoinParent); int32_t getMetaDataFromHash(const char* pKey, int32_t len, SHashObj* pHash, void** pOutput); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 45303b270b..c7d3fa593e 100755 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -172,6 +172,10 @@ force_opt(A) ::= FORCE. %destructor unsafe_opt { } unsafe_opt(A) ::= UNSAFE. { A = true; } +/************************************************ alter cluster *********************************************************/ +cmd ::= ALTER CLUSTER NK_STRING(A). { pCxt->pRootNode = createAlterClusterStmt(pCxt, &A, NULL); } +cmd ::= ALTER CLUSTER NK_STRING(A) NK_STRING(B). { pCxt->pRootNode = createAlterClusterStmt(pCxt, &A, &B); } + /************************************************ alter local *********************************************************/ cmd ::= ALTER LOCAL NK_STRING(A). { pCxt->pRootNode = createAlterLocalStmt(pCxt, &A, NULL); } cmd ::= ALTER LOCAL NK_STRING(A) NK_STRING(B). { pCxt->pRootNode = createAlterLocalStmt(pCxt, &A, &B); } @@ -483,6 +487,9 @@ cmd ::= SHOW APPS. cmd ::= SHOW CONNECTIONS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } cmd ::= SHOW LICENCES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } cmd ::= SHOW GRANTS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } +cmd ::= SHOW GRANTS FULL. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_FULL_STMT); } +cmd ::= SHOW GRANTS LOGS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_LOGS_STMT); } +cmd ::= SHOW CLUSTER MACHINES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); } cmd ::= SHOW CREATE DATABASE db_name(A). { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &A); } cmd ::= SHOW CREATE TABLE full_table_name(A). { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, A); } cmd ::= SHOW CREATE STABLE full_table_name(A). { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, A); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index a96b61e526..7da36a7972 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -2266,6 +2266,17 @@ SNode* createDropCGroupStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToke return (SNode*)pStmt; } +SNode* createAlterClusterStmt(SAstCreateContext* pCxt, const SToken* pConfig, const SToken* pValue) { + CHECK_PARSER_STATUS(pCxt); + SAlterClusterStmt* pStmt = (SAlterClusterStmt*)nodesMakeNode(QUERY_NODE_ALTER_CLUSTER_STMT); + CHECK_OUT_OF_MEM(pStmt); + trimString(pConfig->z, pConfig->n, pStmt->config, sizeof(pStmt->config)); + if (NULL != pValue) { + trimString(pValue->z, pValue->n, pStmt->value, sizeof(pStmt->value)); + } + return (SNode*)pStmt; +} + SNode* createAlterLocalStmt(SAstCreateContext* pCxt, const SToken* pConfig, const SToken* pValue) { CHECK_PARSER_STATUS(pCxt); SAlterLocalStmt* pStmt = (SAlterLocalStmt*)nodesMakeNode(QUERY_NODE_ALTER_LOCAL_STMT); diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index be272228fe..9b34672418 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -619,6 +619,21 @@ static int32_t collectMetaKeyFromShowCompactDetails(SCollectMetaKeyCxt* pCxt, SS return code; } +static int32_t collectMetaKeyFromShowGrantsFull(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) { + return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_GRANTS_FULL, + pCxt->pMetaCache); +} + +static int32_t collectMetaKeyFromShowGrantsLogs(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) { + return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_GRANTS_LOGS, + pCxt->pMetaCache); +} + +static int32_t collectMetaKeyFromShowClusterMachines(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) { + return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_MACHINES, + pCxt->pMetaCache); +} + static int32_t collectMetaKeyFromShowCreateDatabase(SCollectMetaKeyCxt* pCxt, SShowCreateDatabaseStmt* pStmt) { return reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache); } @@ -839,6 +854,12 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) { return collectMetaKeyFromShowCompacts(pCxt, (SShowStmt*)pStmt); case QUERY_NODE_SHOW_COMPACT_DETAILS_STMT: return collectMetaKeyFromShowCompactDetails(pCxt, (SShowStmt*)pStmt); + case QUERY_NODE_SHOW_GRANTS_FULL_STMT: + return collectMetaKeyFromShowGrantsFull(pCxt, (SShowStmt*)pStmt); + case QUERY_NODE_SHOW_GRANTS_LOGS_STMT: + return collectMetaKeyFromShowGrantsLogs(pCxt, (SShowStmt*)pStmt); + case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT: + return collectMetaKeyFromShowClusterMachines(pCxt, (SShowStmt*)pStmt); case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: return collectMetaKeyFromShowCreateDatabase(pCxt, (SShowCreateDatabaseStmt*)pStmt); case QUERY_NODE_SHOW_CREATE_TABLE_STMT: diff --git a/source/libs/parser/src/parAuthenticator.c b/source/libs/parser/src/parAuthenticator.c index 033991f351..c2cd4786db 100644 --- a/source/libs/parser/src/parAuthenticator.c +++ b/source/libs/parser/src/parAuthenticator.c @@ -349,6 +349,9 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) { case QUERY_NODE_SHOW_TABLE_DISTRIBUTED_STMT: case QUERY_NODE_SHOW_VNODES_STMT: case QUERY_NODE_SHOW_SCORES_STMT: + case QUERY_NODE_SHOW_GRANTS_FULL_STMT: + case QUERY_NODE_SHOW_GRANTS_LOGS_STMT: + case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT: return !pCxt->pParseCxt->enableSysInfo ? TSDB_CODE_PAR_PERMISSION_DENIED : TSDB_CODE_SUCCESS; case QUERY_NODE_SHOW_TABLES_STMT: case QUERY_NODE_SHOW_STABLES_STMT: diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 1994ddb437..7d10d1f2df 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -440,14 +440,14 @@ static int32_t parseVarbinary(SToken* pToken, uint8_t **pData, uint32_t *nData, return TSDB_CODE_PAR_INVALID_VARBINARY; } - if(isHex(pToken->z, pToken->n)){ - if(!isValidateHex(pToken->z, pToken->n)){ + if(isHex(pToken->z + 1, pToken->n - 2)){ + if(!isValidateHex(pToken->z + 1, pToken->n - 2)){ return TSDB_CODE_PAR_INVALID_VARBINARY; } void* data = NULL; uint32_t size = 0; - if(taosHex2Ascii(pToken->z, pToken->n, &data, &size) < 0){ + if(taosHex2Ascii(pToken->z + 1, pToken->n - 2, &data, &size) < 0){ return TSDB_CODE_OUT_OF_MEMORY; } @@ -458,11 +458,13 @@ static int32_t parseVarbinary(SToken* pToken, uint8_t **pData, uint32_t *nData, *pData = data; *nData = size; }else{ - if (pToken->n + VARSTR_HEADER_SIZE > bytes) { + *pData = taosMemoryCalloc(1, pToken->n); + int32_t len = trimString(pToken->z, pToken->n, *pData, pToken->n); + *nData = len; + + if (*nData + VARSTR_HEADER_SIZE > bytes) { return TSDB_CODE_PAR_VALUE_TOO_LONG; } - *pData = taosStrdup(pToken->z); - *nData = pToken->n; } return TSDB_CODE_SUCCESS; } @@ -753,7 +755,7 @@ static int32_t buildCreateTbReq(SVnodeModifyOpStmt* pStmt, STag* pTag, SArray* p return TSDB_CODE_SUCCESS; } -static int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, SMsgBuf* pMsgBuf) { +static int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, SMsgBuf* pMsgBuf, int8_t type) { if ((pToken->type != TK_NOW && pToken->type != TK_TODAY && pToken->type != TK_NK_INTEGER && pToken->type != TK_NK_STRING && pToken->type != TK_NK_FLOAT && pToken->type != TK_NK_BOOL && pToken->type != TK_NULL && pToken->type != TK_NK_HEX && pToken->type != TK_NK_OCT && @@ -763,7 +765,7 @@ static int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, SMsgBuf* pMs } // Remove quotation marks - if (TK_NK_STRING == pToken->type) { + if (TK_NK_STRING == pToken->type && type != TSDB_DATA_TYPE_VARBINARY) { if (pToken->n >= TSDB_MAX_BYTES_PER_ROW) { return buildSyntaxErrMsg(pMsgBuf, "too long string", pToken->z); } @@ -935,7 +937,7 @@ static int32_t parseTagsClauseImpl(SInsertParseContext* pCxt, SVnodeModifyOpStmt SSchema* pTagSchema = &pSchema[pCxt->tags.pColIndex[i]]; isJson = pTagSchema->type == TSDB_DATA_TYPE_JSON; - code = checkAndTrimValue(&token, pCxt->tmpTokenBuf, &pCxt->msg); + code = checkAndTrimValue(&token, pCxt->tmpTokenBuf, &pCxt->msg, pTagSchema->type); if (TK_NK_VARIABLE == token.type) { code = buildSyntaxErrMsg(&pCxt->msg, "not expected tags values ", token.z); } @@ -1631,7 +1633,7 @@ static int32_t parseValueTokenImpl(SInsertParseContext* pCxt, const char** pSql, static int32_t parseValueToken(SInsertParseContext* pCxt, const char** pSql, SToken* pToken, SSchema* pSchema, int16_t timePrec, SColVal* pVal) { - int32_t code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg); + int32_t code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg, pSchema->type); if (TSDB_CODE_SUCCESS == code && isNullValue(pSchema->type, pToken)) { if (TSDB_DATA_TYPE_TIMESTAMP == pSchema->type && PRIMARYKEY_TIMESTAMP_COL_ID == pSchema->colId) { return buildSyntaxErrMsg(&pCxt->msg, "primary timestamp should not be null", pToken->z); @@ -1691,7 +1693,7 @@ typedef union SRowsDataContext{ static int32_t parseTbnameToken(SInsertParseContext* pCxt, SStbRowsDataContext* pStbRowsCxt, SToken* pToken, bool* pFoundCtbName) { *pFoundCtbName = false; - int32_t code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg); + int32_t code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg, TSDB_DATA_TYPE_BINARY); if (TK_NK_VARIABLE == pToken->type) { code = buildInvalidOperationMsg(&pCxt->msg, "not expected tbname"); } @@ -1731,7 +1733,7 @@ static int32_t processCtbTagsAfterCtbName(SInsertParseContext* pCxt, SVnodeModif for (int32_t i = 0; code == TSDB_CODE_SUCCESS && i < numOfTagTokens; ++i) { SToken* pTagToken = (SToken*)(tagTokens + i); SSchema* pTagSchema = tagSchemas[i]; - code = checkAndTrimValue(pTagToken, pCxt->tmpTokenBuf, &pCxt->msg); + code = checkAndTrimValue(pTagToken, pCxt->tmpTokenBuf, &pCxt->msg, pTagSchema->type); if (TK_NK_VARIABLE == pTagToken->type) { code = buildInvalidOperationMsg(&pCxt->msg, "not expected tag"); } @@ -1790,7 +1792,7 @@ static int32_t doGetStbRowValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt* tagSchemas[(*pNumOfTagTokens)] = (SSchema*)pTagSchema; ++(*pNumOfTagTokens); } else { - code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg); + code = checkAndTrimValue(pToken, pCxt->tmpTokenBuf, &pCxt->msg, pTagSchema->type); if (TK_NK_VARIABLE == pToken->type) { code = buildInvalidOperationMsg(&pCxt->msg, "not expected row value"); } @@ -2142,13 +2144,15 @@ static int32_t parseDataFromFileImpl(SInsertParseContext* pCxt, SVnodeModifyOpSt pStmt->pTableCxtHashObj = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); } - int32_t numOfRows = 0; int32_t code = parseCsvFile(pCxt, pStmt, rowsDataCxt, &numOfRows); if (TSDB_CODE_SUCCESS == code) { pStmt->totalRowsNum += numOfRows; pStmt->totalTbNum += 1; TSDB_QUERY_SET_TYPE(pStmt->insertType, TSDB_QUERY_TYPE_FILE_INSERT); + if (rowsDataCxt.pTableDataCxt && rowsDataCxt.pTableDataCxt->pData) { + rowsDataCxt.pTableDataCxt->pData->flags |= SUBMIT_REQ_FROM_FILE; + } if (!pStmt->fileProcessing) { taosCloseFile(&pStmt->fp); } else { diff --git a/source/libs/parser/src/parInsertUtil.c b/source/libs/parser/src/parInsertUtil.c index 6b655bfae6..a1f682f4cf 100644 --- a/source/libs/parser/src/parInsertUtil.c +++ b/source/libs/parser/src/parInsertUtil.c @@ -211,6 +211,7 @@ static int32_t createTableDataCxt(STableMeta* pTableMeta, SVCreateTbReq** pCreat bool colMode, bool ignoreColVals) { STableDataCxt* pTableCxt = taosMemoryCalloc(1, sizeof(STableDataCxt)); if (NULL == pTableCxt) { + *pOutput = NULL; return TSDB_CODE_OUT_OF_MEMORY; } @@ -268,12 +269,8 @@ static int32_t createTableDataCxt(STableMeta* pTableMeta, SVCreateTbReq** pCreat } } - if (TSDB_CODE_SUCCESS == code) { - *pOutput = pTableCxt; - qDebug("tableDataCxt created, uid:%" PRId64 ", vgId:%d", pTableMeta->uid, pTableMeta->vgId); - } else { - taosMemoryFree(pTableCxt); - } + *pOutput = pTableCxt; + qDebug("tableDataCxt created, code:%d, uid:%" PRId64 ", vgId:%d", code, pTableMeta->uid, pTableMeta->vgId); return code; } @@ -288,6 +285,7 @@ static int32_t rebuildTableData(SSubmitTbData* pSrc, SSubmitTbData** pDst) { pTmp->suid = pSrc->suid; pTmp->uid = pSrc->uid; pTmp->sver = pSrc->sver; + pTmp->source = pSrc->source; pTmp->pCreateTbReq = NULL; if (pTmp->flags & SUBMIT_REQ_AUTO_CREATE_TABLE) { if (pSrc->pCreateTbReq) { @@ -344,6 +342,10 @@ int32_t insGetTableDataCxt(SHashObj* pHash, void* id, int32_t idLen, STableMeta* void* pData = *pTableCxt; // deal scan coverity code = taosHashPut(pHash, id, idLen, &pData, POINTER_BYTES); } + + if (TSDB_CODE_SUCCESS != code) { + insDestroyTableDataCxt(*pTableCxt); + } return code; } @@ -651,6 +653,7 @@ int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreate goto end; } + pTableCxt->pData->source = SOURCE_TAOSX; if(tmp == NULL){ ret = initTableColSubmitData(pTableCxt); if (ret != TSDB_CODE_SUCCESS) { diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 393046fb4c..32a03cb874 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -113,6 +113,9 @@ static SKeyword keywordTable[] = { {"GEOMETRY", TK_GEOMETRY}, {"GRANT", TK_GRANT}, {"GRANTS", TK_GRANTS}, + {"FULL", TK_FULL}, + {"LOGS", TK_LOGS}, + {"MACHINES", TK_MACHINES}, {"GROUP", TK_GROUP}, {"HAVING", TK_HAVING}, {"HOST", TK_HOST}, diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index ce589f326d..8791beb5f5 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -14,6 +14,7 @@ */ #include "parTranslater.h" +#include "tdatablock.h" #include "parInt.h" #include "catalog.h" @@ -281,7 +282,25 @@ static const SSysTableShowAdapter sysTableShowAdapter[] = { .pTableName = TSDB_INS_TABLE_COMPACT_DETAILS, .numOfShowCols = 1, .pShowCols = {"*"} - }, + }, + { .showType = QUERY_NODE_SHOW_GRANTS_FULL_STMT, + .pDbName = TSDB_INFORMATION_SCHEMA_DB, + .pTableName = TSDB_INS_TABLE_GRANTS_FULL, + .numOfShowCols = 1, + .pShowCols = {"*"} + }, + { .showType = QUERY_NODE_SHOW_GRANTS_LOGS_STMT, + .pDbName = TSDB_INFORMATION_SCHEMA_DB, + .pTableName = TSDB_INS_TABLE_GRANTS_LOGS, + .numOfShowCols = 1, + .pShowCols = {"*"} + }, + { .showType = QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT, + .pDbName = TSDB_INFORMATION_SCHEMA_DB, + .pTableName = TSDB_INS_TABLE_MACHINES, + .numOfShowCols = 1, + .pShowCols = {"*"} + }, }; // clang-format on @@ -3359,6 +3378,19 @@ int32_t validateJoinConds(STranslateContext* pCxt, SJoinTableNode* pJoinTable) { return code; } +static int32_t translateAudit(STranslateContext* pCxt, SRealTableNode* pRealTable, SName* pName) { + if (pRealTable->pMeta->tableType == TSDB_SUPER_TABLE) { + if (IS_AUDIT_DBNAME(pName->dbname) && IS_AUDIT_STB_NAME(pName->tname)) { + pCxt->pParseCxt->isAudit = true; + } + } else if (pRealTable->pMeta->tableType == TSDB_CHILD_TABLE) { + if (IS_AUDIT_DBNAME(pName->dbname) && IS_AUDIT_CTB_NAME(pName->tname)) { + pCxt->pParseCxt->isAudit = true; + } + } + return 0; +} + int32_t translateTable(STranslateContext* pCxt, SNode** pTable, SNode* pJoinParent) { int32_t code = TSDB_CODE_SUCCESS; switch (nodeType(*pTable)) { @@ -3378,7 +3410,8 @@ int32_t translateTable(STranslateContext* pCxt, SNode** pTable, SNode* pJoinPare if (TSDB_VIEW_TABLE == pRealTable->pMeta->tableType) { return translateView(pCxt, pTable, &name); } -#endif + translateAudit(pCxt, pRealTable, &name); +#endif code = setTableVgroupList(pCxt, &name, pRealTable); if (TSDB_CODE_SUCCESS == code) { code = setTableIndex(pCxt, &name, pRealTable); @@ -4633,7 +4666,7 @@ static int32_t findVgroupsFromEqualTbname(STranslateContext* pCxt, SEqCondTbName SName snameTb; char* tbName = taosArrayGetP(pInfo->aTbnames, j); toName(pCxt->pParseCxt->acctId, dbName, tbName, &snameTb); - SVgroupInfo vgInfo; + SVgroupInfo vgInfo = {0}; bool bExists; int32_t code = catalogGetCachedTableHashVgroup(pCxt->pParseCxt->pCatalog, &snameTb, &vgInfo, &bExists); if (code == TSDB_CODE_SUCCESS && bExists) { @@ -5809,6 +5842,11 @@ static int32_t fillCmdSql(STranslateContext* pCxt, int16_t msgType, void* pReq) FILL_CMD_SQL(sql, sqlLen, pCmdReq, SMDropStreamReq, pReq); break; } + + case TDMT_MND_CONFIG_CLUSTER: { + FILL_CMD_SQL(sql, sqlLen, pCmdReq, SMCfgClusterReq, pReq); + break; + } default: { break; } @@ -7028,6 +7066,16 @@ static int32_t translateRestoreDnode(STranslateContext* pCxt, SRestoreComponentN return code; } +static int32_t translateAlterCluster(STranslateContext* pCxt, SAlterClusterStmt* pStmt) { + SMCfgClusterReq cfgReq = {0}; + strcpy(cfgReq.config, pStmt->config); + strcpy(cfgReq.value, pStmt->value); + + int32_t code = buildCmdMsg(pCxt, TDMT_MND_CONFIG_CLUSTER, (FSerializeFunc)tSerializeSMCfgClusterReq, &cfgReq); + tFreeSMCfgClusterReq(&cfgReq); + return code; +} + static int32_t getSmaIndexDstVgId(STranslateContext* pCxt, const char* pDbName, const char* pTableName, int32_t* pVgId) { SVgroupInfo vg = {0}; @@ -7177,7 +7225,7 @@ int32_t createIntervalFromCreateSmaIndexStmt(SCreateIndexStmt* pStmt, SInterval* return TSDB_CODE_SUCCESS; } -int32_t translatePostCreateSmaIndex(SParseContext* pParseCxt, SQuery* pQuery, void** pResRow) { +int32_t translatePostCreateSmaIndex(SParseContext* pParseCxt, SQuery* pQuery, SSDataBlock* pBlock) { int32_t code = TSDB_CODE_SUCCESS; SCreateIndexStmt* pStmt = (SCreateIndexStmt*)pQuery->pRoot; int64_t lastTs = 0; @@ -7187,11 +7235,13 @@ int32_t translatePostCreateSmaIndex(SParseContext* pParseCxt, SQuery* pQuery, vo if (TSDB_CODE_SUCCESS == code) { code = createIntervalFromCreateSmaIndexStmt(pStmt, &interval); } + if (TSDB_CODE_SUCCESS == code) { - if (pResRow && pResRow[0]) { - lastTs = *(int64_t*)pResRow[0]; + if (pBlock != NULL && pBlock->info.rows >= 1) { + SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, 0); + lastTs = *(int64_t*)colDataGetData(pColInfo, 0); } else if (interval.interval > 0) { - lastTs = convertTimePrecision(taosGetTimestampMs(), TSDB_TIME_PRECISION_MILLI, interval.precision); + lastTs = taosGetTimestamp(interval.precision); } else { lastTs = taosGetTimestampMs(); } @@ -8307,42 +8357,116 @@ static int32_t createLastTsSelectStmt(char* pDb, char* pTable, STableMeta* pMeta tstrncpy(col->tableAlias, pTable, tListLen(col->tableAlias)); tstrncpy(col->colName, pMeta->schema[0].name, tListLen(col->colName)); - SNodeList* pParamterList = nodesMakeList(); - if (NULL == pParamterList) { + SNodeList* pParameterList = nodesMakeList(); + if (NULL == pParameterList) { nodesDestroyNode((SNode*)col); return TSDB_CODE_OUT_OF_MEMORY; } - int32_t code = nodesListStrictAppend(pParamterList, (SNode*)col); + int32_t code = nodesListStrictAppend(pParameterList, (SNode*)col); if (code) { - nodesDestroyList(pParamterList); + nodesDestroyList(pParameterList); return code; } - SNode* pFunc = (SNode*)createFunction("last", pParamterList); + SNode* pFunc = (SNode*)createFunction("last", pParameterList); if (NULL == pFunc) { - nodesDestroyList(pParamterList); + nodesDestroyList(pParameterList); return TSDB_CODE_OUT_OF_MEMORY; } SNodeList* pProjectionList = nodesMakeList(); if (NULL == pProjectionList) { - nodesDestroyList(pParamterList); + nodesDestroyNode(pFunc); return TSDB_CODE_OUT_OF_MEMORY; } + code = nodesListStrictAppend(pProjectionList, pFunc); if (code) { nodesDestroyList(pProjectionList); return code; } + SFunctionNode* pFunc1 = createFunction("_vgid", NULL); + if (NULL == pFunc1) { + nodesDestroyList(pProjectionList); + return TSDB_CODE_OUT_OF_MEMORY; + } + + snprintf(pFunc1->node.aliasName, sizeof(pFunc1->node.aliasName), "%s.%p", pFunc1->functionName, pFunc1); + code = nodesListStrictAppend(pProjectionList, (SNode*) pFunc1); + if (code) { + nodesDestroyList(pProjectionList); + return code; + } + + SFunctionNode* pFunc2 = createFunction("_vgver", NULL); + if (NULL == pFunc2) { + nodesDestroyList(pProjectionList); + return TSDB_CODE_OUT_OF_MEMORY; + } + + snprintf(pFunc2->node.aliasName, sizeof(pFunc2->node.aliasName), "%s.%p", pFunc2->functionName, pFunc2); + code = nodesListStrictAppend(pProjectionList, (SNode*) pFunc2); + if (code) { + nodesDestroyList(pProjectionList); + return code; + } + code = createSimpleSelectStmtFromProjList(pDb, pTable, pProjectionList, (SSelectStmt**)pQuery); if (code) { nodesDestroyList(pProjectionList); return code; } - return code; + SSelectStmt** pSelect1 = (SSelectStmt**)pQuery; + (*pSelect1)->pGroupByList = nodesMakeList(); + if (NULL == (*pSelect1)->pGroupByList) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + SGroupingSetNode* pNode1 = (SGroupingSetNode*)nodesMakeNode(QUERY_NODE_GROUPING_SET); + if (NULL == pNode1) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + pNode1->groupingSetType = GP_TYPE_NORMAL; + pNode1->pParameterList = nodesMakeList(); + if (NULL == pNode1->pParameterList) { + nodesDestroyNode((SNode*)pNode1); + return TSDB_CODE_OUT_OF_MEMORY; + } + + code = nodesListStrictAppend(pNode1->pParameterList, nodesCloneNode((SNode*)pFunc1)); + if (code) { + nodesDestroyNode((SNode*)pNode1); + return code; + } + + code = nodesListAppend((*pSelect1)->pGroupByList, (SNode*)pNode1); + if (code) { + return code; + } + + SGroupingSetNode* pNode2 = (SGroupingSetNode*)nodesMakeNode(QUERY_NODE_GROUPING_SET); + if (NULL == pNode2) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + pNode2->groupingSetType = GP_TYPE_NORMAL; + pNode2->pParameterList = nodesMakeList(); + if (NULL == pNode2->pParameterList) { + nodesDestroyNode((SNode*)pNode2); + return TSDB_CODE_OUT_OF_MEMORY; + } + + code = nodesListStrictAppend(pNode2->pParameterList, nodesCloneNode((SNode*)pFunc2)); + if (code) { + nodesDestroyNode((SNode*)pNode2); + return code; + } + + return nodesListAppend((*pSelect1)->pGroupByList, (SNode*)pNode2); } static int32_t buildCreateStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStmt, SCMCreateStreamReq* pReq) { @@ -8489,7 +8613,31 @@ static int32_t buildIntervalForCreateStream(SCreateStreamStmt* pStmt, SInterval* return code; } -int32_t translatePostCreateStream(SParseContext* pParseCxt, SQuery* pQuery, void** pResRow) { +// ts, vgroup_id, vgroup_version +static int32_t createStreamReqVersionInfo(SSDataBlock* pBlock, SArray** pArray, int64_t* lastTs, SInterval* pInterval) { + *pArray = taosArrayInit(pBlock->info.rows, sizeof(SVgroupVer)); + if (*pArray == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + if (pBlock->info.rows > 0) { + *lastTs = pBlock->info.window.ekey; + SColumnInfoData* pCol1 = taosArrayGet(pBlock->pDataBlock, 1); + SColumnInfoData* pCol2 = taosArrayGet(pBlock->pDataBlock, 2); + + for (int32_t i = 0; i < pBlock->info.rows; ++i) { + SVgroupVer v = {.vgId = *(int32_t*)colDataGetData(pCol1, i), .ver = *(int64_t*)colDataGetData(pCol2, i)}; + taosArrayPush(*pArray, &v); + } + } else { + int32_t precision = (pInterval->interval > 0)? pInterval->precision:TSDB_TIME_PRECISION_MILLI; + *lastTs = taosGetTimestamp(precision); + } + + return TSDB_CODE_SUCCESS; +} + +int32_t translatePostCreateStream(SParseContext* pParseCxt, SQuery* pQuery, SSDataBlock* pBlock) { SCreateStreamStmt* pStmt = (SCreateStreamStmt*)pQuery->pRoot; STranslateContext cxt = {0}; SInterval interval = {0}; @@ -8499,15 +8647,11 @@ int32_t translatePostCreateStream(SParseContext* pParseCxt, SQuery* pQuery, void if (TSDB_CODE_SUCCESS == code) { code = buildIntervalForCreateStream(pStmt, &interval); } + if (TSDB_CODE_SUCCESS == code) { - if (pResRow && pResRow[0]) { - lastTs = *(int64_t*)pResRow[0]; - } else if (interval.interval > 0) { - lastTs = convertTimePrecision(taosGetTimestampMs(), TSDB_TIME_PRECISION_MILLI, interval.precision); - } else { - lastTs = taosGetTimestampMs(); - } + code = createStreamReqVersionInfo(pBlock, &pStmt->pReq->pVgroupVerList, &lastTs, &interval); } + if (TSDB_CODE_SUCCESS == code) { if (interval.interval > 0) { pStmt->pReq->lastTs = taosTimeAdd(taosTimeTruncate(lastTs, &interval), interval.interval, interval.intervalUnit, interval.precision); @@ -8516,9 +8660,11 @@ int32_t translatePostCreateStream(SParseContext* pParseCxt, SQuery* pQuery, void } code = buildCmdMsg(&cxt, TDMT_MND_CREATE_STREAM, (FSerializeFunc)tSerializeSCMCreateStreamReq, pStmt->pReq); } + if (TSDB_CODE_SUCCESS == code) { code = setQuery(&cxt, pQuery); } + setRefreshMeta(&cxt, pQuery); destroyTranslateContext(&cxt); @@ -9047,6 +9193,9 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { case QUERY_NODE_COMPACT_DATABASE_STMT: code = translateCompact(pCxt, (SCompactDatabaseStmt*)pNode); break; + case QUERY_NODE_ALTER_CLUSTER_STMT: + code = translateAlterCluster(pCxt, (SAlterClusterStmt*)pNode); + break; case QUERY_NODE_KILL_CONNECTION_STMT: code = translateKillConnection(pCxt, (SKillStmt*)pNode); break; @@ -10893,6 +11042,9 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) { case QUERY_NODE_SHOW_TAGS_STMT: case QUERY_NODE_SHOW_USER_PRIVILEGES_STMT: case QUERY_NODE_SHOW_VIEWS_STMT: + case QUERY_NODE_SHOW_GRANTS_FULL_STMT: + case QUERY_NODE_SHOW_GRANTS_LOGS_STMT: + case QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT: code = rewriteShow(pCxt, pQuery); break; case QUERY_NODE_SHOW_VGROUPS_STMT: diff --git a/source/libs/parser/src/parser.c b/source/libs/parser/src/parser.c index 1fa4c624a7..92e25f3ee6 100644 --- a/source/libs/parser/src/parser.c +++ b/source/libs/parser/src/parser.c @@ -233,14 +233,17 @@ int32_t qContinueParseSql(SParseContext* pCxt, struct SCatalogReq* pCatalogReq, return parseInsertSql(pCxt, &pQuery, pCatalogReq, pMetaData); } -int32_t qContinueParsePostQuery(SParseContext* pCxt, SQuery* pQuery, void** pResRow) { +int32_t qContinueParsePostQuery(SParseContext* pCxt, SQuery* pQuery, SSDataBlock* pBlock) { int32_t code = TSDB_CODE_SUCCESS; switch (nodeType(pQuery->pRoot)) { - case QUERY_NODE_CREATE_STREAM_STMT: - code = translatePostCreateStream(pCxt, pQuery, pResRow); + case QUERY_NODE_CREATE_STREAM_STMT: { + code = translatePostCreateStream(pCxt, pQuery, pBlock); break; - case QUERY_NODE_CREATE_INDEX_STMT: - code = translatePostCreateSmaIndex(pCxt, pQuery, pResRow); + } + case QUERY_NODE_CREATE_INDEX_STMT: { + code = translatePostCreateSmaIndex(pCxt, pQuery, pBlock); + break; + } default: break; } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index a6d59b9414..e209901043 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -104,30 +104,30 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 522 +#define YYNOCODE 524 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - int8_t yy71; - SDataType yy88; - EOrder yy146; - int32_t yy172; - EFillMode yy270; - SToken yy353; - ENullOrder yy361; - int64_t yy369; - EShowKind yy393; - bool yy461; - SShowTablesOption yy637; - SAlterOption yy641; - EOperatorType yy776; + SDataType yy56; + SNodeList* yy72; + EOrder yy130; + EJoinSubType yy166; + SToken yy305; + EOperatorType yy324; + int8_t yy359; + STokenPair yy361; + int32_t yy444; + SShowTablesOption yy517; + ENullOrder yy681; + EShowKind yy761; EJoinType yy828; - SNode* yy884; - STokenPair yy885; - EJoinSubType yy954; - SNodeList* yy964; + EFillMode yy926; + SAlterOption yy941; + bool yy985; + SNode* yy1000; + int64_t yy1005; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -143,18 +143,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 850 -#define YYNRULE 659 -#define YYNRULE_WITH_ACTION 659 -#define YYNTOKEN 356 -#define YY_MAX_SHIFT 849 -#define YY_MIN_SHIFTREDUCE 1265 -#define YY_MAX_SHIFTREDUCE 1923 -#define YY_ERROR_ACTION 1924 -#define YY_ACCEPT_ACTION 1925 -#define YY_NO_ACTION 1926 -#define YY_MIN_REDUCE 1927 -#define YY_MAX_REDUCE 2585 +#define YYNSTATE 856 +#define YYNRULE 664 +#define YYNRULE_WITH_ACTION 664 +#define YYNTOKEN 358 +#define YY_MAX_SHIFT 855 +#define YY_MIN_SHIFTREDUCE 1271 +#define YY_MAX_SHIFTREDUCE 1934 +#define YY_ERROR_ACTION 1935 +#define YY_ACCEPT_ACTION 1936 +#define YY_NO_ACTION 1937 +#define YY_MIN_REDUCE 1938 +#define YY_MAX_REDUCE 2601 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -221,896 +221,855 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (3161) +#define YY_ACTTAB_COUNT (2950) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 566, 106, 423, 567, 1970, 574, 2104, 702, 567, 1970, - /* 10 */ 169, 2298, 48, 46, 1847, 2556, 202, 402, 2117, 189, - /* 20 */ 420, 1928, 1671, 41, 40, 2166, 2108, 47, 45, 44, - /* 30 */ 43, 42, 174, 701, 208, 1756, 2011, 1669, 2557, 703, - /* 40 */ 2054, 388, 128, 2230, 2370, 127, 126, 125, 124, 123, - /* 50 */ 122, 121, 120, 119, 41, 40, 1998, 717, 47, 45, - /* 60 */ 44, 43, 42, 1927, 1751, 278, 1700, 41, 40, 2168, - /* 70 */ 19, 47, 45, 44, 43, 42, 401, 1677, 629, 2561, - /* 80 */ 583, 714, 147, 644, 2166, 2388, 2250, 137, 136, 135, - /* 90 */ 134, 133, 132, 131, 130, 129, 1699, 2336, 642, 751, - /* 100 */ 640, 273, 272, 846, 2248, 722, 15, 476, 821, 820, - /* 110 */ 819, 818, 432, 586, 817, 816, 152, 811, 810, 809, - /* 120 */ 808, 807, 806, 805, 151, 799, 798, 797, 431, 430, - /* 130 */ 794, 793, 792, 188, 187, 791, 584, 2243, 2369, 1696, - /* 140 */ 801, 2407, 1758, 1759, 114, 2371, 755, 2373, 2374, 750, - /* 150 */ 2168, 745, 533, 531, 2091, 370, 191, 410, 2460, 221, - /* 160 */ 735, 2115, 416, 2456, 128, 2166, 1889, 127, 126, 125, - /* 170 */ 124, 123, 122, 121, 120, 119, 790, 1731, 1741, 63, - /* 180 */ 138, 2317, 209, 1913, 1757, 1760, 1696, 609, 735, 2115, - /* 190 */ 2507, 184, 2468, 713, 241, 139, 712, 2561, 569, 1672, - /* 200 */ 1978, 1670, 527, 2556, 803, 2556, 1920, 469, 212, 734, - /* 210 */ 41, 40, 468, 571, 47, 45, 44, 43, 42, 568, - /* 220 */ 692, 701, 208, 790, 2560, 204, 2557, 703, 2557, 2559, - /* 230 */ 276, 1675, 1676, 1728, 275, 1730, 1733, 1734, 1735, 1736, - /* 240 */ 1737, 1738, 1739, 1740, 747, 743, 1749, 1750, 1752, 1753, - /* 250 */ 1754, 1755, 2, 48, 46, 307, 201, 672, 369, 2168, - /* 260 */ 1694, 420, 2250, 1671, 231, 2556, 415, 517, 2155, 2370, - /* 270 */ 536, 467, 380, 466, 2166, 535, 1756, 413, 1669, 1701, - /* 280 */ 2247, 722, 752, 2562, 208, 2168, 526, 525, 2557, 703, - /* 290 */ 656, 499, 424, 537, 2561, 51, 1570, 1571, 501, 2346, - /* 300 */ 2166, 98, 2556, 465, 375, 1751, 1410, 400, 479, 646, - /* 310 */ 2388, 19, 1699, 2106, 1312, 1697, 1785, 181, 1677, 302, - /* 320 */ 1919, 2560, 2336, 2350, 751, 2557, 2558, 2370, 2480, 1819, - /* 330 */ 1820, 1821, 1822, 2480, 2480, 2480, 2480, 2480, 1310, 1311, - /* 340 */ 752, 734, 1980, 2199, 846, 389, 1412, 15, 1819, 1820, - /* 350 */ 1821, 1822, 309, 687, 41, 40, 487, 189, 47, 45, - /* 360 */ 44, 43, 42, 2369, 576, 2289, 2407, 2352, 2388, 176, - /* 370 */ 2371, 755, 2373, 2374, 750, 1697, 745, 745, 1786, 30, - /* 380 */ 2336, 2231, 751, 1758, 1759, 804, 2237, 2216, 2076, 524, - /* 390 */ 523, 522, 521, 516, 515, 514, 513, 512, 507, 506, - /* 400 */ 505, 504, 372, 496, 495, 494, 214, 489, 488, 387, - /* 410 */ 429, 428, 63, 480, 1558, 1559, 673, 2518, 1731, 1741, - /* 420 */ 1577, 2369, 453, 99, 2407, 1757, 1760, 114, 2371, 755, - /* 430 */ 2373, 2374, 750, 1728, 745, 1678, 734, 1502, 1503, 2576, - /* 440 */ 1672, 2460, 1670, 38, 325, 416, 2456, 1878, 1824, 1825, - /* 450 */ 1826, 1827, 1828, 1890, 1618, 693, 688, 681, 37, 418, - /* 460 */ 1780, 1781, 1782, 1783, 1784, 1788, 1789, 1790, 1791, 714, - /* 470 */ 147, 307, 1675, 1676, 1728, 52, 1730, 1733, 1734, 1735, - /* 480 */ 1736, 1737, 1738, 1739, 1740, 747, 743, 1749, 1750, 1752, - /* 490 */ 1753, 1754, 1755, 2, 12, 48, 46, 1590, 1591, 259, - /* 500 */ 12, 2370, 10, 420, 503, 1671, 684, 683, 1876, 1877, - /* 510 */ 1879, 1880, 1881, 502, 752, 182, 735, 2115, 1756, 68, - /* 520 */ 1669, 691, 51, 603, 599, 595, 591, 76, 258, 788, - /* 530 */ 162, 161, 785, 784, 783, 159, 138, 2370, 1950, 1589, - /* 540 */ 1592, 1696, 2388, 614, 2346, 485, 2226, 1751, 457, 2388, - /* 550 */ 717, 243, 655, 19, 2336, 569, 751, 1978, 2355, 582, - /* 560 */ 1677, 316, 317, 714, 147, 1331, 315, 1330, 2350, 96, - /* 570 */ 95, 2475, 256, 1671, 1305, 459, 455, 87, 2388, 117, - /* 580 */ 2468, 2469, 143, 145, 2473, 309, 846, 390, 1669, 15, - /* 590 */ 2336, 2336, 751, 1312, 223, 2369, 2110, 2472, 2407, 1681, - /* 600 */ 1332, 114, 2371, 755, 2373, 2374, 750, 2014, 745, 2475, - /* 610 */ 690, 150, 2352, 157, 2431, 2460, 1307, 1310, 1311, 416, - /* 620 */ 2456, 63, 745, 735, 2115, 1758, 1759, 63, 1677, 653, - /* 630 */ 175, 2369, 1939, 2346, 2407, 2471, 246, 114, 2371, 755, - /* 640 */ 2373, 2374, 750, 56, 745, 255, 248, 2354, 309, 191, - /* 650 */ 9, 2460, 253, 580, 846, 416, 2456, 2350, 12, 425, - /* 660 */ 1731, 1741, 2161, 2163, 227, 1334, 1335, 1757, 1760, 735, - /* 670 */ 2115, 245, 716, 177, 2468, 2469, 1677, 145, 2473, 628, - /* 680 */ 627, 626, 1672, 2508, 1670, 2092, 618, 144, 622, 473, - /* 690 */ 735, 2115, 621, 491, 2226, 309, 414, 620, 625, 396, - /* 700 */ 395, 2352, 417, 619, 172, 90, 615, 1851, 89, 1700, - /* 710 */ 474, 745, 2117, 1696, 1675, 1676, 1728, 781, 1730, 1733, - /* 720 */ 1734, 1735, 1736, 1737, 1738, 1739, 1740, 747, 743, 1749, - /* 730 */ 1750, 1752, 1753, 1754, 1755, 2, 48, 46, 1761, 1949, - /* 740 */ 2370, 1700, 225, 656, 420, 737, 1671, 2432, 1467, 739, - /* 750 */ 1672, 2432, 1670, 752, 2093, 2515, 519, 2226, 648, 1756, - /* 760 */ 647, 1669, 1458, 780, 779, 778, 1462, 777, 1464, 1465, - /* 770 */ 776, 773, 88, 1473, 770, 1475, 1476, 767, 764, 761, - /* 780 */ 1766, 2388, 1675, 1676, 1870, 1700, 1696, 153, 1751, 628, - /* 790 */ 627, 626, 2336, 2336, 309, 751, 618, 144, 622, 1871, - /* 800 */ 309, 1677, 621, 149, 2168, 230, 2431, 620, 625, 396, - /* 810 */ 395, 386, 1948, 619, 2162, 2163, 615, 658, 2289, 2166, - /* 820 */ 788, 162, 161, 785, 784, 783, 159, 846, 605, 604, - /* 830 */ 49, 735, 2115, 2370, 2369, 607, 606, 2407, 633, 1869, - /* 840 */ 114, 2371, 755, 2373, 2374, 750, 752, 745, 2528, 1314, - /* 850 */ 34, 493, 2576, 645, 2460, 1695, 41, 40, 416, 2456, - /* 860 */ 47, 45, 44, 43, 42, 2336, 1758, 1759, 199, 274, - /* 870 */ 1732, 735, 2115, 277, 2388, 2480, 1819, 1820, 1821, 1822, - /* 880 */ 2480, 2480, 2480, 2480, 2480, 636, 2336, 423, 751, 702, - /* 890 */ 330, 508, 630, 1947, 2100, 172, 782, 2556, 271, 2159, - /* 900 */ 203, 1731, 1741, 2117, 735, 2115, 41, 40, 1757, 1760, - /* 910 */ 47, 45, 44, 43, 42, 701, 208, 671, 95, 2102, - /* 920 */ 2557, 703, 1701, 1672, 509, 1670, 1729, 2369, 735, 2115, - /* 930 */ 2407, 2329, 2098, 114, 2371, 755, 2373, 2374, 750, 72, - /* 940 */ 745, 3, 71, 1732, 2111, 2576, 2336, 2460, 510, 1639, - /* 950 */ 1640, 416, 2456, 54, 1701, 1675, 1676, 1728, 2055, 1730, - /* 960 */ 1733, 1734, 1735, 1736, 1737, 1738, 1739, 1740, 747, 743, - /* 970 */ 1749, 1750, 1752, 1753, 1754, 1755, 2, 48, 46, 2370, - /* 980 */ 1422, 672, 14, 13, 1331, 420, 1330, 1671, 2560, 2556, - /* 990 */ 735, 2115, 752, 172, 679, 1421, 735, 2115, 1701, 1729, - /* 1000 */ 1756, 2118, 1669, 563, 2475, 1863, 112, 2562, 208, 2370, - /* 1010 */ 585, 561, 2557, 703, 557, 553, 2112, 1925, 1844, 1332, - /* 1020 */ 2388, 2090, 752, 148, 2549, 714, 147, 735, 2115, 1751, - /* 1030 */ 2470, 2107, 2336, 1696, 751, 47, 45, 44, 43, 42, - /* 1040 */ 735, 2115, 1677, 735, 2115, 36, 61, 279, 394, 393, - /* 1050 */ 2388, 41, 40, 1696, 669, 47, 45, 44, 43, 42, - /* 1060 */ 287, 538, 2336, 720, 751, 735, 2115, 2320, 846, 735, - /* 1070 */ 2115, 49, 1426, 2369, 735, 2115, 2407, 624, 623, 114, - /* 1080 */ 2371, 755, 2373, 2374, 750, 320, 745, 1425, 1799, 732, - /* 1090 */ 140, 2576, 786, 2460, 733, 2159, 435, 416, 2456, 1946, - /* 1100 */ 2168, 434, 86, 2369, 735, 2115, 2407, 1758, 1759, 114, - /* 1110 */ 2371, 755, 2373, 2374, 750, 721, 745, 1945, 442, 392, - /* 1120 */ 391, 2576, 611, 2460, 326, 41, 40, 416, 2456, 47, - /* 1130 */ 45, 44, 43, 42, 613, 178, 2468, 2469, 612, 145, - /* 1140 */ 2473, 1944, 1731, 1741, 613, 1787, 672, 709, 612, 1757, - /* 1150 */ 1760, 706, 2336, 540, 2556, 426, 788, 162, 161, 785, - /* 1160 */ 784, 783, 159, 172, 1672, 742, 1670, 735, 2115, 1943, - /* 1170 */ 2336, 2117, 2562, 208, 2330, 41, 40, 2557, 703, 47, - /* 1180 */ 45, 44, 43, 42, 1942, 1941, 1938, 427, 815, 813, - /* 1190 */ 1732, 44, 43, 42, 2336, 651, 1675, 1676, 1728, 1937, - /* 1200 */ 1730, 1733, 1734, 1735, 1736, 1737, 1738, 1739, 1740, 747, - /* 1210 */ 743, 1749, 1750, 1752, 1753, 1754, 1755, 2, 48, 46, - /* 1220 */ 1936, 1935, 2336, 2119, 672, 35, 420, 2370, 1671, 654, - /* 1230 */ 160, 1934, 2556, 1933, 696, 1792, 2209, 2336, 2336, 2336, - /* 1240 */ 752, 1756, 2492, 1669, 1932, 672, 1729, 849, 1931, 1930, - /* 1250 */ 2562, 208, 2336, 2556, 2168, 2557, 703, 616, 787, 339, - /* 1260 */ 2168, 2159, 2145, 332, 1955, 841, 1729, 617, 2388, 730, - /* 1270 */ 1751, 2562, 208, 2336, 2336, 2167, 2557, 703, 483, 198, - /* 1280 */ 2336, 1407, 751, 1677, 2336, 705, 2336, 837, 833, 829, - /* 1290 */ 825, 1405, 329, 1989, 657, 1843, 171, 2336, 1833, 160, - /* 1300 */ 264, 2336, 2336, 262, 55, 266, 160, 268, 265, 846, - /* 1310 */ 267, 270, 15, 1987, 269, 631, 718, 288, 1922, 1923, - /* 1320 */ 50, 2369, 50, 284, 2407, 192, 1777, 114, 2371, 755, - /* 1330 */ 2373, 2374, 750, 113, 745, 634, 323, 429, 428, 2576, - /* 1340 */ 160, 2460, 746, 50, 672, 416, 2456, 1685, 1758, 1759, - /* 1350 */ 1940, 314, 2556, 75, 2357, 158, 160, 14, 13, 66, - /* 1360 */ 1756, 100, 1678, 111, 1365, 1680, 672, 1679, 731, 2370, - /* 1370 */ 2562, 208, 108, 1634, 2556, 2557, 703, 795, 2521, 796, - /* 1380 */ 1637, 181, 749, 1731, 1741, 50, 685, 50, 759, 1751, - /* 1390 */ 1757, 1760, 2562, 208, 1875, 303, 1874, 2557, 703, 293, - /* 1400 */ 715, 1384, 1677, 1382, 1366, 1672, 142, 1670, 295, 312, - /* 1410 */ 2388, 2359, 1981, 2052, 719, 2389, 311, 1587, 710, 158, - /* 1420 */ 707, 160, 2336, 141, 751, 318, 2051, 727, 741, 322, - /* 1430 */ 1452, 158, 2235, 1793, 1971, 281, 2511, 1675, 1676, 1728, - /* 1440 */ 682, 1730, 1733, 1734, 1735, 1736, 1737, 1738, 1739, 1740, - /* 1450 */ 747, 743, 1749, 1750, 1752, 1753, 1754, 1755, 2, 1742, - /* 1460 */ 173, 338, 1480, 2369, 839, 346, 2407, 406, 689, 361, - /* 1470 */ 2371, 755, 2373, 2374, 750, 748, 745, 736, 2425, 403, - /* 1480 */ 724, 433, 343, 74, 2236, 1977, 73, 2370, 2156, 665, - /* 1490 */ 2512, 2522, 697, 1484, 698, 1491, 371, 1489, 300, 305, - /* 1500 */ 752, 308, 2077, 441, 5, 163, 436, 239, 548, 546, - /* 1510 */ 543, 384, 449, 1704, 450, 461, 460, 216, 463, 218, - /* 1520 */ 333, 215, 1694, 477, 1686, 1695, 1681, 484, 2388, 1683, - /* 1530 */ 1611, 1682, 486, 229, 490, 529, 492, 497, 518, 511, - /* 1540 */ 2336, 2228, 751, 520, 528, 530, 539, 541, 63, 542, - /* 1550 */ 234, 544, 233, 545, 236, 547, 1689, 1691, 549, 1702, - /* 1560 */ 4, 565, 573, 564, 572, 244, 92, 575, 1697, 247, - /* 1570 */ 743, 1749, 1750, 1752, 1753, 1754, 1755, 577, 1703, 1705, - /* 1580 */ 578, 2369, 579, 250, 2407, 581, 64, 114, 2371, 755, - /* 1590 */ 2373, 2374, 750, 252, 745, 1706, 93, 94, 587, 2435, - /* 1600 */ 2370, 2460, 2244, 257, 608, 416, 2456, 365, 610, 2105, - /* 1610 */ 261, 2101, 637, 752, 263, 165, 116, 638, 166, 2103, - /* 1620 */ 2099, 650, 97, 2370, 167, 168, 652, 154, 334, 280, - /* 1630 */ 1698, 660, 661, 84, 83, 472, 752, 659, 220, 285, - /* 1640 */ 664, 2388, 2307, 2370, 2304, 2303, 667, 2290, 283, 676, - /* 1650 */ 686, 464, 462, 2336, 2527, 751, 752, 725, 2526, 290, - /* 1660 */ 2499, 695, 368, 294, 2388, 451, 677, 666, 448, 444, - /* 1670 */ 440, 437, 465, 8, 183, 675, 2336, 292, 751, 674, - /* 1680 */ 296, 297, 299, 700, 2388, 699, 2479, 407, 298, 146, - /* 1690 */ 711, 1699, 708, 2579, 2369, 1841, 2336, 2407, 751, 1839, - /* 1700 */ 114, 2371, 755, 2373, 2374, 750, 304, 745, 195, 310, - /* 1710 */ 2476, 335, 2433, 723, 2460, 155, 2258, 649, 416, 2456, - /* 1720 */ 2407, 309, 2370, 357, 2371, 755, 2373, 2374, 750, 301, - /* 1730 */ 745, 1, 210, 2257, 728, 752, 2256, 2369, 336, 337, - /* 1740 */ 2407, 412, 729, 114, 2371, 755, 2373, 2374, 750, 2555, - /* 1750 */ 745, 2370, 156, 105, 2116, 738, 62, 2460, 2441, 2160, - /* 1760 */ 107, 416, 2456, 2388, 752, 340, 757, 328, 1289, 840, - /* 1770 */ 843, 164, 376, 53, 845, 2336, 377, 751, 349, 363, - /* 1780 */ 364, 342, 344, 2328, 2327, 2326, 81, 353, 2321, 438, - /* 1790 */ 439, 1662, 2388, 1663, 213, 443, 2319, 445, 446, 1661, - /* 1800 */ 447, 2318, 385, 2316, 2336, 452, 751, 2315, 2370, 454, - /* 1810 */ 2314, 456, 2313, 458, 1650, 2294, 2369, 2293, 217, 2407, - /* 1820 */ 219, 752, 115, 2371, 755, 2373, 2374, 750, 82, 745, - /* 1830 */ 1614, 2370, 1613, 2271, 2270, 2269, 2460, 470, 471, 2268, - /* 1840 */ 2459, 2456, 2267, 2218, 752, 2369, 2370, 475, 2407, 2388, - /* 1850 */ 2215, 115, 2371, 755, 2373, 2374, 750, 1557, 745, 752, - /* 1860 */ 478, 2336, 481, 751, 2214, 2460, 2208, 482, 2205, 740, - /* 1870 */ 2456, 222, 2388, 2204, 85, 2203, 2202, 2207, 2206, 224, - /* 1880 */ 2201, 2200, 2198, 2197, 2336, 2196, 751, 2388, 226, 498, - /* 1890 */ 2195, 500, 2211, 2194, 2193, 2192, 2191, 2190, 2213, 2336, - /* 1900 */ 2189, 751, 753, 2188, 2187, 2407, 2186, 2185, 115, 2371, - /* 1910 */ 755, 2373, 2374, 750, 2184, 745, 2370, 2183, 2182, 2181, - /* 1920 */ 2180, 228, 2460, 2179, 91, 2369, 379, 2456, 2407, 752, - /* 1930 */ 2178, 179, 2371, 755, 2373, 2374, 750, 2177, 745, 2176, - /* 1940 */ 2369, 2370, 2212, 2407, 1563, 2173, 115, 2371, 755, 2373, - /* 1950 */ 2374, 750, 2210, 745, 752, 2175, 2174, 2388, 232, 2172, - /* 1960 */ 2460, 373, 1423, 1427, 532, 2457, 2171, 2170, 2169, 2336, - /* 1970 */ 2017, 751, 534, 235, 374, 1419, 2016, 237, 2015, 238, - /* 1980 */ 2013, 2010, 2388, 550, 551, 552, 2009, 404, 554, 2002, - /* 1990 */ 704, 2577, 556, 1991, 2336, 558, 751, 1966, 555, 559, - /* 2000 */ 562, 1313, 560, 2356, 190, 1965, 78, 240, 2292, 2288, - /* 2010 */ 2369, 79, 2370, 2407, 200, 242, 176, 2371, 755, 2373, - /* 2020 */ 2374, 750, 570, 745, 2278, 752, 2266, 249, 251, 2265, - /* 2030 */ 2242, 254, 2094, 2012, 2008, 2369, 588, 590, 2407, 589, - /* 2040 */ 2006, 362, 2371, 755, 2373, 2374, 750, 592, 745, 593, - /* 2050 */ 1358, 2004, 596, 2388, 594, 597, 598, 2001, 405, 600, - /* 2060 */ 602, 1986, 601, 1984, 2519, 2336, 1985, 751, 1983, 1962, - /* 2070 */ 2096, 65, 1496, 2095, 1495, 1409, 1999, 1990, 1408, 2370, - /* 2080 */ 1406, 1404, 1403, 1402, 1401, 1400, 260, 1397, 812, 814, - /* 2090 */ 1396, 1988, 752, 1395, 397, 2370, 1394, 398, 1961, 635, - /* 2100 */ 399, 1960, 632, 1959, 639, 1958, 2369, 1957, 752, 2407, - /* 2110 */ 2370, 641, 362, 2371, 755, 2373, 2374, 750, 643, 745, - /* 2120 */ 2388, 1644, 118, 752, 1646, 1643, 1648, 29, 2291, 69, - /* 2130 */ 282, 1624, 2336, 2287, 751, 1622, 2388, 1620, 2277, 662, - /* 2140 */ 2264, 2263, 2561, 20, 17, 6, 67, 7, 2336, 1892, - /* 2150 */ 751, 2388, 21, 22, 57, 170, 411, 194, 205, 286, - /* 2160 */ 33, 2357, 58, 2336, 31, 751, 289, 680, 678, 663, - /* 2170 */ 1599, 23, 1836, 2369, 2262, 1598, 2407, 206, 668, 355, - /* 2180 */ 2371, 755, 2373, 2374, 750, 180, 745, 670, 193, 2369, - /* 2190 */ 291, 32, 2407, 1873, 24, 179, 2371, 755, 2373, 2374, - /* 2200 */ 750, 1862, 745, 1834, 2369, 2370, 1832, 2407, 1907, 1906, - /* 2210 */ 362, 2371, 755, 2373, 2374, 750, 18, 745, 749, 408, - /* 2220 */ 80, 2370, 207, 1911, 1910, 1912, 409, 306, 1913, 1816, - /* 2230 */ 694, 60, 1815, 185, 752, 2241, 101, 102, 25, 2240, - /* 2240 */ 324, 313, 103, 1868, 108, 26, 2388, 13, 196, 1768, - /* 2250 */ 1687, 59, 319, 70, 104, 2578, 11, 1767, 2336, 1778, - /* 2260 */ 751, 2410, 2388, 726, 1746, 744, 39, 419, 186, 1744, - /* 2270 */ 321, 1743, 16, 27, 2336, 197, 751, 1713, 1721, 28, - /* 2280 */ 758, 756, 1481, 422, 1478, 760, 762, 763, 2370, 765, - /* 2290 */ 1477, 766, 768, 1486, 771, 1474, 769, 774, 772, 2369, - /* 2300 */ 1468, 752, 2407, 2370, 1466, 361, 2371, 755, 2373, 2374, - /* 2310 */ 750, 775, 745, 109, 2426, 2369, 752, 327, 2407, 110, - /* 2320 */ 2370, 362, 2371, 755, 2373, 2374, 750, 754, 745, 2388, - /* 2330 */ 1472, 1471, 1490, 752, 421, 1470, 1469, 77, 1356, 789, - /* 2340 */ 1391, 2336, 1388, 751, 2388, 1387, 1386, 1385, 1383, 1381, - /* 2350 */ 1380, 1379, 1417, 800, 1416, 211, 2336, 1377, 751, 802, - /* 2360 */ 1376, 2388, 1375, 1374, 1373, 1372, 1371, 1413, 1411, 1368, - /* 2370 */ 1367, 1364, 1363, 2336, 1362, 751, 1361, 2007, 824, 822, - /* 2380 */ 2005, 823, 2369, 826, 2003, 2407, 828, 830, 362, 2371, - /* 2390 */ 755, 2373, 2374, 750, 827, 745, 831, 2369, 2370, 832, - /* 2400 */ 2407, 2000, 834, 347, 2371, 755, 2373, 2374, 750, 835, - /* 2410 */ 745, 752, 836, 2370, 2369, 1982, 838, 2407, 1302, 1956, - /* 2420 */ 345, 2371, 755, 2373, 2374, 750, 752, 745, 1290, 842, - /* 2430 */ 331, 844, 1926, 1673, 341, 847, 848, 1926, 1926, 2388, - /* 2440 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, - /* 2450 */ 1926, 2336, 1926, 751, 2388, 1926, 1926, 1926, 1926, 1926, - /* 2460 */ 1926, 1926, 1926, 1926, 1926, 1926, 2336, 1926, 751, 1926, - /* 2470 */ 2370, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, - /* 2480 */ 1926, 1926, 1926, 752, 1926, 1926, 1926, 1926, 1926, 1926, - /* 2490 */ 1926, 1926, 2369, 1926, 1926, 2407, 2370, 1926, 348, 2371, - /* 2500 */ 755, 2373, 2374, 750, 1926, 745, 1926, 2369, 1926, 752, - /* 2510 */ 2407, 2388, 1926, 354, 2371, 755, 2373, 2374, 750, 1926, - /* 2520 */ 745, 1926, 1926, 2336, 1926, 751, 1926, 1926, 1926, 1926, - /* 2530 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 2388, 1926, 2370, - /* 2540 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 2336, - /* 2550 */ 1926, 751, 752, 1926, 1926, 1926, 1926, 1926, 1926, 1926, - /* 2560 */ 1926, 1926, 1926, 1926, 2369, 2370, 1926, 2407, 1926, 1926, - /* 2570 */ 358, 2371, 755, 2373, 2374, 750, 1926, 745, 752, 1926, - /* 2580 */ 2388, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, - /* 2590 */ 2369, 1926, 2336, 2407, 751, 1926, 350, 2371, 755, 2373, - /* 2600 */ 2374, 750, 1926, 745, 1926, 1926, 2388, 1926, 1926, 1926, - /* 2610 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 2336, 1926, - /* 2620 */ 751, 1926, 2370, 1926, 1926, 1926, 1926, 1926, 1926, 1926, - /* 2630 */ 1926, 1926, 1926, 2369, 1926, 752, 2407, 1926, 1926, 359, - /* 2640 */ 2371, 755, 2373, 2374, 750, 1926, 745, 1926, 2370, 1926, - /* 2650 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 2369, - /* 2660 */ 1926, 752, 2407, 2388, 1926, 351, 2371, 755, 2373, 2374, - /* 2670 */ 750, 1926, 745, 1926, 1926, 2336, 1926, 751, 1926, 1926, - /* 2680 */ 2370, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 2388, - /* 2690 */ 1926, 1926, 1926, 752, 1926, 1926, 1926, 1926, 1926, 1926, - /* 2700 */ 1926, 2336, 1926, 751, 1926, 1926, 1926, 1926, 1926, 1926, - /* 2710 */ 1926, 1926, 1926, 1926, 1926, 1926, 2369, 1926, 2370, 2407, - /* 2720 */ 1926, 2388, 360, 2371, 755, 2373, 2374, 750, 1926, 745, - /* 2730 */ 1926, 752, 1926, 2336, 1926, 751, 1926, 1926, 1926, 1926, - /* 2740 */ 1926, 1926, 2369, 1926, 1926, 2407, 1926, 1926, 352, 2371, - /* 2750 */ 755, 2373, 2374, 750, 1926, 745, 1926, 1926, 1926, 2388, - /* 2760 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, - /* 2770 */ 1926, 2336, 1926, 751, 2369, 1926, 1926, 2407, 1926, 1926, - /* 2780 */ 366, 2371, 755, 2373, 2374, 750, 2370, 745, 1926, 1926, - /* 2790 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 752, - /* 2800 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, - /* 2810 */ 1926, 2370, 2369, 1926, 1926, 2407, 1926, 1926, 367, 2371, - /* 2820 */ 755, 2373, 2374, 750, 752, 745, 1926, 2388, 1926, 1926, - /* 2830 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 2336, - /* 2840 */ 1926, 751, 1926, 2370, 1926, 1926, 1926, 1926, 1926, 1926, - /* 2850 */ 1926, 1926, 2388, 1926, 1926, 1926, 752, 1926, 1926, 1926, - /* 2860 */ 1926, 1926, 1926, 1926, 2336, 1926, 751, 1926, 1926, 2370, - /* 2870 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, - /* 2880 */ 2369, 1926, 752, 2407, 2388, 1926, 2382, 2371, 755, 2373, - /* 2890 */ 2374, 750, 1926, 745, 1926, 1926, 2336, 1926, 751, 1926, - /* 2900 */ 1926, 1926, 1926, 1926, 1926, 2369, 1926, 1926, 2407, 1926, - /* 2910 */ 2388, 2381, 2371, 755, 2373, 2374, 750, 1926, 745, 1926, - /* 2920 */ 1926, 1926, 2336, 1926, 751, 1926, 1926, 1926, 1926, 1926, - /* 2930 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 2369, 2370, 1926, - /* 2940 */ 2407, 1926, 1926, 2380, 2371, 755, 2373, 2374, 750, 1926, - /* 2950 */ 745, 752, 1926, 1926, 2370, 1926, 1926, 1926, 1926, 1926, - /* 2960 */ 1926, 1926, 1926, 2369, 1926, 1926, 2407, 752, 1926, 381, - /* 2970 */ 2371, 755, 2373, 2374, 750, 1926, 745, 1926, 1926, 2388, - /* 2980 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, - /* 2990 */ 1926, 2336, 1926, 751, 1926, 2388, 1926, 1926, 1926, 1926, - /* 3000 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 2336, 1926, 751, - /* 3010 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, - /* 3020 */ 1926, 2370, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, - /* 3030 */ 1926, 1926, 2369, 1926, 752, 2407, 1926, 2370, 382, 2371, - /* 3040 */ 755, 2373, 2374, 750, 1926, 745, 1926, 1926, 2369, 1926, - /* 3050 */ 752, 2407, 1926, 2370, 378, 2371, 755, 2373, 2374, 750, - /* 3060 */ 1926, 745, 2388, 1926, 1926, 1926, 752, 1926, 1926, 1926, - /* 3070 */ 1926, 1926, 1926, 1926, 2336, 1926, 751, 1926, 2388, 1926, - /* 3080 */ 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, 1926, - /* 3090 */ 2336, 1926, 751, 1926, 2388, 1926, 1926, 1926, 1926, 1926, - /* 3100 */ 1926, 1926, 1926, 1926, 1926, 1926, 2336, 1926, 751, 1926, - /* 3110 */ 1926, 1926, 1926, 1926, 1926, 2369, 1926, 1926, 2407, 1926, - /* 3120 */ 1926, 383, 2371, 755, 2373, 2374, 750, 1926, 745, 1926, - /* 3130 */ 1926, 753, 1926, 1926, 2407, 1926, 1926, 357, 2371, 755, - /* 3140 */ 2373, 2374, 750, 1926, 745, 1926, 1926, 2369, 1926, 1926, - /* 3150 */ 2407, 1926, 1926, 356, 2371, 755, 2373, 2374, 750, 1926, - /* 3160 */ 745, + /* 0 */ 2266, 570, 478, 471, 571, 1981, 578, 708, 470, 571, + /* 10 */ 1981, 1961, 48, 46, 1858, 2572, 106, 34, 2264, 728, + /* 20 */ 422, 740, 1682, 41, 40, 650, 1320, 47, 45, 44, + /* 30 */ 43, 42, 1706, 707, 208, 1767, 2024, 1680, 2573, 709, + /* 40 */ 648, 2121, 646, 273, 272, 2386, 587, 537, 535, 1707, + /* 50 */ 371, 14, 13, 678, 221, 720, 147, 2266, 723, 189, + /* 60 */ 1707, 2572, 41, 40, 2352, 1762, 47, 45, 44, 43, + /* 70 */ 42, 19, 415, 740, 2577, 2263, 728, 715, 1688, 2578, + /* 80 */ 208, 389, 2572, 2246, 2573, 709, 2404, 201, 427, 41, + /* 90 */ 40, 2174, 2176, 47, 45, 44, 43, 42, 2352, 2168, + /* 100 */ 757, 2576, 588, 2259, 852, 2573, 2575, 15, 51, 827, + /* 110 */ 826, 825, 824, 434, 63, 823, 822, 152, 817, 816, + /* 120 */ 815, 814, 813, 812, 811, 151, 805, 804, 803, 433, + /* 130 */ 432, 800, 799, 798, 188, 187, 797, 677, 181, 2385, + /* 140 */ 302, 1682, 2423, 1769, 1770, 114, 2387, 761, 2389, 2390, + /* 150 */ 756, 1337, 751, 1336, 112, 455, 1680, 191, 1810, 2476, + /* 160 */ 431, 430, 1900, 418, 2472, 184, 2484, 719, 143, 139, + /* 170 */ 718, 148, 741, 2128, 2333, 2181, 2577, 2572, 740, 2120, + /* 180 */ 1742, 1752, 387, 209, 2572, 1689, 1338, 1768, 1771, 1874, + /* 190 */ 2179, 2523, 138, 720, 147, 707, 208, 1688, 425, 613, + /* 200 */ 2573, 709, 1683, 2576, 1681, 1708, 169, 2573, 2574, 1581, + /* 210 */ 1582, 41, 40, 404, 2130, 47, 45, 44, 43, 42, + /* 220 */ 2104, 2179, 128, 852, 1707, 127, 126, 125, 124, 123, + /* 230 */ 122, 121, 120, 119, 1686, 1687, 1739, 661, 1741, 1744, + /* 240 */ 1745, 1746, 1747, 1748, 1749, 1750, 1751, 753, 749, 1760, + /* 250 */ 1761, 1763, 1764, 1765, 1766, 2, 48, 46, 2577, 174, + /* 260 */ 708, 369, 1708, 1705, 422, 51, 1682, 2067, 2572, 61, + /* 270 */ 521, 189, 2386, 540, 381, 1710, 241, 675, 539, 1767, + /* 280 */ 573, 1680, 1989, 459, 2215, 755, 707, 208, 309, 276, + /* 290 */ 796, 2573, 709, 275, 501, 2247, 541, 741, 2128, 741, + /* 300 */ 2128, 370, 503, 117, 2484, 2485, 807, 145, 2489, 1762, + /* 310 */ 461, 457, 481, 2404, 575, 19, 1475, 138, 1796, 212, + /* 320 */ 572, 1683, 1688, 1681, 618, 2352, 1418, 757, 1510, 1511, + /* 330 */ 1466, 786, 785, 784, 1470, 783, 1472, 1473, 782, 779, + /* 340 */ 586, 1481, 776, 1483, 1484, 773, 770, 767, 852, 390, + /* 350 */ 716, 15, 1692, 1686, 1687, 697, 9, 68, 38, 325, + /* 360 */ 489, 2027, 98, 1924, 1960, 376, 2385, 1420, 402, 2423, + /* 370 */ 652, 809, 361, 2387, 761, 2389, 2390, 756, 754, 751, + /* 380 */ 742, 2441, 1797, 2404, 1743, 1601, 1602, 1769, 1770, 531, + /* 390 */ 2253, 2232, 2491, 528, 527, 526, 525, 520, 519, 518, + /* 400 */ 517, 373, 214, 1318, 693, 507, 506, 505, 504, 498, + /* 410 */ 497, 496, 590, 491, 490, 388, 1862, 2352, 2488, 482, + /* 420 */ 1569, 1570, 1707, 1833, 1742, 1752, 1588, 1316, 1317, 1600, + /* 430 */ 1603, 1768, 1771, 95, 632, 631, 630, 307, 63, 309, + /* 440 */ 1740, 622, 144, 626, 696, 514, 1683, 625, 1681, 513, + /* 450 */ 391, 231, 624, 629, 397, 396, 662, 512, 623, 2123, + /* 460 */ 63, 619, 37, 420, 1791, 1792, 1793, 1794, 1795, 1799, + /* 470 */ 1800, 1801, 1802, 1833, 698, 530, 529, 796, 1686, 1687, + /* 480 */ 1739, 659, 1741, 1744, 1745, 1746, 1747, 1748, 1749, 1750, + /* 490 */ 1751, 753, 749, 1760, 1761, 1763, 1764, 1765, 1766, 2, + /* 500 */ 12, 48, 46, 2181, 2386, 699, 694, 687, 1959, 422, + /* 510 */ 403, 1682, 47, 45, 44, 43, 42, 758, 2179, 243, + /* 520 */ 632, 631, 630, 573, 1767, 1989, 1680, 622, 144, 626, + /* 530 */ 580, 2305, 469, 625, 468, 1830, 1831, 1832, 624, 629, + /* 540 */ 397, 396, 2386, 1881, 623, 2404, 12, 619, 1939, 1835, + /* 550 */ 1836, 1837, 1838, 1839, 1762, 723, 1777, 2352, 1882, 757, + /* 560 */ 19, 2352, 1707, 743, 467, 2448, 1889, 1688, 1833, 128, + /* 570 */ 2175, 2176, 127, 126, 125, 124, 123, 122, 121, 120, + /* 580 */ 119, 787, 1743, 2404, 2496, 1830, 1831, 1832, 2496, 2496, + /* 590 */ 2496, 2496, 2496, 852, 1711, 2352, 15, 757, 2385, 1880, + /* 600 */ 2386, 2423, 487, 2242, 114, 2387, 761, 2389, 2390, 756, + /* 610 */ 1688, 751, 309, 758, 150, 1991, 157, 2447, 2476, 1707, + /* 620 */ 741, 2128, 418, 2472, 690, 689, 1887, 1888, 1890, 1891, + /* 630 */ 1892, 52, 1769, 1770, 309, 1710, 2385, 1855, 1740, 2423, + /* 640 */ 56, 2404, 114, 2387, 761, 2389, 2390, 756, 227, 751, + /* 650 */ 330, 223, 36, 2352, 191, 757, 2476, 2117, 41, 40, + /* 660 */ 418, 2472, 47, 45, 44, 43, 42, 41, 40, 1742, + /* 670 */ 1752, 47, 45, 44, 43, 42, 1768, 1771, 99, 2496, + /* 680 */ 1830, 1831, 1832, 2496, 2496, 2496, 2496, 2496, 2524, 90, + /* 690 */ 1739, 1683, 89, 1681, 2385, 741, 2128, 2423, 277, 2113, + /* 700 */ 114, 2387, 761, 2389, 2390, 756, 63, 751, 567, 1629, + /* 710 */ 493, 2242, 2592, 1798, 2476, 475, 2115, 565, 418, 2472, + /* 720 */ 561, 557, 1743, 1686, 1687, 1739, 2111, 1741, 1744, 1745, + /* 730 */ 1746, 1747, 1748, 1749, 1750, 1751, 753, 749, 1760, 1761, + /* 740 */ 1763, 1764, 1765, 1766, 2, 48, 46, 1772, 2491, 2386, + /* 750 */ 617, 741, 2128, 422, 616, 1682, 199, 660, 88, 225, + /* 760 */ 523, 2242, 758, 2199, 2531, 175, 2132, 1950, 1767, 2105, + /* 770 */ 1680, 476, 741, 2128, 2487, 855, 1650, 1651, 1740, 41, + /* 780 */ 40, 2386, 1958, 47, 45, 44, 43, 42, 741, 2128, + /* 790 */ 2404, 332, 495, 35, 758, 662, 2544, 307, 1762, 1938, + /* 800 */ 741, 2128, 2352, 1803, 757, 309, 712, 198, 508, 230, + /* 810 */ 1712, 1688, 741, 2128, 609, 608, 843, 839, 835, 831, + /* 820 */ 509, 329, 2404, 137, 136, 135, 134, 133, 132, 131, + /* 830 */ 130, 129, 510, 1430, 2352, 2352, 757, 852, 741, 2128, + /* 840 */ 49, 720, 147, 2385, 741, 2128, 2423, 1311, 1429, 114, + /* 850 */ 2387, 761, 2389, 2390, 756, 745, 751, 2448, 589, 741, + /* 860 */ 2128, 2592, 113, 2476, 2125, 323, 1318, 418, 2472, 664, + /* 870 */ 2305, 1957, 741, 2128, 202, 2385, 1769, 1770, 2423, 279, + /* 880 */ 309, 114, 2387, 761, 2389, 2390, 756, 2181, 751, 1313, + /* 890 */ 1316, 1317, 287, 2592, 412, 2476, 1711, 737, 2103, 418, + /* 900 */ 2472, 1337, 2179, 1336, 2386, 794, 162, 161, 791, 790, + /* 910 */ 789, 159, 2336, 1742, 1752, 542, 1854, 758, 2491, 685, + /* 920 */ 1768, 1771, 516, 515, 2352, 2362, 41, 40, 741, 2128, + /* 930 */ 47, 45, 44, 43, 42, 1683, 1338, 1681, 1711, 2119, + /* 940 */ 312, 1956, 720, 147, 2486, 2404, 1936, 311, 726, 2366, + /* 950 */ 722, 177, 2484, 2485, 416, 145, 2489, 2352, 2068, 757, + /* 960 */ 1340, 1341, 172, 444, 1955, 1931, 281, 1686, 1687, 1739, + /* 970 */ 2130, 1741, 1744, 1745, 1746, 1747, 1748, 1749, 1750, 1751, + /* 980 */ 753, 749, 1760, 1761, 1763, 1764, 1765, 1766, 2, 48, + /* 990 */ 46, 611, 610, 2368, 2352, 741, 2128, 422, 2385, 1682, + /* 1000 */ 12, 2423, 10, 751, 114, 2387, 761, 2389, 2390, 756, + /* 1010 */ 1954, 751, 1767, 639, 1680, 320, 2592, 2352, 2476, 316, + /* 1020 */ 317, 172, 418, 2472, 315, 437, 741, 2128, 651, 2131, + /* 1030 */ 436, 3, 2386, 425, 794, 162, 161, 791, 790, 789, + /* 1040 */ 159, 172, 1762, 54, 274, 758, 738, 2565, 1711, 2130, + /* 1050 */ 741, 2128, 178, 2484, 2485, 1688, 145, 2489, 203, 1707, + /* 1060 */ 642, 284, 2362, 2352, 2181, 2181, 1951, 636, 634, 2386, + /* 1070 */ 739, 417, 426, 2404, 271, 678, 2371, 713, 1930, 2179, + /* 1080 */ 2179, 852, 758, 2572, 49, 2352, 2366, 757, 741, 2128, + /* 1090 */ 2386, 41, 40, 741, 2128, 47, 45, 44, 43, 42, + /* 1100 */ 204, 2578, 208, 758, 1434, 2508, 2573, 709, 326, 1953, + /* 1110 */ 2404, 2576, 1712, 429, 1952, 72, 1966, 847, 71, 1433, + /* 1120 */ 1769, 1770, 2352, 2181, 757, 810, 2385, 1949, 2089, 2423, + /* 1130 */ 2368, 2404, 114, 2387, 761, 2389, 2390, 756, 727, 751, + /* 1140 */ 751, 628, 627, 2352, 2592, 757, 2476, 44, 43, 42, + /* 1150 */ 418, 2472, 428, 1948, 1712, 821, 819, 1742, 1752, 95, + /* 1160 */ 172, 1947, 2352, 2385, 1768, 1771, 2423, 2352, 2130, 115, + /* 1170 */ 2387, 761, 2389, 2390, 756, 752, 751, 395, 394, 1683, + /* 1180 */ 2352, 1681, 1946, 2476, 2385, 2124, 544, 2423, 2473, 1945, + /* 1190 */ 114, 2387, 761, 2389, 2390, 756, 149, 751, 1944, 2447, + /* 1200 */ 1943, 1942, 2592, 2314, 2476, 702, 2352, 1941, 418, 2472, + /* 1210 */ 160, 1686, 1687, 1739, 2352, 1741, 1744, 1745, 1746, 1747, + /* 1220 */ 1748, 1749, 1750, 1751, 753, 749, 1760, 1761, 1763, 1764, + /* 1230 */ 1765, 1766, 2, 48, 46, 2352, 788, 792, 2225, 2172, + /* 1240 */ 2172, 422, 2352, 1682, 2181, 2345, 76, 2181, 181, 393, + /* 1250 */ 392, 2352, 615, 2352, 2352, 2386, 1767, 278, 1680, 736, + /* 1260 */ 2352, 2346, 2180, 793, 1712, 171, 2172, 2362, 758, 339, + /* 1270 */ 1844, 2106, 2158, 160, 617, 1740, 2386, 620, 616, 264, + /* 1280 */ 485, 2370, 262, 621, 266, 55, 1762, 265, 140, 758, + /* 1290 */ 268, 2366, 2011, 267, 270, 678, 2404, 269, 87, 1688, + /* 1300 */ 86, 1415, 2009, 2572, 153, 1933, 1934, 1413, 2352, 160, + /* 1310 */ 757, 678, 2537, 654, 633, 653, 50, 2404, 173, 2572, + /* 1320 */ 303, 2578, 208, 345, 635, 852, 2573, 709, 15, 2352, + /* 1330 */ 288, 757, 14, 13, 2386, 2368, 419, 2578, 208, 2000, + /* 1340 */ 343, 74, 2573, 709, 73, 751, 748, 758, 1645, 2385, + /* 1350 */ 1998, 50, 2423, 721, 372, 179, 2387, 761, 2389, 2390, + /* 1360 */ 756, 637, 751, 2373, 1769, 1770, 239, 552, 550, 547, + /* 1370 */ 2385, 691, 640, 2423, 100, 2404, 114, 2387, 761, 2389, + /* 1380 */ 2390, 756, 1691, 751, 1648, 142, 1690, 2352, 2451, 757, + /* 1390 */ 2476, 1886, 41, 40, 418, 2472, 47, 45, 44, 43, + /* 1400 */ 42, 1742, 1752, 1373, 192, 801, 1992, 63, 1768, 1771, + /* 1410 */ 711, 160, 50, 314, 710, 2593, 2405, 30, 295, 2065, + /* 1420 */ 2064, 2375, 2251, 1683, 1982, 1681, 1885, 75, 2385, 1392, + /* 1430 */ 158, 2423, 160, 66, 114, 2387, 761, 2389, 2390, 756, + /* 1440 */ 111, 751, 50, 657, 1374, 64, 2449, 50, 2476, 108, + /* 1450 */ 2527, 688, 418, 2472, 408, 1686, 1687, 1739, 845, 1741, + /* 1460 */ 1744, 1745, 1746, 1747, 1748, 1749, 1750, 1751, 753, 749, + /* 1470 */ 1760, 1761, 1763, 1764, 1765, 1766, 2, 695, 663, 293, + /* 1480 */ 405, 431, 430, 435, 730, 724, 725, 1598, 318, 765, + /* 1490 */ 158, 1696, 1901, 678, 84, 83, 474, 2386, 2252, 220, + /* 1500 */ 160, 2572, 733, 141, 1767, 322, 1689, 1460, 1804, 1788, + /* 1510 */ 758, 1988, 466, 464, 2169, 158, 671, 1753, 802, 2578, + /* 1520 */ 208, 2528, 338, 368, 2573, 709, 453, 2386, 678, 450, + /* 1530 */ 446, 442, 439, 467, 1762, 678, 2572, 2538, 2404, 703, + /* 1540 */ 758, 704, 1390, 2572, 300, 2090, 305, 1688, 308, 1694, + /* 1550 */ 2352, 5, 757, 1693, 2578, 208, 438, 443, 451, 2573, + /* 1560 */ 709, 2578, 208, 452, 1488, 1492, 2573, 709, 2404, 385, + /* 1570 */ 1715, 463, 462, 747, 215, 1499, 216, 465, 1497, 218, + /* 1580 */ 2352, 309, 757, 794, 162, 161, 791, 790, 789, 159, + /* 1590 */ 163, 2385, 333, 1622, 2423, 2386, 1705, 114, 2387, 761, + /* 1600 */ 2389, 2390, 756, 479, 751, 1706, 486, 229, 758, 744, + /* 1610 */ 488, 2476, 494, 492, 533, 418, 2472, 511, 499, 522, + /* 1620 */ 2244, 2385, 524, 532, 2423, 534, 545, 115, 2387, 761, + /* 1630 */ 2389, 2390, 756, 543, 751, 546, 2404, 233, 2386, 234, + /* 1640 */ 548, 2476, 549, 1713, 568, 2475, 2472, 236, 2352, 4, + /* 1650 */ 757, 758, 551, 553, 569, 576, 577, 579, 1708, 581, + /* 1660 */ 1714, 1716, 582, 244, 92, 583, 585, 247, 1717, 591, + /* 1670 */ 250, 1697, 252, 1692, 612, 93, 2260, 94, 365, 2404, + /* 1680 */ 257, 643, 2323, 644, 116, 656, 2320, 2319, 658, 2385, + /* 1690 */ 97, 2352, 2423, 757, 666, 115, 2387, 761, 2389, 2390, + /* 1700 */ 756, 614, 751, 1700, 1702, 2118, 261, 2114, 263, 2476, + /* 1710 */ 154, 165, 166, 746, 2472, 2116, 280, 749, 1760, 1761, + /* 1720 */ 1763, 1764, 1765, 1766, 2112, 167, 168, 1709, 285, 665, + /* 1730 */ 673, 2386, 759, 692, 2543, 2423, 670, 8, 115, 2387, + /* 1740 */ 761, 2389, 2390, 756, 758, 751, 334, 667, 682, 2386, + /* 1750 */ 731, 2542, 2476, 290, 672, 2306, 380, 2472, 292, 2515, + /* 1760 */ 283, 701, 758, 683, 2386, 294, 183, 299, 680, 706, + /* 1770 */ 705, 296, 2404, 681, 409, 714, 717, 758, 2571, 2595, + /* 1780 */ 1710, 146, 1852, 1850, 2352, 195, 757, 729, 310, 2274, + /* 1790 */ 2404, 155, 2492, 335, 336, 297, 2273, 2272, 734, 414, + /* 1800 */ 735, 156, 2352, 337, 757, 2404, 105, 2386, 2129, 62, + /* 1810 */ 406, 107, 2173, 2457, 340, 1295, 328, 2352, 2495, 757, + /* 1820 */ 758, 763, 301, 846, 849, 2385, 164, 298, 2423, 2386, + /* 1830 */ 53, 176, 2387, 761, 2389, 2390, 756, 364, 751, 1, + /* 1840 */ 210, 851, 758, 2385, 304, 377, 2423, 349, 2404, 176, + /* 1850 */ 2387, 761, 2389, 2390, 756, 378, 751, 342, 2385, 363, + /* 1860 */ 2352, 2423, 757, 344, 362, 2387, 761, 2389, 2390, 756, + /* 1870 */ 2404, 751, 2386, 353, 2344, 407, 81, 2337, 679, 2534, + /* 1880 */ 2343, 2342, 2352, 440, 757, 758, 441, 1673, 1674, 213, + /* 1890 */ 445, 2335, 447, 448, 449, 1672, 2334, 2535, 386, 2332, + /* 1900 */ 454, 2385, 2386, 2331, 2423, 456, 2330, 355, 2387, 761, + /* 1910 */ 2389, 2390, 756, 2404, 751, 758, 458, 2329, 1661, 460, + /* 1920 */ 2310, 217, 2309, 2385, 219, 2352, 2423, 757, 82, 362, + /* 1930 */ 2387, 761, 2389, 2390, 756, 1625, 751, 1624, 2287, 2286, + /* 1940 */ 2285, 472, 2284, 2404, 473, 2283, 2234, 2231, 413, 477, + /* 1950 */ 1568, 480, 2230, 2224, 2221, 2352, 483, 757, 700, 484, + /* 1960 */ 222, 2220, 2219, 85, 2218, 2223, 2385, 2222, 2217, 2423, + /* 1970 */ 2386, 226, 179, 2387, 761, 2389, 2390, 756, 224, 751, + /* 1980 */ 2216, 2214, 2213, 755, 2212, 500, 2211, 502, 2209, 2208, + /* 1990 */ 2207, 2206, 2229, 2205, 259, 2204, 2385, 2203, 2227, 2423, + /* 2000 */ 2386, 2210, 362, 2387, 761, 2389, 2390, 756, 2202, 751, + /* 2010 */ 182, 2404, 2201, 758, 2200, 2198, 2197, 2196, 2195, 607, + /* 2020 */ 603, 599, 595, 2352, 258, 757, 2194, 2193, 228, 2192, + /* 2030 */ 91, 2191, 2594, 2190, 2189, 2386, 2228, 2226, 2188, 2187, + /* 2040 */ 2186, 2404, 1574, 232, 2185, 2184, 421, 2183, 758, 536, + /* 2050 */ 538, 2182, 1431, 2352, 374, 757, 375, 1435, 2030, 235, + /* 2060 */ 1427, 2029, 2028, 2026, 2385, 96, 556, 2423, 256, 2023, + /* 2070 */ 361, 2387, 761, 2389, 2390, 756, 2404, 751, 237, 2442, + /* 2080 */ 554, 423, 2022, 555, 238, 558, 2015, 562, 2352, 2002, + /* 2090 */ 757, 560, 559, 566, 2385, 564, 1977, 2423, 190, 240, + /* 2100 */ 362, 2387, 761, 2389, 2390, 756, 2386, 751, 563, 78, + /* 2110 */ 1976, 1319, 79, 2372, 2308, 242, 2304, 200, 2294, 758, + /* 2120 */ 574, 2282, 249, 251, 2281, 254, 2258, 2107, 2025, 2385, + /* 2130 */ 2021, 1366, 2423, 594, 246, 362, 2387, 761, 2389, 2390, + /* 2140 */ 756, 592, 751, 255, 248, 593, 2019, 2404, 596, 597, + /* 2150 */ 253, 584, 2017, 601, 598, 602, 600, 2014, 605, 2352, + /* 2160 */ 604, 757, 606, 1997, 2386, 1995, 1996, 1994, 1973, 245, + /* 2170 */ 2109, 1504, 1503, 2108, 1417, 65, 1416, 758, 1414, 2386, + /* 2180 */ 1412, 1411, 1410, 1403, 1409, 1408, 260, 818, 820, 2012, + /* 2190 */ 1405, 398, 758, 1404, 2010, 1402, 399, 2001, 400, 1999, + /* 2200 */ 655, 401, 638, 2423, 1972, 2404, 357, 2387, 761, 2389, + /* 2210 */ 2390, 756, 641, 751, 1971, 1970, 1969, 2352, 645, 757, + /* 2220 */ 2404, 647, 2386, 1968, 649, 118, 2307, 1655, 1657, 1654, + /* 2230 */ 1659, 1635, 2352, 2303, 757, 758, 29, 2386, 69, 1633, + /* 2240 */ 1631, 2293, 282, 668, 2280, 2279, 2577, 31, 6, 17, + /* 2250 */ 758, 170, 20, 21, 67, 22, 57, 58, 2385, 2386, + /* 2260 */ 669, 2423, 286, 2404, 347, 2387, 761, 2389, 2390, 756, + /* 2270 */ 1610, 751, 758, 2385, 674, 2352, 2423, 757, 2404, 346, + /* 2280 */ 2387, 761, 2389, 2390, 756, 1609, 751, 289, 676, 7, + /* 2290 */ 2352, 1903, 757, 684, 2386, 291, 194, 205, 686, 2373, + /* 2300 */ 2404, 33, 1845, 206, 1884, 24, 1847, 758, 180, 306, + /* 2310 */ 60, 23, 2352, 193, 757, 1873, 2385, 2386, 32, 2423, + /* 2320 */ 80, 1918, 348, 2387, 761, 2389, 2390, 756, 185, 751, + /* 2330 */ 758, 2385, 2386, 1843, 2423, 2404, 207, 354, 2387, 761, + /* 2340 */ 2389, 2390, 756, 1923, 751, 758, 1924, 2352, 1827, 757, + /* 2350 */ 1917, 410, 1922, 2385, 1921, 411, 2423, 1826, 2404, 358, + /* 2360 */ 2387, 761, 2389, 2390, 756, 18, 751, 2278, 2257, 101, + /* 2370 */ 2352, 59, 757, 2404, 102, 313, 2256, 103, 25, 324, + /* 2380 */ 108, 13, 1879, 196, 26, 2352, 732, 757, 2385, 319, + /* 2390 */ 70, 2423, 104, 321, 350, 2387, 761, 2389, 2390, 756, + /* 2400 */ 1779, 751, 1778, 2386, 1698, 2426, 1789, 1757, 750, 186, + /* 2410 */ 1755, 2385, 39, 16, 2423, 1754, 758, 359, 2387, 761, + /* 2420 */ 2389, 2390, 756, 27, 751, 1732, 2385, 2386, 11, 2423, + /* 2430 */ 197, 1724, 351, 2387, 761, 2389, 2390, 756, 28, 751, + /* 2440 */ 758, 762, 1489, 764, 2404, 424, 766, 760, 1486, 768, + /* 2450 */ 769, 771, 1485, 772, 774, 1482, 2352, 775, 757, 777, + /* 2460 */ 1476, 778, 780, 1474, 781, 1480, 1479, 327, 2404, 1478, + /* 2470 */ 1477, 109, 110, 1498, 1494, 795, 77, 1364, 1399, 1396, + /* 2480 */ 2352, 1395, 757, 1394, 1393, 1391, 1389, 1388, 1387, 1425, + /* 2490 */ 806, 1424, 808, 211, 1382, 1385, 2386, 2385, 1384, 1383, + /* 2500 */ 2423, 1381, 1380, 360, 2387, 761, 2389, 2390, 756, 758, + /* 2510 */ 751, 1379, 2386, 1421, 1419, 1376, 1375, 1372, 1370, 1371, + /* 2520 */ 1369, 2385, 2020, 828, 2423, 758, 829, 352, 2387, 761, + /* 2530 */ 2389, 2390, 756, 830, 751, 2018, 832, 2404, 833, 2386, + /* 2540 */ 834, 2016, 836, 837, 838, 2013, 840, 1993, 841, 2352, + /* 2550 */ 842, 757, 758, 2404, 844, 1308, 1967, 848, 1296, 331, + /* 2560 */ 850, 1937, 1684, 854, 341, 2352, 1937, 757, 1937, 2386, + /* 2570 */ 853, 1937, 1937, 1937, 1937, 1937, 1937, 1937, 1937, 1937, + /* 2580 */ 2404, 1937, 758, 1937, 1937, 1937, 1937, 1937, 1937, 1937, + /* 2590 */ 2385, 1937, 2352, 2423, 757, 1937, 366, 2387, 761, 2389, + /* 2600 */ 2390, 756, 1937, 751, 1937, 1937, 2385, 1937, 1937, 2423, + /* 2610 */ 2404, 1937, 367, 2387, 761, 2389, 2390, 756, 1937, 751, + /* 2620 */ 1937, 1937, 2352, 1937, 757, 1937, 1937, 1937, 1937, 1937, + /* 2630 */ 1937, 1937, 1937, 2385, 2386, 1937, 2423, 1937, 1937, 2398, + /* 2640 */ 2387, 761, 2389, 2390, 756, 1937, 751, 758, 1937, 1937, + /* 2650 */ 1937, 1937, 2386, 1937, 1937, 1937, 1937, 1937, 1937, 1937, + /* 2660 */ 1937, 1937, 1937, 2385, 1937, 758, 2423, 1937, 1937, 2397, + /* 2670 */ 2387, 761, 2389, 2390, 756, 2404, 751, 1937, 1937, 1937, + /* 2680 */ 1937, 1937, 1937, 1937, 1937, 1937, 1937, 2352, 1937, 757, + /* 2690 */ 1937, 1937, 1937, 2404, 1937, 1937, 1937, 1937, 1937, 1937, + /* 2700 */ 1937, 1937, 1937, 1937, 1937, 2352, 1937, 757, 1937, 2386, + /* 2710 */ 1937, 1937, 1937, 1937, 1937, 1937, 1937, 1937, 1937, 1937, + /* 2720 */ 1937, 1937, 758, 1937, 1937, 1937, 1937, 1937, 2385, 1937, + /* 2730 */ 1937, 2423, 2386, 1937, 2396, 2387, 761, 2389, 2390, 756, + /* 2740 */ 1937, 751, 1937, 1937, 1937, 758, 2385, 2386, 1937, 2423, + /* 2750 */ 2404, 1937, 382, 2387, 761, 2389, 2390, 756, 1937, 751, + /* 2760 */ 758, 1937, 2352, 1937, 757, 1937, 1937, 1937, 1937, 1937, + /* 2770 */ 1937, 1937, 1937, 2404, 1937, 1937, 1937, 1937, 1937, 1937, + /* 2780 */ 1937, 1937, 1937, 1937, 1937, 2352, 1937, 757, 2404, 1937, + /* 2790 */ 1937, 1937, 1937, 1937, 1937, 1937, 1937, 1937, 1937, 1937, + /* 2800 */ 2352, 1937, 757, 2385, 1937, 1937, 2423, 1937, 1937, 383, + /* 2810 */ 2387, 761, 2389, 2390, 756, 1937, 751, 1937, 2386, 1937, + /* 2820 */ 1937, 1937, 1937, 1937, 1937, 1937, 2385, 1937, 1937, 2423, + /* 2830 */ 1937, 758, 379, 2387, 761, 2389, 2390, 756, 1937, 751, + /* 2840 */ 1937, 2385, 2386, 1937, 2423, 1937, 1937, 384, 2387, 761, + /* 2850 */ 2389, 2390, 756, 1937, 751, 758, 1937, 1937, 1937, 2404, + /* 2860 */ 1937, 1937, 1937, 1937, 1937, 1937, 1937, 1937, 1937, 1937, + /* 2870 */ 1937, 2352, 1937, 757, 1937, 1937, 1937, 1937, 1937, 1937, + /* 2880 */ 1937, 1937, 1937, 2404, 1937, 1937, 1937, 1937, 1937, 1937, + /* 2890 */ 1937, 1937, 1937, 1937, 1937, 2352, 1937, 757, 1937, 1937, + /* 2900 */ 1937, 1937, 1937, 1937, 1937, 1937, 1937, 1937, 1937, 1937, + /* 2910 */ 1937, 1937, 759, 1937, 1937, 2423, 1937, 1937, 357, 2387, + /* 2920 */ 761, 2389, 2390, 756, 1937, 751, 1937, 1937, 1937, 1937, + /* 2930 */ 1937, 1937, 1937, 1937, 1937, 1937, 2385, 1937, 1937, 2423, + /* 2940 */ 1937, 1937, 356, 2387, 761, 2389, 2390, 756, 1937, 751, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 366, 378, 392, 369, 370, 366, 401, 485, 369, 370, - /* 10 */ 400, 396, 12, 13, 14, 493, 441, 407, 408, 400, - /* 20 */ 20, 0, 22, 8, 9, 415, 403, 12, 13, 14, - /* 30 */ 15, 16, 381, 511, 512, 35, 0, 37, 516, 517, - /* 40 */ 389, 422, 21, 424, 359, 24, 25, 26, 27, 28, - /* 50 */ 29, 30, 31, 32, 8, 9, 0, 372, 12, 13, - /* 60 */ 14, 15, 16, 0, 64, 450, 20, 8, 9, 400, - /* 70 */ 70, 12, 13, 14, 15, 16, 407, 77, 22, 3, - /* 80 */ 371, 371, 372, 21, 415, 400, 414, 24, 25, 26, - /* 90 */ 27, 28, 29, 30, 31, 32, 20, 412, 36, 414, - /* 100 */ 38, 39, 40, 103, 432, 433, 106, 371, 72, 73, - /* 110 */ 74, 75, 76, 69, 78, 79, 80, 81, 82, 83, + /* 0 */ 416, 368, 373, 437, 371, 372, 368, 487, 442, 371, + /* 10 */ 372, 361, 12, 13, 14, 495, 380, 2, 434, 435, + /* 20 */ 20, 20, 22, 8, 9, 21, 14, 12, 13, 14, + /* 30 */ 15, 16, 20, 513, 514, 35, 0, 37, 518, 519, + /* 40 */ 36, 405, 38, 39, 40, 361, 373, 418, 419, 20, + /* 50 */ 421, 1, 2, 487, 425, 373, 374, 416, 374, 402, + /* 60 */ 20, 495, 8, 9, 414, 65, 12, 13, 14, 15, + /* 70 */ 16, 71, 431, 20, 487, 434, 435, 33, 78, 513, + /* 80 */ 514, 424, 495, 426, 518, 519, 402, 401, 412, 8, + /* 90 */ 9, 415, 416, 12, 13, 14, 15, 16, 414, 413, + /* 100 */ 416, 514, 429, 430, 104, 518, 519, 107, 107, 73, + /* 110 */ 74, 75, 76, 77, 107, 79, 80, 81, 82, 83, /* 120 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - /* 130 */ 94, 95, 96, 97, 98, 99, 427, 428, 453, 20, - /* 140 */ 13, 456, 142, 143, 459, 460, 461, 462, 463, 464, - /* 150 */ 400, 466, 416, 417, 0, 419, 471, 407, 473, 423, - /* 160 */ 371, 372, 477, 478, 21, 415, 107, 24, 25, 26, - /* 170 */ 27, 28, 29, 30, 31, 32, 69, 177, 178, 106, - /* 180 */ 391, 0, 497, 107, 184, 185, 20, 398, 371, 372, - /* 190 */ 505, 481, 482, 483, 367, 485, 486, 485, 371, 199, - /* 200 */ 373, 201, 86, 493, 77, 493, 191, 435, 391, 20, - /* 210 */ 8, 9, 440, 14, 12, 13, 14, 15, 16, 20, - /* 220 */ 20, 511, 512, 69, 512, 179, 516, 517, 516, 517, - /* 230 */ 137, 231, 232, 233, 141, 235, 236, 237, 238, 239, + /* 130 */ 94, 95, 96, 97, 98, 99, 100, 50, 489, 455, + /* 140 */ 491, 22, 458, 143, 144, 461, 462, 463, 464, 465, + /* 150 */ 466, 20, 468, 22, 380, 69, 37, 473, 108, 475, + /* 160 */ 12, 13, 108, 479, 480, 483, 484, 485, 37, 487, + /* 170 */ 488, 397, 373, 374, 0, 402, 487, 495, 20, 405, + /* 180 */ 180, 181, 409, 499, 495, 37, 55, 187, 188, 108, + /* 190 */ 417, 507, 393, 373, 374, 513, 514, 78, 394, 400, + /* 200 */ 518, 519, 202, 514, 204, 20, 402, 518, 519, 180, + /* 210 */ 181, 8, 9, 409, 410, 12, 13, 14, 15, 16, + /* 220 */ 0, 417, 21, 104, 20, 24, 25, 26, 27, 28, + /* 230 */ 29, 30, 31, 32, 234, 235, 236, 20, 238, 239, /* 240 */ 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - /* 250 */ 250, 251, 252, 12, 13, 179, 399, 485, 18, 400, - /* 260 */ 20, 20, 414, 22, 148, 493, 407, 27, 411, 359, - /* 270 */ 30, 198, 70, 200, 415, 35, 35, 429, 37, 233, - /* 280 */ 432, 433, 372, 511, 512, 400, 170, 171, 516, 517, - /* 290 */ 371, 51, 407, 53, 485, 106, 177, 178, 58, 388, - /* 300 */ 415, 208, 493, 230, 211, 64, 37, 214, 68, 216, - /* 310 */ 400, 70, 20, 402, 23, 20, 114, 487, 77, 489, - /* 320 */ 305, 512, 412, 412, 414, 516, 517, 359, 267, 268, - /* 330 */ 269, 270, 271, 272, 273, 274, 275, 276, 47, 48, - /* 340 */ 372, 20, 374, 0, 103, 105, 77, 106, 268, 269, - /* 350 */ 270, 271, 279, 183, 8, 9, 116, 400, 12, 13, - /* 360 */ 14, 15, 16, 453, 445, 446, 456, 456, 400, 459, - /* 370 */ 460, 461, 462, 463, 464, 20, 466, 466, 176, 33, - /* 380 */ 412, 424, 414, 142, 143, 387, 146, 147, 390, 149, - /* 390 */ 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - /* 400 */ 160, 161, 162, 163, 164, 165, 225, 167, 168, 169, - /* 410 */ 12, 13, 106, 173, 174, 175, 506, 507, 177, 178, - /* 420 */ 180, 453, 68, 172, 456, 184, 185, 459, 460, 461, - /* 430 */ 462, 463, 464, 233, 466, 37, 20, 142, 143, 471, - /* 440 */ 199, 473, 201, 474, 475, 477, 478, 231, 272, 273, - /* 450 */ 274, 275, 276, 107, 203, 285, 286, 287, 256, 257, - /* 460 */ 258, 259, 260, 261, 262, 263, 264, 265, 266, 371, - /* 470 */ 372, 179, 231, 232, 233, 106, 235, 236, 237, 238, - /* 480 */ 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, - /* 490 */ 249, 250, 251, 252, 253, 12, 13, 142, 143, 35, - /* 500 */ 253, 359, 255, 20, 161, 22, 290, 291, 292, 293, - /* 510 */ 294, 295, 296, 170, 372, 51, 371, 372, 35, 4, - /* 520 */ 37, 372, 106, 59, 60, 61, 62, 116, 64, 135, - /* 530 */ 136, 137, 138, 139, 140, 141, 391, 359, 359, 184, - /* 540 */ 185, 20, 400, 398, 388, 371, 372, 64, 194, 400, - /* 550 */ 372, 367, 20, 70, 412, 371, 414, 373, 402, 20, - /* 560 */ 77, 136, 137, 371, 372, 20, 141, 22, 412, 105, - /* 570 */ 380, 458, 108, 22, 4, 221, 222, 166, 400, 481, - /* 580 */ 482, 483, 37, 485, 486, 279, 103, 397, 37, 106, - /* 590 */ 412, 412, 414, 23, 420, 453, 406, 484, 456, 201, - /* 600 */ 55, 459, 460, 461, 462, 463, 464, 0, 466, 458, - /* 610 */ 461, 469, 456, 471, 472, 473, 46, 47, 48, 477, - /* 620 */ 478, 106, 466, 371, 372, 142, 143, 106, 77, 116, - /* 630 */ 358, 453, 360, 388, 456, 484, 172, 459, 460, 461, - /* 640 */ 462, 463, 464, 391, 466, 181, 182, 402, 279, 471, - /* 650 */ 42, 473, 188, 189, 103, 477, 478, 412, 253, 410, - /* 660 */ 177, 178, 413, 414, 64, 56, 57, 184, 185, 371, - /* 670 */ 372, 207, 480, 481, 482, 483, 77, 485, 486, 72, - /* 680 */ 73, 74, 199, 505, 201, 0, 79, 80, 81, 391, - /* 690 */ 371, 372, 85, 371, 372, 279, 392, 90, 91, 92, - /* 700 */ 93, 456, 457, 96, 400, 105, 99, 14, 108, 20, - /* 710 */ 391, 466, 408, 20, 231, 232, 233, 116, 235, 236, - /* 720 */ 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, - /* 730 */ 247, 248, 249, 250, 251, 252, 12, 13, 14, 359, - /* 740 */ 359, 20, 420, 371, 20, 470, 22, 472, 103, 470, - /* 750 */ 199, 472, 201, 372, 0, 374, 371, 372, 215, 35, - /* 760 */ 217, 37, 117, 118, 119, 120, 121, 122, 123, 124, - /* 770 */ 125, 126, 172, 128, 129, 130, 131, 132, 133, 134, - /* 780 */ 14, 400, 231, 232, 22, 20, 20, 33, 64, 72, - /* 790 */ 73, 74, 412, 412, 279, 414, 79, 80, 81, 37, - /* 800 */ 279, 77, 85, 469, 400, 420, 472, 90, 91, 92, - /* 810 */ 93, 407, 359, 96, 413, 414, 99, 445, 446, 415, - /* 820 */ 135, 136, 137, 138, 139, 140, 141, 103, 376, 377, - /* 830 */ 106, 371, 372, 359, 453, 376, 377, 456, 4, 77, - /* 840 */ 459, 460, 461, 462, 463, 464, 372, 466, 374, 14, - /* 850 */ 2, 391, 471, 19, 473, 20, 8, 9, 477, 478, - /* 860 */ 12, 13, 14, 15, 16, 412, 142, 143, 179, 35, - /* 870 */ 177, 371, 372, 136, 400, 267, 268, 269, 270, 271, - /* 880 */ 272, 273, 274, 275, 276, 51, 412, 392, 414, 485, - /* 890 */ 34, 391, 58, 359, 401, 400, 409, 493, 64, 412, - /* 900 */ 179, 177, 178, 408, 371, 372, 8, 9, 184, 185, - /* 910 */ 12, 13, 14, 15, 16, 511, 512, 50, 380, 401, - /* 920 */ 516, 517, 233, 199, 391, 201, 233, 453, 371, 372, - /* 930 */ 456, 435, 401, 459, 460, 461, 462, 463, 464, 105, - /* 940 */ 466, 33, 108, 177, 406, 471, 412, 473, 391, 212, - /* 950 */ 213, 477, 478, 45, 233, 231, 232, 233, 389, 235, - /* 960 */ 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, - /* 970 */ 246, 247, 248, 249, 250, 251, 252, 12, 13, 359, - /* 980 */ 22, 485, 1, 2, 20, 20, 22, 22, 3, 493, - /* 990 */ 371, 372, 372, 400, 374, 37, 371, 372, 233, 233, - /* 1000 */ 35, 408, 37, 51, 458, 107, 378, 511, 512, 359, - /* 1010 */ 391, 59, 516, 517, 62, 63, 391, 356, 4, 55, - /* 1020 */ 400, 0, 372, 395, 374, 371, 372, 371, 372, 64, - /* 1030 */ 484, 403, 412, 20, 414, 12, 13, 14, 15, 16, - /* 1040 */ 371, 372, 77, 371, 372, 2, 179, 391, 39, 40, - /* 1050 */ 400, 8, 9, 20, 187, 12, 13, 14, 15, 16, - /* 1060 */ 391, 103, 412, 391, 414, 371, 372, 0, 103, 371, - /* 1070 */ 372, 106, 22, 453, 371, 372, 456, 385, 386, 459, - /* 1080 */ 460, 461, 462, 463, 464, 391, 466, 37, 107, 391, - /* 1090 */ 33, 471, 409, 473, 391, 412, 435, 477, 478, 359, - /* 1100 */ 400, 440, 45, 453, 371, 372, 456, 142, 143, 459, - /* 1110 */ 460, 461, 462, 463, 464, 415, 466, 359, 51, 110, - /* 1120 */ 111, 471, 113, 473, 391, 8, 9, 477, 478, 12, - /* 1130 */ 13, 14, 15, 16, 135, 481, 482, 483, 139, 485, - /* 1140 */ 486, 359, 177, 178, 135, 176, 485, 33, 139, 184, - /* 1150 */ 185, 33, 412, 103, 493, 392, 135, 136, 137, 138, - /* 1160 */ 139, 140, 141, 400, 199, 70, 201, 371, 372, 359, - /* 1170 */ 412, 408, 511, 512, 435, 8, 9, 516, 517, 12, - /* 1180 */ 13, 14, 15, 16, 359, 359, 359, 391, 385, 386, - /* 1190 */ 177, 14, 15, 16, 412, 435, 231, 232, 233, 359, - /* 1200 */ 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - /* 1210 */ 245, 246, 247, 248, 249, 250, 251, 252, 12, 13, - /* 1220 */ 359, 359, 412, 401, 485, 256, 20, 359, 22, 1, - /* 1230 */ 33, 359, 493, 359, 13, 266, 0, 412, 412, 412, - /* 1240 */ 372, 35, 374, 37, 359, 485, 233, 19, 359, 359, - /* 1250 */ 511, 512, 412, 493, 400, 516, 517, 13, 409, 393, - /* 1260 */ 400, 412, 396, 35, 362, 363, 233, 13, 400, 415, - /* 1270 */ 64, 511, 512, 412, 412, 415, 516, 517, 42, 51, - /* 1280 */ 412, 37, 414, 77, 412, 300, 412, 59, 60, 61, - /* 1290 */ 62, 37, 64, 0, 435, 281, 179, 412, 77, 33, - /* 1300 */ 109, 412, 412, 112, 107, 109, 33, 109, 112, 103, - /* 1310 */ 112, 109, 106, 0, 112, 22, 435, 64, 142, 143, - /* 1320 */ 33, 453, 33, 401, 456, 33, 231, 459, 460, 461, - /* 1330 */ 462, 463, 464, 105, 466, 22, 108, 12, 13, 471, - /* 1340 */ 33, 473, 401, 33, 485, 477, 478, 22, 142, 143, - /* 1350 */ 360, 33, 493, 33, 49, 33, 33, 1, 2, 33, - /* 1360 */ 35, 108, 37, 106, 37, 37, 485, 37, 140, 359, - /* 1370 */ 511, 512, 115, 107, 493, 516, 517, 13, 425, 13, - /* 1380 */ 107, 487, 372, 177, 178, 33, 509, 33, 33, 64, - /* 1390 */ 184, 185, 511, 512, 107, 520, 107, 516, 517, 107, - /* 1400 */ 488, 37, 77, 37, 77, 199, 375, 201, 502, 181, - /* 1410 */ 400, 106, 0, 388, 107, 400, 188, 107, 304, 33, - /* 1420 */ 302, 33, 412, 33, 414, 107, 388, 107, 103, 107, - /* 1430 */ 107, 33, 425, 107, 370, 207, 425, 231, 232, 233, - /* 1440 */ 508, 235, 236, 237, 238, 239, 240, 241, 242, 243, - /* 1450 */ 244, 245, 246, 247, 248, 249, 250, 251, 252, 107, - /* 1460 */ 18, 107, 107, 453, 52, 23, 456, 508, 508, 459, - /* 1470 */ 460, 461, 462, 463, 464, 465, 466, 467, 468, 434, - /* 1480 */ 508, 375, 40, 41, 425, 372, 44, 359, 411, 442, - /* 1490 */ 425, 425, 492, 107, 492, 107, 54, 107, 479, 513, - /* 1500 */ 372, 495, 390, 51, 282, 107, 436, 65, 66, 67, - /* 1510 */ 68, 455, 42, 20, 454, 447, 214, 380, 447, 380, - /* 1520 */ 438, 452, 20, 371, 199, 20, 201, 372, 400, 201, - /* 1530 */ 197, 201, 421, 45, 372, 176, 421, 418, 372, 371, - /* 1540 */ 412, 371, 414, 421, 418, 418, 102, 104, 106, 384, - /* 1550 */ 371, 101, 383, 382, 371, 371, 231, 232, 371, 20, - /* 1560 */ 50, 368, 368, 364, 364, 380, 380, 447, 20, 380, - /* 1570 */ 245, 246, 247, 248, 249, 250, 251, 414, 20, 20, - /* 1580 */ 373, 453, 437, 380, 456, 373, 144, 459, 460, 461, - /* 1590 */ 462, 463, 464, 380, 466, 20, 380, 380, 371, 471, - /* 1600 */ 359, 473, 428, 380, 364, 477, 478, 364, 400, 400, - /* 1610 */ 400, 400, 362, 372, 400, 400, 371, 362, 400, 400, - /* 1620 */ 400, 218, 106, 359, 400, 400, 451, 449, 447, 378, - /* 1630 */ 20, 205, 444, 191, 192, 193, 372, 204, 196, 378, - /* 1640 */ 414, 400, 412, 359, 412, 412, 371, 446, 443, 412, - /* 1650 */ 289, 209, 210, 412, 501, 414, 372, 288, 501, 430, - /* 1660 */ 504, 190, 220, 503, 400, 223, 299, 436, 226, 227, - /* 1670 */ 228, 229, 230, 297, 501, 298, 412, 430, 414, 283, - /* 1680 */ 500, 499, 436, 278, 400, 277, 491, 306, 498, 372, - /* 1690 */ 303, 20, 301, 521, 453, 116, 412, 456, 414, 280, - /* 1700 */ 459, 460, 461, 462, 463, 464, 514, 466, 373, 378, - /* 1710 */ 458, 430, 471, 412, 473, 378, 412, 453, 477, 478, - /* 1720 */ 456, 279, 359, 459, 460, 461, 462, 463, 464, 490, - /* 1730 */ 466, 496, 494, 412, 182, 372, 412, 453, 430, 396, - /* 1740 */ 456, 412, 426, 459, 460, 461, 462, 463, 464, 515, - /* 1750 */ 466, 359, 378, 378, 372, 471, 106, 473, 476, 412, - /* 1760 */ 106, 477, 478, 400, 372, 371, 404, 378, 22, 38, - /* 1770 */ 361, 365, 431, 439, 364, 412, 431, 414, 394, 394, - /* 1780 */ 448, 379, 357, 0, 0, 0, 45, 394, 0, 37, - /* 1790 */ 224, 37, 400, 37, 37, 224, 0, 37, 37, 37, - /* 1800 */ 224, 0, 224, 0, 412, 37, 414, 0, 359, 37, - /* 1810 */ 0, 22, 0, 37, 219, 0, 453, 0, 207, 456, - /* 1820 */ 207, 372, 459, 460, 461, 462, 463, 464, 208, 466, - /* 1830 */ 201, 359, 199, 0, 0, 0, 473, 195, 194, 0, - /* 1840 */ 477, 478, 0, 147, 372, 453, 359, 49, 456, 400, - /* 1850 */ 0, 459, 460, 461, 462, 463, 464, 49, 466, 372, - /* 1860 */ 37, 412, 37, 414, 0, 473, 0, 51, 0, 477, - /* 1870 */ 478, 49, 400, 0, 45, 0, 0, 0, 0, 49, - /* 1880 */ 0, 0, 0, 0, 412, 0, 414, 400, 161, 37, - /* 1890 */ 0, 161, 0, 0, 0, 0, 0, 0, 0, 412, - /* 1900 */ 0, 414, 453, 0, 0, 456, 0, 0, 459, 460, - /* 1910 */ 461, 462, 463, 464, 0, 466, 359, 0, 0, 0, - /* 1920 */ 0, 49, 473, 0, 45, 453, 477, 478, 456, 372, - /* 1930 */ 0, 459, 460, 461, 462, 463, 464, 0, 466, 0, - /* 1940 */ 453, 359, 0, 456, 22, 0, 459, 460, 461, 462, - /* 1950 */ 463, 464, 0, 466, 372, 0, 0, 400, 147, 0, - /* 1960 */ 473, 50, 22, 22, 146, 478, 0, 0, 0, 412, - /* 1970 */ 0, 414, 145, 64, 50, 37, 0, 64, 0, 64, - /* 1980 */ 0, 0, 400, 37, 51, 42, 0, 405, 37, 0, - /* 1990 */ 518, 519, 42, 0, 412, 37, 414, 0, 51, 51, - /* 2000 */ 37, 14, 42, 49, 33, 0, 42, 45, 0, 0, - /* 2010 */ 453, 42, 359, 456, 49, 43, 459, 460, 461, 462, - /* 2020 */ 463, 464, 49, 466, 0, 372, 0, 42, 190, 0, - /* 2030 */ 0, 49, 0, 0, 0, 453, 37, 42, 456, 51, - /* 2040 */ 0, 459, 460, 461, 462, 463, 464, 37, 466, 51, - /* 2050 */ 71, 0, 37, 400, 42, 51, 42, 0, 405, 37, - /* 2060 */ 42, 0, 51, 0, 507, 412, 0, 414, 0, 0, - /* 2070 */ 0, 114, 37, 0, 22, 37, 0, 0, 37, 359, - /* 2080 */ 37, 37, 37, 37, 37, 37, 112, 37, 33, 33, - /* 2090 */ 37, 0, 372, 22, 22, 359, 37, 22, 0, 37, - /* 2100 */ 22, 0, 53, 0, 37, 0, 453, 0, 372, 456, - /* 2110 */ 359, 37, 459, 460, 461, 462, 463, 464, 22, 466, - /* 2120 */ 400, 37, 20, 372, 37, 37, 107, 106, 0, 106, - /* 2130 */ 49, 206, 412, 0, 414, 22, 400, 37, 0, 22, - /* 2140 */ 0, 0, 3, 33, 284, 50, 3, 50, 412, 107, - /* 2150 */ 414, 400, 33, 33, 179, 202, 405, 33, 49, 182, - /* 2160 */ 33, 49, 179, 412, 106, 414, 106, 102, 104, 179, - /* 2170 */ 179, 284, 37, 453, 0, 179, 456, 33, 186, 459, - /* 2180 */ 460, 461, 462, 463, 464, 106, 466, 186, 106, 453, - /* 2190 */ 107, 106, 456, 107, 33, 459, 460, 461, 462, 463, - /* 2200 */ 464, 107, 466, 77, 453, 359, 107, 456, 37, 37, - /* 2210 */ 459, 460, 461, 462, 463, 464, 284, 466, 372, 37, - /* 2220 */ 106, 359, 106, 37, 37, 107, 37, 49, 107, 107, - /* 2230 */ 510, 33, 107, 49, 372, 0, 106, 42, 106, 0, - /* 2240 */ 49, 107, 42, 107, 115, 33, 400, 2, 106, 104, - /* 2250 */ 22, 267, 106, 106, 106, 519, 254, 104, 412, 231, - /* 2260 */ 414, 106, 400, 183, 107, 106, 106, 405, 49, 107, - /* 2270 */ 181, 107, 106, 106, 412, 49, 414, 107, 22, 106, - /* 2280 */ 37, 116, 107, 37, 107, 106, 37, 106, 359, 37, - /* 2290 */ 107, 106, 37, 22, 37, 107, 106, 37, 106, 453, - /* 2300 */ 107, 372, 456, 359, 107, 459, 460, 461, 462, 463, - /* 2310 */ 464, 106, 466, 106, 468, 453, 372, 33, 456, 106, - /* 2320 */ 359, 459, 460, 461, 462, 463, 464, 234, 466, 400, - /* 2330 */ 127, 127, 37, 372, 405, 127, 127, 106, 71, 70, - /* 2340 */ 37, 412, 37, 414, 400, 37, 37, 37, 37, 37, - /* 2350 */ 37, 37, 77, 100, 77, 33, 412, 37, 414, 100, - /* 2360 */ 37, 400, 37, 22, 37, 37, 37, 77, 37, 37, - /* 2370 */ 37, 37, 37, 412, 22, 414, 37, 0, 42, 37, - /* 2380 */ 0, 51, 453, 37, 0, 456, 42, 37, 459, 460, - /* 2390 */ 461, 462, 463, 464, 51, 466, 51, 453, 359, 42, - /* 2400 */ 456, 0, 37, 459, 460, 461, 462, 463, 464, 51, - /* 2410 */ 466, 372, 42, 359, 453, 0, 37, 456, 37, 0, - /* 2420 */ 459, 460, 461, 462, 463, 464, 372, 466, 22, 33, - /* 2430 */ 22, 21, 522, 22, 22, 21, 20, 522, 522, 400, - /* 2440 */ 522, 522, 522, 522, 522, 522, 522, 522, 522, 522, - /* 2450 */ 522, 412, 522, 414, 400, 522, 522, 522, 522, 522, - /* 2460 */ 522, 522, 522, 522, 522, 522, 412, 522, 414, 522, - /* 2470 */ 359, 522, 522, 522, 522, 522, 522, 522, 522, 522, - /* 2480 */ 522, 522, 522, 372, 522, 522, 522, 522, 522, 522, - /* 2490 */ 522, 522, 453, 522, 522, 456, 359, 522, 459, 460, - /* 2500 */ 461, 462, 463, 464, 522, 466, 522, 453, 522, 372, - /* 2510 */ 456, 400, 522, 459, 460, 461, 462, 463, 464, 522, - /* 2520 */ 466, 522, 522, 412, 522, 414, 522, 522, 522, 522, - /* 2530 */ 522, 522, 522, 522, 522, 522, 522, 400, 522, 359, - /* 2540 */ 522, 522, 522, 522, 522, 522, 522, 522, 522, 412, - /* 2550 */ 522, 414, 372, 522, 522, 522, 522, 522, 522, 522, - /* 2560 */ 522, 522, 522, 522, 453, 359, 522, 456, 522, 522, - /* 2570 */ 459, 460, 461, 462, 463, 464, 522, 466, 372, 522, - /* 2580 */ 400, 522, 522, 522, 522, 522, 522, 522, 522, 522, - /* 2590 */ 453, 522, 412, 456, 414, 522, 459, 460, 461, 462, - /* 2600 */ 463, 464, 522, 466, 522, 522, 400, 522, 522, 522, - /* 2610 */ 522, 522, 522, 522, 522, 522, 522, 522, 412, 522, - /* 2620 */ 414, 522, 359, 522, 522, 522, 522, 522, 522, 522, - /* 2630 */ 522, 522, 522, 453, 522, 372, 456, 522, 522, 459, - /* 2640 */ 460, 461, 462, 463, 464, 522, 466, 522, 359, 522, - /* 2650 */ 522, 522, 522, 522, 522, 522, 522, 522, 522, 453, - /* 2660 */ 522, 372, 456, 400, 522, 459, 460, 461, 462, 463, - /* 2670 */ 464, 522, 466, 522, 522, 412, 522, 414, 522, 522, - /* 2680 */ 359, 522, 522, 522, 522, 522, 522, 522, 522, 400, - /* 2690 */ 522, 522, 522, 372, 522, 522, 522, 522, 522, 522, - /* 2700 */ 522, 412, 522, 414, 522, 522, 522, 522, 522, 522, - /* 2710 */ 522, 522, 522, 522, 522, 522, 453, 522, 359, 456, - /* 2720 */ 522, 400, 459, 460, 461, 462, 463, 464, 522, 466, - /* 2730 */ 522, 372, 522, 412, 522, 414, 522, 522, 522, 522, - /* 2740 */ 522, 522, 453, 522, 522, 456, 522, 522, 459, 460, - /* 2750 */ 461, 462, 463, 464, 522, 466, 522, 522, 522, 400, - /* 2760 */ 522, 522, 522, 522, 522, 522, 522, 522, 522, 522, - /* 2770 */ 522, 412, 522, 414, 453, 522, 522, 456, 522, 522, - /* 2780 */ 459, 460, 461, 462, 463, 464, 359, 466, 522, 522, - /* 2790 */ 522, 522, 522, 522, 522, 522, 522, 522, 522, 372, - /* 2800 */ 522, 522, 522, 522, 522, 522, 522, 522, 522, 522, - /* 2810 */ 522, 359, 453, 522, 522, 456, 522, 522, 459, 460, - /* 2820 */ 461, 462, 463, 464, 372, 466, 522, 400, 522, 522, - /* 2830 */ 522, 522, 522, 522, 522, 522, 522, 522, 522, 412, - /* 2840 */ 522, 414, 522, 359, 522, 522, 522, 522, 522, 522, - /* 2850 */ 522, 522, 400, 522, 522, 522, 372, 522, 522, 522, - /* 2860 */ 522, 522, 522, 522, 412, 522, 414, 522, 522, 359, - /* 2870 */ 522, 522, 522, 522, 522, 522, 522, 522, 522, 522, - /* 2880 */ 453, 522, 372, 456, 400, 522, 459, 460, 461, 462, - /* 2890 */ 463, 464, 522, 466, 522, 522, 412, 522, 414, 522, - /* 2900 */ 522, 522, 522, 522, 522, 453, 522, 522, 456, 522, - /* 2910 */ 400, 459, 460, 461, 462, 463, 464, 522, 466, 522, - /* 2920 */ 522, 522, 412, 522, 414, 522, 522, 522, 522, 522, - /* 2930 */ 522, 522, 522, 522, 522, 522, 522, 453, 359, 522, - /* 2940 */ 456, 522, 522, 459, 460, 461, 462, 463, 464, 522, - /* 2950 */ 466, 372, 522, 522, 359, 522, 522, 522, 522, 522, - /* 2960 */ 522, 522, 522, 453, 522, 522, 456, 372, 522, 459, - /* 2970 */ 460, 461, 462, 463, 464, 522, 466, 522, 522, 400, - /* 2980 */ 522, 522, 522, 522, 522, 522, 522, 522, 522, 522, - /* 2990 */ 522, 412, 522, 414, 522, 400, 522, 522, 522, 522, - /* 3000 */ 522, 522, 522, 522, 522, 522, 522, 412, 522, 414, - /* 3010 */ 522, 522, 522, 522, 522, 522, 522, 522, 522, 522, - /* 3020 */ 522, 359, 522, 522, 522, 522, 522, 522, 522, 522, - /* 3030 */ 522, 522, 453, 522, 372, 456, 522, 359, 459, 460, - /* 3040 */ 461, 462, 463, 464, 522, 466, 522, 522, 453, 522, - /* 3050 */ 372, 456, 522, 359, 459, 460, 461, 462, 463, 464, - /* 3060 */ 522, 466, 400, 522, 522, 522, 372, 522, 522, 522, - /* 3070 */ 522, 522, 522, 522, 412, 522, 414, 522, 400, 522, - /* 3080 */ 522, 522, 522, 522, 522, 522, 522, 522, 522, 522, - /* 3090 */ 412, 522, 414, 522, 400, 522, 522, 522, 522, 522, - /* 3100 */ 522, 522, 522, 522, 522, 522, 412, 522, 414, 522, - /* 3110 */ 522, 522, 522, 522, 522, 453, 522, 522, 456, 522, - /* 3120 */ 522, 459, 460, 461, 462, 463, 464, 522, 466, 522, - /* 3130 */ 522, 453, 522, 522, 456, 522, 522, 459, 460, 461, - /* 3140 */ 462, 463, 464, 522, 466, 522, 522, 453, 522, 522, - /* 3150 */ 456, 522, 522, 459, 460, 461, 462, 463, 464, 522, - /* 3160 */ 466, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3170 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3180 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3190 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3200 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3210 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3220 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3230 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3240 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3250 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3260 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3270 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3280 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3290 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3300 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3310 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3320 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3330 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3340 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3350 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3360 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3370 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3380 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3390 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3400 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3410 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3420 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3430 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3440 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3450 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3460 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3470 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3480 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3490 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3500 */ 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, - /* 3510 */ 356, 356, 356, 356, 356, 356, 356, + /* 250 */ 250, 251, 252, 253, 254, 255, 12, 13, 3, 383, + /* 260 */ 487, 18, 20, 20, 20, 107, 22, 391, 495, 182, + /* 270 */ 27, 402, 361, 30, 71, 20, 369, 190, 35, 35, + /* 280 */ 373, 37, 375, 197, 0, 374, 513, 514, 281, 138, + /* 290 */ 70, 518, 519, 142, 51, 426, 53, 373, 374, 373, + /* 300 */ 374, 58, 59, 483, 484, 485, 13, 487, 488, 65, + /* 310 */ 224, 225, 69, 402, 14, 71, 104, 393, 115, 393, + /* 320 */ 20, 202, 78, 204, 400, 414, 37, 416, 143, 144, + /* 330 */ 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + /* 340 */ 20, 129, 130, 131, 132, 133, 134, 135, 104, 106, + /* 350 */ 306, 107, 204, 234, 235, 374, 42, 4, 476, 477, + /* 360 */ 117, 0, 211, 108, 361, 214, 455, 78, 217, 458, + /* 370 */ 219, 78, 461, 462, 463, 464, 465, 466, 467, 468, + /* 380 */ 469, 470, 179, 402, 180, 143, 144, 143, 144, 87, + /* 390 */ 147, 148, 460, 150, 151, 152, 153, 154, 155, 156, + /* 400 */ 157, 158, 228, 23, 186, 162, 163, 164, 165, 166, + /* 410 */ 167, 168, 70, 170, 171, 172, 14, 414, 486, 176, + /* 420 */ 177, 178, 20, 159, 180, 181, 183, 47, 48, 187, + /* 430 */ 188, 187, 188, 382, 73, 74, 75, 182, 107, 281, + /* 440 */ 236, 80, 81, 82, 463, 161, 202, 86, 204, 165, + /* 450 */ 399, 149, 91, 92, 93, 94, 373, 173, 97, 408, + /* 460 */ 107, 100, 259, 260, 261, 262, 263, 264, 265, 266, + /* 470 */ 267, 268, 269, 159, 20, 173, 174, 70, 234, 235, + /* 480 */ 236, 117, 238, 239, 240, 241, 242, 243, 244, 245, + /* 490 */ 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + /* 500 */ 256, 12, 13, 402, 361, 287, 288, 289, 361, 20, + /* 510 */ 409, 22, 12, 13, 14, 15, 16, 374, 417, 369, + /* 520 */ 73, 74, 75, 373, 35, 375, 37, 80, 81, 82, + /* 530 */ 447, 448, 201, 86, 203, 271, 272, 273, 91, 92, + /* 540 */ 93, 94, 361, 22, 97, 402, 256, 100, 0, 274, + /* 550 */ 275, 276, 277, 278, 65, 374, 14, 414, 37, 416, + /* 560 */ 71, 414, 20, 472, 233, 474, 234, 78, 159, 21, + /* 570 */ 415, 416, 24, 25, 26, 27, 28, 29, 30, 31, + /* 580 */ 32, 117, 180, 402, 270, 271, 272, 273, 274, 275, + /* 590 */ 276, 277, 278, 104, 20, 414, 107, 416, 455, 78, + /* 600 */ 361, 458, 373, 374, 461, 462, 463, 464, 465, 466, + /* 610 */ 78, 468, 281, 374, 471, 376, 473, 474, 475, 20, + /* 620 */ 373, 374, 479, 480, 292, 293, 294, 295, 296, 297, + /* 630 */ 298, 107, 143, 144, 281, 20, 455, 4, 236, 458, + /* 640 */ 393, 402, 461, 462, 463, 464, 465, 466, 65, 468, + /* 650 */ 34, 422, 2, 414, 473, 416, 475, 403, 8, 9, + /* 660 */ 479, 480, 12, 13, 14, 15, 16, 8, 9, 180, + /* 670 */ 181, 12, 13, 14, 15, 16, 187, 188, 175, 270, + /* 680 */ 271, 272, 273, 274, 275, 276, 277, 278, 507, 106, + /* 690 */ 236, 202, 109, 204, 455, 373, 374, 458, 137, 403, + /* 700 */ 461, 462, 463, 464, 465, 466, 107, 468, 51, 206, + /* 710 */ 373, 374, 473, 179, 475, 393, 403, 60, 479, 480, + /* 720 */ 63, 64, 180, 234, 235, 236, 403, 238, 239, 240, + /* 730 */ 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, + /* 740 */ 251, 252, 253, 254, 255, 12, 13, 14, 460, 361, + /* 750 */ 136, 373, 374, 20, 140, 22, 182, 1, 175, 422, + /* 760 */ 373, 374, 374, 0, 376, 360, 403, 362, 35, 0, + /* 770 */ 37, 393, 373, 374, 486, 19, 215, 216, 236, 8, + /* 780 */ 9, 361, 361, 12, 13, 14, 15, 16, 373, 374, + /* 790 */ 402, 35, 393, 259, 374, 373, 376, 182, 65, 0, + /* 800 */ 373, 374, 414, 269, 416, 281, 33, 51, 393, 422, + /* 810 */ 236, 78, 373, 374, 378, 379, 60, 61, 62, 63, + /* 820 */ 393, 65, 402, 24, 25, 26, 27, 28, 29, 30, + /* 830 */ 31, 32, 393, 22, 414, 414, 416, 104, 373, 374, + /* 840 */ 107, 373, 374, 455, 373, 374, 458, 4, 37, 461, + /* 850 */ 462, 463, 464, 465, 466, 472, 468, 474, 393, 373, + /* 860 */ 374, 473, 106, 475, 393, 109, 23, 479, 480, 447, + /* 870 */ 448, 361, 373, 374, 443, 455, 143, 144, 458, 393, + /* 880 */ 281, 461, 462, 463, 464, 465, 466, 402, 468, 46, + /* 890 */ 47, 48, 393, 473, 409, 475, 20, 141, 0, 479, + /* 900 */ 480, 20, 417, 22, 361, 136, 137, 138, 139, 140, + /* 910 */ 141, 142, 0, 180, 181, 104, 283, 374, 460, 376, + /* 920 */ 187, 188, 159, 160, 414, 390, 8, 9, 373, 374, + /* 930 */ 12, 13, 14, 15, 16, 202, 55, 204, 20, 404, + /* 940 */ 184, 361, 373, 374, 486, 402, 358, 191, 393, 414, + /* 950 */ 482, 483, 484, 485, 394, 487, 488, 414, 391, 416, + /* 960 */ 56, 57, 402, 51, 361, 194, 210, 234, 235, 236, + /* 970 */ 410, 238, 239, 240, 241, 242, 243, 244, 245, 246, + /* 980 */ 247, 248, 249, 250, 251, 252, 253, 254, 255, 12, + /* 990 */ 13, 378, 379, 458, 414, 373, 374, 20, 455, 22, + /* 1000 */ 256, 458, 258, 468, 461, 462, 463, 464, 465, 466, + /* 1010 */ 361, 468, 35, 4, 37, 393, 473, 414, 475, 137, + /* 1020 */ 138, 402, 479, 480, 142, 437, 373, 374, 19, 410, + /* 1030 */ 442, 33, 361, 394, 136, 137, 138, 139, 140, 141, + /* 1040 */ 142, 402, 65, 45, 35, 374, 393, 376, 20, 410, + /* 1050 */ 373, 374, 483, 484, 485, 78, 487, 488, 182, 20, + /* 1060 */ 51, 403, 390, 414, 402, 402, 362, 58, 59, 361, + /* 1070 */ 393, 409, 409, 402, 65, 487, 404, 304, 307, 417, + /* 1080 */ 417, 104, 374, 495, 107, 414, 414, 416, 373, 374, + /* 1090 */ 361, 8, 9, 373, 374, 12, 13, 14, 15, 16, + /* 1100 */ 182, 513, 514, 374, 22, 376, 518, 519, 393, 361, + /* 1110 */ 402, 3, 236, 393, 361, 106, 364, 365, 109, 37, + /* 1120 */ 143, 144, 414, 402, 416, 389, 455, 361, 392, 458, + /* 1130 */ 458, 402, 461, 462, 463, 464, 465, 466, 417, 468, + /* 1140 */ 468, 387, 388, 414, 473, 416, 475, 14, 15, 16, + /* 1150 */ 479, 480, 394, 361, 236, 387, 388, 180, 181, 382, + /* 1160 */ 402, 361, 414, 455, 187, 188, 458, 414, 410, 461, + /* 1170 */ 462, 463, 464, 465, 466, 403, 468, 39, 40, 202, + /* 1180 */ 414, 204, 361, 475, 455, 408, 104, 458, 480, 361, + /* 1190 */ 461, 462, 463, 464, 465, 466, 471, 468, 361, 474, + /* 1200 */ 361, 361, 473, 398, 475, 13, 414, 361, 479, 480, + /* 1210 */ 33, 234, 235, 236, 414, 238, 239, 240, 241, 242, + /* 1220 */ 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, + /* 1230 */ 253, 254, 255, 12, 13, 414, 411, 411, 0, 414, + /* 1240 */ 414, 20, 414, 22, 402, 437, 117, 402, 489, 111, + /* 1250 */ 112, 414, 114, 414, 414, 361, 35, 452, 37, 417, + /* 1260 */ 414, 437, 417, 411, 236, 182, 414, 390, 374, 395, + /* 1270 */ 78, 0, 398, 33, 136, 236, 361, 13, 140, 110, + /* 1280 */ 42, 404, 113, 13, 110, 108, 65, 113, 33, 374, + /* 1290 */ 110, 414, 0, 113, 110, 487, 402, 113, 169, 78, + /* 1300 */ 45, 37, 0, 495, 33, 143, 144, 37, 414, 33, + /* 1310 */ 416, 487, 427, 218, 22, 220, 33, 402, 18, 495, + /* 1320 */ 522, 513, 514, 23, 22, 104, 518, 519, 107, 414, + /* 1330 */ 65, 416, 1, 2, 361, 458, 459, 513, 514, 0, + /* 1340 */ 40, 41, 518, 519, 44, 468, 71, 374, 108, 455, + /* 1350 */ 0, 33, 458, 490, 54, 461, 462, 463, 464, 465, + /* 1360 */ 466, 22, 468, 49, 143, 144, 66, 67, 68, 69, + /* 1370 */ 455, 511, 22, 458, 109, 402, 461, 462, 463, 464, + /* 1380 */ 465, 466, 37, 468, 108, 377, 37, 414, 473, 416, + /* 1390 */ 475, 108, 8, 9, 479, 480, 12, 13, 14, 15, + /* 1400 */ 16, 180, 181, 37, 33, 13, 0, 107, 187, 188, + /* 1410 */ 302, 33, 33, 33, 520, 521, 402, 33, 504, 390, + /* 1420 */ 390, 107, 427, 202, 372, 204, 108, 33, 455, 37, + /* 1430 */ 33, 458, 33, 33, 461, 462, 463, 464, 465, 466, + /* 1440 */ 107, 468, 33, 437, 78, 145, 473, 33, 475, 116, + /* 1450 */ 427, 510, 479, 480, 510, 234, 235, 236, 52, 238, + /* 1460 */ 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + /* 1470 */ 249, 250, 251, 252, 253, 254, 255, 510, 437, 108, + /* 1480 */ 436, 12, 13, 377, 510, 437, 108, 108, 108, 33, + /* 1490 */ 33, 22, 108, 487, 194, 195, 196, 361, 427, 199, + /* 1500 */ 33, 495, 108, 33, 35, 108, 37, 108, 108, 234, + /* 1510 */ 374, 374, 212, 213, 413, 33, 444, 108, 13, 513, + /* 1520 */ 514, 427, 108, 223, 518, 519, 226, 361, 487, 229, + /* 1530 */ 230, 231, 232, 233, 65, 487, 495, 427, 402, 494, + /* 1540 */ 374, 494, 37, 495, 481, 392, 515, 78, 497, 204, + /* 1550 */ 414, 284, 416, 204, 513, 514, 438, 51, 42, 518, + /* 1560 */ 519, 513, 514, 456, 108, 108, 518, 519, 402, 457, + /* 1570 */ 20, 449, 217, 104, 454, 108, 382, 449, 108, 382, + /* 1580 */ 414, 281, 416, 136, 137, 138, 139, 140, 141, 142, + /* 1590 */ 108, 455, 440, 200, 458, 361, 20, 461, 462, 463, + /* 1600 */ 464, 465, 466, 373, 468, 20, 374, 45, 374, 473, + /* 1610 */ 423, 475, 423, 374, 179, 479, 480, 373, 420, 374, + /* 1620 */ 373, 455, 423, 420, 458, 420, 105, 461, 462, 463, + /* 1630 */ 464, 465, 466, 103, 468, 386, 402, 385, 361, 373, + /* 1640 */ 102, 475, 384, 20, 366, 479, 480, 373, 414, 50, + /* 1650 */ 416, 374, 373, 373, 370, 366, 370, 449, 20, 416, + /* 1660 */ 20, 20, 375, 382, 382, 439, 375, 382, 20, 373, + /* 1670 */ 382, 202, 382, 204, 366, 382, 430, 382, 366, 402, + /* 1680 */ 382, 364, 414, 364, 373, 221, 414, 414, 453, 455, + /* 1690 */ 107, 414, 458, 416, 208, 461, 462, 463, 464, 465, + /* 1700 */ 466, 402, 468, 234, 235, 402, 402, 402, 402, 475, + /* 1710 */ 451, 402, 402, 479, 480, 402, 380, 248, 249, 250, + /* 1720 */ 251, 252, 253, 254, 402, 402, 402, 20, 380, 207, + /* 1730 */ 373, 361, 455, 291, 503, 458, 416, 299, 461, 462, + /* 1740 */ 463, 464, 465, 466, 374, 468, 449, 446, 414, 361, + /* 1750 */ 290, 503, 475, 432, 438, 448, 479, 480, 432, 506, + /* 1760 */ 445, 193, 374, 301, 361, 505, 503, 438, 285, 280, + /* 1770 */ 279, 502, 402, 300, 308, 303, 305, 374, 517, 523, + /* 1780 */ 20, 374, 117, 282, 414, 375, 416, 414, 380, 414, + /* 1790 */ 402, 380, 460, 432, 432, 501, 414, 414, 185, 414, + /* 1800 */ 428, 380, 414, 398, 416, 402, 380, 361, 374, 107, + /* 1810 */ 407, 107, 414, 478, 373, 22, 380, 414, 493, 416, + /* 1820 */ 374, 406, 492, 38, 363, 455, 367, 500, 458, 361, + /* 1830 */ 441, 461, 462, 463, 464, 465, 466, 450, 468, 498, + /* 1840 */ 496, 366, 374, 455, 516, 433, 458, 396, 402, 461, + /* 1850 */ 462, 463, 464, 465, 466, 433, 468, 381, 455, 396, + /* 1860 */ 414, 458, 416, 359, 461, 462, 463, 464, 465, 466, + /* 1870 */ 402, 468, 361, 396, 0, 407, 45, 0, 508, 509, + /* 1880 */ 0, 0, 414, 37, 416, 374, 227, 37, 37, 37, + /* 1890 */ 227, 0, 37, 37, 227, 37, 0, 509, 227, 0, + /* 1900 */ 37, 455, 361, 0, 458, 37, 0, 461, 462, 463, + /* 1910 */ 464, 465, 466, 402, 468, 374, 22, 0, 222, 37, + /* 1920 */ 0, 210, 0, 455, 210, 414, 458, 416, 211, 461, + /* 1930 */ 462, 463, 464, 465, 466, 204, 468, 202, 0, 0, + /* 1940 */ 0, 198, 0, 402, 197, 0, 148, 0, 407, 49, + /* 1950 */ 49, 37, 0, 0, 0, 414, 37, 416, 512, 51, + /* 1960 */ 49, 0, 0, 45, 0, 0, 455, 0, 0, 458, + /* 1970 */ 361, 165, 461, 462, 463, 464, 465, 466, 49, 468, + /* 1980 */ 0, 0, 0, 374, 0, 37, 0, 165, 0, 0, + /* 1990 */ 0, 0, 0, 0, 35, 0, 455, 0, 0, 458, + /* 2000 */ 361, 0, 461, 462, 463, 464, 465, 466, 0, 468, + /* 2010 */ 51, 402, 0, 374, 0, 0, 0, 0, 0, 60, + /* 2020 */ 61, 62, 63, 414, 65, 416, 0, 0, 49, 0, + /* 2030 */ 45, 0, 521, 0, 0, 361, 0, 0, 0, 0, + /* 2040 */ 0, 402, 22, 148, 0, 0, 407, 0, 374, 147, + /* 2050 */ 146, 0, 22, 414, 50, 416, 50, 22, 0, 65, + /* 2060 */ 37, 0, 0, 0, 455, 106, 42, 458, 109, 0, + /* 2070 */ 461, 462, 463, 464, 465, 466, 402, 468, 65, 470, + /* 2080 */ 37, 407, 0, 51, 65, 37, 0, 37, 414, 0, + /* 2090 */ 416, 42, 51, 37, 455, 42, 0, 458, 33, 45, + /* 2100 */ 461, 462, 463, 464, 465, 466, 361, 468, 51, 42, + /* 2110 */ 0, 14, 42, 49, 0, 43, 0, 49, 0, 374, + /* 2120 */ 49, 0, 42, 193, 0, 49, 0, 0, 0, 455, + /* 2130 */ 0, 72, 458, 42, 175, 461, 462, 463, 464, 465, + /* 2140 */ 466, 37, 468, 184, 185, 51, 0, 402, 37, 51, + /* 2150 */ 191, 192, 0, 51, 42, 42, 37, 0, 51, 414, + /* 2160 */ 37, 416, 42, 0, 361, 0, 0, 0, 0, 210, + /* 2170 */ 0, 37, 22, 0, 37, 115, 37, 374, 37, 361, + /* 2180 */ 37, 37, 37, 22, 37, 37, 113, 33, 33, 0, + /* 2190 */ 37, 22, 374, 37, 0, 37, 22, 0, 22, 0, + /* 2200 */ 455, 22, 53, 458, 0, 402, 461, 462, 463, 464, + /* 2210 */ 465, 466, 37, 468, 0, 0, 0, 414, 37, 416, + /* 2220 */ 402, 37, 361, 0, 22, 20, 0, 37, 37, 37, + /* 2230 */ 108, 209, 414, 0, 416, 374, 107, 361, 107, 22, + /* 2240 */ 37, 0, 49, 22, 0, 0, 3, 107, 50, 286, + /* 2250 */ 374, 205, 33, 33, 3, 33, 182, 182, 455, 361, + /* 2260 */ 182, 458, 185, 402, 461, 462, 463, 464, 465, 466, + /* 2270 */ 182, 468, 374, 455, 189, 414, 458, 416, 402, 461, + /* 2280 */ 462, 463, 464, 465, 466, 182, 468, 107, 189, 50, + /* 2290 */ 414, 108, 416, 105, 361, 108, 33, 49, 103, 49, + /* 2300 */ 402, 33, 78, 33, 108, 33, 37, 374, 107, 49, + /* 2310 */ 33, 286, 414, 107, 416, 108, 455, 361, 107, 458, + /* 2320 */ 107, 37, 461, 462, 463, 464, 465, 466, 49, 468, + /* 2330 */ 374, 455, 361, 108, 458, 402, 107, 461, 462, 463, + /* 2340 */ 464, 465, 466, 108, 468, 374, 108, 414, 108, 416, + /* 2350 */ 37, 37, 37, 455, 37, 37, 458, 108, 402, 461, + /* 2360 */ 462, 463, 464, 465, 466, 286, 468, 0, 0, 107, + /* 2370 */ 414, 270, 416, 402, 42, 108, 0, 42, 107, 49, + /* 2380 */ 116, 2, 108, 107, 33, 414, 186, 416, 455, 107, + /* 2390 */ 107, 458, 107, 184, 461, 462, 463, 464, 465, 466, + /* 2400 */ 105, 468, 105, 361, 22, 107, 234, 108, 107, 49, + /* 2410 */ 108, 455, 107, 107, 458, 108, 374, 461, 462, 463, + /* 2420 */ 464, 465, 466, 107, 468, 22, 455, 361, 257, 458, + /* 2430 */ 49, 108, 461, 462, 463, 464, 465, 466, 107, 468, + /* 2440 */ 374, 117, 108, 37, 402, 37, 107, 237, 108, 37, + /* 2450 */ 107, 37, 108, 107, 37, 108, 414, 107, 416, 37, + /* 2460 */ 108, 107, 37, 108, 107, 128, 128, 33, 402, 128, + /* 2470 */ 128, 107, 107, 37, 22, 71, 107, 72, 37, 37, + /* 2480 */ 414, 37, 416, 37, 37, 37, 37, 37, 37, 78, + /* 2490 */ 101, 78, 101, 33, 22, 37, 361, 455, 37, 37, + /* 2500 */ 458, 37, 37, 461, 462, 463, 464, 465, 466, 374, + /* 2510 */ 468, 37, 361, 78, 37, 37, 37, 37, 22, 37, + /* 2520 */ 37, 455, 0, 37, 458, 374, 51, 461, 462, 463, + /* 2530 */ 464, 465, 466, 42, 468, 0, 37, 402, 51, 361, + /* 2540 */ 42, 0, 37, 51, 42, 0, 37, 0, 51, 414, + /* 2550 */ 42, 416, 374, 402, 37, 37, 0, 33, 22, 22, + /* 2560 */ 21, 524, 22, 20, 22, 414, 524, 416, 524, 361, + /* 2570 */ 21, 524, 524, 524, 524, 524, 524, 524, 524, 524, + /* 2580 */ 402, 524, 374, 524, 524, 524, 524, 524, 524, 524, + /* 2590 */ 455, 524, 414, 458, 416, 524, 461, 462, 463, 464, + /* 2600 */ 465, 466, 524, 468, 524, 524, 455, 524, 524, 458, + /* 2610 */ 402, 524, 461, 462, 463, 464, 465, 466, 524, 468, + /* 2620 */ 524, 524, 414, 524, 416, 524, 524, 524, 524, 524, + /* 2630 */ 524, 524, 524, 455, 361, 524, 458, 524, 524, 461, + /* 2640 */ 462, 463, 464, 465, 466, 524, 468, 374, 524, 524, + /* 2650 */ 524, 524, 361, 524, 524, 524, 524, 524, 524, 524, + /* 2660 */ 524, 524, 524, 455, 524, 374, 458, 524, 524, 461, + /* 2670 */ 462, 463, 464, 465, 466, 402, 468, 524, 524, 524, + /* 2680 */ 524, 524, 524, 524, 524, 524, 524, 414, 524, 416, + /* 2690 */ 524, 524, 524, 402, 524, 524, 524, 524, 524, 524, + /* 2700 */ 524, 524, 524, 524, 524, 414, 524, 416, 524, 361, + /* 2710 */ 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, + /* 2720 */ 524, 524, 374, 524, 524, 524, 524, 524, 455, 524, + /* 2730 */ 524, 458, 361, 524, 461, 462, 463, 464, 465, 466, + /* 2740 */ 524, 468, 524, 524, 524, 374, 455, 361, 524, 458, + /* 2750 */ 402, 524, 461, 462, 463, 464, 465, 466, 524, 468, + /* 2760 */ 374, 524, 414, 524, 416, 524, 524, 524, 524, 524, + /* 2770 */ 524, 524, 524, 402, 524, 524, 524, 524, 524, 524, + /* 2780 */ 524, 524, 524, 524, 524, 414, 524, 416, 402, 524, + /* 2790 */ 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, + /* 2800 */ 414, 524, 416, 455, 524, 524, 458, 524, 524, 461, + /* 2810 */ 462, 463, 464, 465, 466, 524, 468, 524, 361, 524, + /* 2820 */ 524, 524, 524, 524, 524, 524, 455, 524, 524, 458, + /* 2830 */ 524, 374, 461, 462, 463, 464, 465, 466, 524, 468, + /* 2840 */ 524, 455, 361, 524, 458, 524, 524, 461, 462, 463, + /* 2850 */ 464, 465, 466, 524, 468, 374, 524, 524, 524, 402, + /* 2860 */ 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, + /* 2870 */ 524, 414, 524, 416, 524, 524, 524, 524, 524, 524, + /* 2880 */ 524, 524, 524, 402, 524, 524, 524, 524, 524, 524, + /* 2890 */ 524, 524, 524, 524, 524, 414, 524, 416, 524, 524, + /* 2900 */ 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, + /* 2910 */ 524, 524, 455, 524, 524, 458, 524, 524, 461, 462, + /* 2920 */ 463, 464, 465, 466, 524, 468, 524, 524, 524, 524, + /* 2930 */ 524, 524, 524, 524, 524, 524, 455, 524, 524, 458, + /* 2940 */ 524, 524, 461, 462, 463, 464, 465, 466, 524, 468, + /* 2950 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 2960 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 2970 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 2980 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 2990 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3000 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3010 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3020 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3030 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3040 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3050 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3060 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3070 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3080 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3090 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3100 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3110 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3120 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3130 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3140 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3150 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3160 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3170 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3180 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3190 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3200 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3210 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3220 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3230 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3240 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3250 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3260 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3270 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3280 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3290 */ 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, + /* 3300 */ 358, 358, 358, 358, 358, 358, 358, 358, }; -#define YY_SHIFT_COUNT (849) +#define YY_SHIFT_COUNT (855) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2419) +#define YY_SHIFT_MAX (2556) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 1442, 0, 241, 0, 483, 483, 483, 483, 483, 483, - /* 10 */ 483, 483, 483, 483, 483, 483, 724, 965, 965, 1206, - /* 20 */ 965, 965, 965, 965, 965, 965, 965, 965, 965, 965, - /* 30 */ 965, 965, 965, 965, 965, 965, 965, 965, 965, 965, - /* 40 */ 965, 965, 965, 965, 965, 965, 965, 965, 965, 965, - /* 50 */ 965, 416, 521, 73, 189, 306, 369, 306, 306, 189, - /* 60 */ 189, 306, 1325, 306, 240, 1325, 1325, 515, 306, 166, - /* 70 */ 355, 321, 321, 570, 570, 355, 119, 295, 199, 199, - /* 80 */ 200, 321, 321, 321, 321, 321, 321, 321, 321, 321, - /* 90 */ 321, 321, 532, 539, 321, 321, 44, 166, 321, 532, - /* 100 */ 321, 166, 321, 321, 166, 321, 321, 166, 321, 166, - /* 110 */ 166, 166, 321, 107, 202, 202, 717, 608, 143, 551, - /* 120 */ 551, 551, 551, 551, 551, 551, 551, 551, 551, 551, - /* 130 */ 551, 551, 551, 551, 551, 551, 551, 551, 1009, 76, - /* 140 */ 119, 295, 609, 609, 269, 292, 292, 292, 154, 247, - /* 150 */ 247, 127, 269, 44, 513, 166, 166, 405, 166, 599, - /* 160 */ 166, 599, 599, 601, 856, 645, 645, 645, 645, 645, - /* 170 */ 645, 645, 645, 1228, 607, 21, 46, 61, 61, 15, - /* 180 */ 216, 176, 545, 170, 80, 693, 766, 398, 398, 689, - /* 190 */ 291, 721, 762, 762, 762, 867, 762, 1013, 964, 765, - /* 200 */ 835, 999, 251, 765, 765, 1033, 1221, 1221, 985, 908, - /* 210 */ 1014, 127, 1222, 1452, 1470, 1493, 1302, 44, 1493, 44, - /* 220 */ 1333, 1502, 1505, 1488, 1505, 1488, 1359, 1502, 1505, 1502, - /* 230 */ 1488, 1359, 1359, 1443, 1444, 1502, 1450, 1502, 1502, 1502, - /* 240 */ 1539, 1510, 1539, 1510, 1493, 44, 44, 1548, 44, 1558, - /* 250 */ 1559, 44, 1558, 44, 1575, 44, 44, 1502, 44, 1539, - /* 260 */ 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - /* 270 */ 166, 1502, 856, 856, 1539, 599, 599, 599, 1403, 1516, - /* 280 */ 1493, 107, 1610, 1426, 1433, 1548, 107, 1222, 1502, 599, - /* 290 */ 1361, 1369, 1361, 1369, 1376, 1471, 1361, 1367, 1377, 1396, - /* 300 */ 1222, 1405, 1408, 1381, 1387, 1391, 1505, 1671, 1579, 1419, - /* 310 */ 1558, 107, 107, 1369, 599, 599, 599, 599, 1369, 599, - /* 320 */ 1552, 107, 601, 107, 1505, 1650, 1654, 599, 1502, 107, - /* 330 */ 1746, 1731, 1539, 3161, 3161, 3161, 3161, 3161, 3161, 3161, - /* 340 */ 3161, 3161, 36, 464, 63, 346, 834, 59, 898, 685, - /* 350 */ 848, 1043, 1117, 1021, 1167, 1167, 1167, 1167, 1167, 1167, - /* 360 */ 1167, 1167, 1167, 394, 93, 62, 1023, 1023, 354, 600, - /* 370 */ 116, 952, 343, 958, 1050, 737, 425, 425, 1177, 981, - /* 380 */ 969, 1177, 1177, 1177, 1067, 181, 1197, 1236, 1057, 411, - /* 390 */ 754, 1191, 1196, 1198, 1202, 1244, 1254, 56, 1293, 1313, - /* 400 */ 543, 1266, 1273, 1253, 1287, 1289, 1292, 1176, 1118, 1114, - /* 410 */ 1307, 1310, 1318, 1320, 1322, 1323, 1356, 1326, 1095, 1352, - /* 420 */ 1305, 1354, 1355, 1386, 1388, 1390, 1398, 1257, 1328, 1330, - /* 430 */ 1364, 1366, 1327, 1412, 1783, 1784, 1785, 1741, 1788, 1752, - /* 440 */ 1566, 1754, 1756, 1757, 1571, 1796, 1760, 1761, 1576, 1762, - /* 450 */ 1801, 1578, 1803, 1768, 1807, 1772, 1810, 1789, 1812, 1776, - /* 460 */ 1595, 1815, 1611, 1817, 1613, 1620, 1629, 1633, 1833, 1834, - /* 470 */ 1835, 1642, 1644, 1839, 1842, 1696, 1798, 1808, 1850, 1823, - /* 480 */ 1864, 1866, 1825, 1816, 1868, 1822, 1873, 1829, 1875, 1876, - /* 490 */ 1877, 1830, 1878, 1880, 1881, 1882, 1883, 1885, 1727, 1852, - /* 500 */ 1890, 1730, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1900, - /* 510 */ 1903, 1904, 1906, 1907, 1914, 1917, 1918, 1919, 1920, 1872, - /* 520 */ 1923, 1879, 1930, 1937, 1939, 1942, 1952, 1955, 1956, 1922, - /* 530 */ 1945, 1811, 1959, 1818, 1966, 1827, 1967, 1968, 1940, 1911, - /* 540 */ 1941, 1924, 1970, 1909, 1938, 1976, 1913, 1978, 1915, 1980, - /* 550 */ 1981, 1946, 1933, 1943, 1986, 1951, 1947, 1950, 1989, 1958, - /* 560 */ 1948, 1960, 1993, 1963, 1997, 1962, 1964, 1971, 1954, 1965, - /* 570 */ 1987, 1973, 2005, 1972, 1969, 2008, 2009, 2024, 2026, 1985, - /* 580 */ 1838, 2029, 1954, 1982, 2030, 2032, 1979, 2033, 2034, 1999, - /* 590 */ 1988, 1995, 2040, 2010, 1998, 2012, 2051, 2015, 2004, 2014, - /* 600 */ 2057, 2022, 2011, 2018, 2061, 2063, 2066, 2068, 2069, 2070, - /* 610 */ 1957, 1974, 2035, 2052, 2073, 2038, 2041, 2043, 2044, 2045, - /* 620 */ 2046, 2047, 2048, 2055, 2056, 2050, 2053, 2071, 2059, 2076, - /* 630 */ 2072, 2077, 2075, 2049, 2091, 2078, 2062, 2098, 2101, 2103, - /* 640 */ 2067, 2105, 2074, 2107, 2096, 2102, 2084, 2087, 2088, 2019, - /* 650 */ 2021, 2128, 1975, 2023, 1925, 1954, 2081, 2133, 1983, 2100, - /* 660 */ 2113, 2138, 1953, 2117, 1990, 1977, 2140, 2141, 1991, 1992, - /* 670 */ 1996, 2001, 2139, 2110, 1860, 2058, 2042, 2060, 2095, 2064, - /* 680 */ 2097, 2065, 2083, 2119, 2120, 2086, 2079, 2082, 2085, 2094, - /* 690 */ 2124, 2109, 2112, 2114, 2127, 1887, 2126, 2099, 2144, 2116, - /* 700 */ 2135, 2118, 2121, 2143, 2161, 1932, 2171, 2172, 2182, 2186, - /* 710 */ 2187, 2189, 2122, 2125, 2178, 1984, 2198, 2184, 2174, 2235, - /* 720 */ 2130, 2195, 2132, 2134, 2136, 2142, 2146, 2080, 2147, 2239, - /* 730 */ 2200, 2089, 2148, 2129, 1954, 2191, 2212, 2145, 2002, 2153, - /* 740 */ 2245, 2228, 2028, 2155, 2157, 2159, 2162, 2160, 2164, 2219, - /* 750 */ 2166, 2167, 2226, 2170, 2256, 2093, 2173, 2165, 2175, 2243, - /* 760 */ 2246, 2179, 2177, 2249, 2181, 2183, 2252, 2185, 2188, 2255, - /* 770 */ 2190, 2193, 2257, 2192, 2197, 2260, 2205, 2203, 2204, 2208, - /* 780 */ 2209, 2207, 2284, 2213, 2295, 2231, 2284, 2284, 2271, 2267, - /* 790 */ 2269, 2303, 2305, 2308, 2309, 2310, 2311, 2312, 2313, 2314, - /* 800 */ 2275, 2253, 2277, 2259, 2322, 2320, 2323, 2325, 2341, 2327, - /* 810 */ 2328, 2329, 2290, 2055, 2331, 2056, 2332, 2333, 2334, 2335, - /* 820 */ 2352, 2339, 2377, 2342, 2330, 2336, 2380, 2346, 2343, 2344, - /* 830 */ 2384, 2350, 2345, 2357, 2401, 2365, 2358, 2370, 2415, 2379, - /* 840 */ 2381, 2419, 2406, 2396, 2408, 2410, 2411, 2412, 2414, 2416, + /* 0 */ 1300, 0, 244, 0, 489, 489, 489, 489, 489, 489, + /* 10 */ 489, 489, 489, 489, 489, 489, 733, 977, 977, 1221, + /* 20 */ 977, 977, 977, 977, 977, 977, 977, 977, 977, 977, + /* 30 */ 977, 977, 977, 977, 977, 977, 977, 977, 977, 977, + /* 40 */ 977, 977, 977, 977, 977, 977, 977, 977, 977, 977, + /* 50 */ 977, 158, 599, 331, 1, 7, 524, 7, 7, 1, + /* 60 */ 1, 7, 1469, 7, 243, 1469, 1469, 353, 7, 40, + /* 70 */ 242, 53, 53, 843, 843, 242, 29, 185, 300, 300, + /* 80 */ 454, 53, 53, 53, 53, 53, 53, 53, 53, 53, + /* 90 */ 53, 53, 217, 320, 53, 53, 342, 40, 53, 217, + /* 100 */ 53, 40, 53, 53, 40, 53, 53, 40, 53, 40, + /* 110 */ 40, 40, 53, 407, 203, 203, 447, 314, 201, 119, + /* 120 */ 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, + /* 130 */ 119, 119, 119, 119, 119, 119, 119, 119, 1138, 255, + /* 140 */ 29, 185, 904, 904, 289, 615, 615, 615, 220, 744, + /* 150 */ 744, 293, 289, 342, 364, 40, 40, 290, 40, 532, + /* 160 */ 40, 532, 532, 464, 616, 212, 212, 212, 212, 212, + /* 170 */ 212, 212, 212, 756, 361, 548, 918, 409, 409, 771, + /* 180 */ 332, 275, 131, 218, 264, 402, 542, 148, 148, 574, + /* 190 */ 380, 876, 521, 521, 521, 87, 521, 204, 881, 1028, + /* 200 */ 12, 614, 503, 1028, 1028, 1039, 1192, 1192, 1108, 998, + /* 210 */ 633, 293, 1267, 1506, 1516, 1550, 1355, 342, 1550, 342, + /* 220 */ 1393, 1576, 1585, 1562, 1585, 1562, 1435, 1576, 1585, 1576, + /* 230 */ 1562, 1435, 1435, 1521, 1530, 1576, 1538, 1576, 1576, 1576, + /* 240 */ 1623, 1599, 1623, 1599, 1550, 342, 342, 1638, 342, 1640, + /* 250 */ 1641, 342, 1640, 342, 1648, 342, 342, 1576, 342, 1623, + /* 260 */ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + /* 270 */ 40, 1576, 616, 616, 1623, 532, 532, 532, 1464, 1583, + /* 280 */ 1550, 407, 1707, 1486, 1522, 1638, 407, 1267, 1576, 532, + /* 290 */ 1442, 1460, 1442, 1460, 1438, 1568, 1442, 1462, 1473, 1483, + /* 300 */ 1267, 1489, 1491, 1466, 1471, 1472, 1585, 1760, 1665, 1501, + /* 310 */ 1640, 407, 407, 1460, 532, 532, 532, 532, 1460, 532, + /* 320 */ 1613, 407, 464, 407, 1585, 1702, 1704, 532, 1576, 407, + /* 330 */ 1793, 1785, 1623, 2950, 2950, 2950, 2950, 2950, 2950, 2950, + /* 340 */ 2950, 2950, 36, 1959, 799, 1009, 1384, 54, 81, 769, + /* 350 */ 15, 650, 1083, 898, 659, 659, 659, 659, 659, 659, + /* 360 */ 659, 659, 659, 1447, 151, 4, 500, 500, 86, 583, + /* 370 */ 284, 302, 657, 763, 811, 1082, 561, 882, 882, 1133, + /* 380 */ 50, 534, 1133, 1133, 1133, 912, 174, 1177, 1238, 1255, + /* 390 */ 1129, 1271, 1169, 1174, 1180, 1184, 1264, 1270, 1292, 1302, + /* 400 */ 1339, 1350, 1095, 1240, 1276, 1265, 1283, 1318, 1371, 1162, + /* 410 */ 773, 44, 1378, 1379, 1380, 1394, 1397, 1399, 1331, 1400, + /* 420 */ 1275, 1409, 1314, 1414, 1456, 1457, 1467, 1470, 1482, 1333, + /* 430 */ 1345, 1349, 1392, 1505, 1366, 1406, 1874, 1880, 1881, 1831, + /* 440 */ 1877, 1846, 1659, 1850, 1851, 1852, 1663, 1891, 1855, 1856, + /* 450 */ 1667, 1858, 1896, 1671, 1899, 1863, 1903, 1868, 1906, 1894, + /* 460 */ 1917, 1882, 1696, 1920, 1711, 1922, 1714, 1717, 1731, 1735, + /* 470 */ 1938, 1939, 1940, 1743, 1747, 1942, 1945, 1798, 1900, 1901, + /* 480 */ 1947, 1914, 1952, 1953, 1919, 1908, 1954, 1911, 1961, 1918, + /* 490 */ 1962, 1964, 1965, 1929, 1967, 1968, 1980, 1981, 1982, 1984, + /* 500 */ 1806, 1948, 1986, 1822, 1988, 1989, 1990, 1991, 1992, 1993, + /* 510 */ 1995, 1997, 1998, 2001, 2008, 2012, 2014, 2015, 2016, 2017, + /* 520 */ 2018, 2026, 2027, 1979, 2029, 1985, 2031, 2033, 2034, 2036, + /* 530 */ 2037, 2038, 2039, 2020, 2040, 1895, 2044, 1902, 2045, 1904, + /* 540 */ 2047, 2051, 2030, 2004, 2035, 2006, 2058, 1994, 2023, 2061, + /* 550 */ 2013, 2062, 2019, 2063, 2069, 2043, 2032, 2024, 2082, 2048, + /* 560 */ 2041, 2049, 2086, 2050, 2057, 2053, 2089, 2056, 2096, 2054, + /* 570 */ 2067, 2065, 2064, 2068, 2097, 2071, 2110, 2072, 2070, 2114, + /* 580 */ 2116, 2118, 2121, 2080, 1930, 2124, 2064, 2076, 2126, 2127, + /* 590 */ 2059, 2128, 2130, 2104, 2094, 2091, 2146, 2111, 2098, 2112, + /* 600 */ 2152, 2119, 2102, 2113, 2157, 2123, 2107, 2120, 2163, 2165, + /* 610 */ 2166, 2167, 2168, 2170, 2060, 2073, 2134, 2150, 2173, 2137, + /* 620 */ 2139, 2141, 2143, 2144, 2145, 2147, 2148, 2154, 2155, 2153, + /* 630 */ 2156, 2161, 2158, 2189, 2169, 2194, 2174, 2197, 2176, 2149, + /* 640 */ 2199, 2179, 2175, 2204, 2214, 2215, 2181, 2216, 2184, 2223, + /* 650 */ 2202, 2205, 2190, 2191, 2192, 2122, 2129, 2226, 2074, 2131, + /* 660 */ 2022, 2064, 2193, 2233, 2075, 2203, 2217, 2241, 2046, 2221, + /* 670 */ 2078, 2077, 2244, 2245, 2088, 2085, 2103, 2099, 2243, 2219, + /* 680 */ 1963, 2140, 2183, 2180, 2198, 2188, 2239, 2195, 2187, 2220, + /* 690 */ 2222, 2196, 2201, 2206, 2211, 2207, 2263, 2248, 2250, 2213, + /* 700 */ 2268, 2025, 2224, 2225, 2270, 2229, 2269, 2235, 2238, 2251, + /* 710 */ 2272, 2079, 2284, 2313, 2314, 2315, 2317, 2318, 2240, 2249, + /* 720 */ 2260, 2101, 2277, 2279, 2367, 2368, 2262, 2332, 2271, 2267, + /* 730 */ 2274, 2276, 2282, 2200, 2283, 2376, 2335, 2209, 2285, 2264, + /* 740 */ 2064, 2330, 2351, 2295, 2171, 2297, 2379, 2382, 2172, 2298, + /* 750 */ 2299, 2301, 2302, 2305, 2307, 2360, 2306, 2316, 2381, 2323, + /* 760 */ 2403, 2210, 2331, 2324, 2334, 2406, 2408, 2339, 2340, 2412, + /* 770 */ 2343, 2344, 2414, 2346, 2347, 2417, 2350, 2352, 2422, 2354, + /* 780 */ 2355, 2425, 2357, 2337, 2338, 2341, 2342, 2364, 2434, 2365, + /* 790 */ 2436, 2369, 2434, 2434, 2452, 2405, 2404, 2441, 2442, 2444, + /* 800 */ 2446, 2447, 2448, 2449, 2450, 2451, 2411, 2389, 2413, 2391, + /* 810 */ 2460, 2458, 2461, 2462, 2472, 2464, 2465, 2474, 2435, 2154, + /* 820 */ 2477, 2155, 2478, 2479, 2480, 2482, 2496, 2483, 2522, 2486, + /* 830 */ 2475, 2491, 2535, 2499, 2487, 2498, 2541, 2505, 2492, 2502, + /* 840 */ 2545, 2509, 2497, 2508, 2547, 2517, 2518, 2556, 2536, 2524, + /* 850 */ 2537, 2539, 2540, 2542, 2549, 2543, }; #define YY_REDUCE_COUNT (341) -#define YY_REDUCE_MIN (-478) -#define YY_REDUCE_MAX (2694) +#define YY_REDUCE_MIN (-480) +#define YY_REDUCE_MAX (2481) static const short yy_reduce_ofst[] = { - /* 0 */ 661, -315, 142, 178, -32, 381, 474, 620, 650, 868, - /* 10 */ 1128, 1241, 1284, 1363, 1392, 1449, 1010, -90, 1472, 1487, - /* 20 */ 1557, 1582, 1653, 1720, 1736, 1751, 1846, 1862, 1929, 1264, - /* 30 */ 1944, 1961, 2039, 2054, 2111, 2137, 2180, 2206, 2263, 2289, - /* 40 */ 2321, 2359, 2427, 2452, 2484, 2510, 2579, 2595, 2662, 2678, - /* 50 */ 2694, -290, 404, -228, 192, 496, 739, 760, 859, 98, - /* 60 */ 654, 881, 245, -478, -264, -89, 156, -288, -191, -390, - /* 70 */ -152, -211, 145, -366, -361, -328, -381, 249, -173, 184, - /* 80 */ 149, -183, 252, 298, 319, 174, 322, 460, 500, 533, - /* 90 */ 557, 385, -81, -291, 619, 625, 190, -331, 656, 372, - /* 100 */ 669, -250, 672, 694, 304, 698, 703, -141, 733, 495, - /* 110 */ -115, 763, 796, 628, -31, -31, -349, -170, 272, 179, - /* 120 */ 380, 453, 534, 740, 758, 782, 810, 825, 826, 827, - /* 130 */ 840, 861, 862, 872, 874, 885, 889, 890, -143, 113, - /* 140 */ -43, 401, 452, 459, 692, 113, 151, 546, -377, 275, - /* 150 */ 279, -2, 803, 538, -385, 700, 854, 334, 593, 487, - /* 160 */ 860, 683, 849, 866, 902, -395, 493, 518, 531, 822, - /* 170 */ 922, 941, 822, -425, 569, 990, 953, 894, 894, 875, - /* 180 */ 877, 912, 1031, 906, 894, 1015, 1015, 1025, 1038, 1007, - /* 190 */ 1064, 1011, 932, 959, 960, 1045, 972, 1015, 1106, 1059, - /* 200 */ 1113, 1077, 1047, 1065, 1066, 1015, 1000, 1002, 986, 1019, - /* 210 */ 1006, 1112, 1070, 1056, 1060, 1068, 1069, 1137, 1071, 1139, - /* 220 */ 1082, 1152, 1155, 1111, 1162, 1115, 1119, 1168, 1166, 1170, - /* 230 */ 1122, 1126, 1127, 1165, 1169, 1179, 1171, 1183, 1184, 1187, - /* 240 */ 1199, 1193, 1200, 1194, 1120, 1185, 1186, 1163, 1189, 1207, - /* 250 */ 1145, 1203, 1212, 1213, 1174, 1216, 1217, 1227, 1223, 1240, - /* 260 */ 1208, 1209, 1210, 1211, 1214, 1215, 1218, 1219, 1220, 1224, - /* 270 */ 1225, 1245, 1250, 1255, 1243, 1230, 1232, 1233, 1175, 1178, - /* 280 */ 1181, 1251, 1201, 1188, 1205, 1226, 1261, 1231, 1275, 1237, - /* 290 */ 1153, 1229, 1157, 1247, 1156, 1160, 1173, 1180, 1182, 1190, - /* 300 */ 1246, 1195, 1239, 1172, 1234, 1192, 1317, 1252, 1235, 1238, - /* 310 */ 1335, 1331, 1337, 1281, 1301, 1304, 1321, 1324, 1308, 1329, - /* 320 */ 1316, 1374, 1343, 1375, 1382, 1282, 1362, 1347, 1394, 1389, - /* 330 */ 1409, 1406, 1410, 1334, 1332, 1341, 1345, 1384, 1385, 1393, - /* 340 */ 1402, 1425, + /* 0 */ 588, -316, 143, 181, 239, 388, 420, 543, 671, 729, + /* 10 */ 915, 973, 1136, 1166, 1234, 1277, -89, 1370, 894, 708, + /* 20 */ 1388, 1403, 1468, 1446, 1511, 1541, 1609, 1639, 1674, 1745, + /* 30 */ 1803, 1818, 1861, 1876, 1898, 1933, 1956, 1971, 2042, 2066, + /* 40 */ 2135, 2151, 2178, 2208, 2273, 2291, 2348, 2371, 2386, 2457, + /* 50 */ 2481, -318, -227, -434, 468, 808, 824, 1006, 1041, -180, + /* 60 */ 569, 1048, 877, -480, -371, 535, 672, -413, -311, -196, + /* 70 */ -359, -201, -76, -367, -362, -416, -343, -324, -93, 150, + /* 80 */ -19, -74, 247, 322, 378, 229, 337, 399, 415, 427, + /* 90 */ 439, 387, 83, -327, 465, 471, 51, 101, 486, 422, + /* 100 */ 499, 485, 555, 622, 560, 653, 677, 662, 715, 639, + /* 110 */ 663, 758, 720, -226, -118, -118, -124, -351, 405, -350, + /* 120 */ 3, 147, 421, 510, 580, 603, 649, 748, 753, 766, + /* 130 */ 792, 800, 821, 828, 837, 839, 840, 846, -314, -68, + /* 140 */ -131, 155, 436, 613, 754, -68, 288, 458, -364, 91, + /* 150 */ 383, 736, 768, 777, 805, 721, 842, 725, 619, 825, + /* 160 */ 845, 826, 852, 874, 752, 254, 296, 313, 323, 363, + /* 170 */ 658, 772, 363, 431, 567, 704, 885, 759, 759, 798, + /* 180 */ 860, 863, 1008, 914, 759, 1014, 1014, 1029, 1030, 995, + /* 190 */ 1052, 1023, 941, 944, 967, 1044, 974, 1014, 1106, 1071, + /* 200 */ 1137, 1101, 1072, 1094, 1110, 1014, 1045, 1047, 1031, 1063, + /* 210 */ 1051, 1153, 1118, 1112, 1107, 1122, 1120, 1194, 1128, 1197, + /* 220 */ 1152, 1230, 1232, 1187, 1239, 1189, 1198, 1244, 1245, 1247, + /* 230 */ 1199, 1203, 1205, 1249, 1252, 1266, 1258, 1274, 1279, 1280, + /* 240 */ 1278, 1284, 1289, 1286, 1208, 1281, 1282, 1243, 1285, 1287, + /* 250 */ 1226, 1288, 1291, 1290, 1246, 1293, 1295, 1296, 1298, 1308, + /* 260 */ 1299, 1303, 1304, 1305, 1306, 1309, 1310, 1313, 1322, 1323, + /* 270 */ 1324, 1311, 1317, 1319, 1312, 1268, 1272, 1273, 1235, 1259, + /* 280 */ 1297, 1336, 1307, 1301, 1315, 1320, 1348, 1316, 1357, 1334, + /* 290 */ 1231, 1321, 1248, 1326, 1253, 1260, 1263, 1269, 1294, 1327, + /* 300 */ 1329, 1325, 1330, 1256, 1261, 1328, 1407, 1332, 1341, 1344, + /* 310 */ 1410, 1408, 1411, 1361, 1373, 1375, 1382, 1383, 1362, 1385, + /* 320 */ 1372, 1421, 1405, 1426, 1434, 1335, 1415, 1398, 1441, 1436, + /* 330 */ 1461, 1459, 1475, 1389, 1387, 1412, 1422, 1451, 1463, 1477, + /* 340 */ 1476, 1504, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 10 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 20 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 30 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 40 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 50 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 60 */ 1924, 2259, 1924, 1924, 2222, 1924, 1924, 1924, 1924, 1924, - /* 70 */ 1924, 1924, 1924, 1924, 1924, 1924, 2229, 1924, 1924, 1924, - /* 80 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 90 */ 1924, 1924, 1924, 1924, 1924, 1924, 2021, 1924, 1924, 1924, - /* 100 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 110 */ 1924, 1924, 1924, 2019, 2462, 1924, 1924, 2491, 1924, 1924, - /* 120 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 130 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 2474, - /* 140 */ 1924, 1924, 1995, 1995, 1924, 2474, 2474, 2474, 2019, 2434, - /* 150 */ 2434, 1924, 1924, 2021, 2297, 1924, 1924, 1924, 1924, 1924, - /* 160 */ 1924, 1924, 1924, 2144, 1954, 1924, 1924, 1924, 1924, 2168, - /* 170 */ 1924, 1924, 1924, 2285, 1924, 1924, 2520, 2466, 2467, 2580, - /* 180 */ 1924, 2485, 1924, 2523, 2480, 1924, 1924, 1924, 1924, 2234, - /* 190 */ 1924, 2510, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 200 */ 1924, 2097, 2279, 1924, 1924, 1924, 1924, 1924, 2564, 2464, - /* 210 */ 2504, 1924, 2514, 1924, 2322, 1924, 2311, 2021, 1924, 2021, - /* 220 */ 2272, 2217, 1924, 2227, 1924, 2227, 2224, 1924, 1924, 1924, - /* 230 */ 2227, 2224, 2224, 2086, 2082, 1924, 2080, 1924, 1924, 1924, - /* 240 */ 1924, 1979, 1924, 1979, 1924, 2021, 2021, 1924, 2021, 1924, - /* 250 */ 1924, 2021, 1924, 2021, 1924, 2021, 2021, 1924, 2021, 1924, - /* 260 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 270 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 2309, 2295, - /* 280 */ 1924, 2019, 1924, 2283, 2281, 1924, 2019, 2514, 1924, 1924, - /* 290 */ 2534, 2529, 2534, 2529, 2548, 2544, 2534, 2553, 2550, 2516, - /* 300 */ 2514, 2497, 2493, 2583, 2570, 2566, 1924, 1924, 2502, 2500, - /* 310 */ 1924, 2019, 2019, 2529, 1924, 1924, 1924, 1924, 2529, 1924, - /* 320 */ 1924, 2019, 1924, 2019, 1924, 1924, 2113, 1924, 1924, 2019, - /* 330 */ 1924, 1963, 1924, 2274, 2300, 2255, 2255, 2147, 2147, 2147, - /* 340 */ 2022, 1929, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 350 */ 1924, 1924, 1924, 1924, 2547, 2546, 2387, 1924, 2438, 2437, - /* 360 */ 2436, 2427, 2386, 2109, 1924, 1924, 2385, 2384, 1924, 1924, - /* 370 */ 1924, 1924, 1924, 1924, 1924, 1924, 2246, 2245, 2378, 1924, - /* 380 */ 1924, 2379, 2377, 2376, 1924, 1924, 1924, 1924, 1924, 1924, - /* 390 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 400 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 2567, 2571, - /* 410 */ 1924, 1924, 1924, 1924, 1924, 1924, 2463, 1924, 1924, 1924, - /* 420 */ 2358, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 430 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 440 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 450 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 460 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 470 */ 1924, 1924, 1924, 1924, 1924, 2223, 1924, 1924, 1924, 1924, - /* 480 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 490 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 500 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 510 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 520 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 530 */ 1924, 1924, 1924, 1924, 1924, 2238, 1924, 1924, 1924, 1924, - /* 540 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 550 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 560 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1968, 2365, 1924, - /* 570 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 580 */ 1924, 1924, 2368, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 590 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 600 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 610 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 620 */ 1924, 1924, 1924, 2061, 2060, 1924, 1924, 1924, 1924, 1924, - /* 630 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 640 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 2369, - /* 650 */ 1924, 1924, 1924, 1924, 1924, 2360, 1924, 1924, 1924, 1924, - /* 660 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 670 */ 1924, 1924, 2563, 2517, 1924, 1924, 1924, 1924, 1924, 1924, - /* 680 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 690 */ 1924, 1924, 2358, 1924, 2545, 1924, 1924, 1924, 1924, 1924, - /* 700 */ 1924, 1924, 2561, 1924, 2565, 1924, 1924, 1924, 1924, 1924, - /* 710 */ 1924, 1924, 2473, 2469, 1924, 1924, 2465, 1924, 1924, 1924, - /* 720 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 730 */ 1924, 1924, 1924, 1924, 2357, 1924, 2424, 1924, 1924, 1924, - /* 740 */ 2458, 1924, 1924, 2409, 1924, 1924, 1924, 1924, 1924, 1924, - /* 750 */ 1924, 1924, 1924, 2369, 1924, 2372, 1924, 1924, 1924, 1924, - /* 760 */ 1924, 2141, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 770 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 2125, 2123, 2122, - /* 780 */ 2121, 1924, 2154, 1924, 1924, 1924, 2150, 2149, 1924, 1924, - /* 790 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 800 */ 1924, 1924, 1924, 1924, 2040, 1924, 1924, 1924, 1924, 1924, - /* 810 */ 1924, 1924, 1924, 2032, 1924, 2031, 1924, 1924, 1924, 1924, - /* 820 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 830 */ 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, 1924, - /* 840 */ 1924, 1924, 1924, 1953, 1924, 1924, 1924, 1924, 1924, 1924, + /* 0 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 10 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 20 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 30 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 40 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 50 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 60 */ 1935, 2275, 1935, 1935, 2238, 1935, 1935, 1935, 1935, 1935, + /* 70 */ 1935, 1935, 1935, 1935, 1935, 1935, 2245, 1935, 1935, 1935, + /* 80 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 90 */ 1935, 1935, 1935, 1935, 1935, 1935, 2034, 1935, 1935, 1935, + /* 100 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 110 */ 1935, 1935, 1935, 2032, 2478, 1935, 1935, 2507, 1935, 1935, + /* 120 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 130 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 2490, + /* 140 */ 1935, 1935, 2006, 2006, 1935, 2490, 2490, 2490, 2032, 2450, + /* 150 */ 2450, 1935, 1935, 2034, 2313, 1935, 1935, 1935, 1935, 1935, + /* 160 */ 1935, 1935, 1935, 2157, 1965, 1935, 1935, 1935, 1935, 2181, + /* 170 */ 1935, 1935, 1935, 2301, 1935, 1935, 2536, 2482, 2483, 2596, + /* 180 */ 1935, 2501, 1935, 2539, 2496, 1935, 1935, 1935, 1935, 2250, + /* 190 */ 1935, 2526, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 200 */ 1935, 2110, 2295, 1935, 1935, 1935, 1935, 1935, 2580, 2480, + /* 210 */ 2520, 1935, 2530, 1935, 2338, 1935, 2327, 2034, 1935, 2034, + /* 220 */ 2288, 2233, 1935, 2243, 1935, 2243, 2240, 1935, 1935, 1935, + /* 230 */ 2243, 2240, 2240, 2099, 2095, 1935, 2093, 1935, 1935, 1935, + /* 240 */ 1935, 1990, 1935, 1990, 1935, 2034, 2034, 1935, 2034, 1935, + /* 250 */ 1935, 2034, 1935, 2034, 1935, 2034, 2034, 1935, 2034, 1935, + /* 260 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 270 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 2325, 2311, + /* 280 */ 1935, 2032, 1935, 2299, 2297, 1935, 2032, 2530, 1935, 1935, + /* 290 */ 2550, 2545, 2550, 2545, 2564, 2560, 2550, 2569, 2566, 2532, + /* 300 */ 2530, 2513, 2509, 2599, 2586, 2582, 1935, 1935, 2518, 2516, + /* 310 */ 1935, 2032, 2032, 2545, 1935, 1935, 1935, 1935, 2545, 1935, + /* 320 */ 1935, 2032, 1935, 2032, 1935, 1935, 2126, 1935, 1935, 2032, + /* 330 */ 1935, 1974, 1935, 2290, 2316, 2271, 2271, 2160, 2160, 2160, + /* 340 */ 2035, 1940, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 350 */ 1935, 1935, 1935, 1935, 2563, 2562, 2403, 1935, 2454, 2453, + /* 360 */ 2452, 2443, 2402, 2122, 1935, 1935, 2401, 2400, 1935, 1935, + /* 370 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 2262, 2261, 2394, + /* 380 */ 1935, 1935, 2395, 2393, 2392, 1935, 1935, 1935, 1935, 1935, + /* 390 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 400 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 410 */ 2583, 2587, 1935, 1935, 1935, 1935, 1935, 1935, 2479, 1935, + /* 420 */ 1935, 1935, 2374, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 430 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 440 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 450 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 460 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 470 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 2239, 1935, 1935, + /* 480 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 490 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 500 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 510 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 520 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 530 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 2254, + /* 540 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 550 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 560 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 570 */ 1935, 1979, 2381, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 580 */ 1935, 1935, 1935, 1935, 1935, 1935, 2384, 1935, 1935, 1935, + /* 590 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 600 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 610 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 620 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 2074, 2073, 1935, + /* 630 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 640 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 650 */ 1935, 1935, 1935, 1935, 1935, 2385, 1935, 1935, 1935, 1935, + /* 660 */ 1935, 2376, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 670 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 2579, 2533, + /* 680 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 690 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 2374, 1935, + /* 700 */ 2561, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 2577, 1935, + /* 710 */ 2581, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 2489, 2485, + /* 720 */ 1935, 1935, 2481, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 730 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 740 */ 2373, 1935, 2440, 1935, 1935, 1935, 2474, 1935, 1935, 2425, + /* 750 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 2385, + /* 760 */ 1935, 2388, 1935, 1935, 1935, 1935, 1935, 2154, 1935, 1935, + /* 770 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 780 */ 1935, 1935, 1935, 2138, 2136, 2135, 2134, 1935, 2167, 1935, + /* 790 */ 1935, 1935, 2163, 2162, 1935, 1935, 1935, 1935, 1935, 1935, + /* 800 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 810 */ 2053, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 2045, + /* 820 */ 1935, 2044, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 830 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, + /* 840 */ 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1935, 1964, + /* 850 */ 1935, 1935, 1935, 1935, 1935, 1935, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1188,6 +1147,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* NK_IPTOKEN => nothing */ 0, /* FORCE => nothing */ 0, /* UNSAFE => nothing */ + 0, /* CLUSTER => nothing */ 0, /* LOCAL => nothing */ 0, /* QNODE => nothing */ 0, /* BNODE => nothing */ @@ -1234,7 +1194,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* BWLIMIT => nothing */ 0, /* START => nothing */ 0, /* TIMESTAMP => nothing */ - 307, /* END => ABORT */ + 309, /* END => ABORT */ 0, /* TABLE => nothing */ 0, /* NK_LP => nothing */ 0, /* NK_RP => nothing */ @@ -1288,11 +1248,13 @@ static const YYCODETYPE yyFallback[] = { 0, /* CONNECTIONS => nothing */ 0, /* LICENCES => nothing */ 0, /* GRANTS => nothing */ + 0, /* FULL => nothing */ + 0, /* LOGS => nothing */ + 0, /* MACHINES => nothing */ 0, /* QUERIES => nothing */ 0, /* SCORES => nothing */ 0, /* TOPICS => nothing */ 0, /* VARIABLES => nothing */ - 0, /* CLUSTER => nothing */ 0, /* BNODES => nothing */ 0, /* SNODES => nothing */ 0, /* TRANSACTIONS => nothing */ @@ -1302,7 +1264,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* VNODES => nothing */ 0, /* ALIVE => nothing */ 0, /* VIEWS => nothing */ - 307, /* VIEW => ABORT */ + 309, /* VIEW => ABORT */ 0, /* COMPACTS => nothing */ 0, /* NORMAL => nothing */ 0, /* CHILD => nothing */ @@ -1401,9 +1363,8 @@ static const YYCODETYPE yyFallback[] = { 0, /* INNER => nothing */ 0, /* LEFT => nothing */ 0, /* RIGHT => nothing */ - 0, /* FULL => nothing */ 0, /* OUTER => nothing */ - 307, /* SEMI => ABORT */ + 309, /* SEMI => ABORT */ 0, /* ANTI => nothing */ 0, /* ASOF => nothing */ 0, /* WINDOW => nothing */ @@ -1438,54 +1399,54 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASC => nothing */ 0, /* NULLS => nothing */ 0, /* ABORT => nothing */ - 307, /* AFTER => ABORT */ - 307, /* ATTACH => ABORT */ - 307, /* BEFORE => ABORT */ - 307, /* BEGIN => ABORT */ - 307, /* BITAND => ABORT */ - 307, /* BITNOT => ABORT */ - 307, /* BITOR => ABORT */ - 307, /* BLOCKS => ABORT */ - 307, /* CHANGE => ABORT */ - 307, /* COMMA => ABORT */ - 307, /* CONCAT => ABORT */ - 307, /* CONFLICT => ABORT */ - 307, /* COPY => ABORT */ - 307, /* DEFERRED => ABORT */ - 307, /* DELIMITERS => ABORT */ - 307, /* DETACH => ABORT */ - 307, /* DIVIDE => ABORT */ - 307, /* DOT => ABORT */ - 307, /* EACH => ABORT */ - 307, /* FAIL => ABORT */ - 307, /* FILE => ABORT */ - 307, /* FOR => ABORT */ - 307, /* GLOB => ABORT */ - 307, /* ID => ABORT */ - 307, /* IMMEDIATE => ABORT */ - 307, /* IMPORT => ABORT */ - 307, /* INITIALLY => ABORT */ - 307, /* INSTEAD => ABORT */ - 307, /* ISNULL => ABORT */ - 307, /* KEY => ABORT */ - 307, /* MODULES => ABORT */ - 307, /* NK_BITNOT => ABORT */ - 307, /* NK_SEMI => ABORT */ - 307, /* NOTNULL => ABORT */ - 307, /* OF => ABORT */ - 307, /* PLUS => ABORT */ - 307, /* PRIVILEGE => ABORT */ - 307, /* RAISE => ABORT */ - 307, /* RESTRICT => ABORT */ - 307, /* ROW => ABORT */ - 307, /* STAR => ABORT */ - 307, /* STATEMENT => ABORT */ - 307, /* STRICT => ABORT */ - 307, /* STRING => ABORT */ - 307, /* TIMES => ABORT */ - 307, /* VALUES => ABORT */ - 307, /* VARIABLE => ABORT */ - 307, /* WAL => ABORT */ + 309, /* AFTER => ABORT */ + 309, /* ATTACH => ABORT */ + 309, /* BEFORE => ABORT */ + 309, /* BEGIN => ABORT */ + 309, /* BITAND => ABORT */ + 309, /* BITNOT => ABORT */ + 309, /* BITOR => ABORT */ + 309, /* BLOCKS => ABORT */ + 309, /* CHANGE => ABORT */ + 309, /* COMMA => ABORT */ + 309, /* CONCAT => ABORT */ + 309, /* CONFLICT => ABORT */ + 309, /* COPY => ABORT */ + 309, /* DEFERRED => ABORT */ + 309, /* DELIMITERS => ABORT */ + 309, /* DETACH => ABORT */ + 309, /* DIVIDE => ABORT */ + 309, /* DOT => ABORT */ + 309, /* EACH => ABORT */ + 309, /* FAIL => ABORT */ + 309, /* FILE => ABORT */ + 309, /* FOR => ABORT */ + 309, /* GLOB => ABORT */ + 309, /* ID => ABORT */ + 309, /* IMMEDIATE => ABORT */ + 309, /* IMPORT => ABORT */ + 309, /* INITIALLY => ABORT */ + 309, /* INSTEAD => ABORT */ + 309, /* ISNULL => ABORT */ + 309, /* KEY => ABORT */ + 309, /* MODULES => ABORT */ + 309, /* NK_BITNOT => ABORT */ + 309, /* NK_SEMI => ABORT */ + 309, /* NOTNULL => ABORT */ + 309, /* OF => ABORT */ + 309, /* PLUS => ABORT */ + 309, /* PRIVILEGE => ABORT */ + 309, /* RAISE => ABORT */ + 309, /* RESTRICT => ABORT */ + 309, /* ROW => ABORT */ + 309, /* STAR => ABORT */ + 309, /* STATEMENT => ABORT */ + 309, /* STRICT => ABORT */ + 309, /* STRING => ABORT */ + 309, /* TIMES => ABORT */ + 309, /* VALUES => ABORT */ + 309, /* VARIABLE => ABORT */ + 309, /* WAL => ABORT */ }; #endif /* YYFALLBACK */ @@ -1631,470 +1592,472 @@ static const char *const yyTokenName[] = { /* 55 */ "NK_IPTOKEN", /* 56 */ "FORCE", /* 57 */ "UNSAFE", - /* 58 */ "LOCAL", - /* 59 */ "QNODE", - /* 60 */ "BNODE", - /* 61 */ "SNODE", - /* 62 */ "MNODE", - /* 63 */ "VNODE", - /* 64 */ "DATABASE", - /* 65 */ "USE", - /* 66 */ "FLUSH", - /* 67 */ "TRIM", - /* 68 */ "COMPACT", - /* 69 */ "IF", - /* 70 */ "NOT", - /* 71 */ "EXISTS", - /* 72 */ "BUFFER", - /* 73 */ "CACHEMODEL", - /* 74 */ "CACHESIZE", - /* 75 */ "COMP", - /* 76 */ "DURATION", - /* 77 */ "NK_VARIABLE", - /* 78 */ "MAXROWS", - /* 79 */ "MINROWS", - /* 80 */ "KEEP", - /* 81 */ "PAGES", - /* 82 */ "PAGESIZE", - /* 83 */ "TSDB_PAGESIZE", - /* 84 */ "PRECISION", - /* 85 */ "REPLICA", - /* 86 */ "VGROUPS", - /* 87 */ "SINGLE_STABLE", - /* 88 */ "RETENTIONS", - /* 89 */ "SCHEMALESS", - /* 90 */ "WAL_LEVEL", - /* 91 */ "WAL_FSYNC_PERIOD", - /* 92 */ "WAL_RETENTION_PERIOD", - /* 93 */ "WAL_RETENTION_SIZE", - /* 94 */ "WAL_ROLL_PERIOD", - /* 95 */ "WAL_SEGMENT_SIZE", - /* 96 */ "STT_TRIGGER", - /* 97 */ "TABLE_PREFIX", - /* 98 */ "TABLE_SUFFIX", - /* 99 */ "KEEP_TIME_OFFSET", - /* 100 */ "NK_COLON", - /* 101 */ "BWLIMIT", - /* 102 */ "START", - /* 103 */ "TIMESTAMP", - /* 104 */ "END", - /* 105 */ "TABLE", - /* 106 */ "NK_LP", - /* 107 */ "NK_RP", - /* 108 */ "STABLE", - /* 109 */ "COLUMN", - /* 110 */ "MODIFY", - /* 111 */ "RENAME", - /* 112 */ "TAG", - /* 113 */ "SET", - /* 114 */ "NK_EQ", - /* 115 */ "USING", - /* 116 */ "TAGS", - /* 117 */ "BOOL", - /* 118 */ "TINYINT", - /* 119 */ "SMALLINT", - /* 120 */ "INT", - /* 121 */ "INTEGER", - /* 122 */ "BIGINT", - /* 123 */ "FLOAT", - /* 124 */ "DOUBLE", - /* 125 */ "BINARY", - /* 126 */ "NCHAR", - /* 127 */ "UNSIGNED", - /* 128 */ "JSON", - /* 129 */ "VARCHAR", - /* 130 */ "MEDIUMBLOB", - /* 131 */ "BLOB", - /* 132 */ "VARBINARY", - /* 133 */ "GEOMETRY", - /* 134 */ "DECIMAL", - /* 135 */ "COMMENT", - /* 136 */ "MAX_DELAY", - /* 137 */ "WATERMARK", - /* 138 */ "ROLLUP", - /* 139 */ "TTL", - /* 140 */ "SMA", - /* 141 */ "DELETE_MARK", - /* 142 */ "FIRST", - /* 143 */ "LAST", - /* 144 */ "SHOW", - /* 145 */ "PRIVILEGES", - /* 146 */ "DATABASES", - /* 147 */ "TABLES", - /* 148 */ "STABLES", - /* 149 */ "MNODES", - /* 150 */ "QNODES", - /* 151 */ "FUNCTIONS", - /* 152 */ "INDEXES", - /* 153 */ "ACCOUNTS", - /* 154 */ "APPS", - /* 155 */ "CONNECTIONS", - /* 156 */ "LICENCES", - /* 157 */ "GRANTS", - /* 158 */ "QUERIES", - /* 159 */ "SCORES", - /* 160 */ "TOPICS", - /* 161 */ "VARIABLES", - /* 162 */ "CLUSTER", - /* 163 */ "BNODES", - /* 164 */ "SNODES", - /* 165 */ "TRANSACTIONS", - /* 166 */ "DISTRIBUTED", - /* 167 */ "CONSUMERS", - /* 168 */ "SUBSCRIPTIONS", - /* 169 */ "VNODES", - /* 170 */ "ALIVE", - /* 171 */ "VIEWS", - /* 172 */ "VIEW", - /* 173 */ "COMPACTS", - /* 174 */ "NORMAL", - /* 175 */ "CHILD", - /* 176 */ "LIKE", - /* 177 */ "TBNAME", - /* 178 */ "QTAGS", - /* 179 */ "AS", - /* 180 */ "SYSTEM", - /* 181 */ "INDEX", - /* 182 */ "FUNCTION", - /* 183 */ "INTERVAL", - /* 184 */ "COUNT", - /* 185 */ "LAST_ROW", - /* 186 */ "META", - /* 187 */ "ONLY", - /* 188 */ "TOPIC", - /* 189 */ "CONSUMER", - /* 190 */ "GROUP", - /* 191 */ "DESC", - /* 192 */ "DESCRIBE", - /* 193 */ "RESET", - /* 194 */ "QUERY", - /* 195 */ "CACHE", - /* 196 */ "EXPLAIN", - /* 197 */ "ANALYZE", - /* 198 */ "VERBOSE", - /* 199 */ "NK_BOOL", - /* 200 */ "RATIO", - /* 201 */ "NK_FLOAT", - /* 202 */ "OUTPUTTYPE", - /* 203 */ "AGGREGATE", - /* 204 */ "BUFSIZE", - /* 205 */ "LANGUAGE", - /* 206 */ "REPLACE", - /* 207 */ "STREAM", - /* 208 */ "INTO", - /* 209 */ "PAUSE", - /* 210 */ "RESUME", - /* 211 */ "TRIGGER", - /* 212 */ "AT_ONCE", - /* 213 */ "WINDOW_CLOSE", - /* 214 */ "IGNORE", - /* 215 */ "EXPIRED", - /* 216 */ "FILL_HISTORY", - /* 217 */ "UPDATE", - /* 218 */ "SUBTABLE", - /* 219 */ "UNTREATED", - /* 220 */ "KILL", - /* 221 */ "CONNECTION", - /* 222 */ "TRANSACTION", - /* 223 */ "BALANCE", - /* 224 */ "VGROUP", - /* 225 */ "LEADER", - /* 226 */ "MERGE", - /* 227 */ "REDISTRIBUTE", - /* 228 */ "SPLIT", - /* 229 */ "DELETE", - /* 230 */ "INSERT", - /* 231 */ "NULL", - /* 232 */ "NK_QUESTION", - /* 233 */ "NK_ALIAS", - /* 234 */ "NK_ARROW", - /* 235 */ "ROWTS", - /* 236 */ "QSTART", - /* 237 */ "QEND", - /* 238 */ "QDURATION", - /* 239 */ "WSTART", - /* 240 */ "WEND", - /* 241 */ "WDURATION", - /* 242 */ "IROWTS", - /* 243 */ "ISFILLED", - /* 244 */ "CAST", - /* 245 */ "NOW", - /* 246 */ "TODAY", - /* 247 */ "TIMEZONE", - /* 248 */ "CLIENT_VERSION", - /* 249 */ "SERVER_VERSION", - /* 250 */ "SERVER_STATUS", - /* 251 */ "CURRENT_USER", - /* 252 */ "CASE", - /* 253 */ "WHEN", - /* 254 */ "THEN", - /* 255 */ "ELSE", - /* 256 */ "BETWEEN", - /* 257 */ "IS", - /* 258 */ "NK_LT", - /* 259 */ "NK_GT", - /* 260 */ "NK_LE", - /* 261 */ "NK_GE", - /* 262 */ "NK_NE", - /* 263 */ "MATCH", - /* 264 */ "NMATCH", - /* 265 */ "CONTAINS", - /* 266 */ "IN", - /* 267 */ "JOIN", - /* 268 */ "INNER", - /* 269 */ "LEFT", - /* 270 */ "RIGHT", - /* 271 */ "FULL", - /* 272 */ "OUTER", - /* 273 */ "SEMI", - /* 274 */ "ANTI", - /* 275 */ "ASOF", - /* 276 */ "WINDOW", - /* 277 */ "WINDOW_OFFSET", - /* 278 */ "JLIMIT", - /* 279 */ "SELECT", - /* 280 */ "NK_HINT", - /* 281 */ "DISTINCT", - /* 282 */ "WHERE", - /* 283 */ "PARTITION", - /* 284 */ "BY", - /* 285 */ "SESSION", - /* 286 */ "STATE_WINDOW", - /* 287 */ "EVENT_WINDOW", - /* 288 */ "SLIDING", - /* 289 */ "FILL", - /* 290 */ "VALUE", - /* 291 */ "VALUE_F", - /* 292 */ "NONE", - /* 293 */ "PREV", - /* 294 */ "NULL_F", - /* 295 */ "LINEAR", - /* 296 */ "NEXT", - /* 297 */ "HAVING", - /* 298 */ "RANGE", - /* 299 */ "EVERY", - /* 300 */ "ORDER", - /* 301 */ "SLIMIT", - /* 302 */ "SOFFSET", - /* 303 */ "LIMIT", - /* 304 */ "OFFSET", - /* 305 */ "ASC", - /* 306 */ "NULLS", - /* 307 */ "ABORT", - /* 308 */ "AFTER", - /* 309 */ "ATTACH", - /* 310 */ "BEFORE", - /* 311 */ "BEGIN", - /* 312 */ "BITAND", - /* 313 */ "BITNOT", - /* 314 */ "BITOR", - /* 315 */ "BLOCKS", - /* 316 */ "CHANGE", - /* 317 */ "COMMA", - /* 318 */ "CONCAT", - /* 319 */ "CONFLICT", - /* 320 */ "COPY", - /* 321 */ "DEFERRED", - /* 322 */ "DELIMITERS", - /* 323 */ "DETACH", - /* 324 */ "DIVIDE", - /* 325 */ "DOT", - /* 326 */ "EACH", - /* 327 */ "FAIL", - /* 328 */ "FILE", - /* 329 */ "FOR", - /* 330 */ "GLOB", - /* 331 */ "ID", - /* 332 */ "IMMEDIATE", - /* 333 */ "IMPORT", - /* 334 */ "INITIALLY", - /* 335 */ "INSTEAD", - /* 336 */ "ISNULL", - /* 337 */ "KEY", - /* 338 */ "MODULES", - /* 339 */ "NK_BITNOT", - /* 340 */ "NK_SEMI", - /* 341 */ "NOTNULL", - /* 342 */ "OF", - /* 343 */ "PLUS", - /* 344 */ "PRIVILEGE", - /* 345 */ "RAISE", - /* 346 */ "RESTRICT", - /* 347 */ "ROW", - /* 348 */ "STAR", - /* 349 */ "STATEMENT", - /* 350 */ "STRICT", - /* 351 */ "STRING", - /* 352 */ "TIMES", - /* 353 */ "VALUES", - /* 354 */ "VARIABLE", - /* 355 */ "WAL", - /* 356 */ "cmd", - /* 357 */ "account_options", - /* 358 */ "alter_account_options", - /* 359 */ "literal", - /* 360 */ "alter_account_option", - /* 361 */ "ip_range_list", - /* 362 */ "white_list", - /* 363 */ "white_list_opt", - /* 364 */ "user_name", - /* 365 */ "sysinfo_opt", - /* 366 */ "privileges", - /* 367 */ "priv_level", - /* 368 */ "with_opt", - /* 369 */ "priv_type_list", - /* 370 */ "priv_type", - /* 371 */ "db_name", - /* 372 */ "table_name", - /* 373 */ "topic_name", - /* 374 */ "search_condition", - /* 375 */ "dnode_endpoint", - /* 376 */ "force_opt", - /* 377 */ "unsafe_opt", - /* 378 */ "not_exists_opt", - /* 379 */ "db_options", - /* 380 */ "exists_opt", - /* 381 */ "alter_db_options", - /* 382 */ "speed_opt", - /* 383 */ "start_opt", - /* 384 */ "end_opt", - /* 385 */ "integer_list", - /* 386 */ "variable_list", - /* 387 */ "retention_list", - /* 388 */ "signed", - /* 389 */ "alter_db_option", - /* 390 */ "retention", - /* 391 */ "full_table_name", - /* 392 */ "column_def_list", - /* 393 */ "tags_def_opt", - /* 394 */ "table_options", - /* 395 */ "multi_create_clause", - /* 396 */ "tags_def", - /* 397 */ "multi_drop_clause", - /* 398 */ "alter_table_clause", - /* 399 */ "alter_table_options", - /* 400 */ "column_name", - /* 401 */ "type_name", - /* 402 */ "signed_literal", - /* 403 */ "create_subtable_clause", - /* 404 */ "specific_cols_opt", - /* 405 */ "expression_list", - /* 406 */ "drop_table_clause", - /* 407 */ "col_name_list", - /* 408 */ "column_def", - /* 409 */ "duration_list", - /* 410 */ "rollup_func_list", - /* 411 */ "alter_table_option", - /* 412 */ "duration_literal", - /* 413 */ "rollup_func_name", - /* 414 */ "function_name", - /* 415 */ "col_name", - /* 416 */ "db_kind_opt", - /* 417 */ "table_kind_db_name_cond_opt", - /* 418 */ "like_pattern_opt", - /* 419 */ "db_name_cond_opt", - /* 420 */ "table_name_cond", - /* 421 */ "from_db_opt", - /* 422 */ "tag_list_opt", - /* 423 */ "table_kind", - /* 424 */ "tag_item", - /* 425 */ "column_alias", - /* 426 */ "index_options", - /* 427 */ "full_index_name", - /* 428 */ "index_name", - /* 429 */ "func_list", - /* 430 */ "sliding_opt", - /* 431 */ "sma_stream_opt", - /* 432 */ "func", - /* 433 */ "sma_func_name", - /* 434 */ "with_meta", - /* 435 */ "query_or_subquery", - /* 436 */ "where_clause_opt", - /* 437 */ "cgroup_name", - /* 438 */ "analyze_opt", - /* 439 */ "explain_options", - /* 440 */ "insert_query", - /* 441 */ "or_replace_opt", - /* 442 */ "agg_func_opt", - /* 443 */ "bufsize_opt", - /* 444 */ "language_opt", - /* 445 */ "full_view_name", - /* 446 */ "view_name", - /* 447 */ "stream_name", - /* 448 */ "stream_options", - /* 449 */ "col_list_opt", - /* 450 */ "tag_def_or_ref_opt", - /* 451 */ "subtable_opt", - /* 452 */ "ignore_opt", - /* 453 */ "expression", - /* 454 */ "on_vgroup_id", - /* 455 */ "dnode_list", - /* 456 */ "literal_func", - /* 457 */ "literal_list", - /* 458 */ "table_alias", - /* 459 */ "expr_or_subquery", - /* 460 */ "pseudo_column", - /* 461 */ "column_reference", - /* 462 */ "function_expression", - /* 463 */ "case_when_expression", - /* 464 */ "star_func", - /* 465 */ "star_func_para_list", - /* 466 */ "noarg_func", - /* 467 */ "other_para_list", - /* 468 */ "star_func_para", - /* 469 */ "when_then_list", - /* 470 */ "case_when_else_opt", - /* 471 */ "common_expression", - /* 472 */ "when_then_expr", - /* 473 */ "predicate", - /* 474 */ "compare_op", - /* 475 */ "in_op", - /* 476 */ "in_predicate_value", - /* 477 */ "boolean_value_expression", - /* 478 */ "boolean_primary", - /* 479 */ "from_clause_opt", - /* 480 */ "table_reference_list", - /* 481 */ "table_reference", - /* 482 */ "table_primary", - /* 483 */ "joined_table", - /* 484 */ "alias_opt", - /* 485 */ "subquery", - /* 486 */ "parenthesized_joined_table", - /* 487 */ "join_type", - /* 488 */ "join_subtype", - /* 489 */ "join_on_clause_opt", - /* 490 */ "window_offset_clause_opt", - /* 491 */ "jlimit_clause_opt", - /* 492 */ "window_offset_literal", - /* 493 */ "query_specification", - /* 494 */ "hint_list", - /* 495 */ "set_quantifier_opt", - /* 496 */ "tag_mode_opt", - /* 497 */ "select_list", - /* 498 */ "partition_by_clause_opt", - /* 499 */ "range_opt", - /* 500 */ "every_opt", - /* 501 */ "fill_opt", - /* 502 */ "twindow_clause_opt", - /* 503 */ "group_by_clause_opt", - /* 504 */ "having_clause_opt", - /* 505 */ "select_item", - /* 506 */ "partition_list", - /* 507 */ "partition_item", - /* 508 */ "interval_sliding_duration_literal", - /* 509 */ "fill_mode", - /* 510 */ "group_by_list", - /* 511 */ "query_expression", - /* 512 */ "query_simple", - /* 513 */ "order_by_clause_opt", - /* 514 */ "slimit_clause_opt", - /* 515 */ "limit_clause_opt", - /* 516 */ "union_query_expression", - /* 517 */ "query_simple_or_subquery", - /* 518 */ "sort_specification_list", - /* 519 */ "sort_specification", - /* 520 */ "ordering_specification_opt", - /* 521 */ "null_ordering_opt", + /* 58 */ "CLUSTER", + /* 59 */ "LOCAL", + /* 60 */ "QNODE", + /* 61 */ "BNODE", + /* 62 */ "SNODE", + /* 63 */ "MNODE", + /* 64 */ "VNODE", + /* 65 */ "DATABASE", + /* 66 */ "USE", + /* 67 */ "FLUSH", + /* 68 */ "TRIM", + /* 69 */ "COMPACT", + /* 70 */ "IF", + /* 71 */ "NOT", + /* 72 */ "EXISTS", + /* 73 */ "BUFFER", + /* 74 */ "CACHEMODEL", + /* 75 */ "CACHESIZE", + /* 76 */ "COMP", + /* 77 */ "DURATION", + /* 78 */ "NK_VARIABLE", + /* 79 */ "MAXROWS", + /* 80 */ "MINROWS", + /* 81 */ "KEEP", + /* 82 */ "PAGES", + /* 83 */ "PAGESIZE", + /* 84 */ "TSDB_PAGESIZE", + /* 85 */ "PRECISION", + /* 86 */ "REPLICA", + /* 87 */ "VGROUPS", + /* 88 */ "SINGLE_STABLE", + /* 89 */ "RETENTIONS", + /* 90 */ "SCHEMALESS", + /* 91 */ "WAL_LEVEL", + /* 92 */ "WAL_FSYNC_PERIOD", + /* 93 */ "WAL_RETENTION_PERIOD", + /* 94 */ "WAL_RETENTION_SIZE", + /* 95 */ "WAL_ROLL_PERIOD", + /* 96 */ "WAL_SEGMENT_SIZE", + /* 97 */ "STT_TRIGGER", + /* 98 */ "TABLE_PREFIX", + /* 99 */ "TABLE_SUFFIX", + /* 100 */ "KEEP_TIME_OFFSET", + /* 101 */ "NK_COLON", + /* 102 */ "BWLIMIT", + /* 103 */ "START", + /* 104 */ "TIMESTAMP", + /* 105 */ "END", + /* 106 */ "TABLE", + /* 107 */ "NK_LP", + /* 108 */ "NK_RP", + /* 109 */ "STABLE", + /* 110 */ "COLUMN", + /* 111 */ "MODIFY", + /* 112 */ "RENAME", + /* 113 */ "TAG", + /* 114 */ "SET", + /* 115 */ "NK_EQ", + /* 116 */ "USING", + /* 117 */ "TAGS", + /* 118 */ "BOOL", + /* 119 */ "TINYINT", + /* 120 */ "SMALLINT", + /* 121 */ "INT", + /* 122 */ "INTEGER", + /* 123 */ "BIGINT", + /* 124 */ "FLOAT", + /* 125 */ "DOUBLE", + /* 126 */ "BINARY", + /* 127 */ "NCHAR", + /* 128 */ "UNSIGNED", + /* 129 */ "JSON", + /* 130 */ "VARCHAR", + /* 131 */ "MEDIUMBLOB", + /* 132 */ "BLOB", + /* 133 */ "VARBINARY", + /* 134 */ "GEOMETRY", + /* 135 */ "DECIMAL", + /* 136 */ "COMMENT", + /* 137 */ "MAX_DELAY", + /* 138 */ "WATERMARK", + /* 139 */ "ROLLUP", + /* 140 */ "TTL", + /* 141 */ "SMA", + /* 142 */ "DELETE_MARK", + /* 143 */ "FIRST", + /* 144 */ "LAST", + /* 145 */ "SHOW", + /* 146 */ "PRIVILEGES", + /* 147 */ "DATABASES", + /* 148 */ "TABLES", + /* 149 */ "STABLES", + /* 150 */ "MNODES", + /* 151 */ "QNODES", + /* 152 */ "FUNCTIONS", + /* 153 */ "INDEXES", + /* 154 */ "ACCOUNTS", + /* 155 */ "APPS", + /* 156 */ "CONNECTIONS", + /* 157 */ "LICENCES", + /* 158 */ "GRANTS", + /* 159 */ "FULL", + /* 160 */ "LOGS", + /* 161 */ "MACHINES", + /* 162 */ "QUERIES", + /* 163 */ "SCORES", + /* 164 */ "TOPICS", + /* 165 */ "VARIABLES", + /* 166 */ "BNODES", + /* 167 */ "SNODES", + /* 168 */ "TRANSACTIONS", + /* 169 */ "DISTRIBUTED", + /* 170 */ "CONSUMERS", + /* 171 */ "SUBSCRIPTIONS", + /* 172 */ "VNODES", + /* 173 */ "ALIVE", + /* 174 */ "VIEWS", + /* 175 */ "VIEW", + /* 176 */ "COMPACTS", + /* 177 */ "NORMAL", + /* 178 */ "CHILD", + /* 179 */ "LIKE", + /* 180 */ "TBNAME", + /* 181 */ "QTAGS", + /* 182 */ "AS", + /* 183 */ "SYSTEM", + /* 184 */ "INDEX", + /* 185 */ "FUNCTION", + /* 186 */ "INTERVAL", + /* 187 */ "COUNT", + /* 188 */ "LAST_ROW", + /* 189 */ "META", + /* 190 */ "ONLY", + /* 191 */ "TOPIC", + /* 192 */ "CONSUMER", + /* 193 */ "GROUP", + /* 194 */ "DESC", + /* 195 */ "DESCRIBE", + /* 196 */ "RESET", + /* 197 */ "QUERY", + /* 198 */ "CACHE", + /* 199 */ "EXPLAIN", + /* 200 */ "ANALYZE", + /* 201 */ "VERBOSE", + /* 202 */ "NK_BOOL", + /* 203 */ "RATIO", + /* 204 */ "NK_FLOAT", + /* 205 */ "OUTPUTTYPE", + /* 206 */ "AGGREGATE", + /* 207 */ "BUFSIZE", + /* 208 */ "LANGUAGE", + /* 209 */ "REPLACE", + /* 210 */ "STREAM", + /* 211 */ "INTO", + /* 212 */ "PAUSE", + /* 213 */ "RESUME", + /* 214 */ "TRIGGER", + /* 215 */ "AT_ONCE", + /* 216 */ "WINDOW_CLOSE", + /* 217 */ "IGNORE", + /* 218 */ "EXPIRED", + /* 219 */ "FILL_HISTORY", + /* 220 */ "UPDATE", + /* 221 */ "SUBTABLE", + /* 222 */ "UNTREATED", + /* 223 */ "KILL", + /* 224 */ "CONNECTION", + /* 225 */ "TRANSACTION", + /* 226 */ "BALANCE", + /* 227 */ "VGROUP", + /* 228 */ "LEADER", + /* 229 */ "MERGE", + /* 230 */ "REDISTRIBUTE", + /* 231 */ "SPLIT", + /* 232 */ "DELETE", + /* 233 */ "INSERT", + /* 234 */ "NULL", + /* 235 */ "NK_QUESTION", + /* 236 */ "NK_ALIAS", + /* 237 */ "NK_ARROW", + /* 238 */ "ROWTS", + /* 239 */ "QSTART", + /* 240 */ "QEND", + /* 241 */ "QDURATION", + /* 242 */ "WSTART", + /* 243 */ "WEND", + /* 244 */ "WDURATION", + /* 245 */ "IROWTS", + /* 246 */ "ISFILLED", + /* 247 */ "CAST", + /* 248 */ "NOW", + /* 249 */ "TODAY", + /* 250 */ "TIMEZONE", + /* 251 */ "CLIENT_VERSION", + /* 252 */ "SERVER_VERSION", + /* 253 */ "SERVER_STATUS", + /* 254 */ "CURRENT_USER", + /* 255 */ "CASE", + /* 256 */ "WHEN", + /* 257 */ "THEN", + /* 258 */ "ELSE", + /* 259 */ "BETWEEN", + /* 260 */ "IS", + /* 261 */ "NK_LT", + /* 262 */ "NK_GT", + /* 263 */ "NK_LE", + /* 264 */ "NK_GE", + /* 265 */ "NK_NE", + /* 266 */ "MATCH", + /* 267 */ "NMATCH", + /* 268 */ "CONTAINS", + /* 269 */ "IN", + /* 270 */ "JOIN", + /* 271 */ "INNER", + /* 272 */ "LEFT", + /* 273 */ "RIGHT", + /* 274 */ "OUTER", + /* 275 */ "SEMI", + /* 276 */ "ANTI", + /* 277 */ "ASOF", + /* 278 */ "WINDOW", + /* 279 */ "WINDOW_OFFSET", + /* 280 */ "JLIMIT", + /* 281 */ "SELECT", + /* 282 */ "NK_HINT", + /* 283 */ "DISTINCT", + /* 284 */ "WHERE", + /* 285 */ "PARTITION", + /* 286 */ "BY", + /* 287 */ "SESSION", + /* 288 */ "STATE_WINDOW", + /* 289 */ "EVENT_WINDOW", + /* 290 */ "SLIDING", + /* 291 */ "FILL", + /* 292 */ "VALUE", + /* 293 */ "VALUE_F", + /* 294 */ "NONE", + /* 295 */ "PREV", + /* 296 */ "NULL_F", + /* 297 */ "LINEAR", + /* 298 */ "NEXT", + /* 299 */ "HAVING", + /* 300 */ "RANGE", + /* 301 */ "EVERY", + /* 302 */ "ORDER", + /* 303 */ "SLIMIT", + /* 304 */ "SOFFSET", + /* 305 */ "LIMIT", + /* 306 */ "OFFSET", + /* 307 */ "ASC", + /* 308 */ "NULLS", + /* 309 */ "ABORT", + /* 310 */ "AFTER", + /* 311 */ "ATTACH", + /* 312 */ "BEFORE", + /* 313 */ "BEGIN", + /* 314 */ "BITAND", + /* 315 */ "BITNOT", + /* 316 */ "BITOR", + /* 317 */ "BLOCKS", + /* 318 */ "CHANGE", + /* 319 */ "COMMA", + /* 320 */ "CONCAT", + /* 321 */ "CONFLICT", + /* 322 */ "COPY", + /* 323 */ "DEFERRED", + /* 324 */ "DELIMITERS", + /* 325 */ "DETACH", + /* 326 */ "DIVIDE", + /* 327 */ "DOT", + /* 328 */ "EACH", + /* 329 */ "FAIL", + /* 330 */ "FILE", + /* 331 */ "FOR", + /* 332 */ "GLOB", + /* 333 */ "ID", + /* 334 */ "IMMEDIATE", + /* 335 */ "IMPORT", + /* 336 */ "INITIALLY", + /* 337 */ "INSTEAD", + /* 338 */ "ISNULL", + /* 339 */ "KEY", + /* 340 */ "MODULES", + /* 341 */ "NK_BITNOT", + /* 342 */ "NK_SEMI", + /* 343 */ "NOTNULL", + /* 344 */ "OF", + /* 345 */ "PLUS", + /* 346 */ "PRIVILEGE", + /* 347 */ "RAISE", + /* 348 */ "RESTRICT", + /* 349 */ "ROW", + /* 350 */ "STAR", + /* 351 */ "STATEMENT", + /* 352 */ "STRICT", + /* 353 */ "STRING", + /* 354 */ "TIMES", + /* 355 */ "VALUES", + /* 356 */ "VARIABLE", + /* 357 */ "WAL", + /* 358 */ "cmd", + /* 359 */ "account_options", + /* 360 */ "alter_account_options", + /* 361 */ "literal", + /* 362 */ "alter_account_option", + /* 363 */ "ip_range_list", + /* 364 */ "white_list", + /* 365 */ "white_list_opt", + /* 366 */ "user_name", + /* 367 */ "sysinfo_opt", + /* 368 */ "privileges", + /* 369 */ "priv_level", + /* 370 */ "with_opt", + /* 371 */ "priv_type_list", + /* 372 */ "priv_type", + /* 373 */ "db_name", + /* 374 */ "table_name", + /* 375 */ "topic_name", + /* 376 */ "search_condition", + /* 377 */ "dnode_endpoint", + /* 378 */ "force_opt", + /* 379 */ "unsafe_opt", + /* 380 */ "not_exists_opt", + /* 381 */ "db_options", + /* 382 */ "exists_opt", + /* 383 */ "alter_db_options", + /* 384 */ "speed_opt", + /* 385 */ "start_opt", + /* 386 */ "end_opt", + /* 387 */ "integer_list", + /* 388 */ "variable_list", + /* 389 */ "retention_list", + /* 390 */ "signed", + /* 391 */ "alter_db_option", + /* 392 */ "retention", + /* 393 */ "full_table_name", + /* 394 */ "column_def_list", + /* 395 */ "tags_def_opt", + /* 396 */ "table_options", + /* 397 */ "multi_create_clause", + /* 398 */ "tags_def", + /* 399 */ "multi_drop_clause", + /* 400 */ "alter_table_clause", + /* 401 */ "alter_table_options", + /* 402 */ "column_name", + /* 403 */ "type_name", + /* 404 */ "signed_literal", + /* 405 */ "create_subtable_clause", + /* 406 */ "specific_cols_opt", + /* 407 */ "expression_list", + /* 408 */ "drop_table_clause", + /* 409 */ "col_name_list", + /* 410 */ "column_def", + /* 411 */ "duration_list", + /* 412 */ "rollup_func_list", + /* 413 */ "alter_table_option", + /* 414 */ "duration_literal", + /* 415 */ "rollup_func_name", + /* 416 */ "function_name", + /* 417 */ "col_name", + /* 418 */ "db_kind_opt", + /* 419 */ "table_kind_db_name_cond_opt", + /* 420 */ "like_pattern_opt", + /* 421 */ "db_name_cond_opt", + /* 422 */ "table_name_cond", + /* 423 */ "from_db_opt", + /* 424 */ "tag_list_opt", + /* 425 */ "table_kind", + /* 426 */ "tag_item", + /* 427 */ "column_alias", + /* 428 */ "index_options", + /* 429 */ "full_index_name", + /* 430 */ "index_name", + /* 431 */ "func_list", + /* 432 */ "sliding_opt", + /* 433 */ "sma_stream_opt", + /* 434 */ "func", + /* 435 */ "sma_func_name", + /* 436 */ "with_meta", + /* 437 */ "query_or_subquery", + /* 438 */ "where_clause_opt", + /* 439 */ "cgroup_name", + /* 440 */ "analyze_opt", + /* 441 */ "explain_options", + /* 442 */ "insert_query", + /* 443 */ "or_replace_opt", + /* 444 */ "agg_func_opt", + /* 445 */ "bufsize_opt", + /* 446 */ "language_opt", + /* 447 */ "full_view_name", + /* 448 */ "view_name", + /* 449 */ "stream_name", + /* 450 */ "stream_options", + /* 451 */ "col_list_opt", + /* 452 */ "tag_def_or_ref_opt", + /* 453 */ "subtable_opt", + /* 454 */ "ignore_opt", + /* 455 */ "expression", + /* 456 */ "on_vgroup_id", + /* 457 */ "dnode_list", + /* 458 */ "literal_func", + /* 459 */ "literal_list", + /* 460 */ "table_alias", + /* 461 */ "expr_or_subquery", + /* 462 */ "pseudo_column", + /* 463 */ "column_reference", + /* 464 */ "function_expression", + /* 465 */ "case_when_expression", + /* 466 */ "star_func", + /* 467 */ "star_func_para_list", + /* 468 */ "noarg_func", + /* 469 */ "other_para_list", + /* 470 */ "star_func_para", + /* 471 */ "when_then_list", + /* 472 */ "case_when_else_opt", + /* 473 */ "common_expression", + /* 474 */ "when_then_expr", + /* 475 */ "predicate", + /* 476 */ "compare_op", + /* 477 */ "in_op", + /* 478 */ "in_predicate_value", + /* 479 */ "boolean_value_expression", + /* 480 */ "boolean_primary", + /* 481 */ "from_clause_opt", + /* 482 */ "table_reference_list", + /* 483 */ "table_reference", + /* 484 */ "table_primary", + /* 485 */ "joined_table", + /* 486 */ "alias_opt", + /* 487 */ "subquery", + /* 488 */ "parenthesized_joined_table", + /* 489 */ "join_type", + /* 490 */ "join_subtype", + /* 491 */ "join_on_clause_opt", + /* 492 */ "window_offset_clause_opt", + /* 493 */ "jlimit_clause_opt", + /* 494 */ "window_offset_literal", + /* 495 */ "query_specification", + /* 496 */ "hint_list", + /* 497 */ "set_quantifier_opt", + /* 498 */ "tag_mode_opt", + /* 499 */ "select_list", + /* 500 */ "partition_by_clause_opt", + /* 501 */ "range_opt", + /* 502 */ "every_opt", + /* 503 */ "fill_opt", + /* 504 */ "twindow_clause_opt", + /* 505 */ "group_by_clause_opt", + /* 506 */ "having_clause_opt", + /* 507 */ "select_item", + /* 508 */ "partition_list", + /* 509 */ "partition_item", + /* 510 */ "interval_sliding_duration_literal", + /* 511 */ "fill_mode", + /* 512 */ "group_by_list", + /* 513 */ "query_expression", + /* 514 */ "query_simple", + /* 515 */ "order_by_clause_opt", + /* 516 */ "slimit_clause_opt", + /* 517 */ "limit_clause_opt", + /* 518 */ "union_query_expression", + /* 519 */ "query_simple_or_subquery", + /* 520 */ "sort_specification_list", + /* 521 */ "sort_specification", + /* 522 */ "ordering_specification_opt", + /* 523 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -2173,594 +2136,599 @@ static const char *const yyRuleName[] = { /* 68 */ "force_opt ::=", /* 69 */ "force_opt ::= FORCE", /* 70 */ "unsafe_opt ::= UNSAFE", - /* 71 */ "cmd ::= ALTER LOCAL NK_STRING", - /* 72 */ "cmd ::= ALTER LOCAL NK_STRING NK_STRING", - /* 73 */ "cmd ::= CREATE QNODE ON DNODE NK_INTEGER", - /* 74 */ "cmd ::= DROP QNODE ON DNODE NK_INTEGER", - /* 75 */ "cmd ::= RESTORE QNODE ON DNODE NK_INTEGER", - /* 76 */ "cmd ::= CREATE BNODE ON DNODE NK_INTEGER", - /* 77 */ "cmd ::= DROP BNODE ON DNODE NK_INTEGER", - /* 78 */ "cmd ::= CREATE SNODE ON DNODE NK_INTEGER", - /* 79 */ "cmd ::= DROP SNODE ON DNODE NK_INTEGER", - /* 80 */ "cmd ::= CREATE MNODE ON DNODE NK_INTEGER", - /* 81 */ "cmd ::= DROP MNODE ON DNODE NK_INTEGER", - /* 82 */ "cmd ::= RESTORE MNODE ON DNODE NK_INTEGER", - /* 83 */ "cmd ::= RESTORE VNODE ON DNODE NK_INTEGER", - /* 84 */ "cmd ::= CREATE DATABASE not_exists_opt db_name db_options", - /* 85 */ "cmd ::= DROP DATABASE exists_opt db_name", - /* 86 */ "cmd ::= USE db_name", - /* 87 */ "cmd ::= ALTER DATABASE db_name alter_db_options", - /* 88 */ "cmd ::= FLUSH DATABASE db_name", - /* 89 */ "cmd ::= TRIM DATABASE db_name speed_opt", - /* 90 */ "cmd ::= COMPACT DATABASE db_name start_opt end_opt", - /* 91 */ "not_exists_opt ::= IF NOT EXISTS", - /* 92 */ "not_exists_opt ::=", - /* 93 */ "exists_opt ::= IF EXISTS", - /* 94 */ "exists_opt ::=", - /* 95 */ "db_options ::=", - /* 96 */ "db_options ::= db_options BUFFER NK_INTEGER", - /* 97 */ "db_options ::= db_options CACHEMODEL NK_STRING", - /* 98 */ "db_options ::= db_options CACHESIZE NK_INTEGER", - /* 99 */ "db_options ::= db_options COMP NK_INTEGER", - /* 100 */ "db_options ::= db_options DURATION NK_INTEGER", - /* 101 */ "db_options ::= db_options DURATION NK_VARIABLE", - /* 102 */ "db_options ::= db_options MAXROWS NK_INTEGER", - /* 103 */ "db_options ::= db_options MINROWS NK_INTEGER", - /* 104 */ "db_options ::= db_options KEEP integer_list", - /* 105 */ "db_options ::= db_options KEEP variable_list", - /* 106 */ "db_options ::= db_options PAGES NK_INTEGER", - /* 107 */ "db_options ::= db_options PAGESIZE NK_INTEGER", - /* 108 */ "db_options ::= db_options TSDB_PAGESIZE NK_INTEGER", - /* 109 */ "db_options ::= db_options PRECISION NK_STRING", - /* 110 */ "db_options ::= db_options REPLICA NK_INTEGER", - /* 111 */ "db_options ::= db_options VGROUPS NK_INTEGER", - /* 112 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", - /* 113 */ "db_options ::= db_options RETENTIONS retention_list", - /* 114 */ "db_options ::= db_options SCHEMALESS NK_INTEGER", - /* 115 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER", - /* 116 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER", - /* 117 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER", - /* 118 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", - /* 119 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER", - /* 120 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", - /* 121 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER", - /* 122 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER", - /* 123 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER", - /* 124 */ "db_options ::= db_options TABLE_PREFIX signed", - /* 125 */ "db_options ::= db_options TABLE_SUFFIX signed", - /* 126 */ "db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER", - /* 127 */ "alter_db_options ::= alter_db_option", - /* 128 */ "alter_db_options ::= alter_db_options alter_db_option", - /* 129 */ "alter_db_option ::= BUFFER NK_INTEGER", - /* 130 */ "alter_db_option ::= CACHEMODEL NK_STRING", - /* 131 */ "alter_db_option ::= CACHESIZE NK_INTEGER", - /* 132 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER", - /* 133 */ "alter_db_option ::= KEEP integer_list", - /* 134 */ "alter_db_option ::= KEEP variable_list", - /* 135 */ "alter_db_option ::= PAGES NK_INTEGER", - /* 136 */ "alter_db_option ::= REPLICA NK_INTEGER", - /* 137 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER", - /* 138 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER", - /* 139 */ "alter_db_option ::= MINROWS NK_INTEGER", - /* 140 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER", - /* 141 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", - /* 142 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER", - /* 143 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", - /* 144 */ "alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER", - /* 145 */ "integer_list ::= NK_INTEGER", - /* 146 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", - /* 147 */ "variable_list ::= NK_VARIABLE", - /* 148 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", - /* 149 */ "retention_list ::= retention", - /* 150 */ "retention_list ::= retention_list NK_COMMA retention", - /* 151 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", - /* 152 */ "retention ::= NK_MINUS NK_COLON NK_VARIABLE", - /* 153 */ "speed_opt ::=", - /* 154 */ "speed_opt ::= BWLIMIT NK_INTEGER", - /* 155 */ "start_opt ::=", - /* 156 */ "start_opt ::= START WITH NK_INTEGER", - /* 157 */ "start_opt ::= START WITH NK_STRING", - /* 158 */ "start_opt ::= START WITH TIMESTAMP NK_STRING", - /* 159 */ "end_opt ::=", - /* 160 */ "end_opt ::= END WITH NK_INTEGER", - /* 161 */ "end_opt ::= END WITH NK_STRING", - /* 162 */ "end_opt ::= END WITH TIMESTAMP NK_STRING", - /* 163 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", - /* 164 */ "cmd ::= CREATE TABLE multi_create_clause", - /* 165 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 166 */ "cmd ::= DROP TABLE multi_drop_clause", - /* 167 */ "cmd ::= DROP STABLE exists_opt full_table_name", - /* 168 */ "cmd ::= ALTER TABLE alter_table_clause", - /* 169 */ "cmd ::= ALTER STABLE alter_table_clause", - /* 170 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 171 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", - /* 172 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 173 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", - /* 174 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 175 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", - /* 176 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 177 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", - /* 178 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", - /* 179 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", - /* 180 */ "multi_create_clause ::= create_subtable_clause", - /* 181 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 182 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options", - /* 183 */ "multi_drop_clause ::= drop_table_clause", - /* 184 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", - /* 185 */ "drop_table_clause ::= exists_opt full_table_name", - /* 186 */ "specific_cols_opt ::=", - /* 187 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", - /* 188 */ "full_table_name ::= table_name", - /* 189 */ "full_table_name ::= db_name NK_DOT table_name", - /* 190 */ "column_def_list ::= column_def", - /* 191 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 192 */ "column_def ::= column_name type_name", - /* 193 */ "type_name ::= BOOL", - /* 194 */ "type_name ::= TINYINT", - /* 195 */ "type_name ::= SMALLINT", - /* 196 */ "type_name ::= INT", - /* 197 */ "type_name ::= INTEGER", - /* 198 */ "type_name ::= BIGINT", - /* 199 */ "type_name ::= FLOAT", - /* 200 */ "type_name ::= DOUBLE", - /* 201 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 202 */ "type_name ::= TIMESTAMP", - /* 203 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 204 */ "type_name ::= TINYINT UNSIGNED", - /* 205 */ "type_name ::= SMALLINT UNSIGNED", - /* 206 */ "type_name ::= INT UNSIGNED", - /* 207 */ "type_name ::= BIGINT UNSIGNED", - /* 208 */ "type_name ::= JSON", - /* 209 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 210 */ "type_name ::= MEDIUMBLOB", - /* 211 */ "type_name ::= BLOB", - /* 212 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 213 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP", - /* 214 */ "type_name ::= DECIMAL", - /* 215 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 216 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 217 */ "tags_def_opt ::=", - /* 218 */ "tags_def_opt ::= tags_def", - /* 219 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", - /* 220 */ "table_options ::=", - /* 221 */ "table_options ::= table_options COMMENT NK_STRING", - /* 222 */ "table_options ::= table_options MAX_DELAY duration_list", - /* 223 */ "table_options ::= table_options WATERMARK duration_list", - /* 224 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", - /* 225 */ "table_options ::= table_options TTL NK_INTEGER", - /* 226 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 227 */ "table_options ::= table_options DELETE_MARK duration_list", - /* 228 */ "alter_table_options ::= alter_table_option", - /* 229 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 230 */ "alter_table_option ::= COMMENT NK_STRING", - /* 231 */ "alter_table_option ::= TTL NK_INTEGER", - /* 232 */ "duration_list ::= duration_literal", - /* 233 */ "duration_list ::= duration_list NK_COMMA duration_literal", - /* 234 */ "rollup_func_list ::= rollup_func_name", - /* 235 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", - /* 236 */ "rollup_func_name ::= function_name", - /* 237 */ "rollup_func_name ::= FIRST", - /* 238 */ "rollup_func_name ::= LAST", - /* 239 */ "col_name_list ::= col_name", - /* 240 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 241 */ "col_name ::= column_name", - /* 242 */ "cmd ::= SHOW DNODES", - /* 243 */ "cmd ::= SHOW USERS", - /* 244 */ "cmd ::= SHOW USER PRIVILEGES", - /* 245 */ "cmd ::= SHOW db_kind_opt DATABASES", - /* 246 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt", - /* 247 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 248 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 249 */ "cmd ::= SHOW MNODES", - /* 250 */ "cmd ::= SHOW QNODES", - /* 251 */ "cmd ::= SHOW FUNCTIONS", - /* 252 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 253 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name", - /* 254 */ "cmd ::= SHOW STREAMS", - /* 255 */ "cmd ::= SHOW ACCOUNTS", - /* 256 */ "cmd ::= SHOW APPS", - /* 257 */ "cmd ::= SHOW CONNECTIONS", - /* 258 */ "cmd ::= SHOW LICENCES", - /* 259 */ "cmd ::= SHOW GRANTS", - /* 260 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 261 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 262 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 263 */ "cmd ::= SHOW QUERIES", - /* 264 */ "cmd ::= SHOW SCORES", - /* 265 */ "cmd ::= SHOW TOPICS", - /* 266 */ "cmd ::= SHOW VARIABLES", - /* 267 */ "cmd ::= SHOW CLUSTER VARIABLES", - /* 268 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 269 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", - /* 270 */ "cmd ::= SHOW BNODES", - /* 271 */ "cmd ::= SHOW SNODES", - /* 272 */ "cmd ::= SHOW CLUSTER", - /* 273 */ "cmd ::= SHOW TRANSACTIONS", - /* 274 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 275 */ "cmd ::= SHOW CONSUMERS", - /* 276 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 277 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", - /* 278 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name", - /* 279 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", - /* 280 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name", - /* 281 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER", - /* 282 */ "cmd ::= SHOW VNODES", - /* 283 */ "cmd ::= SHOW db_name_cond_opt ALIVE", - /* 284 */ "cmd ::= SHOW CLUSTER ALIVE", - /* 285 */ "cmd ::= SHOW db_name_cond_opt VIEWS", - /* 286 */ "cmd ::= SHOW CREATE VIEW full_table_name", - /* 287 */ "cmd ::= SHOW COMPACTS", - /* 288 */ "cmd ::= SHOW COMPACT NK_INTEGER", - /* 289 */ "table_kind_db_name_cond_opt ::=", - /* 290 */ "table_kind_db_name_cond_opt ::= table_kind", - /* 291 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT", - /* 292 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT", - /* 293 */ "table_kind ::= NORMAL", - /* 294 */ "table_kind ::= CHILD", - /* 295 */ "db_name_cond_opt ::=", - /* 296 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 297 */ "like_pattern_opt ::=", - /* 298 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 299 */ "table_name_cond ::= table_name", - /* 300 */ "from_db_opt ::=", - /* 301 */ "from_db_opt ::= FROM db_name", - /* 302 */ "tag_list_opt ::=", - /* 303 */ "tag_list_opt ::= tag_item", - /* 304 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", - /* 305 */ "tag_item ::= TBNAME", - /* 306 */ "tag_item ::= QTAGS", - /* 307 */ "tag_item ::= column_name", - /* 308 */ "tag_item ::= column_name column_alias", - /* 309 */ "tag_item ::= column_name AS column_alias", - /* 310 */ "db_kind_opt ::=", - /* 311 */ "db_kind_opt ::= USER", - /* 312 */ "db_kind_opt ::= SYSTEM", - /* 313 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options", - /* 314 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP", - /* 315 */ "cmd ::= DROP INDEX exists_opt full_index_name", - /* 316 */ "full_index_name ::= index_name", - /* 317 */ "full_index_name ::= db_name NK_DOT index_name", - /* 318 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 319 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt", - /* 320 */ "func_list ::= func", - /* 321 */ "func_list ::= func_list NK_COMMA func", - /* 322 */ "func ::= sma_func_name NK_LP expression_list NK_RP", - /* 323 */ "sma_func_name ::= function_name", - /* 324 */ "sma_func_name ::= COUNT", - /* 325 */ "sma_func_name ::= FIRST", - /* 326 */ "sma_func_name ::= LAST", - /* 327 */ "sma_func_name ::= LAST_ROW", - /* 328 */ "sma_stream_opt ::=", - /* 329 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", - /* 330 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", - /* 331 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", - /* 332 */ "with_meta ::= AS", - /* 333 */ "with_meta ::= WITH META AS", - /* 334 */ "with_meta ::= ONLY META AS", - /* 335 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 336 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", - /* 337 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", - /* 338 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 339 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 340 */ "cmd ::= DESC full_table_name", - /* 341 */ "cmd ::= DESCRIBE full_table_name", - /* 342 */ "cmd ::= RESET QUERY CACHE", - /* 343 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 344 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", - /* 345 */ "analyze_opt ::=", - /* 346 */ "analyze_opt ::= ANALYZE", - /* 347 */ "explain_options ::=", - /* 348 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 349 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 350 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", - /* 351 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 352 */ "agg_func_opt ::=", - /* 353 */ "agg_func_opt ::= AGGREGATE", - /* 354 */ "bufsize_opt ::=", - /* 355 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 356 */ "language_opt ::=", - /* 357 */ "language_opt ::= LANGUAGE NK_STRING", - /* 358 */ "or_replace_opt ::=", - /* 359 */ "or_replace_opt ::= OR REPLACE", - /* 360 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery", - /* 361 */ "cmd ::= DROP VIEW exists_opt full_view_name", - /* 362 */ "full_view_name ::= view_name", - /* 363 */ "full_view_name ::= db_name NK_DOT view_name", - /* 364 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery", - /* 365 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 366 */ "cmd ::= PAUSE STREAM exists_opt stream_name", - /* 367 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", - /* 368 */ "col_list_opt ::=", - /* 369 */ "col_list_opt ::= NK_LP col_name_list NK_RP", - /* 370 */ "tag_def_or_ref_opt ::=", - /* 371 */ "tag_def_or_ref_opt ::= tags_def", - /* 372 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", - /* 373 */ "stream_options ::=", - /* 374 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 375 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 376 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 377 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 378 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 379 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 380 */ "stream_options ::= stream_options DELETE_MARK duration_literal", - /* 381 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", - /* 382 */ "subtable_opt ::=", - /* 383 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 384 */ "ignore_opt ::=", - /* 385 */ "ignore_opt ::= IGNORE UNTREATED", - /* 386 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 387 */ "cmd ::= KILL QUERY NK_STRING", - /* 388 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 389 */ "cmd ::= KILL COMPACT NK_INTEGER", - /* 390 */ "cmd ::= BALANCE VGROUP", - /* 391 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", - /* 392 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 393 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 394 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 395 */ "on_vgroup_id ::=", - /* 396 */ "on_vgroup_id ::= ON NK_INTEGER", - /* 397 */ "dnode_list ::= DNODE NK_INTEGER", - /* 398 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 399 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 400 */ "cmd ::= query_or_subquery", - /* 401 */ "cmd ::= insert_query", - /* 402 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 403 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 404 */ "literal ::= NK_INTEGER", - /* 405 */ "literal ::= NK_FLOAT", - /* 406 */ "literal ::= NK_STRING", - /* 407 */ "literal ::= NK_BOOL", - /* 408 */ "literal ::= TIMESTAMP NK_STRING", - /* 409 */ "literal ::= duration_literal", - /* 410 */ "literal ::= NULL", - /* 411 */ "literal ::= NK_QUESTION", - /* 412 */ "duration_literal ::= NK_VARIABLE", - /* 413 */ "signed ::= NK_INTEGER", - /* 414 */ "signed ::= NK_PLUS NK_INTEGER", - /* 415 */ "signed ::= NK_MINUS NK_INTEGER", - /* 416 */ "signed ::= NK_FLOAT", - /* 417 */ "signed ::= NK_PLUS NK_FLOAT", - /* 418 */ "signed ::= NK_MINUS NK_FLOAT", - /* 419 */ "signed_literal ::= signed", - /* 420 */ "signed_literal ::= NK_STRING", - /* 421 */ "signed_literal ::= NK_BOOL", - /* 422 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 423 */ "signed_literal ::= duration_literal", - /* 424 */ "signed_literal ::= NULL", - /* 425 */ "signed_literal ::= literal_func", - /* 426 */ "signed_literal ::= NK_QUESTION", - /* 427 */ "literal_list ::= signed_literal", - /* 428 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 429 */ "db_name ::= NK_ID", - /* 430 */ "table_name ::= NK_ID", - /* 431 */ "column_name ::= NK_ID", - /* 432 */ "function_name ::= NK_ID", - /* 433 */ "view_name ::= NK_ID", - /* 434 */ "table_alias ::= NK_ID", - /* 435 */ "column_alias ::= NK_ID", - /* 436 */ "column_alias ::= NK_ALIAS", - /* 437 */ "user_name ::= NK_ID", - /* 438 */ "topic_name ::= NK_ID", - /* 439 */ "stream_name ::= NK_ID", - /* 440 */ "cgroup_name ::= NK_ID", - /* 441 */ "index_name ::= NK_ID", - /* 442 */ "expr_or_subquery ::= expression", - /* 443 */ "expression ::= literal", - /* 444 */ "expression ::= pseudo_column", - /* 445 */ "expression ::= column_reference", - /* 446 */ "expression ::= function_expression", - /* 447 */ "expression ::= case_when_expression", - /* 448 */ "expression ::= NK_LP expression NK_RP", - /* 449 */ "expression ::= NK_PLUS expr_or_subquery", - /* 450 */ "expression ::= NK_MINUS expr_or_subquery", - /* 451 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 452 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 453 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 454 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 455 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 456 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 457 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 458 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 459 */ "expression_list ::= expr_or_subquery", - /* 460 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 461 */ "column_reference ::= column_name", - /* 462 */ "column_reference ::= table_name NK_DOT column_name", - /* 463 */ "column_reference ::= NK_ALIAS", - /* 464 */ "column_reference ::= table_name NK_DOT NK_ALIAS", - /* 465 */ "pseudo_column ::= ROWTS", - /* 466 */ "pseudo_column ::= TBNAME", - /* 467 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 468 */ "pseudo_column ::= QSTART", - /* 469 */ "pseudo_column ::= QEND", - /* 470 */ "pseudo_column ::= QDURATION", - /* 471 */ "pseudo_column ::= WSTART", - /* 472 */ "pseudo_column ::= WEND", - /* 473 */ "pseudo_column ::= WDURATION", - /* 474 */ "pseudo_column ::= IROWTS", - /* 475 */ "pseudo_column ::= ISFILLED", - /* 476 */ "pseudo_column ::= QTAGS", - /* 477 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 478 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 479 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 480 */ "function_expression ::= literal_func", - /* 481 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 482 */ "literal_func ::= NOW", - /* 483 */ "noarg_func ::= NOW", - /* 484 */ "noarg_func ::= TODAY", - /* 485 */ "noarg_func ::= TIMEZONE", - /* 486 */ "noarg_func ::= DATABASE", - /* 487 */ "noarg_func ::= CLIENT_VERSION", - /* 488 */ "noarg_func ::= SERVER_VERSION", - /* 489 */ "noarg_func ::= SERVER_STATUS", - /* 490 */ "noarg_func ::= CURRENT_USER", - /* 491 */ "noarg_func ::= USER", - /* 492 */ "star_func ::= COUNT", - /* 493 */ "star_func ::= FIRST", - /* 494 */ "star_func ::= LAST", - /* 495 */ "star_func ::= LAST_ROW", - /* 496 */ "star_func_para_list ::= NK_STAR", - /* 497 */ "star_func_para_list ::= other_para_list", - /* 498 */ "other_para_list ::= star_func_para", - /* 499 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 500 */ "star_func_para ::= expr_or_subquery", - /* 501 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 502 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 503 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 504 */ "when_then_list ::= when_then_expr", - /* 505 */ "when_then_list ::= when_then_list when_then_expr", - /* 506 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 507 */ "case_when_else_opt ::=", - /* 508 */ "case_when_else_opt ::= ELSE common_expression", - /* 509 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 510 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 511 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 512 */ "predicate ::= expr_or_subquery IS NULL", - /* 513 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 514 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 515 */ "compare_op ::= NK_LT", - /* 516 */ "compare_op ::= NK_GT", - /* 517 */ "compare_op ::= NK_LE", - /* 518 */ "compare_op ::= NK_GE", - /* 519 */ "compare_op ::= NK_NE", - /* 520 */ "compare_op ::= NK_EQ", - /* 521 */ "compare_op ::= LIKE", - /* 522 */ "compare_op ::= NOT LIKE", - /* 523 */ "compare_op ::= MATCH", - /* 524 */ "compare_op ::= NMATCH", - /* 525 */ "compare_op ::= CONTAINS", - /* 526 */ "in_op ::= IN", - /* 527 */ "in_op ::= NOT IN", - /* 528 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 529 */ "boolean_value_expression ::= boolean_primary", - /* 530 */ "boolean_value_expression ::= NOT boolean_primary", - /* 531 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 532 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 533 */ "boolean_primary ::= predicate", - /* 534 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 535 */ "common_expression ::= expr_or_subquery", - /* 536 */ "common_expression ::= boolean_value_expression", - /* 537 */ "from_clause_opt ::=", - /* 538 */ "from_clause_opt ::= FROM table_reference_list", - /* 539 */ "table_reference_list ::= table_reference", - /* 540 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 541 */ "table_reference ::= table_primary", - /* 542 */ "table_reference ::= joined_table", - /* 543 */ "table_primary ::= table_name alias_opt", - /* 544 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 545 */ "table_primary ::= subquery alias_opt", - /* 546 */ "table_primary ::= parenthesized_joined_table", - /* 547 */ "alias_opt ::=", - /* 548 */ "alias_opt ::= table_alias", - /* 549 */ "alias_opt ::= AS table_alias", - /* 550 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 551 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 552 */ "joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt", - /* 553 */ "join_type ::=", - /* 554 */ "join_type ::= INNER", - /* 555 */ "join_type ::= LEFT", - /* 556 */ "join_type ::= RIGHT", - /* 557 */ "join_type ::= FULL", - /* 558 */ "join_subtype ::=", - /* 559 */ "join_subtype ::= OUTER", - /* 560 */ "join_subtype ::= SEMI", - /* 561 */ "join_subtype ::= ANTI", - /* 562 */ "join_subtype ::= ASOF", - /* 563 */ "join_subtype ::= WINDOW", - /* 564 */ "join_on_clause_opt ::=", - /* 565 */ "join_on_clause_opt ::= ON search_condition", - /* 566 */ "window_offset_clause_opt ::=", - /* 567 */ "window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP", - /* 568 */ "window_offset_literal ::= NK_VARIABLE", - /* 569 */ "window_offset_literal ::= NK_MINUS NK_VARIABLE", - /* 570 */ "jlimit_clause_opt ::=", - /* 571 */ "jlimit_clause_opt ::= JLIMIT NK_INTEGER", - /* 572 */ "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", - /* 573 */ "hint_list ::=", - /* 574 */ "hint_list ::= NK_HINT", - /* 575 */ "tag_mode_opt ::=", - /* 576 */ "tag_mode_opt ::= TAGS", - /* 577 */ "set_quantifier_opt ::=", - /* 578 */ "set_quantifier_opt ::= DISTINCT", - /* 579 */ "set_quantifier_opt ::= ALL", - /* 580 */ "select_list ::= select_item", - /* 581 */ "select_list ::= select_list NK_COMMA select_item", - /* 582 */ "select_item ::= NK_STAR", - /* 583 */ "select_item ::= common_expression", - /* 584 */ "select_item ::= common_expression column_alias", - /* 585 */ "select_item ::= common_expression AS column_alias", - /* 586 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 587 */ "where_clause_opt ::=", - /* 588 */ "where_clause_opt ::= WHERE search_condition", - /* 589 */ "partition_by_clause_opt ::=", - /* 590 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 591 */ "partition_list ::= partition_item", - /* 592 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 593 */ "partition_item ::= expr_or_subquery", - /* 594 */ "partition_item ::= expr_or_subquery column_alias", - /* 595 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 596 */ "twindow_clause_opt ::=", - /* 597 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", - /* 598 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 599 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 600 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 601 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 602 */ "sliding_opt ::=", - /* 603 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", - /* 604 */ "interval_sliding_duration_literal ::= NK_VARIABLE", - /* 605 */ "interval_sliding_duration_literal ::= NK_STRING", - /* 606 */ "interval_sliding_duration_literal ::= NK_INTEGER", - /* 607 */ "fill_opt ::=", - /* 608 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 609 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", - /* 610 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", - /* 611 */ "fill_mode ::= NONE", - /* 612 */ "fill_mode ::= PREV", - /* 613 */ "fill_mode ::= NULL", - /* 614 */ "fill_mode ::= NULL_F", - /* 615 */ "fill_mode ::= LINEAR", - /* 616 */ "fill_mode ::= NEXT", - /* 617 */ "group_by_clause_opt ::=", - /* 618 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 619 */ "group_by_list ::= expr_or_subquery", - /* 620 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 621 */ "having_clause_opt ::=", - /* 622 */ "having_clause_opt ::= HAVING search_condition", - /* 623 */ "range_opt ::=", - /* 624 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 625 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", - /* 626 */ "every_opt ::=", - /* 627 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 628 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 629 */ "query_simple ::= query_specification", - /* 630 */ "query_simple ::= union_query_expression", - /* 631 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 632 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 633 */ "query_simple_or_subquery ::= query_simple", - /* 634 */ "query_simple_or_subquery ::= subquery", - /* 635 */ "query_or_subquery ::= query_expression", - /* 636 */ "query_or_subquery ::= subquery", - /* 637 */ "order_by_clause_opt ::=", - /* 638 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 639 */ "slimit_clause_opt ::=", - /* 640 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 641 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 642 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 643 */ "limit_clause_opt ::=", - /* 644 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 645 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 646 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 647 */ "subquery ::= NK_LP query_expression NK_RP", - /* 648 */ "subquery ::= NK_LP subquery NK_RP", - /* 649 */ "search_condition ::= common_expression", - /* 650 */ "sort_specification_list ::= sort_specification", - /* 651 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 652 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 653 */ "ordering_specification_opt ::=", - /* 654 */ "ordering_specification_opt ::= ASC", - /* 655 */ "ordering_specification_opt ::= DESC", - /* 656 */ "null_ordering_opt ::=", - /* 657 */ "null_ordering_opt ::= NULLS FIRST", - /* 658 */ "null_ordering_opt ::= NULLS LAST", + /* 71 */ "cmd ::= ALTER CLUSTER NK_STRING", + /* 72 */ "cmd ::= ALTER CLUSTER NK_STRING NK_STRING", + /* 73 */ "cmd ::= ALTER LOCAL NK_STRING", + /* 74 */ "cmd ::= ALTER LOCAL NK_STRING NK_STRING", + /* 75 */ "cmd ::= CREATE QNODE ON DNODE NK_INTEGER", + /* 76 */ "cmd ::= DROP QNODE ON DNODE NK_INTEGER", + /* 77 */ "cmd ::= RESTORE QNODE ON DNODE NK_INTEGER", + /* 78 */ "cmd ::= CREATE BNODE ON DNODE NK_INTEGER", + /* 79 */ "cmd ::= DROP BNODE ON DNODE NK_INTEGER", + /* 80 */ "cmd ::= CREATE SNODE ON DNODE NK_INTEGER", + /* 81 */ "cmd ::= DROP SNODE ON DNODE NK_INTEGER", + /* 82 */ "cmd ::= CREATE MNODE ON DNODE NK_INTEGER", + /* 83 */ "cmd ::= DROP MNODE ON DNODE NK_INTEGER", + /* 84 */ "cmd ::= RESTORE MNODE ON DNODE NK_INTEGER", + /* 85 */ "cmd ::= RESTORE VNODE ON DNODE NK_INTEGER", + /* 86 */ "cmd ::= CREATE DATABASE not_exists_opt db_name db_options", + /* 87 */ "cmd ::= DROP DATABASE exists_opt db_name", + /* 88 */ "cmd ::= USE db_name", + /* 89 */ "cmd ::= ALTER DATABASE db_name alter_db_options", + /* 90 */ "cmd ::= FLUSH DATABASE db_name", + /* 91 */ "cmd ::= TRIM DATABASE db_name speed_opt", + /* 92 */ "cmd ::= COMPACT DATABASE db_name start_opt end_opt", + /* 93 */ "not_exists_opt ::= IF NOT EXISTS", + /* 94 */ "not_exists_opt ::=", + /* 95 */ "exists_opt ::= IF EXISTS", + /* 96 */ "exists_opt ::=", + /* 97 */ "db_options ::=", + /* 98 */ "db_options ::= db_options BUFFER NK_INTEGER", + /* 99 */ "db_options ::= db_options CACHEMODEL NK_STRING", + /* 100 */ "db_options ::= db_options CACHESIZE NK_INTEGER", + /* 101 */ "db_options ::= db_options COMP NK_INTEGER", + /* 102 */ "db_options ::= db_options DURATION NK_INTEGER", + /* 103 */ "db_options ::= db_options DURATION NK_VARIABLE", + /* 104 */ "db_options ::= db_options MAXROWS NK_INTEGER", + /* 105 */ "db_options ::= db_options MINROWS NK_INTEGER", + /* 106 */ "db_options ::= db_options KEEP integer_list", + /* 107 */ "db_options ::= db_options KEEP variable_list", + /* 108 */ "db_options ::= db_options PAGES NK_INTEGER", + /* 109 */ "db_options ::= db_options PAGESIZE NK_INTEGER", + /* 110 */ "db_options ::= db_options TSDB_PAGESIZE NK_INTEGER", + /* 111 */ "db_options ::= db_options PRECISION NK_STRING", + /* 112 */ "db_options ::= db_options REPLICA NK_INTEGER", + /* 113 */ "db_options ::= db_options VGROUPS NK_INTEGER", + /* 114 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", + /* 115 */ "db_options ::= db_options RETENTIONS retention_list", + /* 116 */ "db_options ::= db_options SCHEMALESS NK_INTEGER", + /* 117 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER", + /* 118 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER", + /* 119 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER", + /* 120 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", + /* 121 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER", + /* 122 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", + /* 123 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER", + /* 124 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER", + /* 125 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER", + /* 126 */ "db_options ::= db_options TABLE_PREFIX signed", + /* 127 */ "db_options ::= db_options TABLE_SUFFIX signed", + /* 128 */ "db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER", + /* 129 */ "alter_db_options ::= alter_db_option", + /* 130 */ "alter_db_options ::= alter_db_options alter_db_option", + /* 131 */ "alter_db_option ::= BUFFER NK_INTEGER", + /* 132 */ "alter_db_option ::= CACHEMODEL NK_STRING", + /* 133 */ "alter_db_option ::= CACHESIZE NK_INTEGER", + /* 134 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER", + /* 135 */ "alter_db_option ::= KEEP integer_list", + /* 136 */ "alter_db_option ::= KEEP variable_list", + /* 137 */ "alter_db_option ::= PAGES NK_INTEGER", + /* 138 */ "alter_db_option ::= REPLICA NK_INTEGER", + /* 139 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER", + /* 140 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER", + /* 141 */ "alter_db_option ::= MINROWS NK_INTEGER", + /* 142 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER", + /* 143 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", + /* 144 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER", + /* 145 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", + /* 146 */ "alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER", + /* 147 */ "integer_list ::= NK_INTEGER", + /* 148 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", + /* 149 */ "variable_list ::= NK_VARIABLE", + /* 150 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", + /* 151 */ "retention_list ::= retention", + /* 152 */ "retention_list ::= retention_list NK_COMMA retention", + /* 153 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", + /* 154 */ "retention ::= NK_MINUS NK_COLON NK_VARIABLE", + /* 155 */ "speed_opt ::=", + /* 156 */ "speed_opt ::= BWLIMIT NK_INTEGER", + /* 157 */ "start_opt ::=", + /* 158 */ "start_opt ::= START WITH NK_INTEGER", + /* 159 */ "start_opt ::= START WITH NK_STRING", + /* 160 */ "start_opt ::= START WITH TIMESTAMP NK_STRING", + /* 161 */ "end_opt ::=", + /* 162 */ "end_opt ::= END WITH NK_INTEGER", + /* 163 */ "end_opt ::= END WITH NK_STRING", + /* 164 */ "end_opt ::= END WITH TIMESTAMP NK_STRING", + /* 165 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", + /* 166 */ "cmd ::= CREATE TABLE multi_create_clause", + /* 167 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", + /* 168 */ "cmd ::= DROP TABLE multi_drop_clause", + /* 169 */ "cmd ::= DROP STABLE exists_opt full_table_name", + /* 170 */ "cmd ::= ALTER TABLE alter_table_clause", + /* 171 */ "cmd ::= ALTER STABLE alter_table_clause", + /* 172 */ "alter_table_clause ::= full_table_name alter_table_options", + /* 173 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", + /* 174 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", + /* 175 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", + /* 176 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", + /* 177 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", + /* 178 */ "alter_table_clause ::= full_table_name DROP TAG column_name", + /* 179 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", + /* 180 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", + /* 181 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", + /* 182 */ "multi_create_clause ::= create_subtable_clause", + /* 183 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", + /* 184 */ "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", + /* 185 */ "multi_drop_clause ::= drop_table_clause", + /* 186 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", + /* 187 */ "drop_table_clause ::= exists_opt full_table_name", + /* 188 */ "specific_cols_opt ::=", + /* 189 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", + /* 190 */ "full_table_name ::= table_name", + /* 191 */ "full_table_name ::= db_name NK_DOT table_name", + /* 192 */ "column_def_list ::= column_def", + /* 193 */ "column_def_list ::= column_def_list NK_COMMA column_def", + /* 194 */ "column_def ::= column_name type_name", + /* 195 */ "type_name ::= BOOL", + /* 196 */ "type_name ::= TINYINT", + /* 197 */ "type_name ::= SMALLINT", + /* 198 */ "type_name ::= INT", + /* 199 */ "type_name ::= INTEGER", + /* 200 */ "type_name ::= BIGINT", + /* 201 */ "type_name ::= FLOAT", + /* 202 */ "type_name ::= DOUBLE", + /* 203 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 204 */ "type_name ::= TIMESTAMP", + /* 205 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 206 */ "type_name ::= TINYINT UNSIGNED", + /* 207 */ "type_name ::= SMALLINT UNSIGNED", + /* 208 */ "type_name ::= INT UNSIGNED", + /* 209 */ "type_name ::= BIGINT UNSIGNED", + /* 210 */ "type_name ::= JSON", + /* 211 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 212 */ "type_name ::= MEDIUMBLOB", + /* 213 */ "type_name ::= BLOB", + /* 214 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 215 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP", + /* 216 */ "type_name ::= DECIMAL", + /* 217 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 218 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 219 */ "tags_def_opt ::=", + /* 220 */ "tags_def_opt ::= tags_def", + /* 221 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", + /* 222 */ "table_options ::=", + /* 223 */ "table_options ::= table_options COMMENT NK_STRING", + /* 224 */ "table_options ::= table_options MAX_DELAY duration_list", + /* 225 */ "table_options ::= table_options WATERMARK duration_list", + /* 226 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", + /* 227 */ "table_options ::= table_options TTL NK_INTEGER", + /* 228 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 229 */ "table_options ::= table_options DELETE_MARK duration_list", + /* 230 */ "alter_table_options ::= alter_table_option", + /* 231 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 232 */ "alter_table_option ::= COMMENT NK_STRING", + /* 233 */ "alter_table_option ::= TTL NK_INTEGER", + /* 234 */ "duration_list ::= duration_literal", + /* 235 */ "duration_list ::= duration_list NK_COMMA duration_literal", + /* 236 */ "rollup_func_list ::= rollup_func_name", + /* 237 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", + /* 238 */ "rollup_func_name ::= function_name", + /* 239 */ "rollup_func_name ::= FIRST", + /* 240 */ "rollup_func_name ::= LAST", + /* 241 */ "col_name_list ::= col_name", + /* 242 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 243 */ "col_name ::= column_name", + /* 244 */ "cmd ::= SHOW DNODES", + /* 245 */ "cmd ::= SHOW USERS", + /* 246 */ "cmd ::= SHOW USER PRIVILEGES", + /* 247 */ "cmd ::= SHOW db_kind_opt DATABASES", + /* 248 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt", + /* 249 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 250 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 251 */ "cmd ::= SHOW MNODES", + /* 252 */ "cmd ::= SHOW QNODES", + /* 253 */ "cmd ::= SHOW FUNCTIONS", + /* 254 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 255 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name", + /* 256 */ "cmd ::= SHOW STREAMS", + /* 257 */ "cmd ::= SHOW ACCOUNTS", + /* 258 */ "cmd ::= SHOW APPS", + /* 259 */ "cmd ::= SHOW CONNECTIONS", + /* 260 */ "cmd ::= SHOW LICENCES", + /* 261 */ "cmd ::= SHOW GRANTS", + /* 262 */ "cmd ::= SHOW GRANTS FULL", + /* 263 */ "cmd ::= SHOW GRANTS LOGS", + /* 264 */ "cmd ::= SHOW CLUSTER MACHINES", + /* 265 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 266 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 267 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 268 */ "cmd ::= SHOW QUERIES", + /* 269 */ "cmd ::= SHOW SCORES", + /* 270 */ "cmd ::= SHOW TOPICS", + /* 271 */ "cmd ::= SHOW VARIABLES", + /* 272 */ "cmd ::= SHOW CLUSTER VARIABLES", + /* 273 */ "cmd ::= SHOW LOCAL VARIABLES", + /* 274 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", + /* 275 */ "cmd ::= SHOW BNODES", + /* 276 */ "cmd ::= SHOW SNODES", + /* 277 */ "cmd ::= SHOW CLUSTER", + /* 278 */ "cmd ::= SHOW TRANSACTIONS", + /* 279 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", + /* 280 */ "cmd ::= SHOW CONSUMERS", + /* 281 */ "cmd ::= SHOW SUBSCRIPTIONS", + /* 282 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", + /* 283 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name", + /* 284 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", + /* 285 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name", + /* 286 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER", + /* 287 */ "cmd ::= SHOW VNODES", + /* 288 */ "cmd ::= SHOW db_name_cond_opt ALIVE", + /* 289 */ "cmd ::= SHOW CLUSTER ALIVE", + /* 290 */ "cmd ::= SHOW db_name_cond_opt VIEWS", + /* 291 */ "cmd ::= SHOW CREATE VIEW full_table_name", + /* 292 */ "cmd ::= SHOW COMPACTS", + /* 293 */ "cmd ::= SHOW COMPACT NK_INTEGER", + /* 294 */ "table_kind_db_name_cond_opt ::=", + /* 295 */ "table_kind_db_name_cond_opt ::= table_kind", + /* 296 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT", + /* 297 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT", + /* 298 */ "table_kind ::= NORMAL", + /* 299 */ "table_kind ::= CHILD", + /* 300 */ "db_name_cond_opt ::=", + /* 301 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 302 */ "like_pattern_opt ::=", + /* 303 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 304 */ "table_name_cond ::= table_name", + /* 305 */ "from_db_opt ::=", + /* 306 */ "from_db_opt ::= FROM db_name", + /* 307 */ "tag_list_opt ::=", + /* 308 */ "tag_list_opt ::= tag_item", + /* 309 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", + /* 310 */ "tag_item ::= TBNAME", + /* 311 */ "tag_item ::= QTAGS", + /* 312 */ "tag_item ::= column_name", + /* 313 */ "tag_item ::= column_name column_alias", + /* 314 */ "tag_item ::= column_name AS column_alias", + /* 315 */ "db_kind_opt ::=", + /* 316 */ "db_kind_opt ::= USER", + /* 317 */ "db_kind_opt ::= SYSTEM", + /* 318 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options", + /* 319 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP", + /* 320 */ "cmd ::= DROP INDEX exists_opt full_index_name", + /* 321 */ "full_index_name ::= index_name", + /* 322 */ "full_index_name ::= db_name NK_DOT index_name", + /* 323 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 324 */ "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", + /* 325 */ "func_list ::= func", + /* 326 */ "func_list ::= func_list NK_COMMA func", + /* 327 */ "func ::= sma_func_name NK_LP expression_list NK_RP", + /* 328 */ "sma_func_name ::= function_name", + /* 329 */ "sma_func_name ::= COUNT", + /* 330 */ "sma_func_name ::= FIRST", + /* 331 */ "sma_func_name ::= LAST", + /* 332 */ "sma_func_name ::= LAST_ROW", + /* 333 */ "sma_stream_opt ::=", + /* 334 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", + /* 335 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", + /* 336 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", + /* 337 */ "with_meta ::= AS", + /* 338 */ "with_meta ::= WITH META AS", + /* 339 */ "with_meta ::= ONLY META AS", + /* 340 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 341 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", + /* 342 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", + /* 343 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 344 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 345 */ "cmd ::= DESC full_table_name", + /* 346 */ "cmd ::= DESCRIBE full_table_name", + /* 347 */ "cmd ::= RESET QUERY CACHE", + /* 348 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 349 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", + /* 350 */ "analyze_opt ::=", + /* 351 */ "analyze_opt ::= ANALYZE", + /* 352 */ "explain_options ::=", + /* 353 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 354 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 355 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", + /* 356 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 357 */ "agg_func_opt ::=", + /* 358 */ "agg_func_opt ::= AGGREGATE", + /* 359 */ "bufsize_opt ::=", + /* 360 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 361 */ "language_opt ::=", + /* 362 */ "language_opt ::= LANGUAGE NK_STRING", + /* 363 */ "or_replace_opt ::=", + /* 364 */ "or_replace_opt ::= OR REPLACE", + /* 365 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery", + /* 366 */ "cmd ::= DROP VIEW exists_opt full_view_name", + /* 367 */ "full_view_name ::= view_name", + /* 368 */ "full_view_name ::= db_name NK_DOT view_name", + /* 369 */ "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", + /* 370 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 371 */ "cmd ::= PAUSE STREAM exists_opt stream_name", + /* 372 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", + /* 373 */ "col_list_opt ::=", + /* 374 */ "col_list_opt ::= NK_LP col_name_list NK_RP", + /* 375 */ "tag_def_or_ref_opt ::=", + /* 376 */ "tag_def_or_ref_opt ::= tags_def", + /* 377 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", + /* 378 */ "stream_options ::=", + /* 379 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 380 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 381 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 382 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 383 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 384 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 385 */ "stream_options ::= stream_options DELETE_MARK duration_literal", + /* 386 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", + /* 387 */ "subtable_opt ::=", + /* 388 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 389 */ "ignore_opt ::=", + /* 390 */ "ignore_opt ::= IGNORE UNTREATED", + /* 391 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 392 */ "cmd ::= KILL QUERY NK_STRING", + /* 393 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 394 */ "cmd ::= KILL COMPACT NK_INTEGER", + /* 395 */ "cmd ::= BALANCE VGROUP", + /* 396 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", + /* 397 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 398 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 399 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 400 */ "on_vgroup_id ::=", + /* 401 */ "on_vgroup_id ::= ON NK_INTEGER", + /* 402 */ "dnode_list ::= DNODE NK_INTEGER", + /* 403 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 404 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 405 */ "cmd ::= query_or_subquery", + /* 406 */ "cmd ::= insert_query", + /* 407 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 408 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", + /* 409 */ "literal ::= NK_INTEGER", + /* 410 */ "literal ::= NK_FLOAT", + /* 411 */ "literal ::= NK_STRING", + /* 412 */ "literal ::= NK_BOOL", + /* 413 */ "literal ::= TIMESTAMP NK_STRING", + /* 414 */ "literal ::= duration_literal", + /* 415 */ "literal ::= NULL", + /* 416 */ "literal ::= NK_QUESTION", + /* 417 */ "duration_literal ::= NK_VARIABLE", + /* 418 */ "signed ::= NK_INTEGER", + /* 419 */ "signed ::= NK_PLUS NK_INTEGER", + /* 420 */ "signed ::= NK_MINUS NK_INTEGER", + /* 421 */ "signed ::= NK_FLOAT", + /* 422 */ "signed ::= NK_PLUS NK_FLOAT", + /* 423 */ "signed ::= NK_MINUS NK_FLOAT", + /* 424 */ "signed_literal ::= signed", + /* 425 */ "signed_literal ::= NK_STRING", + /* 426 */ "signed_literal ::= NK_BOOL", + /* 427 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 428 */ "signed_literal ::= duration_literal", + /* 429 */ "signed_literal ::= NULL", + /* 430 */ "signed_literal ::= literal_func", + /* 431 */ "signed_literal ::= NK_QUESTION", + /* 432 */ "literal_list ::= signed_literal", + /* 433 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 434 */ "db_name ::= NK_ID", + /* 435 */ "table_name ::= NK_ID", + /* 436 */ "column_name ::= NK_ID", + /* 437 */ "function_name ::= NK_ID", + /* 438 */ "view_name ::= NK_ID", + /* 439 */ "table_alias ::= NK_ID", + /* 440 */ "column_alias ::= NK_ID", + /* 441 */ "column_alias ::= NK_ALIAS", + /* 442 */ "user_name ::= NK_ID", + /* 443 */ "topic_name ::= NK_ID", + /* 444 */ "stream_name ::= NK_ID", + /* 445 */ "cgroup_name ::= NK_ID", + /* 446 */ "index_name ::= NK_ID", + /* 447 */ "expr_or_subquery ::= expression", + /* 448 */ "expression ::= literal", + /* 449 */ "expression ::= pseudo_column", + /* 450 */ "expression ::= column_reference", + /* 451 */ "expression ::= function_expression", + /* 452 */ "expression ::= case_when_expression", + /* 453 */ "expression ::= NK_LP expression NK_RP", + /* 454 */ "expression ::= NK_PLUS expr_or_subquery", + /* 455 */ "expression ::= NK_MINUS expr_or_subquery", + /* 456 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 457 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 458 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 459 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 460 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 461 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 462 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 463 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 464 */ "expression_list ::= expr_or_subquery", + /* 465 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 466 */ "column_reference ::= column_name", + /* 467 */ "column_reference ::= table_name NK_DOT column_name", + /* 468 */ "column_reference ::= NK_ALIAS", + /* 469 */ "column_reference ::= table_name NK_DOT NK_ALIAS", + /* 470 */ "pseudo_column ::= ROWTS", + /* 471 */ "pseudo_column ::= TBNAME", + /* 472 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 473 */ "pseudo_column ::= QSTART", + /* 474 */ "pseudo_column ::= QEND", + /* 475 */ "pseudo_column ::= QDURATION", + /* 476 */ "pseudo_column ::= WSTART", + /* 477 */ "pseudo_column ::= WEND", + /* 478 */ "pseudo_column ::= WDURATION", + /* 479 */ "pseudo_column ::= IROWTS", + /* 480 */ "pseudo_column ::= ISFILLED", + /* 481 */ "pseudo_column ::= QTAGS", + /* 482 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 483 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 484 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 485 */ "function_expression ::= literal_func", + /* 486 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 487 */ "literal_func ::= NOW", + /* 488 */ "noarg_func ::= NOW", + /* 489 */ "noarg_func ::= TODAY", + /* 490 */ "noarg_func ::= TIMEZONE", + /* 491 */ "noarg_func ::= DATABASE", + /* 492 */ "noarg_func ::= CLIENT_VERSION", + /* 493 */ "noarg_func ::= SERVER_VERSION", + /* 494 */ "noarg_func ::= SERVER_STATUS", + /* 495 */ "noarg_func ::= CURRENT_USER", + /* 496 */ "noarg_func ::= USER", + /* 497 */ "star_func ::= COUNT", + /* 498 */ "star_func ::= FIRST", + /* 499 */ "star_func ::= LAST", + /* 500 */ "star_func ::= LAST_ROW", + /* 501 */ "star_func_para_list ::= NK_STAR", + /* 502 */ "star_func_para_list ::= other_para_list", + /* 503 */ "other_para_list ::= star_func_para", + /* 504 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 505 */ "star_func_para ::= expr_or_subquery", + /* 506 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 507 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 508 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 509 */ "when_then_list ::= when_then_expr", + /* 510 */ "when_then_list ::= when_then_list when_then_expr", + /* 511 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 512 */ "case_when_else_opt ::=", + /* 513 */ "case_when_else_opt ::= ELSE common_expression", + /* 514 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 515 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 516 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 517 */ "predicate ::= expr_or_subquery IS NULL", + /* 518 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 519 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 520 */ "compare_op ::= NK_LT", + /* 521 */ "compare_op ::= NK_GT", + /* 522 */ "compare_op ::= NK_LE", + /* 523 */ "compare_op ::= NK_GE", + /* 524 */ "compare_op ::= NK_NE", + /* 525 */ "compare_op ::= NK_EQ", + /* 526 */ "compare_op ::= LIKE", + /* 527 */ "compare_op ::= NOT LIKE", + /* 528 */ "compare_op ::= MATCH", + /* 529 */ "compare_op ::= NMATCH", + /* 530 */ "compare_op ::= CONTAINS", + /* 531 */ "in_op ::= IN", + /* 532 */ "in_op ::= NOT IN", + /* 533 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 534 */ "boolean_value_expression ::= boolean_primary", + /* 535 */ "boolean_value_expression ::= NOT boolean_primary", + /* 536 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 537 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 538 */ "boolean_primary ::= predicate", + /* 539 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 540 */ "common_expression ::= expr_or_subquery", + /* 541 */ "common_expression ::= boolean_value_expression", + /* 542 */ "from_clause_opt ::=", + /* 543 */ "from_clause_opt ::= FROM table_reference_list", + /* 544 */ "table_reference_list ::= table_reference", + /* 545 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 546 */ "table_reference ::= table_primary", + /* 547 */ "table_reference ::= joined_table", + /* 548 */ "table_primary ::= table_name alias_opt", + /* 549 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 550 */ "table_primary ::= subquery alias_opt", + /* 551 */ "table_primary ::= parenthesized_joined_table", + /* 552 */ "alias_opt ::=", + /* 553 */ "alias_opt ::= table_alias", + /* 554 */ "alias_opt ::= AS table_alias", + /* 555 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 556 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 557 */ "joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt", + /* 558 */ "join_type ::=", + /* 559 */ "join_type ::= INNER", + /* 560 */ "join_type ::= LEFT", + /* 561 */ "join_type ::= RIGHT", + /* 562 */ "join_type ::= FULL", + /* 563 */ "join_subtype ::=", + /* 564 */ "join_subtype ::= OUTER", + /* 565 */ "join_subtype ::= SEMI", + /* 566 */ "join_subtype ::= ANTI", + /* 567 */ "join_subtype ::= ASOF", + /* 568 */ "join_subtype ::= WINDOW", + /* 569 */ "join_on_clause_opt ::=", + /* 570 */ "join_on_clause_opt ::= ON search_condition", + /* 571 */ "window_offset_clause_opt ::=", + /* 572 */ "window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP", + /* 573 */ "window_offset_literal ::= NK_VARIABLE", + /* 574 */ "window_offset_literal ::= NK_MINUS NK_VARIABLE", + /* 575 */ "jlimit_clause_opt ::=", + /* 576 */ "jlimit_clause_opt ::= JLIMIT NK_INTEGER", + /* 577 */ "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", + /* 578 */ "hint_list ::=", + /* 579 */ "hint_list ::= NK_HINT", + /* 580 */ "tag_mode_opt ::=", + /* 581 */ "tag_mode_opt ::= TAGS", + /* 582 */ "set_quantifier_opt ::=", + /* 583 */ "set_quantifier_opt ::= DISTINCT", + /* 584 */ "set_quantifier_opt ::= ALL", + /* 585 */ "select_list ::= select_item", + /* 586 */ "select_list ::= select_list NK_COMMA select_item", + /* 587 */ "select_item ::= NK_STAR", + /* 588 */ "select_item ::= common_expression", + /* 589 */ "select_item ::= common_expression column_alias", + /* 590 */ "select_item ::= common_expression AS column_alias", + /* 591 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 592 */ "where_clause_opt ::=", + /* 593 */ "where_clause_opt ::= WHERE search_condition", + /* 594 */ "partition_by_clause_opt ::=", + /* 595 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 596 */ "partition_list ::= partition_item", + /* 597 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 598 */ "partition_item ::= expr_or_subquery", + /* 599 */ "partition_item ::= expr_or_subquery column_alias", + /* 600 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 601 */ "twindow_clause_opt ::=", + /* 602 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", + /* 603 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 604 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 605 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 606 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 607 */ "sliding_opt ::=", + /* 608 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", + /* 609 */ "interval_sliding_duration_literal ::= NK_VARIABLE", + /* 610 */ "interval_sliding_duration_literal ::= NK_STRING", + /* 611 */ "interval_sliding_duration_literal ::= NK_INTEGER", + /* 612 */ "fill_opt ::=", + /* 613 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 614 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", + /* 615 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", + /* 616 */ "fill_mode ::= NONE", + /* 617 */ "fill_mode ::= PREV", + /* 618 */ "fill_mode ::= NULL", + /* 619 */ "fill_mode ::= NULL_F", + /* 620 */ "fill_mode ::= LINEAR", + /* 621 */ "fill_mode ::= NEXT", + /* 622 */ "group_by_clause_opt ::=", + /* 623 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 624 */ "group_by_list ::= expr_or_subquery", + /* 625 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 626 */ "having_clause_opt ::=", + /* 627 */ "having_clause_opt ::= HAVING search_condition", + /* 628 */ "range_opt ::=", + /* 629 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 630 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", + /* 631 */ "every_opt ::=", + /* 632 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 633 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 634 */ "query_simple ::= query_specification", + /* 635 */ "query_simple ::= union_query_expression", + /* 636 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 637 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 638 */ "query_simple_or_subquery ::= query_simple", + /* 639 */ "query_simple_or_subquery ::= subquery", + /* 640 */ "query_or_subquery ::= query_expression", + /* 641 */ "query_or_subquery ::= subquery", + /* 642 */ "order_by_clause_opt ::=", + /* 643 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 644 */ "slimit_clause_opt ::=", + /* 645 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 646 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 647 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 648 */ "limit_clause_opt ::=", + /* 649 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 650 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 651 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 652 */ "subquery ::= NK_LP query_expression NK_RP", + /* 653 */ "subquery ::= NK_LP subquery NK_RP", + /* 654 */ "search_condition ::= common_expression", + /* 655 */ "sort_specification_list ::= sort_specification", + /* 656 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 657 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 658 */ "ordering_specification_opt ::=", + /* 659 */ "ordering_specification_opt ::= ASC", + /* 660 */ "ordering_specification_opt ::= DESC", + /* 661 */ "null_ordering_opt ::=", + /* 662 */ "null_ordering_opt ::= NULLS FIRST", + /* 663 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2887,240 +2855,240 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 356: /* cmd */ - case 359: /* literal */ - case 368: /* with_opt */ - case 374: /* search_condition */ - case 379: /* db_options */ - case 381: /* alter_db_options */ - case 383: /* start_opt */ - case 384: /* end_opt */ - case 388: /* signed */ - case 390: /* retention */ - case 391: /* full_table_name */ - case 394: /* table_options */ - case 398: /* alter_table_clause */ - case 399: /* alter_table_options */ - case 402: /* signed_literal */ - case 403: /* create_subtable_clause */ - case 406: /* drop_table_clause */ - case 408: /* column_def */ - case 412: /* duration_literal */ - case 413: /* rollup_func_name */ - case 415: /* col_name */ - case 418: /* like_pattern_opt */ - case 419: /* db_name_cond_opt */ - case 420: /* table_name_cond */ - case 421: /* from_db_opt */ - case 424: /* tag_item */ - case 426: /* index_options */ - case 427: /* full_index_name */ - case 430: /* sliding_opt */ - case 431: /* sma_stream_opt */ - case 432: /* func */ - case 435: /* query_or_subquery */ - case 436: /* where_clause_opt */ - case 439: /* explain_options */ - case 440: /* insert_query */ - case 445: /* full_view_name */ - case 448: /* stream_options */ - case 451: /* subtable_opt */ - case 453: /* expression */ - case 456: /* literal_func */ - case 459: /* expr_or_subquery */ - case 460: /* pseudo_column */ - case 461: /* column_reference */ - case 462: /* function_expression */ - case 463: /* case_when_expression */ - case 468: /* star_func_para */ - case 470: /* case_when_else_opt */ - case 471: /* common_expression */ - case 472: /* when_then_expr */ - case 473: /* predicate */ - case 476: /* in_predicate_value */ - case 477: /* boolean_value_expression */ - case 478: /* boolean_primary */ - case 479: /* from_clause_opt */ - case 480: /* table_reference_list */ - case 481: /* table_reference */ - case 482: /* table_primary */ - case 483: /* joined_table */ - case 485: /* subquery */ - case 486: /* parenthesized_joined_table */ - case 489: /* join_on_clause_opt */ - case 490: /* window_offset_clause_opt */ - case 491: /* jlimit_clause_opt */ - case 492: /* window_offset_literal */ - case 493: /* query_specification */ - case 499: /* range_opt */ - case 500: /* every_opt */ - case 501: /* fill_opt */ - case 502: /* twindow_clause_opt */ - case 504: /* having_clause_opt */ - case 505: /* select_item */ - case 507: /* partition_item */ - case 508: /* interval_sliding_duration_literal */ - case 511: /* query_expression */ - case 512: /* query_simple */ - case 514: /* slimit_clause_opt */ - case 515: /* limit_clause_opt */ - case 516: /* union_query_expression */ - case 517: /* query_simple_or_subquery */ - case 519: /* sort_specification */ + case 358: /* cmd */ + case 361: /* literal */ + case 370: /* with_opt */ + case 376: /* search_condition */ + case 381: /* db_options */ + case 383: /* alter_db_options */ + case 385: /* start_opt */ + case 386: /* end_opt */ + case 390: /* signed */ + case 392: /* retention */ + case 393: /* full_table_name */ + case 396: /* table_options */ + case 400: /* alter_table_clause */ + case 401: /* alter_table_options */ + case 404: /* signed_literal */ + case 405: /* create_subtable_clause */ + case 408: /* drop_table_clause */ + case 410: /* column_def */ + case 414: /* duration_literal */ + case 415: /* rollup_func_name */ + case 417: /* col_name */ + case 420: /* like_pattern_opt */ + case 421: /* db_name_cond_opt */ + case 422: /* table_name_cond */ + case 423: /* from_db_opt */ + case 426: /* tag_item */ + case 428: /* index_options */ + case 429: /* full_index_name */ + case 432: /* sliding_opt */ + case 433: /* sma_stream_opt */ + case 434: /* func */ + case 437: /* query_or_subquery */ + case 438: /* where_clause_opt */ + case 441: /* explain_options */ + case 442: /* insert_query */ + case 447: /* full_view_name */ + case 450: /* stream_options */ + case 453: /* subtable_opt */ + case 455: /* expression */ + case 458: /* literal_func */ + case 461: /* expr_or_subquery */ + case 462: /* pseudo_column */ + case 463: /* column_reference */ + case 464: /* function_expression */ + case 465: /* case_when_expression */ + case 470: /* star_func_para */ + case 472: /* case_when_else_opt */ + case 473: /* common_expression */ + case 474: /* when_then_expr */ + case 475: /* predicate */ + case 478: /* in_predicate_value */ + case 479: /* boolean_value_expression */ + case 480: /* boolean_primary */ + case 481: /* from_clause_opt */ + case 482: /* table_reference_list */ + case 483: /* table_reference */ + case 484: /* table_primary */ + case 485: /* joined_table */ + case 487: /* subquery */ + case 488: /* parenthesized_joined_table */ + case 491: /* join_on_clause_opt */ + case 492: /* window_offset_clause_opt */ + case 493: /* jlimit_clause_opt */ + case 494: /* window_offset_literal */ + case 495: /* query_specification */ + case 501: /* range_opt */ + case 502: /* every_opt */ + case 503: /* fill_opt */ + case 504: /* twindow_clause_opt */ + case 506: /* having_clause_opt */ + case 507: /* select_item */ + case 509: /* partition_item */ + case 510: /* interval_sliding_duration_literal */ + case 513: /* query_expression */ + case 514: /* query_simple */ + case 516: /* slimit_clause_opt */ + case 517: /* limit_clause_opt */ + case 518: /* union_query_expression */ + case 519: /* query_simple_or_subquery */ + case 521: /* sort_specification */ { - nodesDestroyNode((yypminor->yy884)); + nodesDestroyNode((yypminor->yy1000)); } break; - case 357: /* account_options */ - case 358: /* alter_account_options */ - case 360: /* alter_account_option */ - case 382: /* speed_opt */ - case 434: /* with_meta */ - case 443: /* bufsize_opt */ + case 359: /* account_options */ + case 360: /* alter_account_options */ + case 362: /* alter_account_option */ + case 384: /* speed_opt */ + case 436: /* with_meta */ + case 445: /* bufsize_opt */ { } break; - case 361: /* ip_range_list */ - case 362: /* white_list */ - case 363: /* white_list_opt */ - case 385: /* integer_list */ - case 386: /* variable_list */ - case 387: /* retention_list */ - case 392: /* column_def_list */ - case 393: /* tags_def_opt */ - case 395: /* multi_create_clause */ - case 396: /* tags_def */ - case 397: /* multi_drop_clause */ - case 404: /* specific_cols_opt */ - case 405: /* expression_list */ - case 407: /* col_name_list */ - case 409: /* duration_list */ - case 410: /* rollup_func_list */ - case 422: /* tag_list_opt */ - case 429: /* func_list */ - case 449: /* col_list_opt */ - case 450: /* tag_def_or_ref_opt */ - case 455: /* dnode_list */ - case 457: /* literal_list */ - case 465: /* star_func_para_list */ - case 467: /* other_para_list */ - case 469: /* when_then_list */ - case 494: /* hint_list */ - case 497: /* select_list */ - case 498: /* partition_by_clause_opt */ - case 503: /* group_by_clause_opt */ - case 506: /* partition_list */ - case 510: /* group_by_list */ - case 513: /* order_by_clause_opt */ - case 518: /* sort_specification_list */ + case 363: /* ip_range_list */ + case 364: /* white_list */ + case 365: /* white_list_opt */ + case 387: /* integer_list */ + case 388: /* variable_list */ + case 389: /* retention_list */ + case 394: /* column_def_list */ + case 395: /* tags_def_opt */ + case 397: /* multi_create_clause */ + case 398: /* tags_def */ + case 399: /* multi_drop_clause */ + case 406: /* specific_cols_opt */ + case 407: /* expression_list */ + case 409: /* col_name_list */ + case 411: /* duration_list */ + case 412: /* rollup_func_list */ + case 424: /* tag_list_opt */ + case 431: /* func_list */ + case 451: /* col_list_opt */ + case 452: /* tag_def_or_ref_opt */ + case 457: /* dnode_list */ + case 459: /* literal_list */ + case 467: /* star_func_para_list */ + case 469: /* other_para_list */ + case 471: /* when_then_list */ + case 496: /* hint_list */ + case 499: /* select_list */ + case 500: /* partition_by_clause_opt */ + case 505: /* group_by_clause_opt */ + case 508: /* partition_list */ + case 512: /* group_by_list */ + case 515: /* order_by_clause_opt */ + case 520: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy964)); + nodesDestroyList((yypminor->yy72)); } break; - case 364: /* user_name */ - case 371: /* db_name */ - case 372: /* table_name */ - case 373: /* topic_name */ - case 375: /* dnode_endpoint */ - case 400: /* column_name */ - case 414: /* function_name */ - case 425: /* column_alias */ - case 428: /* index_name */ - case 433: /* sma_func_name */ - case 437: /* cgroup_name */ - case 444: /* language_opt */ - case 446: /* view_name */ - case 447: /* stream_name */ - case 454: /* on_vgroup_id */ - case 458: /* table_alias */ - case 464: /* star_func */ - case 466: /* noarg_func */ - case 484: /* alias_opt */ + case 366: /* user_name */ + case 373: /* db_name */ + case 374: /* table_name */ + case 375: /* topic_name */ + case 377: /* dnode_endpoint */ + case 402: /* column_name */ + case 416: /* function_name */ + case 427: /* column_alias */ + case 430: /* index_name */ + case 435: /* sma_func_name */ + case 439: /* cgroup_name */ + case 446: /* language_opt */ + case 448: /* view_name */ + case 449: /* stream_name */ + case 456: /* on_vgroup_id */ + case 460: /* table_alias */ + case 466: /* star_func */ + case 468: /* noarg_func */ + case 486: /* alias_opt */ { } break; - case 365: /* sysinfo_opt */ + case 367: /* sysinfo_opt */ { } break; - case 366: /* privileges */ - case 369: /* priv_type_list */ - case 370: /* priv_type */ + case 368: /* privileges */ + case 371: /* priv_type_list */ + case 372: /* priv_type */ { } break; - case 367: /* priv_level */ + case 369: /* priv_level */ { } break; - case 376: /* force_opt */ - case 377: /* unsafe_opt */ - case 378: /* not_exists_opt */ - case 380: /* exists_opt */ - case 438: /* analyze_opt */ - case 441: /* or_replace_opt */ - case 442: /* agg_func_opt */ - case 452: /* ignore_opt */ - case 495: /* set_quantifier_opt */ - case 496: /* tag_mode_opt */ + case 378: /* force_opt */ + case 379: /* unsafe_opt */ + case 380: /* not_exists_opt */ + case 382: /* exists_opt */ + case 440: /* analyze_opt */ + case 443: /* or_replace_opt */ + case 444: /* agg_func_opt */ + case 454: /* ignore_opt */ + case 497: /* set_quantifier_opt */ + case 498: /* tag_mode_opt */ { } break; - case 389: /* alter_db_option */ - case 411: /* alter_table_option */ + case 391: /* alter_db_option */ + case 413: /* alter_table_option */ { } break; - case 401: /* type_name */ + case 403: /* type_name */ { } break; - case 416: /* db_kind_opt */ - case 423: /* table_kind */ + case 418: /* db_kind_opt */ + case 425: /* table_kind */ { } break; - case 417: /* table_kind_db_name_cond_opt */ + case 419: /* table_kind_db_name_cond_opt */ { } break; - case 474: /* compare_op */ - case 475: /* in_op */ + case 476: /* compare_op */ + case 477: /* in_op */ { } break; - case 487: /* join_type */ + case 489: /* join_type */ { } break; - case 488: /* join_subtype */ + case 490: /* join_subtype */ { } break; - case 509: /* fill_mode */ + case 511: /* fill_mode */ { } break; - case 520: /* ordering_specification_opt */ + case 522: /* ordering_specification_opt */ { } break; - case 521: /* null_ordering_opt */ + case 523: /* null_ordering_opt */ { } @@ -3411,665 +3379,670 @@ static void yy_shift( /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side ** of that rule */ static const YYCODETYPE yyRuleInfoLhs[] = { - 356, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - 356, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - 357, /* (2) account_options ::= */ - 357, /* (3) account_options ::= account_options PPS literal */ - 357, /* (4) account_options ::= account_options TSERIES literal */ - 357, /* (5) account_options ::= account_options STORAGE literal */ - 357, /* (6) account_options ::= account_options STREAMS literal */ - 357, /* (7) account_options ::= account_options QTIME literal */ - 357, /* (8) account_options ::= account_options DBS literal */ - 357, /* (9) account_options ::= account_options USERS literal */ - 357, /* (10) account_options ::= account_options CONNS literal */ - 357, /* (11) account_options ::= account_options STATE literal */ - 358, /* (12) alter_account_options ::= alter_account_option */ - 358, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - 360, /* (14) alter_account_option ::= PASS literal */ - 360, /* (15) alter_account_option ::= PPS literal */ - 360, /* (16) alter_account_option ::= TSERIES literal */ - 360, /* (17) alter_account_option ::= STORAGE literal */ - 360, /* (18) alter_account_option ::= STREAMS literal */ - 360, /* (19) alter_account_option ::= QTIME literal */ - 360, /* (20) alter_account_option ::= DBS literal */ - 360, /* (21) alter_account_option ::= USERS literal */ - 360, /* (22) alter_account_option ::= CONNS literal */ - 360, /* (23) alter_account_option ::= STATE literal */ - 361, /* (24) ip_range_list ::= NK_STRING */ - 361, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ - 362, /* (26) white_list ::= HOST ip_range_list */ - 363, /* (27) white_list_opt ::= */ - 363, /* (28) white_list_opt ::= white_list */ - 356, /* (29) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt white_list_opt */ - 356, /* (30) cmd ::= ALTER USER user_name PASS NK_STRING */ - 356, /* (31) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - 356, /* (32) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - 356, /* (33) cmd ::= ALTER USER user_name ADD white_list */ - 356, /* (34) cmd ::= ALTER USER user_name DROP white_list */ - 356, /* (35) cmd ::= DROP USER user_name */ - 365, /* (36) sysinfo_opt ::= */ - 365, /* (37) sysinfo_opt ::= SYSINFO NK_INTEGER */ - 356, /* (38) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ - 356, /* (39) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ - 366, /* (40) privileges ::= ALL */ - 366, /* (41) privileges ::= priv_type_list */ - 366, /* (42) privileges ::= SUBSCRIBE */ - 369, /* (43) priv_type_list ::= priv_type */ - 369, /* (44) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - 370, /* (45) priv_type ::= READ */ - 370, /* (46) priv_type ::= WRITE */ - 370, /* (47) priv_type ::= ALTER */ - 367, /* (48) priv_level ::= NK_STAR NK_DOT NK_STAR */ - 367, /* (49) priv_level ::= db_name NK_DOT NK_STAR */ - 367, /* (50) priv_level ::= db_name NK_DOT table_name */ - 367, /* (51) priv_level ::= topic_name */ - 368, /* (52) with_opt ::= */ - 368, /* (53) with_opt ::= WITH search_condition */ - 356, /* (54) cmd ::= CREATE DNODE dnode_endpoint */ - 356, /* (55) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - 356, /* (56) cmd ::= DROP DNODE NK_INTEGER force_opt */ - 356, /* (57) cmd ::= DROP DNODE dnode_endpoint force_opt */ - 356, /* (58) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ - 356, /* (59) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ - 356, /* (60) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - 356, /* (61) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - 356, /* (62) cmd ::= ALTER ALL DNODES NK_STRING */ - 356, /* (63) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - 356, /* (64) cmd ::= RESTORE DNODE NK_INTEGER */ - 375, /* (65) dnode_endpoint ::= NK_STRING */ - 375, /* (66) dnode_endpoint ::= NK_ID */ - 375, /* (67) dnode_endpoint ::= NK_IPTOKEN */ - 376, /* (68) force_opt ::= */ - 376, /* (69) force_opt ::= FORCE */ - 377, /* (70) unsafe_opt ::= UNSAFE */ - 356, /* (71) cmd ::= ALTER LOCAL NK_STRING */ - 356, /* (72) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - 356, /* (73) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - 356, /* (74) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - 356, /* (75) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ - 356, /* (76) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - 356, /* (77) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - 356, /* (78) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - 356, /* (79) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - 356, /* (80) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - 356, /* (81) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - 356, /* (82) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ - 356, /* (83) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ - 356, /* (84) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - 356, /* (85) cmd ::= DROP DATABASE exists_opt db_name */ - 356, /* (86) cmd ::= USE db_name */ - 356, /* (87) cmd ::= ALTER DATABASE db_name alter_db_options */ - 356, /* (88) cmd ::= FLUSH DATABASE db_name */ - 356, /* (89) cmd ::= TRIM DATABASE db_name speed_opt */ - 356, /* (90) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ - 378, /* (91) not_exists_opt ::= IF NOT EXISTS */ - 378, /* (92) not_exists_opt ::= */ - 380, /* (93) exists_opt ::= IF EXISTS */ - 380, /* (94) exists_opt ::= */ - 379, /* (95) db_options ::= */ - 379, /* (96) db_options ::= db_options BUFFER NK_INTEGER */ - 379, /* (97) db_options ::= db_options CACHEMODEL NK_STRING */ - 379, /* (98) db_options ::= db_options CACHESIZE NK_INTEGER */ - 379, /* (99) db_options ::= db_options COMP NK_INTEGER */ - 379, /* (100) db_options ::= db_options DURATION NK_INTEGER */ - 379, /* (101) db_options ::= db_options DURATION NK_VARIABLE */ - 379, /* (102) db_options ::= db_options MAXROWS NK_INTEGER */ - 379, /* (103) db_options ::= db_options MINROWS NK_INTEGER */ - 379, /* (104) db_options ::= db_options KEEP integer_list */ - 379, /* (105) db_options ::= db_options KEEP variable_list */ - 379, /* (106) db_options ::= db_options PAGES NK_INTEGER */ - 379, /* (107) db_options ::= db_options PAGESIZE NK_INTEGER */ - 379, /* (108) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ - 379, /* (109) db_options ::= db_options PRECISION NK_STRING */ - 379, /* (110) db_options ::= db_options REPLICA NK_INTEGER */ - 379, /* (111) db_options ::= db_options VGROUPS NK_INTEGER */ - 379, /* (112) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - 379, /* (113) db_options ::= db_options RETENTIONS retention_list */ - 379, /* (114) db_options ::= db_options SCHEMALESS NK_INTEGER */ - 379, /* (115) db_options ::= db_options WAL_LEVEL NK_INTEGER */ - 379, /* (116) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ - 379, /* (117) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ - 379, /* (118) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - 379, /* (119) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ - 379, /* (120) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - 379, /* (121) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ - 379, /* (122) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ - 379, /* (123) db_options ::= db_options STT_TRIGGER NK_INTEGER */ - 379, /* (124) db_options ::= db_options TABLE_PREFIX signed */ - 379, /* (125) db_options ::= db_options TABLE_SUFFIX signed */ - 379, /* (126) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ - 381, /* (127) alter_db_options ::= alter_db_option */ - 381, /* (128) alter_db_options ::= alter_db_options alter_db_option */ - 389, /* (129) alter_db_option ::= BUFFER NK_INTEGER */ - 389, /* (130) alter_db_option ::= CACHEMODEL NK_STRING */ - 389, /* (131) alter_db_option ::= CACHESIZE NK_INTEGER */ - 389, /* (132) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - 389, /* (133) alter_db_option ::= KEEP integer_list */ - 389, /* (134) alter_db_option ::= KEEP variable_list */ - 389, /* (135) alter_db_option ::= PAGES NK_INTEGER */ - 389, /* (136) alter_db_option ::= REPLICA NK_INTEGER */ - 389, /* (137) alter_db_option ::= WAL_LEVEL NK_INTEGER */ - 389, /* (138) alter_db_option ::= STT_TRIGGER NK_INTEGER */ - 389, /* (139) alter_db_option ::= MINROWS NK_INTEGER */ - 389, /* (140) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ - 389, /* (141) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - 389, /* (142) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ - 389, /* (143) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - 389, /* (144) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ - 385, /* (145) integer_list ::= NK_INTEGER */ - 385, /* (146) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - 386, /* (147) variable_list ::= NK_VARIABLE */ - 386, /* (148) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - 387, /* (149) retention_list ::= retention */ - 387, /* (150) retention_list ::= retention_list NK_COMMA retention */ - 390, /* (151) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - 390, /* (152) retention ::= NK_MINUS NK_COLON NK_VARIABLE */ - 382, /* (153) speed_opt ::= */ - 382, /* (154) speed_opt ::= BWLIMIT NK_INTEGER */ - 383, /* (155) start_opt ::= */ - 383, /* (156) start_opt ::= START WITH NK_INTEGER */ - 383, /* (157) start_opt ::= START WITH NK_STRING */ - 383, /* (158) start_opt ::= START WITH TIMESTAMP NK_STRING */ - 384, /* (159) end_opt ::= */ - 384, /* (160) end_opt ::= END WITH NK_INTEGER */ - 384, /* (161) end_opt ::= END WITH NK_STRING */ - 384, /* (162) end_opt ::= END WITH TIMESTAMP NK_STRING */ - 356, /* (163) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - 356, /* (164) cmd ::= CREATE TABLE multi_create_clause */ - 356, /* (165) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - 356, /* (166) cmd ::= DROP TABLE multi_drop_clause */ - 356, /* (167) cmd ::= DROP STABLE exists_opt full_table_name */ - 356, /* (168) cmd ::= ALTER TABLE alter_table_clause */ - 356, /* (169) cmd ::= ALTER STABLE alter_table_clause */ - 398, /* (170) alter_table_clause ::= full_table_name alter_table_options */ - 398, /* (171) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - 398, /* (172) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - 398, /* (173) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - 398, /* (174) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - 398, /* (175) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - 398, /* (176) alter_table_clause ::= full_table_name DROP TAG column_name */ - 398, /* (177) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - 398, /* (178) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - 398, /* (179) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - 395, /* (180) multi_create_clause ::= create_subtable_clause */ - 395, /* (181) multi_create_clause ::= multi_create_clause create_subtable_clause */ - 403, /* (182) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ - 397, /* (183) multi_drop_clause ::= drop_table_clause */ - 397, /* (184) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - 406, /* (185) drop_table_clause ::= exists_opt full_table_name */ - 404, /* (186) specific_cols_opt ::= */ - 404, /* (187) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - 391, /* (188) full_table_name ::= table_name */ - 391, /* (189) full_table_name ::= db_name NK_DOT table_name */ - 392, /* (190) column_def_list ::= column_def */ - 392, /* (191) column_def_list ::= column_def_list NK_COMMA column_def */ - 408, /* (192) column_def ::= column_name type_name */ - 401, /* (193) type_name ::= BOOL */ - 401, /* (194) type_name ::= TINYINT */ - 401, /* (195) type_name ::= SMALLINT */ - 401, /* (196) type_name ::= INT */ - 401, /* (197) type_name ::= INTEGER */ - 401, /* (198) type_name ::= BIGINT */ - 401, /* (199) type_name ::= FLOAT */ - 401, /* (200) type_name ::= DOUBLE */ - 401, /* (201) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - 401, /* (202) type_name ::= TIMESTAMP */ - 401, /* (203) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - 401, /* (204) type_name ::= TINYINT UNSIGNED */ - 401, /* (205) type_name ::= SMALLINT UNSIGNED */ - 401, /* (206) type_name ::= INT UNSIGNED */ - 401, /* (207) type_name ::= BIGINT UNSIGNED */ - 401, /* (208) type_name ::= JSON */ - 401, /* (209) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - 401, /* (210) type_name ::= MEDIUMBLOB */ - 401, /* (211) type_name ::= BLOB */ - 401, /* (212) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - 401, /* (213) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - 401, /* (214) type_name ::= DECIMAL */ - 401, /* (215) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - 401, /* (216) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 393, /* (217) tags_def_opt ::= */ - 393, /* (218) tags_def_opt ::= tags_def */ - 396, /* (219) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - 394, /* (220) table_options ::= */ - 394, /* (221) table_options ::= table_options COMMENT NK_STRING */ - 394, /* (222) table_options ::= table_options MAX_DELAY duration_list */ - 394, /* (223) table_options ::= table_options WATERMARK duration_list */ - 394, /* (224) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - 394, /* (225) table_options ::= table_options TTL NK_INTEGER */ - 394, /* (226) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - 394, /* (227) table_options ::= table_options DELETE_MARK duration_list */ - 399, /* (228) alter_table_options ::= alter_table_option */ - 399, /* (229) alter_table_options ::= alter_table_options alter_table_option */ - 411, /* (230) alter_table_option ::= COMMENT NK_STRING */ - 411, /* (231) alter_table_option ::= TTL NK_INTEGER */ - 409, /* (232) duration_list ::= duration_literal */ - 409, /* (233) duration_list ::= duration_list NK_COMMA duration_literal */ - 410, /* (234) rollup_func_list ::= rollup_func_name */ - 410, /* (235) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - 413, /* (236) rollup_func_name ::= function_name */ - 413, /* (237) rollup_func_name ::= FIRST */ - 413, /* (238) rollup_func_name ::= LAST */ - 407, /* (239) col_name_list ::= col_name */ - 407, /* (240) col_name_list ::= col_name_list NK_COMMA col_name */ - 415, /* (241) col_name ::= column_name */ - 356, /* (242) cmd ::= SHOW DNODES */ - 356, /* (243) cmd ::= SHOW USERS */ - 356, /* (244) cmd ::= SHOW USER PRIVILEGES */ - 356, /* (245) cmd ::= SHOW db_kind_opt DATABASES */ - 356, /* (246) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ - 356, /* (247) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - 356, /* (248) cmd ::= SHOW db_name_cond_opt VGROUPS */ - 356, /* (249) cmd ::= SHOW MNODES */ - 356, /* (250) cmd ::= SHOW QNODES */ - 356, /* (251) cmd ::= SHOW FUNCTIONS */ - 356, /* (252) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - 356, /* (253) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - 356, /* (254) cmd ::= SHOW STREAMS */ - 356, /* (255) cmd ::= SHOW ACCOUNTS */ - 356, /* (256) cmd ::= SHOW APPS */ - 356, /* (257) cmd ::= SHOW CONNECTIONS */ - 356, /* (258) cmd ::= SHOW LICENCES */ - 356, /* (259) cmd ::= SHOW GRANTS */ - 356, /* (260) cmd ::= SHOW CREATE DATABASE db_name */ - 356, /* (261) cmd ::= SHOW CREATE TABLE full_table_name */ - 356, /* (262) cmd ::= SHOW CREATE STABLE full_table_name */ - 356, /* (263) cmd ::= SHOW QUERIES */ - 356, /* (264) cmd ::= SHOW SCORES */ - 356, /* (265) cmd ::= SHOW TOPICS */ - 356, /* (266) cmd ::= SHOW VARIABLES */ - 356, /* (267) cmd ::= SHOW CLUSTER VARIABLES */ - 356, /* (268) cmd ::= SHOW LOCAL VARIABLES */ - 356, /* (269) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - 356, /* (270) cmd ::= SHOW BNODES */ - 356, /* (271) cmd ::= SHOW SNODES */ - 356, /* (272) cmd ::= SHOW CLUSTER */ - 356, /* (273) cmd ::= SHOW TRANSACTIONS */ - 356, /* (274) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - 356, /* (275) cmd ::= SHOW CONSUMERS */ - 356, /* (276) cmd ::= SHOW SUBSCRIPTIONS */ - 356, /* (277) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - 356, /* (278) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - 356, /* (279) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - 356, /* (280) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - 356, /* (281) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - 356, /* (282) cmd ::= SHOW VNODES */ - 356, /* (283) cmd ::= SHOW db_name_cond_opt ALIVE */ - 356, /* (284) cmd ::= SHOW CLUSTER ALIVE */ - 356, /* (285) cmd ::= SHOW db_name_cond_opt VIEWS */ - 356, /* (286) cmd ::= SHOW CREATE VIEW full_table_name */ - 356, /* (287) cmd ::= SHOW COMPACTS */ - 356, /* (288) cmd ::= SHOW COMPACT NK_INTEGER */ - 417, /* (289) table_kind_db_name_cond_opt ::= */ - 417, /* (290) table_kind_db_name_cond_opt ::= table_kind */ - 417, /* (291) table_kind_db_name_cond_opt ::= db_name NK_DOT */ - 417, /* (292) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ - 423, /* (293) table_kind ::= NORMAL */ - 423, /* (294) table_kind ::= CHILD */ - 419, /* (295) db_name_cond_opt ::= */ - 419, /* (296) db_name_cond_opt ::= db_name NK_DOT */ - 418, /* (297) like_pattern_opt ::= */ - 418, /* (298) like_pattern_opt ::= LIKE NK_STRING */ - 420, /* (299) table_name_cond ::= table_name */ - 421, /* (300) from_db_opt ::= */ - 421, /* (301) from_db_opt ::= FROM db_name */ - 422, /* (302) tag_list_opt ::= */ - 422, /* (303) tag_list_opt ::= tag_item */ - 422, /* (304) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - 424, /* (305) tag_item ::= TBNAME */ - 424, /* (306) tag_item ::= QTAGS */ - 424, /* (307) tag_item ::= column_name */ - 424, /* (308) tag_item ::= column_name column_alias */ - 424, /* (309) tag_item ::= column_name AS column_alias */ - 416, /* (310) db_kind_opt ::= */ - 416, /* (311) db_kind_opt ::= USER */ - 416, /* (312) db_kind_opt ::= SYSTEM */ - 356, /* (313) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - 356, /* (314) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - 356, /* (315) cmd ::= DROP INDEX exists_opt full_index_name */ - 427, /* (316) full_index_name ::= index_name */ - 427, /* (317) full_index_name ::= db_name NK_DOT index_name */ - 426, /* (318) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - 426, /* (319) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ - 429, /* (320) func_list ::= func */ - 429, /* (321) func_list ::= func_list NK_COMMA func */ - 432, /* (322) func ::= sma_func_name NK_LP expression_list NK_RP */ - 433, /* (323) sma_func_name ::= function_name */ - 433, /* (324) sma_func_name ::= COUNT */ - 433, /* (325) sma_func_name ::= FIRST */ - 433, /* (326) sma_func_name ::= LAST */ - 433, /* (327) sma_func_name ::= LAST_ROW */ - 431, /* (328) sma_stream_opt ::= */ - 431, /* (329) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - 431, /* (330) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - 431, /* (331) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - 434, /* (332) with_meta ::= AS */ - 434, /* (333) with_meta ::= WITH META AS */ - 434, /* (334) with_meta ::= ONLY META AS */ - 356, /* (335) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - 356, /* (336) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - 356, /* (337) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - 356, /* (338) cmd ::= DROP TOPIC exists_opt topic_name */ - 356, /* (339) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - 356, /* (340) cmd ::= DESC full_table_name */ - 356, /* (341) cmd ::= DESCRIBE full_table_name */ - 356, /* (342) cmd ::= RESET QUERY CACHE */ - 356, /* (343) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - 356, /* (344) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 438, /* (345) analyze_opt ::= */ - 438, /* (346) analyze_opt ::= ANALYZE */ - 439, /* (347) explain_options ::= */ - 439, /* (348) explain_options ::= explain_options VERBOSE NK_BOOL */ - 439, /* (349) explain_options ::= explain_options RATIO NK_FLOAT */ - 356, /* (350) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - 356, /* (351) cmd ::= DROP FUNCTION exists_opt function_name */ - 442, /* (352) agg_func_opt ::= */ - 442, /* (353) agg_func_opt ::= AGGREGATE */ - 443, /* (354) bufsize_opt ::= */ - 443, /* (355) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 444, /* (356) language_opt ::= */ - 444, /* (357) language_opt ::= LANGUAGE NK_STRING */ - 441, /* (358) or_replace_opt ::= */ - 441, /* (359) or_replace_opt ::= OR REPLACE */ - 356, /* (360) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ - 356, /* (361) cmd ::= DROP VIEW exists_opt full_view_name */ - 445, /* (362) full_view_name ::= view_name */ - 445, /* (363) full_view_name ::= db_name NK_DOT view_name */ - 356, /* (364) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ - 356, /* (365) cmd ::= DROP STREAM exists_opt stream_name */ - 356, /* (366) cmd ::= PAUSE STREAM exists_opt stream_name */ - 356, /* (367) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 449, /* (368) col_list_opt ::= */ - 449, /* (369) col_list_opt ::= NK_LP col_name_list NK_RP */ - 450, /* (370) tag_def_or_ref_opt ::= */ - 450, /* (371) tag_def_or_ref_opt ::= tags_def */ - 450, /* (372) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - 448, /* (373) stream_options ::= */ - 448, /* (374) stream_options ::= stream_options TRIGGER AT_ONCE */ - 448, /* (375) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - 448, /* (376) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - 448, /* (377) stream_options ::= stream_options WATERMARK duration_literal */ - 448, /* (378) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - 448, /* (379) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - 448, /* (380) stream_options ::= stream_options DELETE_MARK duration_literal */ - 448, /* (381) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 451, /* (382) subtable_opt ::= */ - 451, /* (383) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 452, /* (384) ignore_opt ::= */ - 452, /* (385) ignore_opt ::= IGNORE UNTREATED */ - 356, /* (386) cmd ::= KILL CONNECTION NK_INTEGER */ - 356, /* (387) cmd ::= KILL QUERY NK_STRING */ - 356, /* (388) cmd ::= KILL TRANSACTION NK_INTEGER */ - 356, /* (389) cmd ::= KILL COMPACT NK_INTEGER */ - 356, /* (390) cmd ::= BALANCE VGROUP */ - 356, /* (391) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - 356, /* (392) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - 356, /* (393) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - 356, /* (394) cmd ::= SPLIT VGROUP NK_INTEGER */ - 454, /* (395) on_vgroup_id ::= */ - 454, /* (396) on_vgroup_id ::= ON NK_INTEGER */ - 455, /* (397) dnode_list ::= DNODE NK_INTEGER */ - 455, /* (398) dnode_list ::= dnode_list DNODE NK_INTEGER */ - 356, /* (399) cmd ::= DELETE FROM full_table_name where_clause_opt */ - 356, /* (400) cmd ::= query_or_subquery */ - 356, /* (401) cmd ::= insert_query */ - 440, /* (402) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - 440, /* (403) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - 359, /* (404) literal ::= NK_INTEGER */ - 359, /* (405) literal ::= NK_FLOAT */ - 359, /* (406) literal ::= NK_STRING */ - 359, /* (407) literal ::= NK_BOOL */ - 359, /* (408) literal ::= TIMESTAMP NK_STRING */ - 359, /* (409) literal ::= duration_literal */ - 359, /* (410) literal ::= NULL */ - 359, /* (411) literal ::= NK_QUESTION */ - 412, /* (412) duration_literal ::= NK_VARIABLE */ - 388, /* (413) signed ::= NK_INTEGER */ - 388, /* (414) signed ::= NK_PLUS NK_INTEGER */ - 388, /* (415) signed ::= NK_MINUS NK_INTEGER */ - 388, /* (416) signed ::= NK_FLOAT */ - 388, /* (417) signed ::= NK_PLUS NK_FLOAT */ - 388, /* (418) signed ::= NK_MINUS NK_FLOAT */ - 402, /* (419) signed_literal ::= signed */ - 402, /* (420) signed_literal ::= NK_STRING */ - 402, /* (421) signed_literal ::= NK_BOOL */ - 402, /* (422) signed_literal ::= TIMESTAMP NK_STRING */ - 402, /* (423) signed_literal ::= duration_literal */ - 402, /* (424) signed_literal ::= NULL */ - 402, /* (425) signed_literal ::= literal_func */ - 402, /* (426) signed_literal ::= NK_QUESTION */ - 457, /* (427) literal_list ::= signed_literal */ - 457, /* (428) literal_list ::= literal_list NK_COMMA signed_literal */ - 371, /* (429) db_name ::= NK_ID */ - 372, /* (430) table_name ::= NK_ID */ - 400, /* (431) column_name ::= NK_ID */ - 414, /* (432) function_name ::= NK_ID */ - 446, /* (433) view_name ::= NK_ID */ - 458, /* (434) table_alias ::= NK_ID */ - 425, /* (435) column_alias ::= NK_ID */ - 425, /* (436) column_alias ::= NK_ALIAS */ - 364, /* (437) user_name ::= NK_ID */ - 373, /* (438) topic_name ::= NK_ID */ - 447, /* (439) stream_name ::= NK_ID */ - 437, /* (440) cgroup_name ::= NK_ID */ - 428, /* (441) index_name ::= NK_ID */ - 459, /* (442) expr_or_subquery ::= expression */ - 453, /* (443) expression ::= literal */ - 453, /* (444) expression ::= pseudo_column */ - 453, /* (445) expression ::= column_reference */ - 453, /* (446) expression ::= function_expression */ - 453, /* (447) expression ::= case_when_expression */ - 453, /* (448) expression ::= NK_LP expression NK_RP */ - 453, /* (449) expression ::= NK_PLUS expr_or_subquery */ - 453, /* (450) expression ::= NK_MINUS expr_or_subquery */ - 453, /* (451) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - 453, /* (452) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - 453, /* (453) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - 453, /* (454) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - 453, /* (455) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - 453, /* (456) expression ::= column_reference NK_ARROW NK_STRING */ - 453, /* (457) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - 453, /* (458) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - 405, /* (459) expression_list ::= expr_or_subquery */ - 405, /* (460) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - 461, /* (461) column_reference ::= column_name */ - 461, /* (462) column_reference ::= table_name NK_DOT column_name */ - 461, /* (463) column_reference ::= NK_ALIAS */ - 461, /* (464) column_reference ::= table_name NK_DOT NK_ALIAS */ - 460, /* (465) pseudo_column ::= ROWTS */ - 460, /* (466) pseudo_column ::= TBNAME */ - 460, /* (467) pseudo_column ::= table_name NK_DOT TBNAME */ - 460, /* (468) pseudo_column ::= QSTART */ - 460, /* (469) pseudo_column ::= QEND */ - 460, /* (470) pseudo_column ::= QDURATION */ - 460, /* (471) pseudo_column ::= WSTART */ - 460, /* (472) pseudo_column ::= WEND */ - 460, /* (473) pseudo_column ::= WDURATION */ - 460, /* (474) pseudo_column ::= IROWTS */ - 460, /* (475) pseudo_column ::= ISFILLED */ - 460, /* (476) pseudo_column ::= QTAGS */ - 462, /* (477) function_expression ::= function_name NK_LP expression_list NK_RP */ - 462, /* (478) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - 462, /* (479) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - 462, /* (480) function_expression ::= literal_func */ - 456, /* (481) literal_func ::= noarg_func NK_LP NK_RP */ - 456, /* (482) literal_func ::= NOW */ - 466, /* (483) noarg_func ::= NOW */ - 466, /* (484) noarg_func ::= TODAY */ - 466, /* (485) noarg_func ::= TIMEZONE */ - 466, /* (486) noarg_func ::= DATABASE */ - 466, /* (487) noarg_func ::= CLIENT_VERSION */ - 466, /* (488) noarg_func ::= SERVER_VERSION */ - 466, /* (489) noarg_func ::= SERVER_STATUS */ - 466, /* (490) noarg_func ::= CURRENT_USER */ - 466, /* (491) noarg_func ::= USER */ - 464, /* (492) star_func ::= COUNT */ - 464, /* (493) star_func ::= FIRST */ - 464, /* (494) star_func ::= LAST */ - 464, /* (495) star_func ::= LAST_ROW */ - 465, /* (496) star_func_para_list ::= NK_STAR */ - 465, /* (497) star_func_para_list ::= other_para_list */ - 467, /* (498) other_para_list ::= star_func_para */ - 467, /* (499) other_para_list ::= other_para_list NK_COMMA star_func_para */ - 468, /* (500) star_func_para ::= expr_or_subquery */ - 468, /* (501) star_func_para ::= table_name NK_DOT NK_STAR */ - 463, /* (502) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - 463, /* (503) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - 469, /* (504) when_then_list ::= when_then_expr */ - 469, /* (505) when_then_list ::= when_then_list when_then_expr */ - 472, /* (506) when_then_expr ::= WHEN common_expression THEN common_expression */ - 470, /* (507) case_when_else_opt ::= */ - 470, /* (508) case_when_else_opt ::= ELSE common_expression */ - 473, /* (509) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - 473, /* (510) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - 473, /* (511) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - 473, /* (512) predicate ::= expr_or_subquery IS NULL */ - 473, /* (513) predicate ::= expr_or_subquery IS NOT NULL */ - 473, /* (514) predicate ::= expr_or_subquery in_op in_predicate_value */ - 474, /* (515) compare_op ::= NK_LT */ - 474, /* (516) compare_op ::= NK_GT */ - 474, /* (517) compare_op ::= NK_LE */ - 474, /* (518) compare_op ::= NK_GE */ - 474, /* (519) compare_op ::= NK_NE */ - 474, /* (520) compare_op ::= NK_EQ */ - 474, /* (521) compare_op ::= LIKE */ - 474, /* (522) compare_op ::= NOT LIKE */ - 474, /* (523) compare_op ::= MATCH */ - 474, /* (524) compare_op ::= NMATCH */ - 474, /* (525) compare_op ::= CONTAINS */ - 475, /* (526) in_op ::= IN */ - 475, /* (527) in_op ::= NOT IN */ - 476, /* (528) in_predicate_value ::= NK_LP literal_list NK_RP */ - 477, /* (529) boolean_value_expression ::= boolean_primary */ - 477, /* (530) boolean_value_expression ::= NOT boolean_primary */ - 477, /* (531) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - 477, /* (532) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - 478, /* (533) boolean_primary ::= predicate */ - 478, /* (534) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - 471, /* (535) common_expression ::= expr_or_subquery */ - 471, /* (536) common_expression ::= boolean_value_expression */ - 479, /* (537) from_clause_opt ::= */ - 479, /* (538) from_clause_opt ::= FROM table_reference_list */ - 480, /* (539) table_reference_list ::= table_reference */ - 480, /* (540) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - 481, /* (541) table_reference ::= table_primary */ - 481, /* (542) table_reference ::= joined_table */ - 482, /* (543) table_primary ::= table_name alias_opt */ - 482, /* (544) table_primary ::= db_name NK_DOT table_name alias_opt */ - 482, /* (545) table_primary ::= subquery alias_opt */ - 482, /* (546) table_primary ::= parenthesized_joined_table */ - 484, /* (547) alias_opt ::= */ - 484, /* (548) alias_opt ::= table_alias */ - 484, /* (549) alias_opt ::= AS table_alias */ - 486, /* (550) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - 486, /* (551) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - 483, /* (552) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ - 487, /* (553) join_type ::= */ - 487, /* (554) join_type ::= INNER */ - 487, /* (555) join_type ::= LEFT */ - 487, /* (556) join_type ::= RIGHT */ - 487, /* (557) join_type ::= FULL */ - 488, /* (558) join_subtype ::= */ - 488, /* (559) join_subtype ::= OUTER */ - 488, /* (560) join_subtype ::= SEMI */ - 488, /* (561) join_subtype ::= ANTI */ - 488, /* (562) join_subtype ::= ASOF */ - 488, /* (563) join_subtype ::= WINDOW */ - 489, /* (564) join_on_clause_opt ::= */ - 489, /* (565) join_on_clause_opt ::= ON search_condition */ - 490, /* (566) window_offset_clause_opt ::= */ - 490, /* (567) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ - 492, /* (568) window_offset_literal ::= NK_VARIABLE */ - 492, /* (569) window_offset_literal ::= NK_MINUS NK_VARIABLE */ - 491, /* (570) jlimit_clause_opt ::= */ - 491, /* (571) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - 493, /* (572) 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 */ - 494, /* (573) hint_list ::= */ - 494, /* (574) hint_list ::= NK_HINT */ - 496, /* (575) tag_mode_opt ::= */ - 496, /* (576) tag_mode_opt ::= TAGS */ - 495, /* (577) set_quantifier_opt ::= */ - 495, /* (578) set_quantifier_opt ::= DISTINCT */ - 495, /* (579) set_quantifier_opt ::= ALL */ - 497, /* (580) select_list ::= select_item */ - 497, /* (581) select_list ::= select_list NK_COMMA select_item */ - 505, /* (582) select_item ::= NK_STAR */ - 505, /* (583) select_item ::= common_expression */ - 505, /* (584) select_item ::= common_expression column_alias */ - 505, /* (585) select_item ::= common_expression AS column_alias */ - 505, /* (586) select_item ::= table_name NK_DOT NK_STAR */ - 436, /* (587) where_clause_opt ::= */ - 436, /* (588) where_clause_opt ::= WHERE search_condition */ - 498, /* (589) partition_by_clause_opt ::= */ - 498, /* (590) partition_by_clause_opt ::= PARTITION BY partition_list */ - 506, /* (591) partition_list ::= partition_item */ - 506, /* (592) partition_list ::= partition_list NK_COMMA partition_item */ - 507, /* (593) partition_item ::= expr_or_subquery */ - 507, /* (594) partition_item ::= expr_or_subquery column_alias */ - 507, /* (595) partition_item ::= expr_or_subquery AS column_alias */ - 502, /* (596) twindow_clause_opt ::= */ - 502, /* (597) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - 502, /* (598) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - 502, /* (599) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 502, /* (600) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 502, /* (601) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 430, /* (602) sliding_opt ::= */ - 430, /* (603) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - 508, /* (604) interval_sliding_duration_literal ::= NK_VARIABLE */ - 508, /* (605) interval_sliding_duration_literal ::= NK_STRING */ - 508, /* (606) interval_sliding_duration_literal ::= NK_INTEGER */ - 501, /* (607) fill_opt ::= */ - 501, /* (608) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - 501, /* (609) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - 501, /* (610) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - 509, /* (611) fill_mode ::= NONE */ - 509, /* (612) fill_mode ::= PREV */ - 509, /* (613) fill_mode ::= NULL */ - 509, /* (614) fill_mode ::= NULL_F */ - 509, /* (615) fill_mode ::= LINEAR */ - 509, /* (616) fill_mode ::= NEXT */ - 503, /* (617) group_by_clause_opt ::= */ - 503, /* (618) group_by_clause_opt ::= GROUP BY group_by_list */ - 510, /* (619) group_by_list ::= expr_or_subquery */ - 510, /* (620) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 504, /* (621) having_clause_opt ::= */ - 504, /* (622) having_clause_opt ::= HAVING search_condition */ - 499, /* (623) range_opt ::= */ - 499, /* (624) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - 499, /* (625) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 500, /* (626) every_opt ::= */ - 500, /* (627) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - 511, /* (628) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - 512, /* (629) query_simple ::= query_specification */ - 512, /* (630) query_simple ::= union_query_expression */ - 516, /* (631) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - 516, /* (632) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - 517, /* (633) query_simple_or_subquery ::= query_simple */ - 517, /* (634) query_simple_or_subquery ::= subquery */ - 435, /* (635) query_or_subquery ::= query_expression */ - 435, /* (636) query_or_subquery ::= subquery */ - 513, /* (637) order_by_clause_opt ::= */ - 513, /* (638) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 514, /* (639) slimit_clause_opt ::= */ - 514, /* (640) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - 514, /* (641) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - 514, /* (642) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 515, /* (643) limit_clause_opt ::= */ - 515, /* (644) limit_clause_opt ::= LIMIT NK_INTEGER */ - 515, /* (645) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - 515, /* (646) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 485, /* (647) subquery ::= NK_LP query_expression NK_RP */ - 485, /* (648) subquery ::= NK_LP subquery NK_RP */ - 374, /* (649) search_condition ::= common_expression */ - 518, /* (650) sort_specification_list ::= sort_specification */ - 518, /* (651) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - 519, /* (652) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 520, /* (653) ordering_specification_opt ::= */ - 520, /* (654) ordering_specification_opt ::= ASC */ - 520, /* (655) ordering_specification_opt ::= DESC */ - 521, /* (656) null_ordering_opt ::= */ - 521, /* (657) null_ordering_opt ::= NULLS FIRST */ - 521, /* (658) null_ordering_opt ::= NULLS LAST */ + 358, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + 358, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + 359, /* (2) account_options ::= */ + 359, /* (3) account_options ::= account_options PPS literal */ + 359, /* (4) account_options ::= account_options TSERIES literal */ + 359, /* (5) account_options ::= account_options STORAGE literal */ + 359, /* (6) account_options ::= account_options STREAMS literal */ + 359, /* (7) account_options ::= account_options QTIME literal */ + 359, /* (8) account_options ::= account_options DBS literal */ + 359, /* (9) account_options ::= account_options USERS literal */ + 359, /* (10) account_options ::= account_options CONNS literal */ + 359, /* (11) account_options ::= account_options STATE literal */ + 360, /* (12) alter_account_options ::= alter_account_option */ + 360, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + 362, /* (14) alter_account_option ::= PASS literal */ + 362, /* (15) alter_account_option ::= PPS literal */ + 362, /* (16) alter_account_option ::= TSERIES literal */ + 362, /* (17) alter_account_option ::= STORAGE literal */ + 362, /* (18) alter_account_option ::= STREAMS literal */ + 362, /* (19) alter_account_option ::= QTIME literal */ + 362, /* (20) alter_account_option ::= DBS literal */ + 362, /* (21) alter_account_option ::= USERS literal */ + 362, /* (22) alter_account_option ::= CONNS literal */ + 362, /* (23) alter_account_option ::= STATE literal */ + 363, /* (24) ip_range_list ::= NK_STRING */ + 363, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ + 364, /* (26) white_list ::= HOST ip_range_list */ + 365, /* (27) white_list_opt ::= */ + 365, /* (28) white_list_opt ::= white_list */ + 358, /* (29) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt white_list_opt */ + 358, /* (30) cmd ::= ALTER USER user_name PASS NK_STRING */ + 358, /* (31) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ + 358, /* (32) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ + 358, /* (33) cmd ::= ALTER USER user_name ADD white_list */ + 358, /* (34) cmd ::= ALTER USER user_name DROP white_list */ + 358, /* (35) cmd ::= DROP USER user_name */ + 367, /* (36) sysinfo_opt ::= */ + 367, /* (37) sysinfo_opt ::= SYSINFO NK_INTEGER */ + 358, /* (38) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ + 358, /* (39) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ + 368, /* (40) privileges ::= ALL */ + 368, /* (41) privileges ::= priv_type_list */ + 368, /* (42) privileges ::= SUBSCRIBE */ + 371, /* (43) priv_type_list ::= priv_type */ + 371, /* (44) priv_type_list ::= priv_type_list NK_COMMA priv_type */ + 372, /* (45) priv_type ::= READ */ + 372, /* (46) priv_type ::= WRITE */ + 372, /* (47) priv_type ::= ALTER */ + 369, /* (48) priv_level ::= NK_STAR NK_DOT NK_STAR */ + 369, /* (49) priv_level ::= db_name NK_DOT NK_STAR */ + 369, /* (50) priv_level ::= db_name NK_DOT table_name */ + 369, /* (51) priv_level ::= topic_name */ + 370, /* (52) with_opt ::= */ + 370, /* (53) with_opt ::= WITH search_condition */ + 358, /* (54) cmd ::= CREATE DNODE dnode_endpoint */ + 358, /* (55) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ + 358, /* (56) cmd ::= DROP DNODE NK_INTEGER force_opt */ + 358, /* (57) cmd ::= DROP DNODE dnode_endpoint force_opt */ + 358, /* (58) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ + 358, /* (59) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ + 358, /* (60) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + 358, /* (61) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + 358, /* (62) cmd ::= ALTER ALL DNODES NK_STRING */ + 358, /* (63) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + 358, /* (64) cmd ::= RESTORE DNODE NK_INTEGER */ + 377, /* (65) dnode_endpoint ::= NK_STRING */ + 377, /* (66) dnode_endpoint ::= NK_ID */ + 377, /* (67) dnode_endpoint ::= NK_IPTOKEN */ + 378, /* (68) force_opt ::= */ + 378, /* (69) force_opt ::= FORCE */ + 379, /* (70) unsafe_opt ::= UNSAFE */ + 358, /* (71) cmd ::= ALTER CLUSTER NK_STRING */ + 358, /* (72) cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ + 358, /* (73) cmd ::= ALTER LOCAL NK_STRING */ + 358, /* (74) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + 358, /* (75) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + 358, /* (76) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + 358, /* (77) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ + 358, /* (78) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + 358, /* (79) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + 358, /* (80) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + 358, /* (81) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + 358, /* (82) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + 358, /* (83) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + 358, /* (84) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ + 358, /* (85) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ + 358, /* (86) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + 358, /* (87) cmd ::= DROP DATABASE exists_opt db_name */ + 358, /* (88) cmd ::= USE db_name */ + 358, /* (89) cmd ::= ALTER DATABASE db_name alter_db_options */ + 358, /* (90) cmd ::= FLUSH DATABASE db_name */ + 358, /* (91) cmd ::= TRIM DATABASE db_name speed_opt */ + 358, /* (92) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ + 380, /* (93) not_exists_opt ::= IF NOT EXISTS */ + 380, /* (94) not_exists_opt ::= */ + 382, /* (95) exists_opt ::= IF EXISTS */ + 382, /* (96) exists_opt ::= */ + 381, /* (97) db_options ::= */ + 381, /* (98) db_options ::= db_options BUFFER NK_INTEGER */ + 381, /* (99) db_options ::= db_options CACHEMODEL NK_STRING */ + 381, /* (100) db_options ::= db_options CACHESIZE NK_INTEGER */ + 381, /* (101) db_options ::= db_options COMP NK_INTEGER */ + 381, /* (102) db_options ::= db_options DURATION NK_INTEGER */ + 381, /* (103) db_options ::= db_options DURATION NK_VARIABLE */ + 381, /* (104) db_options ::= db_options MAXROWS NK_INTEGER */ + 381, /* (105) db_options ::= db_options MINROWS NK_INTEGER */ + 381, /* (106) db_options ::= db_options KEEP integer_list */ + 381, /* (107) db_options ::= db_options KEEP variable_list */ + 381, /* (108) db_options ::= db_options PAGES NK_INTEGER */ + 381, /* (109) db_options ::= db_options PAGESIZE NK_INTEGER */ + 381, /* (110) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ + 381, /* (111) db_options ::= db_options PRECISION NK_STRING */ + 381, /* (112) db_options ::= db_options REPLICA NK_INTEGER */ + 381, /* (113) db_options ::= db_options VGROUPS NK_INTEGER */ + 381, /* (114) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + 381, /* (115) db_options ::= db_options RETENTIONS retention_list */ + 381, /* (116) db_options ::= db_options SCHEMALESS NK_INTEGER */ + 381, /* (117) db_options ::= db_options WAL_LEVEL NK_INTEGER */ + 381, /* (118) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ + 381, /* (119) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ + 381, /* (120) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + 381, /* (121) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ + 381, /* (122) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + 381, /* (123) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ + 381, /* (124) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ + 381, /* (125) db_options ::= db_options STT_TRIGGER NK_INTEGER */ + 381, /* (126) db_options ::= db_options TABLE_PREFIX signed */ + 381, /* (127) db_options ::= db_options TABLE_SUFFIX signed */ + 381, /* (128) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ + 383, /* (129) alter_db_options ::= alter_db_option */ + 383, /* (130) alter_db_options ::= alter_db_options alter_db_option */ + 391, /* (131) alter_db_option ::= BUFFER NK_INTEGER */ + 391, /* (132) alter_db_option ::= CACHEMODEL NK_STRING */ + 391, /* (133) alter_db_option ::= CACHESIZE NK_INTEGER */ + 391, /* (134) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ + 391, /* (135) alter_db_option ::= KEEP integer_list */ + 391, /* (136) alter_db_option ::= KEEP variable_list */ + 391, /* (137) alter_db_option ::= PAGES NK_INTEGER */ + 391, /* (138) alter_db_option ::= REPLICA NK_INTEGER */ + 391, /* (139) alter_db_option ::= WAL_LEVEL NK_INTEGER */ + 391, /* (140) alter_db_option ::= STT_TRIGGER NK_INTEGER */ + 391, /* (141) alter_db_option ::= MINROWS NK_INTEGER */ + 391, /* (142) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ + 391, /* (143) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + 391, /* (144) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ + 391, /* (145) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + 391, /* (146) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ + 387, /* (147) integer_list ::= NK_INTEGER */ + 387, /* (148) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + 388, /* (149) variable_list ::= NK_VARIABLE */ + 388, /* (150) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + 389, /* (151) retention_list ::= retention */ + 389, /* (152) retention_list ::= retention_list NK_COMMA retention */ + 392, /* (153) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + 392, /* (154) retention ::= NK_MINUS NK_COLON NK_VARIABLE */ + 384, /* (155) speed_opt ::= */ + 384, /* (156) speed_opt ::= BWLIMIT NK_INTEGER */ + 385, /* (157) start_opt ::= */ + 385, /* (158) start_opt ::= START WITH NK_INTEGER */ + 385, /* (159) start_opt ::= START WITH NK_STRING */ + 385, /* (160) start_opt ::= START WITH TIMESTAMP NK_STRING */ + 386, /* (161) end_opt ::= */ + 386, /* (162) end_opt ::= END WITH NK_INTEGER */ + 386, /* (163) end_opt ::= END WITH NK_STRING */ + 386, /* (164) end_opt ::= END WITH TIMESTAMP NK_STRING */ + 358, /* (165) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + 358, /* (166) cmd ::= CREATE TABLE multi_create_clause */ + 358, /* (167) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + 358, /* (168) cmd ::= DROP TABLE multi_drop_clause */ + 358, /* (169) cmd ::= DROP STABLE exists_opt full_table_name */ + 358, /* (170) cmd ::= ALTER TABLE alter_table_clause */ + 358, /* (171) cmd ::= ALTER STABLE alter_table_clause */ + 400, /* (172) alter_table_clause ::= full_table_name alter_table_options */ + 400, /* (173) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + 400, /* (174) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + 400, /* (175) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + 400, /* (176) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + 400, /* (177) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + 400, /* (178) alter_table_clause ::= full_table_name DROP TAG column_name */ + 400, /* (179) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + 400, /* (180) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + 400, /* (181) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + 397, /* (182) multi_create_clause ::= create_subtable_clause */ + 397, /* (183) multi_create_clause ::= multi_create_clause create_subtable_clause */ + 405, /* (184) 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 */ + 399, /* (185) multi_drop_clause ::= drop_table_clause */ + 399, /* (186) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ + 408, /* (187) drop_table_clause ::= exists_opt full_table_name */ + 406, /* (188) specific_cols_opt ::= */ + 406, /* (189) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + 393, /* (190) full_table_name ::= table_name */ + 393, /* (191) full_table_name ::= db_name NK_DOT table_name */ + 394, /* (192) column_def_list ::= column_def */ + 394, /* (193) column_def_list ::= column_def_list NK_COMMA column_def */ + 410, /* (194) column_def ::= column_name type_name */ + 403, /* (195) type_name ::= BOOL */ + 403, /* (196) type_name ::= TINYINT */ + 403, /* (197) type_name ::= SMALLINT */ + 403, /* (198) type_name ::= INT */ + 403, /* (199) type_name ::= INTEGER */ + 403, /* (200) type_name ::= BIGINT */ + 403, /* (201) type_name ::= FLOAT */ + 403, /* (202) type_name ::= DOUBLE */ + 403, /* (203) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + 403, /* (204) type_name ::= TIMESTAMP */ + 403, /* (205) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + 403, /* (206) type_name ::= TINYINT UNSIGNED */ + 403, /* (207) type_name ::= SMALLINT UNSIGNED */ + 403, /* (208) type_name ::= INT UNSIGNED */ + 403, /* (209) type_name ::= BIGINT UNSIGNED */ + 403, /* (210) type_name ::= JSON */ + 403, /* (211) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + 403, /* (212) type_name ::= MEDIUMBLOB */ + 403, /* (213) type_name ::= BLOB */ + 403, /* (214) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + 403, /* (215) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + 403, /* (216) type_name ::= DECIMAL */ + 403, /* (217) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + 403, /* (218) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 395, /* (219) tags_def_opt ::= */ + 395, /* (220) tags_def_opt ::= tags_def */ + 398, /* (221) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + 396, /* (222) table_options ::= */ + 396, /* (223) table_options ::= table_options COMMENT NK_STRING */ + 396, /* (224) table_options ::= table_options MAX_DELAY duration_list */ + 396, /* (225) table_options ::= table_options WATERMARK duration_list */ + 396, /* (226) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + 396, /* (227) table_options ::= table_options TTL NK_INTEGER */ + 396, /* (228) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + 396, /* (229) table_options ::= table_options DELETE_MARK duration_list */ + 401, /* (230) alter_table_options ::= alter_table_option */ + 401, /* (231) alter_table_options ::= alter_table_options alter_table_option */ + 413, /* (232) alter_table_option ::= COMMENT NK_STRING */ + 413, /* (233) alter_table_option ::= TTL NK_INTEGER */ + 411, /* (234) duration_list ::= duration_literal */ + 411, /* (235) duration_list ::= duration_list NK_COMMA duration_literal */ + 412, /* (236) rollup_func_list ::= rollup_func_name */ + 412, /* (237) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + 415, /* (238) rollup_func_name ::= function_name */ + 415, /* (239) rollup_func_name ::= FIRST */ + 415, /* (240) rollup_func_name ::= LAST */ + 409, /* (241) col_name_list ::= col_name */ + 409, /* (242) col_name_list ::= col_name_list NK_COMMA col_name */ + 417, /* (243) col_name ::= column_name */ + 358, /* (244) cmd ::= SHOW DNODES */ + 358, /* (245) cmd ::= SHOW USERS */ + 358, /* (246) cmd ::= SHOW USER PRIVILEGES */ + 358, /* (247) cmd ::= SHOW db_kind_opt DATABASES */ + 358, /* (248) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ + 358, /* (249) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + 358, /* (250) cmd ::= SHOW db_name_cond_opt VGROUPS */ + 358, /* (251) cmd ::= SHOW MNODES */ + 358, /* (252) cmd ::= SHOW QNODES */ + 358, /* (253) cmd ::= SHOW FUNCTIONS */ + 358, /* (254) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + 358, /* (255) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + 358, /* (256) cmd ::= SHOW STREAMS */ + 358, /* (257) cmd ::= SHOW ACCOUNTS */ + 358, /* (258) cmd ::= SHOW APPS */ + 358, /* (259) cmd ::= SHOW CONNECTIONS */ + 358, /* (260) cmd ::= SHOW LICENCES */ + 358, /* (261) cmd ::= SHOW GRANTS */ + 358, /* (262) cmd ::= SHOW GRANTS FULL */ + 358, /* (263) cmd ::= SHOW GRANTS LOGS */ + 358, /* (264) cmd ::= SHOW CLUSTER MACHINES */ + 358, /* (265) cmd ::= SHOW CREATE DATABASE db_name */ + 358, /* (266) cmd ::= SHOW CREATE TABLE full_table_name */ + 358, /* (267) cmd ::= SHOW CREATE STABLE full_table_name */ + 358, /* (268) cmd ::= SHOW QUERIES */ + 358, /* (269) cmd ::= SHOW SCORES */ + 358, /* (270) cmd ::= SHOW TOPICS */ + 358, /* (271) cmd ::= SHOW VARIABLES */ + 358, /* (272) cmd ::= SHOW CLUSTER VARIABLES */ + 358, /* (273) cmd ::= SHOW LOCAL VARIABLES */ + 358, /* (274) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + 358, /* (275) cmd ::= SHOW BNODES */ + 358, /* (276) cmd ::= SHOW SNODES */ + 358, /* (277) cmd ::= SHOW CLUSTER */ + 358, /* (278) cmd ::= SHOW TRANSACTIONS */ + 358, /* (279) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + 358, /* (280) cmd ::= SHOW CONSUMERS */ + 358, /* (281) cmd ::= SHOW SUBSCRIPTIONS */ + 358, /* (282) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + 358, /* (283) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + 358, /* (284) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + 358, /* (285) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + 358, /* (286) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + 358, /* (287) cmd ::= SHOW VNODES */ + 358, /* (288) cmd ::= SHOW db_name_cond_opt ALIVE */ + 358, /* (289) cmd ::= SHOW CLUSTER ALIVE */ + 358, /* (290) cmd ::= SHOW db_name_cond_opt VIEWS */ + 358, /* (291) cmd ::= SHOW CREATE VIEW full_table_name */ + 358, /* (292) cmd ::= SHOW COMPACTS */ + 358, /* (293) cmd ::= SHOW COMPACT NK_INTEGER */ + 419, /* (294) table_kind_db_name_cond_opt ::= */ + 419, /* (295) table_kind_db_name_cond_opt ::= table_kind */ + 419, /* (296) table_kind_db_name_cond_opt ::= db_name NK_DOT */ + 419, /* (297) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ + 425, /* (298) table_kind ::= NORMAL */ + 425, /* (299) table_kind ::= CHILD */ + 421, /* (300) db_name_cond_opt ::= */ + 421, /* (301) db_name_cond_opt ::= db_name NK_DOT */ + 420, /* (302) like_pattern_opt ::= */ + 420, /* (303) like_pattern_opt ::= LIKE NK_STRING */ + 422, /* (304) table_name_cond ::= table_name */ + 423, /* (305) from_db_opt ::= */ + 423, /* (306) from_db_opt ::= FROM db_name */ + 424, /* (307) tag_list_opt ::= */ + 424, /* (308) tag_list_opt ::= tag_item */ + 424, /* (309) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + 426, /* (310) tag_item ::= TBNAME */ + 426, /* (311) tag_item ::= QTAGS */ + 426, /* (312) tag_item ::= column_name */ + 426, /* (313) tag_item ::= column_name column_alias */ + 426, /* (314) tag_item ::= column_name AS column_alias */ + 418, /* (315) db_kind_opt ::= */ + 418, /* (316) db_kind_opt ::= USER */ + 418, /* (317) db_kind_opt ::= SYSTEM */ + 358, /* (318) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ + 358, /* (319) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ + 358, /* (320) cmd ::= DROP INDEX exists_opt full_index_name */ + 429, /* (321) full_index_name ::= index_name */ + 429, /* (322) full_index_name ::= db_name NK_DOT index_name */ + 428, /* (323) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + 428, /* (324) 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 */ + 431, /* (325) func_list ::= func */ + 431, /* (326) func_list ::= func_list NK_COMMA func */ + 434, /* (327) func ::= sma_func_name NK_LP expression_list NK_RP */ + 435, /* (328) sma_func_name ::= function_name */ + 435, /* (329) sma_func_name ::= COUNT */ + 435, /* (330) sma_func_name ::= FIRST */ + 435, /* (331) sma_func_name ::= LAST */ + 435, /* (332) sma_func_name ::= LAST_ROW */ + 433, /* (333) sma_stream_opt ::= */ + 433, /* (334) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + 433, /* (335) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + 433, /* (336) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + 436, /* (337) with_meta ::= AS */ + 436, /* (338) with_meta ::= WITH META AS */ + 436, /* (339) with_meta ::= ONLY META AS */ + 358, /* (340) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + 358, /* (341) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + 358, /* (342) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + 358, /* (343) cmd ::= DROP TOPIC exists_opt topic_name */ + 358, /* (344) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + 358, /* (345) cmd ::= DESC full_table_name */ + 358, /* (346) cmd ::= DESCRIBE full_table_name */ + 358, /* (347) cmd ::= RESET QUERY CACHE */ + 358, /* (348) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + 358, /* (349) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 440, /* (350) analyze_opt ::= */ + 440, /* (351) analyze_opt ::= ANALYZE */ + 441, /* (352) explain_options ::= */ + 441, /* (353) explain_options ::= explain_options VERBOSE NK_BOOL */ + 441, /* (354) explain_options ::= explain_options RATIO NK_FLOAT */ + 358, /* (355) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + 358, /* (356) cmd ::= DROP FUNCTION exists_opt function_name */ + 444, /* (357) agg_func_opt ::= */ + 444, /* (358) agg_func_opt ::= AGGREGATE */ + 445, /* (359) bufsize_opt ::= */ + 445, /* (360) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 446, /* (361) language_opt ::= */ + 446, /* (362) language_opt ::= LANGUAGE NK_STRING */ + 443, /* (363) or_replace_opt ::= */ + 443, /* (364) or_replace_opt ::= OR REPLACE */ + 358, /* (365) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ + 358, /* (366) cmd ::= DROP VIEW exists_opt full_view_name */ + 447, /* (367) full_view_name ::= view_name */ + 447, /* (368) full_view_name ::= db_name NK_DOT view_name */ + 358, /* (369) 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 */ + 358, /* (370) cmd ::= DROP STREAM exists_opt stream_name */ + 358, /* (371) cmd ::= PAUSE STREAM exists_opt stream_name */ + 358, /* (372) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 451, /* (373) col_list_opt ::= */ + 451, /* (374) col_list_opt ::= NK_LP col_name_list NK_RP */ + 452, /* (375) tag_def_or_ref_opt ::= */ + 452, /* (376) tag_def_or_ref_opt ::= tags_def */ + 452, /* (377) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ + 450, /* (378) stream_options ::= */ + 450, /* (379) stream_options ::= stream_options TRIGGER AT_ONCE */ + 450, /* (380) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + 450, /* (381) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + 450, /* (382) stream_options ::= stream_options WATERMARK duration_literal */ + 450, /* (383) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + 450, /* (384) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + 450, /* (385) stream_options ::= stream_options DELETE_MARK duration_literal */ + 450, /* (386) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 453, /* (387) subtable_opt ::= */ + 453, /* (388) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 454, /* (389) ignore_opt ::= */ + 454, /* (390) ignore_opt ::= IGNORE UNTREATED */ + 358, /* (391) cmd ::= KILL CONNECTION NK_INTEGER */ + 358, /* (392) cmd ::= KILL QUERY NK_STRING */ + 358, /* (393) cmd ::= KILL TRANSACTION NK_INTEGER */ + 358, /* (394) cmd ::= KILL COMPACT NK_INTEGER */ + 358, /* (395) cmd ::= BALANCE VGROUP */ + 358, /* (396) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ + 358, /* (397) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + 358, /* (398) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + 358, /* (399) cmd ::= SPLIT VGROUP NK_INTEGER */ + 456, /* (400) on_vgroup_id ::= */ + 456, /* (401) on_vgroup_id ::= ON NK_INTEGER */ + 457, /* (402) dnode_list ::= DNODE NK_INTEGER */ + 457, /* (403) dnode_list ::= dnode_list DNODE NK_INTEGER */ + 358, /* (404) cmd ::= DELETE FROM full_table_name where_clause_opt */ + 358, /* (405) cmd ::= query_or_subquery */ + 358, /* (406) cmd ::= insert_query */ + 442, /* (407) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + 442, /* (408) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + 361, /* (409) literal ::= NK_INTEGER */ + 361, /* (410) literal ::= NK_FLOAT */ + 361, /* (411) literal ::= NK_STRING */ + 361, /* (412) literal ::= NK_BOOL */ + 361, /* (413) literal ::= TIMESTAMP NK_STRING */ + 361, /* (414) literal ::= duration_literal */ + 361, /* (415) literal ::= NULL */ + 361, /* (416) literal ::= NK_QUESTION */ + 414, /* (417) duration_literal ::= NK_VARIABLE */ + 390, /* (418) signed ::= NK_INTEGER */ + 390, /* (419) signed ::= NK_PLUS NK_INTEGER */ + 390, /* (420) signed ::= NK_MINUS NK_INTEGER */ + 390, /* (421) signed ::= NK_FLOAT */ + 390, /* (422) signed ::= NK_PLUS NK_FLOAT */ + 390, /* (423) signed ::= NK_MINUS NK_FLOAT */ + 404, /* (424) signed_literal ::= signed */ + 404, /* (425) signed_literal ::= NK_STRING */ + 404, /* (426) signed_literal ::= NK_BOOL */ + 404, /* (427) signed_literal ::= TIMESTAMP NK_STRING */ + 404, /* (428) signed_literal ::= duration_literal */ + 404, /* (429) signed_literal ::= NULL */ + 404, /* (430) signed_literal ::= literal_func */ + 404, /* (431) signed_literal ::= NK_QUESTION */ + 459, /* (432) literal_list ::= signed_literal */ + 459, /* (433) literal_list ::= literal_list NK_COMMA signed_literal */ + 373, /* (434) db_name ::= NK_ID */ + 374, /* (435) table_name ::= NK_ID */ + 402, /* (436) column_name ::= NK_ID */ + 416, /* (437) function_name ::= NK_ID */ + 448, /* (438) view_name ::= NK_ID */ + 460, /* (439) table_alias ::= NK_ID */ + 427, /* (440) column_alias ::= NK_ID */ + 427, /* (441) column_alias ::= NK_ALIAS */ + 366, /* (442) user_name ::= NK_ID */ + 375, /* (443) topic_name ::= NK_ID */ + 449, /* (444) stream_name ::= NK_ID */ + 439, /* (445) cgroup_name ::= NK_ID */ + 430, /* (446) index_name ::= NK_ID */ + 461, /* (447) expr_or_subquery ::= expression */ + 455, /* (448) expression ::= literal */ + 455, /* (449) expression ::= pseudo_column */ + 455, /* (450) expression ::= column_reference */ + 455, /* (451) expression ::= function_expression */ + 455, /* (452) expression ::= case_when_expression */ + 455, /* (453) expression ::= NK_LP expression NK_RP */ + 455, /* (454) expression ::= NK_PLUS expr_or_subquery */ + 455, /* (455) expression ::= NK_MINUS expr_or_subquery */ + 455, /* (456) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + 455, /* (457) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + 455, /* (458) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + 455, /* (459) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + 455, /* (460) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + 455, /* (461) expression ::= column_reference NK_ARROW NK_STRING */ + 455, /* (462) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + 455, /* (463) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + 407, /* (464) expression_list ::= expr_or_subquery */ + 407, /* (465) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + 463, /* (466) column_reference ::= column_name */ + 463, /* (467) column_reference ::= table_name NK_DOT column_name */ + 463, /* (468) column_reference ::= NK_ALIAS */ + 463, /* (469) column_reference ::= table_name NK_DOT NK_ALIAS */ + 462, /* (470) pseudo_column ::= ROWTS */ + 462, /* (471) pseudo_column ::= TBNAME */ + 462, /* (472) pseudo_column ::= table_name NK_DOT TBNAME */ + 462, /* (473) pseudo_column ::= QSTART */ + 462, /* (474) pseudo_column ::= QEND */ + 462, /* (475) pseudo_column ::= QDURATION */ + 462, /* (476) pseudo_column ::= WSTART */ + 462, /* (477) pseudo_column ::= WEND */ + 462, /* (478) pseudo_column ::= WDURATION */ + 462, /* (479) pseudo_column ::= IROWTS */ + 462, /* (480) pseudo_column ::= ISFILLED */ + 462, /* (481) pseudo_column ::= QTAGS */ + 464, /* (482) function_expression ::= function_name NK_LP expression_list NK_RP */ + 464, /* (483) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + 464, /* (484) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + 464, /* (485) function_expression ::= literal_func */ + 458, /* (486) literal_func ::= noarg_func NK_LP NK_RP */ + 458, /* (487) literal_func ::= NOW */ + 468, /* (488) noarg_func ::= NOW */ + 468, /* (489) noarg_func ::= TODAY */ + 468, /* (490) noarg_func ::= TIMEZONE */ + 468, /* (491) noarg_func ::= DATABASE */ + 468, /* (492) noarg_func ::= CLIENT_VERSION */ + 468, /* (493) noarg_func ::= SERVER_VERSION */ + 468, /* (494) noarg_func ::= SERVER_STATUS */ + 468, /* (495) noarg_func ::= CURRENT_USER */ + 468, /* (496) noarg_func ::= USER */ + 466, /* (497) star_func ::= COUNT */ + 466, /* (498) star_func ::= FIRST */ + 466, /* (499) star_func ::= LAST */ + 466, /* (500) star_func ::= LAST_ROW */ + 467, /* (501) star_func_para_list ::= NK_STAR */ + 467, /* (502) star_func_para_list ::= other_para_list */ + 469, /* (503) other_para_list ::= star_func_para */ + 469, /* (504) other_para_list ::= other_para_list NK_COMMA star_func_para */ + 470, /* (505) star_func_para ::= expr_or_subquery */ + 470, /* (506) star_func_para ::= table_name NK_DOT NK_STAR */ + 465, /* (507) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + 465, /* (508) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + 471, /* (509) when_then_list ::= when_then_expr */ + 471, /* (510) when_then_list ::= when_then_list when_then_expr */ + 474, /* (511) when_then_expr ::= WHEN common_expression THEN common_expression */ + 472, /* (512) case_when_else_opt ::= */ + 472, /* (513) case_when_else_opt ::= ELSE common_expression */ + 475, /* (514) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + 475, /* (515) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + 475, /* (516) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + 475, /* (517) predicate ::= expr_or_subquery IS NULL */ + 475, /* (518) predicate ::= expr_or_subquery IS NOT NULL */ + 475, /* (519) predicate ::= expr_or_subquery in_op in_predicate_value */ + 476, /* (520) compare_op ::= NK_LT */ + 476, /* (521) compare_op ::= NK_GT */ + 476, /* (522) compare_op ::= NK_LE */ + 476, /* (523) compare_op ::= NK_GE */ + 476, /* (524) compare_op ::= NK_NE */ + 476, /* (525) compare_op ::= NK_EQ */ + 476, /* (526) compare_op ::= LIKE */ + 476, /* (527) compare_op ::= NOT LIKE */ + 476, /* (528) compare_op ::= MATCH */ + 476, /* (529) compare_op ::= NMATCH */ + 476, /* (530) compare_op ::= CONTAINS */ + 477, /* (531) in_op ::= IN */ + 477, /* (532) in_op ::= NOT IN */ + 478, /* (533) in_predicate_value ::= NK_LP literal_list NK_RP */ + 479, /* (534) boolean_value_expression ::= boolean_primary */ + 479, /* (535) boolean_value_expression ::= NOT boolean_primary */ + 479, /* (536) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + 479, /* (537) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + 480, /* (538) boolean_primary ::= predicate */ + 480, /* (539) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + 473, /* (540) common_expression ::= expr_or_subquery */ + 473, /* (541) common_expression ::= boolean_value_expression */ + 481, /* (542) from_clause_opt ::= */ + 481, /* (543) from_clause_opt ::= FROM table_reference_list */ + 482, /* (544) table_reference_list ::= table_reference */ + 482, /* (545) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + 483, /* (546) table_reference ::= table_primary */ + 483, /* (547) table_reference ::= joined_table */ + 484, /* (548) table_primary ::= table_name alias_opt */ + 484, /* (549) table_primary ::= db_name NK_DOT table_name alias_opt */ + 484, /* (550) table_primary ::= subquery alias_opt */ + 484, /* (551) table_primary ::= parenthesized_joined_table */ + 486, /* (552) alias_opt ::= */ + 486, /* (553) alias_opt ::= table_alias */ + 486, /* (554) alias_opt ::= AS table_alias */ + 488, /* (555) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + 488, /* (556) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + 485, /* (557) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ + 489, /* (558) join_type ::= */ + 489, /* (559) join_type ::= INNER */ + 489, /* (560) join_type ::= LEFT */ + 489, /* (561) join_type ::= RIGHT */ + 489, /* (562) join_type ::= FULL */ + 490, /* (563) join_subtype ::= */ + 490, /* (564) join_subtype ::= OUTER */ + 490, /* (565) join_subtype ::= SEMI */ + 490, /* (566) join_subtype ::= ANTI */ + 490, /* (567) join_subtype ::= ASOF */ + 490, /* (568) join_subtype ::= WINDOW */ + 491, /* (569) join_on_clause_opt ::= */ + 491, /* (570) join_on_clause_opt ::= ON search_condition */ + 492, /* (571) window_offset_clause_opt ::= */ + 492, /* (572) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ + 494, /* (573) window_offset_literal ::= NK_VARIABLE */ + 494, /* (574) window_offset_literal ::= NK_MINUS NK_VARIABLE */ + 493, /* (575) jlimit_clause_opt ::= */ + 493, /* (576) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ + 495, /* (577) 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 */ + 496, /* (578) hint_list ::= */ + 496, /* (579) hint_list ::= NK_HINT */ + 498, /* (580) tag_mode_opt ::= */ + 498, /* (581) tag_mode_opt ::= TAGS */ + 497, /* (582) set_quantifier_opt ::= */ + 497, /* (583) set_quantifier_opt ::= DISTINCT */ + 497, /* (584) set_quantifier_opt ::= ALL */ + 499, /* (585) select_list ::= select_item */ + 499, /* (586) select_list ::= select_list NK_COMMA select_item */ + 507, /* (587) select_item ::= NK_STAR */ + 507, /* (588) select_item ::= common_expression */ + 507, /* (589) select_item ::= common_expression column_alias */ + 507, /* (590) select_item ::= common_expression AS column_alias */ + 507, /* (591) select_item ::= table_name NK_DOT NK_STAR */ + 438, /* (592) where_clause_opt ::= */ + 438, /* (593) where_clause_opt ::= WHERE search_condition */ + 500, /* (594) partition_by_clause_opt ::= */ + 500, /* (595) partition_by_clause_opt ::= PARTITION BY partition_list */ + 508, /* (596) partition_list ::= partition_item */ + 508, /* (597) partition_list ::= partition_list NK_COMMA partition_item */ + 509, /* (598) partition_item ::= expr_or_subquery */ + 509, /* (599) partition_item ::= expr_or_subquery column_alias */ + 509, /* (600) partition_item ::= expr_or_subquery AS column_alias */ + 504, /* (601) twindow_clause_opt ::= */ + 504, /* (602) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ + 504, /* (603) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + 504, /* (604) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + 504, /* (605) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + 504, /* (606) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 432, /* (607) sliding_opt ::= */ + 432, /* (608) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ + 510, /* (609) interval_sliding_duration_literal ::= NK_VARIABLE */ + 510, /* (610) interval_sliding_duration_literal ::= NK_STRING */ + 510, /* (611) interval_sliding_duration_literal ::= NK_INTEGER */ + 503, /* (612) fill_opt ::= */ + 503, /* (613) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + 503, /* (614) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + 503, /* (615) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + 511, /* (616) fill_mode ::= NONE */ + 511, /* (617) fill_mode ::= PREV */ + 511, /* (618) fill_mode ::= NULL */ + 511, /* (619) fill_mode ::= NULL_F */ + 511, /* (620) fill_mode ::= LINEAR */ + 511, /* (621) fill_mode ::= NEXT */ + 505, /* (622) group_by_clause_opt ::= */ + 505, /* (623) group_by_clause_opt ::= GROUP BY group_by_list */ + 512, /* (624) group_by_list ::= expr_or_subquery */ + 512, /* (625) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 506, /* (626) having_clause_opt ::= */ + 506, /* (627) having_clause_opt ::= HAVING search_condition */ + 501, /* (628) range_opt ::= */ + 501, /* (629) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + 501, /* (630) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 502, /* (631) every_opt ::= */ + 502, /* (632) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + 513, /* (633) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + 514, /* (634) query_simple ::= query_specification */ + 514, /* (635) query_simple ::= union_query_expression */ + 518, /* (636) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + 518, /* (637) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + 519, /* (638) query_simple_or_subquery ::= query_simple */ + 519, /* (639) query_simple_or_subquery ::= subquery */ + 437, /* (640) query_or_subquery ::= query_expression */ + 437, /* (641) query_or_subquery ::= subquery */ + 515, /* (642) order_by_clause_opt ::= */ + 515, /* (643) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 516, /* (644) slimit_clause_opt ::= */ + 516, /* (645) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + 516, /* (646) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + 516, /* (647) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 517, /* (648) limit_clause_opt ::= */ + 517, /* (649) limit_clause_opt ::= LIMIT NK_INTEGER */ + 517, /* (650) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + 517, /* (651) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 487, /* (652) subquery ::= NK_LP query_expression NK_RP */ + 487, /* (653) subquery ::= NK_LP subquery NK_RP */ + 376, /* (654) search_condition ::= common_expression */ + 520, /* (655) sort_specification_list ::= sort_specification */ + 520, /* (656) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + 521, /* (657) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 522, /* (658) ordering_specification_opt ::= */ + 522, /* (659) ordering_specification_opt ::= ASC */ + 522, /* (660) ordering_specification_opt ::= DESC */ + 523, /* (661) null_ordering_opt ::= */ + 523, /* (662) null_ordering_opt ::= NULLS FIRST */ + 523, /* (663) null_ordering_opt ::= NULLS LAST */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -4146,594 +4119,599 @@ static const signed char yyRuleInfoNRhs[] = { 0, /* (68) force_opt ::= */ -1, /* (69) force_opt ::= FORCE */ -1, /* (70) unsafe_opt ::= UNSAFE */ - -3, /* (71) cmd ::= ALTER LOCAL NK_STRING */ - -4, /* (72) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - -5, /* (73) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - -5, /* (74) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - -5, /* (75) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ - -5, /* (76) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - -5, /* (77) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - -5, /* (78) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - -5, /* (79) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - -5, /* (80) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - -5, /* (81) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - -5, /* (82) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ - -5, /* (83) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ - -5, /* (84) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - -4, /* (85) cmd ::= DROP DATABASE exists_opt db_name */ - -2, /* (86) cmd ::= USE db_name */ - -4, /* (87) cmd ::= ALTER DATABASE db_name alter_db_options */ - -3, /* (88) cmd ::= FLUSH DATABASE db_name */ - -4, /* (89) cmd ::= TRIM DATABASE db_name speed_opt */ - -5, /* (90) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ - -3, /* (91) not_exists_opt ::= IF NOT EXISTS */ - 0, /* (92) not_exists_opt ::= */ - -2, /* (93) exists_opt ::= IF EXISTS */ - 0, /* (94) exists_opt ::= */ - 0, /* (95) db_options ::= */ - -3, /* (96) db_options ::= db_options BUFFER NK_INTEGER */ - -3, /* (97) db_options ::= db_options CACHEMODEL NK_STRING */ - -3, /* (98) db_options ::= db_options CACHESIZE NK_INTEGER */ - -3, /* (99) db_options ::= db_options COMP NK_INTEGER */ - -3, /* (100) db_options ::= db_options DURATION NK_INTEGER */ - -3, /* (101) db_options ::= db_options DURATION NK_VARIABLE */ - -3, /* (102) db_options ::= db_options MAXROWS NK_INTEGER */ - -3, /* (103) db_options ::= db_options MINROWS NK_INTEGER */ - -3, /* (104) db_options ::= db_options KEEP integer_list */ - -3, /* (105) db_options ::= db_options KEEP variable_list */ - -3, /* (106) db_options ::= db_options PAGES NK_INTEGER */ - -3, /* (107) db_options ::= db_options PAGESIZE NK_INTEGER */ - -3, /* (108) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ - -3, /* (109) db_options ::= db_options PRECISION NK_STRING */ - -3, /* (110) db_options ::= db_options REPLICA NK_INTEGER */ - -3, /* (111) db_options ::= db_options VGROUPS NK_INTEGER */ - -3, /* (112) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - -3, /* (113) db_options ::= db_options RETENTIONS retention_list */ - -3, /* (114) db_options ::= db_options SCHEMALESS NK_INTEGER */ - -3, /* (115) db_options ::= db_options WAL_LEVEL NK_INTEGER */ - -3, /* (116) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ - -3, /* (117) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ - -4, /* (118) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - -3, /* (119) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ - -4, /* (120) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - -3, /* (121) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ - -3, /* (122) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ - -3, /* (123) db_options ::= db_options STT_TRIGGER NK_INTEGER */ - -3, /* (124) db_options ::= db_options TABLE_PREFIX signed */ - -3, /* (125) db_options ::= db_options TABLE_SUFFIX signed */ - -3, /* (126) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ - -1, /* (127) alter_db_options ::= alter_db_option */ - -2, /* (128) alter_db_options ::= alter_db_options alter_db_option */ - -2, /* (129) alter_db_option ::= BUFFER NK_INTEGER */ - -2, /* (130) alter_db_option ::= CACHEMODEL NK_STRING */ - -2, /* (131) alter_db_option ::= CACHESIZE NK_INTEGER */ - -2, /* (132) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - -2, /* (133) alter_db_option ::= KEEP integer_list */ - -2, /* (134) alter_db_option ::= KEEP variable_list */ - -2, /* (135) alter_db_option ::= PAGES NK_INTEGER */ - -2, /* (136) alter_db_option ::= REPLICA NK_INTEGER */ - -2, /* (137) alter_db_option ::= WAL_LEVEL NK_INTEGER */ - -2, /* (138) alter_db_option ::= STT_TRIGGER NK_INTEGER */ - -2, /* (139) alter_db_option ::= MINROWS NK_INTEGER */ - -2, /* (140) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ - -3, /* (141) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - -2, /* (142) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ - -3, /* (143) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - -2, /* (144) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ - -1, /* (145) integer_list ::= NK_INTEGER */ - -3, /* (146) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - -1, /* (147) variable_list ::= NK_VARIABLE */ - -3, /* (148) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - -1, /* (149) retention_list ::= retention */ - -3, /* (150) retention_list ::= retention_list NK_COMMA retention */ - -3, /* (151) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - -3, /* (152) retention ::= NK_MINUS NK_COLON NK_VARIABLE */ - 0, /* (153) speed_opt ::= */ - -2, /* (154) speed_opt ::= BWLIMIT NK_INTEGER */ - 0, /* (155) start_opt ::= */ - -3, /* (156) start_opt ::= START WITH NK_INTEGER */ - -3, /* (157) start_opt ::= START WITH NK_STRING */ - -4, /* (158) start_opt ::= START WITH TIMESTAMP NK_STRING */ - 0, /* (159) end_opt ::= */ - -3, /* (160) end_opt ::= END WITH NK_INTEGER */ - -3, /* (161) end_opt ::= END WITH NK_STRING */ - -4, /* (162) end_opt ::= END WITH TIMESTAMP NK_STRING */ - -9, /* (163) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - -3, /* (164) cmd ::= CREATE TABLE multi_create_clause */ - -9, /* (165) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - -3, /* (166) cmd ::= DROP TABLE multi_drop_clause */ - -4, /* (167) cmd ::= DROP STABLE exists_opt full_table_name */ - -3, /* (168) cmd ::= ALTER TABLE alter_table_clause */ - -3, /* (169) cmd ::= ALTER STABLE alter_table_clause */ - -2, /* (170) alter_table_clause ::= full_table_name alter_table_options */ - -5, /* (171) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - -4, /* (172) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - -5, /* (173) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - -5, /* (174) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - -5, /* (175) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - -4, /* (176) alter_table_clause ::= full_table_name DROP TAG column_name */ - -5, /* (177) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - -5, /* (178) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - -6, /* (179) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - -1, /* (180) multi_create_clause ::= create_subtable_clause */ - -2, /* (181) multi_create_clause ::= multi_create_clause create_subtable_clause */ - -10, /* (182) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ - -1, /* (183) multi_drop_clause ::= drop_table_clause */ - -3, /* (184) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - -2, /* (185) drop_table_clause ::= exists_opt full_table_name */ - 0, /* (186) specific_cols_opt ::= */ - -3, /* (187) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - -1, /* (188) full_table_name ::= table_name */ - -3, /* (189) full_table_name ::= db_name NK_DOT table_name */ - -1, /* (190) column_def_list ::= column_def */ - -3, /* (191) column_def_list ::= column_def_list NK_COMMA column_def */ - -2, /* (192) column_def ::= column_name type_name */ - -1, /* (193) type_name ::= BOOL */ - -1, /* (194) type_name ::= TINYINT */ - -1, /* (195) type_name ::= SMALLINT */ - -1, /* (196) type_name ::= INT */ - -1, /* (197) type_name ::= INTEGER */ - -1, /* (198) type_name ::= BIGINT */ - -1, /* (199) type_name ::= FLOAT */ - -1, /* (200) type_name ::= DOUBLE */ - -4, /* (201) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - -1, /* (202) type_name ::= TIMESTAMP */ - -4, /* (203) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - -2, /* (204) type_name ::= TINYINT UNSIGNED */ - -2, /* (205) type_name ::= SMALLINT UNSIGNED */ - -2, /* (206) type_name ::= INT UNSIGNED */ - -2, /* (207) type_name ::= BIGINT UNSIGNED */ - -1, /* (208) type_name ::= JSON */ - -4, /* (209) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - -1, /* (210) type_name ::= MEDIUMBLOB */ - -1, /* (211) type_name ::= BLOB */ - -4, /* (212) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - -4, /* (213) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - -1, /* (214) type_name ::= DECIMAL */ - -4, /* (215) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - -6, /* (216) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 0, /* (217) tags_def_opt ::= */ - -1, /* (218) tags_def_opt ::= tags_def */ - -4, /* (219) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - 0, /* (220) table_options ::= */ - -3, /* (221) table_options ::= table_options COMMENT NK_STRING */ - -3, /* (222) table_options ::= table_options MAX_DELAY duration_list */ - -3, /* (223) table_options ::= table_options WATERMARK duration_list */ - -5, /* (224) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - -3, /* (225) table_options ::= table_options TTL NK_INTEGER */ - -5, /* (226) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - -3, /* (227) table_options ::= table_options DELETE_MARK duration_list */ - -1, /* (228) alter_table_options ::= alter_table_option */ - -2, /* (229) alter_table_options ::= alter_table_options alter_table_option */ - -2, /* (230) alter_table_option ::= COMMENT NK_STRING */ - -2, /* (231) alter_table_option ::= TTL NK_INTEGER */ - -1, /* (232) duration_list ::= duration_literal */ - -3, /* (233) duration_list ::= duration_list NK_COMMA duration_literal */ - -1, /* (234) rollup_func_list ::= rollup_func_name */ - -3, /* (235) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - -1, /* (236) rollup_func_name ::= function_name */ - -1, /* (237) rollup_func_name ::= FIRST */ - -1, /* (238) rollup_func_name ::= LAST */ - -1, /* (239) col_name_list ::= col_name */ - -3, /* (240) col_name_list ::= col_name_list NK_COMMA col_name */ - -1, /* (241) col_name ::= column_name */ - -2, /* (242) cmd ::= SHOW DNODES */ - -2, /* (243) cmd ::= SHOW USERS */ - -3, /* (244) cmd ::= SHOW USER PRIVILEGES */ - -3, /* (245) cmd ::= SHOW db_kind_opt DATABASES */ - -4, /* (246) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ - -4, /* (247) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - -3, /* (248) cmd ::= SHOW db_name_cond_opt VGROUPS */ - -2, /* (249) cmd ::= SHOW MNODES */ - -2, /* (250) cmd ::= SHOW QNODES */ - -2, /* (251) cmd ::= SHOW FUNCTIONS */ - -5, /* (252) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - -6, /* (253) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - -2, /* (254) cmd ::= SHOW STREAMS */ - -2, /* (255) cmd ::= SHOW ACCOUNTS */ - -2, /* (256) cmd ::= SHOW APPS */ - -2, /* (257) cmd ::= SHOW CONNECTIONS */ - -2, /* (258) cmd ::= SHOW LICENCES */ - -2, /* (259) cmd ::= SHOW GRANTS */ - -4, /* (260) cmd ::= SHOW CREATE DATABASE db_name */ - -4, /* (261) cmd ::= SHOW CREATE TABLE full_table_name */ - -4, /* (262) cmd ::= SHOW CREATE STABLE full_table_name */ - -2, /* (263) cmd ::= SHOW QUERIES */ - -2, /* (264) cmd ::= SHOW SCORES */ - -2, /* (265) cmd ::= SHOW TOPICS */ - -2, /* (266) cmd ::= SHOW VARIABLES */ - -3, /* (267) cmd ::= SHOW CLUSTER VARIABLES */ - -3, /* (268) cmd ::= SHOW LOCAL VARIABLES */ - -5, /* (269) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - -2, /* (270) cmd ::= SHOW BNODES */ - -2, /* (271) cmd ::= SHOW SNODES */ - -2, /* (272) cmd ::= SHOW CLUSTER */ - -2, /* (273) cmd ::= SHOW TRANSACTIONS */ - -4, /* (274) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - -2, /* (275) cmd ::= SHOW CONSUMERS */ - -2, /* (276) cmd ::= SHOW SUBSCRIPTIONS */ - -5, /* (277) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - -6, /* (278) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - -7, /* (279) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - -8, /* (280) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - -5, /* (281) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - -2, /* (282) cmd ::= SHOW VNODES */ - -3, /* (283) cmd ::= SHOW db_name_cond_opt ALIVE */ - -3, /* (284) cmd ::= SHOW CLUSTER ALIVE */ - -3, /* (285) cmd ::= SHOW db_name_cond_opt VIEWS */ - -4, /* (286) cmd ::= SHOW CREATE VIEW full_table_name */ - -2, /* (287) cmd ::= SHOW COMPACTS */ - -3, /* (288) cmd ::= SHOW COMPACT NK_INTEGER */ - 0, /* (289) table_kind_db_name_cond_opt ::= */ - -1, /* (290) table_kind_db_name_cond_opt ::= table_kind */ - -2, /* (291) table_kind_db_name_cond_opt ::= db_name NK_DOT */ - -3, /* (292) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ - -1, /* (293) table_kind ::= NORMAL */ - -1, /* (294) table_kind ::= CHILD */ - 0, /* (295) db_name_cond_opt ::= */ - -2, /* (296) db_name_cond_opt ::= db_name NK_DOT */ - 0, /* (297) like_pattern_opt ::= */ - -2, /* (298) like_pattern_opt ::= LIKE NK_STRING */ - -1, /* (299) table_name_cond ::= table_name */ - 0, /* (300) from_db_opt ::= */ - -2, /* (301) from_db_opt ::= FROM db_name */ - 0, /* (302) tag_list_opt ::= */ - -1, /* (303) tag_list_opt ::= tag_item */ - -3, /* (304) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - -1, /* (305) tag_item ::= TBNAME */ - -1, /* (306) tag_item ::= QTAGS */ - -1, /* (307) tag_item ::= column_name */ - -2, /* (308) tag_item ::= column_name column_alias */ - -3, /* (309) tag_item ::= column_name AS column_alias */ - 0, /* (310) db_kind_opt ::= */ - -1, /* (311) db_kind_opt ::= USER */ - -1, /* (312) db_kind_opt ::= SYSTEM */ - -8, /* (313) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - -9, /* (314) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - -4, /* (315) cmd ::= DROP INDEX exists_opt full_index_name */ - -1, /* (316) full_index_name ::= index_name */ - -3, /* (317) full_index_name ::= db_name NK_DOT index_name */ - -10, /* (318) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - -12, /* (319) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ - -1, /* (320) func_list ::= func */ - -3, /* (321) func_list ::= func_list NK_COMMA func */ - -4, /* (322) func ::= sma_func_name NK_LP expression_list NK_RP */ - -1, /* (323) sma_func_name ::= function_name */ - -1, /* (324) sma_func_name ::= COUNT */ - -1, /* (325) sma_func_name ::= FIRST */ - -1, /* (326) sma_func_name ::= LAST */ - -1, /* (327) sma_func_name ::= LAST_ROW */ - 0, /* (328) sma_stream_opt ::= */ - -3, /* (329) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - -3, /* (330) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - -3, /* (331) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - -1, /* (332) with_meta ::= AS */ - -3, /* (333) with_meta ::= WITH META AS */ - -3, /* (334) with_meta ::= ONLY META AS */ - -6, /* (335) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - -7, /* (336) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - -8, /* (337) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - -4, /* (338) cmd ::= DROP TOPIC exists_opt topic_name */ - -7, /* (339) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - -2, /* (340) cmd ::= DESC full_table_name */ - -2, /* (341) cmd ::= DESCRIBE full_table_name */ - -3, /* (342) cmd ::= RESET QUERY CACHE */ - -4, /* (343) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - -4, /* (344) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 0, /* (345) analyze_opt ::= */ - -1, /* (346) analyze_opt ::= ANALYZE */ - 0, /* (347) explain_options ::= */ - -3, /* (348) explain_options ::= explain_options VERBOSE NK_BOOL */ - -3, /* (349) explain_options ::= explain_options RATIO NK_FLOAT */ - -12, /* (350) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - -4, /* (351) cmd ::= DROP FUNCTION exists_opt function_name */ - 0, /* (352) agg_func_opt ::= */ - -1, /* (353) agg_func_opt ::= AGGREGATE */ - 0, /* (354) bufsize_opt ::= */ - -2, /* (355) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 0, /* (356) language_opt ::= */ - -2, /* (357) language_opt ::= LANGUAGE NK_STRING */ - 0, /* (358) or_replace_opt ::= */ - -2, /* (359) or_replace_opt ::= OR REPLACE */ - -6, /* (360) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ - -4, /* (361) cmd ::= DROP VIEW exists_opt full_view_name */ - -1, /* (362) full_view_name ::= view_name */ - -3, /* (363) full_view_name ::= db_name NK_DOT view_name */ - -12, /* (364) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ - -4, /* (365) cmd ::= DROP STREAM exists_opt stream_name */ - -4, /* (366) cmd ::= PAUSE STREAM exists_opt stream_name */ - -5, /* (367) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 0, /* (368) col_list_opt ::= */ - -3, /* (369) col_list_opt ::= NK_LP col_name_list NK_RP */ - 0, /* (370) tag_def_or_ref_opt ::= */ - -1, /* (371) tag_def_or_ref_opt ::= tags_def */ - -4, /* (372) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - 0, /* (373) stream_options ::= */ - -3, /* (374) stream_options ::= stream_options TRIGGER AT_ONCE */ - -3, /* (375) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - -4, /* (376) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - -3, /* (377) stream_options ::= stream_options WATERMARK duration_literal */ - -4, /* (378) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - -3, /* (379) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - -3, /* (380) stream_options ::= stream_options DELETE_MARK duration_literal */ - -4, /* (381) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 0, /* (382) subtable_opt ::= */ - -4, /* (383) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 0, /* (384) ignore_opt ::= */ - -2, /* (385) ignore_opt ::= IGNORE UNTREATED */ - -3, /* (386) cmd ::= KILL CONNECTION NK_INTEGER */ - -3, /* (387) cmd ::= KILL QUERY NK_STRING */ - -3, /* (388) cmd ::= KILL TRANSACTION NK_INTEGER */ - -3, /* (389) cmd ::= KILL COMPACT NK_INTEGER */ - -2, /* (390) cmd ::= BALANCE VGROUP */ - -4, /* (391) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - -4, /* (392) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - -4, /* (393) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - -3, /* (394) cmd ::= SPLIT VGROUP NK_INTEGER */ - 0, /* (395) on_vgroup_id ::= */ - -2, /* (396) on_vgroup_id ::= ON NK_INTEGER */ - -2, /* (397) dnode_list ::= DNODE NK_INTEGER */ - -3, /* (398) dnode_list ::= dnode_list DNODE NK_INTEGER */ - -4, /* (399) cmd ::= DELETE FROM full_table_name where_clause_opt */ - -1, /* (400) cmd ::= query_or_subquery */ - -1, /* (401) cmd ::= insert_query */ - -7, /* (402) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - -4, /* (403) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - -1, /* (404) literal ::= NK_INTEGER */ - -1, /* (405) literal ::= NK_FLOAT */ - -1, /* (406) literal ::= NK_STRING */ - -1, /* (407) literal ::= NK_BOOL */ - -2, /* (408) literal ::= TIMESTAMP NK_STRING */ - -1, /* (409) literal ::= duration_literal */ - -1, /* (410) literal ::= NULL */ - -1, /* (411) literal ::= NK_QUESTION */ - -1, /* (412) duration_literal ::= NK_VARIABLE */ - -1, /* (413) signed ::= NK_INTEGER */ - -2, /* (414) signed ::= NK_PLUS NK_INTEGER */ - -2, /* (415) signed ::= NK_MINUS NK_INTEGER */ - -1, /* (416) signed ::= NK_FLOAT */ - -2, /* (417) signed ::= NK_PLUS NK_FLOAT */ - -2, /* (418) signed ::= NK_MINUS NK_FLOAT */ - -1, /* (419) signed_literal ::= signed */ - -1, /* (420) signed_literal ::= NK_STRING */ - -1, /* (421) signed_literal ::= NK_BOOL */ - -2, /* (422) signed_literal ::= TIMESTAMP NK_STRING */ - -1, /* (423) signed_literal ::= duration_literal */ - -1, /* (424) signed_literal ::= NULL */ - -1, /* (425) signed_literal ::= literal_func */ - -1, /* (426) signed_literal ::= NK_QUESTION */ - -1, /* (427) literal_list ::= signed_literal */ - -3, /* (428) literal_list ::= literal_list NK_COMMA signed_literal */ - -1, /* (429) db_name ::= NK_ID */ - -1, /* (430) table_name ::= NK_ID */ - -1, /* (431) column_name ::= NK_ID */ - -1, /* (432) function_name ::= NK_ID */ - -1, /* (433) view_name ::= NK_ID */ - -1, /* (434) table_alias ::= NK_ID */ - -1, /* (435) column_alias ::= NK_ID */ - -1, /* (436) column_alias ::= NK_ALIAS */ - -1, /* (437) user_name ::= NK_ID */ - -1, /* (438) topic_name ::= NK_ID */ - -1, /* (439) stream_name ::= NK_ID */ - -1, /* (440) cgroup_name ::= NK_ID */ - -1, /* (441) index_name ::= NK_ID */ - -1, /* (442) expr_or_subquery ::= expression */ - -1, /* (443) expression ::= literal */ - -1, /* (444) expression ::= pseudo_column */ - -1, /* (445) expression ::= column_reference */ - -1, /* (446) expression ::= function_expression */ - -1, /* (447) expression ::= case_when_expression */ - -3, /* (448) expression ::= NK_LP expression NK_RP */ - -2, /* (449) expression ::= NK_PLUS expr_or_subquery */ - -2, /* (450) expression ::= NK_MINUS expr_or_subquery */ - -3, /* (451) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - -3, /* (452) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - -3, /* (453) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - -3, /* (454) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - -3, /* (455) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - -3, /* (456) expression ::= column_reference NK_ARROW NK_STRING */ - -3, /* (457) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - -3, /* (458) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - -1, /* (459) expression_list ::= expr_or_subquery */ - -3, /* (460) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - -1, /* (461) column_reference ::= column_name */ - -3, /* (462) column_reference ::= table_name NK_DOT column_name */ - -1, /* (463) column_reference ::= NK_ALIAS */ - -3, /* (464) column_reference ::= table_name NK_DOT NK_ALIAS */ - -1, /* (465) pseudo_column ::= ROWTS */ - -1, /* (466) pseudo_column ::= TBNAME */ - -3, /* (467) pseudo_column ::= table_name NK_DOT TBNAME */ - -1, /* (468) pseudo_column ::= QSTART */ - -1, /* (469) pseudo_column ::= QEND */ - -1, /* (470) pseudo_column ::= QDURATION */ - -1, /* (471) pseudo_column ::= WSTART */ - -1, /* (472) pseudo_column ::= WEND */ - -1, /* (473) pseudo_column ::= WDURATION */ - -1, /* (474) pseudo_column ::= IROWTS */ - -1, /* (475) pseudo_column ::= ISFILLED */ - -1, /* (476) pseudo_column ::= QTAGS */ - -4, /* (477) function_expression ::= function_name NK_LP expression_list NK_RP */ - -4, /* (478) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - -6, /* (479) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - -1, /* (480) function_expression ::= literal_func */ - -3, /* (481) literal_func ::= noarg_func NK_LP NK_RP */ - -1, /* (482) literal_func ::= NOW */ - -1, /* (483) noarg_func ::= NOW */ - -1, /* (484) noarg_func ::= TODAY */ - -1, /* (485) noarg_func ::= TIMEZONE */ - -1, /* (486) noarg_func ::= DATABASE */ - -1, /* (487) noarg_func ::= CLIENT_VERSION */ - -1, /* (488) noarg_func ::= SERVER_VERSION */ - -1, /* (489) noarg_func ::= SERVER_STATUS */ - -1, /* (490) noarg_func ::= CURRENT_USER */ - -1, /* (491) noarg_func ::= USER */ - -1, /* (492) star_func ::= COUNT */ - -1, /* (493) star_func ::= FIRST */ - -1, /* (494) star_func ::= LAST */ - -1, /* (495) star_func ::= LAST_ROW */ - -1, /* (496) star_func_para_list ::= NK_STAR */ - -1, /* (497) star_func_para_list ::= other_para_list */ - -1, /* (498) other_para_list ::= star_func_para */ - -3, /* (499) other_para_list ::= other_para_list NK_COMMA star_func_para */ - -1, /* (500) star_func_para ::= expr_or_subquery */ - -3, /* (501) star_func_para ::= table_name NK_DOT NK_STAR */ - -4, /* (502) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - -5, /* (503) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - -1, /* (504) when_then_list ::= when_then_expr */ - -2, /* (505) when_then_list ::= when_then_list when_then_expr */ - -4, /* (506) when_then_expr ::= WHEN common_expression THEN common_expression */ - 0, /* (507) case_when_else_opt ::= */ - -2, /* (508) case_when_else_opt ::= ELSE common_expression */ - -3, /* (509) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - -5, /* (510) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - -6, /* (511) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - -3, /* (512) predicate ::= expr_or_subquery IS NULL */ - -4, /* (513) predicate ::= expr_or_subquery IS NOT NULL */ - -3, /* (514) predicate ::= expr_or_subquery in_op in_predicate_value */ - -1, /* (515) compare_op ::= NK_LT */ - -1, /* (516) compare_op ::= NK_GT */ - -1, /* (517) compare_op ::= NK_LE */ - -1, /* (518) compare_op ::= NK_GE */ - -1, /* (519) compare_op ::= NK_NE */ - -1, /* (520) compare_op ::= NK_EQ */ - -1, /* (521) compare_op ::= LIKE */ - -2, /* (522) compare_op ::= NOT LIKE */ - -1, /* (523) compare_op ::= MATCH */ - -1, /* (524) compare_op ::= NMATCH */ - -1, /* (525) compare_op ::= CONTAINS */ - -1, /* (526) in_op ::= IN */ - -2, /* (527) in_op ::= NOT IN */ - -3, /* (528) in_predicate_value ::= NK_LP literal_list NK_RP */ - -1, /* (529) boolean_value_expression ::= boolean_primary */ - -2, /* (530) boolean_value_expression ::= NOT boolean_primary */ - -3, /* (531) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - -3, /* (532) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - -1, /* (533) boolean_primary ::= predicate */ - -3, /* (534) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - -1, /* (535) common_expression ::= expr_or_subquery */ - -1, /* (536) common_expression ::= boolean_value_expression */ - 0, /* (537) from_clause_opt ::= */ - -2, /* (538) from_clause_opt ::= FROM table_reference_list */ - -1, /* (539) table_reference_list ::= table_reference */ - -3, /* (540) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - -1, /* (541) table_reference ::= table_primary */ - -1, /* (542) table_reference ::= joined_table */ - -2, /* (543) table_primary ::= table_name alias_opt */ - -4, /* (544) table_primary ::= db_name NK_DOT table_name alias_opt */ - -2, /* (545) table_primary ::= subquery alias_opt */ - -1, /* (546) table_primary ::= parenthesized_joined_table */ - 0, /* (547) alias_opt ::= */ - -1, /* (548) alias_opt ::= table_alias */ - -2, /* (549) alias_opt ::= AS table_alias */ - -3, /* (550) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - -3, /* (551) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - -8, /* (552) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ - 0, /* (553) join_type ::= */ - -1, /* (554) join_type ::= INNER */ - -1, /* (555) join_type ::= LEFT */ - -1, /* (556) join_type ::= RIGHT */ - -1, /* (557) join_type ::= FULL */ - 0, /* (558) join_subtype ::= */ - -1, /* (559) join_subtype ::= OUTER */ - -1, /* (560) join_subtype ::= SEMI */ - -1, /* (561) join_subtype ::= ANTI */ - -1, /* (562) join_subtype ::= ASOF */ - -1, /* (563) join_subtype ::= WINDOW */ - 0, /* (564) join_on_clause_opt ::= */ - -2, /* (565) join_on_clause_opt ::= ON search_condition */ - 0, /* (566) window_offset_clause_opt ::= */ - -6, /* (567) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ - -1, /* (568) window_offset_literal ::= NK_VARIABLE */ - -2, /* (569) window_offset_literal ::= NK_MINUS NK_VARIABLE */ - 0, /* (570) jlimit_clause_opt ::= */ - -2, /* (571) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - -14, /* (572) 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, /* (573) hint_list ::= */ - -1, /* (574) hint_list ::= NK_HINT */ - 0, /* (575) tag_mode_opt ::= */ - -1, /* (576) tag_mode_opt ::= TAGS */ - 0, /* (577) set_quantifier_opt ::= */ - -1, /* (578) set_quantifier_opt ::= DISTINCT */ - -1, /* (579) set_quantifier_opt ::= ALL */ - -1, /* (580) select_list ::= select_item */ - -3, /* (581) select_list ::= select_list NK_COMMA select_item */ - -1, /* (582) select_item ::= NK_STAR */ - -1, /* (583) select_item ::= common_expression */ - -2, /* (584) select_item ::= common_expression column_alias */ - -3, /* (585) select_item ::= common_expression AS column_alias */ - -3, /* (586) select_item ::= table_name NK_DOT NK_STAR */ - 0, /* (587) where_clause_opt ::= */ - -2, /* (588) where_clause_opt ::= WHERE search_condition */ - 0, /* (589) partition_by_clause_opt ::= */ - -3, /* (590) partition_by_clause_opt ::= PARTITION BY partition_list */ - -1, /* (591) partition_list ::= partition_item */ - -3, /* (592) partition_list ::= partition_list NK_COMMA partition_item */ - -1, /* (593) partition_item ::= expr_or_subquery */ - -2, /* (594) partition_item ::= expr_or_subquery column_alias */ - -3, /* (595) partition_item ::= expr_or_subquery AS column_alias */ - 0, /* (596) twindow_clause_opt ::= */ - -6, /* (597) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - -4, /* (598) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - -6, /* (599) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -8, /* (600) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -7, /* (601) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 0, /* (602) sliding_opt ::= */ - -4, /* (603) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - -1, /* (604) interval_sliding_duration_literal ::= NK_VARIABLE */ - -1, /* (605) interval_sliding_duration_literal ::= NK_STRING */ - -1, /* (606) interval_sliding_duration_literal ::= NK_INTEGER */ - 0, /* (607) fill_opt ::= */ - -4, /* (608) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - -6, /* (609) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - -6, /* (610) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - -1, /* (611) fill_mode ::= NONE */ - -1, /* (612) fill_mode ::= PREV */ - -1, /* (613) fill_mode ::= NULL */ - -1, /* (614) fill_mode ::= NULL_F */ - -1, /* (615) fill_mode ::= LINEAR */ - -1, /* (616) fill_mode ::= NEXT */ - 0, /* (617) group_by_clause_opt ::= */ - -3, /* (618) group_by_clause_opt ::= GROUP BY group_by_list */ - -1, /* (619) group_by_list ::= expr_or_subquery */ - -3, /* (620) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 0, /* (621) having_clause_opt ::= */ - -2, /* (622) having_clause_opt ::= HAVING search_condition */ - 0, /* (623) range_opt ::= */ - -6, /* (624) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - -4, /* (625) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 0, /* (626) every_opt ::= */ - -4, /* (627) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - -4, /* (628) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - -1, /* (629) query_simple ::= query_specification */ - -1, /* (630) query_simple ::= union_query_expression */ - -4, /* (631) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - -3, /* (632) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - -1, /* (633) query_simple_or_subquery ::= query_simple */ - -1, /* (634) query_simple_or_subquery ::= subquery */ - -1, /* (635) query_or_subquery ::= query_expression */ - -1, /* (636) query_or_subquery ::= subquery */ - 0, /* (637) order_by_clause_opt ::= */ - -3, /* (638) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 0, /* (639) slimit_clause_opt ::= */ - -2, /* (640) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - -4, /* (641) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - -4, /* (642) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 0, /* (643) limit_clause_opt ::= */ - -2, /* (644) limit_clause_opt ::= LIMIT NK_INTEGER */ - -4, /* (645) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - -4, /* (646) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - -3, /* (647) subquery ::= NK_LP query_expression NK_RP */ - -3, /* (648) subquery ::= NK_LP subquery NK_RP */ - -1, /* (649) search_condition ::= common_expression */ - -1, /* (650) sort_specification_list ::= sort_specification */ - -3, /* (651) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - -3, /* (652) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 0, /* (653) ordering_specification_opt ::= */ - -1, /* (654) ordering_specification_opt ::= ASC */ - -1, /* (655) ordering_specification_opt ::= DESC */ - 0, /* (656) null_ordering_opt ::= */ - -2, /* (657) null_ordering_opt ::= NULLS FIRST */ - -2, /* (658) null_ordering_opt ::= NULLS LAST */ + -3, /* (71) cmd ::= ALTER CLUSTER NK_STRING */ + -4, /* (72) cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ + -3, /* (73) cmd ::= ALTER LOCAL NK_STRING */ + -4, /* (74) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + -5, /* (75) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + -5, /* (76) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + -5, /* (77) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ + -5, /* (78) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + -5, /* (79) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + -5, /* (80) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + -5, /* (81) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + -5, /* (82) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + -5, /* (83) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + -5, /* (84) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ + -5, /* (85) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ + -5, /* (86) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + -4, /* (87) cmd ::= DROP DATABASE exists_opt db_name */ + -2, /* (88) cmd ::= USE db_name */ + -4, /* (89) cmd ::= ALTER DATABASE db_name alter_db_options */ + -3, /* (90) cmd ::= FLUSH DATABASE db_name */ + -4, /* (91) cmd ::= TRIM DATABASE db_name speed_opt */ + -5, /* (92) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ + -3, /* (93) not_exists_opt ::= IF NOT EXISTS */ + 0, /* (94) not_exists_opt ::= */ + -2, /* (95) exists_opt ::= IF EXISTS */ + 0, /* (96) exists_opt ::= */ + 0, /* (97) db_options ::= */ + -3, /* (98) db_options ::= db_options BUFFER NK_INTEGER */ + -3, /* (99) db_options ::= db_options CACHEMODEL NK_STRING */ + -3, /* (100) db_options ::= db_options CACHESIZE NK_INTEGER */ + -3, /* (101) db_options ::= db_options COMP NK_INTEGER */ + -3, /* (102) db_options ::= db_options DURATION NK_INTEGER */ + -3, /* (103) db_options ::= db_options DURATION NK_VARIABLE */ + -3, /* (104) db_options ::= db_options MAXROWS NK_INTEGER */ + -3, /* (105) db_options ::= db_options MINROWS NK_INTEGER */ + -3, /* (106) db_options ::= db_options KEEP integer_list */ + -3, /* (107) db_options ::= db_options KEEP variable_list */ + -3, /* (108) db_options ::= db_options PAGES NK_INTEGER */ + -3, /* (109) db_options ::= db_options PAGESIZE NK_INTEGER */ + -3, /* (110) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ + -3, /* (111) db_options ::= db_options PRECISION NK_STRING */ + -3, /* (112) db_options ::= db_options REPLICA NK_INTEGER */ + -3, /* (113) db_options ::= db_options VGROUPS NK_INTEGER */ + -3, /* (114) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + -3, /* (115) db_options ::= db_options RETENTIONS retention_list */ + -3, /* (116) db_options ::= db_options SCHEMALESS NK_INTEGER */ + -3, /* (117) db_options ::= db_options WAL_LEVEL NK_INTEGER */ + -3, /* (118) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ + -3, /* (119) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ + -4, /* (120) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + -3, /* (121) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ + -4, /* (122) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + -3, /* (123) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ + -3, /* (124) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ + -3, /* (125) db_options ::= db_options STT_TRIGGER NK_INTEGER */ + -3, /* (126) db_options ::= db_options TABLE_PREFIX signed */ + -3, /* (127) db_options ::= db_options TABLE_SUFFIX signed */ + -3, /* (128) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ + -1, /* (129) alter_db_options ::= alter_db_option */ + -2, /* (130) alter_db_options ::= alter_db_options alter_db_option */ + -2, /* (131) alter_db_option ::= BUFFER NK_INTEGER */ + -2, /* (132) alter_db_option ::= CACHEMODEL NK_STRING */ + -2, /* (133) alter_db_option ::= CACHESIZE NK_INTEGER */ + -2, /* (134) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ + -2, /* (135) alter_db_option ::= KEEP integer_list */ + -2, /* (136) alter_db_option ::= KEEP variable_list */ + -2, /* (137) alter_db_option ::= PAGES NK_INTEGER */ + -2, /* (138) alter_db_option ::= REPLICA NK_INTEGER */ + -2, /* (139) alter_db_option ::= WAL_LEVEL NK_INTEGER */ + -2, /* (140) alter_db_option ::= STT_TRIGGER NK_INTEGER */ + -2, /* (141) alter_db_option ::= MINROWS NK_INTEGER */ + -2, /* (142) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ + -3, /* (143) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + -2, /* (144) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ + -3, /* (145) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + -2, /* (146) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ + -1, /* (147) integer_list ::= NK_INTEGER */ + -3, /* (148) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + -1, /* (149) variable_list ::= NK_VARIABLE */ + -3, /* (150) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + -1, /* (151) retention_list ::= retention */ + -3, /* (152) retention_list ::= retention_list NK_COMMA retention */ + -3, /* (153) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + -3, /* (154) retention ::= NK_MINUS NK_COLON NK_VARIABLE */ + 0, /* (155) speed_opt ::= */ + -2, /* (156) speed_opt ::= BWLIMIT NK_INTEGER */ + 0, /* (157) start_opt ::= */ + -3, /* (158) start_opt ::= START WITH NK_INTEGER */ + -3, /* (159) start_opt ::= START WITH NK_STRING */ + -4, /* (160) start_opt ::= START WITH TIMESTAMP NK_STRING */ + 0, /* (161) end_opt ::= */ + -3, /* (162) end_opt ::= END WITH NK_INTEGER */ + -3, /* (163) end_opt ::= END WITH NK_STRING */ + -4, /* (164) end_opt ::= END WITH TIMESTAMP NK_STRING */ + -9, /* (165) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + -3, /* (166) cmd ::= CREATE TABLE multi_create_clause */ + -9, /* (167) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + -3, /* (168) cmd ::= DROP TABLE multi_drop_clause */ + -4, /* (169) cmd ::= DROP STABLE exists_opt full_table_name */ + -3, /* (170) cmd ::= ALTER TABLE alter_table_clause */ + -3, /* (171) cmd ::= ALTER STABLE alter_table_clause */ + -2, /* (172) alter_table_clause ::= full_table_name alter_table_options */ + -5, /* (173) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + -4, /* (174) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + -5, /* (175) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + -5, /* (176) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + -5, /* (177) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + -4, /* (178) alter_table_clause ::= full_table_name DROP TAG column_name */ + -5, /* (179) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + -5, /* (180) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + -6, /* (181) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + -1, /* (182) multi_create_clause ::= create_subtable_clause */ + -2, /* (183) multi_create_clause ::= multi_create_clause create_subtable_clause */ + -10, /* (184) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ + -1, /* (185) multi_drop_clause ::= drop_table_clause */ + -3, /* (186) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ + -2, /* (187) drop_table_clause ::= exists_opt full_table_name */ + 0, /* (188) specific_cols_opt ::= */ + -3, /* (189) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + -1, /* (190) full_table_name ::= table_name */ + -3, /* (191) full_table_name ::= db_name NK_DOT table_name */ + -1, /* (192) column_def_list ::= column_def */ + -3, /* (193) column_def_list ::= column_def_list NK_COMMA column_def */ + -2, /* (194) column_def ::= column_name type_name */ + -1, /* (195) type_name ::= BOOL */ + -1, /* (196) type_name ::= TINYINT */ + -1, /* (197) type_name ::= SMALLINT */ + -1, /* (198) type_name ::= INT */ + -1, /* (199) type_name ::= INTEGER */ + -1, /* (200) type_name ::= BIGINT */ + -1, /* (201) type_name ::= FLOAT */ + -1, /* (202) type_name ::= DOUBLE */ + -4, /* (203) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + -1, /* (204) type_name ::= TIMESTAMP */ + -4, /* (205) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + -2, /* (206) type_name ::= TINYINT UNSIGNED */ + -2, /* (207) type_name ::= SMALLINT UNSIGNED */ + -2, /* (208) type_name ::= INT UNSIGNED */ + -2, /* (209) type_name ::= BIGINT UNSIGNED */ + -1, /* (210) type_name ::= JSON */ + -4, /* (211) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + -1, /* (212) type_name ::= MEDIUMBLOB */ + -1, /* (213) type_name ::= BLOB */ + -4, /* (214) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + -4, /* (215) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + -1, /* (216) type_name ::= DECIMAL */ + -4, /* (217) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + -6, /* (218) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 0, /* (219) tags_def_opt ::= */ + -1, /* (220) tags_def_opt ::= tags_def */ + -4, /* (221) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + 0, /* (222) table_options ::= */ + -3, /* (223) table_options ::= table_options COMMENT NK_STRING */ + -3, /* (224) table_options ::= table_options MAX_DELAY duration_list */ + -3, /* (225) table_options ::= table_options WATERMARK duration_list */ + -5, /* (226) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + -3, /* (227) table_options ::= table_options TTL NK_INTEGER */ + -5, /* (228) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + -3, /* (229) table_options ::= table_options DELETE_MARK duration_list */ + -1, /* (230) alter_table_options ::= alter_table_option */ + -2, /* (231) alter_table_options ::= alter_table_options alter_table_option */ + -2, /* (232) alter_table_option ::= COMMENT NK_STRING */ + -2, /* (233) alter_table_option ::= TTL NK_INTEGER */ + -1, /* (234) duration_list ::= duration_literal */ + -3, /* (235) duration_list ::= duration_list NK_COMMA duration_literal */ + -1, /* (236) rollup_func_list ::= rollup_func_name */ + -3, /* (237) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + -1, /* (238) rollup_func_name ::= function_name */ + -1, /* (239) rollup_func_name ::= FIRST */ + -1, /* (240) rollup_func_name ::= LAST */ + -1, /* (241) col_name_list ::= col_name */ + -3, /* (242) col_name_list ::= col_name_list NK_COMMA col_name */ + -1, /* (243) col_name ::= column_name */ + -2, /* (244) cmd ::= SHOW DNODES */ + -2, /* (245) cmd ::= SHOW USERS */ + -3, /* (246) cmd ::= SHOW USER PRIVILEGES */ + -3, /* (247) cmd ::= SHOW db_kind_opt DATABASES */ + -4, /* (248) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ + -4, /* (249) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + -3, /* (250) cmd ::= SHOW db_name_cond_opt VGROUPS */ + -2, /* (251) cmd ::= SHOW MNODES */ + -2, /* (252) cmd ::= SHOW QNODES */ + -2, /* (253) cmd ::= SHOW FUNCTIONS */ + -5, /* (254) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + -6, /* (255) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + -2, /* (256) cmd ::= SHOW STREAMS */ + -2, /* (257) cmd ::= SHOW ACCOUNTS */ + -2, /* (258) cmd ::= SHOW APPS */ + -2, /* (259) cmd ::= SHOW CONNECTIONS */ + -2, /* (260) cmd ::= SHOW LICENCES */ + -2, /* (261) cmd ::= SHOW GRANTS */ + -3, /* (262) cmd ::= SHOW GRANTS FULL */ + -3, /* (263) cmd ::= SHOW GRANTS LOGS */ + -3, /* (264) cmd ::= SHOW CLUSTER MACHINES */ + -4, /* (265) cmd ::= SHOW CREATE DATABASE db_name */ + -4, /* (266) cmd ::= SHOW CREATE TABLE full_table_name */ + -4, /* (267) cmd ::= SHOW CREATE STABLE full_table_name */ + -2, /* (268) cmd ::= SHOW QUERIES */ + -2, /* (269) cmd ::= SHOW SCORES */ + -2, /* (270) cmd ::= SHOW TOPICS */ + -2, /* (271) cmd ::= SHOW VARIABLES */ + -3, /* (272) cmd ::= SHOW CLUSTER VARIABLES */ + -3, /* (273) cmd ::= SHOW LOCAL VARIABLES */ + -5, /* (274) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + -2, /* (275) cmd ::= SHOW BNODES */ + -2, /* (276) cmd ::= SHOW SNODES */ + -2, /* (277) cmd ::= SHOW CLUSTER */ + -2, /* (278) cmd ::= SHOW TRANSACTIONS */ + -4, /* (279) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + -2, /* (280) cmd ::= SHOW CONSUMERS */ + -2, /* (281) cmd ::= SHOW SUBSCRIPTIONS */ + -5, /* (282) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + -6, /* (283) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + -7, /* (284) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + -8, /* (285) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + -5, /* (286) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + -2, /* (287) cmd ::= SHOW VNODES */ + -3, /* (288) cmd ::= SHOW db_name_cond_opt ALIVE */ + -3, /* (289) cmd ::= SHOW CLUSTER ALIVE */ + -3, /* (290) cmd ::= SHOW db_name_cond_opt VIEWS */ + -4, /* (291) cmd ::= SHOW CREATE VIEW full_table_name */ + -2, /* (292) cmd ::= SHOW COMPACTS */ + -3, /* (293) cmd ::= SHOW COMPACT NK_INTEGER */ + 0, /* (294) table_kind_db_name_cond_opt ::= */ + -1, /* (295) table_kind_db_name_cond_opt ::= table_kind */ + -2, /* (296) table_kind_db_name_cond_opt ::= db_name NK_DOT */ + -3, /* (297) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ + -1, /* (298) table_kind ::= NORMAL */ + -1, /* (299) table_kind ::= CHILD */ + 0, /* (300) db_name_cond_opt ::= */ + -2, /* (301) db_name_cond_opt ::= db_name NK_DOT */ + 0, /* (302) like_pattern_opt ::= */ + -2, /* (303) like_pattern_opt ::= LIKE NK_STRING */ + -1, /* (304) table_name_cond ::= table_name */ + 0, /* (305) from_db_opt ::= */ + -2, /* (306) from_db_opt ::= FROM db_name */ + 0, /* (307) tag_list_opt ::= */ + -1, /* (308) tag_list_opt ::= tag_item */ + -3, /* (309) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + -1, /* (310) tag_item ::= TBNAME */ + -1, /* (311) tag_item ::= QTAGS */ + -1, /* (312) tag_item ::= column_name */ + -2, /* (313) tag_item ::= column_name column_alias */ + -3, /* (314) tag_item ::= column_name AS column_alias */ + 0, /* (315) db_kind_opt ::= */ + -1, /* (316) db_kind_opt ::= USER */ + -1, /* (317) db_kind_opt ::= SYSTEM */ + -8, /* (318) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ + -9, /* (319) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ + -4, /* (320) cmd ::= DROP INDEX exists_opt full_index_name */ + -1, /* (321) full_index_name ::= index_name */ + -3, /* (322) full_index_name ::= db_name NK_DOT index_name */ + -10, /* (323) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + -12, /* (324) 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, /* (325) func_list ::= func */ + -3, /* (326) func_list ::= func_list NK_COMMA func */ + -4, /* (327) func ::= sma_func_name NK_LP expression_list NK_RP */ + -1, /* (328) sma_func_name ::= function_name */ + -1, /* (329) sma_func_name ::= COUNT */ + -1, /* (330) sma_func_name ::= FIRST */ + -1, /* (331) sma_func_name ::= LAST */ + -1, /* (332) sma_func_name ::= LAST_ROW */ + 0, /* (333) sma_stream_opt ::= */ + -3, /* (334) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + -3, /* (335) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + -3, /* (336) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + -1, /* (337) with_meta ::= AS */ + -3, /* (338) with_meta ::= WITH META AS */ + -3, /* (339) with_meta ::= ONLY META AS */ + -6, /* (340) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + -7, /* (341) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + -8, /* (342) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + -4, /* (343) cmd ::= DROP TOPIC exists_opt topic_name */ + -7, /* (344) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + -2, /* (345) cmd ::= DESC full_table_name */ + -2, /* (346) cmd ::= DESCRIBE full_table_name */ + -3, /* (347) cmd ::= RESET QUERY CACHE */ + -4, /* (348) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + -4, /* (349) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 0, /* (350) analyze_opt ::= */ + -1, /* (351) analyze_opt ::= ANALYZE */ + 0, /* (352) explain_options ::= */ + -3, /* (353) explain_options ::= explain_options VERBOSE NK_BOOL */ + -3, /* (354) explain_options ::= explain_options RATIO NK_FLOAT */ + -12, /* (355) 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, /* (356) cmd ::= DROP FUNCTION exists_opt function_name */ + 0, /* (357) agg_func_opt ::= */ + -1, /* (358) agg_func_opt ::= AGGREGATE */ + 0, /* (359) bufsize_opt ::= */ + -2, /* (360) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 0, /* (361) language_opt ::= */ + -2, /* (362) language_opt ::= LANGUAGE NK_STRING */ + 0, /* (363) or_replace_opt ::= */ + -2, /* (364) or_replace_opt ::= OR REPLACE */ + -6, /* (365) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ + -4, /* (366) cmd ::= DROP VIEW exists_opt full_view_name */ + -1, /* (367) full_view_name ::= view_name */ + -3, /* (368) full_view_name ::= db_name NK_DOT view_name */ + -12, /* (369) 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, /* (370) cmd ::= DROP STREAM exists_opt stream_name */ + -4, /* (371) cmd ::= PAUSE STREAM exists_opt stream_name */ + -5, /* (372) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 0, /* (373) col_list_opt ::= */ + -3, /* (374) col_list_opt ::= NK_LP col_name_list NK_RP */ + 0, /* (375) tag_def_or_ref_opt ::= */ + -1, /* (376) tag_def_or_ref_opt ::= tags_def */ + -4, /* (377) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ + 0, /* (378) stream_options ::= */ + -3, /* (379) stream_options ::= stream_options TRIGGER AT_ONCE */ + -3, /* (380) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + -4, /* (381) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + -3, /* (382) stream_options ::= stream_options WATERMARK duration_literal */ + -4, /* (383) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + -3, /* (384) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + -3, /* (385) stream_options ::= stream_options DELETE_MARK duration_literal */ + -4, /* (386) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 0, /* (387) subtable_opt ::= */ + -4, /* (388) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 0, /* (389) ignore_opt ::= */ + -2, /* (390) ignore_opt ::= IGNORE UNTREATED */ + -3, /* (391) cmd ::= KILL CONNECTION NK_INTEGER */ + -3, /* (392) cmd ::= KILL QUERY NK_STRING */ + -3, /* (393) cmd ::= KILL TRANSACTION NK_INTEGER */ + -3, /* (394) cmd ::= KILL COMPACT NK_INTEGER */ + -2, /* (395) cmd ::= BALANCE VGROUP */ + -4, /* (396) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ + -4, /* (397) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + -4, /* (398) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + -3, /* (399) cmd ::= SPLIT VGROUP NK_INTEGER */ + 0, /* (400) on_vgroup_id ::= */ + -2, /* (401) on_vgroup_id ::= ON NK_INTEGER */ + -2, /* (402) dnode_list ::= DNODE NK_INTEGER */ + -3, /* (403) dnode_list ::= dnode_list DNODE NK_INTEGER */ + -4, /* (404) cmd ::= DELETE FROM full_table_name where_clause_opt */ + -1, /* (405) cmd ::= query_or_subquery */ + -1, /* (406) cmd ::= insert_query */ + -7, /* (407) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + -4, /* (408) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + -1, /* (409) literal ::= NK_INTEGER */ + -1, /* (410) literal ::= NK_FLOAT */ + -1, /* (411) literal ::= NK_STRING */ + -1, /* (412) literal ::= NK_BOOL */ + -2, /* (413) literal ::= TIMESTAMP NK_STRING */ + -1, /* (414) literal ::= duration_literal */ + -1, /* (415) literal ::= NULL */ + -1, /* (416) literal ::= NK_QUESTION */ + -1, /* (417) duration_literal ::= NK_VARIABLE */ + -1, /* (418) signed ::= NK_INTEGER */ + -2, /* (419) signed ::= NK_PLUS NK_INTEGER */ + -2, /* (420) signed ::= NK_MINUS NK_INTEGER */ + -1, /* (421) signed ::= NK_FLOAT */ + -2, /* (422) signed ::= NK_PLUS NK_FLOAT */ + -2, /* (423) signed ::= NK_MINUS NK_FLOAT */ + -1, /* (424) signed_literal ::= signed */ + -1, /* (425) signed_literal ::= NK_STRING */ + -1, /* (426) signed_literal ::= NK_BOOL */ + -2, /* (427) signed_literal ::= TIMESTAMP NK_STRING */ + -1, /* (428) signed_literal ::= duration_literal */ + -1, /* (429) signed_literal ::= NULL */ + -1, /* (430) signed_literal ::= literal_func */ + -1, /* (431) signed_literal ::= NK_QUESTION */ + -1, /* (432) literal_list ::= signed_literal */ + -3, /* (433) literal_list ::= literal_list NK_COMMA signed_literal */ + -1, /* (434) db_name ::= NK_ID */ + -1, /* (435) table_name ::= NK_ID */ + -1, /* (436) column_name ::= NK_ID */ + -1, /* (437) function_name ::= NK_ID */ + -1, /* (438) view_name ::= NK_ID */ + -1, /* (439) table_alias ::= NK_ID */ + -1, /* (440) column_alias ::= NK_ID */ + -1, /* (441) column_alias ::= NK_ALIAS */ + -1, /* (442) user_name ::= NK_ID */ + -1, /* (443) topic_name ::= NK_ID */ + -1, /* (444) stream_name ::= NK_ID */ + -1, /* (445) cgroup_name ::= NK_ID */ + -1, /* (446) index_name ::= NK_ID */ + -1, /* (447) expr_or_subquery ::= expression */ + -1, /* (448) expression ::= literal */ + -1, /* (449) expression ::= pseudo_column */ + -1, /* (450) expression ::= column_reference */ + -1, /* (451) expression ::= function_expression */ + -1, /* (452) expression ::= case_when_expression */ + -3, /* (453) expression ::= NK_LP expression NK_RP */ + -2, /* (454) expression ::= NK_PLUS expr_or_subquery */ + -2, /* (455) expression ::= NK_MINUS expr_or_subquery */ + -3, /* (456) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + -3, /* (457) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + -3, /* (458) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + -3, /* (459) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + -3, /* (460) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + -3, /* (461) expression ::= column_reference NK_ARROW NK_STRING */ + -3, /* (462) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + -3, /* (463) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + -1, /* (464) expression_list ::= expr_or_subquery */ + -3, /* (465) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + -1, /* (466) column_reference ::= column_name */ + -3, /* (467) column_reference ::= table_name NK_DOT column_name */ + -1, /* (468) column_reference ::= NK_ALIAS */ + -3, /* (469) column_reference ::= table_name NK_DOT NK_ALIAS */ + -1, /* (470) pseudo_column ::= ROWTS */ + -1, /* (471) pseudo_column ::= TBNAME */ + -3, /* (472) pseudo_column ::= table_name NK_DOT TBNAME */ + -1, /* (473) pseudo_column ::= QSTART */ + -1, /* (474) pseudo_column ::= QEND */ + -1, /* (475) pseudo_column ::= QDURATION */ + -1, /* (476) pseudo_column ::= WSTART */ + -1, /* (477) pseudo_column ::= WEND */ + -1, /* (478) pseudo_column ::= WDURATION */ + -1, /* (479) pseudo_column ::= IROWTS */ + -1, /* (480) pseudo_column ::= ISFILLED */ + -1, /* (481) pseudo_column ::= QTAGS */ + -4, /* (482) function_expression ::= function_name NK_LP expression_list NK_RP */ + -4, /* (483) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + -6, /* (484) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + -1, /* (485) function_expression ::= literal_func */ + -3, /* (486) literal_func ::= noarg_func NK_LP NK_RP */ + -1, /* (487) literal_func ::= NOW */ + -1, /* (488) noarg_func ::= NOW */ + -1, /* (489) noarg_func ::= TODAY */ + -1, /* (490) noarg_func ::= TIMEZONE */ + -1, /* (491) noarg_func ::= DATABASE */ + -1, /* (492) noarg_func ::= CLIENT_VERSION */ + -1, /* (493) noarg_func ::= SERVER_VERSION */ + -1, /* (494) noarg_func ::= SERVER_STATUS */ + -1, /* (495) noarg_func ::= CURRENT_USER */ + -1, /* (496) noarg_func ::= USER */ + -1, /* (497) star_func ::= COUNT */ + -1, /* (498) star_func ::= FIRST */ + -1, /* (499) star_func ::= LAST */ + -1, /* (500) star_func ::= LAST_ROW */ + -1, /* (501) star_func_para_list ::= NK_STAR */ + -1, /* (502) star_func_para_list ::= other_para_list */ + -1, /* (503) other_para_list ::= star_func_para */ + -3, /* (504) other_para_list ::= other_para_list NK_COMMA star_func_para */ + -1, /* (505) star_func_para ::= expr_or_subquery */ + -3, /* (506) star_func_para ::= table_name NK_DOT NK_STAR */ + -4, /* (507) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + -5, /* (508) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + -1, /* (509) when_then_list ::= when_then_expr */ + -2, /* (510) when_then_list ::= when_then_list when_then_expr */ + -4, /* (511) when_then_expr ::= WHEN common_expression THEN common_expression */ + 0, /* (512) case_when_else_opt ::= */ + -2, /* (513) case_when_else_opt ::= ELSE common_expression */ + -3, /* (514) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + -5, /* (515) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + -6, /* (516) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + -3, /* (517) predicate ::= expr_or_subquery IS NULL */ + -4, /* (518) predicate ::= expr_or_subquery IS NOT NULL */ + -3, /* (519) predicate ::= expr_or_subquery in_op in_predicate_value */ + -1, /* (520) compare_op ::= NK_LT */ + -1, /* (521) compare_op ::= NK_GT */ + -1, /* (522) compare_op ::= NK_LE */ + -1, /* (523) compare_op ::= NK_GE */ + -1, /* (524) compare_op ::= NK_NE */ + -1, /* (525) compare_op ::= NK_EQ */ + -1, /* (526) compare_op ::= LIKE */ + -2, /* (527) compare_op ::= NOT LIKE */ + -1, /* (528) compare_op ::= MATCH */ + -1, /* (529) compare_op ::= NMATCH */ + -1, /* (530) compare_op ::= CONTAINS */ + -1, /* (531) in_op ::= IN */ + -2, /* (532) in_op ::= NOT IN */ + -3, /* (533) in_predicate_value ::= NK_LP literal_list NK_RP */ + -1, /* (534) boolean_value_expression ::= boolean_primary */ + -2, /* (535) boolean_value_expression ::= NOT boolean_primary */ + -3, /* (536) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + -3, /* (537) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + -1, /* (538) boolean_primary ::= predicate */ + -3, /* (539) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + -1, /* (540) common_expression ::= expr_or_subquery */ + -1, /* (541) common_expression ::= boolean_value_expression */ + 0, /* (542) from_clause_opt ::= */ + -2, /* (543) from_clause_opt ::= FROM table_reference_list */ + -1, /* (544) table_reference_list ::= table_reference */ + -3, /* (545) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + -1, /* (546) table_reference ::= table_primary */ + -1, /* (547) table_reference ::= joined_table */ + -2, /* (548) table_primary ::= table_name alias_opt */ + -4, /* (549) table_primary ::= db_name NK_DOT table_name alias_opt */ + -2, /* (550) table_primary ::= subquery alias_opt */ + -1, /* (551) table_primary ::= parenthesized_joined_table */ + 0, /* (552) alias_opt ::= */ + -1, /* (553) alias_opt ::= table_alias */ + -2, /* (554) alias_opt ::= AS table_alias */ + -3, /* (555) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + -3, /* (556) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + -8, /* (557) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ + 0, /* (558) join_type ::= */ + -1, /* (559) join_type ::= INNER */ + -1, /* (560) join_type ::= LEFT */ + -1, /* (561) join_type ::= RIGHT */ + -1, /* (562) join_type ::= FULL */ + 0, /* (563) join_subtype ::= */ + -1, /* (564) join_subtype ::= OUTER */ + -1, /* (565) join_subtype ::= SEMI */ + -1, /* (566) join_subtype ::= ANTI */ + -1, /* (567) join_subtype ::= ASOF */ + -1, /* (568) join_subtype ::= WINDOW */ + 0, /* (569) join_on_clause_opt ::= */ + -2, /* (570) join_on_clause_opt ::= ON search_condition */ + 0, /* (571) window_offset_clause_opt ::= */ + -6, /* (572) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ + -1, /* (573) window_offset_literal ::= NK_VARIABLE */ + -2, /* (574) window_offset_literal ::= NK_MINUS NK_VARIABLE */ + 0, /* (575) jlimit_clause_opt ::= */ + -2, /* (576) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ + -14, /* (577) 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, /* (578) hint_list ::= */ + -1, /* (579) hint_list ::= NK_HINT */ + 0, /* (580) tag_mode_opt ::= */ + -1, /* (581) tag_mode_opt ::= TAGS */ + 0, /* (582) set_quantifier_opt ::= */ + -1, /* (583) set_quantifier_opt ::= DISTINCT */ + -1, /* (584) set_quantifier_opt ::= ALL */ + -1, /* (585) select_list ::= select_item */ + -3, /* (586) select_list ::= select_list NK_COMMA select_item */ + -1, /* (587) select_item ::= NK_STAR */ + -1, /* (588) select_item ::= common_expression */ + -2, /* (589) select_item ::= common_expression column_alias */ + -3, /* (590) select_item ::= common_expression AS column_alias */ + -3, /* (591) select_item ::= table_name NK_DOT NK_STAR */ + 0, /* (592) where_clause_opt ::= */ + -2, /* (593) where_clause_opt ::= WHERE search_condition */ + 0, /* (594) partition_by_clause_opt ::= */ + -3, /* (595) partition_by_clause_opt ::= PARTITION BY partition_list */ + -1, /* (596) partition_list ::= partition_item */ + -3, /* (597) partition_list ::= partition_list NK_COMMA partition_item */ + -1, /* (598) partition_item ::= expr_or_subquery */ + -2, /* (599) partition_item ::= expr_or_subquery column_alias */ + -3, /* (600) partition_item ::= expr_or_subquery AS column_alias */ + 0, /* (601) twindow_clause_opt ::= */ + -6, /* (602) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ + -4, /* (603) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + -6, /* (604) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + -8, /* (605) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + -7, /* (606) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 0, /* (607) sliding_opt ::= */ + -4, /* (608) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ + -1, /* (609) interval_sliding_duration_literal ::= NK_VARIABLE */ + -1, /* (610) interval_sliding_duration_literal ::= NK_STRING */ + -1, /* (611) interval_sliding_duration_literal ::= NK_INTEGER */ + 0, /* (612) fill_opt ::= */ + -4, /* (613) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + -6, /* (614) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + -6, /* (615) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + -1, /* (616) fill_mode ::= NONE */ + -1, /* (617) fill_mode ::= PREV */ + -1, /* (618) fill_mode ::= NULL */ + -1, /* (619) fill_mode ::= NULL_F */ + -1, /* (620) fill_mode ::= LINEAR */ + -1, /* (621) fill_mode ::= NEXT */ + 0, /* (622) group_by_clause_opt ::= */ + -3, /* (623) group_by_clause_opt ::= GROUP BY group_by_list */ + -1, /* (624) group_by_list ::= expr_or_subquery */ + -3, /* (625) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 0, /* (626) having_clause_opt ::= */ + -2, /* (627) having_clause_opt ::= HAVING search_condition */ + 0, /* (628) range_opt ::= */ + -6, /* (629) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + -4, /* (630) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 0, /* (631) every_opt ::= */ + -4, /* (632) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + -4, /* (633) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + -1, /* (634) query_simple ::= query_specification */ + -1, /* (635) query_simple ::= union_query_expression */ + -4, /* (636) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + -3, /* (637) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + -1, /* (638) query_simple_or_subquery ::= query_simple */ + -1, /* (639) query_simple_or_subquery ::= subquery */ + -1, /* (640) query_or_subquery ::= query_expression */ + -1, /* (641) query_or_subquery ::= subquery */ + 0, /* (642) order_by_clause_opt ::= */ + -3, /* (643) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 0, /* (644) slimit_clause_opt ::= */ + -2, /* (645) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + -4, /* (646) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + -4, /* (647) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 0, /* (648) limit_clause_opt ::= */ + -2, /* (649) limit_clause_opt ::= LIMIT NK_INTEGER */ + -4, /* (650) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + -4, /* (651) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + -3, /* (652) subquery ::= NK_LP query_expression NK_RP */ + -3, /* (653) subquery ::= NK_LP subquery NK_RP */ + -1, /* (654) search_condition ::= common_expression */ + -1, /* (655) sort_specification_list ::= sort_specification */ + -3, /* (656) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + -3, /* (657) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 0, /* (658) ordering_specification_opt ::= */ + -1, /* (659) ordering_specification_opt ::= ASC */ + -1, /* (660) ordering_specification_opt ::= DESC */ + 0, /* (661) null_ordering_opt ::= */ + -2, /* (662) null_ordering_opt ::= NULLS FIRST */ + -2, /* (663) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -4825,11 +4803,11 @@ static YYACTIONTYPE yy_reduce( YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,357,&yymsp[0].minor); + yy_destructor(yypParser,359,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,358,&yymsp[0].minor); + yy_destructor(yypParser,360,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -4843,20 +4821,20 @@ static YYACTIONTYPE yy_reduce( case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9); case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10); case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11); -{ yy_destructor(yypParser,357,&yymsp[-2].minor); +{ yy_destructor(yypParser,359,&yymsp[-2].minor); { } - yy_destructor(yypParser,359,&yymsp[0].minor); + yy_destructor(yypParser,361,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,360,&yymsp[0].minor); +{ yy_destructor(yypParser,362,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,358,&yymsp[-1].minor); +{ yy_destructor(yypParser,360,&yymsp[-1].minor); { } - yy_destructor(yypParser,360,&yymsp[0].minor); + yy_destructor(yypParser,362,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -4870,158 +4848,158 @@ static YYACTIONTYPE yy_reduce( case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); { } - yy_destructor(yypParser,359,&yymsp[0].minor); + yy_destructor(yypParser,361,&yymsp[0].minor); break; case 24: /* ip_range_list ::= NK_STRING */ -{ yylhsminor.yy964 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy964 = yylhsminor.yy964; +{ yylhsminor.yy72 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy72 = yylhsminor.yy72; break; case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ -{ yylhsminor.yy964 = addNodeToList(pCxt, yymsp[-2].minor.yy964, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy964 = yylhsminor.yy964; +{ yylhsminor.yy72 = addNodeToList(pCxt, yymsp[-2].minor.yy72, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy72 = yylhsminor.yy72; break; case 26: /* white_list ::= HOST ip_range_list */ -{ yymsp[-1].minor.yy964 = yymsp[0].minor.yy964; } +{ yymsp[-1].minor.yy72 = yymsp[0].minor.yy72; } break; case 27: /* white_list_opt ::= */ - case 186: /* specific_cols_opt ::= */ yytestcase(yyruleno==186); - case 217: /* tags_def_opt ::= */ yytestcase(yyruleno==217); - case 302: /* tag_list_opt ::= */ yytestcase(yyruleno==302); - case 368: /* col_list_opt ::= */ yytestcase(yyruleno==368); - case 370: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==370); - case 589: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==589); - case 617: /* group_by_clause_opt ::= */ yytestcase(yyruleno==617); - case 637: /* order_by_clause_opt ::= */ yytestcase(yyruleno==637); -{ yymsp[1].minor.yy964 = NULL; } + case 188: /* specific_cols_opt ::= */ yytestcase(yyruleno==188); + case 219: /* tags_def_opt ::= */ yytestcase(yyruleno==219); + case 307: /* tag_list_opt ::= */ yytestcase(yyruleno==307); + case 373: /* col_list_opt ::= */ yytestcase(yyruleno==373); + case 375: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==375); + case 594: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==594); + case 622: /* group_by_clause_opt ::= */ yytestcase(yyruleno==622); + case 642: /* order_by_clause_opt ::= */ yytestcase(yyruleno==642); +{ yymsp[1].minor.yy72 = NULL; } break; case 28: /* white_list_opt ::= white_list */ - case 218: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==218); - case 371: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==371); - case 497: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==497); -{ yylhsminor.yy964 = yymsp[0].minor.yy964; } - yymsp[0].minor.yy964 = yylhsminor.yy964; + case 220: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==220); + case 376: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==376); + case 502: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==502); +{ yylhsminor.yy72 = yymsp[0].minor.yy72; } + yymsp[0].minor.yy72 = yylhsminor.yy72; break; case 29: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt white_list_opt */ { - pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-4].minor.yy353, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy71); - pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy964); + pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-4].minor.yy305, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy359); + pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy72); } break; case 30: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy353, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy305, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 31: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy353, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy305, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } break; case 32: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy353, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy305, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 33: /* cmd ::= ALTER USER user_name ADD white_list */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy353, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy964); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy305, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy72); } break; case 34: /* cmd ::= ALTER USER user_name DROP white_list */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy353, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy964); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy305, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy72); } break; case 35: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy353); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy305); } break; case 36: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy71 = 1; } +{ yymsp[1].minor.yy359 = 1; } break; case 37: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -{ yymsp[-1].minor.yy71 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy359 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } break; case 38: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy369, &yymsp[-3].minor.yy885, &yymsp[0].minor.yy353, yymsp[-2].minor.yy884); } +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy1005, &yymsp[-3].minor.yy361, &yymsp[0].minor.yy305, yymsp[-2].minor.yy1000); } break; case 39: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy369, &yymsp[-3].minor.yy885, &yymsp[0].minor.yy353, yymsp[-2].minor.yy884); } +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy1005, &yymsp[-3].minor.yy361, &yymsp[0].minor.yy305, yymsp[-2].minor.yy1000); } break; case 40: /* privileges ::= ALL */ -{ yymsp[0].minor.yy369 = PRIVILEGE_TYPE_ALL; } +{ yymsp[0].minor.yy1005 = PRIVILEGE_TYPE_ALL; } break; case 41: /* privileges ::= priv_type_list */ case 43: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==43); -{ yylhsminor.yy369 = yymsp[0].minor.yy369; } - yymsp[0].minor.yy369 = yylhsminor.yy369; +{ yylhsminor.yy1005 = yymsp[0].minor.yy1005; } + yymsp[0].minor.yy1005 = yylhsminor.yy1005; break; case 42: /* privileges ::= SUBSCRIBE */ -{ yymsp[0].minor.yy369 = PRIVILEGE_TYPE_SUBSCRIBE; } +{ yymsp[0].minor.yy1005 = PRIVILEGE_TYPE_SUBSCRIBE; } break; case 44: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy369 = yymsp[-2].minor.yy369 | yymsp[0].minor.yy369; } - yymsp[-2].minor.yy369 = yylhsminor.yy369; +{ yylhsminor.yy1005 = yymsp[-2].minor.yy1005 | yymsp[0].minor.yy1005; } + yymsp[-2].minor.yy1005 = yylhsminor.yy1005; break; case 45: /* priv_type ::= READ */ -{ yymsp[0].minor.yy369 = PRIVILEGE_TYPE_READ; } +{ yymsp[0].minor.yy1005 = PRIVILEGE_TYPE_READ; } break; case 46: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy369 = PRIVILEGE_TYPE_WRITE; } +{ yymsp[0].minor.yy1005 = PRIVILEGE_TYPE_WRITE; } break; case 47: /* priv_type ::= ALTER */ -{ yymsp[0].minor.yy369 = PRIVILEGE_TYPE_ALTER; } +{ yymsp[0].minor.yy1005 = PRIVILEGE_TYPE_ALTER; } break; case 48: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy885.first = yymsp[-2].minor.yy0; yylhsminor.yy885.second = yymsp[0].minor.yy0; } - yymsp[-2].minor.yy885 = yylhsminor.yy885; +{ yylhsminor.yy361.first = yymsp[-2].minor.yy0; yylhsminor.yy361.second = yymsp[0].minor.yy0; } + yymsp[-2].minor.yy361 = yylhsminor.yy361; break; case 49: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy885.first = yymsp[-2].minor.yy353; yylhsminor.yy885.second = yymsp[0].minor.yy0; } - yymsp[-2].minor.yy885 = yylhsminor.yy885; +{ yylhsminor.yy361.first = yymsp[-2].minor.yy305; yylhsminor.yy361.second = yymsp[0].minor.yy0; } + yymsp[-2].minor.yy361 = yylhsminor.yy361; break; case 50: /* priv_level ::= db_name NK_DOT table_name */ -{ yylhsminor.yy885.first = yymsp[-2].minor.yy353; yylhsminor.yy885.second = yymsp[0].minor.yy353; } - yymsp[-2].minor.yy885 = yylhsminor.yy885; +{ yylhsminor.yy361.first = yymsp[-2].minor.yy305; yylhsminor.yy361.second = yymsp[0].minor.yy305; } + yymsp[-2].minor.yy361 = yylhsminor.yy361; break; case 51: /* priv_level ::= topic_name */ -{ yylhsminor.yy885.first = yymsp[0].minor.yy353; yylhsminor.yy885.second = nil_token; } - yymsp[0].minor.yy885 = yylhsminor.yy885; +{ yylhsminor.yy361.first = yymsp[0].minor.yy305; yylhsminor.yy361.second = nil_token; } + yymsp[0].minor.yy361 = yylhsminor.yy361; break; case 52: /* with_opt ::= */ - case 155: /* start_opt ::= */ yytestcase(yyruleno==155); - case 159: /* end_opt ::= */ yytestcase(yyruleno==159); - case 297: /* like_pattern_opt ::= */ yytestcase(yyruleno==297); - case 382: /* subtable_opt ::= */ yytestcase(yyruleno==382); - case 507: /* case_when_else_opt ::= */ yytestcase(yyruleno==507); - case 537: /* from_clause_opt ::= */ yytestcase(yyruleno==537); - case 564: /* join_on_clause_opt ::= */ yytestcase(yyruleno==564); - case 566: /* window_offset_clause_opt ::= */ yytestcase(yyruleno==566); - case 570: /* jlimit_clause_opt ::= */ yytestcase(yyruleno==570); - case 587: /* where_clause_opt ::= */ yytestcase(yyruleno==587); - case 596: /* twindow_clause_opt ::= */ yytestcase(yyruleno==596); - case 602: /* sliding_opt ::= */ yytestcase(yyruleno==602); - case 607: /* fill_opt ::= */ yytestcase(yyruleno==607); - case 621: /* having_clause_opt ::= */ yytestcase(yyruleno==621); - case 623: /* range_opt ::= */ yytestcase(yyruleno==623); - case 626: /* every_opt ::= */ yytestcase(yyruleno==626); - case 639: /* slimit_clause_opt ::= */ yytestcase(yyruleno==639); - case 643: /* limit_clause_opt ::= */ yytestcase(yyruleno==643); -{ yymsp[1].minor.yy884 = NULL; } + case 157: /* start_opt ::= */ yytestcase(yyruleno==157); + case 161: /* end_opt ::= */ yytestcase(yyruleno==161); + case 302: /* like_pattern_opt ::= */ yytestcase(yyruleno==302); + case 387: /* subtable_opt ::= */ yytestcase(yyruleno==387); + case 512: /* case_when_else_opt ::= */ yytestcase(yyruleno==512); + case 542: /* from_clause_opt ::= */ yytestcase(yyruleno==542); + case 569: /* join_on_clause_opt ::= */ yytestcase(yyruleno==569); + case 571: /* window_offset_clause_opt ::= */ yytestcase(yyruleno==571); + case 575: /* jlimit_clause_opt ::= */ yytestcase(yyruleno==575); + case 592: /* where_clause_opt ::= */ yytestcase(yyruleno==592); + case 601: /* twindow_clause_opt ::= */ yytestcase(yyruleno==601); + case 607: /* sliding_opt ::= */ yytestcase(yyruleno==607); + case 612: /* fill_opt ::= */ yytestcase(yyruleno==612); + case 626: /* having_clause_opt ::= */ yytestcase(yyruleno==626); + case 628: /* range_opt ::= */ yytestcase(yyruleno==628); + case 631: /* every_opt ::= */ yytestcase(yyruleno==631); + case 644: /* slimit_clause_opt ::= */ yytestcase(yyruleno==644); + case 648: /* limit_clause_opt ::= */ yytestcase(yyruleno==648); +{ yymsp[1].minor.yy1000 = NULL; } break; case 53: /* with_opt ::= WITH search_condition */ - case 538: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==538); - case 565: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==565); - case 588: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==588); - case 622: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==622); -{ yymsp[-1].minor.yy884 = yymsp[0].minor.yy884; } + case 543: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==543); + case 570: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==570); + case 593: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==593); + case 627: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==627); +{ yymsp[-1].minor.yy1000 = yymsp[0].minor.yy1000; } break; case 54: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy353, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy305, NULL); } break; case 55: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy305, &yymsp[0].minor.yy0); } break; case 56: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy461, false); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy985, false); } break; case 57: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy353, yymsp[0].minor.yy461, false); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy305, yymsp[0].minor.yy985, false); } break; case 58: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy461); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy985); } break; case 59: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy353, false, yymsp[0].minor.yy461); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy305, false, yymsp[0].minor.yy985); } break; case 60: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -5041,1650 +5019,1665 @@ static YYACTIONTYPE yy_reduce( case 65: /* dnode_endpoint ::= NK_STRING */ case 66: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==66); case 67: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==67); - case 324: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==324); - case 325: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==325); - case 326: /* sma_func_name ::= LAST */ yytestcase(yyruleno==326); - case 327: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==327); - case 429: /* db_name ::= NK_ID */ yytestcase(yyruleno==429); - case 430: /* table_name ::= NK_ID */ yytestcase(yyruleno==430); - case 431: /* column_name ::= NK_ID */ yytestcase(yyruleno==431); - case 432: /* function_name ::= NK_ID */ yytestcase(yyruleno==432); - case 433: /* view_name ::= NK_ID */ yytestcase(yyruleno==433); - case 434: /* table_alias ::= NK_ID */ yytestcase(yyruleno==434); - case 435: /* column_alias ::= NK_ID */ yytestcase(yyruleno==435); - case 436: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==436); - case 437: /* user_name ::= NK_ID */ yytestcase(yyruleno==437); - case 438: /* topic_name ::= NK_ID */ yytestcase(yyruleno==438); - case 439: /* stream_name ::= NK_ID */ yytestcase(yyruleno==439); - case 440: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==440); - case 441: /* index_name ::= NK_ID */ yytestcase(yyruleno==441); - case 483: /* noarg_func ::= NOW */ yytestcase(yyruleno==483); - case 484: /* noarg_func ::= TODAY */ yytestcase(yyruleno==484); - case 485: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==485); - case 486: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==486); - case 487: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==487); - case 488: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==488); - case 489: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==489); - case 490: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==490); - case 491: /* noarg_func ::= USER */ yytestcase(yyruleno==491); - case 492: /* star_func ::= COUNT */ yytestcase(yyruleno==492); - case 493: /* star_func ::= FIRST */ yytestcase(yyruleno==493); - case 494: /* star_func ::= LAST */ yytestcase(yyruleno==494); - case 495: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==495); -{ yylhsminor.yy353 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy353 = yylhsminor.yy353; + case 329: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==329); + case 330: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==330); + case 331: /* sma_func_name ::= LAST */ yytestcase(yyruleno==331); + case 332: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==332); + case 434: /* db_name ::= NK_ID */ yytestcase(yyruleno==434); + case 435: /* table_name ::= NK_ID */ yytestcase(yyruleno==435); + case 436: /* column_name ::= NK_ID */ yytestcase(yyruleno==436); + case 437: /* function_name ::= NK_ID */ yytestcase(yyruleno==437); + case 438: /* view_name ::= NK_ID */ yytestcase(yyruleno==438); + case 439: /* table_alias ::= NK_ID */ yytestcase(yyruleno==439); + case 440: /* column_alias ::= NK_ID */ yytestcase(yyruleno==440); + case 441: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==441); + case 442: /* user_name ::= NK_ID */ yytestcase(yyruleno==442); + case 443: /* topic_name ::= NK_ID */ yytestcase(yyruleno==443); + case 444: /* stream_name ::= NK_ID */ yytestcase(yyruleno==444); + case 445: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==445); + case 446: /* index_name ::= NK_ID */ yytestcase(yyruleno==446); + case 488: /* noarg_func ::= NOW */ yytestcase(yyruleno==488); + case 489: /* noarg_func ::= TODAY */ yytestcase(yyruleno==489); + case 490: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==490); + case 491: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==491); + case 492: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==492); + case 493: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==493); + case 494: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==494); + case 495: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==495); + case 496: /* noarg_func ::= USER */ yytestcase(yyruleno==496); + case 497: /* star_func ::= COUNT */ yytestcase(yyruleno==497); + case 498: /* star_func ::= FIRST */ yytestcase(yyruleno==498); + case 499: /* star_func ::= LAST */ yytestcase(yyruleno==499); + case 500: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==500); +{ yylhsminor.yy305 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy305 = yylhsminor.yy305; break; case 68: /* force_opt ::= */ - case 92: /* not_exists_opt ::= */ yytestcase(yyruleno==92); - case 94: /* exists_opt ::= */ yytestcase(yyruleno==94); - case 345: /* analyze_opt ::= */ yytestcase(yyruleno==345); - case 352: /* agg_func_opt ::= */ yytestcase(yyruleno==352); - case 358: /* or_replace_opt ::= */ yytestcase(yyruleno==358); - case 384: /* ignore_opt ::= */ yytestcase(yyruleno==384); - case 575: /* tag_mode_opt ::= */ yytestcase(yyruleno==575); - case 577: /* set_quantifier_opt ::= */ yytestcase(yyruleno==577); -{ yymsp[1].minor.yy461 = false; } + case 94: /* not_exists_opt ::= */ yytestcase(yyruleno==94); + case 96: /* exists_opt ::= */ yytestcase(yyruleno==96); + case 350: /* analyze_opt ::= */ yytestcase(yyruleno==350); + case 357: /* agg_func_opt ::= */ yytestcase(yyruleno==357); + case 363: /* or_replace_opt ::= */ yytestcase(yyruleno==363); + case 389: /* ignore_opt ::= */ yytestcase(yyruleno==389); + case 580: /* tag_mode_opt ::= */ yytestcase(yyruleno==580); + case 582: /* set_quantifier_opt ::= */ yytestcase(yyruleno==582); +{ yymsp[1].minor.yy985 = false; } break; case 69: /* force_opt ::= FORCE */ case 70: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==70); - case 346: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==346); - case 353: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==353); - case 576: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==576); - case 578: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==578); -{ yymsp[0].minor.yy461 = true; } + case 351: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==351); + case 358: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==358); + case 581: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==581); + case 583: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==583); +{ yymsp[0].minor.yy985 = true; } break; - case 71: /* cmd ::= ALTER LOCAL NK_STRING */ + case 71: /* cmd ::= ALTER CLUSTER NK_STRING */ +{ pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[0].minor.yy0, NULL); } + break; + case 72: /* cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ +{ pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } + break; + case 73: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 72: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + case 74: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 73: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + case 75: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); } break; - case 74: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + case 76: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); } break; - case 75: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ + case 77: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_QNODE_STMT, &yymsp[0].minor.yy0); } break; - case 76: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + case 78: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); } break; - case 77: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + case 79: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); } break; - case 78: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + case 80: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); } break; - case 79: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + case 81: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); } break; - case 80: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + case 82: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); } break; - case 81: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + case 83: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } break; - case 82: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ + case 84: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_MNODE_STMT, &yymsp[0].minor.yy0); } break; - case 83: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ + case 85: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); } break; - case 84: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy461, &yymsp[-1].minor.yy353, yymsp[0].minor.yy884); } + case 86: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy985, &yymsp[-1].minor.yy305, yymsp[0].minor.yy1000); } break; - case 85: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy461, &yymsp[0].minor.yy353); } + case 87: /* cmd ::= DROP DATABASE exists_opt db_name */ +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy985, &yymsp[0].minor.yy305); } break; - case 86: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy353); } + case 88: /* cmd ::= USE db_name */ +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy305); } break; - case 87: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy353, yymsp[0].minor.yy884); } + case 89: /* cmd ::= ALTER DATABASE db_name alter_db_options */ +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy305, yymsp[0].minor.yy1000); } break; - case 88: /* cmd ::= FLUSH DATABASE db_name */ -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy353); } + case 90: /* cmd ::= FLUSH DATABASE db_name */ +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy305); } break; - case 89: /* cmd ::= TRIM DATABASE db_name speed_opt */ -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy353, yymsp[0].minor.yy172); } + case 91: /* cmd ::= TRIM DATABASE db_name speed_opt */ +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy305, yymsp[0].minor.yy444); } break; - case 90: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ -{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy353, yymsp[-1].minor.yy884, yymsp[0].minor.yy884); } + case 92: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ +{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy305, yymsp[-1].minor.yy1000, yymsp[0].minor.yy1000); } break; - case 91: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy461 = true; } + case 93: /* not_exists_opt ::= IF NOT EXISTS */ +{ yymsp[-2].minor.yy985 = true; } break; - case 93: /* exists_opt ::= IF EXISTS */ - case 359: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==359); - case 385: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==385); -{ yymsp[-1].minor.yy461 = true; } + case 95: /* exists_opt ::= IF EXISTS */ + case 364: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==364); + case 390: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==390); +{ yymsp[-1].minor.yy985 = true; } break; - case 95: /* db_options ::= */ -{ yymsp[1].minor.yy884 = createDefaultDatabaseOptions(pCxt); } + case 97: /* db_options ::= */ +{ yymsp[1].minor.yy1000 = createDefaultDatabaseOptions(pCxt); } break; - case 96: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 98: /* db_options ::= db_options BUFFER NK_INTEGER */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 97: /* db_options ::= db_options CACHEMODEL NK_STRING */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 99: /* db_options ::= db_options CACHEMODEL NK_STRING */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 98: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 100: /* db_options ::= db_options CACHESIZE NK_INTEGER */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 99: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 101: /* db_options ::= db_options COMP NK_INTEGER */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 100: /* db_options ::= db_options DURATION NK_INTEGER */ - case 101: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==101); -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 102: /* db_options ::= db_options DURATION NK_INTEGER */ + case 103: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==103); +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 102: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 104: /* db_options ::= db_options MAXROWS NK_INTEGER */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 103: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 105: /* db_options ::= db_options MINROWS NK_INTEGER */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 104: /* db_options ::= db_options KEEP integer_list */ - case 105: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==105); -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_KEEP, yymsp[0].minor.yy964); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 106: /* db_options ::= db_options KEEP integer_list */ + case 107: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==107); +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_KEEP, yymsp[0].minor.yy72); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 106: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 108: /* db_options ::= db_options PAGES NK_INTEGER */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 107: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 109: /* db_options ::= db_options PAGESIZE NK_INTEGER */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 108: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 110: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 109: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 111: /* db_options ::= db_options PRECISION NK_STRING */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 110: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 112: /* db_options ::= db_options REPLICA NK_INTEGER */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 111: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 113: /* db_options ::= db_options VGROUPS NK_INTEGER */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 112: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 114: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 113: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_RETENTIONS, yymsp[0].minor.yy964); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 115: /* db_options ::= db_options RETENTIONS retention_list */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_RETENTIONS, yymsp[0].minor.yy72); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 114: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 116: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 115: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 117: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 116: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 118: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 117: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 119: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 118: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + case 120: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-3].minor.yy884, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-3].minor.yy1000, DB_OPTION_WAL_RETENTION_PERIOD, &t); } - yymsp[-3].minor.yy884 = yylhsminor.yy884; + yymsp[-3].minor.yy1000 = yylhsminor.yy1000; break; - case 119: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 121: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 120: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + case 122: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-3].minor.yy884, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-3].minor.yy1000, DB_OPTION_WAL_RETENTION_SIZE, &t); } - yymsp[-3].minor.yy884 = yylhsminor.yy884; + yymsp[-3].minor.yy1000 = yylhsminor.yy1000; break; - case 121: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 123: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 122: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 124: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 123: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 125: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 124: /* db_options ::= db_options TABLE_PREFIX signed */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy884); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 126: /* db_options ::= db_options TABLE_PREFIX signed */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy1000); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 125: /* db_options ::= db_options TABLE_SUFFIX signed */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy884); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 127: /* db_options ::= db_options TABLE_SUFFIX signed */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy1000); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 126: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ -{ yylhsminor.yy884 = setDatabaseOption(pCxt, yymsp[-2].minor.yy884, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 128: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ +{ yylhsminor.yy1000 = setDatabaseOption(pCxt, yymsp[-2].minor.yy1000, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 127: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy884 = createAlterDatabaseOptions(pCxt); yylhsminor.yy884 = setAlterDatabaseOption(pCxt, yylhsminor.yy884, &yymsp[0].minor.yy641); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 129: /* alter_db_options ::= alter_db_option */ +{ yylhsminor.yy1000 = createAlterDatabaseOptions(pCxt); yylhsminor.yy1000 = setAlterDatabaseOption(pCxt, yylhsminor.yy1000, &yymsp[0].minor.yy941); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 128: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy884 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy884, &yymsp[0].minor.yy641); } - yymsp[-1].minor.yy884 = yylhsminor.yy884; + case 130: /* alter_db_options ::= alter_db_options alter_db_option */ +{ yylhsminor.yy1000 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy1000, &yymsp[0].minor.yy941); } + yymsp[-1].minor.yy1000 = yylhsminor.yy1000; break; - case 129: /* alter_db_option ::= BUFFER NK_INTEGER */ -{ yymsp[-1].minor.yy641.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy641.val = yymsp[0].minor.yy0; } + case 131: /* alter_db_option ::= BUFFER NK_INTEGER */ +{ yymsp[-1].minor.yy941.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy941.val = yymsp[0].minor.yy0; } break; - case 130: /* alter_db_option ::= CACHEMODEL NK_STRING */ -{ yymsp[-1].minor.yy641.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy641.val = yymsp[0].minor.yy0; } + case 132: /* alter_db_option ::= CACHEMODEL NK_STRING */ +{ yymsp[-1].minor.yy941.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy941.val = yymsp[0].minor.yy0; } break; - case 131: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -{ yymsp[-1].minor.yy641.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy641.val = yymsp[0].minor.yy0; } + case 133: /* alter_db_option ::= CACHESIZE NK_INTEGER */ +{ yymsp[-1].minor.yy941.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy941.val = yymsp[0].minor.yy0; } break; - case 132: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ -{ yymsp[-1].minor.yy641.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy641.val = yymsp[0].minor.yy0; } + case 134: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ +{ yymsp[-1].minor.yy941.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy941.val = yymsp[0].minor.yy0; } break; - case 133: /* alter_db_option ::= KEEP integer_list */ - case 134: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==134); -{ yymsp[-1].minor.yy641.type = DB_OPTION_KEEP; yymsp[-1].minor.yy641.pList = yymsp[0].minor.yy964; } + case 135: /* alter_db_option ::= KEEP integer_list */ + case 136: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==136); +{ yymsp[-1].minor.yy941.type = DB_OPTION_KEEP; yymsp[-1].minor.yy941.pList = yymsp[0].minor.yy72; } break; - case 135: /* alter_db_option ::= PAGES NK_INTEGER */ -{ yymsp[-1].minor.yy641.type = DB_OPTION_PAGES; yymsp[-1].minor.yy641.val = yymsp[0].minor.yy0; } + case 137: /* alter_db_option ::= PAGES NK_INTEGER */ +{ yymsp[-1].minor.yy941.type = DB_OPTION_PAGES; yymsp[-1].minor.yy941.val = yymsp[0].minor.yy0; } break; - case 136: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy641.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy641.val = yymsp[0].minor.yy0; } + case 138: /* alter_db_option ::= REPLICA NK_INTEGER */ +{ yymsp[-1].minor.yy941.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy941.val = yymsp[0].minor.yy0; } break; - case 137: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ -{ yymsp[-1].minor.yy641.type = DB_OPTION_WAL; yymsp[-1].minor.yy641.val = yymsp[0].minor.yy0; } + case 139: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ +{ yymsp[-1].minor.yy941.type = DB_OPTION_WAL; yymsp[-1].minor.yy941.val = yymsp[0].minor.yy0; } break; - case 138: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ -{ yymsp[-1].minor.yy641.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy641.val = yymsp[0].minor.yy0; } + case 140: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ +{ yymsp[-1].minor.yy941.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy941.val = yymsp[0].minor.yy0; } break; - case 139: /* alter_db_option ::= MINROWS NK_INTEGER */ -{ yymsp[-1].minor.yy641.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy641.val = yymsp[0].minor.yy0; } + case 141: /* alter_db_option ::= MINROWS NK_INTEGER */ +{ yymsp[-1].minor.yy941.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy941.val = yymsp[0].minor.yy0; } break; - case 140: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ -{ yymsp[-1].minor.yy641.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy641.val = yymsp[0].minor.yy0; } + case 142: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ +{ yymsp[-1].minor.yy941.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy941.val = yymsp[0].minor.yy0; } break; - case 141: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + case 143: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yymsp[-2].minor.yy641.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy641.val = t; + yymsp[-2].minor.yy941.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy941.val = t; } break; - case 142: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ -{ yymsp[-1].minor.yy641.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy641.val = yymsp[0].minor.yy0; } + case 144: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ +{ yymsp[-1].minor.yy941.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy941.val = yymsp[0].minor.yy0; } break; - case 143: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + case 145: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yymsp[-2].minor.yy641.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy641.val = t; + yymsp[-2].minor.yy941.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy941.val = t; } break; - case 144: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ -{ yymsp[-1].minor.yy641.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy641.val = yymsp[0].minor.yy0; } - break; - case 145: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy964 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy964 = yylhsminor.yy964; - break; - case 146: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 398: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==398); -{ yylhsminor.yy964 = addNodeToList(pCxt, yymsp[-2].minor.yy964, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy964 = yylhsminor.yy964; - break; - case 147: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy964 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy964 = yylhsminor.yy964; - break; - case 148: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy964 = addNodeToList(pCxt, yymsp[-2].minor.yy964, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy964 = yylhsminor.yy964; - break; - case 149: /* retention_list ::= retention */ - case 180: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==180); - case 183: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==183); - case 190: /* column_def_list ::= column_def */ yytestcase(yyruleno==190); - case 234: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==234); - case 239: /* col_name_list ::= col_name */ yytestcase(yyruleno==239); - case 303: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==303); - case 320: /* func_list ::= func */ yytestcase(yyruleno==320); - case 427: /* literal_list ::= signed_literal */ yytestcase(yyruleno==427); - case 498: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==498); - case 504: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==504); - case 580: /* select_list ::= select_item */ yytestcase(yyruleno==580); - case 591: /* partition_list ::= partition_item */ yytestcase(yyruleno==591); - case 650: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==650); -{ yylhsminor.yy964 = createNodeList(pCxt, yymsp[0].minor.yy884); } - yymsp[0].minor.yy964 = yylhsminor.yy964; - break; - case 150: /* retention_list ::= retention_list NK_COMMA retention */ - case 184: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==184); - case 191: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==191); - case 235: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==235); - case 240: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==240); - case 304: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==304); - case 321: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==321); - case 428: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==428); - case 499: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==499); - case 581: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==581); - case 592: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==592); - case 651: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==651); -{ yylhsminor.yy964 = addNodeToList(pCxt, yymsp[-2].minor.yy964, yymsp[0].minor.yy884); } - yymsp[-2].minor.yy964 = yylhsminor.yy964; - break; - case 151: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - case 152: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==152); -{ yylhsminor.yy884 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; - break; - case 153: /* speed_opt ::= */ - case 354: /* bufsize_opt ::= */ yytestcase(yyruleno==354); -{ yymsp[1].minor.yy172 = 0; } - break; - case 154: /* speed_opt ::= BWLIMIT NK_INTEGER */ - case 355: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==355); -{ yymsp[-1].minor.yy172 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } - break; - case 156: /* start_opt ::= START WITH NK_INTEGER */ - case 160: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==160); -{ yymsp[-2].minor.yy884 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - break; - case 157: /* start_opt ::= START WITH NK_STRING */ - case 161: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==161); -{ yymsp[-2].minor.yy884 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } - break; - case 158: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ - case 162: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==162); -{ yymsp[-3].minor.yy884 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } - break; - case 163: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - case 165: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==165); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy461, yymsp[-5].minor.yy884, yymsp[-3].minor.yy964, yymsp[-1].minor.yy964, yymsp[0].minor.yy884); } - break; - case 164: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy964); } - break; - case 166: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy964); } - break; - case 167: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy461, yymsp[0].minor.yy884); } - break; - case 168: /* cmd ::= ALTER TABLE alter_table_clause */ - case 400: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==400); - case 401: /* cmd ::= insert_query */ yytestcase(yyruleno==401); -{ pCxt->pRootNode = yymsp[0].minor.yy884; } - break; - case 169: /* cmd ::= ALTER STABLE alter_table_clause */ -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy884); } - break; - case 170: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy884 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy884, yymsp[0].minor.yy884); } - yymsp[-1].minor.yy884 = yylhsminor.yy884; - break; - case 171: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy884 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy884, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy353, yymsp[0].minor.yy88); } - yymsp[-4].minor.yy884 = yylhsminor.yy884; - break; - case 172: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy884 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy884, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy353); } - yymsp[-3].minor.yy884 = yylhsminor.yy884; - break; - case 173: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy884 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy884, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy353, yymsp[0].minor.yy88); } - yymsp[-4].minor.yy884 = yylhsminor.yy884; - break; - case 174: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy884 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy884, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy353, &yymsp[0].minor.yy353); } - yymsp[-4].minor.yy884 = yylhsminor.yy884; - break; - case 175: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy884 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy884, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy353, yymsp[0].minor.yy88); } - yymsp[-4].minor.yy884 = yylhsminor.yy884; - break; - case 176: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy884 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy884, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy353); } - yymsp[-3].minor.yy884 = yylhsminor.yy884; + case 146: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ +{ yymsp[-1].minor.yy941.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy941.val = yymsp[0].minor.yy0; } + break; + case 147: /* integer_list ::= NK_INTEGER */ +{ yylhsminor.yy72 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy72 = yylhsminor.yy72; + break; + case 148: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ + case 403: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==403); +{ yylhsminor.yy72 = addNodeToList(pCxt, yymsp[-2].minor.yy72, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy72 = yylhsminor.yy72; + break; + case 149: /* variable_list ::= NK_VARIABLE */ +{ yylhsminor.yy72 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy72 = yylhsminor.yy72; + break; + case 150: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ +{ yylhsminor.yy72 = addNodeToList(pCxt, yymsp[-2].minor.yy72, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy72 = yylhsminor.yy72; + break; + case 151: /* retention_list ::= retention */ + case 182: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==182); + case 185: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==185); + case 192: /* column_def_list ::= column_def */ yytestcase(yyruleno==192); + case 236: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==236); + case 241: /* col_name_list ::= col_name */ yytestcase(yyruleno==241); + case 308: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==308); + case 325: /* func_list ::= func */ yytestcase(yyruleno==325); + case 432: /* literal_list ::= signed_literal */ yytestcase(yyruleno==432); + case 503: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==503); + case 509: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==509); + case 585: /* select_list ::= select_item */ yytestcase(yyruleno==585); + case 596: /* partition_list ::= partition_item */ yytestcase(yyruleno==596); + case 655: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==655); +{ yylhsminor.yy72 = createNodeList(pCxt, yymsp[0].minor.yy1000); } + yymsp[0].minor.yy72 = yylhsminor.yy72; + break; + case 152: /* retention_list ::= retention_list NK_COMMA retention */ + case 186: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==186); + case 193: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==193); + case 237: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==237); + case 242: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==242); + case 309: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==309); + case 326: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==326); + case 433: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==433); + case 504: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==504); + case 586: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==586); + case 597: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==597); + case 656: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==656); +{ yylhsminor.yy72 = addNodeToList(pCxt, yymsp[-2].minor.yy72, yymsp[0].minor.yy1000); } + yymsp[-2].minor.yy72 = yylhsminor.yy72; + break; + case 153: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + case 154: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==154); +{ yylhsminor.yy1000 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; + break; + case 155: /* speed_opt ::= */ + case 359: /* bufsize_opt ::= */ yytestcase(yyruleno==359); +{ yymsp[1].minor.yy444 = 0; } + break; + case 156: /* speed_opt ::= BWLIMIT NK_INTEGER */ + case 360: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==360); +{ yymsp[-1].minor.yy444 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } + break; + case 158: /* start_opt ::= START WITH NK_INTEGER */ + case 162: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==162); +{ yymsp[-2].minor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + break; + case 159: /* start_opt ::= START WITH NK_STRING */ + case 163: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==163); +{ yymsp[-2].minor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + break; + case 160: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ + case 164: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==164); +{ yymsp[-3].minor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + break; + case 165: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + case 167: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==167); +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy985, yymsp[-5].minor.yy1000, yymsp[-3].minor.yy72, yymsp[-1].minor.yy72, yymsp[0].minor.yy1000); } + break; + case 166: /* cmd ::= CREATE TABLE multi_create_clause */ +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy72); } + break; + case 168: /* cmd ::= DROP TABLE multi_drop_clause */ +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy72); } + break; + case 169: /* cmd ::= DROP STABLE exists_opt full_table_name */ +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy985, yymsp[0].minor.yy1000); } + break; + case 170: /* cmd ::= ALTER TABLE alter_table_clause */ + case 405: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==405); + case 406: /* cmd ::= insert_query */ yytestcase(yyruleno==406); +{ pCxt->pRootNode = yymsp[0].minor.yy1000; } + break; + case 171: /* cmd ::= ALTER STABLE alter_table_clause */ +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy1000); } + break; + case 172: /* alter_table_clause ::= full_table_name alter_table_options */ +{ yylhsminor.yy1000 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy1000, yymsp[0].minor.yy1000); } + yymsp[-1].minor.yy1000 = yylhsminor.yy1000; + break; + case 173: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ +{ yylhsminor.yy1000 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy1000, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy305, yymsp[0].minor.yy56); } + yymsp[-4].minor.yy1000 = yylhsminor.yy1000; + break; + case 174: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ +{ yylhsminor.yy1000 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy1000, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy305); } + yymsp[-3].minor.yy1000 = yylhsminor.yy1000; + break; + case 175: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ +{ yylhsminor.yy1000 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy1000, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy305, yymsp[0].minor.yy56); } + yymsp[-4].minor.yy1000 = yylhsminor.yy1000; + break; + case 176: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ +{ yylhsminor.yy1000 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy1000, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy305, &yymsp[0].minor.yy305); } + yymsp[-4].minor.yy1000 = yylhsminor.yy1000; + break; + case 177: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ +{ yylhsminor.yy1000 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy1000, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy305, yymsp[0].minor.yy56); } + yymsp[-4].minor.yy1000 = yylhsminor.yy1000; + break; + case 178: /* alter_table_clause ::= full_table_name DROP TAG column_name */ +{ yylhsminor.yy1000 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy1000, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy305); } + yymsp[-3].minor.yy1000 = yylhsminor.yy1000; break; - case 177: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy884 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy884, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy353, yymsp[0].minor.yy88); } - yymsp[-4].minor.yy884 = yylhsminor.yy884; + case 179: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ +{ yylhsminor.yy1000 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy1000, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy305, yymsp[0].minor.yy56); } + yymsp[-4].minor.yy1000 = yylhsminor.yy1000; break; - case 178: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy884 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy884, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy353, &yymsp[0].minor.yy353); } - yymsp[-4].minor.yy884 = yylhsminor.yy884; + case 180: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ +{ yylhsminor.yy1000 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy1000, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy305, &yymsp[0].minor.yy305); } + yymsp[-4].minor.yy1000 = yylhsminor.yy1000; break; - case 179: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -{ yylhsminor.yy884 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy884, &yymsp[-2].minor.yy353, yymsp[0].minor.yy884); } - yymsp[-5].minor.yy884 = yylhsminor.yy884; + case 181: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ +{ yylhsminor.yy1000 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy1000, &yymsp[-2].minor.yy305, yymsp[0].minor.yy1000); } + yymsp[-5].minor.yy1000 = yylhsminor.yy1000; break; - case 181: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 505: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==505); -{ yylhsminor.yy964 = addNodeToList(pCxt, yymsp[-1].minor.yy964, yymsp[0].minor.yy884); } - yymsp[-1].minor.yy964 = yylhsminor.yy964; + case 183: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ + case 510: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==510); +{ yylhsminor.yy72 = addNodeToList(pCxt, yymsp[-1].minor.yy72, yymsp[0].minor.yy1000); } + yymsp[-1].minor.yy72 = yylhsminor.yy72; break; - case 182: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ -{ yylhsminor.yy884 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy461, yymsp[-8].minor.yy884, yymsp[-6].minor.yy884, yymsp[-5].minor.yy964, yymsp[-2].minor.yy964, yymsp[0].minor.yy884); } - yymsp[-9].minor.yy884 = yylhsminor.yy884; + case 184: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ +{ yylhsminor.yy1000 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy985, yymsp[-8].minor.yy1000, yymsp[-6].minor.yy1000, yymsp[-5].minor.yy72, yymsp[-2].minor.yy72, yymsp[0].minor.yy1000); } + yymsp[-9].minor.yy1000 = yylhsminor.yy1000; break; - case 185: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy884 = createDropTableClause(pCxt, yymsp[-1].minor.yy461, yymsp[0].minor.yy884); } - yymsp[-1].minor.yy884 = yylhsminor.yy884; + case 187: /* drop_table_clause ::= exists_opt full_table_name */ +{ yylhsminor.yy1000 = createDropTableClause(pCxt, yymsp[-1].minor.yy985, yymsp[0].minor.yy1000); } + yymsp[-1].minor.yy1000 = yylhsminor.yy1000; break; - case 187: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ - case 369: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==369); -{ yymsp[-2].minor.yy964 = yymsp[-1].minor.yy964; } + case 189: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ + case 374: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==374); +{ yymsp[-2].minor.yy72 = yymsp[-1].minor.yy72; } break; - case 188: /* full_table_name ::= table_name */ -{ yylhsminor.yy884 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy353, NULL); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 190: /* full_table_name ::= table_name */ +{ yylhsminor.yy1000 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy305, NULL); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 189: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy884 = createRealTableNode(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy353, NULL); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 191: /* full_table_name ::= db_name NK_DOT table_name */ +{ yylhsminor.yy1000 = createRealTableNode(pCxt, &yymsp[-2].minor.yy305, &yymsp[0].minor.yy305, NULL); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 192: /* column_def ::= column_name type_name */ -{ yylhsminor.yy884 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy353, yymsp[0].minor.yy88, NULL); } - yymsp[-1].minor.yy884 = yylhsminor.yy884; + case 194: /* column_def ::= column_name type_name */ +{ yylhsminor.yy1000 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy305, yymsp[0].minor.yy56, NULL); } + yymsp[-1].minor.yy1000 = yylhsminor.yy1000; break; - case 193: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy88 = createDataType(TSDB_DATA_TYPE_BOOL); } + case 195: /* type_name ::= BOOL */ +{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_BOOL); } break; - case 194: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy88 = createDataType(TSDB_DATA_TYPE_TINYINT); } + case 196: /* type_name ::= TINYINT */ +{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; - case 195: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy88 = createDataType(TSDB_DATA_TYPE_SMALLINT); } + case 197: /* type_name ::= SMALLINT */ +{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; - case 196: /* type_name ::= INT */ - case 197: /* type_name ::= INTEGER */ yytestcase(yyruleno==197); -{ yymsp[0].minor.yy88 = createDataType(TSDB_DATA_TYPE_INT); } + case 198: /* type_name ::= INT */ + case 199: /* type_name ::= INTEGER */ yytestcase(yyruleno==199); +{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_INT); } break; - case 198: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy88 = createDataType(TSDB_DATA_TYPE_BIGINT); } + case 200: /* type_name ::= BIGINT */ +{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; - case 199: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy88 = createDataType(TSDB_DATA_TYPE_FLOAT); } + case 201: /* type_name ::= FLOAT */ +{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; - case 200: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy88 = createDataType(TSDB_DATA_TYPE_DOUBLE); } + case 202: /* type_name ::= DOUBLE */ +{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; - case 201: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy88 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } + case 203: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy56 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; - case 202: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy88 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } + case 204: /* type_name ::= TIMESTAMP */ +{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; - case 203: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy88 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } + case 205: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy56 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; - case 204: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy88 = createDataType(TSDB_DATA_TYPE_UTINYINT); } + case 206: /* type_name ::= TINYINT UNSIGNED */ +{ yymsp[-1].minor.yy56 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; - case 205: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy88 = createDataType(TSDB_DATA_TYPE_USMALLINT); } + case 207: /* type_name ::= SMALLINT UNSIGNED */ +{ yymsp[-1].minor.yy56 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; - case 206: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy88 = createDataType(TSDB_DATA_TYPE_UINT); } + case 208: /* type_name ::= INT UNSIGNED */ +{ yymsp[-1].minor.yy56 = createDataType(TSDB_DATA_TYPE_UINT); } break; - case 207: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy88 = createDataType(TSDB_DATA_TYPE_UBIGINT); } + case 209: /* type_name ::= BIGINT UNSIGNED */ +{ yymsp[-1].minor.yy56 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; - case 208: /* type_name ::= JSON */ -{ yymsp[0].minor.yy88 = createDataType(TSDB_DATA_TYPE_JSON); } + case 210: /* type_name ::= JSON */ +{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_JSON); } break; - case 209: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy88 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } + case 211: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy56 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; - case 210: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy88 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } + case 212: /* type_name ::= MEDIUMBLOB */ +{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; - case 211: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy88 = createDataType(TSDB_DATA_TYPE_BLOB); } + case 213: /* type_name ::= BLOB */ +{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_BLOB); } break; - case 212: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy88 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } + case 214: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy56 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; - case 213: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy88 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } + case 215: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy56 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } break; - case 214: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy88 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 216: /* type_name ::= DECIMAL */ +{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 215: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy88 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 217: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy56 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 216: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy88 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 218: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy56 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 219: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ - case 372: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==372); -{ yymsp[-3].minor.yy964 = yymsp[-1].minor.yy964; } + case 221: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ + case 377: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==377); +{ yymsp[-3].minor.yy72 = yymsp[-1].minor.yy72; } break; - case 220: /* table_options ::= */ -{ yymsp[1].minor.yy884 = createDefaultTableOptions(pCxt); } + case 222: /* table_options ::= */ +{ yymsp[1].minor.yy1000 = createDefaultTableOptions(pCxt); } break; - case 221: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy884 = setTableOption(pCxt, yymsp[-2].minor.yy884, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 223: /* table_options ::= table_options COMMENT NK_STRING */ +{ yylhsminor.yy1000 = setTableOption(pCxt, yymsp[-2].minor.yy1000, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 222: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy884 = setTableOption(pCxt, yymsp[-2].minor.yy884, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy964); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 224: /* table_options ::= table_options MAX_DELAY duration_list */ +{ yylhsminor.yy1000 = setTableOption(pCxt, yymsp[-2].minor.yy1000, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy72); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 223: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy884 = setTableOption(pCxt, yymsp[-2].minor.yy884, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy964); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 225: /* table_options ::= table_options WATERMARK duration_list */ +{ yylhsminor.yy1000 = setTableOption(pCxt, yymsp[-2].minor.yy1000, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy72); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 224: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy884 = setTableOption(pCxt, yymsp[-4].minor.yy884, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy964); } - yymsp[-4].minor.yy884 = yylhsminor.yy884; + case 226: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ +{ yylhsminor.yy1000 = setTableOption(pCxt, yymsp[-4].minor.yy1000, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy72); } + yymsp[-4].minor.yy1000 = yylhsminor.yy1000; break; - case 225: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy884 = setTableOption(pCxt, yymsp[-2].minor.yy884, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 227: /* table_options ::= table_options TTL NK_INTEGER */ +{ yylhsminor.yy1000 = setTableOption(pCxt, yymsp[-2].minor.yy1000, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 226: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy884 = setTableOption(pCxt, yymsp[-4].minor.yy884, TABLE_OPTION_SMA, yymsp[-1].minor.yy964); } - yymsp[-4].minor.yy884 = yylhsminor.yy884; + case 228: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ +{ yylhsminor.yy1000 = setTableOption(pCxt, yymsp[-4].minor.yy1000, TABLE_OPTION_SMA, yymsp[-1].minor.yy72); } + yymsp[-4].minor.yy1000 = yylhsminor.yy1000; break; - case 227: /* table_options ::= table_options DELETE_MARK duration_list */ -{ yylhsminor.yy884 = setTableOption(pCxt, yymsp[-2].minor.yy884, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy964); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 229: /* table_options ::= table_options DELETE_MARK duration_list */ +{ yylhsminor.yy1000 = setTableOption(pCxt, yymsp[-2].minor.yy1000, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy72); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 228: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy884 = createAlterTableOptions(pCxt); yylhsminor.yy884 = setTableOption(pCxt, yylhsminor.yy884, yymsp[0].minor.yy641.type, &yymsp[0].minor.yy641.val); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 230: /* alter_table_options ::= alter_table_option */ +{ yylhsminor.yy1000 = createAlterTableOptions(pCxt); yylhsminor.yy1000 = setTableOption(pCxt, yylhsminor.yy1000, yymsp[0].minor.yy941.type, &yymsp[0].minor.yy941.val); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 229: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy884 = setTableOption(pCxt, yymsp[-1].minor.yy884, yymsp[0].minor.yy641.type, &yymsp[0].minor.yy641.val); } - yymsp[-1].minor.yy884 = yylhsminor.yy884; + case 231: /* alter_table_options ::= alter_table_options alter_table_option */ +{ yylhsminor.yy1000 = setTableOption(pCxt, yymsp[-1].minor.yy1000, yymsp[0].minor.yy941.type, &yymsp[0].minor.yy941.val); } + yymsp[-1].minor.yy1000 = yylhsminor.yy1000; break; - case 230: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy641.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy641.val = yymsp[0].minor.yy0; } + case 232: /* alter_table_option ::= COMMENT NK_STRING */ +{ yymsp[-1].minor.yy941.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy941.val = yymsp[0].minor.yy0; } break; - case 231: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy641.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy641.val = yymsp[0].minor.yy0; } + case 233: /* alter_table_option ::= TTL NK_INTEGER */ +{ yymsp[-1].minor.yy941.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy941.val = yymsp[0].minor.yy0; } break; - case 232: /* duration_list ::= duration_literal */ - case 459: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==459); -{ yylhsminor.yy964 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy884)); } - yymsp[0].minor.yy964 = yylhsminor.yy964; + case 234: /* duration_list ::= duration_literal */ + case 464: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==464); +{ yylhsminor.yy72 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy1000)); } + yymsp[0].minor.yy72 = yylhsminor.yy72; break; - case 233: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 460: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==460); -{ yylhsminor.yy964 = addNodeToList(pCxt, yymsp[-2].minor.yy964, releaseRawExprNode(pCxt, yymsp[0].minor.yy884)); } - yymsp[-2].minor.yy964 = yylhsminor.yy964; + case 235: /* duration_list ::= duration_list NK_COMMA duration_literal */ + case 465: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==465); +{ yylhsminor.yy72 = addNodeToList(pCxt, yymsp[-2].minor.yy72, releaseRawExprNode(pCxt, yymsp[0].minor.yy1000)); } + yymsp[-2].minor.yy72 = yylhsminor.yy72; break; - case 236: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy884 = createFunctionNode(pCxt, &yymsp[0].minor.yy353, NULL); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 238: /* rollup_func_name ::= function_name */ +{ yylhsminor.yy1000 = createFunctionNode(pCxt, &yymsp[0].minor.yy305, NULL); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 237: /* rollup_func_name ::= FIRST */ - case 238: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==238); - case 306: /* tag_item ::= QTAGS */ yytestcase(yyruleno==306); -{ yylhsminor.yy884 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 239: /* rollup_func_name ::= FIRST */ + case 240: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==240); + case 311: /* tag_item ::= QTAGS */ yytestcase(yyruleno==311); +{ yylhsminor.yy1000 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 241: /* col_name ::= column_name */ - case 307: /* tag_item ::= column_name */ yytestcase(yyruleno==307); -{ yylhsminor.yy884 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy353); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 243: /* col_name ::= column_name */ + case 312: /* tag_item ::= column_name */ yytestcase(yyruleno==312); +{ yylhsminor.yy1000 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy305); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 242: /* cmd ::= SHOW DNODES */ + case 244: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } break; - case 243: /* cmd ::= SHOW USERS */ + case 245: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } break; - case 244: /* cmd ::= SHOW USER PRIVILEGES */ + case 246: /* cmd ::= SHOW USER PRIVILEGES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } break; - case 245: /* cmd ::= SHOW db_kind_opt DATABASES */ + case 247: /* cmd ::= SHOW db_kind_opt DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); - setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy393); + setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy761); } break; - case 246: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ + case 248: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ { - pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy637, yymsp[0].minor.yy884, OP_TYPE_LIKE); + pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy517, yymsp[0].minor.yy1000, OP_TYPE_LIKE); } break; - case 247: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy884, yymsp[0].minor.yy884, OP_TYPE_LIKE); } + case 249: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy1000, yymsp[0].minor.yy1000, OP_TYPE_LIKE); } break; - case 248: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy884, NULL, OP_TYPE_LIKE); } + case 250: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy1000, NULL, OP_TYPE_LIKE); } break; - case 249: /* cmd ::= SHOW MNODES */ + case 251: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } break; - case 250: /* cmd ::= SHOW QNODES */ + case 252: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } break; - case 251: /* cmd ::= SHOW FUNCTIONS */ + case 253: /* cmd ::= SHOW FUNCTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; - case 252: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy884, yymsp[-1].minor.yy884, OP_TYPE_EQUAL); } + case 254: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy1000, yymsp[-1].minor.yy1000, OP_TYPE_EQUAL); } break; - case 253: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy353), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy353), OP_TYPE_EQUAL); } + case 255: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy305), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy305), OP_TYPE_EQUAL); } break; - case 254: /* cmd ::= SHOW STREAMS */ + case 256: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } break; - case 255: /* cmd ::= SHOW ACCOUNTS */ + case 257: /* cmd ::= SHOW ACCOUNTS */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } break; - case 256: /* cmd ::= SHOW APPS */ + case 258: /* cmd ::= SHOW APPS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } break; - case 257: /* cmd ::= SHOW CONNECTIONS */ + case 259: /* cmd ::= SHOW CONNECTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } break; - case 258: /* cmd ::= SHOW LICENCES */ - case 259: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==259); + case 260: /* cmd ::= SHOW LICENCES */ + case 261: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==261); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } break; - case 260: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy353); } + case 262: /* cmd ::= SHOW GRANTS FULL */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_FULL_STMT); } break; - case 261: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy884); } + case 263: /* cmd ::= SHOW GRANTS LOGS */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_LOGS_STMT); } break; - case 262: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy884); } + case 264: /* cmd ::= SHOW CLUSTER MACHINES */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); } break; - case 263: /* cmd ::= SHOW QUERIES */ + case 265: /* cmd ::= SHOW CREATE DATABASE db_name */ +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy305); } + break; + case 266: /* cmd ::= SHOW CREATE TABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy1000); } + break; + case 267: /* cmd ::= SHOW CREATE STABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy1000); } + break; + case 268: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } break; - case 264: /* cmd ::= SHOW SCORES */ + case 269: /* cmd ::= SHOW SCORES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } break; - case 265: /* cmd ::= SHOW TOPICS */ + case 270: /* cmd ::= SHOW TOPICS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } break; - case 266: /* cmd ::= SHOW VARIABLES */ - case 267: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==267); + case 271: /* cmd ::= SHOW VARIABLES */ + case 272: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==272); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } break; - case 268: /* cmd ::= SHOW LOCAL VARIABLES */ + case 273: /* cmd ::= SHOW LOCAL VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } break; - case 269: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy884); } + case 274: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy1000); } break; - case 270: /* cmd ::= SHOW BNODES */ + case 275: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } break; - case 271: /* cmd ::= SHOW SNODES */ + case 276: /* cmd ::= SHOW SNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } break; - case 272: /* cmd ::= SHOW CLUSTER */ + case 277: /* cmd ::= SHOW CLUSTER */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } break; - case 273: /* cmd ::= SHOW TRANSACTIONS */ + case 278: /* cmd ::= SHOW TRANSACTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; - case 274: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy884); } + case 279: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy1000); } break; - case 275: /* cmd ::= SHOW CONSUMERS */ + case 280: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } break; - case 276: /* cmd ::= SHOW SUBSCRIPTIONS */ + case 281: /* cmd ::= SHOW SUBSCRIPTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } break; - case 277: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy884, yymsp[-1].minor.yy884, OP_TYPE_EQUAL); } + case 282: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy1000, yymsp[-1].minor.yy1000, OP_TYPE_EQUAL); } break; - case 278: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy353), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy353), OP_TYPE_EQUAL); } + case 283: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy305), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy305), OP_TYPE_EQUAL); } break; - case 279: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy884, yymsp[0].minor.yy884, yymsp[-3].minor.yy964); } + case 284: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy1000, yymsp[0].minor.yy1000, yymsp[-3].minor.yy72); } break; - case 280: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy353), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy353), yymsp[-4].minor.yy964); } + case 285: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy305), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy305), yymsp[-4].minor.yy72); } break; - case 281: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + case 286: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } break; - case 282: /* cmd ::= SHOW VNODES */ + case 287: /* cmd ::= SHOW VNODES */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } break; - case 283: /* cmd ::= SHOW db_name_cond_opt ALIVE */ -{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy884, QUERY_NODE_SHOW_DB_ALIVE_STMT); } + case 288: /* cmd ::= SHOW db_name_cond_opt ALIVE */ +{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy1000, QUERY_NODE_SHOW_DB_ALIVE_STMT); } break; - case 284: /* cmd ::= SHOW CLUSTER ALIVE */ + case 289: /* cmd ::= SHOW CLUSTER ALIVE */ { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } break; - case 285: /* cmd ::= SHOW db_name_cond_opt VIEWS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-1].minor.yy884, NULL, OP_TYPE_LIKE); } + case 290: /* cmd ::= SHOW db_name_cond_opt VIEWS */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-1].minor.yy1000, NULL, OP_TYPE_LIKE); } break; - case 286: /* cmd ::= SHOW CREATE VIEW full_table_name */ -{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy884); } + case 291: /* cmd ::= SHOW CREATE VIEW full_table_name */ +{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy1000); } break; - case 287: /* cmd ::= SHOW COMPACTS */ + case 292: /* cmd ::= SHOW COMPACTS */ { pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); } break; - case 288: /* cmd ::= SHOW COMPACT NK_INTEGER */ + case 293: /* cmd ::= SHOW COMPACT NK_INTEGER */ { pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 289: /* table_kind_db_name_cond_opt ::= */ -{ yymsp[1].minor.yy637.kind = SHOW_KIND_ALL; yymsp[1].minor.yy637.dbName = nil_token; } + case 294: /* table_kind_db_name_cond_opt ::= */ +{ yymsp[1].minor.yy517.kind = SHOW_KIND_ALL; yymsp[1].minor.yy517.dbName = nil_token; } break; - case 290: /* table_kind_db_name_cond_opt ::= table_kind */ -{ yylhsminor.yy637.kind = yymsp[0].minor.yy393; yylhsminor.yy637.dbName = nil_token; } - yymsp[0].minor.yy637 = yylhsminor.yy637; + case 295: /* table_kind_db_name_cond_opt ::= table_kind */ +{ yylhsminor.yy517.kind = yymsp[0].minor.yy761; yylhsminor.yy517.dbName = nil_token; } + yymsp[0].minor.yy517 = yylhsminor.yy517; break; - case 291: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy637.kind = SHOW_KIND_ALL; yylhsminor.yy637.dbName = yymsp[-1].minor.yy353; } - yymsp[-1].minor.yy637 = yylhsminor.yy637; + case 296: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy517.kind = SHOW_KIND_ALL; yylhsminor.yy517.dbName = yymsp[-1].minor.yy305; } + yymsp[-1].minor.yy517 = yylhsminor.yy517; break; - case 292: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ -{ yylhsminor.yy637.kind = yymsp[-2].minor.yy393; yylhsminor.yy637.dbName = yymsp[-1].minor.yy353; } - yymsp[-2].minor.yy637 = yylhsminor.yy637; + case 297: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ +{ yylhsminor.yy517.kind = yymsp[-2].minor.yy761; yylhsminor.yy517.dbName = yymsp[-1].minor.yy305; } + yymsp[-2].minor.yy517 = yylhsminor.yy517; break; - case 293: /* table_kind ::= NORMAL */ -{ yymsp[0].minor.yy393 = SHOW_KIND_TABLES_NORMAL; } + case 298: /* table_kind ::= NORMAL */ +{ yymsp[0].minor.yy761 = SHOW_KIND_TABLES_NORMAL; } break; - case 294: /* table_kind ::= CHILD */ -{ yymsp[0].minor.yy393 = SHOW_KIND_TABLES_CHILD; } + case 299: /* table_kind ::= CHILD */ +{ yymsp[0].minor.yy761 = SHOW_KIND_TABLES_CHILD; } break; - case 295: /* db_name_cond_opt ::= */ - case 300: /* from_db_opt ::= */ yytestcase(yyruleno==300); -{ yymsp[1].minor.yy884 = createDefaultDatabaseCondValue(pCxt); } + case 300: /* db_name_cond_opt ::= */ + case 305: /* from_db_opt ::= */ yytestcase(yyruleno==305); +{ yymsp[1].minor.yy1000 = createDefaultDatabaseCondValue(pCxt); } break; - case 296: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy884 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy353); } - yymsp[-1].minor.yy884 = yylhsminor.yy884; + case 301: /* db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy1000 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy305); } + yymsp[-1].minor.yy1000 = yylhsminor.yy1000; break; - case 298: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy884 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 303: /* like_pattern_opt ::= LIKE NK_STRING */ +{ yymsp[-1].minor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 299: /* table_name_cond ::= table_name */ -{ yylhsminor.yy884 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy353); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 304: /* table_name_cond ::= table_name */ +{ yylhsminor.yy1000 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy305); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 301: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy884 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy353); } + case 306: /* from_db_opt ::= FROM db_name */ +{ yymsp[-1].minor.yy1000 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy305); } break; - case 305: /* tag_item ::= TBNAME */ -{ yylhsminor.yy884 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 310: /* tag_item ::= TBNAME */ +{ yylhsminor.yy1000 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 308: /* tag_item ::= column_name column_alias */ -{ yylhsminor.yy884 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy353), &yymsp[0].minor.yy353); } - yymsp[-1].minor.yy884 = yylhsminor.yy884; + case 313: /* tag_item ::= column_name column_alias */ +{ yylhsminor.yy1000 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy305), &yymsp[0].minor.yy305); } + yymsp[-1].minor.yy1000 = yylhsminor.yy1000; break; - case 309: /* tag_item ::= column_name AS column_alias */ -{ yylhsminor.yy884 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy353), &yymsp[0].minor.yy353); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 314: /* tag_item ::= column_name AS column_alias */ +{ yylhsminor.yy1000 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy305), &yymsp[0].minor.yy305); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 310: /* db_kind_opt ::= */ -{ yymsp[1].minor.yy393 = SHOW_KIND_ALL; } + case 315: /* db_kind_opt ::= */ +{ yymsp[1].minor.yy761 = SHOW_KIND_ALL; } break; - case 311: /* db_kind_opt ::= USER */ -{ yymsp[0].minor.yy393 = SHOW_KIND_DATABASES_USER; } + case 316: /* db_kind_opt ::= USER */ +{ yymsp[0].minor.yy761 = SHOW_KIND_DATABASES_USER; } break; - case 312: /* db_kind_opt ::= SYSTEM */ -{ yymsp[0].minor.yy393 = SHOW_KIND_DATABASES_SYSTEM; } + case 317: /* db_kind_opt ::= SYSTEM */ +{ yymsp[0].minor.yy761 = SHOW_KIND_DATABASES_SYSTEM; } break; - case 313: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy461, yymsp[-3].minor.yy884, yymsp[-1].minor.yy884, NULL, yymsp[0].minor.yy884); } + case 318: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy985, yymsp[-3].minor.yy1000, yymsp[-1].minor.yy1000, NULL, yymsp[0].minor.yy1000); } break; - case 314: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy461, yymsp[-5].minor.yy884, yymsp[-3].minor.yy884, yymsp[-1].minor.yy964, NULL); } + case 319: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy985, yymsp[-5].minor.yy1000, yymsp[-3].minor.yy1000, yymsp[-1].minor.yy72, NULL); } break; - case 315: /* cmd ::= DROP INDEX exists_opt full_index_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy461, yymsp[0].minor.yy884); } + case 320: /* cmd ::= DROP INDEX exists_opt full_index_name */ +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy985, yymsp[0].minor.yy1000); } break; - case 316: /* full_index_name ::= index_name */ -{ yylhsminor.yy884 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy353); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 321: /* full_index_name ::= index_name */ +{ yylhsminor.yy1000 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy305); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 317: /* full_index_name ::= db_name NK_DOT index_name */ -{ yylhsminor.yy884 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy353); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 322: /* full_index_name ::= db_name NK_DOT index_name */ +{ yylhsminor.yy1000 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy305, &yymsp[0].minor.yy305); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 318: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-9].minor.yy884 = createIndexOption(pCxt, yymsp[-7].minor.yy964, releaseRawExprNode(pCxt, yymsp[-3].minor.yy884), NULL, yymsp[-1].minor.yy884, yymsp[0].minor.yy884); } + case 323: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ +{ yymsp[-9].minor.yy1000 = createIndexOption(pCxt, yymsp[-7].minor.yy72, releaseRawExprNode(pCxt, yymsp[-3].minor.yy1000), NULL, yymsp[-1].minor.yy1000, yymsp[0].minor.yy1000); } break; - case 319: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-11].minor.yy884 = createIndexOption(pCxt, yymsp[-9].minor.yy964, releaseRawExprNode(pCxt, yymsp[-5].minor.yy884), releaseRawExprNode(pCxt, yymsp[-3].minor.yy884), yymsp[-1].minor.yy884, yymsp[0].minor.yy884); } + case 324: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ +{ yymsp[-11].minor.yy1000 = createIndexOption(pCxt, yymsp[-9].minor.yy72, releaseRawExprNode(pCxt, yymsp[-5].minor.yy1000), releaseRawExprNode(pCxt, yymsp[-3].minor.yy1000), yymsp[-1].minor.yy1000, yymsp[0].minor.yy1000); } break; - case 322: /* func ::= sma_func_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy884 = createFunctionNode(pCxt, &yymsp[-3].minor.yy353, yymsp[-1].minor.yy964); } - yymsp[-3].minor.yy884 = yylhsminor.yy884; + case 327: /* func ::= sma_func_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy1000 = createFunctionNode(pCxt, &yymsp[-3].minor.yy305, yymsp[-1].minor.yy72); } + yymsp[-3].minor.yy1000 = yylhsminor.yy1000; break; - case 323: /* sma_func_name ::= function_name */ - case 548: /* alias_opt ::= table_alias */ yytestcase(yyruleno==548); -{ yylhsminor.yy353 = yymsp[0].minor.yy353; } - yymsp[0].minor.yy353 = yylhsminor.yy353; + case 328: /* sma_func_name ::= function_name */ + case 553: /* alias_opt ::= table_alias */ yytestcase(yyruleno==553); +{ yylhsminor.yy305 = yymsp[0].minor.yy305; } + yymsp[0].minor.yy305 = yylhsminor.yy305; break; - case 328: /* sma_stream_opt ::= */ - case 373: /* stream_options ::= */ yytestcase(yyruleno==373); -{ yymsp[1].minor.yy884 = createStreamOptions(pCxt); } + case 333: /* sma_stream_opt ::= */ + case 378: /* stream_options ::= */ yytestcase(yyruleno==378); +{ yymsp[1].minor.yy1000 = createStreamOptions(pCxt); } break; - case 329: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy884)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy884); yylhsminor.yy884 = yymsp[-2].minor.yy884; } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 334: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy1000)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy1000); yylhsminor.yy1000 = yymsp[-2].minor.yy1000; } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 330: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy884)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy884); yylhsminor.yy884 = yymsp[-2].minor.yy884; } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 335: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy1000)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy1000); yylhsminor.yy1000 = yymsp[-2].minor.yy1000; } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 331: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy884)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy884); yylhsminor.yy884 = yymsp[-2].minor.yy884; } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 336: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy1000)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy1000); yylhsminor.yy1000 = yymsp[-2].minor.yy1000; } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 332: /* with_meta ::= AS */ -{ yymsp[0].minor.yy172 = 0; } + case 337: /* with_meta ::= AS */ +{ yymsp[0].minor.yy444 = 0; } break; - case 333: /* with_meta ::= WITH META AS */ -{ yymsp[-2].minor.yy172 = 1; } + case 338: /* with_meta ::= WITH META AS */ +{ yymsp[-2].minor.yy444 = 1; } break; - case 334: /* with_meta ::= ONLY META AS */ -{ yymsp[-2].minor.yy172 = 2; } + case 339: /* with_meta ::= ONLY META AS */ +{ yymsp[-2].minor.yy444 = 2; } break; - case 335: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy461, &yymsp[-2].minor.yy353, yymsp[0].minor.yy884); } + case 340: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy985, &yymsp[-2].minor.yy305, yymsp[0].minor.yy1000); } break; - case 336: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy461, &yymsp[-3].minor.yy353, &yymsp[0].minor.yy353, yymsp[-2].minor.yy172); } + case 341: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy985, &yymsp[-3].minor.yy305, &yymsp[0].minor.yy305, yymsp[-2].minor.yy444); } break; - case 337: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy461, &yymsp[-4].minor.yy353, yymsp[-1].minor.yy884, yymsp[-3].minor.yy172, yymsp[0].minor.yy884); } + case 342: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy985, &yymsp[-4].minor.yy305, yymsp[-1].minor.yy1000, yymsp[-3].minor.yy444, yymsp[0].minor.yy1000); } break; - case 338: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy461, &yymsp[0].minor.yy353); } + case 343: /* cmd ::= DROP TOPIC exists_opt topic_name */ +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy985, &yymsp[0].minor.yy305); } break; - case 339: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy461, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy353); } + case 344: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy985, &yymsp[-2].minor.yy305, &yymsp[0].minor.yy305); } break; - case 340: /* cmd ::= DESC full_table_name */ - case 341: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==341); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy884); } + case 345: /* cmd ::= DESC full_table_name */ + case 346: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==346); +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy1000); } break; - case 342: /* cmd ::= RESET QUERY CACHE */ + case 347: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 343: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - case 344: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==344); -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy461, yymsp[-1].minor.yy884, yymsp[0].minor.yy884); } + case 348: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + case 349: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==349); +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy985, yymsp[-1].minor.yy1000, yymsp[0].minor.yy1000); } break; - case 347: /* explain_options ::= */ -{ yymsp[1].minor.yy884 = createDefaultExplainOptions(pCxt); } + case 352: /* explain_options ::= */ +{ yymsp[1].minor.yy1000 = createDefaultExplainOptions(pCxt); } break; - case 348: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy884 = setExplainVerbose(pCxt, yymsp[-2].minor.yy884, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 353: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy1000 = setExplainVerbose(pCxt, yymsp[-2].minor.yy1000, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 349: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy884 = setExplainRatio(pCxt, yymsp[-2].minor.yy884, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 354: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy1000 = setExplainRatio(pCxt, yymsp[-2].minor.yy1000, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 350: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy461, yymsp[-9].minor.yy461, &yymsp[-6].minor.yy353, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy88, yymsp[-1].minor.yy172, &yymsp[0].minor.yy353, yymsp[-10].minor.yy461); } + case 355: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy985, yymsp[-9].minor.yy985, &yymsp[-6].minor.yy305, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy56, yymsp[-1].minor.yy444, &yymsp[0].minor.yy305, yymsp[-10].minor.yy985); } break; - case 351: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy461, &yymsp[0].minor.yy353); } + case 356: /* cmd ::= DROP FUNCTION exists_opt function_name */ +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy985, &yymsp[0].minor.yy305); } break; - case 356: /* language_opt ::= */ - case 395: /* on_vgroup_id ::= */ yytestcase(yyruleno==395); -{ yymsp[1].minor.yy353 = nil_token; } + case 361: /* language_opt ::= */ + case 400: /* on_vgroup_id ::= */ yytestcase(yyruleno==400); +{ yymsp[1].minor.yy305 = nil_token; } break; - case 357: /* language_opt ::= LANGUAGE NK_STRING */ - case 396: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==396); -{ yymsp[-1].minor.yy353 = yymsp[0].minor.yy0; } + case 362: /* language_opt ::= LANGUAGE NK_STRING */ + case 401: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==401); +{ yymsp[-1].minor.yy305 = yymsp[0].minor.yy0; } break; - case 360: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ -{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy461, yymsp[-2].minor.yy884, &yymsp[-1].minor.yy0, yymsp[0].minor.yy884); } + case 365: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ +{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy985, yymsp[-2].minor.yy1000, &yymsp[-1].minor.yy0, yymsp[0].minor.yy1000); } break; - case 361: /* cmd ::= DROP VIEW exists_opt full_view_name */ -{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy461, yymsp[0].minor.yy884); } + case 366: /* cmd ::= DROP VIEW exists_opt full_view_name */ +{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy985, yymsp[0].minor.yy1000); } break; - case 362: /* full_view_name ::= view_name */ -{ yylhsminor.yy884 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy353); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 367: /* full_view_name ::= view_name */ +{ yylhsminor.yy1000 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy305); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 363: /* full_view_name ::= db_name NK_DOT view_name */ -{ yylhsminor.yy884 = createViewNode(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy353); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 368: /* full_view_name ::= db_name NK_DOT view_name */ +{ yylhsminor.yy1000 = createViewNode(pCxt, &yymsp[-2].minor.yy305, &yymsp[0].minor.yy305); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 364: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy461, &yymsp[-8].minor.yy353, yymsp[-5].minor.yy884, yymsp[-7].minor.yy884, yymsp[-3].minor.yy964, yymsp[-2].minor.yy884, yymsp[0].minor.yy884, yymsp[-4].minor.yy964); } + case 369: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy985, &yymsp[-8].minor.yy305, yymsp[-5].minor.yy1000, yymsp[-7].minor.yy1000, yymsp[-3].minor.yy72, yymsp[-2].minor.yy1000, yymsp[0].minor.yy1000, yymsp[-4].minor.yy72); } break; - case 365: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy461, &yymsp[0].minor.yy353); } + case 370: /* cmd ::= DROP STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy985, &yymsp[0].minor.yy305); } break; - case 366: /* cmd ::= PAUSE STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy461, &yymsp[0].minor.yy353); } + case 371: /* cmd ::= PAUSE STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy985, &yymsp[0].minor.yy305); } break; - case 367: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ -{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy461, yymsp[-1].minor.yy461, &yymsp[0].minor.yy353); } + case 372: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ +{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy985, yymsp[-1].minor.yy985, &yymsp[0].minor.yy305); } break; - case 374: /* stream_options ::= stream_options TRIGGER AT_ONCE */ - case 375: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==375); -{ yylhsminor.yy884 = setStreamOptions(pCxt, yymsp[-2].minor.yy884, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 379: /* stream_options ::= stream_options TRIGGER AT_ONCE */ + case 380: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==380); +{ yylhsminor.yy1000 = setStreamOptions(pCxt, yymsp[-2].minor.yy1000, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 376: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ yylhsminor.yy884 = setStreamOptions(pCxt, yymsp[-3].minor.yy884, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy884)); } - yymsp[-3].minor.yy884 = yylhsminor.yy884; + case 381: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +{ yylhsminor.yy1000 = setStreamOptions(pCxt, yymsp[-3].minor.yy1000, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy1000)); } + yymsp[-3].minor.yy1000 = yylhsminor.yy1000; break; - case 377: /* stream_options ::= stream_options WATERMARK duration_literal */ -{ yylhsminor.yy884 = setStreamOptions(pCxt, yymsp[-2].minor.yy884, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy884)); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 382: /* stream_options ::= stream_options WATERMARK duration_literal */ +{ yylhsminor.yy1000 = setStreamOptions(pCxt, yymsp[-2].minor.yy1000, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy1000)); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 378: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -{ yylhsminor.yy884 = setStreamOptions(pCxt, yymsp[-3].minor.yy884, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-3].minor.yy884 = yylhsminor.yy884; + case 383: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +{ yylhsminor.yy1000 = setStreamOptions(pCxt, yymsp[-3].minor.yy1000, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy1000 = yylhsminor.yy1000; break; - case 379: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ -{ yylhsminor.yy884 = setStreamOptions(pCxt, yymsp[-2].minor.yy884, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 384: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ +{ yylhsminor.yy1000 = setStreamOptions(pCxt, yymsp[-2].minor.yy1000, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 380: /* stream_options ::= stream_options DELETE_MARK duration_literal */ -{ yylhsminor.yy884 = setStreamOptions(pCxt, yymsp[-2].minor.yy884, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy884)); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 385: /* stream_options ::= stream_options DELETE_MARK duration_literal */ +{ yylhsminor.yy1000 = setStreamOptions(pCxt, yymsp[-2].minor.yy1000, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy1000)); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 381: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ -{ yylhsminor.yy884 = setStreamOptions(pCxt, yymsp[-3].minor.yy884, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-3].minor.yy884 = yylhsminor.yy884; + case 386: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ +{ yylhsminor.yy1000 = setStreamOptions(pCxt, yymsp[-3].minor.yy1000, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy1000 = yylhsminor.yy1000; break; - case 383: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 603: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==603); - case 627: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==627); -{ yymsp[-3].minor.yy884 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy884); } + case 388: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 608: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==608); + case 632: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==632); +{ yymsp[-3].minor.yy1000 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy1000); } break; - case 386: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 391: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 387: /* cmd ::= KILL QUERY NK_STRING */ + case 392: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 388: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 393: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 389: /* cmd ::= KILL COMPACT NK_INTEGER */ + case 394: /* cmd ::= KILL COMPACT NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_COMPACT_STMT, &yymsp[0].minor.yy0); } break; - case 390: /* cmd ::= BALANCE VGROUP */ + case 395: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 391: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ -{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy353); } + case 396: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ +{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy305); } break; - case 392: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 397: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 393: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy964); } + case 398: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy72); } break; - case 394: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 399: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 397: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy964 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + case 402: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy72 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 399: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy884, yymsp[0].minor.yy884); } + case 404: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy1000, yymsp[0].minor.yy1000); } break; - case 402: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ -{ yymsp[-6].minor.yy884 = createInsertStmt(pCxt, yymsp[-4].minor.yy884, yymsp[-2].minor.yy964, yymsp[0].minor.yy884); } + case 407: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +{ yymsp[-6].minor.yy1000 = createInsertStmt(pCxt, yymsp[-4].minor.yy1000, yymsp[-2].minor.yy72, yymsp[0].minor.yy1000); } break; - case 403: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ -{ yymsp[-3].minor.yy884 = createInsertStmt(pCxt, yymsp[-1].minor.yy884, NULL, yymsp[0].minor.yy884); } + case 408: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ +{ yymsp[-3].minor.yy1000 = createInsertStmt(pCxt, yymsp[-1].minor.yy1000, NULL, yymsp[0].minor.yy1000); } break; - case 404: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy884 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 409: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy1000 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 405: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy884 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 410: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy1000 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 406: /* literal ::= NK_STRING */ -{ yylhsminor.yy884 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 411: /* literal ::= NK_STRING */ +{ yylhsminor.yy1000 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 407: /* literal ::= NK_BOOL */ -{ yylhsminor.yy884 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 412: /* literal ::= NK_BOOL */ +{ yylhsminor.yy1000 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 408: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy884 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy884 = yylhsminor.yy884; + case 413: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy1000 = yylhsminor.yy1000; break; - case 409: /* literal ::= duration_literal */ - case 419: /* signed_literal ::= signed */ yytestcase(yyruleno==419); - case 442: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==442); - case 443: /* expression ::= literal */ yytestcase(yyruleno==443); - case 445: /* expression ::= column_reference */ yytestcase(yyruleno==445); - case 446: /* expression ::= function_expression */ yytestcase(yyruleno==446); - case 447: /* expression ::= case_when_expression */ yytestcase(yyruleno==447); - case 480: /* function_expression ::= literal_func */ yytestcase(yyruleno==480); - case 529: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==529); - case 533: /* boolean_primary ::= predicate */ yytestcase(yyruleno==533); - case 535: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==535); - case 536: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==536); - case 539: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==539); - case 541: /* table_reference ::= table_primary */ yytestcase(yyruleno==541); - case 542: /* table_reference ::= joined_table */ yytestcase(yyruleno==542); - case 546: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==546); - case 629: /* query_simple ::= query_specification */ yytestcase(yyruleno==629); - case 630: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==630); - case 633: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==633); - case 635: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==635); -{ yylhsminor.yy884 = yymsp[0].minor.yy884; } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 414: /* literal ::= duration_literal */ + case 424: /* signed_literal ::= signed */ yytestcase(yyruleno==424); + case 447: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==447); + case 448: /* expression ::= literal */ yytestcase(yyruleno==448); + case 450: /* expression ::= column_reference */ yytestcase(yyruleno==450); + case 451: /* expression ::= function_expression */ yytestcase(yyruleno==451); + case 452: /* expression ::= case_when_expression */ yytestcase(yyruleno==452); + case 485: /* function_expression ::= literal_func */ yytestcase(yyruleno==485); + case 534: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==534); + case 538: /* boolean_primary ::= predicate */ yytestcase(yyruleno==538); + case 540: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==540); + case 541: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==541); + case 544: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==544); + case 546: /* table_reference ::= table_primary */ yytestcase(yyruleno==546); + case 547: /* table_reference ::= joined_table */ yytestcase(yyruleno==547); + case 551: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==551); + case 634: /* query_simple ::= query_specification */ yytestcase(yyruleno==634); + case 635: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==635); + case 638: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==638); + case 640: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==640); +{ yylhsminor.yy1000 = yymsp[0].minor.yy1000; } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 410: /* literal ::= NULL */ -{ yylhsminor.yy884 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 415: /* literal ::= NULL */ +{ yylhsminor.yy1000 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 411: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy884 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 416: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy1000 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 412: /* duration_literal ::= NK_VARIABLE */ - case 604: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==604); - case 605: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==605); - case 606: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==606); -{ yylhsminor.yy884 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 417: /* duration_literal ::= NK_VARIABLE */ + case 609: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==609); + case 610: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==610); + case 611: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==611); +{ yylhsminor.yy1000 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 413: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy884 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 418: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 414: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy884 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + case 419: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } break; - case 415: /* signed ::= NK_MINUS NK_INTEGER */ + case 420: /* signed ::= NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy884 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy884 = yylhsminor.yy884; + yymsp[-1].minor.yy1000 = yylhsminor.yy1000; break; - case 416: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy884 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 421: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 417: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy884 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 422: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 418: /* signed ::= NK_MINUS NK_FLOAT */ + case 423: /* signed ::= NK_MINUS NK_FLOAT */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy884 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy884 = yylhsminor.yy884; + yymsp[-1].minor.yy1000 = yylhsminor.yy1000; break; - case 420: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy884 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 425: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 421: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy884 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 426: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 422: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy884 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 427: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 423: /* signed_literal ::= duration_literal */ - case 425: /* signed_literal ::= literal_func */ yytestcase(yyruleno==425); - case 500: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==500); - case 583: /* select_item ::= common_expression */ yytestcase(yyruleno==583); - case 593: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==593); - case 634: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==634); - case 636: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==636); - case 649: /* search_condition ::= common_expression */ yytestcase(yyruleno==649); -{ yylhsminor.yy884 = releaseRawExprNode(pCxt, yymsp[0].minor.yy884); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 428: /* signed_literal ::= duration_literal */ + case 430: /* signed_literal ::= literal_func */ yytestcase(yyruleno==430); + case 505: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==505); + case 588: /* select_item ::= common_expression */ yytestcase(yyruleno==588); + case 598: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==598); + case 639: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==639); + case 641: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==641); + case 654: /* search_condition ::= common_expression */ yytestcase(yyruleno==654); +{ yylhsminor.yy1000 = releaseRawExprNode(pCxt, yymsp[0].minor.yy1000); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 424: /* signed_literal ::= NULL */ -{ yylhsminor.yy884 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 429: /* signed_literal ::= NULL */ +{ yylhsminor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 426: /* signed_literal ::= NK_QUESTION */ -{ yylhsminor.yy884 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 431: /* signed_literal ::= NK_QUESTION */ +{ yylhsminor.yy1000 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 444: /* expression ::= pseudo_column */ -{ yylhsminor.yy884 = yymsp[0].minor.yy884; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy884, true); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 449: /* expression ::= pseudo_column */ +{ yylhsminor.yy1000 = yymsp[0].minor.yy1000; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy1000, true); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 448: /* expression ::= NK_LP expression NK_RP */ - case 534: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==534); - case 648: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==648); -{ yylhsminor.yy884 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy884)); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 453: /* expression ::= NK_LP expression NK_RP */ + case 539: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==539); + case 653: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==653); +{ yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy1000)); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 449: /* expression ::= NK_PLUS expr_or_subquery */ + case 454: /* expression ::= NK_PLUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy884); - yylhsminor.yy884 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy884)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy1000); + yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy1000)); } - yymsp[-1].minor.yy884 = yylhsminor.yy884; + yymsp[-1].minor.yy1000 = yylhsminor.yy1000; break; - case 450: /* expression ::= NK_MINUS expr_or_subquery */ + case 455: /* expression ::= NK_MINUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy884); - yylhsminor.yy884 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy884), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy1000); + yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy1000), NULL)); } - yymsp[-1].minor.yy884 = yylhsminor.yy884; + yymsp[-1].minor.yy1000 = yylhsminor.yy1000; break; - case 451: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + case 456: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy884); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy884); - yylhsminor.yy884 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy884), releaseRawExprNode(pCxt, yymsp[0].minor.yy884))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy1000); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy1000); + yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy1000), releaseRawExprNode(pCxt, yymsp[0].minor.yy1000))); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 452: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + case 457: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy884); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy884); - yylhsminor.yy884 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy884), releaseRawExprNode(pCxt, yymsp[0].minor.yy884))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy1000); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy1000); + yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy1000), releaseRawExprNode(pCxt, yymsp[0].minor.yy1000))); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 453: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + case 458: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy884); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy884); - yylhsminor.yy884 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy884), releaseRawExprNode(pCxt, yymsp[0].minor.yy884))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy1000); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy1000); + yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy1000), releaseRawExprNode(pCxt, yymsp[0].minor.yy1000))); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 454: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + case 459: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy884); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy884); - yylhsminor.yy884 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy884), releaseRawExprNode(pCxt, yymsp[0].minor.yy884))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy1000); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy1000); + yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy1000), releaseRawExprNode(pCxt, yymsp[0].minor.yy1000))); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 455: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ + case 460: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy884); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy884); - yylhsminor.yy884 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy884), releaseRawExprNode(pCxt, yymsp[0].minor.yy884))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy1000); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy1000); + yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy1000), releaseRawExprNode(pCxt, yymsp[0].minor.yy1000))); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 456: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 461: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy884); - yylhsminor.yy884 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy884), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy1000); + yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy1000), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 457: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + case 462: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy884); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy884); - yylhsminor.yy884 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy884), releaseRawExprNode(pCxt, yymsp[0].minor.yy884))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy1000); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy1000); + yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy1000), releaseRawExprNode(pCxt, yymsp[0].minor.yy1000))); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 458: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + case 463: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy884); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy884); - yylhsminor.yy884 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy884), releaseRawExprNode(pCxt, yymsp[0].minor.yy884))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy1000); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy1000); + yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy1000), releaseRawExprNode(pCxt, yymsp[0].minor.yy1000))); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 461: /* column_reference ::= column_name */ -{ yylhsminor.yy884 = createRawExprNode(pCxt, &yymsp[0].minor.yy353, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy353)); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 466: /* column_reference ::= column_name */ +{ yylhsminor.yy1000 = createRawExprNode(pCxt, &yymsp[0].minor.yy305, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy305)); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 462: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy884 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy353, createColumnNode(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy353)); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 467: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy305, &yymsp[0].minor.yy305, createColumnNode(pCxt, &yymsp[-2].minor.yy305, &yymsp[0].minor.yy305)); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 463: /* column_reference ::= NK_ALIAS */ -{ yylhsminor.yy884 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 468: /* column_reference ::= NK_ALIAS */ +{ yylhsminor.yy1000 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 464: /* column_reference ::= table_name NK_DOT NK_ALIAS */ -{ yylhsminor.yy884 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 469: /* column_reference ::= table_name NK_DOT NK_ALIAS */ +{ yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy305, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy305, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 465: /* pseudo_column ::= ROWTS */ - case 466: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==466); - case 468: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==468); - case 469: /* pseudo_column ::= QEND */ yytestcase(yyruleno==469); - case 470: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==470); - case 471: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==471); - case 472: /* pseudo_column ::= WEND */ yytestcase(yyruleno==472); - case 473: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==473); - case 474: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==474); - case 475: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==475); - case 476: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==476); - case 482: /* literal_func ::= NOW */ yytestcase(yyruleno==482); -{ yylhsminor.yy884 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 470: /* pseudo_column ::= ROWTS */ + case 471: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==471); + case 473: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==473); + case 474: /* pseudo_column ::= QEND */ yytestcase(yyruleno==474); + case 475: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==475); + case 476: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==476); + case 477: /* pseudo_column ::= WEND */ yytestcase(yyruleno==477); + case 478: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==478); + case 479: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==479); + case 480: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==480); + case 481: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==481); + case 487: /* literal_func ::= NOW */ yytestcase(yyruleno==487); +{ yylhsminor.yy1000 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 467: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy884 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy353)))); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 472: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy305, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy305)))); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 477: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 478: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==478); -{ yylhsminor.yy884 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy353, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy353, yymsp[-1].minor.yy964)); } - yymsp[-3].minor.yy884 = yylhsminor.yy884; + case 482: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 483: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==483); +{ yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy305, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy305, yymsp[-1].minor.yy72)); } + yymsp[-3].minor.yy1000 = yylhsminor.yy1000; break; - case 479: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ -{ yylhsminor.yy884 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy884), yymsp[-1].minor.yy88)); } - yymsp[-5].minor.yy884 = yylhsminor.yy884; + case 484: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ +{ yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy1000), yymsp[-1].minor.yy56)); } + yymsp[-5].minor.yy1000 = yylhsminor.yy1000; break; - case 481: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy884 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy353, NULL)); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 486: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy305, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy305, NULL)); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 496: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy964 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy964 = yylhsminor.yy964; + case 501: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy72 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy72 = yylhsminor.yy72; break; - case 501: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 586: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==586); -{ yylhsminor.yy884 = createColumnNode(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 506: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 591: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==591); +{ yylhsminor.yy1000 = createColumnNode(pCxt, &yymsp[-2].minor.yy305, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 502: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ -{ yylhsminor.yy884 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy964, yymsp[-1].minor.yy884)); } - yymsp[-3].minor.yy884 = yylhsminor.yy884; + case 507: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +{ yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy72, yymsp[-1].minor.yy1000)); } + yymsp[-3].minor.yy1000 = yylhsminor.yy1000; break; - case 503: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -{ yylhsminor.yy884 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy884), yymsp[-2].minor.yy964, yymsp[-1].minor.yy884)); } - yymsp[-4].minor.yy884 = yylhsminor.yy884; + case 508: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +{ yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy1000), yymsp[-2].minor.yy72, yymsp[-1].minor.yy1000)); } + yymsp[-4].minor.yy1000 = yylhsminor.yy1000; break; - case 506: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -{ yymsp[-3].minor.yy884 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy884), releaseRawExprNode(pCxt, yymsp[0].minor.yy884)); } + case 511: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +{ yymsp[-3].minor.yy1000 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy1000), releaseRawExprNode(pCxt, yymsp[0].minor.yy1000)); } break; - case 508: /* case_when_else_opt ::= ELSE common_expression */ -{ yymsp[-1].minor.yy884 = releaseRawExprNode(pCxt, yymsp[0].minor.yy884); } + case 513: /* case_when_else_opt ::= ELSE common_expression */ +{ yymsp[-1].minor.yy1000 = releaseRawExprNode(pCxt, yymsp[0].minor.yy1000); } break; - case 509: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 514: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==514); + case 514: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 519: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==519); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy884); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy884); - yylhsminor.yy884 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy776, releaseRawExprNode(pCxt, yymsp[-2].minor.yy884), releaseRawExprNode(pCxt, yymsp[0].minor.yy884))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy1000); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy1000); + yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy324, releaseRawExprNode(pCxt, yymsp[-2].minor.yy1000), releaseRawExprNode(pCxt, yymsp[0].minor.yy1000))); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 510: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + case 515: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy884); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy884); - yylhsminor.yy884 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy884), releaseRawExprNode(pCxt, yymsp[-2].minor.yy884), releaseRawExprNode(pCxt, yymsp[0].minor.yy884))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy1000); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy1000); + yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy1000), releaseRawExprNode(pCxt, yymsp[-2].minor.yy1000), releaseRawExprNode(pCxt, yymsp[0].minor.yy1000))); } - yymsp[-4].minor.yy884 = yylhsminor.yy884; + yymsp[-4].minor.yy1000 = yylhsminor.yy1000; break; - case 511: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + case 516: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy884); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy884); - yylhsminor.yy884 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy884), releaseRawExprNode(pCxt, yymsp[-2].minor.yy884), releaseRawExprNode(pCxt, yymsp[0].minor.yy884))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy1000); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy1000); + yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy1000), releaseRawExprNode(pCxt, yymsp[-2].minor.yy1000), releaseRawExprNode(pCxt, yymsp[0].minor.yy1000))); } - yymsp[-5].minor.yy884 = yylhsminor.yy884; + yymsp[-5].minor.yy1000 = yylhsminor.yy1000; break; - case 512: /* predicate ::= expr_or_subquery IS NULL */ + case 517: /* predicate ::= expr_or_subquery IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy884); - yylhsminor.yy884 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy884), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy1000); + yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy1000), NULL)); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 513: /* predicate ::= expr_or_subquery IS NOT NULL */ + case 518: /* predicate ::= expr_or_subquery IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy884); - yylhsminor.yy884 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy884), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy1000); + yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy1000), NULL)); } - yymsp[-3].minor.yy884 = yylhsminor.yy884; + yymsp[-3].minor.yy1000 = yylhsminor.yy1000; break; - case 515: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy776 = OP_TYPE_LOWER_THAN; } + case 520: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy324 = OP_TYPE_LOWER_THAN; } break; - case 516: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy776 = OP_TYPE_GREATER_THAN; } + case 521: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy324 = OP_TYPE_GREATER_THAN; } break; - case 517: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy776 = OP_TYPE_LOWER_EQUAL; } + case 522: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy324 = OP_TYPE_LOWER_EQUAL; } break; - case 518: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy776 = OP_TYPE_GREATER_EQUAL; } + case 523: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy324 = OP_TYPE_GREATER_EQUAL; } break; - case 519: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy776 = OP_TYPE_NOT_EQUAL; } + case 524: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy324 = OP_TYPE_NOT_EQUAL; } break; - case 520: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy776 = OP_TYPE_EQUAL; } + case 525: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy324 = OP_TYPE_EQUAL; } break; - case 521: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy776 = OP_TYPE_LIKE; } + case 526: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy324 = OP_TYPE_LIKE; } break; - case 522: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy776 = OP_TYPE_NOT_LIKE; } + case 527: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy324 = OP_TYPE_NOT_LIKE; } break; - case 523: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy776 = OP_TYPE_MATCH; } + case 528: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy324 = OP_TYPE_MATCH; } break; - case 524: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy776 = OP_TYPE_NMATCH; } + case 529: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy324 = OP_TYPE_NMATCH; } break; - case 525: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy776 = OP_TYPE_JSON_CONTAINS; } + case 530: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy324 = OP_TYPE_JSON_CONTAINS; } break; - case 526: /* in_op ::= IN */ -{ yymsp[0].minor.yy776 = OP_TYPE_IN; } + case 531: /* in_op ::= IN */ +{ yymsp[0].minor.yy324 = OP_TYPE_IN; } break; - case 527: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy776 = OP_TYPE_NOT_IN; } + case 532: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy324 = OP_TYPE_NOT_IN; } break; - case 528: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -{ yylhsminor.yy884 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy964)); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 533: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +{ yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy72)); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 530: /* boolean_value_expression ::= NOT boolean_primary */ + case 535: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy884); - yylhsminor.yy884 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy884), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy1000); + yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy1000), NULL)); } - yymsp[-1].minor.yy884 = yylhsminor.yy884; + yymsp[-1].minor.yy1000 = yylhsminor.yy1000; break; - case 531: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 536: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy884); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy884); - yylhsminor.yy884 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy884), releaseRawExprNode(pCxt, yymsp[0].minor.yy884))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy1000); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy1000); + yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy1000), releaseRawExprNode(pCxt, yymsp[0].minor.yy1000))); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 532: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 537: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy884); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy884); - yylhsminor.yy884 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy884), releaseRawExprNode(pCxt, yymsp[0].minor.yy884))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy1000); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy1000); + yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy1000), releaseRawExprNode(pCxt, yymsp[0].minor.yy1000))); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 540: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy884 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy884, yymsp[0].minor.yy884, NULL); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 545: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy1000 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy1000, yymsp[0].minor.yy1000, NULL); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 543: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy884 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy353, &yymsp[0].minor.yy353); } - yymsp[-1].minor.yy884 = yylhsminor.yy884; + case 548: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy1000 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy305, &yymsp[0].minor.yy305); } + yymsp[-1].minor.yy1000 = yylhsminor.yy1000; break; - case 544: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy884 = createRealTableNode(pCxt, &yymsp[-3].minor.yy353, &yymsp[-1].minor.yy353, &yymsp[0].minor.yy353); } - yymsp[-3].minor.yy884 = yylhsminor.yy884; + case 549: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy1000 = createRealTableNode(pCxt, &yymsp[-3].minor.yy305, &yymsp[-1].minor.yy305, &yymsp[0].minor.yy305); } + yymsp[-3].minor.yy1000 = yylhsminor.yy1000; break; - case 545: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy884 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy884), &yymsp[0].minor.yy353); } - yymsp[-1].minor.yy884 = yylhsminor.yy884; + case 550: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy1000 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy1000), &yymsp[0].minor.yy305); } + yymsp[-1].minor.yy1000 = yylhsminor.yy1000; break; - case 547: /* alias_opt ::= */ -{ yymsp[1].minor.yy353 = nil_token; } + case 552: /* alias_opt ::= */ +{ yymsp[1].minor.yy305 = nil_token; } break; - case 549: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy353 = yymsp[0].minor.yy353; } + case 554: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy305 = yymsp[0].minor.yy305; } break; - case 550: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 551: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==551); -{ yymsp[-2].minor.yy884 = yymsp[-1].minor.yy884; } + case 555: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 556: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==556); +{ yymsp[-2].minor.yy1000 = yymsp[-1].minor.yy1000; } break; - case 552: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ + case 557: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ { - yylhsminor.yy884 = createJoinTableNode(pCxt, yymsp[-6].minor.yy828, yymsp[-5].minor.yy954, yymsp[-7].minor.yy884, yymsp[-3].minor.yy884, yymsp[-2].minor.yy884); - yylhsminor.yy884 = addWindowOffsetClause(pCxt, yylhsminor.yy884, yymsp[-1].minor.yy884); - yylhsminor.yy884 = addJLimitClause(pCxt, yylhsminor.yy884, yymsp[0].minor.yy884); + yylhsminor.yy1000 = createJoinTableNode(pCxt, yymsp[-6].minor.yy828, yymsp[-5].minor.yy166, yymsp[-7].minor.yy1000, yymsp[-3].minor.yy1000, yymsp[-2].minor.yy1000); + yylhsminor.yy1000 = addWindowOffsetClause(pCxt, yylhsminor.yy1000, yymsp[-1].minor.yy1000); + yylhsminor.yy1000 = addJLimitClause(pCxt, yylhsminor.yy1000, yymsp[0].minor.yy1000); } - yymsp[-7].minor.yy884 = yylhsminor.yy884; + yymsp[-7].minor.yy1000 = yylhsminor.yy1000; break; - case 553: /* join_type ::= */ + case 558: /* join_type ::= */ { yymsp[1].minor.yy828 = JOIN_TYPE_INNER; } break; - case 554: /* join_type ::= INNER */ + case 559: /* join_type ::= INNER */ { yymsp[0].minor.yy828 = JOIN_TYPE_INNER; } break; - case 555: /* join_type ::= LEFT */ + case 560: /* join_type ::= LEFT */ { yymsp[0].minor.yy828 = JOIN_TYPE_LEFT; } break; - case 556: /* join_type ::= RIGHT */ + case 561: /* join_type ::= RIGHT */ { yymsp[0].minor.yy828 = JOIN_TYPE_RIGHT; } break; - case 557: /* join_type ::= FULL */ + case 562: /* join_type ::= FULL */ { yymsp[0].minor.yy828 = JOIN_TYPE_FULL; } break; - case 558: /* join_subtype ::= */ -{ yymsp[1].minor.yy954 = JOIN_STYPE_NONE; } + case 563: /* join_subtype ::= */ +{ yymsp[1].minor.yy166 = JOIN_STYPE_NONE; } break; - case 559: /* join_subtype ::= OUTER */ -{ yymsp[0].minor.yy954 = JOIN_STYPE_OUTER; } + case 564: /* join_subtype ::= OUTER */ +{ yymsp[0].minor.yy166 = JOIN_STYPE_OUTER; } break; - case 560: /* join_subtype ::= SEMI */ -{ yymsp[0].minor.yy954 = JOIN_STYPE_SEMI; } + case 565: /* join_subtype ::= SEMI */ +{ yymsp[0].minor.yy166 = JOIN_STYPE_SEMI; } break; - case 561: /* join_subtype ::= ANTI */ -{ yymsp[0].minor.yy954 = JOIN_STYPE_ANTI; } + case 566: /* join_subtype ::= ANTI */ +{ yymsp[0].minor.yy166 = JOIN_STYPE_ANTI; } break; - case 562: /* join_subtype ::= ASOF */ -{ yymsp[0].minor.yy954 = JOIN_STYPE_ASOF; } + case 567: /* join_subtype ::= ASOF */ +{ yymsp[0].minor.yy166 = JOIN_STYPE_ASOF; } break; - case 563: /* join_subtype ::= WINDOW */ -{ yymsp[0].minor.yy954 = JOIN_STYPE_WIN; } + case 568: /* join_subtype ::= WINDOW */ +{ yymsp[0].minor.yy166 = JOIN_STYPE_WIN; } break; - case 567: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ -{ yymsp[-5].minor.yy884 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy884), releaseRawExprNode(pCxt, yymsp[-1].minor.yy884)); } + case 572: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ +{ yymsp[-5].minor.yy1000 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy1000), releaseRawExprNode(pCxt, yymsp[-1].minor.yy1000)); } break; - case 568: /* window_offset_literal ::= NK_VARIABLE */ -{ yylhsminor.yy884 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 573: /* window_offset_literal ::= NK_VARIABLE */ +{ yylhsminor.yy1000 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 569: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */ + case 574: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy884 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); + yylhsminor.yy1000 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); } - yymsp[-1].minor.yy884 = yylhsminor.yy884; + yymsp[-1].minor.yy1000 = yylhsminor.yy1000; break; - case 571: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - case 640: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==640); - case 644: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==644); -{ yymsp[-1].minor.yy884 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 576: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */ + case 645: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==645); + case 649: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==649); +{ yymsp[-1].minor.yy1000 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 572: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 577: /* 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 */ { - yymsp[-13].minor.yy884 = createSelectStmt(pCxt, yymsp[-11].minor.yy461, yymsp[-9].minor.yy964, yymsp[-8].minor.yy884, yymsp[-12].minor.yy964); - yymsp[-13].minor.yy884 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy884, yymsp[-10].minor.yy461); - yymsp[-13].minor.yy884 = addWhereClause(pCxt, yymsp[-13].minor.yy884, yymsp[-7].minor.yy884); - yymsp[-13].minor.yy884 = addPartitionByClause(pCxt, yymsp[-13].minor.yy884, yymsp[-6].minor.yy964); - yymsp[-13].minor.yy884 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy884, yymsp[-2].minor.yy884); - yymsp[-13].minor.yy884 = addGroupByClause(pCxt, yymsp[-13].minor.yy884, yymsp[-1].minor.yy964); - yymsp[-13].minor.yy884 = addHavingClause(pCxt, yymsp[-13].minor.yy884, yymsp[0].minor.yy884); - yymsp[-13].minor.yy884 = addRangeClause(pCxt, yymsp[-13].minor.yy884, yymsp[-5].minor.yy884); - yymsp[-13].minor.yy884 = addEveryClause(pCxt, yymsp[-13].minor.yy884, yymsp[-4].minor.yy884); - yymsp[-13].minor.yy884 = addFillClause(pCxt, yymsp[-13].minor.yy884, yymsp[-3].minor.yy884); + yymsp[-13].minor.yy1000 = createSelectStmt(pCxt, yymsp[-11].minor.yy985, yymsp[-9].minor.yy72, yymsp[-8].minor.yy1000, yymsp[-12].minor.yy72); + yymsp[-13].minor.yy1000 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy1000, yymsp[-10].minor.yy985); + yymsp[-13].minor.yy1000 = addWhereClause(pCxt, yymsp[-13].minor.yy1000, yymsp[-7].minor.yy1000); + yymsp[-13].minor.yy1000 = addPartitionByClause(pCxt, yymsp[-13].minor.yy1000, yymsp[-6].minor.yy72); + yymsp[-13].minor.yy1000 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy1000, yymsp[-2].minor.yy1000); + yymsp[-13].minor.yy1000 = addGroupByClause(pCxt, yymsp[-13].minor.yy1000, yymsp[-1].minor.yy72); + yymsp[-13].minor.yy1000 = addHavingClause(pCxt, yymsp[-13].minor.yy1000, yymsp[0].minor.yy1000); + yymsp[-13].minor.yy1000 = addRangeClause(pCxt, yymsp[-13].minor.yy1000, yymsp[-5].minor.yy1000); + yymsp[-13].minor.yy1000 = addEveryClause(pCxt, yymsp[-13].minor.yy1000, yymsp[-4].minor.yy1000); + yymsp[-13].minor.yy1000 = addFillClause(pCxt, yymsp[-13].minor.yy1000, yymsp[-3].minor.yy1000); } break; - case 573: /* hint_list ::= */ -{ yymsp[1].minor.yy964 = createHintNodeList(pCxt, NULL); } + case 578: /* hint_list ::= */ +{ yymsp[1].minor.yy72 = createHintNodeList(pCxt, NULL); } break; - case 574: /* hint_list ::= NK_HINT */ -{ yylhsminor.yy964 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy964 = yylhsminor.yy964; + case 579: /* hint_list ::= NK_HINT */ +{ yylhsminor.yy72 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy72 = yylhsminor.yy72; break; - case 579: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy461 = false; } + case 584: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy985 = false; } break; - case 582: /* select_item ::= NK_STAR */ -{ yylhsminor.yy884 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy884 = yylhsminor.yy884; + case 587: /* select_item ::= NK_STAR */ +{ yylhsminor.yy1000 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy1000 = yylhsminor.yy1000; break; - case 584: /* select_item ::= common_expression column_alias */ - case 594: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==594); -{ yylhsminor.yy884 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy884), &yymsp[0].minor.yy353); } - yymsp[-1].minor.yy884 = yylhsminor.yy884; + case 589: /* select_item ::= common_expression column_alias */ + case 599: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==599); +{ yylhsminor.yy1000 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy1000), &yymsp[0].minor.yy305); } + yymsp[-1].minor.yy1000 = yylhsminor.yy1000; break; - case 585: /* select_item ::= common_expression AS column_alias */ - case 595: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==595); -{ yylhsminor.yy884 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy884), &yymsp[0].minor.yy353); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 590: /* select_item ::= common_expression AS column_alias */ + case 600: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==600); +{ yylhsminor.yy1000 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy1000), &yymsp[0].minor.yy305); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 590: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 618: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==618); - case 638: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==638); -{ yymsp[-2].minor.yy964 = yymsp[0].minor.yy964; } + case 595: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 623: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==623); + case 643: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==643); +{ yymsp[-2].minor.yy72 = yymsp[0].minor.yy72; } break; - case 597: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ -{ yymsp[-5].minor.yy884 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy884), releaseRawExprNode(pCxt, yymsp[-1].minor.yy884)); } + case 602: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ +{ yymsp[-5].minor.yy1000 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy1000), releaseRawExprNode(pCxt, yymsp[-1].minor.yy1000)); } break; - case 598: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -{ yymsp[-3].minor.yy884 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy884)); } + case 603: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy1000 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy1000)); } break; - case 599: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy884 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy884), NULL, yymsp[-1].minor.yy884, yymsp[0].minor.yy884); } + case 604: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy1000 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy1000), NULL, yymsp[-1].minor.yy1000, yymsp[0].minor.yy1000); } break; - case 600: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy884 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy884), releaseRawExprNode(pCxt, yymsp[-3].minor.yy884), yymsp[-1].minor.yy884, yymsp[0].minor.yy884); } + case 605: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy1000 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy1000), releaseRawExprNode(pCxt, yymsp[-3].minor.yy1000), yymsp[-1].minor.yy1000, yymsp[0].minor.yy1000); } break; - case 601: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ -{ yymsp[-6].minor.yy884 = createEventWindowNode(pCxt, yymsp[-3].minor.yy884, yymsp[0].minor.yy884); } + case 606: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ +{ yymsp[-6].minor.yy1000 = createEventWindowNode(pCxt, yymsp[-3].minor.yy1000, yymsp[0].minor.yy1000); } break; - case 608: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy884 = createFillNode(pCxt, yymsp[-1].minor.yy270, NULL); } + case 613: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy1000 = createFillNode(pCxt, yymsp[-1].minor.yy926, NULL); } break; - case 609: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ -{ yymsp[-5].minor.yy884 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy964)); } + case 614: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ +{ yymsp[-5].minor.yy1000 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy72)); } break; - case 610: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ -{ yymsp[-5].minor.yy884 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy964)); } + case 615: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ +{ yymsp[-5].minor.yy1000 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy72)); } break; - case 611: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy270 = FILL_MODE_NONE; } + case 616: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy926 = FILL_MODE_NONE; } break; - case 612: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy270 = FILL_MODE_PREV; } + case 617: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy926 = FILL_MODE_PREV; } break; - case 613: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy270 = FILL_MODE_NULL; } + case 618: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy926 = FILL_MODE_NULL; } break; - case 614: /* fill_mode ::= NULL_F */ -{ yymsp[0].minor.yy270 = FILL_MODE_NULL_F; } + case 619: /* fill_mode ::= NULL_F */ +{ yymsp[0].minor.yy926 = FILL_MODE_NULL_F; } break; - case 615: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy270 = FILL_MODE_LINEAR; } + case 620: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy926 = FILL_MODE_LINEAR; } break; - case 616: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy270 = FILL_MODE_NEXT; } + case 621: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy926 = FILL_MODE_NEXT; } break; - case 619: /* group_by_list ::= expr_or_subquery */ -{ yylhsminor.yy964 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy884))); } - yymsp[0].minor.yy964 = yylhsminor.yy964; + case 624: /* group_by_list ::= expr_or_subquery */ +{ yylhsminor.yy72 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy1000))); } + yymsp[0].minor.yy72 = yylhsminor.yy72; break; - case 620: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -{ yylhsminor.yy964 = addNodeToList(pCxt, yymsp[-2].minor.yy964, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy884))); } - yymsp[-2].minor.yy964 = yylhsminor.yy964; + case 625: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +{ yylhsminor.yy72 = addNodeToList(pCxt, yymsp[-2].minor.yy72, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy1000))); } + yymsp[-2].minor.yy72 = yylhsminor.yy72; break; - case 624: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ -{ yymsp[-5].minor.yy884 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy884), releaseRawExprNode(pCxt, yymsp[-1].minor.yy884)); } + case 629: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +{ yymsp[-5].minor.yy1000 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy1000), releaseRawExprNode(pCxt, yymsp[-1].minor.yy1000)); } break; - case 625: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ -{ yymsp[-3].minor.yy884 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy884)); } + case 630: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy1000 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy1000)); } break; - case 628: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 633: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy884 = addOrderByClause(pCxt, yymsp[-3].minor.yy884, yymsp[-2].minor.yy964); - yylhsminor.yy884 = addSlimitClause(pCxt, yylhsminor.yy884, yymsp[-1].minor.yy884); - yylhsminor.yy884 = addLimitClause(pCxt, yylhsminor.yy884, yymsp[0].minor.yy884); + yylhsminor.yy1000 = addOrderByClause(pCxt, yymsp[-3].minor.yy1000, yymsp[-2].minor.yy72); + yylhsminor.yy1000 = addSlimitClause(pCxt, yylhsminor.yy1000, yymsp[-1].minor.yy1000); + yylhsminor.yy1000 = addLimitClause(pCxt, yylhsminor.yy1000, yymsp[0].minor.yy1000); } - yymsp[-3].minor.yy884 = yylhsminor.yy884; + yymsp[-3].minor.yy1000 = yylhsminor.yy1000; break; - case 631: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -{ yylhsminor.yy884 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy884, yymsp[0].minor.yy884); } - yymsp[-3].minor.yy884 = yylhsminor.yy884; + case 636: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +{ yylhsminor.yy1000 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy1000, yymsp[0].minor.yy1000); } + yymsp[-3].minor.yy1000 = yylhsminor.yy1000; break; - case 632: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -{ yylhsminor.yy884 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy884, yymsp[0].minor.yy884); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 637: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +{ yylhsminor.yy1000 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy1000, yymsp[0].minor.yy1000); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 641: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 645: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==645); -{ yymsp[-3].minor.yy884 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 646: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 650: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==650); +{ yymsp[-3].minor.yy1000 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 642: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 646: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==646); -{ yymsp[-3].minor.yy884 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 647: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 651: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==651); +{ yymsp[-3].minor.yy1000 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 647: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy884 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy884); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 652: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy1000); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 652: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy884 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy884), yymsp[-1].minor.yy146, yymsp[0].minor.yy361); } - yymsp[-2].minor.yy884 = yylhsminor.yy884; + case 657: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy1000 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy1000), yymsp[-1].minor.yy130, yymsp[0].minor.yy681); } + yymsp[-2].minor.yy1000 = yylhsminor.yy1000; break; - case 653: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy146 = ORDER_ASC; } + case 658: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy130 = ORDER_ASC; } break; - case 654: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy146 = ORDER_ASC; } + case 659: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy130 = ORDER_ASC; } break; - case 655: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy146 = ORDER_DESC; } + case 660: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy130 = ORDER_DESC; } break; - case 656: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy361 = NULL_ORDER_DEFAULT; } + case 661: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy681 = NULL_ORDER_DEFAULT; } break; - case 657: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy361 = NULL_ORDER_FIRST; } + case 662: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy681 = NULL_ORDER_FIRST; } break; - case 658: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy361 = NULL_ORDER_LAST; } + case 663: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy681 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/parser/test/mockCatalogService.cpp b/source/libs/parser/test/mockCatalogService.cpp index f1b43c535d..1cff7ac87a 100644 --- a/source/libs/parser/test/mockCatalogService.cpp +++ b/source/libs/parser/test/mockCatalogService.cpp @@ -755,6 +755,7 @@ void MockCatalogService::destoryCatalogReq(SCatalogReq* pReq) { taosArrayDestroy(pReq->pUser); taosArrayDestroy(pReq->pTableIndex); taosArrayDestroy(pReq->pTableCfg); + taosArrayDestroyEx(pReq->pView, destoryTablesReq); delete pReq; } @@ -781,6 +782,7 @@ void MockCatalogService::destoryMetaData(SMetaData* pData) { taosArrayDestroyEx(pData->pQnodeList, destoryMetaRes); taosArrayDestroyEx(pData->pTableCfg, destoryMetaRes); taosArrayDestroyEx(pData->pDnodeList, destoryMetaArrayRes); + taosArrayDestroyEx(pData->pView, destoryMetaRes); taosMemoryFree(pData->pSvrVer); delete pData; } diff --git a/source/libs/parser/test/parAlterToBalanceTest.cpp b/source/libs/parser/test/parAlterToBalanceTest.cpp index d137029a14..1cf132a632 100644 --- a/source/libs/parser/test/parAlterToBalanceTest.cpp +++ b/source/libs/parser/test/parAlterToBalanceTest.cpp @@ -73,6 +73,7 @@ TEST_F(ParserInitialATest, alterDnode) { ASSERT_EQ(req.dnodeId, expect.dnodeId); ASSERT_EQ(std::string(req.config), std::string(expect.config)); ASSERT_EQ(std::string(req.value), std::string(expect.value)); + tFreeSMCfgDnodeReq(&req); }); setCfgDnodeReq(1, "resetLog"); @@ -183,6 +184,7 @@ TEST_F(ParserInitialATest, alterDatabase) { ASSERT_EQ(req.minRows, expect.minRows); ASSERT_EQ(req.walRetentionPeriod, expect.walRetentionPeriod); ASSERT_EQ(req.walRetentionSize, expect.walRetentionSize); + tFreeSAlterDbReq(&req); }); const int32_t MINUTE_PER_DAY = MILLISECOND_PER_DAY / MILLISECOND_PER_MINUTE; @@ -827,6 +829,7 @@ TEST_F(ParserInitialATest, alterUser) { ASSERT_EQ(std::string(req.user), std::string(expect.user)); ASSERT_EQ(std::string(req.pass), std::string(expect.pass)); ASSERT_EQ(std::string(req.objname), std::string(expect.objname)); + tFreeSAlterUserReq(&req); }); setAlterUserReq("wxy", TSDB_ALTER_USER_PASSWD, "123456"); @@ -853,6 +856,7 @@ TEST_F(ParserInitialATest, balanceVgroup) { ASSERT_EQ(pQuery->pCmdMsg->msgType, TDMT_MND_BALANCE_VGROUP); SBalanceVgroupReq req = {0}; ASSERT_EQ(tDeserializeSBalanceVgroupReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req), TSDB_CODE_SUCCESS); + tFreeSBalanceVgroupReq(&req); }); run("BALANCE VGROUP"); @@ -870,6 +874,7 @@ TEST_F(ParserInitialATest, balanceVgroupLeader) { SBalanceVgroupLeaderReq req = {0}; ASSERT_EQ(tDeserializeSBalanceVgroupLeaderReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req), TSDB_CODE_SUCCESS); + tFreeSBalanceVgroupLeaderReq(&req); }); run("BALANCE VGROUP LEADER"); diff --git a/source/libs/parser/test/parExplainToSyncdbTest.cpp b/source/libs/parser/test/parExplainToSyncdbTest.cpp index fbb9ce227c..2f3c7e6f92 100644 --- a/source/libs/parser/test/parExplainToSyncdbTest.cpp +++ b/source/libs/parser/test/parExplainToSyncdbTest.cpp @@ -52,6 +52,7 @@ TEST_F(ParserExplainToSyncdbTest, grant) { ASSERT_EQ(req.alterType, expect.alterType); ASSERT_EQ(string(req.user), string(expect.user)); ASSERT_EQ(string(req.objname), string(expect.objname)); + tFreeSAlterUserReq(&req); }); setAlterUserReq(TSDB_ALTER_USER_ADD_PRIVILEGES, PRIVILEGE_TYPE_ALL, "wxy", "0.*"); @@ -183,6 +184,7 @@ TEST_F(ParserExplainToSyncdbTest, redistributeVgroup) { ASSERT_EQ(req.dnodeId1, expect.dnodeId1); ASSERT_EQ(req.dnodeId2, expect.dnodeId2); ASSERT_EQ(req.dnodeId3, expect.dnodeId3); + tFreeSRedistributeVgroupReq(&req); }); setRedistributeVgroupReqFunc(3, 1); @@ -228,6 +230,7 @@ TEST_F(ParserExplainToSyncdbTest, restoreDnode) { ASSERT_EQ(tDeserializeSRestoreDnodeReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req), TSDB_CODE_SUCCESS); ASSERT_EQ(req.dnodeId, expect.dnodeId); ASSERT_EQ(req.restoreType, expect.restoreType); + tFreeSRestoreDnodeReq(&req); }); setRestoreDnodeReq(1, RESTORE_TYPE__ALL); @@ -272,6 +275,7 @@ TEST_F(ParserExplainToSyncdbTest, revoke) { ASSERT_EQ(req.alterType, expect.alterType); ASSERT_EQ(string(req.user), string(expect.user)); ASSERT_EQ(string(req.objname), string(expect.objname)); + tFreeSAlterUserReq(&req); }); setAlterUserReq(TSDB_ALTER_USER_DEL_PRIVILEGES, PRIVILEGE_TYPE_ALL, "wxy", "0.*"); diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp index 0f6aa22050..1a3559316c 100644 --- a/source/libs/parser/test/parInitialCTest.cpp +++ b/source/libs/parser/test/parInitialCTest.cpp @@ -43,6 +43,7 @@ TEST_F(ParserInitialCTest, compact) { ASSERT_EQ(std::string(req.db), std::string(expect.db)); ASSERT_EQ(req.timeRange.skey, expect.timeRange.skey); ASSERT_EQ(req.timeRange.ekey, expect.timeRange.ekey); + tFreeSCompactDbReq(&req); }); setCompactDbReq("test"); @@ -374,6 +375,7 @@ TEST_F(ParserInitialCTest, createDnode) { ASSERT_EQ(std::string(req.fqdn), std::string(expect.fqdn)); ASSERT_EQ(req.port, expect.port); + tFreeSCreateDnodeReq(&req); }); setCreateDnodeReq("abc1", 7030); @@ -599,6 +601,7 @@ TEST_F(ParserInitialCTest, createMnode) { tDeserializeSCreateDropMQSNodeReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req)); ASSERT_EQ(req.dnodeId, expect.dnodeId); + tFreeSMCreateQnodeReq(&req); }); setCreateMnodeReq(1); @@ -622,6 +625,7 @@ TEST_F(ParserInitialCTest, createQnode) { tDeserializeSCreateDropMQSNodeReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req)); ASSERT_EQ(req.dnodeId, expect.dnodeId); + tFreeSMCreateQnodeReq(&req); }); setCreateQnodeReq(1); @@ -1326,6 +1330,7 @@ TEST_F(ParserInitialCTest, createUser) { ASSERT_EQ(req.enable, expect.enable); ASSERT_EQ(std::string(req.user), std::string(expect.user)); ASSERT_EQ(std::string(req.pass), std::string(expect.pass)); + tFreeSCreateUserReq(&req); }); setCreateUserReq("wxy", "123456"); diff --git a/source/libs/parser/test/parInitialDTest.cpp b/source/libs/parser/test/parInitialDTest.cpp index 937f76176e..1a724e7b70 100644 --- a/source/libs/parser/test/parInitialDTest.cpp +++ b/source/libs/parser/test/parInitialDTest.cpp @@ -117,6 +117,7 @@ TEST_F(ParserInitialDTest, dropDnode) { ASSERT_EQ(req.port, expect.port); ASSERT_EQ(req.force, expect.force); ASSERT_EQ(req.unsafe, expect.unsafe); + tFreeSDropDnodeReq(&req); }); setDropDnodeReqById(1); @@ -208,6 +209,7 @@ TEST_F(ParserInitialDTest, dropQnode) { tDeserializeSCreateDropMQSNodeReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req)); ASSERT_EQ(req.dnodeId, expect.dnodeId); + tFreeSDDropQnodeReq(&req); }); setDropQnodeReq(1); @@ -245,6 +247,7 @@ TEST_F(ParserInitialDTest, dropStream) { ASSERT_EQ(std::string(req.name), std::string(expect.name)); ASSERT_EQ(req.igNotExists, expect.igNotExists); + tFreeMDropStreamReq(&req); }); setDropStreamReq("s1"); @@ -285,6 +288,7 @@ TEST_F(ParserInitialDTest, dropUser) { ASSERT_TRUE(TSDB_CODE_SUCCESS == tDeserializeSDropUserReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req)); ASSERT_EQ(std::string(req.user), std::string(expect.user)); + tFreeSDropUserReq(&req); }); setDropUserReq("wxy"); diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index de889f9948..8326446c31 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -1714,28 +1714,25 @@ static int32_t sortForJoinOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pL SLogicNode* pLeft = (SLogicNode*)nodesListGetNode(pJoin->node.pChildren, 0); SLogicNode* pRight = (SLogicNode*)nodesListGetNode(pJoin->node.pChildren, 1); SScanLogicNode* pScan = NULL; + SLogicNode* pChild = NULL; + SNode** pChildPos = NULL; + EOrder targetOrder = 0; + SSHashObj* pTables = NULL; if (QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(pLeft) && ((SScanLogicNode*)pLeft)->node.outputTsOrder != SCAN_ORDER_BOTH) { pScan = (SScanLogicNode*)pLeft; + pChild = pRight; + pChildPos = &pJoin->node.pChildren->pTail->pNode; + targetOrder = pScan->node.outputTsOrder; } else if (QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(pRight) && ((SScanLogicNode*)pRight)->node.outputTsOrder != SCAN_ORDER_BOTH) { pScan = (SScanLogicNode*)pRight; - } - - if (NULL != pScan) { - switch (pScan->node.outputTsOrder) { - case SCAN_ORDER_ASC: - pScan->scanSeq[0] = 0; - pScan->scanSeq[1] = 1; - pScan->node.outputTsOrder = ORDER_DESC; - goto _return; - case SCAN_ORDER_DESC: - pScan->scanSeq[0] = 1; - pScan->scanSeq[1] = 0; - pScan->node.outputTsOrder = ORDER_ASC; - goto _return; - default: - break; - } + pChild = pLeft; + pChildPos = &pJoin->node.pChildren->pHead->pNode; + targetOrder = pScan->node.outputTsOrder; + } else { + pChild = pRight; + pChildPos = &pJoin->node.pChildren->pTail->pNode; + targetOrder = pLeft->outputTsOrder; } if (QUERY_NODE_OPERATOR != nodeType(pJoin->pPrimKeyEqCond)) { @@ -1749,16 +1746,15 @@ static int32_t sortForJoinOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pL } SNode* pOrderByNode = NULL; - SSHashObj* pLeftTables = NULL; - collectTableAliasFromNodes(nodesListGetNode(pJoin->node.pChildren, 0), &pLeftTables); - - if (NULL != tSimpleHashGet(pLeftTables, ((SColumnNode*)pOp->pLeft)->tableAlias, strlen(((SColumnNode*)pOp->pLeft)->tableAlias))) { + + collectTableAliasFromNodes((SNode*)pChild, &pTables); + if (NULL != tSimpleHashGet(pTables, ((SColumnNode*)pOp->pLeft)->tableAlias, strlen(((SColumnNode*)pOp->pLeft)->tableAlias))) { pOrderByNode = pOp->pLeft; - } else if (NULL != tSimpleHashGet(pLeftTables, ((SColumnNode*)pOp->pRight)->tableAlias, strlen(((SColumnNode*)pOp->pRight)->tableAlias))) { + } else if (NULL != tSimpleHashGet(pTables, ((SColumnNode*)pOp->pRight)->tableAlias, strlen(((SColumnNode*)pOp->pRight)->tableAlias))) { pOrderByNode = pOp->pRight; } - tSimpleHashCleanup(pLeftTables); + tSimpleHashCleanup(pTables); if (NULL == pOrderByNode) { return TSDB_CODE_PLAN_INTERNAL_ERROR; @@ -1769,7 +1765,13 @@ static int32_t sortForJoinOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pL return TSDB_CODE_OUT_OF_MEMORY; } - pSort->node.outputTsOrder = (ORDER_ASC == pLeft->outputTsOrder) ? ORDER_DESC : ORDER_ASC; + pSort->node.outputTsOrder = targetOrder; + pSort->node.pTargets = nodesCloneList(pChild->pTargets); + if (NULL == pSort->node.pTargets) { + nodesDestroyNode((SNode *)pSort); + return TSDB_CODE_OUT_OF_MEMORY; + } + pSort->groupSort = false; SOrderByExprNode* pOrder = (SOrderByExprNode*)nodesMakeNode(QUERY_NODE_ORDER_BY_EXPR); if (NULL == pOrder) { @@ -1778,7 +1780,7 @@ static int32_t sortForJoinOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pL } nodesListMakeAppend(&pSort->pSortKeys, (SNode*)pOrder); - pOrder->order = (ORDER_ASC == pLeft->outputTsOrder) ? ORDER_DESC : ORDER_ASC; + pOrder->order = targetOrder; pOrder->pExpr = nodesCloneNode(pOrderByNode); pOrder->nullOrder = (ORDER_ASC == pOrder->order) ? NULL_ORDER_FIRST : NULL_ORDER_LAST; if (!pOrder->pExpr) { @@ -1786,9 +1788,9 @@ static int32_t sortForJoinOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pL return TSDB_CODE_OUT_OF_MEMORY; } - pLeft->pParent = (SLogicNode*)pSort; - nodesListMakeAppend(&pSort->node.pChildren, (SNode*)pLeft); - pJoin->node.pChildren->pHead->pNode = (SNode*)pSort; + pChild->pParent = (SLogicNode*)pSort; + nodesListMakeAppend(&pSort->node.pChildren, (SNode*)pChild); + *pChildPos = (SNode*)pSort; pSort->node.pParent = (SLogicNode*)pJoin;; _return: @@ -3234,6 +3236,7 @@ static int32_t lastRowScanOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogic } nodesClearList(cxt.pLastCols); } + nodesClearList(cxt.pOtherCols); pAgg->hasLastRow = false; pAgg->hasLast = false; diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index d19aaa31de..34c2fd7768 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -1759,6 +1759,8 @@ static ENodeType getIntervalOperatorType(EWindowAlgorithm windowAlgo) { return QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL; case INTERVAL_ALGO_STREAM_SEMI: return QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL; + case INTERVAL_ALGO_STREAM_MID: + return QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL; case INTERVAL_ALGO_STREAM_SINGLE: return QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL; case SESSION_ALGO_STREAM_FINAL: @@ -2306,6 +2308,8 @@ static SSubplan* makeSubplan(SPhysiPlanContext* pCxt, SLogicSubplan* pLogicSubpl pSubplan->level = pLogicSubplan->level; pSubplan->rowsThreshold = 4096; pSubplan->dynamicRowThreshold = false; + pSubplan->isView = pCxt->pPlanCxt->isView; + pSubplan->isAudit = pCxt->pPlanCxt->isAudit; if (NULL != pCxt->pPlanCxt->pUser) { snprintf(pSubplan->user, sizeof(pSubplan->user), "%s", pCxt->pPlanCxt->pUser); } diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index 28e31b7a4f..4099f2be42 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -344,11 +344,12 @@ static bool stbSplFindSplitNode(SSplitContext* pCxt, SLogicSubplan* pSubplan, SL return false; } -static int32_t stbSplRewriteFuns(const SNodeList* pFuncs, SNodeList** pPartialFuncs, SNodeList** pMergeFuncs) { +static int32_t stbSplRewriteFuns(const SNodeList* pFuncs, SNodeList** pPartialFuncs, SNodeList** pMidFuncs, SNodeList** pMergeFuncs) { SNode* pNode = NULL; FOREACH(pNode, pFuncs) { SFunctionNode* pFunc = (SFunctionNode*)pNode; SFunctionNode* pPartFunc = NULL; + SFunctionNode* pMidFunc = NULL; SFunctionNode* pMergeFunc = NULL; int32_t code = TSDB_CODE_SUCCESS; if (fmIsWindowPseudoColumnFunc(pFunc->funcId)) { @@ -359,18 +360,33 @@ static int32_t stbSplRewriteFuns(const SNodeList* pFuncs, SNodeList** pPartialFu nodesDestroyNode((SNode*)pMergeFunc); code = TSDB_CODE_OUT_OF_MEMORY; } + if(pMidFuncs != NULL){ + pMidFunc = (SFunctionNode*)nodesCloneNode(pNode); + if (NULL == pMidFunc) { + nodesDestroyNode((SNode*)pMidFunc); + code = TSDB_CODE_OUT_OF_MEMORY; + } + } } else { - code = fmGetDistMethod(pFunc, &pPartFunc, &pMergeFunc); + code = fmGetDistMethod(pFunc, &pPartFunc, &pMidFunc, &pMergeFunc); } if (TSDB_CODE_SUCCESS == code) { code = nodesListMakeStrictAppend(pPartialFuncs, (SNode*)pPartFunc); } + if (TSDB_CODE_SUCCESS == code) { + if(pMidFuncs != NULL){ + code = nodesListMakeStrictAppend(pMidFuncs, (SNode*)pMidFunc); + }else{ + nodesDestroyNode((SNode*)pMidFunc); + } + } if (TSDB_CODE_SUCCESS == code) { code = nodesListMakeStrictAppend(pMergeFuncs, (SNode*)pMergeFunc); } if (TSDB_CODE_SUCCESS != code) { - nodesDestroyList(*pPartialFuncs); - nodesDestroyList(*pMergeFuncs); + nodesDestroyNode((SNode*)pPartFunc); + nodesDestroyNode((SNode*)pMidFunc); + nodesDestroyNode((SNode*)pMergeFunc); return code; } } @@ -463,7 +479,7 @@ static int32_t stbSplCreatePartWindowNode(SWindowLogicNode* pMergeWindow, SLogic splSetParent((SLogicNode*)pPartWin); int32_t index = 0; - int32_t code = stbSplRewriteFuns(pFunc, &pPartWin->pFuncs, &pMergeWindow->pFuncs); + int32_t code = stbSplRewriteFuns(pFunc, &pPartWin->pFuncs, NULL, &pMergeWindow->pFuncs); if (TSDB_CODE_SUCCESS == code) { code = stbSplAppendWStart(pPartWin->pFuncs, &index, ((SColumnNode*)pMergeWindow->pTspk)->node.resType.precision); } @@ -488,6 +504,85 @@ static int32_t stbSplCreatePartWindowNode(SWindowLogicNode* pMergeWindow, SLogic return code; } +static int32_t stbSplCreatePartMidWindowNode(SWindowLogicNode* pMergeWindow, SLogicNode** pPartWindow, SLogicNode** pMidWindow) { + SNodeList* pFunc = pMergeWindow->pFuncs; + pMergeWindow->pFuncs = NULL; + SNodeList* pTargets = pMergeWindow->node.pTargets; + pMergeWindow->node.pTargets = NULL; + SNodeList* pChildren = pMergeWindow->node.pChildren; + pMergeWindow->node.pChildren = NULL; + SNode* pConditions = pMergeWindow->node.pConditions; + pMergeWindow->node.pConditions = NULL; + + SWindowLogicNode* pPartWin = (SWindowLogicNode*)nodesCloneNode((SNode*)pMergeWindow); + if (NULL == pPartWin) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + SWindowLogicNode* pMidWin = (SWindowLogicNode*)nodesCloneNode((SNode*)pMergeWindow); + if (NULL == pMidWin) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + pPartWin->node.groupAction = GROUP_ACTION_KEEP; + pMidWin->node.groupAction = GROUP_ACTION_KEEP; + pMergeWindow->node.pTargets = pTargets; + pMergeWindow->node.pConditions = pConditions; + + pPartWin->node.pChildren = pChildren; + splSetParent((SLogicNode*)pPartWin); + + SNodeList* pFuncPart = NULL; + SNodeList* pFuncMid = NULL; + SNodeList* pFuncMerge = NULL; + int32_t code = stbSplRewriteFuns(pFunc, &pFuncPart, &pFuncMid, &pFuncMerge); + pPartWin->pFuncs = pFuncPart; + pMidWin->pFuncs = pFuncMid; + pMergeWindow->pFuncs = pFuncMerge; + + int32_t index = 0; + if (TSDB_CODE_SUCCESS == code) { + code = stbSplAppendWStart(pPartWin->pFuncs, &index, ((SColumnNode*)pMergeWindow->pTspk)->node.resType.precision); + } + if (TSDB_CODE_SUCCESS == code) { + code = createColumnByRewriteExprs(pPartWin->pFuncs, &pPartWin->node.pTargets); + } + + if (TSDB_CODE_SUCCESS == code) { + nodesDestroyNode(pMidWin->pTspk); + pMidWin->pTspk = nodesCloneNode(nodesListGetNode(pPartWin->node.pTargets, index)); + if (NULL == pMidWin->pTspk) { + code = TSDB_CODE_OUT_OF_MEMORY; + } + } + + if (TSDB_CODE_SUCCESS == code) { + code = stbSplAppendWStart(pMidWin->pFuncs, &index, ((SColumnNode*)pMergeWindow->pTspk)->node.resType.precision); + } + if (TSDB_CODE_SUCCESS == code) { + code = createColumnByRewriteExprs(pMidWin->pFuncs, &pMidWin->node.pTargets); + } + + if (TSDB_CODE_SUCCESS == code) { + nodesDestroyNode(pMergeWindow->pTspk); + pMergeWindow->pTspk = nodesCloneNode(nodesListGetNode(pMidWin->node.pTargets, index)); + if (NULL == pMergeWindow->pTspk) { + code = TSDB_CODE_OUT_OF_MEMORY; + } + } + + nodesDestroyList(pFunc); + if (TSDB_CODE_SUCCESS == code) { + *pPartWindow = (SLogicNode*)pPartWin; + *pMidWindow = (SLogicNode*)pMidWin; + } else { + nodesDestroyNode((SNode*)pPartWin); + nodesDestroyNode((SNode*)pMidWin); + } + + return code; +} + static int32_t stbSplGetNumOfVgroups(SLogicNode* pNode) { if (QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(pNode)) { return ((SScanLogicNode*)pNode)->pVgroupList->numOfVgroups; @@ -635,18 +730,31 @@ static int32_t stbSplSplitIntervalForBatch(SSplitContext* pCxt, SStableSplitInfo return code; } -static int32_t stbSplSplitIntervalForStream(SSplitContext* pCxt, SStableSplitInfo* pInfo) { +static int32_t stbSplSplitIntervalForStreamMultiAgg(SSplitContext* pCxt, SStableSplitInfo* pInfo) { SLogicNode* pPartWindow = NULL; - int32_t code = stbSplCreatePartWindowNode((SWindowLogicNode*)pInfo->pSplitNode, &pPartWindow); + SLogicNode* pMidWindow = NULL; + int32_t code = stbSplCreatePartMidWindowNode((SWindowLogicNode*)pInfo->pSplitNode, &pPartWindow, &pMidWindow); if (TSDB_CODE_SUCCESS == code) { - ((SWindowLogicNode*)pPartWindow)->windowAlgo = INTERVAL_ALGO_STREAM_SEMI; + ((SWindowLogicNode*)pMidWindow)->windowAlgo = INTERVAL_ALGO_STREAM_MID; ((SWindowLogicNode*)pInfo->pSplitNode)->windowAlgo = INTERVAL_ALGO_STREAM_FINAL; - code = stbSplCreateExchangeNode(pCxt, pInfo->pSplitNode, pPartWindow); + ((SWindowLogicNode*)pPartWindow)->windowAlgo = INTERVAL_ALGO_STREAM_SEMI; + code = stbSplCreateExchangeNode(pCxt, pInfo->pSplitNode, pMidWindow); + if (TSDB_CODE_SUCCESS == code) { + code = stbSplCreateExchangeNode(pCxt, pMidWindow, pPartWindow); + } } + if (TSDB_CODE_SUCCESS == code) { - code = nodesListMakeStrictAppend(&pInfo->pSubplan->pChildren, + SNode* subPlan = (SNode*)splCreateSubplan(pCxt, pMidWindow); + ((SLogicSubplan*)subPlan)->subplanType = SUBPLAN_TYPE_MERGE; + + code = nodesListMakeStrictAppend(&((SLogicSubplan*)subPlan)->pChildren, (SNode*)splCreateScanSubplan(pCxt, pPartWindow, SPLIT_FLAG_STABLE_SPLIT)); + if (TSDB_CODE_SUCCESS == code) { + code = nodesListMakeStrictAppend(&pInfo->pSubplan->pChildren, subPlan); + } } + pInfo->pSubplan->subplanType = SUBPLAN_TYPE_MERGE; ++(pCxt->groupId); return code; @@ -654,7 +762,7 @@ static int32_t stbSplSplitIntervalForStream(SSplitContext* pCxt, SStableSplitInf static int32_t stbSplSplitInterval(SSplitContext* pCxt, SStableSplitInfo* pInfo) { if (pCxt->pPlanCxt->streamQuery) { - return stbSplSplitIntervalForStream(pCxt, pInfo); + return stbSplSplitIntervalForStreamMultiAgg(pCxt, pInfo); } else { return stbSplSplitIntervalForBatch(pCxt, pInfo); } @@ -860,7 +968,7 @@ static int32_t stbSplCreatePartAggNode(SAggLogicNode* pMergeAgg, SLogicNode** pO pPartAgg->node.pChildren = pChildren; splSetParent((SLogicNode*)pPartAgg); - code = stbSplRewriteFuns(pFunc, &pPartAgg->pAggFuncs, &pMergeAgg->pAggFuncs); + code = stbSplRewriteFuns(pFunc, &pPartAgg->pAggFuncs, NULL, &pMergeAgg->pAggFuncs); } if (TSDB_CODE_SUCCESS == code) { code = createColumnByRewriteExprs(pPartAgg->pAggFuncs, &pPartAgg->node.pTargets); diff --git a/source/libs/planner/src/planValidator.c b/source/libs/planner/src/planValidator.c index a5d729ab84..4fcd064e56 100755 --- a/source/libs/planner/src/planValidator.c +++ b/source/libs/planner/src/planValidator.c @@ -95,6 +95,7 @@ int32_t doValidatePhysiNode(SValidatePlanContext* pCxt, SNode* pNode) { case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL: case QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL: case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL: case QUERY_NODE_PHYSICAL_PLAN_FILL: case QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL: case QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION: diff --git a/source/libs/qworker/src/qwMsg.c b/source/libs/qworker/src/qwMsg.c index 9a1c309ab0..66ec460861 100644 --- a/source/libs/qworker/src/qwMsg.c +++ b/source/libs/qworker/src/qwMsg.c @@ -360,10 +360,24 @@ int32_t qWorkerPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg, bool chkGran QW_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); } - if (chkGrant && (!TEST_SHOW_REWRITE_MASK(msg.msgMask)) && !taosGranted()) { - QW_ELOG("query failed cause of grant expired, msgMask:%d", msg.msgMask); - tFreeSSubQueryMsg(&msg); - QW_ERR_RET(TSDB_CODE_GRANT_EXPIRED); + if (chkGrant) { + if ((!TEST_SHOW_REWRITE_MASK(msg.msgMask))) { + if (!taosGranted(TSDB_GRANT_ALL)) { + QW_ELOG("query failed cause of grant expired, msgMask:%d", msg.msgMask); + tFreeSSubQueryMsg(&msg); + QW_ERR_RET(TSDB_CODE_GRANT_EXPIRED); + } + if ((TEST_VIEW_MASK(msg.msgMask)) && !taosGranted(TSDB_GRANT_VIEW)) { + QW_ELOG("query failed cause of view grant expired, msgMask:%d", msg.msgMask); + tFreeSSubQueryMsg(&msg); + QW_ERR_RET(TSDB_CODE_GRANT_EXPIRED); + } + if ((TEST_AUDIT_MASK(msg.msgMask)) && !taosGranted(TSDB_GRANT_AUDIT)) { + QW_ELOG("query failed cause of audit grant expired, msgMask:%d", msg.msgMask); + tFreeSSubQueryMsg(&msg); + QW_ERR_RET(TSDB_CODE_GRANT_EXPIRED); + } + } } uint64_t sId = msg.sId; diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index 7376aa3a9c..594bb205d8 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -543,7 +543,7 @@ int32_t qwHandlePrePhaseEvents(QW_FPARAMS_DEF, int8_t phase, SQWPhaseInput *inpu if (QW_EVENT_RECEIVED(ctx, QW_EVENT_FETCH)) { QW_TASK_WLOG("last fetch still not processed, phase:%s", qwPhaseStr(phase)); - QW_ERR_JRET(TSDB_CODE_QRY_DUPLICATTED_OPERATION); + QW_ERR_JRET(TSDB_CODE_QRY_DUPLICATED_OPERATION); } if (ctx->rspCode) { @@ -737,6 +737,13 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, char *sql) { QW_ERR_JRET(code); } +#if 0 + SReadHandle* pReadHandle = qwMsg->node; + int64_t delay = 0; + bool fhFinish = false; + pReadHandle->api.tqReaderFn.tqGetStreamExecProgress(pReadHandle->vnode, 0, &delay, &fhFinish); +#endif + code = qCreateExecTask(qwMsg->node, mgmt->nodeId, tId, plan, &pTaskInfo, &sinkHandle, sql, OPTR_EXEC_MODEL_BATCH); sql = NULL; if (code) { @@ -972,7 +979,7 @@ int32_t qwProcessDrop(QW_FPARAMS_DEF, SQWMsg *qwMsg) { if (QW_EVENT_RECEIVED(ctx, QW_EVENT_DROP)) { QW_TASK_WLOG_E("task already dropping"); - QW_ERR_JRET(TSDB_CODE_QRY_DUPLICATTED_OPERATION); + QW_ERR_JRET(TSDB_CODE_QRY_DUPLICATED_OPERATION); } if (QW_QUERY_RUNNING(ctx)) { diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index 26552f25b4..62fda148cd 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -1815,9 +1815,8 @@ int32_t winEndTsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p return TSDB_CODE_SUCCESS; } -int32_t qTbnameFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { - char* p = colDataGetVarData(pInput->columnData, 0); - +int32_t qPseudoTagFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { + char *p = colDataGetData(pInput->columnData, 0); int32_t code = colDataSetNItems(pOutput->columnData, pOutput->numOfRows, p, pInput->numOfRows, true); if (code) { return code; @@ -1826,31 +1825,6 @@ int32_t qTbnameFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pO pOutput->numOfRows += pInput->numOfRows; return TSDB_CODE_SUCCESS; } -#ifdef BUILD_NO_CALL -int32_t qTbUidFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { - char* p = colDataGetNumData(pInput->columnData, 0); - - int32_t code = colDataSetNItems(pOutput->columnData, pOutput->numOfRows, p, pInput->numOfRows, true); - if (code) { - return code; - } - - pOutput->numOfRows += pInput->numOfRows; - return TSDB_CODE_SUCCESS; -} - -int32_t qVgIdFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { - char* p = colDataGetNumData(pInput->columnData, 0); - - int32_t code = colDataSetNItems(pOutput->columnData, pOutput->numOfRows, p, pInput->numOfRows, true); - if (code) { - return code; - } - - pOutput->numOfRows += pInput->numOfRows; - return TSDB_CODE_SUCCESS; -} -#endif /** Aggregation functions **/ int32_t countScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index 5c67c7974f..1c0b31109e 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -1109,6 +1109,8 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, qMsg.refId = pJob->refId; qMsg.execId = pTask->execId; qMsg.msgMask = (pTask->plan->showRewrite) ? QUERY_MSG_MASK_SHOW_REWRITE() : 0; + qMsg.msgMask |= (pTask->plan->isView) ? QUERY_MSG_MASK_VIEW() : 0; + qMsg.msgMask |= (pTask->plan->isAudit) ? QUERY_MSG_MASK_AUDIT() : 0; qMsg.taskType = TASK_TYPE_TEMP; qMsg.explain = SCH_IS_EXPLAIN_JOB(pJob); qMsg.needFetch = SCH_TASK_NEED_FETCH(pTask); diff --git a/source/libs/stream/inc/streamInt.h b/source/libs/stream/inc/streamInt.h index 0534f2c30c..300b0a7f24 100644 --- a/source/libs/stream/inc/streamInt.h +++ b/source/libs/stream/inc/streamInt.h @@ -107,7 +107,7 @@ SStreamDataBlock* createStreamBlockFromResults(SStreamQueueItem* pItem, SStreamT void destroyStreamDataBlock(SStreamDataBlock* pBlock); int32_t streamRetrieveReqToData(const SStreamRetrieveReq* pReq, SStreamDataBlock* pData); -int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock); +int32_t streamBroadcastToUpTasks(SStreamTask* pTask, const SSDataBlock* pBlock); int32_t tEncodeStreamRetrieveReq(SEncoder* pEncoder, const SStreamRetrieveReq* pReq); @@ -123,7 +123,7 @@ int32_t streamTaskInitTokenBucket(STokenBucket* pBucket, int32_t numCap, int32_t STaskId streamTaskGetTaskId(const SStreamTask* pTask); void streamTaskInitForLaunchHTask(SHistoryTaskInfo* pInfo); void streamTaskSetRetryInfoForLaunch(SHistoryTaskInfo* pInfo); -int32_t streamTaskFillHistoryFinished(SStreamTask* pTask); +int32_t streamTaskResetTimewindowFilter(SStreamTask* pTask); void streamClearChkptReadyMsg(SStreamTask* pTask); int32_t streamTaskGetDataFromInputQ(SStreamTask* pTask, SStreamQueueItem** pInput, int32_t* numOfBlocks, diff --git a/source/libs/stream/src/stream.c b/source/libs/stream/src/stream.c index c3373c1e7f..7830bbdd39 100644 --- a/source/libs/stream/src/stream.c +++ b/source/libs/stream/src/stream.c @@ -181,7 +181,7 @@ static int32_t streamTaskAppendInputBlocks(SStreamTask* pTask, const SStreamDisp return status; } -int32_t streamTaskEnqueueRetrieve(SStreamTask* pTask, SStreamRetrieveReq* pReq, SRpcMsg* pRsp) { +int32_t streamTaskEnqueueRetrieve(SStreamTask* pTask, SStreamRetrieveReq* pReq) { SStreamDataBlock* pData = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM, sizeof(SStreamDataBlock)); int8_t status = TASK_INPUT_STATUS__NORMAL; @@ -203,17 +203,6 @@ int32_t streamTaskEnqueueRetrieve(SStreamTask* pTask, SStreamRetrieveReq* pReq, /*status = TASK_INPUT_STATUS__FAILED;*/ } - // rsp by input status - void* buf = rpcMallocCont(sizeof(SMsgHead) + sizeof(SStreamRetrieveRsp)); - ((SMsgHead*)buf)->vgId = htonl(pReq->srcNodeId); - SStreamRetrieveRsp* pCont = POINTER_SHIFT(buf, sizeof(SMsgHead)); - pCont->streamId = pReq->streamId; - pCont->rspToTaskId = pReq->srcTaskId; - pCont->rspFromTaskId = pReq->dstTaskId; - pRsp->pCont = buf; - pRsp->contLen = sizeof(SMsgHead) + sizeof(SStreamRetrieveRsp); - tmsgSendRsp(pRsp); - return status == TASK_INPUT_STATUS__NORMAL ? 0 : -1; } @@ -295,11 +284,12 @@ int32_t streamProcessDispatchMsg(SStreamTask* pTask, SStreamDispatchReq* pReq, S return 0; } -int32_t streamProcessRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* pReq, SRpcMsg* pRsp) { - streamTaskEnqueueRetrieve(pTask, pReq, pRsp); - ASSERT(pTask->info.taskLevel != TASK_LEVEL__SINK); - streamSchedExec(pTask); - return 0; +int32_t streamProcessRetrieveReq(SStreamTask* pTask, SStreamRetrieveReq* pReq) { + int32_t code = streamTaskEnqueueRetrieve(pTask, pReq); + if(code != 0){ + return code; + } + return streamSchedExec(pTask); } void streamTaskInputFail(SStreamTask* pTask) { atomic_store_8(&pTask->inputq.status, TASK_INPUT_STATUS__FAILED); } diff --git a/source/libs/stream/src/streamCheckpoint.c b/source/libs/stream/src/streamCheckpoint.c index 50a010d779..b1783fb640 100644 --- a/source/libs/stream/src/streamCheckpoint.c +++ b/source/libs/stream/src/streamCheckpoint.c @@ -116,7 +116,6 @@ static int32_t streamAlignCheckpoint(SStreamTask* pTask) { return atomic_sub_fetch_32(&pTask->chkInfo.downstreamAlignNum, 1); } -// todo handle down the transId of checkpoint to sink/agg tasks. static int32_t appendCheckpointIntoInputQ(SStreamTask* pTask, int32_t checkpointType) { SStreamDataBlock* pChkpoint = taosAllocateQitem(sizeof(SStreamDataBlock), DEF_QITEM, sizeof(SSDataBlock)); if (pChkpoint == NULL) { @@ -133,6 +132,7 @@ static int32_t appendCheckpointIntoInputQ(SStreamTask* pTask, int32_t checkpoint pBlock->info.type = STREAM_CHECKPOINT; pBlock->info.version = pTask->chkInfo.checkpointingId; + pBlock->info.window.ekey = pBlock->info.window.skey = pTask->chkInfo.transId; // NOTE: set the transId pBlock->info.rows = 1; pBlock->info.childId = pTask->info.selfChildId; @@ -158,7 +158,7 @@ int32_t streamProcessCheckpointSourceReq(SStreamTask* pTask, SStreamCheckpointSo pTask->chkInfo.transId = pReq->transId; pTask->chkInfo.checkpointingId = pReq->checkpointId; - pTask->chkInfo.checkpointNotReadyTasks = streamTaskGetNumOfDownstream(pTask); + pTask->chkInfo.numOfNotReady = streamTaskGetNumOfDownstream(pTask); pTask->chkInfo.startTs = taosGetTimestampMs(); pTask->execInfo.checkpoint += 1; @@ -185,17 +185,20 @@ static int32_t continueDispatchCheckpointBlock(SStreamDataBlock* pBlock, SStream int32_t streamProcessCheckpointBlock(SStreamTask* pTask, SStreamDataBlock* pBlock) { SSDataBlock* pDataBlock = taosArrayGet(pBlock->blocks, 0); int64_t checkpointId = pDataBlock->info.version; + int32_t transId = pDataBlock->info.window.skey; const char* id = pTask->id.idStr; int32_t code = TSDB_CODE_SUCCESS; int32_t vgId = pTask->pMeta->vgId; stDebug("s-task:%s vgId:%d start to handle the checkpoint block, checkpointId:%" PRId64 " ver:%" PRId64 - ", current checkpointingId:%" PRId64, - id, vgId, pTask->chkInfo.checkpointId, pTask->chkInfo.checkpointVer, checkpointId); + ", transId:%d current checkpointingId:%" PRId64, + id, vgId, pTask->chkInfo.checkpointId, pTask->chkInfo.checkpointVer, transId, checkpointId); // set task status if (streamTaskGetStatus(pTask)->state != TASK_STATUS__CK) { pTask->chkInfo.checkpointingId = checkpointId; + pTask->chkInfo.transId = transId; + code = streamTaskHandleEvent(pTask->status.pSM, TASK_EVENT_GEN_CHECKPOINT); if (code != TSDB_CODE_SUCCESS) { stError("s-task:%s handle checkpoint-trigger block failed, code:%s", id, tstrerror(code)); @@ -211,7 +214,7 @@ int32_t streamProcessCheckpointBlock(SStreamTask* pTask, SStreamDataBlock* pBloc stDebug("s-task:%s set childIdx:%d, and add checkpoint-trigger block into outputQ", id, pTask->info.selfChildId); continueDispatchCheckpointBlock(pBlock, pTask); } else { // only one task exists, no need to dispatch downstream info - atomic_add_fetch_32(&pTask->chkInfo.checkpointNotReadyTasks, 1); + atomic_add_fetch_32(&pTask->chkInfo.numOfNotReady, 1); streamProcessCheckpointReadyMsg(pTask); streamFreeQitem((SStreamQueueItem*)pBlock); } @@ -246,7 +249,7 @@ int32_t streamProcessCheckpointBlock(SStreamTask* pTask, SStreamDataBlock* pBloc // set the needed checked downstream tasks, only when all downstream tasks do checkpoint complete, this task // can start local checkpoint procedure - pTask->chkInfo.checkpointNotReadyTasks = streamTaskGetNumOfDownstream(pTask); + pTask->chkInfo.numOfNotReady = streamTaskGetNumOfDownstream(pTask); // Put the checkpoint block into inputQ, to make sure all blocks with less version have been handled by this task // already. And then, dispatch check point msg to all downstream tasks @@ -265,7 +268,7 @@ int32_t streamProcessCheckpointReadyMsg(SStreamTask* pTask) { ASSERT(pTask->info.taskLevel == TASK_LEVEL__SOURCE || pTask->info.taskLevel == TASK_LEVEL__AGG); // only when all downstream tasks are send checkpoint rsp, we can start the checkpoint procedure for the agg task - int32_t notReady = atomic_sub_fetch_32(&pTask->chkInfo.checkpointNotReadyTasks, 1); + int32_t notReady = atomic_sub_fetch_32(&pTask->chkInfo.numOfNotReady, 1); ASSERT(notReady >= 0); if (notReady == 0) { @@ -284,7 +287,7 @@ void streamTaskClearCheckInfo(SStreamTask* pTask, bool clearChkpReadyMsg) { pTask->chkInfo.checkpointingId = 0; // clear the checkpoint id pTask->chkInfo.failedId = 0; pTask->chkInfo.startTs = 0; // clear the recorded start time - pTask->chkInfo.checkpointNotReadyTasks = 0; + pTask->chkInfo.numOfNotReady = 0; pTask->chkInfo.transId = 0; pTask->chkInfo.dispatchCheckpointTrigger = false; diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index 6b7c0fc69a..98d9a29c87 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -162,16 +162,71 @@ int32_t tDecodeStreamRetrieveReq(SDecoder* pDecoder, SStreamRetrieveReq* pReq) { return 0; } -void tDeleteStreamRetrieveReq(SStreamRetrieveReq* pReq) { taosMemoryFree(pReq->pRetrieve); } +void sendRetrieveRsp(SStreamRetrieveReq *pReq, SRpcMsg* pRsp){ + void* buf = rpcMallocCont(sizeof(SMsgHead) + sizeof(SStreamRetrieveRsp)); + ((SMsgHead*)buf)->vgId = htonl(pReq->srcNodeId); + SStreamRetrieveRsp* pCont = POINTER_SHIFT(buf, sizeof(SMsgHead)); + pCont->streamId = pReq->streamId; + pCont->rspToTaskId = pReq->srcTaskId; + pCont->rspFromTaskId = pReq->dstTaskId; + pRsp->pCont = buf; + pRsp->contLen = sizeof(SMsgHead) + sizeof(SStreamRetrieveRsp); + tmsgSendRsp(pRsp); +} -int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock) { - int32_t code = -1; +int32_t broadcastRetrieveMsg(SStreamTask* pTask, SStreamRetrieveReq *req){ + int32_t code = 0; + void* buf = NULL; + int32_t sz = taosArrayGetSize(pTask->upstreamInfo.pList); + ASSERT(sz > 0); + for (int32_t i = 0; i < sz; i++) { + req->reqId = tGenIdPI64(); + SStreamChildEpInfo* pEpInfo = taosArrayGetP(pTask->upstreamInfo.pList, i); + req->dstNodeId = pEpInfo->nodeId; + req->dstTaskId = pEpInfo->taskId; + int32_t len; + tEncodeSize(tEncodeStreamRetrieveReq, req, len, code); + if (code != 0) { + ASSERT(0); + return code; + } + + buf = rpcMallocCont(sizeof(SMsgHead) + len); + if (buf == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + return code; + } + + ((SMsgHead*)buf)->vgId = htonl(pEpInfo->nodeId); + void* abuf = POINTER_SHIFT(buf, sizeof(SMsgHead)); + SEncoder encoder; + tEncoderInit(&encoder, abuf, len); + tEncodeStreamRetrieveReq(&encoder, req); + tEncoderClear(&encoder); + + SRpcMsg rpcMsg = {0}; + initRpcMsg(&rpcMsg, TDMT_STREAM_RETRIEVE, buf, len + sizeof(SMsgHead)); + + code = tmsgSendReq(&pEpInfo->epSet, &rpcMsg); + if (code != 0) { + ASSERT(0); + rpcFreeCont(buf); + return code; + } + + buf = NULL; + stDebug("s-task:%s (child %d) send retrieve req to task:0x%x (vgId:%d), reqId:0x%" PRIx64, pTask->id.idStr, + pTask->info.selfChildId, pEpInfo->taskId, pEpInfo->nodeId, req->reqId); + } + return code; +} + +static int32_t buildStreamRetrieveReq(SStreamTask* pTask, const SSDataBlock* pBlock, SStreamRetrieveReq* req){ SRetrieveTableRsp* pRetrieve = NULL; - void* buf = NULL; int32_t dataStrLen = sizeof(SRetrieveTableRsp) + blockGetEncodeSize(pBlock); pRetrieve = taosMemoryCalloc(1, dataStrLen); - if (pRetrieve == NULL) return -1; + if (pRetrieve == NULL) return TSDB_CODE_OUT_OF_MEMORY; int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock); pRetrieve->useconds = 0; @@ -187,57 +242,24 @@ int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock) int32_t actualLen = blockEncode(pBlock, pRetrieve->data, numOfCols); - SStreamRetrieveReq req = { - .streamId = pTask->id.streamId, - .srcNodeId = pTask->info.nodeId, - .srcTaskId = pTask->id.taskId, - .pRetrieve = pRetrieve, - .retrieveLen = dataStrLen, - }; + req->streamId = pTask->id.streamId; + req->srcNodeId = pTask->info.nodeId; + req->srcTaskId = pTask->id.taskId; + req->pRetrieve = pRetrieve; + req->retrieveLen = dataStrLen; + return 0; +} - int32_t sz = taosArrayGetSize(pTask->upstreamInfo.pList); - ASSERT(sz > 0); - for (int32_t i = 0; i < sz; i++) { - req.reqId = tGenIdPI64(); - SStreamChildEpInfo* pEpInfo = taosArrayGetP(pTask->upstreamInfo.pList, i); - req.dstNodeId = pEpInfo->nodeId; - req.dstTaskId = pEpInfo->taskId; - int32_t len; - tEncodeSize(tEncodeStreamRetrieveReq, &req, len, code); - if (code < 0) { - ASSERT(0); - return -1; - } - - buf = rpcMallocCont(sizeof(SMsgHead) + len); - if (buf == NULL) { - goto CLEAR; - } - - ((SMsgHead*)buf)->vgId = htonl(pEpInfo->nodeId); - void* abuf = POINTER_SHIFT(buf, sizeof(SMsgHead)); - SEncoder encoder; - tEncoderInit(&encoder, abuf, len); - tEncodeStreamRetrieveReq(&encoder, &req); - tEncoderClear(&encoder); - - SRpcMsg rpcMsg = {0}; - initRpcMsg(&rpcMsg, TDMT_STREAM_RETRIEVE, buf, len + sizeof(SMsgHead)); - - if (tmsgSendReq(&pEpInfo->epSet, &rpcMsg) < 0) { - ASSERT(0); - goto CLEAR; - } - - buf = NULL; - stDebug("s-task:%s (child %d) send retrieve req to task:0x%x (vgId:%d), reqId:0x%" PRIx64, pTask->id.idStr, - pTask->info.selfChildId, pEpInfo->taskId, pEpInfo->nodeId, req.reqId); +int32_t streamBroadcastToUpTasks(SStreamTask* pTask, const SSDataBlock* pBlock) { + SStreamRetrieveReq req; + int32_t code = buildStreamRetrieveReq(pTask, pBlock, &req); + if(code != 0){ + return code; } - code = 0; -CLEAR: - taosMemoryFree(pRetrieve); - rpcFreeCont(buf); + code = broadcastRetrieveMsg(pTask, &req); + taosMemoryFree(req.pRetrieve); + return code; } diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index 27748c84a0..840a7678f2 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -138,7 +138,7 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, SStreamQueueItem* pItem, i } if (output->info.type == STREAM_RETRIEVE) { - if (streamBroadcastToChildren(pTask, output) < 0) { + if (streamBroadcastToUpTasks(pTask, output) < 0) { // TODO } continue; @@ -388,8 +388,7 @@ int32_t streamDoTransferStateToStreamTask(SStreamTask* pTask) { pStreamTask->id.idStr, TASK_LEVEL__SOURCE, pTimeWindow->skey, pTimeWindow->ekey, INT64_MIN, pTimeWindow->ekey, p, pStreamTask->status.schedStatus); - pTimeWindow->skey = INT64_MIN; - qStreamInfoResetTimewindowFilter(pStreamTask->exec.pExecutor); + streamTaskResetTimewindowFilter(pStreamTask); } else { stDebug("s-task:%s no need to update/reset filter time window for non-source tasks", pStreamTask->id.idStr); } @@ -400,7 +399,6 @@ int32_t streamDoTransferStateToStreamTask(SStreamTask* pTask) { // 3. send msg to mnode to launch a checkpoint to keep the state for current stream streamTaskSendCheckpointReq(pStreamTask); -// streamTaskResume(pStreamTask); // 4. assign the status to the value that will be kept in disk pStreamTask->status.taskStatus = streamTaskGetStatus(pStreamTask)->state; @@ -419,10 +417,6 @@ int32_t streamTransferStateToStreamTask(SStreamTask* pTask) { ASSERT(pTask->status.appendTranstateBlock == 1); int32_t level = pTask->info.taskLevel; - if (level == TASK_LEVEL__SOURCE) { - streamTaskFillHistoryFinished(pTask); - } - if (level == TASK_LEVEL__AGG || level == TASK_LEVEL__SOURCE) { // do transfer task operator states. code = streamDoTransferStateToStreamTask(pTask); } else { // no state transfer for sink tasks, and drop fill-history task, followed by opening inputQ of sink task. @@ -777,6 +771,8 @@ int32_t streamResumeTask(SStreamTask* pTask) { while (1) { /*int32_t code = */ doStreamExecTask(pTask); + + // check if continue taosThreadMutexLock(&pTask->lock); int32_t numOfItems = streamQueueGetNumOfItems(pTask->inputq.queue); diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index db71b56815..db74ce9897 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -590,11 +590,6 @@ int32_t streamMetaRegisterTask(SStreamMeta* pMeta, int64_t ver, SStreamTask* pTa return 0; } - if (pTask->info.fillHistory == 1) { - stDebug("s-task:0x%x initial nextProcessVer is set to 1 for fill-history task", pTask->id.taskId); - ver = 1; - } - if (pMeta->expandFunc(pMeta->ahandle, pTask, ver) < 0) { tFreeStreamTask(pTask); return -1; @@ -1312,28 +1307,28 @@ void streamMetaResetStartInfo(STaskStartInfo* pStartInfo) { } void streamMetaRLock(SStreamMeta* pMeta) { - stTrace("vgId:%d meta-rlock", pMeta->vgId); +// stTrace("vgId:%d meta-rlock", pMeta->vgId); taosThreadRwlockRdlock(&pMeta->lock); } void streamMetaRUnLock(SStreamMeta* pMeta) { - stTrace("vgId:%d meta-runlock", pMeta->vgId); +// stTrace("vgId:%d meta-runlock", pMeta->vgId); int32_t code = taosThreadRwlockUnlock(&pMeta->lock); if (code != TSDB_CODE_SUCCESS) { stError("vgId:%d meta-runlock failed, code:%d", pMeta->vgId, code); } else { - stDebug("vgId:%d meta-runlock completed", pMeta->vgId); +// stTrace("vgId:%d meta-runlock completed", pMeta->vgId); } } void streamMetaWLock(SStreamMeta* pMeta) { - stTrace("vgId:%d meta-wlock", pMeta->vgId); +// stTrace("vgId:%d meta-wlock", pMeta->vgId); taosThreadRwlockWrlock(&pMeta->lock); - stTrace("vgId:%d meta-wlock completed", pMeta->vgId); +// stTrace("vgId:%d meta-wlock completed", pMeta->vgId); } void streamMetaWUnLock(SStreamMeta* pMeta) { - stTrace("vgId:%d meta-wunlock", pMeta->vgId); +// stTrace("vgId:%d meta-wunlock", pMeta->vgId); taosThreadRwlockUnlock(&pMeta->lock); } diff --git a/source/libs/stream/src/streamQueue.c b/source/libs/stream/src/streamQueue.c index 78929c365e..0936d410bf 100644 --- a/source/libs/stream/src/streamQueue.c +++ b/source/libs/stream/src/streamQueue.c @@ -155,14 +155,14 @@ int32_t streamTaskGetDataFromInputQ(SStreamTask* pTask, SStreamQueueItem** pInpu *blockSize = 0; // no available token in bucket for sink task, let's wait for a little bit - if (taskLevel == TASK_LEVEL__SINK && (!streamTaskExtractAvailableToken(pTask->outputInfo.pTokenBucket, pTask->id.idStr))) { + if (taskLevel == TASK_LEVEL__SINK && (!streamTaskExtractAvailableToken(pTask->outputInfo.pTokenBucket, id))) { stDebug("s-task:%s no available token in bucket for sink data, wait for 10ms", id); return TSDB_CODE_SUCCESS; } while (1) { if (streamTaskShouldPause(pTask) || streamTaskShouldStop(pTask)) { - stDebug("s-task:%s task should pause, extract input blocks:%d", pTask->id.idStr, *numOfBlocks); + stDebug("s-task:%s task should pause, extract input blocks:%d", id, *numOfBlocks); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/stream/src/streamStart.c b/source/libs/stream/src/streamStart.c index 20fdcff7d9..ee98bc801b 100644 --- a/source/libs/stream/src/streamStart.c +++ b/source/libs/stream/src/streamStart.c @@ -385,7 +385,6 @@ int32_t streamTaskOnScanhistoryTaskReady(SStreamTask* pTask) { void doProcessDownstreamReadyRsp(SStreamTask* pTask) { EStreamTaskEvent event = (pTask->info.fillHistory == 0) ? TASK_EVENT_INIT : TASK_EVENT_INIT_SCANHIST; - streamTaskOnHandleEventSuccess(pTask->status.pSM, event); int64_t initTs = pTask->execInfo.init; @@ -596,8 +595,6 @@ static void checkFillhistoryTaskStatus(SStreamTask* pTask, SStreamTask* pHTask) SDataRange* pRange = &pHTask->dataRange; // the query version range should be limited to the already processed data - pRange->range.minVer = 0; - pRange->range.maxVer = pTask->chkInfo.nextProcessVer - 1; pHTask->execInfo.init = taosGetTimestampMs(); if (pTask->info.taskLevel == TASK_LEVEL__SOURCE) { @@ -844,7 +841,7 @@ int32_t streamLaunchFillHistoryTask(SStreamTask* pTask) { } } -int32_t streamTaskFillHistoryFinished(SStreamTask* pTask) { +int32_t streamTaskResetTimewindowFilter(SStreamTask* pTask) { void* exec = pTask->exec.pExecutor; return qStreamInfoResetTimewindowFilter(exec); } @@ -855,8 +852,6 @@ bool streamHistoryTaskSetVerRangeStep2(SStreamTask* pTask, int64_t nextProcessVe int64_t walScanStartVer = pRange->maxVer + 1; if (walScanStartVer > nextProcessVer - 1) { - // no input data yet. no need to execute the secondary scan while stream task halt - streamTaskFillHistoryFinished(pTask); stDebug( "s-task:%s no need to perform secondary scan-history data(step 2), since no data ingest during step1 scan, " "related stream task currentVer:%" PRId64, @@ -966,27 +961,13 @@ void streamTaskSetRangeStreamCalc(SStreamTask* pTask) { return; } - int64_t ekey = 0; - if (pRange->window.ekey < INT64_MAX) { - ekey = pRange->window.ekey + 1; - } else { - ekey = pRange->window.ekey; - } - - int64_t ver = pRange->range.minVer; - - pRange->window.skey = ekey; - pRange->window.ekey = INT64_MAX; - pRange->range.minVer = 0; - pRange->range.maxVer = ver; - - stDebug("s-task:%s level:%d related fill-history task exists, set stream task timeWindow:%" PRId64 " - %" PRId64 + stDebug("s-task:%s level:%d related fill-history task exists, stream task timeWindow:%" PRId64 " - %" PRId64 ", verRang:%" PRId64 " - %" PRId64, - pTask->id.idStr, pTask->info.taskLevel, pRange->window.skey, pRange->window.ekey, ver, INT64_MAX); + pTask->id.idStr, pTask->info.taskLevel, pRange->window.skey, pRange->window.ekey, pRange->range.minVer, + pRange->range.maxVer); - SVersionRange verRange = {.minVer = ver, .maxVer = INT64_MAX}; + SVersionRange verRange = pRange->range; STimeWindow win = pRange->window; streamSetParamForStreamScannerStep2(pTask, &verRange, &win); } } - diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index ea20f0e2b1..e370312338 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -670,7 +670,6 @@ void streamStateFreeCur(SStreamStateCur* pCur) { if (!pCur) { return; } - qDebug("streamStateFreeCur"); streamStateResetCur(pCur); taosMemoryFree(pCur); } diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index 3018894132..9f08a55b21 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -79,7 +79,7 @@ static SStreamChildEpInfo* createStreamTaskEpInfo(const SStreamTask* pTask) { return pEpInfo; } -SStreamTask* tNewStreamTask(int64_t streamId, int8_t taskLevel, bool fillHistory, int64_t triggerParam, +SStreamTask* tNewStreamTask(int64_t streamId, int8_t taskLevel, SEpSet* pEpset, bool fillHistory, int64_t triggerParam, SArray* pTaskList, bool hasFillhistory) { SStreamTask* pTask = (SStreamTask*)taosMemoryCalloc(1, sizeof(SStreamTask)); if (pTask == NULL) { @@ -92,6 +92,7 @@ SStreamTask* tNewStreamTask(int64_t streamId, int8_t taskLevel, bool fillHistory pTask->ver = SSTREAM_TASK_VER; pTask->id.taskId = tGenIdPI32(); pTask->id.streamId = streamId; + pTask->info.taskLevel = taskLevel; pTask->info.fillHistory = fillHistory; pTask->info.triggerParam = triggerParam; @@ -103,7 +104,7 @@ SStreamTask* tNewStreamTask(int64_t streamId, int8_t taskLevel, bool fillHistory } char buf[128] = {0}; - sprintf(buf, "0x%" PRIx64 "-%d", pTask->id.streamId, pTask->id.taskId); + sprintf(buf, "0x%" PRIx64 "-0x%x", pTask->id.streamId, pTask->id.taskId); pTask->id.idStr = taosStrdup(buf); pTask->status.schedStatus = TASK_SCHED_STATUS__INACTIVE; @@ -115,6 +116,8 @@ SStreamTask* tNewStreamTask(int64_t streamId, int8_t taskLevel, bool fillHistory ASSERT(hasFillhistory); } + epsetAssign(&(pTask->info.mnodeEpset), pEpset); + addToTaskset(pTaskList, pTask); return pTask; } @@ -458,16 +461,18 @@ void tFreeStreamTask(SStreamTask* pTask) { int32_t streamTaskInit(SStreamTask* pTask, SStreamMeta* pMeta, SMsgCb* pMsgCb, int64_t ver) { pTask->id.idStr = createStreamTaskIdStr(pTask->id.streamId, pTask->id.taskId); pTask->refCnt = 1; - pTask->status.schedStatus = TASK_SCHED_STATUS__INACTIVE; - pTask->status.timerActive = 0; + + pTask->inputq.status = TASK_INPUT_STATUS__NORMAL; + pTask->outputq.status = TASK_OUTPUT_STATUS__NORMAL; pTask->inputq.queue = streamQueueOpen(512 << 10); pTask->outputq.queue = streamQueueOpen(512 << 10); - if (pTask->inputq.queue == NULL || pTask->outputq.queue == NULL) { stError("s-task:%s failed to prepare the input/output queue, initialize task failed", pTask->id.idStr); return TSDB_CODE_OUT_OF_MEMORY; } + pTask->status.schedStatus = TASK_SCHED_STATUS__INACTIVE; + pTask->status.timerActive = 0; pTask->status.pSM = streamCreateStateMachine(pTask); if (pTask->status.pSM == NULL) { stError("s-task:%s failed create state-machine for stream task, initialization failed, code:%s", pTask->id.idStr, @@ -476,29 +481,34 @@ int32_t streamTaskInit(SStreamTask* pTask, SStreamMeta* pMeta, SMsgCb* pMsgCb, i } pTask->execInfo.created = taosGetTimestampMs(); - pTask->inputq.status = TASK_INPUT_STATUS__NORMAL; - pTask->outputq.status = TASK_OUTPUT_STATUS__NORMAL; - pTask->pMeta = pMeta; + SCheckpointInfo* pChkInfo = &pTask->chkInfo; + SDataRange* pRange = &pTask->dataRange; - pTask->chkInfo.checkpointVer = ver - 1; // only update when generating checkpoint - pTask->chkInfo.processedVer = ver - 1; // already processed version + // only set the version info for stream tasks without fill-history task + if (pTask->info.taskLevel == TASK_LEVEL__SOURCE) { + if ((pTask->info.fillHistory == 0) && (!HAS_RELATED_FILLHISTORY_TASK(pTask))) { + pChkInfo->checkpointVer = ver - 1; // only update when generating checkpoint + pChkInfo->processedVer = ver - 1; // already processed version + pChkInfo->nextProcessVer = ver; // next processed version - pTask->chkInfo.nextProcessVer = ver; // next processed version - pTask->dataRange.range.maxVer = ver; - pTask->dataRange.range.minVer = ver; - pTask->pMsgCb = pMsgCb; - pTask->msgInfo.pRetryList = taosArrayInit(4, sizeof(int32_t)); - - pTask->outputInfo.pTokenBucket = taosMemoryCalloc(1, sizeof(STokenBucket)); - if (pTask->outputInfo.pTokenBucket == NULL) { - stError("s-task:%s failed to prepare the tokenBucket, code:%s", pTask->id.idStr, - tstrerror(TSDB_CODE_OUT_OF_MEMORY)); - return TSDB_CODE_OUT_OF_MEMORY; + pRange->range.maxVer = ver; + pRange->range.minVer = ver; + } else { + if (pTask->info.fillHistory == 1) { + pChkInfo->checkpointVer = pRange->range.maxVer; + pChkInfo->processedVer = pRange->range.maxVer; + pChkInfo->nextProcessVer = pRange->range.maxVer + 1; + } else { + pChkInfo->checkpointVer = pRange->range.minVer - 1; + pChkInfo->processedVer = pRange->range.minVer - 1; + pChkInfo->nextProcessVer = pRange->range.minVer; + } + } } - // 2MiB per second for sink task - // 50 times sink operator per second - streamTaskInitTokenBucket(pTask->outputInfo.pTokenBucket, 35, 35, tsSinkDataRate, pTask->id.idStr); + pTask->pMeta = pMeta; + pTask->pMsgCb = pMsgCb; + pTask->msgInfo.pRetryList = taosArrayInit(4, sizeof(int32_t)); TdThreadMutexAttr attr = {0}; int code = taosThreadMutexAttrInit(&attr); @@ -514,10 +524,22 @@ int32_t streamTaskInit(SStreamTask* pTask, SStreamMeta* pMeta, SMsgCb* pMsgCb, i } taosThreadMutexInit(&pTask->lock, &attr); + taosThreadMutexAttrDestroy(&attr); streamTaskOpenAllUpstreamInput(pTask); - pTask->outputInfo.pDownstreamUpdateList = taosArrayInit(4, sizeof(SDownstreamTaskEpset)); - if (pTask->outputInfo.pDownstreamUpdateList == NULL) { + STaskOutputInfo* pOutputInfo = &pTask->outputInfo; + pOutputInfo->pTokenBucket = taosMemoryCalloc(1, sizeof(STokenBucket)); + if (pOutputInfo->pTokenBucket == NULL) { + stError("s-task:%s failed to prepare the tokenBucket, code:%s", pTask->id.idStr, + tstrerror(TSDB_CODE_OUT_OF_MEMORY)); + return TSDB_CODE_OUT_OF_MEMORY; + } + + // 2MiB per second for sink task + // 50 times sink operator per second + streamTaskInitTokenBucket(pOutputInfo->pTokenBucket, 35, 35, tsSinkDataRate, pTask->id.idStr); + pOutputInfo->pDownstreamUpdateList = taosArrayInit(4, sizeof(SDownstreamTaskEpset)); + if (pOutputInfo->pDownstreamUpdateList == NULL) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -527,16 +549,16 @@ int32_t streamTaskInit(SStreamTask* pTask, SStreamMeta* pMeta, SMsgCb* pMsgCb, i int32_t streamTaskGetNumOfDownstream(const SStreamTask* pTask) { if (pTask->info.taskLevel == TASK_LEVEL__SINK) { return 0; + } + + int32_t type = pTask->outputInfo.type; + if (type == TASK_OUTPUT__TABLE) { + return 0; + } else if (type == TASK_OUTPUT__FIXED_DISPATCH) { + return 1; } else { - int32_t type = pTask->outputInfo.type; - if (type == TASK_OUTPUT__TABLE) { - return 0; - } else if (type == TASK_OUTPUT__FIXED_DISPATCH) { - return 1; - } else { - SArray* vgInfo = pTask->outputInfo.shuffleDispatcher.dbInfo.pVgroupInfos; - return taosArrayGetSize(vgInfo); - } + SArray* vgInfo = pTask->outputInfo.shuffleDispatcher.dbInfo.pVgroupInfos; + return taosArrayGetSize(vgInfo); } } diff --git a/source/libs/stream/src/streamTaskSm.c b/source/libs/stream/src/streamTaskSm.c index 1671d78ed2..83e71c42bc 100644 --- a/source/libs/stream/src/streamTaskSm.c +++ b/source/libs/stream/src/streamTaskSm.c @@ -105,7 +105,7 @@ int32_t streamTaskKeepCurrentVerInWal(SStreamTask* pTask) { if (pTask->info.taskLevel == TASK_LEVEL__SOURCE) { pTask->hTaskInfo.haltVer = walReaderGetCurrentVer(pTask->exec.pWalReader); if (pTask->hTaskInfo.haltVer == -1) { - pTask->hTaskInfo.haltVer = pTask->dataRange.range.maxVer + 1; + pTask->hTaskInfo.haltVer = pTask->dataRange.range.minVer; } } diff --git a/source/libs/stream/test/CMakeLists.txt b/source/libs/stream/test/CMakeLists.txt index d756b71e29..c11d8fe3e6 100644 --- a/source/libs/stream/test/CMakeLists.txt +++ b/source/libs/stream/test/CMakeLists.txt @@ -32,4 +32,9 @@ TARGET_INCLUDE_DIRECTORIES( add_test( NAME streamUpdateTest COMMAND streamUpdateTest -) \ No newline at end of file +) + +# add_test( +# NAME checkpointTest +# COMMAND checkpointTest +# ) \ No newline at end of file diff --git a/source/libs/stream/test/checkpointTest.cpp b/source/libs/stream/test/checkpointTest.cpp index dca2e97c28..0dc2cc13f5 100644 --- a/source/libs/stream/test/checkpointTest.cpp +++ b/source/libs/stream/test/checkpointTest.cpp @@ -39,7 +39,9 @@ int main(int argc, char **argv) { return -1; } strcpy(tsSnodeAddress, "127.0.0.1"); - return RUN_ALL_TESTS(); + int ret = RUN_ALL_TESTS(); + s3CleanUp(); + return ret; } TEST(testCase, checkpointUpload_Test) { diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index edaf59f9db..e06ea70f70 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -413,6 +413,7 @@ int32_t syncEndSnapshot(int64_t rid) { return code; } +#ifdef BUILD_NO_CALL int32_t syncStepDown(int64_t rid, SyncTerm newTerm) { SSyncNode* pSyncNode = syncNodeAcquire(rid); if (pSyncNode == NULL) { @@ -424,6 +425,7 @@ int32_t syncStepDown(int64_t rid, SyncTerm newTerm) { syncNodeRelease(pSyncNode); return 0; } +#endif bool syncNodeIsReadyForRead(SSyncNode* pSyncNode) { if (pSyncNode == NULL) { @@ -458,6 +460,7 @@ bool syncIsReadyForRead(int64_t rid) { return ready; } +#ifdef BUILD_NO_CALL bool syncSnapshotSending(int64_t rid) { SSyncNode* pSyncNode = syncNodeAcquire(rid); if (pSyncNode == NULL) { @@ -479,6 +482,7 @@ bool syncSnapshotRecving(int64_t rid) { syncNodeRelease(pSyncNode); return b; } +#endif int32_t syncNodeLeaderTransfer(SSyncNode* pSyncNode) { if (pSyncNode->peersNum == 0) { @@ -1060,7 +1064,9 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo, int32_t vnodeVersion) { pSyncNode->heartbeatTimerMS = pSyncNode->hbBaseLine; atomic_store_64(&pSyncNode->heartbeatTimerLogicClock, 0); atomic_store_64(&pSyncNode->heartbeatTimerLogicClockUser, 0); +#ifdef BUILD_NO_CALL pSyncNode->FpHeartbeatTimerCB = syncNodeEqHeartbeatTimer; +#endif pSyncNode->heartbeatTimerCounter = 0; // init peer heartbeat timer @@ -1151,6 +1157,7 @@ _error: return NULL; } +#ifdef BUILD_NO_CALL void syncNodeMaybeUpdateCommitBySnapshot(SSyncNode* pSyncNode) { if (pSyncNode->pFsm != NULL && pSyncNode->pFsm->FpGetSnapshotInfo != NULL) { SSnapshot snapshot = {0}; @@ -1160,6 +1167,7 @@ void syncNodeMaybeUpdateCommitBySnapshot(SSyncNode* pSyncNode) { } } } +#endif int32_t syncNodeRestore(SSyncNode* pSyncNode) { ASSERTS(pSyncNode->pLogStore != NULL, "log store not created"); @@ -1214,6 +1222,7 @@ int32_t syncNodeStart(SSyncNode* pSyncNode) { return ret; } +#ifdef BUILD_NO_CALL int32_t syncNodeStartStandBy(SSyncNode* pSyncNode) { // state change pSyncNode->state = TAOS_SYNC_STATE_FOLLOWER; @@ -1235,6 +1244,7 @@ int32_t syncNodeStartStandBy(SSyncNode* pSyncNode) { } return ret; } +#endif void syncNodePreClose(SSyncNode* pSyncNode) { ASSERT(pSyncNode != NULL); @@ -1401,6 +1411,7 @@ void syncNodeResetElectTimer(SSyncNode* pSyncNode) { electMS); } +#ifdef BUILD_NO_CALL static int32_t syncNodeDoStartHeartbeatTimer(SSyncNode* pSyncNode) { int32_t ret = 0; if (syncIsInit()) { @@ -1414,6 +1425,7 @@ static int32_t syncNodeDoStartHeartbeatTimer(SSyncNode* pSyncNode) { sNTrace(pSyncNode, "start heartbeat timer, ms:%d", pSyncNode->heartbeatTimerMS); return ret; } +#endif int32_t syncNodeStartHeartbeatTimer(SSyncNode* pSyncNode) { int32_t ret = 0; @@ -1452,11 +1464,13 @@ int32_t syncNodeStopHeartbeatTimer(SSyncNode* pSyncNode) { return ret; } +#ifdef BUILD_NO_CALL int32_t syncNodeRestartHeartbeatTimer(SSyncNode* pSyncNode) { syncNodeStopHeartbeatTimer(pSyncNode); syncNodeStartHeartbeatTimer(pSyncNode); return 0; } +#endif int32_t syncNodeSendMsgById(const SRaftId* destRaftId, SSyncNode* pNode, SRpcMsg* pMsg) { SEpSet* epSet = NULL; @@ -1700,6 +1714,7 @@ _END: } // raft state change -------------- +#ifdef BUILD_NO_CALL void syncNodeUpdateTerm(SSyncNode* pSyncNode, SyncTerm term) { if (term > raftStoreGetTerm(pSyncNode)) { raftStoreSetTerm(pSyncNode, term); @@ -1709,6 +1724,7 @@ void syncNodeUpdateTerm(SSyncNode* pSyncNode, SyncTerm term) { raftStoreClearVote(pSyncNode); } } +#endif void syncNodeUpdateTermWithoutStepDown(SSyncNode* pSyncNode, SyncTerm term) { if (term > raftStoreGetTerm(pSyncNode)) { @@ -1934,6 +1950,7 @@ void syncNodeFollower2Candidate(SSyncNode* pSyncNode) { sNTrace(pSyncNode, "follower to candidate"); } +#ifdef BUILD_NO_CALL void syncNodeLeader2Follower(SSyncNode* pSyncNode) { ASSERT(pSyncNode->state == TAOS_SYNC_STATE_LEADER); syncNodeBecomeFollower(pSyncNode, "leader to follower"); @@ -1953,6 +1970,7 @@ void syncNodeCandidate2Follower(SSyncNode* pSyncNode) { sNTrace(pSyncNode, "candidate to follower"); } +#endif // just called by syncNodeVoteForSelf // need assert @@ -2042,6 +2060,7 @@ int32_t syncNodeGetLastIndexTerm(SSyncNode* pSyncNode, SyncIndex* pLastIndex, Sy return 0; } +#ifdef BUILD_NO_CALL // return append-entries first try index SyncIndex syncNodeSyncStartIndex(SSyncNode* pSyncNode) { SyncIndex syncStartIndex = syncNodeGetLastIndex(pSyncNode) + 1; @@ -2129,6 +2148,7 @@ int32_t syncNodeGetPreIndexTerm(SSyncNode* pSyncNode, SyncIndex index, SyncIndex *pPreTerm = syncNodeGetPreTerm(pSyncNode, index); return 0; } +#endif static void syncNodeEqPingTimer(void* param, void* tmrId) { if (!syncIsInit()) return; @@ -2141,7 +2161,7 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) { if (code != 0) { sError("failed to build ping msg"); rpcFreeCont(rpcMsg.pCont); - return; + goto _out; } // sTrace("enqueue ping msg"); @@ -2149,9 +2169,10 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) { if (code != 0) { sError("failed to sync enqueue ping msg since %s", terrstr()); rpcFreeCont(rpcMsg.pCont); - return; + goto _out; } + _out: taosTmrReset(syncNodeEqPingTimer, pNode->pingTimerMS, pNode, syncEnv()->pTimerManager, &pNode->pPingTimer); } } @@ -2199,6 +2220,7 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) { syncNodeRelease(pNode); } +#ifdef BUILD_NO_CALL static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) { if (!syncIsInit()) return; @@ -2211,7 +2233,7 @@ static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) { if (code != 0) { sError("failed to build heartbeat msg"); - return; + goto _out; } sTrace("vgId:%d, enqueue heartbeat timer", pNode->vgId); @@ -2219,9 +2241,10 @@ static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) { if (code != 0) { sError("failed to enqueue heartbeat msg since %s", terrstr()); rpcFreeCont(rpcMsg.pCont); - return; + goto _out; } + _out: taosTmrReset(syncNodeEqHeartbeatTimer, pNode->heartbeatTimerMS, pNode, syncEnv()->pTimerManager, &pNode->pHeartbeatTimer); @@ -2231,6 +2254,7 @@ static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) { } } } +#endif static void syncNodeEqPeerHeartbeatTimer(void* param, void* tmrId) { int64_t hbDataRid = (int64_t)param; @@ -2318,6 +2342,7 @@ static void syncNodeEqPeerHeartbeatTimer(void* param, void* tmrId) { syncNodeRelease(pSyncNode); } +#ifdef BUILD_NO_CALL static void deleteCacheEntry(const void* key, size_t keyLen, void* value, void* ud) { (void)ud; taosMemoryFree(value); @@ -2337,6 +2362,7 @@ int32_t syncCacheEntry(SSyncLogStore* pLogStore, SSyncRaftEntry* pEntry, LRUHand return code; } +#endif void syncBuildConfigFromReq(SAlterVnodeReplicaReq* pReq, SSyncCfg* cfg) { // TODO SAlterVnodeReplicaReq name is proper? cfg->replicaNum = 0; @@ -2974,6 +3000,7 @@ static int32_t syncNodeAppendNoop(SSyncNode* ths) { return 0; } +#ifdef BUILD_NO_CALL static int32_t syncNodeAppendNoopOld(SSyncNode* ths) { int32_t ret = 0; @@ -3002,6 +3029,7 @@ static int32_t syncNodeAppendNoopOld(SSyncNode* ths) { return ret; } +#endif int32_t syncNodeOnHeartbeat(SSyncNode* ths, const SRpcMsg* pRpcMsg) { SyncHeartbeat* pMsg = pRpcMsg->pCont; @@ -3119,6 +3147,7 @@ int32_t syncNodeOnHeartbeatReply(SSyncNode* ths, const SRpcMsg* pRpcMsg) { return syncLogReplProcessHeartbeatReply(pMgr, ths, pMsg); } +#ifdef BUILD_NO_CALL int32_t syncNodeOnHeartbeatReplyOld(SSyncNode* ths, const SRpcMsg* pRpcMsg) { SyncHeartbeatReply* pMsg = pRpcMsg->pCont; @@ -3134,6 +3163,7 @@ int32_t syncNodeOnHeartbeatReplyOld(SSyncNode* ths, const SRpcMsg* pRpcMsg) { syncIndexMgrSetRecvTime(ths->pMatchIndex, &pMsg->srcId, tsMs); return 0; } +#endif int32_t syncNodeOnLocalCmd(SSyncNode* ths, const SRpcMsg* pRpcMsg) { SyncLocalCmd* pMsg = pRpcMsg->pCont; @@ -3313,6 +3343,7 @@ SPeerState* syncNodeGetPeerState(SSyncNode* ths, const SRaftId* pDestId) { return pState; } +#ifdef BUILD_NO_CALL bool syncNodeNeedSendAppendEntries(SSyncNode* ths, const SRaftId* pDestId, const SyncAppendEntries* pMsg) { SPeerState* pState = syncNodeGetPeerState(ths, pDestId); if (pState == NULL) { @@ -3354,3 +3385,4 @@ bool syncNodeCanChange(SSyncNode* pSyncNode) { return true; } +#endif \ No newline at end of file diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 15b35030d3..b6942655a9 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -2515,7 +2515,7 @@ int transReleaseCliHandle(void* handle) { SCliThrd* pThrd = transGetWorkThrdFromHandle(NULL, (int64_t)handle); if (pThrd == NULL) { - return -1; + return TSDB_CODE_RPC_BROKEN_LINK; } STransMsg tmsg = {.info.handle = handle, .info.ahandle = (void*)0x9527}; @@ -2535,7 +2535,7 @@ int transReleaseCliHandle(void* handle) { if (0 != transAsyncSend(pThrd->asyncPool, &cmsg->q)) { destroyCmsg(cmsg); - return -1; + return TSDB_CODE_RPC_BROKEN_LINK; } return 0; } @@ -2544,7 +2544,7 @@ int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STran STrans* pTransInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)shandle); if (pTransInst == NULL) { transFreeMsg(pReq->pCont); - return -1; + return TSDB_CODE_RPC_BROKEN_LINK; } SCliThrd* pThrd = transGetWorkThrd(pTransInst, (int64_t)pReq->info.handle); @@ -2577,7 +2577,7 @@ int transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STran if (0 != transAsyncSend(pThrd->asyncPool, &(cliMsg->q))) { destroyCmsg(cliMsg); transReleaseExHandle(transGetInstMgt(), (int64_t)shandle); - return -1; + return TSDB_CODE_RPC_BROKEN_LINK; } transReleaseExHandle(transGetInstMgt(), (int64_t)shandle); return 0; @@ -2589,7 +2589,7 @@ int transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransMs if (pTransInst == NULL) { transFreeMsg(pReq->pCont); taosMemoryFree(pTransRsp); - return -1; + return TSDB_CODE_RPC_BROKEN_LINK; } SCliThrd* pThrd = transGetWorkThrd(pTransInst, (int64_t)pReq->info.handle); @@ -2627,6 +2627,7 @@ int transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransMs int ret = transAsyncSend(pThrd->asyncPool, &cliMsg->q); if (ret != 0) { destroyCmsg(cliMsg); + ret = TSDB_CODE_RPC_BROKEN_LINK; goto _RETURN; } tsem_wait(sem); @@ -2661,7 +2662,7 @@ int transSendRecvWithTimeout(void* shandle, SEpSet* pEpSet, STransMsg* pReq, STr if (pTransInst == NULL) { transFreeMsg(pReq->pCont); taosMemoryFree(pTransMsg); - return -1; + return TSDB_CODE_RPC_BROKEN_LINK; } SCliThrd* pThrd = transGetWorkThrd(pTransInst, (int64_t)pReq->info.handle); @@ -2698,6 +2699,7 @@ int transSendRecvWithTimeout(void* shandle, SEpSet* pEpSet, STransMsg* pReq, STr int ret = transAsyncSend(pThrd->asyncPool, &cliMsg->q); if (ret != 0) { destroyCmsg(cliMsg); + ret = TSDB_CODE_RPC_BROKEN_LINK; goto _RETURN; } @@ -2726,7 +2728,7 @@ _RETURN: int transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn) { STrans* pTransInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)shandle); if (pTransInst == NULL) { - return -1; + return TSDB_CODE_RPC_BROKEN_LINK; } SCvtAddr cvtAddr = {0}; @@ -2750,7 +2752,6 @@ int transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn) { if (transAsyncSend(thrd->asyncPool, &(cliMsg->q)) != 0) { destroyCmsg(cliMsg); transReleaseExHandle(transGetInstMgt(), (int64_t)shandle); - return -1; } } transReleaseExHandle(transGetInstMgt(), (int64_t)shandle); diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index 362d38b505..b324ca5f91 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -159,7 +159,7 @@ static void uvStartSendResp(SSvrMsg* msg); static void uvNotifyLinkBrokenToApp(SSvrConn* conn); -static FORCE_INLINE void destroySmsg(SSvrMsg* smsg); +static FORCE_INLINE void destroySmsg(SSvrMsg* smsg); static FORCE_INLINE SSvrConn* createConn(void* hThrd); static FORCE_INLINE void destroyConn(SSvrConn* conn, bool clear /*clear handle or not*/); static FORCE_INLINE void destroyConnRegArg(SSvrConn* conn); @@ -1382,7 +1382,7 @@ void uvHandleUpdate(SSvrMsg* msg, SWorkThrd* thrd) { tFreeSUpdateIpWhiteReq(req); taosMemoryFree(req); } else { - tInfo("ip-white-list disable on trans"); + tDebug("ip-white-list disable on trans"); thrd->enableIpWhiteList = 0; } taosMemoryFree(msg); diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c index 3854e90901..d491b00e73 100644 --- a/source/libs/wal/src/walRead.c +++ b/source/libs/wal/src/walRead.c @@ -70,10 +70,9 @@ int32_t walNextValidMsg(SWalReader *pReader) { int64_t committedVer = walGetCommittedVer(pReader->pWal); int64_t appliedVer = walGetAppliedVer(pReader->pWal); - wDebug("vgId:%d, wal start to fetch, index:%" PRId64 ", last index:%" PRId64 " commit index:%" PRId64 - ", applied index:%" PRId64, + wDebug("vgId:%d, wal start to fetch, index:%" PRId64 ", last:%" PRId64 " commit:%" PRId64 ", applied:%" PRId64, pReader->pWal->cfg.vgId, fetchVer, lastVer, committedVer, appliedVer); - if (fetchVer > appliedVer){ + if (fetchVer > appliedVer) { terrno = TSDB_CODE_WAL_LOG_NOT_EXIST; return -1; } @@ -86,10 +85,8 @@ int32_t walNextValidMsg(SWalReader *pReader) { int32_t type = pReader->pHead->head.msgType; if (type == TDMT_VND_SUBMIT || ((type == TDMT_VND_DELETE) && (pReader->cond.deleteMsg == 1)) || (IS_META_MSG(type) && pReader->cond.scanMeta)) { - if (walFetchBody(pReader) < 0) { - return -1; - } - return 0; + int32_t code = walFetchBody(pReader); + return (code == TSDB_CODE_SUCCESS)? 0:-1; } else { if (walSkipFetchBody(pReader) < 0) { return -1; diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index 341d989f8f..9783705bad 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -498,7 +498,7 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy pWal->writeHead.head.version = index; pWal->writeHead.head.bodyLen = bodyLen; pWal->writeHead.head.msgType = msgType; - pWal->writeHead.head.ingestTs = 0; + pWal->writeHead.head.ingestTs = taosGetTimestampUs(); // sync info for sync module pWal->writeHead.head.syncMeta = syncMeta; diff --git a/source/os/src/osMath.c b/source/os/src/osMath.c index 10d02ab25c..c18746d397 100644 --- a/source/os/src/osMath.c +++ b/source/os/src/osMath.c @@ -18,10 +18,12 @@ #include #include "talgo.h" +#if defined(WINDOWS_STASH) || defined(_ALPINE) int32_t qsortHelper(const void* p1, const void* p2, const void* param) { __compar_fn_t comparFn = param; return comparFn(p1, p2); } +#endif // todo refactor: 1) move away; 2) use merge sort instead; 3) qsort is not a stable sort actually. void taosSort(void* base, int64_t sz, int64_t width, __compar_fn_t compar) { diff --git a/source/os/src/osSemaphore.c b/source/os/src/osSemaphore.c index dda4b14901..7d1cc746ff 100644 --- a/source/os/src/osSemaphore.c +++ b/source/os/src/osSemaphore.c @@ -56,6 +56,8 @@ int32_t taosGetAppName(char* name, int32_t* len) { char* end = strrchr(filepath, TD_DIRSEP[0]); if (end == NULL) { end = filepath; + } else { + end += 1; } tstrncpy(name, end, TSDB_APP_NAME_LEN); diff --git a/source/os/src/osSystem.c b/source/os/src/osSystem.c index 7b6c77f7bc..17d211a5ab 100644 --- a/source/os/src/osSystem.c +++ b/source/os/src/osSystem.c @@ -88,6 +88,7 @@ struct termios oldtio; typedef struct FILE TdCmd; +#ifdef BUILD_NO_CALL void* taosLoadDll(const char* filename) { #if defined(WINDOWS) ASSERT(0); @@ -140,6 +141,7 @@ void taosCloseDll(void* handle) { } #endif } +#endif int taosSetConsoleEcho(bool on) { #if defined(WINDOWS) diff --git a/source/util/src/tbase58.c b/source/util/src/tbase58.c new file mode 100644 index 0000000000..fa3ecadd14 --- /dev/null +++ b/source/util/src/tbase58.c @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#define _DEFAULT_SOURCE +#include "tbase58.h" +#include +#include + +#define BASE_BUF_SIZE 256 +static const char *basis_58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; + +char *base58_encode(const uint8_t *value, int32_t vlen) { + const uint8_t *pb = value; + const uint8_t *pe = pb + vlen; + uint8_t buf[BASE_BUF_SIZE] = {0}; + uint8_t *pbuf = &buf[0]; + bool bfree = false; + int32_t nz = 0, size = 0, len = 0; + + while (pb != pe && *pb == 0) { + ++pb; + ++nz; + } + + size = (pe - pb) * 69 / 50 + 1; + if (size > BASE_BUF_SIZE) { + if (!(pbuf = taosMemoryCalloc(1, size))) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + bfree = true; + } + + while (pb != pe) { + int32_t num = *pb; + int32_t i = 0; + for (int32_t j = (int32_t)size - 1; (num != 0 || i < len) && j >= 0; --j, ++i) { + num += ((int32_t)buf[j]) << 8; + pbuf[j] = num % 58; + num /= 58; + } + len = i; + ++pb; + } + + const uint8_t *pi = pbuf + (size - len); + while (pi != pbuf + size && *pi == 0) ++pi; + uint8_t *result = taosMemoryCalloc(1, size + 1); + if (!result) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + if (bfree) taosMemoryFree(pbuf); + return NULL; + } + memset(result, '1', nz); + while (pi != pbuf + size) result[nz++] = basis_58[*pi++]; + + if (bfree) taosMemoryFree(pbuf); + return result; +} + +static const signed char index_58[256] = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, + -1, -1, -1, -1, -1, -1, -1, 9, 10, 11, 12, 13, 14, 15, 16, -1, 17, 18, 19, 20, 21, -1, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, -1, -1, -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, -1, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; + +uint8_t *base58_decode(const char *value, size_t inlen, int32_t *outlen) { + const char *pe = value + inlen; + uint8_t buf[BASE_BUF_SIZE] = {0}; + uint8_t *pbuf = &buf[0]; + bool bfree = false; + int32_t nz = 0, size = 0, len = 0; + + while (*value && isspace(*value)) ++value; + while (*value == '1') { + ++nz; + ++value; + } + + size = (int32_t)(pe - value) * 733 / 1000 + 1; + if (size > BASE_BUF_SIZE) { + if (!(pbuf = taosMemoryCalloc(1, size))) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + bfree = true; + } + + while (*value && !isspace(*value)) { + int32_t num = index_58[(uint8_t)*value]; + if (num == -1) { + if (bfree) taosMemoryFree(pbuf); + return NULL; + } + int32_t i = 0; + for (int32_t j = size - 1; (num != 0 || i < len) && (j >= 0); --j, ++i) { + num += (int32_t)pbuf[j] * 58; + pbuf[j] = num & 255; + num >>= 8; + } + len = i; + ++value; + } + + while (isspace(*value)) ++value; + if (*value != 0) { + if (bfree) taosMemoryFree(pbuf); + return NULL; + } + const uint8_t *it = pbuf + (size - len); + while (it != pbuf + size && *it == 0) ++it; + + uint8_t *result = taosMemoryCalloc(1, size + 1); + if (!result) { + if (bfree) taosMemoryFree(pbuf); + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + + memset(result, 0, nz); + while (it != pbuf + size) result[nz++] = *it++; + + if (outlen) *outlen = nz; + + if (bfree) taosMemoryFree(pbuf); + return result; +} \ No newline at end of file diff --git a/source/util/src/tcompression.c b/source/util/src/tcompression.c index 3cc00ddc7f..656e2706f2 100644 --- a/source/util/src/tcompression.c +++ b/source/util/src/tcompression.c @@ -977,6 +977,7 @@ int32_t tsDecompressDoubleLossyImp(const char *input, int32_t compressedSize, co } #endif +#ifdef BUILD_NO_CALL /************************************************************************* * STREAM COMPRESSION *************************************************************************/ @@ -2120,7 +2121,7 @@ int32_t tCompressEnd(SCompressor *pCmprsor, const uint8_t **ppOut, int32_t *nOut int32_t tCompress(SCompressor *pCmprsor, const void *pData, int64_t nData) { return DATA_TYPE_INFO[pCmprsor->type].cmprFn(pCmprsor, pData, nData); } - +#endif /************************************************************************* * REGULAR COMPRESSION *************************************************************************/ diff --git a/source/util/src/tconfig.c b/source/util/src/tconfig.c index d656f0c14e..ad3c766510 100644 --- a/source/util/src/tconfig.c +++ b/source/util/src/tconfig.c @@ -336,7 +336,7 @@ static int32_t cfgUpdateDebugFlagItem(SConfig *pCfg, const char *name, bool rese } int32_t cfgSetItem(SConfig *pCfg, const char *name, const char *value, ECfgSrcType stype) { - GRANT_CFG_SET; + // GRANT_CFG_SET; SConfigItem *pItem = cfgGetItem(pCfg, name); if (pItem == NULL) { terrno = TSDB_CODE_CFG_NOT_FOUND; diff --git a/source/util/src/tdes.c b/source/util/src/tdes.c index 0e0193a123..a4da08630e 100644 --- a/source/util/src/tdes.c +++ b/source/util/src/tdes.c @@ -48,6 +48,10 @@ char* taosDesImp(uint8_t* key, char* src, uint32_t len, int32_t process_mode) { key_set key_sets[17]; memset(key_sets, 0, sizeof(key_sets)); char* dest = taosMemoryCalloc(len + 1, 1); + if (!dest) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } generate_sub_keys(key, key_sets); for (uint32_t block_count = 0; block_count < number_of_blocks; block_count++) { @@ -61,7 +65,10 @@ char* taosDesImp(uint8_t* key, char* src, uint32_t len, int32_t process_mode) { } char* taosDesEncode(int64_t key, char* src, int32_t len) { - if (len % 8 != 0) return NULL; + if (len % 8 != 0) { + terrno = TSDB_CODE_INVALID_PARA; + return NULL; + } uint8_t* keyStr = (uint8_t*)(&key); return taosDesImp(keyStr, src, len, ENCRYPTION_MODE); } diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 86edb75dd0..8625c2ea60 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -346,6 +346,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MNODE_ALREADY_IS_VOTER, "Mnode already is a le TAOS_DEFINE_ERROR(TSDB_CODE_MNODE_ONLY_TWO_MNODE, "Only two mnodes exist") TAOS_DEFINE_ERROR(TSDB_CODE_MNODE_NO_NEED_RESTORE, "No need to restore on this dnode") TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_ONLY_USE_WHEN_OFFLINE, "Please use this command when the dnode is offline") +TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_NO_MACHINE_CODE, "Dnode can not get machine code") // vnode TAOS_DEFINE_ERROR(TSDB_CODE_VND_INVALID_VGROUP_ID, "Vnode is closed or removed") @@ -417,7 +418,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_QRY_TASK_CANCELLED, "Task cancelled") TAOS_DEFINE_ERROR(TSDB_CODE_QRY_TASK_DROPPED, "Task dropped") TAOS_DEFINE_ERROR(TSDB_CODE_QRY_TASK_CANCELLING, "Task cancelling") TAOS_DEFINE_ERROR(TSDB_CODE_QRY_TASK_DROPPING, "Task dropping") -TAOS_DEFINE_ERROR(TSDB_CODE_QRY_DUPLICATTED_OPERATION, "Duplicatted operation") +TAOS_DEFINE_ERROR(TSDB_CODE_QRY_DUPLICATED_OPERATION, "Duplicated operation") TAOS_DEFINE_ERROR(TSDB_CODE_QRY_TASK_MSG_ERROR, "Task message error") TAOS_DEFINE_ERROR(TSDB_CODE_QRY_JOB_FREED, "Job already freed") TAOS_DEFINE_ERROR(TSDB_CODE_QRY_TASK_STATUS_ERROR, "Task status error") @@ -434,26 +435,35 @@ TAOS_DEFINE_ERROR(TSDB_CODE_QRY_INVALID_JOIN_CONDITION, "Not supported join on // grant TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_EXPIRED, "License expired") -TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_DNODE_LIMITED, "DNode creation limited by license") -TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_ACCT_LIMITED, "Account creation limited by license") -TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_TIMESERIES_LIMITED, "Time series limited by license") -TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_DB_LIMITED, "DB creation limited by license") -TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_USER_LIMITED, "User creation limited by license") -TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_CONN_LIMITED, "Conn creation limited by license") -TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_STREAM_LIMITED, "Stream creation limited by license") -TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_SPEED_LIMITED, "Write speed limited by license") -TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_STORAGE_LIMITED, "Storage capacity limited by license") -TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_QUERYTIME_LIMITED, "Query time limited by license") -TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_CPU_LIMITED, "CPU cores limited by license") -TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_STABLE_LIMITED, "STable creation limited by license") -TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_TABLE_LIMITED, "Table creation limited by license") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_DNODE_LIMITED, "Number of dnodes has reached the licensed upper limit") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_ACCT_LIMITED, "Number of accounts has reached the licensed upper limit") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_TIMESERIES_LIMITED, "Number of time series has reached the licensed upper limit") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_DB_LIMITED, "Number of DBs has reached the licensed upper limit") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_USER_LIMITED, "Number of users has reached the licensed upper limit") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_CONN_LIMITED, "Number of connections has reached the licensed upper limit") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_STREAM_LIMITED, "Number of streams has reached the licensed upper limit") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_SPEED_LIMITED, "Write speed has reached the licensed upper limit") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_STORAGE_LIMITED, "Storage capacity has reached the licensed upper limit") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_SUBSCRIPTION_LIMITED, "Number of subscriptions has reached the licensed upper limit") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_CPU_LIMITED, "Number of CPU cores has reached the licensed upper limit") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_STABLE_LIMITED, "Number of stables has reached the licensed upper limit") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_TABLE_LIMITED, "Number of tables has reached the licensed upper limit") TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_PAR_IVLD_ACTIVE, "Invalid active code") TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_PAR_IVLD_KEY, "Invalid key to parse active code") TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_PAR_DEC_IVLD_KEY, "Invalid key to decode active code") TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_PAR_DEC_IVLD_KLEN, "Invalid klen to decode active code") -TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_GEN_IVLD_KEY, "Invalid key to gen active code") -TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_GEN_APP_LIMIT, "Limited app num to gen active code") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_GEN_IVLD_KEY, "Invalid key to generate active code") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_GEN_ACTIVE_LEN, "Exceeded active len to generate active code") TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_GEN_ENC_IVLD_KLEN, "Invalid klen to encode active code") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_PAR_IVLD_DIST, "Invalid distribution time to parse active code") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_UNLICENSED_CLUSTER, "Illegal operation, the license is being used by an unlicensed cluster") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_LACK_OF_BASIC, "Lack of basic functions in active code") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_OBJ_NOT_EXIST, "Grant object not exist") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_LAST_ACTIVE_NOT_FOUND, "The historial active code does not match") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_MACHINES_MISMATCH, "Cluster machines mismatch with active code") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_OPT_EXPIRE_TOO_LARGE, "Expire time of optional grant item is too large") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_DUPLICATED_ACTIVE, "The active code can't be activated repeatedly") +TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_VIEW_LIMITED, "Number of view has reached the licensed upper limit") // sync TAOS_DEFINE_ERROR(TSDB_CODE_SYN_TIMEOUT, "Sync timeout") @@ -596,7 +606,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_WINDOW_NOT_ALLOWED_FUNC, "Window not allowed" TAOS_DEFINE_ERROR(TSDB_CODE_PAR_STREAM_NOT_ALLOWED_FUNC, "Stream not allowed") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_GROUP_BY_NOT_ALLOWED_FUNC, "Group by not allowd") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_INTERP_CLAUSE, "Invalid interp clause") -TAOS_DEFINE_ERROR(TSDB_CODE_PAR_NO_VALID_FUNC_IN_WIN, "Not valid function ion window") +TAOS_DEFINE_ERROR(TSDB_CODE_PAR_NO_VALID_FUNC_IN_WIN, "Not valid function in window") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE, "Only support single table") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_SMA_INDEX, "Invalid sma index") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_SELECTED_EXPR, "Invalid SELECTed expression") diff --git a/source/util/src/tqueue.c b/source/util/src/tqueue.c index 1dfdd637b6..2cc13be6ba 100644 --- a/source/util/src/tqueue.c +++ b/source/util/src/tqueue.c @@ -159,6 +159,7 @@ void taosFreeQitem(void *pItem) { int32_t taosWriteQitem(STaosQueue *queue, void *pItem) { int32_t code = 0; STaosQnode *pNode = (STaosQnode *)(((char *)pItem) - sizeof(STaosQnode)); + pNode->timestamp = taosGetTimestampUs(); pNode->next = NULL; taosThreadMutexLock(&queue->mutex); @@ -464,6 +465,7 @@ int32_t taosReadAllQitemsFromQset(STaosQset *qset, STaosQall *qall, SQueueInfo * qinfo->ahandle = queue->ahandle; qinfo->fp = queue->itemsFp; qinfo->queue = queue; + qinfo->timestamp = queue->head->timestamp; queue->head = NULL; queue->tail = NULL; @@ -489,8 +491,8 @@ int32_t taosReadAllQitemsFromQset(STaosQset *qset, STaosQall *qall, SQueueInfo * int32_t taosQallItemSize(STaosQall *qall) { return qall->numOfItems; } int64_t taosQallMemSize(STaosQall *qall) { return qall->memOfItems; } -int64_t taosQallUnAccessedItemSize(STaosQall *qall) {return qall->unAccessedNumOfItems;} -int64_t taosQallUnAccessedMemSize(STaosQall *qall) {return qall->unAccessMemOfItems;} +int64_t taosQallUnAccessedItemSize(STaosQall *qall) { return qall->unAccessedNumOfItems; } +int64_t taosQallUnAccessedMemSize(STaosQall *qall) { return qall->unAccessMemOfItems; } void taosResetQitems(STaosQall *qall) { qall->current = qall->start; } int32_t taosGetQueueNumber(STaosQset *qset) { return qset->numOfQueues; } diff --git a/source/util/src/tsched.c b/source/util/src/tsched.c index 8ad7ccc7c2..645910dfbc 100644 --- a/source/util/src/tsched.c +++ b/source/util/src/tsched.c @@ -115,6 +115,7 @@ void *taosInitScheduler(int32_t queueSize, int32_t numOfThreads, const char *lab return (void *)pSched; } +#ifdef BUILD_NO_CALL void *taosInitSchedulerWithInfo(int32_t queueSize, int32_t numOfThreads, const char *label, void *tmrCtrl) { SSchedQueue *pSched = taosInitScheduler(queueSize, numOfThreads, label, NULL); @@ -125,6 +126,7 @@ void *taosInitSchedulerWithInfo(int32_t queueSize, int32_t numOfThreads, const c return pSched; } +#endif void *taosProcessSchedQueue(void *scheduler) { SSchedMsg msg; @@ -241,6 +243,7 @@ void taosCleanUpScheduler(void *param) { // taosMemoryFree(pSched); } +#ifdef BUILD_NO_CALL // for debug purpose, dump the scheduler status every 1min. void taosDumpSchedulerStatus(void *qhandle, void *tmrId) { SSchedQueue *pSched = (SSchedQueue *)qhandle; @@ -255,3 +258,4 @@ void taosDumpSchedulerStatus(void *qhandle, void *tmrId) { taosTmrReset(taosDumpSchedulerStatus, DUMP_SCHEDULER_TIME_WINDOW, pSched, pSched->pTmrCtrl, &pSched->pTimer); } +#endif diff --git a/source/util/src/tunit.c b/source/util/src/tunit.c index d3447294ea..378f23613a 100644 --- a/source/util/src/tunit.c +++ b/source/util/src/tunit.c @@ -64,6 +64,7 @@ int64_t taosStrHumanToInt64(const char* str) { return val; } +#ifdef BUILD_NO_CALL void taosInt64ToHumanStr(int64_t val, char* outStr) { if (((val >= UNIT_ONE_EXBIBYTE) || (-val >= UNIT_ONE_EXBIBYTE)) && ((val % UNIT_ONE_EXBIBYTE) == 0)) { sprintf(outStr, "%qdE", (long long)val / UNIT_ONE_EXBIBYTE); @@ -80,6 +81,7 @@ void taosInt64ToHumanStr(int64_t val, char* outStr) { } else sprintf(outStr, "%qd", (long long)val); } +#endif int32_t taosStrHumanToInt32(const char* str) { size_t sLen = strlen(str); @@ -112,6 +114,7 @@ int32_t taosStrHumanToInt32(const char* str) { return val; } +#ifdef BUILD_NO_CALL void taosInt32ToHumanStr(int32_t val, char* outStr) { if (((val >= UNIT_ONE_GIBIBYTE) || (-val >= UNIT_ONE_GIBIBYTE)) && ((val % UNIT_ONE_GIBIBYTE) == 0)) { sprintf(outStr, "%qdG", (long long)val / UNIT_ONE_GIBIBYTE); @@ -122,3 +125,4 @@ void taosInt32ToHumanStr(int32_t val, char* outStr) { } else sprintf(outStr, "%qd", (long long)val); } +#endif diff --git a/source/util/src/tworker.c b/source/util/src/tworker.c index 57dc60e539..3e591c7d7f 100644 --- a/source/util/src/tworker.c +++ b/source/util/src/tworker.c @@ -15,10 +15,12 @@ #define _DEFAULT_SOURCE #include "tworker.h" -#include "tgeosctx.h" #include "taoserror.h" +#include "tgeosctx.h" #include "tlog.h" +#define QUEUE_THRESHOLD 1000 * 1000 + typedef void *(*ThreadFp)(void *param); int32_t tQWorkerInit(SQWorkerPool *pool) { @@ -84,6 +86,13 @@ static void *tQWorkerThreadFp(SQueueWorker *worker) { break; } + if (qinfo.timestamp != 0) { + int64_t cost = taosGetTimestampUs() - qinfo.timestamp; + if (cost > QUEUE_THRESHOLD) { + uWarn("worker:%s,message has been queued for too long, cost: %" PRId64 "s", pool->name, cost / QUEUE_THRESHOLD); + } + } + if (qinfo.fp != NULL) { qinfo.workerId = worker->id; qinfo.threadNum = pool->num; @@ -198,6 +207,13 @@ static void *tAutoQWorkerThreadFp(SQueueWorker *worker) { break; } + if (qinfo.timestamp != 0) { + int64_t cost = taosGetTimestampUs() - qinfo.timestamp; + if (cost > QUEUE_THRESHOLD) { + uWarn("worker:%s,message has been queued for too long, cost: %" PRId64 "s", pool->name, cost / QUEUE_THRESHOLD); + } + } + if (qinfo.fp != NULL) { qinfo.workerId = worker->id; qinfo.threadNum = taosArrayGetSize(pool->workers); @@ -221,7 +237,7 @@ STaosQueue *tAutoQWorkerAllocQueue(SAutoQWorkerPool *pool, void *ahandle, FItem int32_t queueNum = taosGetQueueNumber(pool->qset); int32_t curWorkerNum = taosArrayGetSize(pool->workers); int32_t dstWorkerNum = ceilf(queueNum * pool->ratio); - if (dstWorkerNum < 1) dstWorkerNum = 1; + if (dstWorkerNum < 2) dstWorkerNum = 2; // spawn a thread to process queue while (curWorkerNum < dstWorkerNum) { @@ -338,6 +354,13 @@ static void *tWWorkerThreadFp(SWWorker *worker) { break; } + if (qinfo.timestamp != 0) { + int64_t cost = taosGetTimestampUs() - qinfo.timestamp; + if (cost > QUEUE_THRESHOLD) { + uWarn("worker:%s,message has been queued for too long, cost: %" PRId64 "s", pool->name, cost / QUEUE_THRESHOLD); + } + } + if (qinfo.fp != NULL) { qinfo.workerId = worker->id; qinfo.threadNum = pool->num; diff --git a/tests/army/community/cluster/snapshot.json b/tests/army/community/cluster/snapshot.json index d4f6f00d37..4855c23260 100644 --- a/tests/army/community/cluster/snapshot.json +++ b/tests/army/community/cluster/snapshot.json @@ -35,8 +35,8 @@ "start_timestamp":"now-12d", "columns": [ { "type": "bool", "name": "bc"}, - { "type": "float", "name": "fc" }, - { "type": "double", "name": "dc"}, + { "type": "float", "name": "fc", "min": 100, "max": 100}, + { "type": "double", "name": "dc", "min": 200, "max": 200}, { "type": "tinyint", "name": "ti"}, { "type": "smallint", "name": "si" }, { "type": "int", "name": "ic" }, diff --git a/tests/army/community/cluster/snapshot.py b/tests/army/community/cluster/snapshot.py index 5b5457be75..b4c4d3c4c8 100644 --- a/tests/army/community/cluster/snapshot.py +++ b/tests/army/community/cluster/snapshot.py @@ -29,7 +29,11 @@ from frame import * class TDTestCase(TBase): updatecfgDict = { - "countAlwaysReturnValue" : "0" + "countAlwaysReturnValue" : "0", + "lossyColumns" : "float,double", + "fPrecision" : "0.000000001", + "dPrecision" : "0.00000000000000001", + "ifAdtFse" : "1" } def insertData(self): @@ -48,6 +52,18 @@ class TDTestCase(TBase): sql = f"create table {self.db}.ta(ts timestamp, age int) tags(area int)" tdSql.execute(sql) + def checkFloatDouble(self): + sql = f"select * from {self.db}.{self.stb} where fc!=100" + tdSql.query(sql) + tdSql.checkRows(0) + sql = f"select count(*) from {self.db}.{self.stb} where dc!=200" + tdSql.query(sql) + tdSql.checkRows(0) + sql = f"select avg(fc) from {self.db}.{self.stb}" + tdSql.checkFirstValue(sql, 100) + sql = f"select avg(dc) from {self.db}.{self.stb}" + tdSql.checkFirstValue(sql, 200) + def doAction(self): tdLog.info(f"do action.") self.flushDb() @@ -85,6 +101,9 @@ class TDTestCase(TBase): # check insert data correct self.checkInsertCorrect() + # check float double value ok + self.checkFloatDouble() + # save self.snapshotAgg() @@ -97,6 +116,10 @@ class TDTestCase(TBase): # check insert correct again self.checkInsertCorrect() + # check float double value ok + self.checkFloatDouble() + + tdLog.success(f"{__file__} successfully executed") diff --git a/tests/army/community/cmdline/fullopt.py b/tests/army/community/cmdline/fullopt.py index d1d4421018..c0ce709801 100644 --- a/tests/army/community/cmdline/fullopt.py +++ b/tests/army/community/cmdline/fullopt.py @@ -27,6 +27,15 @@ from frame import * class TDTestCase(TBase): + updatecfgDict = { + 'queryMaxConcurrentTables': '2K', + 'streamMax': '1M', + 'totalMemoryKB': '1G', + #'rpcQueueMemoryAllowed': '1T', + #'mndLogRetention': '1P', + 'streamBufferSize':'2G' + } + def insertData(self): tdLog.info(f"insert data.") @@ -62,7 +71,7 @@ class TDTestCase(TBase): # TSDB_FQDN_LEN = 128 lname = "testhostnamelength" - lname.rjust(130, 'a') + lname.rjust(230, 'a') # except test sql = f"show vgroups;" @@ -72,6 +81,9 @@ class TDTestCase(TBase): etool.exeBinFile("taos", f'-a {lname} -s "{sql}" ', wait=False) etool.exeBinFile("taos", f'-p{lname} -s "{sql}" ', wait=False) etool.exeBinFile("taos", f'-w -s "{sql}" ', wait=False) + etool.exeBinFile("taos", f'abc', wait=False) + etool.exeBinFile("taos", f'-V', wait=False) + etool.exeBinFile("taos", f'-?', wait=False) # others etool.exeBinFile("taos", f'-N 200 -l 2048 -s "{sql}" ', wait=False) @@ -121,6 +133,11 @@ class TDTestCase(TBase): time.sleep(3) eos.exe("pkill -9 taos") + # call enter password + etool.exeBinFile("taos", f'-p', wait=False) + time.sleep(1) + eos.exe("pkill -9 taos") + # run def run(self): tdLog.debug(f"start to excute {__file__}") diff --git a/tests/army/community/storage/oneStageComp.json b/tests/army/community/storage/oneStageComp.json new file mode 100644 index 0000000000..f64fda3824 --- /dev/null +++ b/tests/army/community/storage/oneStageComp.json @@ -0,0 +1,66 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "connection_pool_size": 8, + "num_of_records_per_req": 3000, + "prepared_rand": 3000, + "thread_count": 2, + "create_table_thread_count": 1, + "confirm_parameter_prompt": "no", + "databases": [ + { + "dbinfo": { + "name": "db", + "drop": "yes", + "vgroups": 2, + "replica": 3, + "wal_retention_period": 10, + "wal_retention_size": 100, + "keep": "60d,120d,365d", + "stt_trigger": 1, + "wal_level": 2, + "WAL_FSYNC_PERIOD": 3300, + "cachemodel": "'last_value'", + "TABLE_PREFIX":1, + "comp": 1 + }, + "super_tables": [ + { + "name": "stb", + "child_table_exists": "no", + "childtable_count": 10, + "insert_rows": 100000, + "childtable_prefix": "d", + "insert_mode": "taosc", + "timestamp_step": 1000, + "start_timestamp":"now-360d", + "columns": [ + { "type": "bool", "name": "bc","max": 1,"min": 1}, + { "type": "float", "name": "fc" ,"max": 101,"min": 101}, + { "type": "double", "name": "dc" ,"max": 102,"min": 102}, + { "type": "tinyint", "name": "ti" ,"max": 103,"min": 103}, + { "type": "smallint", "name": "si" ,"max": 104,"min": 104}, + { "type": "int", "name": "ic" ,"max": 105,"min": 105}, + { "type": "bigint", "name": "bi" ,"max": 106,"min": 106}, + { "type": "utinyint", "name": "uti","max": 107,"min": 107}, + { "type": "usmallint", "name": "usi","max": 108,"min": 108}, + { "type": "uint", "name": "ui" ,"max": 109,"min": 109}, + { "type": "ubigint", "name": "ubi","max": 110,"min": 110}, + { "type": "binary", "name": "bin", "len": 16}, + { "type": "nchar", "name": "nch", "len": 32} + ], + "tags": [ + {"type": "tinyint", "name": "groupid","max": 100,"min": 100}, + {"name": "location","type": "binary", "len": 16, "values": + ["San Francisco", "Los Angles", "San Diego", "San Jose", "Palo Alto", "Campbell", "Mountain View","Sunnyvale", "Santa Clara", "Cupertino"] + } + ] + } + ] + } + ] +} diff --git a/tests/army/community/storage/oneStageComp.py b/tests/army/community/storage/oneStageComp.py new file mode 100644 index 0000000000..9a2c7cfcd6 --- /dev/null +++ b/tests/army/community/storage/oneStageComp.py @@ -0,0 +1,140 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import time +import random + +import taos +import frame +import frame.etool + + +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * + + +class TDTestCase(TBase): + updatecfgDict = { + "compressMsgSize" : "100", + } + + def insertData(self): + tdLog.info(f"insert data.") + # taosBenchmark run + jfile = etool.curFile(__file__, "oneStageComp.json") + etool.benchMark(json=jfile) + + tdSql.execute(f"use {self.db}") + # set insert data information + self.childtable_count = 10 + self.insert_rows = 100000 + self.timestamp_step = 1000 + + + + def checkColValueCorrect(self): + tdLog.info(f"do action.") + self.flushDb() + + # check all columns correct + cnt = self.insert_rows * self.childtable_count + sql = "select * from stb where bc!=1" + tdSql.query(sql) + tdSql.checkRows(0) + sql = "select * from stb where fc=101" + tdSql.query(sql) + tdSql.checkRows(cnt) + sql = "select * from stb where dc!=102" + tdSql.query(sql) + tdSql.checkRows(0) + sql = "select * from stb where ti!=103" + tdSql.query(sql) + tdSql.checkRows(0) + sql = "select * from stb where si!=104" + tdSql.query(sql) + tdSql.checkRows(0) + sql = "select * from stb where ic!=105" + tdSql.query(sql) + tdSql.checkRows(0) + sql = "select * from stb where bi!=106" + tdSql.query(sql) + tdSql.checkRows(0) + sql = "select * from stb where uti!=107" + tdSql.query(sql) + tdSql.checkRows(0) + sql = "select * from stb where usi!=108" + tdSql.query(sql) + tdSql.checkRows(0) + sql = "select * from stb where ui!=109" + tdSql.query(sql) + tdSql.checkRows(0) + sql = "select * from stb where ubi!=110" + tdSql.query(sql) + tdSql.checkRows(0) + + def insertNull(self): + # insert 6 lines + sql = "insert into d0(ts) values(now) (now + 1s) (now + 2s) (now + 3s) (now + 4s) (now + 5s)" + tdSql.execute(sql) + + self.flushDb() + self.trimDb() + + # check all columns correct + cnt = self.insert_rows * self.childtable_count + sql = "select * from stb where bc!=1" + tdSql.query(sql) + tdSql.checkRows(0) + sql = "select * from stb where bc is null" + tdSql.query(sql) + tdSql.checkRows(6) + sql = "select * from stb where bc=1" + tdSql.query(sql) + tdSql.checkRows(cnt) + sql = "select * from stb where usi is null" + tdSql.query(sql) + tdSql.checkRows(6) + + # run + def run(self): + tdLog.debug(f"start to excute {__file__}") + + # insert data + self.insertData() + + # check insert data correct + self.checkInsertCorrect() + + # save + self.snapshotAgg() + + # do action + self.checkColValueCorrect() + + # check save agg result correct + self.checkAggCorrect() + + # insert null + self.insertNull() + + + tdLog.success(f"{__file__} successfully executed") + + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/army/enterprise/s3/s3_basic.py b/tests/army/enterprise/s3/s3_basic.py index a1a945a304..e7bc188ca5 100644 --- a/tests/army/enterprise/s3/s3_basic.py +++ b/tests/army/enterprise/s3/s3_basic.py @@ -128,7 +128,7 @@ class TDTestCase(TBase): self.checkInsertCorrect() # check stream correct and drop stream - # self.checkStreamCorrect() + #self.checkStreamCorrect() # drop stream self.dropStream(self.sname) diff --git a/tests/develop-test/2-query/table_count_scan.py b/tests/develop-test/2-query/table_count_scan.py index 40d2e2a887..09b34a97d0 100644 --- a/tests/develop-test/2-query/table_count_scan.py +++ b/tests/develop-test/2-query/table_count_scan.py @@ -65,7 +65,7 @@ class TDTestCase: tdSql.query('select count(*),db_name, stable_name from information_schema.ins_tables group by db_name, stable_name;') tdSql.checkRows(3) - tdSql.checkData(0, 0, 26) + tdSql.checkData(0, 0, 29) tdSql.checkData(0, 1, 'information_schema') tdSql.checkData(0, 2, None) tdSql.checkData(1, 0, 3) @@ -77,7 +77,7 @@ class TDTestCase: tdSql.query('select count(1) v,db_name, stable_name from information_schema.ins_tables group by db_name, stable_name order by v desc;') tdSql.checkRows(3) - tdSql.checkData(0, 0, 26) + tdSql.checkData(0, 0, 29) tdSql.checkData(0, 1, 'information_schema') tdSql.checkData(0, 2, None) tdSql.checkData(1, 0, 5) @@ -93,7 +93,7 @@ class TDTestCase: tdSql.checkData(1, 1, 'performance_schema') tdSql.checkData(0, 0, 3) tdSql.checkData(0, 1, 'tbl_count') - tdSql.checkData(2, 0, 26) + tdSql.checkData(2, 0, 29) tdSql.checkData(2, 1, 'information_schema') tdSql.query("select count(*) from information_schema.ins_tables where db_name='tbl_count'") @@ -106,7 +106,7 @@ class TDTestCase: tdSql.query('select count(*) from information_schema.ins_tables') tdSql.checkRows(1) - tdSql.checkData(0, 0, 34) + tdSql.checkData(0, 0, 37) tdSql.execute('create table stba (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 float, c7 double, c8 binary(10), c9 nchar(10), c10 tinyint unsigned, c11 smallint unsigned, c12 int unsigned, c13 bigint unsigned) TAGS(t1 int, t2 binary(10), t3 double);') @@ -189,7 +189,7 @@ class TDTestCase: tdSql.checkData(2, 0, 5) tdSql.checkData(2, 1, 'performance_schema') tdSql.checkData(2, 2, None) - tdSql.checkData(3, 0, 26) + tdSql.checkData(3, 0, 29) tdSql.checkData(3, 1, 'information_schema') tdSql.checkData(3, 2, None) @@ -204,7 +204,7 @@ class TDTestCase: tdSql.checkData(2, 0, 5) tdSql.checkData(2, 1, 'performance_schema') tdSql.checkData(2, 2, None) - tdSql.checkData(3, 0, 26) + tdSql.checkData(3, 0, 29) tdSql.checkData(3, 1, 'information_schema') tdSql.checkData(3, 2, None) @@ -215,7 +215,7 @@ class TDTestCase: tdSql.checkData(0, 1, 'tbl_count') tdSql.checkData(1, 0, 5) tdSql.checkData(1, 1, 'performance_schema') - tdSql.checkData(2, 0, 26) + tdSql.checkData(2, 0, 29) tdSql.checkData(2, 1, 'information_schema') tdSql.query("select count(*) from information_schema.ins_tables where db_name='tbl_count'") @@ -228,7 +228,7 @@ class TDTestCase: tdSql.query('select count(*) from information_schema.ins_tables') tdSql.checkRows(1) - tdSql.checkData(0, 0, 35) + tdSql.checkData(0, 0, 38) tdSql.execute('drop database tbl_count') diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index d932529d0a..d43a9a7ee6 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -4,12 +4,8 @@ #unit-test -archOs=$(arch) -if [[ $archOs =~ "aarch64" ]]; then ,,n,unit-test,bash test.sh -else -,,y,unit-test,bash test.sh -fi + # # army-test @@ -23,12 +19,12 @@ fi ,,y,army,./pytest.sh python3 ./test.py -f community/query/query_basic.py -N 3 ,,y,army,./pytest.sh python3 ./test.py -f community/cluster/splitVgroupByLearner.py -N 3 ,,n,army,python3 ./test.py -f community/cmdline/fullopt.py - - +,,y,army,./pytest.sh python3 ./test.py -f community/storage/oneStageComp.py -N 3 -L 3 -D 1 # # system test # +,,y,system-test,./pytest.sh python3 ./test.py -f 8-stream/stream_multi_agg.py ,,y,system-test,./pytest.sh python3 ./test.py -f 8-stream/stream_basic.py ,,y,system-test,./pytest.sh python3 ./test.py -f 8-stream/scalar_function.py ,,y,system-test,./pytest.sh python3 ./test.py -f 8-stream/at_once_interval.py @@ -230,6 +226,7 @@ fi ,,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/tmqVnodeTransform-stb.py -N 2 -n 1 ,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeTransform-stb.py -N 6 -n 3 #,,y,system-test,./pytest.sh python3 test.py -f 7-tmq/tmqVnodeTransform-db.py -N 6 -n 3 @@ -292,6 +289,7 @@ fi ,,n,system-test,python3 ./test.py -f 0-others/timeRangeWise.py -N 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/delete_check.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/test_hot_refresh_configurations.py +,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/subscribe_stream_privilege.py ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/insert_double.py ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_database.py @@ -348,6 +346,7 @@ fi ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/ts-4272.py ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/test_ts4295.py ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/test_td27388.py +,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/test_ts4479.py ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/insert_timestamp.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/show.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/show_tag_index.py @@ -565,7 +564,7 @@ fi ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/systable_func.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/test_ts4382.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/test_ts4403.py - +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/test_td28163.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/stablity.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/stablity_1.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/elapsed.py diff --git a/tests/script/coverage_test.sh b/tests/script/coverage_test.sh index d8f1999b26..01192763a1 100644 --- a/tests/script/coverage_test.sh +++ b/tests/script/coverage_test.sh @@ -211,7 +211,7 @@ function lcovFunc { '*/AccessBridgeCalls.c' '*/ttszip.c' '*/dataInserter.c' '*/tlinearhash.c' '*/tsimplehash.c' '*/tsdbDiskData.c'\ '*/texpr.c' '*/runUdf.c' '*/schDbg.c' '*/syncIO.c' '*/tdbOs.c' '*/pushServer.c' '*/osLz4.c'\ '*/tbase64.c' '*/tbuffer.c' '*/tdes.c' '*/texception.c' '*/examples/*' '*/tidpool.c' '*/tmempool.c'\ - '*/clientJniConnector.c' '*/clientTmqConnector.c' '*/version.c'\ + '*/clientJniConnector.c' '*/clientTmqConnector.c' '*/version.c' '*/build_version.cc'\ '*/tthread.c' '*/tversion.c' '*/ctgDbg.c' '*/schDbg.c' '*/qwDbg.c' '*/tencode.h' \ '*/shellAuto.c' '*/shellTire.c' '*/shellCommand.c'\ '*/sql.c' '*/sql.y'\ diff --git a/tests/script/sh/checkAsan.sh b/tests/script/sh/checkAsan.sh index 9f67d437e2..d2f1e13e8f 100755 --- a/tests/script/sh/checkAsan.sh +++ b/tests/script/sh/checkAsan.sh @@ -72,7 +72,7 @@ python_error=$(cat ${LOG_DIR}/*.info | grep -w "stack" | wc -l) #0 0x7f2d64f5a808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144 #1 0x7f2d63fcf459 in strerror /build/glibc-SzIz7B/glibc-2.31/string/strerror.c:38 -runtime_error=$(cat ${LOG_DIR}/*.asan | grep "runtime error" | grep -v "trees.c:873" | grep -v "sclfunc.c.*outside the range of representable values of type" | grep -v "signed integer overflow" | grep -v "strerror.c" | grep -v "asan_malloc_linux.cc" | grep -v "strerror.c" | wc -l) +runtime_error=$(cat ${LOG_DIR}/*.asan | grep "runtime error" | grep -v "trees.c:873" | grep -v "sclfunc.c.*outside the range of representable values of type" | grep -v "signed integer overflow" | grep -v "strerror.c" | grep -v "asan_malloc_linux.cc" | grep -v "strerror.c" | grep -v "asan_malloc_linux.cpp" | grep -v "sclvector.c" | wc -l) echo -e "\033[44;32;1m"asan error_num: $error_num"\033[0m" echo -e "\033[44;32;1m"asan memory_leak: $memory_leak"\033[0m" diff --git a/tests/script/tsim/query/join_order.sim b/tests/script/tsim/query/join_order.sim index bd772ff407..534ab5d631 100644 --- a/tests/script/tsim/query/join_order.sim +++ b/tests/script/tsim/query/join_order.sim @@ -47,5 +47,90 @@ sql select a.*,b.* from (select * from tba1 order by ts desc) a, (select * from if $rows != 4 then return -1 endi +sql select a.*,b.* from (select * from tba1 order by ts desc) a, (select * from tba1 order by ts) b where a.ts=b.ts order by a.ts; +if $rows != 4 then + return -1 +endi +if $data00 != @23-11-17 16:29:00.000@ then + return -1 +endi +sql select a.*,b.* from (select * from tba1 order by ts desc) a, (select * from tba1 order by ts) b where a.ts=b.ts order by a.ts desc; +if $rows != 4 then + return -1 +endi +if $data00 != @23-11-17 16:29:04.000@ then + return -1 +endi +sql select a.*,b.* from (select * from tba1 order by ts) a, (select * from tba1 order by ts) b where a.ts=b.ts order by a.ts; +if $rows != 4 then + return -1 +endi +if $data00 != @23-11-17 16:29:00.000@ then + return -1 +endi +sql select a.*,b.* from (select * from tba1 order by ts) a, (select * from tba1 order by ts) b where a.ts=b.ts order by a.ts desc; +if $rows != 4 then + return -1 +endi +if $data00 != @23-11-17 16:29:04.000@ then + return -1 +endi +sql select a.*,b.* from (select * from tba1 order by ts limit 2) a, (select * from tba1 order by ts desc limit 2) b where a.ts=b.ts order by a.ts desc; +if $rows != 0 then + return -1 +endi +sql select a.*,b.* from (select * from tba1 order by ts limit 3) a, (select * from tba1 order by ts desc limit 3) b where a.ts=b.ts order by a.ts desc; +if $rows != 2 then + return -1 +endi +if $data00 != @23-11-17 16:29:03.000@ then + return -1 +endi + +sql select a.*,b.* from (select * from tba1 order by ts limit 3) a, (select * from tba1 order by ts desc limit 3) b where a.ts=b.ts order by a.ts; +if $rows != 2 then + return -1 +endi +if $data00 != @23-11-17 16:29:02.000@ then + return -1 +endi + +sql select a.*,b.* from tba1 a, (select * from tba1 order by ts desc limit 3) b where a.ts=b.ts order by a.ts; +if $rows != 3 then + return -1 +endi +if $data00 != @23-11-17 16:29:02.000@ then + return -1 +endi +sql select a.*,b.* from tba1 a, (select * from tba1 order by ts limit 3) b where a.ts=b.ts order by a.ts desc limit 2; +if $rows != 2 then + return -1 +endi +if $data00 != @23-11-17 16:29:03.000@ then + return -1 +endi + +sql select a.*,b.* from (select * from tba1 order by ts limit 3) a, tba1 b where a.ts=b.ts order by a.ts desc; +if $rows != 3 then + return -1 +endi +if $data00 != @23-11-17 16:29:03.000@ then + return -1 +endi +sql select a.*,b.* from (select * from tba1 order by ts desc limit 3) a, tba1 b where a.ts=b.ts order by a.ts desc; +if $rows != 3 then + return -1 +endi +if $data00 != @23-11-17 16:29:04.000@ then + return -1 +endi + +sql select a.*,b.* from (select * from tba1 order by ts desc limit 3) a, tba1 b where a.ts=b.ts order by a.ts; +if $rows != 3 then + return -1 +endi +if $data00 != @23-11-17 16:29:02.000@ then + return -1 +endi system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/query/sys_tbname.sim b/tests/script/tsim/query/sys_tbname.sim index 8bf0fb4700..9069ad949c 100644 --- a/tests/script/tsim/query/sys_tbname.sim +++ b/tests/script/tsim/query/sys_tbname.sim @@ -58,7 +58,7 @@ endi sql select tbname from information_schema.ins_tables; print $rows $data00 -if $rows != 35 then +if $rows != 38 then return -1 endi if $data00 != @ins_tables@ then diff --git a/tests/script/tsim/query/tableCount.sim b/tests/script/tsim/query/tableCount.sim index 315a39e56d..573e134133 100644 --- a/tests/script/tsim/query/tableCount.sim +++ b/tests/script/tsim/query/tableCount.sim @@ -53,7 +53,7 @@ sql select stable_name,count(table_name) from information_schema.ins_tables grou if $rows != 3 then return -1 endi -if $data01 != 32 then +if $data01 != 35 then return -1 endi if $data11 != 10 then @@ -72,7 +72,7 @@ endi if $data11 != 5 then return -1 endi -if $data21 != 26 then +if $data21 != 29 then return -1 endi if $data31 != 5 then @@ -97,7 +97,7 @@ endi if $data42 != 3 then return -1 endi -if $data52 != 26 then +if $data52 != 29 then return -1 endi if $data62 != 5 then diff --git a/tests/script/tsim/stream/distributeInterval0.sim b/tests/script/tsim/stream/distributeInterval0.sim index a4e7941c28..cc8b7227d7 100644 --- a/tests/script/tsim/stream/distributeInterval0.sim +++ b/tests/script/tsim/stream/distributeInterval0.sim @@ -475,6 +475,8 @@ sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); sql create stream stream_t3 trigger at_once into streamtST3 as select ts, min(a) c6, a, b, c, ta, tb, tc from st interval(10s) ; +sleep 1000 + sql insert into ts1 values(1648791211000,1,2,3); sleep 50 sql insert into ts1 values(1648791222001,2,2,3); @@ -488,6 +490,9 @@ $loop_count = 0 loop3: sql select * from streamtST3; +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 + sleep 1000 $loop_count = $loop_count + 1 if $loop_count == 30 then diff --git a/tests/script/tsim/stream/fillHistoryBasic2.sim b/tests/script/tsim/stream/fillHistoryBasic2.sim index 01019334a2..b3dd947eb9 100644 --- a/tests/script/tsim/stream/fillHistoryBasic2.sim +++ b/tests/script/tsim/stream/fillHistoryBasic2.sim @@ -243,6 +243,8 @@ sql create table ts1 using st tags(1,1,1); sql create table ts2 using st tags(2,2,2); sql create stream stream_t3 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamtST3 as select ts, min(a) c6, a, b, c, ta, tb, tc from st interval(10s) ; +sleep 1000 + sql insert into ts1 values(1648791211000,1,2,3); sleep 50 sql insert into ts1 values(1648791222001,2,2,3); diff --git a/tests/script/tsim/stream/windowClose.sim b/tests/script/tsim/stream/windowClose.sim index 67678963ea..ce5c57572e 100644 --- a/tests/script/tsim/stream/windowClose.sim +++ b/tests/script/tsim/stream/windowClose.sim @@ -290,6 +290,213 @@ if $data32 != $now32 then return -1 endi +print step 2 max delay 2s +sql create database test15 vgroups 4; +sql use test15; +sql create table t1(ts timestamp, a int, b int , c int, d double); + +sql create stream stream15 trigger max_delay 2s into streamt13 as select _wstart, sum(a), now from t1 session(ts, 10s); + +sleep 1000 + +sql insert into t1 values(1648791213000,1,2,3,1.0); +sql insert into t1 values(1648791233001,2,2,3,1.1); + +$loop_count = 0 + +loop4: + +sleep 1000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +sql select * from streamt13; + +if $rows != 2 then + print ======rows=$rows + goto loop4 +endi + +$now02 = $data02 +$now12 = $data12 + + +print step1 max delay 2s......... sleep 3s +sleep 3000 + +sql select * from streamt13; + + +if $data02 != $now02 then + print ======data02=$data02 + return -1 +endi + +if $data12 != $now12 then + print ======data12=$data12 + return -1 +endi + +print step1 max delay 2s......... sleep 3s +sleep 3000 + +sql select * from streamt13; + + +if $data02 != $now02 then + print ======data02=$data02 + return -1 +endi + +if $data12 != $now12 then + print ======data12=$data12 + return -1 +endi + +print session max delay over + +print step 3 max delay 2s +sql create database test16 vgroups 4; +sql use test16; +sql create table t1(ts timestamp, a int, b int , c int, d double); + +sql create stream stream16 trigger max_delay 2s into streamt13 as select _wstart, sum(a), now from t1 state_window(a); + +sleep 1000 + +sql insert into t1 values(1648791213000,1,2,3,1.0); +sql insert into t1 values(1648791233001,2,2,3,1.1); + +$loop_count = 0 + +loop5: + +sleep 1000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +sql select * from streamt13; + +if $rows != 2 then + print ======rows=$rows + goto loop5 +endi + +$now02 = $data02 +$now12 = $data12 + + +print step1 max delay 2s......... sleep 3s +sleep 3000 + +sql select * from streamt13; + + +if $data02 != $now02 then + print ======data02=$data02 + return -1 +endi + +if $data12 != $now12 then + print ======data12=$data12 + return -1 +endi + +print step1 max delay 2s......... sleep 3s +sleep 3000 + +sql select * from streamt13; + + +if $data02 != $now02 then + print ======data02=$data02 + return -1 +endi + +if $data12 != $now12 then + print ======data12=$data12 + return -1 +endi + +print state max delay over + +print step 4 max delay 2s +sql create database test17 vgroups 4; +sql use test17; +sql create table t1(ts timestamp, a int, b int , c int, d double); + +sql create stream stream17 trigger max_delay 2s into streamt13 as select _wstart, sum(a), now from t1 event_window start with a = 1 end with a = 9; + +sleep 1000 + +sql insert into t1 values(1648791213000,1,2,3,1.0); +sql insert into t1 values(1648791213001,9,2,3,1.0); + +sql insert into t1 values(1648791233001,1,2,3,1.1); +sql insert into t1 values(1648791233009,9,2,3,1.1); + +$loop_count = 0 + +loop6: + +sleep 1000 + +$loop_count = $loop_count + 1 +if $loop_count == 20 then + return -1 +endi + +sql select * from streamt13; + +if $rows != 2 then + print ======rows=$rows + goto loop6 +endi + +$now02 = $data02 +$now12 = $data12 + + +print step1 max delay 2s......... sleep 3s +sleep 3000 + +sql select * from streamt13; + + +if $data02 != $now02 then + print ======data02=$data02 + return -1 +endi + +if $data12 != $now12 then + print ======data12=$data12 + return -1 +endi + +print step1 max delay 2s......... sleep 3s +sleep 3000 + +sql select * from streamt13; + + +if $data02 != $now02 then + print ======data02=$data02 + return -1 +endi + +if $data12 != $now12 then + print ======data12=$data12 + return -1 +endi + +print event max delay over + print ======over system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/system-test/0-others/information_schema.py b/tests/system-test/0-others/information_schema.py index 20305bf4c1..a7995762d8 100644 --- a/tests/system-test/0-others/information_schema.py +++ b/tests/system-test/0-others/information_schema.py @@ -58,7 +58,7 @@ class TDTestCase: self.ins_list = ['ins_dnodes','ins_mnodes','ins_qnodes','ins_snodes','ins_cluster','ins_databases','ins_functions',\ 'ins_indexes','ins_stables','ins_tables','ins_tags','ins_columns','ins_users','ins_grants','ins_vgroups','ins_configs','ins_dnode_variables',\ 'ins_topics','ins_subscriptions','ins_streams','ins_stream_tasks','ins_vnodes','ins_user_privileges','ins_views', - 'ins_compacts', 'ins_compact_details'] + 'ins_compacts', 'ins_compact_details', 'ins_grants_full','ins_grants_logs', 'ins_machines'] self.perf_list = ['perf_connections','perf_queries','perf_consumers','perf_trans','perf_apps'] def insert_data(self,column_dict,tbname,row_num): insert_sql = self.setsql.set_insertsql(column_dict,tbname,self.binary_str,self.nchar_str) @@ -218,7 +218,7 @@ class TDTestCase: tdSql.checkEqual(20470,len(tdSql.queryResult)) tdSql.query("select * from information_schema.ins_columns where db_name ='information_schema'") - tdSql.checkEqual(219, len(tdSql.queryResult)) + tdSql.checkEqual(True, len(tdSql.queryResult) in range(215, 230)) tdSql.query("select * from information_schema.ins_columns where db_name ='performance_schema'") tdSql.checkEqual(54, len(tdSql.queryResult)) @@ -229,8 +229,7 @@ class TDTestCase: tdSql.query(f'select * from information_schema.ins_dnodes') result = tdSql.queryResult tdSql.checkEqual(result[0][0],1) - tdSql.checkEqual(result[0][8],"") - tdSql.checkEqual(result[0][9],"") + tdSql.checkEqual(True, len(result[0][8]) in (0,24)) self.str107 = 'Hc7VCc+' for t in range (10): self.str107 += 'tP+2soIXpP' @@ -247,11 +246,9 @@ class TDTestCase: tdSql.error('alter dnode 1 "activeCode" "' + self.str109 + '"') tdSql.error('alter all dnodes "activeCode" "' + self.str510 + '"') tdSql.query(f'select * from information_schema.ins_dnodes') - tdSql.checkEqual(tdSql.queryResult[0][8],"") - tdSql.execute('alter dnode 1 "activeCode" ""') - tdSql.query(f'select active_code,c_active_code from information_schema.ins_dnodes') - tdSql.checkEqual(tdSql.queryResult[0][0],"") - tdSql.checkEqual(tdSql.queryResult[0][1],'') + tdSql.checkEqual(True, len(result[0][8]) in (0,24)) + tdSql.error('alter dnode 1 "activeCode" ""') + tdSql.error(f'select active_code,c_active_code from information_schema.ins_dnodes') tdSql.error('alter dnode 1 "cActiveCode" "a"') tdSql.error('alter dnode 1 "cActiveCode" "' + self.str107 + '"') tdSql.error('alter dnode 1 "cActiveCode" "' + self.str256 + '"') @@ -260,15 +257,59 @@ class TDTestCase: tdSql.error('alter all dnodes "cActiveCode" "' + self.str257 + '"') tdSql.error('alter all dnodes "cActiveCode" "' + self.str254 + '"') tdSql.error('alter dnode 1 "cActiveCode" "' + self.str510 + '"') - tdSql.query(f'select active_code,c_active_code from information_schema.ins_dnodes') - tdSql.checkEqual(tdSql.queryResult[0][0],"") - tdSql.checkEqual(tdSql.queryResult[0][1],"") + tdSql.error(f'select active_code,c_active_code from information_schema.ins_dnodes') tdSql.error('alter dnode 1 "cActiveCode" "' + self.str109 + '"') tdSql.query(f'show dnodes') - tdSql.checkEqual(tdSql.queryResult[0][9],"") - tdSql.execute('alter all dnodes "cActiveCode" ""') - tdSql.query(f'select c_active_code from information_schema.ins_dnodes') - tdSql.checkEqual(tdSql.queryResult[0][0],'') + tdSql.error(f'select c_active_code from information_schema.ins_dnodes') + tdSql.error('alter all dnodes "cActiveCode" ""') + + def ins_grants_check(self): + grant_name_dict = { + 'stream':'stream', + 'subscription':'subscription', + 'view':'view', + 'audit':'audit', + 'csv':'csv', + 'storage':'multi_tier_storage', + 'backup_restore':'backup_restore', + 'opc_da':'OPC_DA', + 'opc_ua':'OPC_UA', + 'pi':'Pi', + 'kafka':'Kafka', + 'influxdb':'InfluxDB', + 'mqtt':'MQTT', + 'avevahistorian':'avevaHistorian', + 'opentsdb':'OpenTSDB', + 'td2.6':'TDengine2.6', + 'td3.0':'TDengine3.0' + } + + tdSql.execute('drop database if exists db2') + tdSql.execute('create database if not exists db2 vgroups 1 replica 1') + tdSql.query(f'select * from information_schema.ins_grants_full') + result = tdSql.queryResult + index = 0 + for i in range(0, len(result)): + if result[i][0] in grant_name_dict: + tdSql.checkEqual(result[i][1], grant_name_dict[result[i][0]]) + index += 1 + tdSql.checkEqual(index, 17) + tdSql.query(f'select * from information_schema.ins_grants_logs') + result = tdSql.queryResult + tdSql.checkEqual(True, len(result) >= 0) + if(len(result) > 0): + tdSql.checkEqual(True, result[0][0].find(",init,ungranted,ungranted") >= 16) + tdSql.checkEqual(True, len(result[0][1]) == 0) + tdSql.checkEqual(True, len(result[0][2]) >= 46) + + tdSql.query(f'select * from information_schema.ins_machines') + tdSql.checkRows(1) + tdSql.execute('alter cluster "activeCode" "revoked"') + tdSql.execute('alter cluster "activeCode" "revoked"') + tdSql.error('alter cluster "activeCode" ""') + tdSql.error('alter cluster "activeCode" "abc"') + tdSql.error('alter cluster "activeCode" ""') + tdSql.execute('alter cluster "activeCode" "revoked"') def run(self): self.prepare_data() @@ -278,6 +319,7 @@ class TDTestCase: self.ins_stable_check() self.ins_stable_check2() self.ins_dnodes_check() + self.ins_grants_check() def stop(self): diff --git a/tests/system-test/0-others/subscribe_stream_privilege.py b/tests/system-test/0-others/subscribe_stream_privilege.py new file mode 100644 index 0000000000..b477af9f57 --- /dev/null +++ b/tests/system-test/0-others/subscribe_stream_privilege.py @@ -0,0 +1,184 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +import time + +import taos +from taos.tmq import * +from util.cases import * +from util.common import * +from util.log import * +from util.sql import * +from util.sqlset import * + + +class TDTestCase: + clientCfgDict = {'debugFlag': 135} + updatecfgDict = {'debugFlag': 143, 'clientCfg':clientCfgDict} + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + self.setsql = TDSetSql() + self.stbname = 'stb' + self.user_name = 'test' + self.binary_length = 20 # the length of binary for column_dict + self.nchar_length = 20 # the length of nchar for column_dict + self.dbnames = ['db1'] + self.column_dict = { + 'ts': 'timestamp', + 'col1': 'float', + 'col2': 'int', + 'col3': 'float', + } + + self.tag_dict = { + 't1': 'int', + 't2': f'binary({self.binary_length})' + } + + self.tag_list = [ + f'1, "Beijing"', + f'2, "Shanghai"', + f'3, "Guangzhou"', + f'4, "Shenzhen"' + ] + + self.values_list = [ + f'now, 9.1, 200, 0.3' + ] + + self.tbnum = 4 + self.topic_name = 'topic1' + + + def prepare_data(self): + for db in self.dbnames: + tdSql.execute(f"create database {db} vgroups 1") + tdSql.execute(f"use {db}") + tdSql.execute(self.setsql.set_create_stable_sql(self.stbname, self.column_dict, self.tag_dict)) + for i in range(self.tbnum): + tdSql.execute(f'create table {self.stbname}_{i} using {self.stbname} tags({self.tag_list[i]})') + for j in self.values_list: + tdSql.execute(f'insert into {self.stbname}_{i} values({j})') + + def checkUserPrivileges(self, rowCnt): + tdSql.query("show user privileges") + tdSql.checkRows(rowCnt) + + def streamTest(self): + tdSql.execute("create stream s1 trigger at_once fill_history 1 into so1 as select ts,abs(col2) from stb partition by tbname") + time.sleep(2) + tdSql.query("select * from so1") + tdSql.checkRows(4) + tdSql.execute("insert into stb_0(ts,col2) values(now, 332)") + time.sleep(2) + tdSql.query("select * from so1") + tdSql.checkRows(5) + + time.sleep(2) + tdSql.query("select * from information_schema.ins_stream_tasks") + tdSql.checkData(0, 5, 'ready') + + print(time.time()) + while 1: + t = time.time() + if t > 1706254434 : + break + else: + print("time:%d" %(t)) + time.sleep(1) + + + tdSql.error("create stream s11 trigger at_once fill_history 1 into so1 as select ts,abs(col2) from stb partition by tbname") + + time.sleep(10) + tdSql.query("select * from information_schema.ins_stream_tasks") + tdSql.checkData(0, 5, 'paused') + tdSql.execute("insert into stb_0(ts,col2) values(now, 3232)") + tdSql.query("select * from so1") + tdSql.checkRows(5) + + tdSql.error("resume stream s1") + + def consumeTest(self): + consumer_dict = { + "group.id": "g1", + "td.connect.user": self.user_name, + "td.connect.pass": "test", + "auto.offset.reset": "earliest" + } + consumer = Consumer(consumer_dict) + + tdLog.debug("test subscribe topic created by other user") + exceptOccured = False + try: + consumer.subscribe([self.topic_name]) + except TmqError: + exceptOccured = True + + if not exceptOccured: + tdLog.exit(f"has no privilege, should except") + + self.checkUserPrivileges(1) + tdLog.debug("test subscribe topic privilege granted by other user") + tdSql.execute(f'grant subscribe on {self.topic_name} to {self.user_name}') + self.checkUserPrivileges(2) + + exceptOccured = False + try: + consumer.subscribe([self.topic_name]) + except TmqError: + exceptOccured = True + + if exceptOccured: + tdLog.exit(f"has privilege, should not except") + + cnt = 0 + try: + while True: + res = consumer.poll(1) + cnt += 1 + if cnt == 1: + if not res: + tdLog.exit(f"grant privilege, should get res") + elif cnt == 2: + if res: + tdLog.exit(f"revoke privilege, should get NULL") + else: + break + + tdLog.debug("test subscribe topic privilege revoked by other user") + tdSql.execute(f'revoke subscribe on {self.topic_name} from {self.user_name}') + self.checkUserPrivileges(1) + time.sleep(5) + + finally: + consumer.close() + + def create_user(self): + tdSql.execute(f'create topic {self.topic_name} as database {self.dbnames[0]}') + tdSql.execute(f'create user {self.user_name} pass "test"') + + def run(self): + self.prepare_data() + self.create_user() + self.consumeTest() + # self.streamTest() + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/1-insert/test_ts4479.py b/tests/system-test/1-insert/test_ts4479.py new file mode 100644 index 0000000000..be9789b5fc --- /dev/null +++ b/tests/system-test/1-insert/test_ts4479.py @@ -0,0 +1,75 @@ +import os +import sys +from util.log import * +from util.cases import * +from util.sql import * +from util.dnodes import tdDnodes +from math import inf +import taos + + +class TDTestCase: + """Verify inserting varbinary type data of ts-4479 + """ + def init(self, conn, logSql, replicaVer=1): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), True) + self.conn = conn + self.db_name = "db" + self.stable_name = "st" + + def run(self): + tdSql.execute("create database if not exists %s" % self.db_name) + tdSql.execute("use %s" % self.db_name) + # create super table + tdSql.execute("create table %s (ts timestamp, c1 varbinary(65517)) tags (t1 varbinary(16382))" % self.stable_name) + + # varbinary tag length is more than 16382 + tag = os.urandom(16383).hex() + tdSql.error("create table ct using st tags(%s);" % ('\\x' + tag)) + + # create child table with max column and tag length + child_table_list = [] + for i in range(2): + child_table_name = "ct_" + str(i+1) + child_table_list.append(child_table_name) + tag = os.urandom(16382).hex() + tdSql.execute("create table %s using st tags('%s');" % (child_table_name, '\\x' + tag)) + tdLog.info("create table %s successfully" % child_table_name) + + # varbinary column length is more than 65517 + value = os.urandom(65518).hex() + tdSql.error("insert into ct_1 values(now, '\\x%s');" % value) + + # insert data + for i in range(10): + sql = "insert into table_name values" + for j in range(5): + value = os.urandom(65517).hex() + sql += "(now+%ss, '%s')," % (str(j+1), '\\x' + value) + for child_table in child_table_list: + tdSql.execute(sql.replace("table_name", child_table)) + tdLog.info("Insert data into %s successfully" % child_table) + tdLog.info("Insert data round %s successfully" % str(i+1)) + tdSql.execute("flush database %s" % self.db_name) + + # insert \\x to varbinary column + tdSql.execute("insert into ct_1 values(now, '\\x');") + tdSql.query("select * from ct_1 where c1 = '\\x';") + tdSql.checkRows(1) + tdSql.checkData(0, 1, b'') + + # insert \\x to varbinary tag + tdSql.execute("create table ct_3 using st tags('\\x');") + tdSql.execute("insert into ct_3 values(now, '\\x45');") + tdSql.query("select * from st where t1='';") + tdSql.checkRows(1) + tdSql.checkData(0, 2, b'') + + def stop(self): + tdSql.execute("drop database if exists %s" % self.db_name) + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/system-test/2-query/mergeFileSttQuery.py b/tests/system-test/2-query/mergeFileSttQuery.py index 7d2695a760..4f15fe60f1 100644 --- a/tests/system-test/2-query/mergeFileSttQuery.py +++ b/tests/system-test/2-query/mergeFileSttQuery.py @@ -42,18 +42,38 @@ class TDTestCase: def run(self): binPath = self.getPath() - tdLog.debug("insert full data block and flush db") + tdLog.debug("insert full data block that has first time '2021-10-02 00:00:00.001' and flush db") os.system(f"{binPath} -f ./2-query/megeFileSttQuery.json") tdSql.execute("flush database db;") - tdLog.debug("insert disorder data and flush db") + + tdLog.debug("insert only a piece of data that is behind the time that already exists and flush db") + tdSql.execute("insert into db.d0 values ('2021-10-01 23:59:59.990',12.793,208,0.84) ;") + tdSql.execute("flush database db;") + tdLog.debug("check data") + sleep(1) + tdSql.query("select count(*) from db.d0;") + tdSql.checkData(0,0,10001) + tdSql.execute("drop database db;") + + + + + + tdLog.debug("insert full data block that has first time '2021-10-02 00:00:00.001' and flush db") + os.system(f"{binPath} -f ./2-query/megeFileSttQuery.json") + tdSql.execute("flush database db;") + + tdLog.debug("insert four pieces of disorder data, and the time range covers the data file that was previously placed on disk and flush db") os.system(f"{binPath} -f ./2-query/megeFileSttQueryUpdate.json") tdSql.execute("flush database db;") tdLog.debug("check data") + tdSql.query("select count(*) from db.d0;",queryTimes=3) + tdSql.checkData(0,0,10004) tdSql.query("select ts from db.d0 limit 5;") tdSql.checkData(0, 0, '2021-10-02 00:00:00.001') tdSql.checkData(1, 0, '2021-10-02 00:01:00.000') - tdLog.debug("update disorder data and flush db") + tdLog.debug("update the same disorder data and flush db") os.system(f"{binPath} -f ./2-query/megeFileSttQueryUpdate.json") tdSql.query("select ts from db.d0 limit 5;") tdSql.checkData(0, 0, '2021-10-02 00:00:00.001') diff --git a/tests/system-test/2-query/test_td28163.py b/tests/system-test/2-query/test_td28163.py new file mode 100644 index 0000000000..df727f6c5a --- /dev/null +++ b/tests/system-test/2-query/test_td28163.py @@ -0,0 +1,265 @@ +import random +import itertools +from util.log import * +from util.cases import * +from util.sql import * +from util.sqlset import * +from util import constant +from util.common import * + + +class TDTestCase: + """Verify the jira TD-28163 + """ + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def prepareData(self): + # db + tdSql.execute("create database if not exists db") + tdSql.execute("use db") + + # super table + tdSql.execute("create stable st(ts timestamp, c_ts_empty timestamp, c_int int, c_int_empty int, c_unsigned_int int unsigned, \ + c_unsigned_int_empty int unsigned, c_bigint bigint, c_bigint_empty bigint, c_unsigned_bigint bigint unsigned, \ + c_unsigned_bigint_empty bigint unsigned, c_float float, c_float_empty float, c_double double, c_double_empty double, \ + c_binary binary(16), c_binary_empty binary(16), c_smallint smallint, c_smallint_empty smallint, \ + c_smallint_unsigned smallint unsigned, c_smallint_unsigned_empty smallint unsigned, c_tinyint tinyint, \ + c_tinyint_empty tinyint, c_tinyint_unsigned tinyint unsigned, c_tinyint_unsigned_empty tinyint unsigned, \ + c_bool bool, c_bool_empty bool, c_nchar nchar(16), c_nchar_empty nchar(16), c_varchar varchar(16), \ + c_varchar_empty varchar(16), c_varbinary varbinary(16), c_varbinary_empty varbinary(16)) \ + tags(t_timestamp timestamp, t_timestamp_empty timestamp, t_int int, t_int_empty int, \ + t_unsigned_int int unsigned, t_unsigned_int_empty int unsigned, t_bigint bigint, t_bigint_empty bigint, \ + t_unsigned_bigint bigint unsigned, t_unsigned_bigint_empty bigint unsigned, t_float float, t_float_empty float, \ + t_double double, t_double_empty double, t_binary binary(16), t_binary_empty binary(16), t_smallint smallint, \ + t_smallint_empty smallint, t_smallint_unsigned smallint unsigned, t_smallint_unsigned_empty smallint unsigned, \ + t_tinyint tinyint, t_tinyint_empty tinyint, t_tinyint_unsigned tinyint unsigned, t_tinyint_unsigned_empty tinyint unsigned, \ + t_bool bool, t_bool_empty bool, t_nchar nchar(16), t_nchar_empty nchar(16), t_varchar varchar(16), \ + t_varchar_empty varchar(16), t_varbinary varbinary(16), t_varbinary_empty varbinary(16));") + + # child tables + start_ts = 1704085200000 + tags = [ + "'2024-01-01 13:00:01', null, 1, null, 1, null, 1111111111111111, null, 1111111111111111, null, 1.1, null, 1.11, null, 'aaaaaaaa', '', 1, null, 1, null, 1, null, 1, null, True, null, 'ncharaa', null, 'varcharaa', null, '0x7661726331', null", + "'2024-01-01 13:00:02', null, 2, null, 2, null, 2222222222222222, null, 2222222222222222, null, 2.2, null, 2.22, null, 'bbbbbbbb', '', 2, null, 2, null, 2, null, 2, null, False, null, 'ncharbb', null, 'varcharbb', null, '0x7661726332', null", + "'2024-01-01 13:00:03', null, 3, null, 3, null, 3333333333333333, null, 3333333333333333, null, 3.3, null, 3.33, null, 'cccccccc', '', 3, null, 3, null, 3, null, 3, null, True, null, 'ncharcc', null, 'varcharcc', null, '0x7661726333', null", + "'2024-01-01 13:00:04', null, 4, null, 4, null, 4444444444444444, null, 4444444444444444, null, 4.4, null, 4.44, null, 'dddddddd', '', 4, null, 4, null, 4, null, 4, null, False, null, 'nchardd', null, 'varchardd', null, '0x7661726334', null", + "'2024-01-01 13:00:05', null, 5, null, 5, null, 5555555555555555, null, 5555555555555555, null, 5.5, null, 5.55, null, 'eeeeeeee', '', 5, null, 5, null, 5, null, 5, null, True, null, 'ncharee', null, 'varcharee', null, '0x7661726335', null", + ] + for i in range(5): + tdSql.execute(f"create table ct{i+1} using st tags({tags[i]});") + + # insert data + data = "null, 1, null, 1, null, 1111111111111111, null, 1111111111111111, null, 1.1, null, 1.11, null, 'aaaaaaaa', null, 1, null, 1, null, 1, null, 1, null, True, null, 'ncharaa', null, 'varcharaa', null, '0x7661726331', null" + for round in range(100): + sql = f"insert into ct{i+1} values" + for j in range(100): + sql += f"({start_ts + (round * 100 + j + 1) * 1000}, {data})" + sql += ";" + tdSql.execute(sql) + tdLog.debug("Prepare data successfully") + + def test_query_with_filter(self): + # total row number + tdSql.query("select count(*) from st;") + total_rows = tdSql.queryResult[0][0] + tdLog.debug("Total row number is %s" % total_rows) + + # start_ts and end_ts + tdSql.query("select first(ts), last(ts) from st;") + start_ts = tdSql.queryResult[0][0] + end_ts = tdSql.queryResult[0][1] + tdLog.debug("start_ts is %s, end_ts is %s" % (start_ts, end_ts)) + + filter_dic = { + "all_filter_list": ["ts <= now", "t_timestamp <= now", f"ts between '{start_ts}' and '{end_ts}'", + f"t_timestamp between '{start_ts}' and '{end_ts}'", "c_ts_empty is null", + "t_timestamp_empty is null", "ts > '1970-01-01 00:00:00'", "t_int in (1, 2, 3, 4, 5)", + "c_int=1", "c_int_empty is null", "c_unsigned_int=1", "c_unsigned_int_empty is null", + "c_unsigned_int in (1, 2, 3, 4, 5)", "c_unsigned_int_empty is null", "c_bigint=1111111111111111", + "c_bigint_empty is null", "c_unsigned_bigint in (1111111111111111)", "c_unsigned_bigint_empty is null", + "c_float=1.1", "c_float_empty is null", "c_double=1.11", "c_double_empty is null", "c_binary='aaaaaaaa'", + "c_binary_empty is null", "c_smallint=1", "c_smallint_empty is null", "c_smallint_unsigned=1", + "c_smallint_unsigned_empty is null", "c_tinyint=1", "c_tinyint_empty is null", "c_tinyint_unsigned=1", + "c_tinyint_unsigned_empty is null", "c_bool=True", "c_bool_empty is null", "c_nchar='ncharaa'", + "c_nchar_empty is null", "c_varchar='varcharaa'", "c_varchar_empty is null", "c_varbinary='0x7661726331'", + "c_varbinary_empty is null"], + "empty_filter_list": ["ts > now", "t_timestamp > now", "c_ts_empty is not null","t_timestamp_empty is not null", + "ts <= '1970-01-01 00:00:00'", "c_ts_empty < '1970-01-01 00:00:00'", "c_int <> 1", "c_int_empty is not null", + "t_int in (10, 11)", "t_int_empty is not null"] + } + for filter in filter_dic["all_filter_list"]: + tdLog.debug("Execute query with filter '%s'" % filter) + tdSql.query(f"select * from st where {filter};") + tdSql.checkRows(total_rows) + + for filter in filter_dic["empty_filter_list"]: + tdLog.debug("Execute query with filter '%s'" % filter) + tdSql.query(f"select * from st where {filter};") + tdSql.checkRows(0) + + def test_query_with_groupby(self): + tdSql.query("select count(*) from st group by tbname;") + tdSql.checkRows(5) + tdSql.checkData(0, 0, 10000) + + tdSql.query("select count(c_unsigned_int_empty + c_int_empty * c_float_empty - c_double_empty + c_smallint_empty / c_tinyint_empty) from st where c_int_empty is null group by tbname;") + tdSql.checkRows(5) + tdSql.checkData(0, 0, 0) + + tdSql.query("select sum(t_unsigned_int_empty + t_int_empty * t_float_empty - t_double_empty + t_smallint_empty / t_tinyint_empty) from st where t_int_empty is null group by tbname;") + tdSql.checkRows(5) + tdSql.checkData(0, 0, None) + + tdSql.query("select max(c_bigint_empty) from st group by tbname, t_bigint_empty, t_float_empty, t_double_empty;") + tdSql.checkRows(5) + tdSql.checkData(0, 0, None) + + tdSql.query("select min(t_double) as v from st where c_nchar like '%aa%' and t_double is not null group by tbname, t_bigint_empty, t_float_empty, t_double_empty order by v limit 1;") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1.11) + + tdSql.query("select top(c_float, 1) as v from st where c_nchar like '%aa%' group by tbname order by v desc slimit 1 limit 1;") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1.1) + + tdSql.query("select first(ts) from st where c_varchar is not null partition by tbname order by ts slimit 1;") + tdSql.checkRows(5) + tdSql.checkData(0, 0, '2024-01-01 13:00:01.000') + + tdSql.query("select first(c_nchar_empty) from st group by tbname;") + tdSql.checkRows(0) + + tdSql.query("select first(ts), first(c_nchar_empty) from st group by tbname, ts order by ts slimit 1 limit 1;") + tdSql.checkRows(1) + tdSql.checkData(0, 0, '2024-01-01 13:00:01.000') + tdSql.checkData(0, 1, None) + + tdSql.query("select first(c_nchar_empty) from st group by t_timestamp_empty order by t_timestamp;") + tdSql.checkRows(0) + + tdSql.query("select last(ts), last(c_nchar_empty) from st group by tbname, ts order by ts slimit 1 limit 1;") + tdSql.checkRows(1) + tdSql.checkData(0, 0, '2024-01-01 13:00:01.000') + tdSql.checkData(0, 1, None) + + tdSql.query("select elapsed(ts, 1s) t from st where c_int = 1 and c_nchar like '%aa%' group by tbname order by t desc slimit 1 limit 1;") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 9999) + + tdSql.query("select elapsed(ts, 1s) t from st where c_int_empty is not null and c_nchar like '%aa%' group by tbname order by t desc slimit 1 limit 1;") + tdSql.checkRows(0) + + def test_query_with_join(self): + tdSql.query("select count(*) from st as t1 join st as t2 on t1.ts = t2.ts and t1.c_float_empty is not null;") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + + tdSql.query("select count(t1.c_ts_empty) as v from st as t1 join st as t2 on t1.ts = t2.ts and t1.c_float_empty is null order by v desc;") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + + tdSql.query("select avg(t1.c_tinyint), sum(t2.c_bigint) from st t1, st t2 where t1.ts=t2.ts and t1.c_int > t2.c_int;") + tdSql.checkRows(0) + + tdSql.query("select avg(t1.c_tinyint), sum(t2.c_bigint) from st t1, st t2 where t1.ts=t2.ts and t1.c_int <= t2.c_int;") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1) + tdSql.checkData(0, 1, 1076616672134475760) + + tdSql.query("select count(t1.c_float_empty) from st t1, st t2 where t1.ts=t2.ts and t1.c_int = t2.c_int and t1.t_int_empty=t2.t_int_empty;") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + + def test_query_with_window(self): + # time window + tdSql.query("select sum(c_int_empty) from st where ts > '2024-01-01 00:00:00.000' and ts <= '2024-01-01 14:00:00.000' interval(5m) sliding(1m) fill(value, 10);") + tdSql.checkRows(841) + tdSql.checkData(0, 0, 10) + + tdSql.query("select _wstart, _wend, sum(c_int) from st where ts > '2024-01-01 00:00:00.000' and ts <= '2024-01-01 14:00:00.000' interval(5m) sliding(1m);") + tdSql.checkRows(65) + + # status window + tdSql.error("select _wstart, count(*) from st state_window(t_bool);") + tdSql.query("select _wstart, count(*) from st partition by tbname state_window(c_bool);") + tdSql.checkRows(5) + tdSql.checkData(0, 1, 10000) + + # session window + tdSql.query("select _wstart, count(*) from st partition by tbname, t_int session(ts, 1m);") + tdSql.checkRows(5) + tdSql.checkData(0, 1, 10000) + + # event window + tdSql.query("select _wstart, _wend, count(*) from (select * from st order by ts, tbname) event_window start with t_bool=true end with t_bool=false;") + tdSql.checkRows(20000) + + def test_query_with_union(self): + tdSql.query("select count(ts) from (select * from ct1 union select * from ct2 union select * from ct3);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 10000) + + tdSql.query("select count(ts) from (select * from ct1 union all select * from ct2 union all select * from ct3);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 30000) + + tdSql.query("select count(*) from (select * from ct1 union select * from ct2 union select * from ct3);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 10000) + + tdSql.query("select count(c_ts_empty) from (select * from ct1 union select * from ct2 union select * from ct3);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0) + + tdSql.query("select count(*) from (select ts from st union select c_ts_empty from st);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 10001) + + tdSql.query("select count(*) from (select ts from st union all select c_ts_empty from st);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 100000) + + tdSql.query("select count(ts) from (select ts from st union select c_ts_empty from st);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 10000) + + tdSql.query("select count(ts) from (select ts from st union all select c_ts_empty from st);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 50000) + + def test_nested_query(self): + tdSql.query("select elapsed(ts, 1s) from (select * from (select * from st where c_int = 1) where c_int_empty is null);") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 9999) + + tdSql.query("select first(ts) as t, avg(c_int) as v from (select * from (select * from st where c_int = 1) where c_int_empty is null) group by t_timestamp order by t_timestamp desc slimit 1 limit 1;") + tdSql.checkRows(1) + tdSql.checkData(0, 0, '2024-01-01 13:00:01.000') + tdSql.checkData(0, 1, 1) + + tdSql.query("select max(c_tinyint) from (select c_tinyint, tbname from st where c_float_empty is null or t_int_empty is null) group by tbname order by c_tinyint desc slimit 1 limit 1;") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1) + + tdSql.query("select top(c_int, 3) from (select c_int, tbname from st where t_int in (2, 3)) group by tbname slimit 3;") + tdSql.checkRows(6) + tdSql.checkData(0, 0, 1) + + def run(self): + self.prepareData() + self.test_query_with_filter() + self.test_query_with_groupby() + self.test_query_with_join() + self.test_query_with_window() + self.test_query_with_union() + self.test_nested_query() + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/system-test/7-tmq/tmqDropConsumer.py b/tests/system-test/7-tmq/tmqDropConsumer.py index 5208d14069..953e9314f1 100644 --- a/tests/system-test/7-tmq/tmqDropConsumer.py +++ b/tests/system-test/7-tmq/tmqDropConsumer.py @@ -12,7 +12,8 @@ sys.path.append("./7-tmq") from tmqCommon import * class TDTestCase: - # updatecfgDict = {'debugFlag': 135} + clientCfgDict = {'debugFlag': 135} + updatecfgDict = {'debugFlag': 135, 'clientCfg':clientCfgDict} def __init__(self): self.vgroups = 2 diff --git a/tests/system-test/7-tmq/tmqParamsTest.py b/tests/system-test/7-tmq/tmqParamsTest.py index 0e9e8f989f..82a5d42b47 100644 --- a/tests/system-test/7-tmq/tmqParamsTest.py +++ b/tests/system-test/7-tmq/tmqParamsTest.py @@ -11,7 +11,9 @@ sys.path.append("./7-tmq") from tmqCommon import * class TDTestCase: - updatecfgDict = {'debugFlag': 135} + clientCfgDict = {'debugFlag': 135} + updatecfgDict = {'debugFlag': 135, 'clientCfg':clientCfgDict} + def init(self, conn, logSql, replicaVar=1): self.replicaVar = int(replicaVar) tdLog.debug(f"start to excute {__file__}") @@ -131,13 +133,17 @@ class TDTestCase: if snapshot_value == "true": if offset_value != "earliest" and offset_value != "": if offset_value == "latest": - offset_value_list = list(map(lambda x: int(x[-2].replace("wal:", "").replace("earliest", "0").replace("latest", "0").replace(offset_value, "0")), subscription_info)) - tdSql.checkEqual(sum(offset_value_list) >= 0, True) + offset_value_list = list(map(lambda x: (x[-2].replace("wal:", "").replace("earliest", "0").replace("latest", "0").replace(offset_value, "0")), subscription_info)) + offset_value_list1 = list(map(lambda x: int(x.split("/")[0]), offset_value_list)) + offset_value_list2 = list(map(lambda x: int(x.split("/")[1]), offset_value_list)) + tdSql.checkEqual(offset_value_list1 == offset_value_list2, True) + tdSql.checkEqual(sum(offset_value_list1) >= 0, True) rows_value_list = list(map(lambda x: int(x[-1]), subscription_info)) tdSql.checkEqual(sum(rows_value_list), expected_res) elif offset_value == "none": offset_value_list = list(map(lambda x: x[-2], subscription_info)) - tdSql.checkEqual(offset_value_list, ['none']*len(subscription_info)) + offset_value_list1 = list(map(lambda x: (x.split("/")[0]), offset_value_list)) + tdSql.checkEqual(offset_value_list1, ['none']*len(subscription_info)) rows_value_list = list(map(lambda x: x[-1], subscription_info)) tdSql.checkEqual(rows_value_list, [0]*len(subscription_info)) else: @@ -149,18 +155,23 @@ class TDTestCase: # tdSql.checkEqual(sum(rows_value_list), expected_res) else: offset_value_list = list(map(lambda x: x[-2], subscription_info)) - tdSql.checkEqual(offset_value_list, [None]*len(subscription_info)) + offset_value_list1 = list(map(lambda x: (x.split("/")[0]), offset_value_list)) + tdSql.checkEqual(offset_value_list1, [None]*len(subscription_info)) rows_value_list = list(map(lambda x: x[-1], subscription_info)) tdSql.checkEqual(rows_value_list, [None]*len(subscription_info)) else: if offset_value != "none": - offset_value_list = list(map(lambda x: int(x[-2].replace("wal:", "").replace("earliest", "0").replace("latest", "0").replace(offset_value, "0")), subscription_info)) - tdSql.checkEqual(sum(offset_value_list) >= 0, True) + offset_value_list = list(map(lambda x: (x[-2].replace("wal:", "").replace("earliest", "0").replace("latest", "0").replace(offset_value, "0")), subscription_info)) + offset_value_list1 = list(map(lambda x: int(x.split("/")[0]), offset_value_list)) + offset_value_list2 = list(map(lambda x: int(x.split("/")[1]), offset_value_list)) + tdSql.checkEqual(offset_value_list1 == offset_value_list2, True) + tdSql.checkEqual(sum(offset_value_list1) >= 0, True) rows_value_list = list(map(lambda x: int(x[-1]), subscription_info)) tdSql.checkEqual(sum(rows_value_list), expected_res) else: offset_value_list = list(map(lambda x: x[-2], subscription_info)) - tdSql.checkEqual(offset_value_list, ['none']*len(subscription_info)) + offset_value_list1 = list(map(lambda x: (x.split("/")[0]), offset_value_list)) + tdSql.checkEqual(offset_value_list1, ['none']*len(subscription_info)) rows_value_list = list(map(lambda x: x[-1], subscription_info)) tdSql.checkEqual(rows_value_list, [0]*len(subscription_info)) tdSql.execute(f"drop topic if exists {topic_name}") diff --git a/tests/system-test/7-tmq/tmqVnodeTransform.py b/tests/system-test/7-tmq/tmqVnodeTransform.py index 811b72c35f..c2b002ead6 100644 --- a/tests/system-test/7-tmq/tmqVnodeTransform.py +++ b/tests/system-test/7-tmq/tmqVnodeTransform.py @@ -186,7 +186,7 @@ class TDTestCase: tmqCom.getStartCommitNotifyFromTmqsim() #restart dnode & remove wal - # self.restartAndRemoveWal() + self.restartAndRemoveWal() # redistribute vgroup self.redistributeVgroups(); @@ -235,7 +235,7 @@ class TDTestCase: tdSql.execute(sqlString) tdSql.query("flush database %s"%(paraDict['dbName'])) #restart dnode & remove wal - # self.restartAndRemoveWal() + self.restartAndRemoveWal() # redistribute vgroup self.redistributeVgroups(); @@ -313,7 +313,7 @@ class TDTestCase: time.sleep(5) #restart dnode & remove wal - # self.restartAndRemoveWal() + self.restartAndRemoveWal() # redistribute vgroup self.redistributeVgroups() diff --git a/tests/system-test/7-tmq/tmq_taosx.py b/tests/system-test/7-tmq/tmq_taosx.py index 86c40fdc72..5bd70a5d60 100644 --- a/tests/system-test/7-tmq/tmq_taosx.py +++ b/tests/system-test/7-tmq/tmq_taosx.py @@ -11,6 +11,7 @@ from util.sql import * from util.cases import * from util.dnodes import * from util.common import * +from taos.tmq import * sys.path.append("./7-tmq") from tmqCommon import * @@ -310,6 +311,43 @@ class TDTestCase: return + def consumeExcluded(self): + tdSql.execute(f'create topic topic_excluded as database db_taosx') + consumer_dict = { + "group.id": "g1", + "td.connect.user": "root", + "td.connect.pass": "taosdata", + "auto.offset.reset": "earliest", + "msg.consume.excluded": 1 + } + consumer = Consumer(consumer_dict) + + tdLog.debug("test subscribe topic created by other user") + exceptOccured = False + try: + consumer.subscribe(["topic_excluded"]) + except TmqError: + exceptOccured = True + + if exceptOccured: + tdLog.exit(f"subscribe error") + + try: + while True: + res = consumer.poll(1) + if not res: + break + err = res.error() + if err is not None: + raise err + val = res.value() + + for block in val: + print(block.fetchall()) + + finally: + consumer.close() + def run(self): tdSql.prepare() self.checkWal1VgroupOnlyMeta() @@ -324,6 +362,8 @@ class TDTestCase: self.checkSnapshotMultiVgroups() self.checkWalMultiVgroupsWithDropTable() + # self.consumeExcluded() + self.checkSnapshotMultiVgroupsWithDropTable() def stop(self): diff --git a/tests/system-test/8-stream/max_delay_session.py b/tests/system-test/8-stream/max_delay_session.py index 7e9d365fc8..934fbbcac2 100644 --- a/tests/system-test/8-stream/max_delay_session.py +++ b/tests/system-test/8-stream/max_delay_session.py @@ -58,8 +58,8 @@ class TDTestCase: tdSql.query(f'select wstart, {self.tdCom.stb_output_select_str} from {tbname}') else: tdSql.query(f'select wstart, {self.tdCom.tb_output_select_str} from {tbname}') - if not fill_history_value: - tdSql.checkEqual(tdSql.queryRows, init_num) + # if not fill_history_value: + # tdSql.checkEqual(tdSql.queryRows, init_num) self.tdCom.sinsert_rows(tbname=self.ctb_name, ts_value=window_close_ts) self.tdCom.sinsert_rows(tbname=self.tb_name, ts_value=window_close_ts) diff --git a/tests/system-test/8-stream/stream_multi_agg.py b/tests/system-test/8-stream/stream_multi_agg.py new file mode 100644 index 0000000000..3532825493 --- /dev/null +++ b/tests/system-test/8-stream/stream_multi_agg.py @@ -0,0 +1,100 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + + +from util.log import * +from util.cases import * +from util.sql import * +from util.common import * +from util.sqlset import * +from util.autogen import * + +import random +import time +import traceback +import os +from os import path + + +class TDTestCase: + updatecfgDict = {'debugFlag': 135, 'asynclog': 0, 'streamAggCnt': 2} + # init + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), True) + + def case1(self): + tdLog.debug("========case1 start========") + + os.system("nohup taosBenchmark -y -B 1 -t 40 -S 1000 -n 10 -i 1000 -v 5 > /dev/null 2>&1 &") + time.sleep(10) + tdSql.query("use test") + tdSql.query("create stream if not exists s1 trigger at_once ignore expired 0 ignore update 0 fill_history 1 into st1 as select _wstart,sum(voltage),groupid from meters partition by groupid interval(2s)") + tdLog.debug("========create stream and insert data ok========") + time.sleep(15) + + tdSql.query("select _wstart,sum(voltage),groupid from meters partition by groupid interval(2s) order by groupid,_wstart") + rowCnt = tdSql.getRows() + results = [] + for i in range(rowCnt): + results.append(tdSql.getData(i,1)) + + tdSql.query("select * from st1 order by groupid,_wstart") + tdSql.checkRows(rowCnt) + for i in range(rowCnt): + data1 = tdSql.getData(i,1) + data2 = results[i] + if data1 != data2: + tdLog.info("num: %d, act data: %d, expect data: %d"%(i, data1, data2)) + tdLog.exit("check data error!") + + tdLog.debug("case1 end") + + def case2(self): + tdLog.debug("========case2 start========") + + os.system("taosBenchmark -d db -t 20 -v 6 -n 1000 -y > /dev/null 2>&1") + # create stream + tdSql.execute("use db") + tdSql.execute("create stream stream1 fill_history 1 into sta as select count(*) as cnt from meters interval(10a);",show=True) + time.sleep(5) + + sql = "select count(*) from sta" + # loop wait max 60s to check count is ok + tdLog.info("loop wait result ...") + tdSql.checkDataLoop(0, 0, 100, sql, loopCount=10, waitTime=0.5) + + # check all data is correct + sql = "select * from sta where cnt != 200;" + tdSql.query(sql) + tdSql.checkRows(0) + + # check ts interval is correct + sql = "select * from ( select diff(_wstart) as tsdif from sta ) where tsdif != 10;" + tdSql.query(sql) + tdSql.checkRows(0) + tdLog.debug("case2 end") + +# run + def run(self): + self.case1() + self.case2() + + # stop + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/test.py b/tests/system-test/test.py index 795132b14e..301622cd28 100644 --- a/tests/system-test/test.py +++ b/tests/system-test/test.py @@ -683,6 +683,6 @@ if __name__ == "__main__": if conn is not None: conn.close() if asan: - tdDnodes.StopAllSigint() + # tdDnodes.StopAllSigint() tdLog.info("Address sanitizer mode finished") sys.exit(0) diff --git a/tests/unit-test/test.sh b/tests/unit-test/test.sh index 292767e00c..71f5189551 100755 --- a/tests/unit-test/test.sh +++ b/tests/unit-test/test.sh @@ -40,7 +40,7 @@ pgrep taosd || taosd >> /dev/null 2>&1 & sleep 10 -ctest -E "smlTest|funcTest|profileTest|sdbTest|showTest|geomTest|idxFstUtilUT|idxTest|idxUtilUT|idxFstUT|parserTest|plannerTest|transUT|transUtilUt" -j8 +ctest -j8 ret=$? exit $ret diff --git a/tools/shell/src/shellArguments.c b/tools/shell/src/shellArguments.c index 71fa777d63..434b5e4b61 100644 --- a/tools/shell/src/shellArguments.c +++ b/tools/shell/src/shellArguments.c @@ -244,7 +244,7 @@ static int32_t shellParseSingleOpt(int32_t key, char *arg) { } return 0; } - +#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32) || defined(_TD_DARWIN_64) int32_t shellParseArgsWithoutArgp(int argc, char *argv[]) { SShellArgs *pArgs = &shell.args; @@ -302,6 +302,7 @@ int32_t shellParseArgsWithoutArgp(int argc, char *argv[]) { return 0; } +#endif static void shellInitArgs(int argc, char *argv[]) { for (int i = 1; i < argc; i++) { diff --git a/tools/shell/src/shellMain.c b/tools/shell/src/shellMain.c index 18f4ca21d1..d3ca60ab87 100644 --- a/tools/shell/src/shellMain.c +++ b/tools/shell/src/shellMain.c @@ -28,7 +28,7 @@ void shellCrashHandler(int signum, void *sigInfo, void *context) { #if !defined(WINDOWS) taosIgnSignal(SIGBUS); -#endif +#endif taosIgnSignal(SIGABRT); taosIgnSignal(SIGFPE); taosIgnSignal(SIGSEGV); @@ -82,7 +82,9 @@ int main(int argc, char *argv[]) { #ifdef WEBSOCKET shellCheckConnectMode(); #endif - taos_init(); + if (taos_init() != 0) { + return -1; + } // kill heart-beat thread when quit taos_set_hb_quit(1); @@ -105,7 +107,7 @@ int main(int argc, char *argv[]) { return 0; } - // support port feature + // support port feature shellAutoInit(); int32_t ret = shellExecute(); shellAutoExit(); diff --git a/utils/TSZ/sz/src/sz_double.c b/utils/TSZ/sz/src/sz_double.c index 1adfdf3b56..0510fc612d 100644 --- a/utils/TSZ/sz/src/sz_double.c +++ b/utils/TSZ/sz/src/sz_double.c @@ -385,9 +385,11 @@ unsigned int optimize_intervals_double_1D_opt(double *oriData, size_t dataLength totalSampleSize++; pred_value = data_pos[-1]; pred_err = fabs(pred_value - *data_pos); - radiusIndex = (unsigned long)((pred_err/realPrecision+1)/2); - if(radiusIndex>=confparams_cpr->maxRangeRadius) - radiusIndex = confparams_cpr->maxRangeRadius - 1; + double dbri = (unsigned long)((pred_err/realPrecision+1)/2); + if(dbri >= (double)confparams_cpr->maxRangeRadius) + radiusIndex = confparams_cpr->maxRangeRadius - 1; + else + radiusIndex = dbri; intervals[radiusIndex]++; data_pos += confparams_cpr->sampleDistance; diff --git a/utils/test/c/tmq_taosx_ci.c b/utils/test/c/tmq_taosx_ci.c index 8a7074844a..056b7dc6cf 100644 --- a/utils/test/c/tmq_taosx_ci.c +++ b/utils/test/c/tmq_taosx_ci.c @@ -909,6 +909,88 @@ void initLogFile() { taosCloseFile(&pFile2); } +void testConsumeExcluded(int topic_type){ + TAOS* pConn = use_db(); + TAOS_RES *pRes = NULL; + + if(topic_type == 1){ + char *topic = "create topic topic_excluded with meta as database db_taosx"; + pRes = taos_query(pConn, topic); + if (taos_errno(pRes) != 0) { + printf("failed to create topic topic_excluded, reason:%s\n", taos_errstr(pRes)); + taos_close(pConn); + return; + } + taos_free_result(pRes); + }else if(topic_type == 2){ + char *topic = "create topic topic_excluded as select * from stt"; + pRes = taos_query(pConn, topic); + if (taos_errno(pRes) != 0) { + printf("failed to create topic topic_excluded, reason:%s\n", taos_errstr(pRes)); + taos_close(pConn); + return; + } + taos_free_result(pRes); + } + taos_close(pConn); + + tmq_conf_t* conf = tmq_conf_new(); + tmq_conf_set(conf, "group.id", "tg2"); + tmq_conf_set(conf, "client.id", "my app 1"); + tmq_conf_set(conf, "td.connect.user", "root"); + tmq_conf_set(conf, "td.connect.pass", "taosdata"); + tmq_conf_set(conf, "msg.with.table.name", "true"); + tmq_conf_set(conf, "enable.auto.commit", "true"); + tmq_conf_set(conf, "auto.offset.reset", "earliest"); + tmq_conf_set(conf, "msg.consume.excluded", "1"); + + + tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL); + tmq_t* tmq = tmq_consumer_new(conf, NULL, 0); + assert(tmq); + tmq_conf_destroy(conf); + + tmq_list_t* topic_list = tmq_list_new(); + tmq_list_append(topic_list, "topic_excluded"); + + int32_t code = 0; + + if ((code = tmq_subscribe(tmq, topic_list))) { + fprintf(stderr, "%% Failed to start consuming topics: %s\n", tmq_err2str(code)); + printf("subscribe err\n"); + return; + } + while (running) { + TAOS_RES* msg = tmq_consumer_poll(tmq, 1000); + if (msg) { + tmq_raw_data raw = {0}; + tmq_get_raw(msg, &raw); + if(topic_type == 1){ + assert(raw.raw_type != 2 && raw.raw_type != 4); + }else if(topic_type == 2){ + assert(0); + } +// printf("write raw data type: %d\n", raw.raw_type); + tmq_free_raw(raw); + + taos_free_result(msg); + } else { + break; + } + } + + tmq_consumer_close(tmq); + tmq_list_destroy(topic_list); + + pConn = use_db(); + pRes = taos_query(pConn, "drop topic if exists topic_excluded"); + if (taos_errno(pRes) != 0) { + printf("error in drop topic, reason:%s\n", taos_errstr(pRes)); + taos_close(pConn); + return; + } + taos_free_result(pRes); +} int main(int argc, char* argv[]) { for (int32_t i = 1; i < argc; i++) { if (strcmp(argv[i], "-c") == 0) { @@ -942,5 +1024,8 @@ int main(int argc, char* argv[]) { tmq_list_t* topic_list = build_topic_list(); basic_consume_loop(tmq, topic_list); tmq_list_destroy(topic_list); + + testConsumeExcluded(1); + testConsumeExcluded(2); taosCloseFile(&g_fp); } diff --git a/utils/test/c/varbinary_test.c b/utils/test/c/varbinary_test.c index 522a820fe8..47bacf629b 100644 --- a/utils/test/c/varbinary_test.c +++ b/utils/test/c/varbinary_test.c @@ -85,7 +85,6 @@ void varbinary_sql_test() { // test insert pRes = taos_query(taos, "insert into tb2 using stb tags (2, 'tb2_bin1', 093) values (now + 2s, 'nchar1', 892, 0.3)"); - printf("error:%s", taos_errstr(pRes)); ASSERT(taos_errno(pRes) != 0); pRes = taos_query(taos, "insert into tb3 using stb tags (3, 'tb3_bin1', 0x7f829) values (now + 3s, 'nchar1', 0x7f829, 0.3)"); @@ -322,6 +321,60 @@ void varbinary_sql_test() { printf("%s result %s\n", __FUNCTION__, taos_errstr(pRes)); taos_free_result(pRes); + // test insert string value '\x' + pRes = taos_query(taos, "insert into tb5 using stb tags (5, 'tb5_bin1', '\\\\xg') values (now + 4s, 'nchar1', '\\\\xg', 0.3)"); + taos_free_result(pRes); + + pRes = taos_query(taos, "select c2,t3 from stb where t3 = '\\x5C7867'"); + while ((row = taos_fetch_row(pRes)) != NULL) { + int32_t* length = taos_fetch_lengths(pRes); + void* data = NULL; + uint32_t size = 0; + if(taosAscii2Hex(row[0], length[0], &data, &size) < 0){ + ASSERT(0); + } + + ASSERT(memcmp(data, "\\x5C7867", size) == 0); + taosMemoryFree(data); + + if(taosAscii2Hex(row[1], length[1], &data, &size) < 0){ + ASSERT(0); + } + + ASSERT(memcmp(data, "\\x5C7867", size) == 0); + taosMemoryFree(data); + } + taos_free_result(pRes); + + // test insert + char tmp [65517*2+3] = {0}; + tmp[0] = '\\'; + tmp[1] = 'x'; + memset(tmp + 2, 48, 65517*2); + + char sql[65517*2+3 + 256] = {0}; + + pRes = taos_query(taos, "create stable stb1 (ts timestamp, c2 varbinary(65517)) tags (t1 int, t2 binary(8), t3 varbinary(8))"); + taos_free_result(pRes); + + sprintf(sql, "insert into tb6 using stb1 tags (6, 'tb6_bin1', '\\\\xg') values (now + 4s, '%s')", tmp); + pRes = taos_query(taos, sql); + taos_free_result(pRes); + + pRes = taos_query(taos, "select c2 from tb6"); + while ((row = taos_fetch_row(pRes)) != NULL) { + int32_t* length = taos_fetch_lengths(pRes); + void* data = NULL; + uint32_t size = 0; + if(taosAscii2Hex(row[0], length[0], &data, &size) < 0){ + ASSERT(0); + } + + ASSERT(memcmp(data, tmp, size) == 0); + taosMemoryFree(data); + } + taos_free_result(pRes); + taos_close(taos); }