diff --git a/docs/zh/07-develop/07-tmq.mdx b/docs/zh/07-develop/07-tmq.mdx
index df651eab96..a852e71ff4 100644
--- a/docs/zh/07-develop/07-tmq.mdx
+++ b/docs/zh/07-develop/07-tmq.mdx
@@ -91,6 +91,7 @@ TDengine 会为 WAL 文件自动创建索引以支持快速随机访问,并提
不同语言下, TMQ 订阅相关的 API 及数据结构如下(详细的接口说明可以参考连接器章节,注意consumer结构不是线程安全的,在一个线程使用consumer时,不要在另一个线程close这个consumer):
+
```c
@@ -101,17 +102,17 @@ TDengine 会为 WAL 文件自动创建索引以支持快速随机访问,并提
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;
+ 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;
+ 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);
@@ -146,7 +147,6 @@ TDengine 会为 WAL 文件自动创建索引以支持快速随机访问,并提
DLL_EXPORT int64_t tmq_get_vgroup_offset(TAOS_RES* res);
DLL_EXPORT const char *tmq_err2str(int32_t code);
```
-
@@ -250,281 +250,280 @@ TDengine 会为 WAL 文件自动创建索引以支持快速随机访问,并提
+ futures::Stream<
Item = Result<(Self::Offset, MessageSet), Self::Error>,
>,
- >,
- >;
- async fn commit(&self, offset: Self::Offset) -> Result<(), Self::Error>;
+ >,
+ >;
+ async fn commit(&self, offset: Self::Offset) -> Result<(), Self::Error>;
- async fn unsubscribe(self);
- ```
+ async fn unsubscribe(self);
+ ```
- 可在 上查看详细 API 说明。
+ 可在 上查看详细 API 说明。
-
+
-
+
- ```js
- function TMQConsumer(config)
+ ```js
+ function TMQConsumer(config)
+
+ function subscribe(topic)
+
+ function consume(timeout)
+
+ function subscription()
+
+ function unsubscribe()
+
+ function commit(msg)
+
+ function close()
+ ```
- function subscribe(topic)
+
- function consume(timeout)
+
- function subscription()
+ ```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()
+ ```
+
+
- 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');
+```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:
+使用 SQL 创建一个 topic:
- ```sql
- CREATE TOPIC topic_name AS SELECT ts, c1, c2, c3 FROM tmqdb.stb WHERE c1 > 1;
- ```
+```sql
+CREATE TOPIC topic_name AS SELECT ts, c1, c2, c3 FROM tmqdb.stb WHERE c1 > 1;
+```
- ## 创建消费者 *consumer*
+## 创建消费者 *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
+ /* 根据需要,设置消费组 (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);
- tmq_t* tmq = tmq_consumer_new(conf, NULL, 0);
- tmq_conf_destroy(conf);
- ```
-
-
-
-
- 对于 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 | 指定字符串解析的字符集 | |
-
- 需要注意:此处使用 `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);
-
- /* value deserializer definition. */
- import com.taosdata.jdbc.tmq.ReferenceDeserializer;
-
- public class MetersDeserializer extends ReferenceDeserializer {
- }
- ```
-
-
-
-
-
- ```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)
- ```
-
-
-
-
-
- ```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()?;
- ```
-
-
-
-
-
- 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',
- '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'
- });
+ tmq_t* tmq = tmq_consumer_new(conf, NULL, 0);
+ tmq_conf_destroy(conf);
```
+
-
+
-
-
- ```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();
+ 对于 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 | 指定字符串解析的字符集 | |
+
+ 需要注意:此处使用 `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);
+
+ /* value deserializer definition. */
+ import com.taosdata.jdbc.tmq.ReferenceDeserializer;
+
+ public class MetersDeserializer extends ReferenceDeserializer {
+ }
```
+
-
+
+
+ ```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)
+ ```
+
+
-
+
+
+ ```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()?;
+ ```
+
+
- 上述配置中包括 consumer group ID,如果多个 consumer 指定的 consumer group ID 一样,则自动形成一个 consumer group,共享消费进度。
+
+
+ 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",
+ }
+ )
+ ```
+
+
- ## 订阅 *topics*
+
+
+ ```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',
+ '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'
+ });
+ ```
+
+
- 一个 consumer 支持同时订阅多个 topic。
+
+
+ ```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,共享消费进度。
+
+## 订阅 *topics*
-
-
+一个 consumer 支持同时订阅多个 topic。
+
+
-```c
+
+
+ ```c
// 创建订阅 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);
```
-
-
-
+
+
+
```go
err = consumer.Subscribe("example_tmq_topic", nil)
@@ -533,26 +532,26 @@ INSERT INTO tmqdb.ctb1 VALUES(now, 1, 1, 'a1')(now+1s, 11, 11, 'a11');
}
```
-
-
+
+
-```rust
+ ```rust
consumer.subscribe(["tmq_meters"]).await?;
```
-
+
-
+
-```python
+ ```python
consumer.subscribe(['topic1', 'topic2'])
```
-
+
-
+
-```js
+ ```js
// 创建订阅 topics 列表
let topics = ['topic_test']
@@ -560,11 +559,11 @@ INSERT INTO tmqdb.ctb1 VALUES(now, 1, 1, 'a1')(now+1s, 11, 11, 'a11');
consumer.subscribe(topics);
```
-
+
-
+
-```csharp
+ ```csharp
// 创建订阅 topics 列表
List topics = new List();
topics.add("tmq_topic");
@@ -572,18 +571,19 @@ INSERT INTO tmqdb.ctb1 VALUES(now, 1, 1, 'a1')(now+1s, 11, 11, 'a11');
consumer.Subscribe(topics);
```
-
+
-
+
- ## 消费
+## 消费
- 以下代码展示了不同语言下如何对 TMQ 消息进行消费。
+以下代码展示了不同语言下如何对 TMQ 消息进行消费。
-
-
+
-```c
+
+
+ ```c
// 消费数据
while (running) {
TAOS_RES* msg = tmq_consumer_poll(tmq, timeOut);
@@ -591,11 +591,11 @@ INSERT INTO tmqdb.ctb1 VALUES(now, 1, 1, 'a1')(now+1s, 11, 11, 'a11');
}
```
-这里是一个 **while** 循环,每调用一次 tmq_consumer_poll(),获取一个消息,该消息与普通查询返回的结果集完全相同,可以使用相同的解析 API 完成消息内容的解析。
-
-
-
+ 这里是一个 **while** 循环,每调用一次 tmq_consumer_poll(),获取一个消息,该消息与普通查询返回的结果集完全相同,可以使用相同的解析 API 完成消息内容的解析。
+
+
+
```java
while(running){
ConsumerRecords meters = consumer.poll(Duration.ofMillis(100));
@@ -604,10 +604,10 @@ INSERT INTO tmqdb.ctb1 VALUES(now, 1, 1, 'a1')(now+1s, 11, 11, 'a11');
}
}
```
+
+
-
-
-
+
```go
for {
@@ -625,9 +625,9 @@ INSERT INTO tmqdb.ctb1 VALUES(now, 1, 1, 'a1')(now+1s, 11, 11, 'a11');
}
```
-
+
-
+
```rust
{
@@ -660,8 +660,8 @@ INSERT INTO tmqdb.ctb1 VALUES(now, 1, 1, 'a1')(now+1s, 11, 11, 'a11');
}
```
-
-
+
+
```python
while True:
@@ -677,9 +677,9 @@ INSERT INTO tmqdb.ctb1 VALUES(now, 1, 1, 'a1')(now+1s, 11, 11, 'a11');
print(block.fetchall())
```
-
+
-
+
```js
while(true){
@@ -691,11 +691,11 @@ INSERT INTO tmqdb.ctb1 VALUES(now, 1, 1, 'a1')(now+1s, 11, 11, 'a11');
}
```
-
+
-
+
-```csharp
+ ```csharp
// 消费数据
while (true)
{
@@ -708,18 +708,19 @@ INSERT INTO tmqdb.ctb1 VALUES(now, 1, 1, 'a1')(now+1s, 11, 11, 'a11');
}
```
-
+
-
+
- ## 结束消费
+## 结束消费
- 消费结束后,应当取消订阅。
+消费结束后,应当取消订阅。
-
-
+
+
+
-```c
+ ```c
/* 取消订阅 */
tmq_unsubscribe(tmq);
@@ -727,10 +728,10 @@ INSERT INTO tmqdb.ctb1 VALUES(now, 1, 1, 'a1')(now+1s, 11, 11, 'a11');
tmq_consumer_close(tmq);
```
-
-
+
+
-```java
+ ```java
/* 取消订阅 */
consumer.unsubscribe();
@@ -738,11 +739,11 @@ INSERT INTO tmqdb.ctb1 VALUES(now, 1, 1, 'a1')(now+1s, 11, 11, 'a11');
consumer.close();
```
-
+
+
+
-
-
-```go
+ ```go
/* Unsubscribe */
_ = consumer.Unsubscribe()
@@ -750,38 +751,38 @@ INSERT INTO tmqdb.ctb1 VALUES(now, 1, 1, 'a1')(now+1s, 11, 11, 'a11');
_ = consumer.Close()
```
-
+
+
+
-
-
-```rust
+ ```rust
consumer.unsubscribe().await;
```
-
+
-
+
-```py
+ ```py
# 取消订阅
consumer.unsubscribe()
# 关闭消费
consumer.close()
```
-
-
+
+
-```js
+ ```js
consumer.unsubscribe();
consumer.close();
```
-
+
-
+
-```csharp
+ ```csharp
// 取消订阅
consumer.Unsubscribe();
@@ -789,7 +790,7 @@ INSERT INTO tmqdb.ctb1 VALUES(now, 1, 1, 'a1')(now+1s, 11, 11, 'a11');
consumer.Close();
```
-
+
@@ -799,41 +800,41 @@ INSERT INTO tmqdb.ctb1 VALUES(now, 1, 1, 'a1')(now+1s, 11, 11, 'a11');
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
#订阅高级功能
diff --git a/include/common/tcommon.h b/include/common/tcommon.h
index 7e7e9b0481..ccad689710 100644
--- a/include/common/tcommon.h
+++ b/include/common/tcommon.h
@@ -54,6 +54,8 @@ typedef struct SSessionKey {
uint64_t groupId;
} SSessionKey;
+typedef int64_t COUNT_TYPE;
+
typedef struct SVersionRange {
int64_t minVer;
int64_t maxVer;
diff --git a/include/common/tmsg.h b/include/common/tmsg.h
index db75d0e7d7..1257225319 100644
--- a/include/common/tmsg.h
+++ b/include/common/tmsg.h
@@ -248,6 +248,7 @@ typedef enum ENodeType {
QUERY_NODE_HINT,
QUERY_NODE_VIEW,
QUERY_NODE_WINDOW_OFFSET,
+ QUERY_NODE_COUNT_WINDOW,
// Statement nodes are used in parser and planner module.
QUERY_NODE_SET_OPERATOR = 100,
@@ -433,7 +434,9 @@ typedef enum ENodeType {
QUERY_NODE_PHYSICAL_PLAN_HASH_JOIN,
QUERY_NODE_PHYSICAL_PLAN_GROUP_CACHE,
QUERY_NODE_PHYSICAL_PLAN_DYN_QUERY_CTRL,
- QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL
+ QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT,
+ QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT,
+ QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL,
} ENodeType;
typedef struct {
@@ -1401,7 +1404,7 @@ void tFreeSCompactDbReq(SCompactDbReq* pReq);
typedef struct {
int32_t compactId;
- int8_t bAccepted;
+ int8_t bAccepted;
} SCompactDbRsp;
int32_t tSerializeSCompactDbRsp(void* buf, int32_t bufLen, SCompactDbRsp* pRsp);
@@ -1415,7 +1418,7 @@ typedef struct {
int32_t tSerializeSKillCompactReq(void* buf, int32_t bufLen, SKillCompactReq* pReq);
int32_t tDeserializeSKillCompactReq(void* buf, int32_t bufLen, SKillCompactReq* pReq);
-void tFreeSKillCompactReq(SKillCompactReq *pReq);
+void tFreeSKillCompactReq(SKillCompactReq* pReq);
typedef struct {
char name[TSDB_FUNC_NAME_LEN];
@@ -1752,9 +1755,9 @@ int32_t tSerializeSCompactVnodeReq(void* buf, int32_t bufLen, SCompactVnodeReq*
int32_t tDeserializeSCompactVnodeReq(void* buf, int32_t bufLen, SCompactVnodeReq* pReq);
typedef struct {
- int32_t compactId;
- int32_t vgId;
- int32_t dnodeId;
+ int32_t compactId;
+ int32_t vgId;
+ int32_t dnodeId;
} SVKillCompactReq;
int32_t tSerializeSVKillCompactReq(void* buf, int32_t bufLen, SVKillCompactReq* pReq);
@@ -1955,9 +1958,9 @@ typedef struct {
char db[TSDB_DB_FNAME_LEN];
char tb[TSDB_TABLE_NAME_LEN];
char user[TSDB_USER_LEN];
- char filterTb[TSDB_TABLE_NAME_LEN]; // for ins_columns
+ char filterTb[TSDB_TABLE_NAME_LEN]; // for ins_columns
int64_t showId;
- int64_t compactId; // for compact
+ int64_t compactId; // for compact
} SRetrieveTableReq;
typedef struct SSysTableSchema {
@@ -3183,18 +3186,11 @@ typedef struct {
typedef struct {
SMsgHead head;
- int64_t leftForVer;
+ int64_t resetRelHalt; // reset related stream task halt status
int64_t streamId;
int32_t taskId;
} SVDropStreamTaskReq;
-typedef struct {
- SMsgHead head;
- int64_t streamId;
- int32_t taskId;
- int64_t dataVer;
-} SVStreamTaskVerUpdateReq;
-
typedef struct {
int8_t reserved;
} SVDropStreamTaskRsp;
@@ -3785,12 +3781,12 @@ typedef struct {
} SMqHbReq;
typedef struct {
- char topic[TSDB_TOPIC_FNAME_LEN];
- int8_t noPrivilege;
+ char topic[TSDB_TOPIC_FNAME_LEN];
+ int8_t noPrivilege;
} STopicPrivilege;
typedef struct {
- SArray* topicPrivileges; // SArray
+ SArray* topicPrivileges; // SArray
} SMqHbRsp;
typedef struct {
@@ -3928,8 +3924,8 @@ int32_t tDeserializeSMqSeekReq(void* buf, int32_t bufLen, SMqSeekReq* pReq);
#define SUBMIT_REQ_COLUMN_DATA_FORMAT 0x2
#define SUBMIT_REQ_FROM_FILE 0x4
-#define SOURCE_NULL 0
-#define SOURCE_TAOSX 1
+#define SOURCE_NULL 0
+#define SOURCE_TAOSX 1
typedef struct {
int32_t flags;
@@ -3941,8 +3937,8 @@ typedef struct {
SArray* aRowP;
SArray* aCol;
};
- int64_t ctimeMs;
- int8_t source;
+ int64_t ctimeMs;
+ int8_t source;
} SSubmitTbData;
typedef struct {
diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h
index 519da6d116..52e2260031 100644
--- a/include/common/ttokendef.h
+++ b/include/common/ttokendef.h
@@ -305,74 +305,76 @@
#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_COUNT_WINDOW 290
+#define TK_SLIDING 291
+#define TK_FILL 292
+#define TK_VALUE 293
+#define TK_VALUE_F 294
+#define TK_NONE 295
+#define TK_PREV 296
+#define TK_NULL_F 297
+#define TK_LINEAR 298
+#define TK_NEXT 299
+#define TK_HAVING 300
+#define TK_RANGE 301
+#define TK_EVERY 302
+#define TK_ORDER 303
+#define TK_SLIMIT 304
+#define TK_SOFFSET 305
+#define TK_LIMIT 306
+#define TK_OFFSET 307
+#define TK_ASC 308
+#define TK_NULLS 309
+#define TK_ABORT 310
+#define TK_AFTER 311
+#define TK_ATTACH 312
+#define TK_BEFORE 313
+#define TK_BEGIN 314
+#define TK_BITAND 315
+#define TK_BITNOT 316
+#define TK_BITOR 317
+#define TK_BLOCKS 318
+#define TK_CHANGE 319
+#define TK_COMMA 320
+#define TK_CONCAT 321
+#define TK_CONFLICT 322
+#define TK_COPY 323
+#define TK_DEFERRED 324
+#define TK_DELIMITERS 325
+#define TK_DETACH 326
+#define TK_DIVIDE 327
+#define TK_DOT 328
+#define TK_EACH 329
+#define TK_FAIL 330
+#define TK_FILE 331
+#define TK_FOR 332
+#define TK_GLOB 333
+#define TK_ID 334
+#define TK_IMMEDIATE 335
+#define TK_IMPORT 336
+#define TK_INITIALLY 337
+#define TK_INSTEAD 338
+#define TK_ISNULL 339
+#define TK_KEY 340
+#define TK_MODULES 341
+#define TK_NK_BITNOT 342
+#define TK_NK_SEMI 343
+#define TK_NOTNULL 344
+#define TK_OF 345
+#define TK_PLUS 346
+#define TK_PRIVILEGE 347
+#define TK_RAISE 348
+#define TK_RESTRICT 349
+#define TK_ROW 350
+#define TK_STAR 351
+#define TK_STATEMENT 352
+#define TK_STRICT 353
+#define TK_STRING 354
+#define TK_TIMES 355
+#define TK_VALUES 356
+#define TK_VARIABLE 357
+#define TK_WAL 358
+
#define TK_NK_SPACE 600
diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h
index e06a08acba..fe20639c77 100644
--- a/include/libs/executor/executor.h
+++ b/include/libs/executor/executor.h
@@ -215,7 +215,6 @@ int32_t qSetStreamOperatorOptionForScanHistory(qTaskInfo_t tinfo);
int32_t qStreamSourceScanParamForHistoryScanStep1(qTaskInfo_t tinfo, SVersionRange *pVerRange, STimeWindow* pWindow);
int32_t qStreamSourceScanParamForHistoryScanStep2(qTaskInfo_t tinfo, SVersionRange *pVerRange, STimeWindow* pWindow);
int32_t qStreamRecoverFinish(qTaskInfo_t tinfo);
-int32_t qRestoreStreamOperatorOption(qTaskInfo_t tinfo);
bool qStreamScanhistoryFinished(qTaskInfo_t tinfo);
int32_t qStreamInfoResetTimewindowFilter(qTaskInfo_t tinfo);
void resetTaskInfo(qTaskInfo_t tinfo);
diff --git a/include/libs/executor/storageapi.h b/include/libs/executor/storageapi.h
index 9987dab166..e66ffe5521 100644
--- a/include/libs/executor/storageapi.h
+++ b/include/libs/executor/storageapi.h
@@ -352,14 +352,19 @@ typedef struct SStateStore {
int32_t (*streamStateSessionPut)(SStreamState* pState, const SSessionKey* key, void* value, int32_t vLen);
int32_t (*streamStateSessionGet)(SStreamState* pState, SSessionKey* key, void** pVal, int32_t* pVLen);
int32_t (*streamStateSessionDel)(SStreamState* pState, const SSessionKey* key);
+ int32_t (*streamStateSessionReset)(SStreamState* pState, void* pVal);
int32_t (*streamStateSessionClear)(SStreamState* pState);
int32_t (*streamStateSessionGetKVByCur)(SStreamStateCur* pCur, SSessionKey* pKey, void** pVal, int32_t* pVLen);
int32_t (*streamStateStateAddIfNotExist)(SStreamState* pState, SSessionKey* key, char* pKeyData, int32_t keyDataLen,
state_key_cmpr_fn fn, void** pVal, int32_t* pVLen);
int32_t (*streamStateSessionGetKeyByRange)(SStreamState* pState, const SSessionKey* range, SSessionKey* curKey);
+ int32_t (*streamStateCountGetKeyByRange)(SStreamState* pState, const SSessionKey* range, SSessionKey* curKey);
int32_t (*streamStateSessionAllocWinBuffByNextPosition)(SStreamState* pState, SStreamStateCur* pCur,
const SSessionKey* pKey, void** pVal, int32_t* pVLen);
+ int32_t (*streamStateCountWinAddIfNotExist)(SStreamState* pState, SSessionKey* pKey, COUNT_TYPE winCount, void** ppVal, int32_t* pVLen);
+ int32_t (*streamStateCountWinAdd)(SStreamState* pState, SSessionKey* pKey, void** pVal, int32_t* pVLen);
+
SUpdateInfo* (*updateInfoInit)(int64_t interval, int32_t precision, int64_t watermark, bool igUp);
TSKEY (*updateInfoFillBlockData)(SUpdateInfo* pInfo, SSDataBlock* pBlock, int32_t primaryTsCol);
bool (*updateInfoIsUpdated)(SUpdateInfo* pInfo, uint64_t tableId, TSKEY ts);
@@ -377,6 +382,7 @@ typedef struct SStateStore {
int32_t (*updateInfoDeserialize)(void* buf, int32_t bufLen, SUpdateInfo* pInfo);
SStreamStateCur* (*streamStateSessionSeekKeyNext)(SStreamState* pState, const SSessionKey* key);
+ SStreamStateCur* (*streamStateCountSeekKeyPrev)(SStreamState* pState, const SSessionKey* pKey, COUNT_TYPE count);
SStreamStateCur* (*streamStateSessionSeekKeyCurrentPrev)(SStreamState* pState, const SSessionKey* key);
SStreamStateCur* (*streamStateSessionSeekKeyCurrentNext)(SStreamState* pState, const SSessionKey* key);
diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h
index 1e5276495d..90d58868dc 100644
--- a/include/libs/nodes/plannodes.h
+++ b/include/libs/nodes/plannodes.h
@@ -249,7 +249,8 @@ typedef enum EWindowType {
WINDOW_TYPE_INTERVAL = 1,
WINDOW_TYPE_SESSION,
WINDOW_TYPE_STATE,
- WINDOW_TYPE_EVENT
+ WINDOW_TYPE_EVENT,
+ WINDOW_TYPE_COUNT
} EWindowType;
typedef enum EWindowAlgorithm {
@@ -287,6 +288,8 @@ typedef struct SWindowLogicNode {
int8_t igCheckUpdate;
EWindowAlgorithm windowAlgo;
bool isPartTb;
+ int64_t windowCount;
+ int64_t windowSliding;
} SWindowLogicNode;
typedef struct SFillLogicNode {
@@ -651,6 +654,14 @@ typedef struct SEventWinodwPhysiNode {
typedef SEventWinodwPhysiNode SStreamEventWinodwPhysiNode;
+typedef struct SCountWinodwPhysiNode {
+ SWindowPhysiNode window;
+ int64_t windowCount;
+ int64_t windowSliding;
+} SCountWinodwPhysiNode;
+
+typedef SCountWinodwPhysiNode SStreamCountWinodwPhysiNode;
+
typedef struct SSortPhysiNode {
SPhysiNode node;
SNodeList* pExprs; // these are expression list of order_by_clause and parameter expression of aggregate function
diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h
index 8214fcb10f..f8252bb52e 100644
--- a/include/libs/nodes/querynodes.h
+++ b/include/libs/nodes/querynodes.h
@@ -306,6 +306,13 @@ typedef struct SEventWindowNode {
SNode* pEndCond;
} SEventWindowNode;
+typedef struct SCountWindowNode {
+ ENodeType type; // QUERY_NODE_EVENT_WINDOW
+ SNode* pCol; // timestamp primary key
+ int64_t windowCount;
+ int64_t windowSliding;
+} SCountWindowNode;
+
typedef enum EFillMode {
FILL_MODE_NONE = 1,
FILL_MODE_VALUE,
diff --git a/include/libs/stream/streamState.h b/include/libs/stream/streamState.h
index c2f7c6de2f..c603f9f5ac 100644
--- a/include/libs/stream/streamState.h
+++ b/include/libs/stream/streamState.h
@@ -55,13 +55,16 @@ int32_t streamStateSessionAddIfNotExist(SStreamState* pState, SSessionKey* key,
int32_t streamStateSessionPut(SStreamState* pState, const SSessionKey* key, void* value, int32_t vLen);
int32_t streamStateSessionGet(SStreamState* pState, SSessionKey* key, void** pVal, int32_t* pVLen);
int32_t streamStateSessionDel(SStreamState* pState, const SSessionKey* key);
+int32_t streamStateSessionReset(SStreamState* pState, void* pVal);
int32_t streamStateSessionClear(SStreamState* pState);
int32_t streamStateSessionGetKVByCur(SStreamStateCur* pCur, SSessionKey* pKey, void** pVal, int32_t* pVLen);
int32_t streamStateSessionGetKeyByRange(SStreamState* pState, const SSessionKey* range, SSessionKey* curKey);
+int32_t streamStateCountGetKeyByRange(SStreamState* pState, const SSessionKey* range, SSessionKey* curKey);
int32_t streamStateSessionAllocWinBuffByNextPosition(SStreamState* pState, SStreamStateCur* pCur,
const SSessionKey* pKey, void** pVal, int32_t* pVLen);
SStreamStateCur* streamStateSessionSeekKeyNext(SStreamState* pState, const SSessionKey* key);
+SStreamStateCur* streamStateCountSeekKeyPrev(SStreamState* pState, const SSessionKey* pKey, COUNT_TYPE count);
SStreamStateCur* streamStateSessionSeekKeyCurrentPrev(SStreamState* pState, const SSessionKey* key);
SStreamStateCur* streamStateSessionSeekKeyCurrentNext(SStreamState* pState, const SSessionKey* key);
@@ -79,6 +82,10 @@ int32_t streamStateReleaseBuf(SStreamState* pState, void* pVal, bool used);
int32_t streamStateClearBuff(SStreamState* pState, void* pVal);
void streamStateFreeVal(void* val);
+// count window
+int32_t streamStateCountWinAddIfNotExist(SStreamState* pState, SSessionKey* pKey, COUNT_TYPE winCount, void** ppVal, int32_t* pVLen);
+int32_t streamStateCountWinAdd(SStreamState* pState, SSessionKey* pKey, void** pVal, int32_t* pVLen);
+
SStreamStateCur* streamStateGetAndCheckCur(SStreamState* pState, SWinKey* key);
SStreamStateCur* streamStateSeekKeyNext(SStreamState* pState, const SWinKey* key);
SStreamStateCur* streamStateFillSeekKeyNext(SStreamState* pState, const SWinKey* key);
@@ -128,10 +135,6 @@ int sessionRangeKeyCmpr(const SSessionKey* pWin1, const SSessionKey* pWin2);
int sessionWinKeyCmpr(const SSessionKey* pWin1, const SSessionKey* pWin2);
int stateSessionKeyCmpr(const void* pKey1, int kLen1, const void* pKey2, int kLen2);
int stateKeyCmpr(const void* pKey1, int kLen1, const void* pKey2, int kLen2);
-#if 0
-char* streamStateSessionDump(SStreamState* pState);
-char* streamStateIntervalDump(SStreamState* pState);
-#endif
#ifdef __cplusplus
}
diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h
index d6d89d1d30..64ce735843 100644
--- a/include/libs/stream/tstream.h
+++ b/include/libs/stream/tstream.h
@@ -50,21 +50,21 @@ extern "C" {
(_t)->hTaskInfo.id.streamId = 0; \
} while (0)
-#define STREAM_EXEC_T_EXTRACT_WAL_DATA (-1)
-#define STREAM_EXEC_T_START_ALL_TASKS (-2)
-#define STREAM_EXEC_T_START_ONE_TASK (-3)
-#define STREAM_EXEC_T_RESTART_ALL_TASKS (-4)
-#define STREAM_EXEC_T_STOP_ALL_TASKS (-5)
-#define STREAM_EXEC_T_RESUME_TASK (-6)
-#define STREAM_EXEC_T_UPDATE_TASK_EPSET (-7)
+#define STREAM_EXEC_T_EXTRACT_WAL_DATA (-1)
+#define STREAM_EXEC_T_START_ALL_TASKS (-2)
+#define STREAM_EXEC_T_START_ONE_TASK (-3)
+#define STREAM_EXEC_T_RESTART_ALL_TASKS (-4)
+#define STREAM_EXEC_T_STOP_ALL_TASKS (-5)
+#define STREAM_EXEC_T_RESUME_TASK (-6)
+#define STREAM_EXEC_T_UPDATE_TASK_EPSET (-7)
typedef struct SStreamTask SStreamTask;
typedef struct SStreamQueue SStreamQueue;
typedef struct SStreamTaskSM SStreamTaskSM;
-#define SSTREAM_TASK_VER 3
-#define SSTREAM_TASK_INCOMPATIBLE_VER 1
-#define SSTREAM_TASK_NEED_CONVERT_VER 2
+#define SSTREAM_TASK_VER 3
+#define SSTREAM_TASK_INCOMPATIBLE_VER 1
+#define SSTREAM_TASK_NEED_CONVERT_VER 2
#define SSTREAM_TASK_SUBTABLE_CHANGED_VER 3
enum {
@@ -405,8 +405,8 @@ typedef struct SHistoryTaskInfo {
int32_t tickCount;
int32_t retryTimes;
int32_t waitInterval;
- int64_t haltVer; // offset in wal when halt the stream task
- bool operatorOpen; // false by default
+ int64_t haltVer; // offset in wal when halt the stream task
+ bool operatorOpen; // false by default
} SHistoryTaskInfo;
typedef struct STaskOutputInfo {
@@ -463,21 +463,22 @@ struct SStreamTask {
struct SStreamMeta* pMeta;
SSHashObj* pNameMap;
void* pBackend;
- char reserve[256];
+ int8_t subtableWithoutMd5;
+ char reserve[255];
};
typedef int32_t (*startComplete_fn_t)(struct SStreamMeta*);
typedef struct STaskStartInfo {
- int64_t startTs;
- int64_t readyTs;
- int32_t tasksWillRestart;
- int32_t taskStarting; // restart flag, sentinel to guard the restart procedure.
- SHashObj* pReadyTaskSet; // tasks that are all ready for running stream processing
- SHashObj* pFailedTaskSet; // tasks that are done the check downstream process, may be successful or failed
- int64_t elapsedTime;
- int32_t restartCount; // restart task counter
- startComplete_fn_t completeFn; // complete callback function
+ int64_t startTs;
+ int64_t readyTs;
+ int32_t tasksWillRestart;
+ int32_t taskStarting; // restart flag, sentinel to guard the restart procedure.
+ SHashObj* pReadyTaskSet; // tasks that are all ready for running stream processing
+ SHashObj* pFailedTaskSet; // tasks that are done the check downstream process, may be successful or failed
+ int64_t elapsedTime;
+ int32_t restartCount; // restart task counter
+ startComplete_fn_t completeFn; // complete callback function
} STaskStartInfo;
typedef struct STaskUpdateInfo {
@@ -504,7 +505,7 @@ typedef struct SStreamMeta {
int32_t vgId;
int64_t stage;
int32_t role;
- bool sendMsgBeforeClosing; // send hb to mnode before close all tasks when switch to follower.
+ bool sendMsgBeforeClosing; // send hb to mnode before close all tasks when switch to follower.
STaskStartInfo startInfo;
TdThreadRwlock lock;
SScanWalInfo scanInfo;
@@ -532,7 +533,7 @@ int32_t tEncodeStreamEpInfo(SEncoder* pEncoder, const SStreamChildEpInfo* pInfo)
int32_t tDecodeStreamEpInfo(SDecoder* pDecoder, SStreamChildEpInfo* pInfo);
SStreamTask* tNewStreamTask(int64_t streamId, int8_t taskLevel, SEpSet* pEpset, bool fillHistory, int64_t triggerParam,
- SArray* pTaskList, bool hasFillhistory);
+ SArray* pTaskList, bool hasFillhistory, int8_t subtableWithoutMd5);
int32_t tEncodeStreamTask(SEncoder* pEncoder, const SStreamTask* pTask);
int32_t tDecodeStreamTask(SDecoder* pDecoder, SStreamTask* pTask);
void tFreeStreamTask(SStreamTask* pTask);
@@ -656,7 +657,6 @@ int32_t tEncodeStreamCheckpointSourceReq(SEncoder* pEncoder, const SStreamCheckp
int32_t tDecodeStreamCheckpointSourceReq(SDecoder* pDecoder, SStreamCheckpointSourceReq* pReq);
int32_t tEncodeStreamCheckpointSourceRsp(SEncoder* pEncoder, const SStreamCheckpointSourceRsp* pRsp);
-int32_t tDecodeStreamCheckpointSourceRsp(SDecoder* pDecoder, SStreamCheckpointSourceRsp* pRsp);
typedef struct {
SMsgHead msgHead;
@@ -678,18 +678,18 @@ typedef struct STaskStatusEntry {
int32_t statusLastDuration; // to record the last duration of current status
int64_t stage;
int32_t nodeId;
- int64_t verStart; // start version in WAL, only valid for source task
- int64_t verEnd; // end version in WAL, only valid for source task
- int64_t processedVer; // only valid for source task
- int64_t checkpointId; // current active checkpoint id
- int32_t chkpointTransId; // checkpoint trans id
- int8_t checkpointFailed; // denote if the checkpoint is failed or not
- bool inputQChanging; // inputQ is changing or not
+ int64_t verStart; // start version in WAL, only valid for source task
+ int64_t verEnd; // end version in WAL, only valid for source task
+ int64_t processedVer; // only valid for source task
+ int64_t checkpointId; // current active checkpoint id
+ int32_t chkpointTransId; // checkpoint trans id
+ int8_t checkpointFailed; // denote if the checkpoint is failed or not
+ bool inputQChanging; // inputQ is changing or not
int64_t inputQUnchangeCounter;
- double inputQUsed; // in MiB
+ double inputQUsed; // in MiB
double inputRate;
- double sinkQuota; // existed quota size for sink task
- double sinkDataSize; // sink to dst data size
+ double sinkQuota; // existed quota size for sink task
+ double sinkDataSize; // sink to dst data size
} STaskStatusEntry;
typedef struct SStreamHbMsg {
@@ -720,23 +720,10 @@ int32_t tEncodeStreamTaskUpdateMsg(SEncoder* pEncoder, const SStreamTaskNodeUpda
int32_t tDecodeStreamTaskUpdateMsg(SDecoder* pDecoder, SStreamTaskNodeUpdateMsg* pMsg);
typedef struct SStreamTaskState {
- ETaskStatus state;
- char* name;
+ ETaskStatus state;
+ char* name;
} SStreamTaskState;
-typedef struct {
- int64_t streamId;
- int32_t downstreamTaskId;
- int32_t taskId;
-} SStreamRecoverDownstreamReq;
-
-typedef struct {
- int64_t streamId;
- int32_t downstreamTaskId;
- int32_t taskId;
- SArray* checkpointVer; // SArray
-} SStreamRecoverDownstreamRsp;
-
int32_t tEncodeStreamTaskCheckReq(SEncoder* pEncoder, const SStreamTaskCheckReq* pReq);
int32_t tDecodeStreamTaskCheckReq(SDecoder* pDecoder, SStreamTaskCheckReq* pReq);
@@ -745,10 +732,12 @@ int32_t tDecodeStreamTaskCheckRsp(SDecoder* pDecoder, SStreamTaskCheckRsp* pRsp)
int32_t tEncodeStreamDispatchReq(SEncoder* pEncoder, const SStreamDispatchReq* pReq);
int32_t tDecodeStreamDispatchReq(SDecoder* pDecoder, SStreamDispatchReq* pReq);
-
-int32_t tDecodeStreamRetrieveReq(SDecoder* pDecoder, SStreamRetrieveReq* pReq);
void tDeleteStreamDispatchReq(SStreamDispatchReq* pReq);
+int32_t tEncodeStreamRetrieveReq(SEncoder* pEncoder, const SStreamRetrieveReq* pReq);
+int32_t tDecodeStreamRetrieveReq(SDecoder* pDecoder, SStreamRetrieveReq* pReq);
+void tDeleteStreamRetrieveReq(SStreamRetrieveReq* pReq);
+
typedef struct SStreamTaskCheckpointReq {
int64_t streamId;
int32_t taskId;
@@ -787,21 +776,19 @@ void initRpcMsg(SRpcMsg* pMsg, int32_t msgType, void* pCont, int32_t contLen);
// recover and fill history
void streamTaskCheckDownstream(SStreamTask* pTask);
-int32_t streamTaskCheckStatus(SStreamTask* pTask, int32_t upstreamTaskId, int32_t vgId, int64_t stage,
- int64_t* oldStage);
+int32_t streamTaskCheckStatus(SStreamTask* pTask, int32_t upstreamId, int32_t vgId, int64_t stage, int64_t* oldStage);
int32_t streamTaskUpdateEpsetInfo(SStreamTask* pTask, SArray* pNodeList);
void streamTaskResetUpstreamStageInfo(SStreamTask* pTask);
bool streamTaskIsAllUpstreamClosed(SStreamTask* pTask);
bool streamTaskSetSchedStatusWait(SStreamTask* pTask);
int8_t streamTaskSetSchedStatusActive(SStreamTask* pTask);
int8_t streamTaskSetSchedStatusInactive(SStreamTask* pTask);
-int32_t streamTaskClearHTaskAttr(SStreamTask* pTask, bool metaLock);
+int32_t streamTaskClearHTaskAttr(SStreamTask* pTask, int32_t clearRelHalt, bool metaLock);
int32_t streamTaskHandleEvent(SStreamTaskSM* pSM, EStreamTaskEvent event);
int32_t streamTaskOnHandleEventSuccess(SStreamTaskSM* pSM, EStreamTaskEvent event);
void streamTaskRestoreStatus(SStreamTask* pTask);
-int32_t streamTaskStop(SStreamTask* pTask);
int32_t streamSendCheckRsp(const SStreamMeta* pMeta, const SStreamTaskCheckReq* pReq, SStreamTaskCheckRsp* pRsp,
SRpcHandleInfo* pRpcInfo, int32_t taskId);
int32_t streamProcessCheckRsp(SStreamTask* pTask, const SStreamTaskCheckRsp* pRsp);
@@ -813,9 +800,9 @@ bool streamHistoryTaskSetVerRangeStep2(SStreamTask* pTask, int64_t latestVer)
int32_t streamQueueGetNumOfItems(const SStreamQueue* pQueue);
// common
-int32_t streamRestoreParam(SStreamTask* pTask);
void streamTaskPause(SStreamMeta* pMeta, SStreamTask* pTask);
void streamTaskResume(SStreamTask* pTask);
+int32_t streamTaskStop(SStreamTask* pTask);
int32_t streamTaskSetUpstreamInfo(SStreamTask* pTask, const SStreamTask* pUpstreamTask);
void streamTaskUpdateUpstreamInfo(SStreamTask* pTask, int32_t nodeId, const SEpSet* pEpSet);
void streamTaskUpdateDownstreamInfo(SStreamTask* pTask, int32_t nodeId, const SEpSet* pEpSet);
@@ -839,7 +826,8 @@ SScanhistoryDataInfo streamScanHistoryData(SStreamTask* pTask, int64_t st);
// stream task meta
void streamMetaInit();
void streamMetaCleanup();
-SStreamMeta* streamMetaOpen(const char* path, void* ahandle, FTaskExpand expandFunc, int32_t vgId, int64_t stage, startComplete_fn_t fn);
+SStreamMeta* streamMetaOpen(const char* path, void* ahandle, FTaskExpand expandFunc, int32_t vgId, int64_t stage,
+ startComplete_fn_t fn);
void streamMetaClose(SStreamMeta* streamMeta);
int32_t streamMetaSaveTask(SStreamMeta* pMeta, SStreamTask* pTask); // save to stream meta store
int32_t streamMetaRemoveTask(SStreamMeta* pMeta, STaskId* pKey);
@@ -858,22 +846,22 @@ void streamMetaNotifyClose(SStreamMeta* pMeta);
void streamMetaStartHb(SStreamMeta* pMeta);
bool streamMetaTaskInTimer(SStreamMeta* pMeta);
int32_t streamMetaAddTaskLaunchResult(SStreamMeta* pMeta, int64_t streamId, int32_t taskId, int64_t startTs,
- int64_t endTs, bool ready);
+ int64_t endTs, bool ready);
int32_t streamMetaResetTaskStatus(SStreamMeta* pMeta);
-void streamMetaRLock(SStreamMeta* pMeta);
-void streamMetaRUnLock(SStreamMeta* pMeta);
-void streamMetaWLock(SStreamMeta* pMeta);
-void streamMetaWUnLock(SStreamMeta* pMeta);
-void streamMetaResetStartInfo(STaskStartInfo* pMeta);
-SArray* streamMetaSendMsgBeforeCloseTasks(SStreamMeta* pMeta);
-void streamMetaUpdateStageRole(SStreamMeta* pMeta, int64_t stage, bool isLeader);
-int32_t streamMetaLoadAllTasks(SStreamMeta* pMeta);
-int32_t streamMetaStartAllTasks(SStreamMeta* pMeta);
-int32_t streamMetaStopAllTasks(SStreamMeta* pMeta);
-int32_t streamMetaStartOneTask(SStreamMeta* pMeta, int64_t streamId, int32_t taskId);
-bool streamMetaAllTasksReady(const SStreamMeta* pMeta);
-tmr_h streamTimerGetInstance();
+void streamMetaRLock(SStreamMeta* pMeta);
+void streamMetaRUnLock(SStreamMeta* pMeta);
+void streamMetaWLock(SStreamMeta* pMeta);
+void streamMetaWUnLock(SStreamMeta* pMeta);
+void streamMetaResetStartInfo(STaskStartInfo* pMeta);
+SArray* streamMetaSendMsgBeforeCloseTasks(SStreamMeta* pMeta);
+void streamMetaUpdateStageRole(SStreamMeta* pMeta, int64_t stage, bool isLeader);
+int32_t streamMetaLoadAllTasks(SStreamMeta* pMeta);
+int32_t streamMetaStartAllTasks(SStreamMeta* pMeta);
+int32_t streamMetaStopAllTasks(SStreamMeta* pMeta);
+int32_t streamMetaStartOneTask(SStreamMeta* pMeta, int64_t streamId, int32_t taskId);
+bool streamMetaAllTasksReady(const SStreamMeta* pMeta);
+tmr_h streamTimerGetInstance();
// checkpoint
int32_t streamProcessCheckpointSourceReq(SStreamTask* pTask, SStreamCheckpointSourceReq* pReq);
@@ -881,7 +869,7 @@ int32_t streamProcessCheckpointReadyMsg(SStreamTask* pTask);
int32_t streamTaskBuildCheckpoint(SStreamTask* pTask);
void streamTaskClearCheckInfo(SStreamTask* pTask, bool clearChkpReadyMsg);
int32_t streamAlignTransferState(SStreamTask* pTask);
-int32_t streamBuildAndSendDropTaskMsg(SMsgCb* pMsgCb, int32_t vgId, SStreamTaskId* pTaskId);
+int32_t streamBuildAndSendDropTaskMsg(SMsgCb* pMsgCb, int32_t vgId, SStreamTaskId* pTaskId, int64_t resetRelHalt);
int32_t streamAddCheckpointSourceRspMsg(SStreamCheckpointSourceReq* pReq, SRpcHandleInfo* pRpcInfo, SStreamTask* pTask,
int8_t isSucceed);
int32_t buildCheckpointSourceRsp(SStreamCheckpointSourceReq* pReq, SRpcHandleInfo* pRpcInfo, SRpcMsg* pMsg,
@@ -892,6 +880,7 @@ void* streamDestroyStateMachine(SStreamTaskSM* pSM);
int32_t broadcastRetrieveMsg(SStreamTask* pTask, SStreamRetrieveReq *req);
void sendRetrieveRsp(SStreamRetrieveReq *pReq, SRpcMsg* pRsp);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/libs/stream/tstreamFileState.h b/include/libs/stream/tstreamFileState.h
index 2a129c1830..a9a198d194 100644
--- a/include/libs/stream/tstreamFileState.h
+++ b/include/libs/stream/tstreamFileState.h
@@ -41,6 +41,8 @@ typedef int32_t (*_state_file_remove_fn)(SStreamFileState* pFileState, const voi
typedef int32_t (*_state_file_get_fn)(SStreamFileState* pFileState, void* pKey, void* data, int32_t* pDataLen);
typedef int32_t (*_state_file_clear_fn)(SStreamState* pState);
+typedef int32_t (*range_cmpr_fn)(const SSessionKey* pWin1, const SSessionKey* pWin2);
+
SStreamFileState* streamFileStateInit(int64_t memSize, uint32_t keySize, uint32_t rowSize, uint32_t selectRowSize,
GetTsFun fp, void* pFile, TSKEY delMark, const char* taskId,
int64_t checkpointId, int8_t type);
@@ -90,14 +92,19 @@ void sessionWinStateCleanup(void* pBuff);
SStreamStateCur* sessionWinStateSeekKeyCurrentPrev(SStreamFileState* pFileState, const SSessionKey* pWinKey);
SStreamStateCur* sessionWinStateSeekKeyCurrentNext(SStreamFileState* pFileState, const SSessionKey* pWinKey);
SStreamStateCur* sessionWinStateSeekKeyNext(SStreamFileState* pFileState, const SSessionKey* pWinKey);
+SStreamStateCur* countWinStateSeekKeyPrev(SStreamFileState* pFileState, const SSessionKey* pWinKey, COUNT_TYPE count);
int32_t sessionWinStateGetKVByCur(SStreamStateCur* pCur, SSessionKey* pKey, void** pVal, int32_t* pVLen);
int32_t sessionWinStateMoveToNext(SStreamStateCur* pCur);
-int32_t sessionWinStateGetKeyByRange(SStreamFileState* pFileState, const SSessionKey* key, SSessionKey* curKey);
+int32_t sessionWinStateGetKeyByRange(SStreamFileState* pFileState, const SSessionKey* key, SSessionKey* curKey, range_cmpr_fn cmpFn);
// state window
int32_t getStateWinResultBuff(SStreamFileState* pFileState, SSessionKey* key, char* pKeyData, int32_t keyDataLen,
state_key_cmpr_fn fn, void** pVal, int32_t* pVLen);
+// count window
+int32_t getCountWinResultBuff(SStreamFileState* pFileState, SSessionKey* pKey, COUNT_TYPE winCount, void** pVal, int32_t* pVLen);
+int32_t createCountWinResultBuff(SStreamFileState* pFileState, SSessionKey* pKey, void** pVal, int32_t* pVLen);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/os/osFile.h b/include/os/osFile.h
index 4d760a791f..eb0862a719 100644
--- a/include/os/osFile.h
+++ b/include/os/osFile.h
@@ -119,6 +119,8 @@ int32_t taosSetFileHandlesLimit();
int32_t taosLinkFile(char *src, char *dst);
+bool lastErrorIsFileNotExist();
+
#ifdef __cplusplus
}
#endif
diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c
index d3d8ee1dc1..971ed407f9 100644
--- a/source/client/src/clientImpl.c
+++ b/source/client/src/clientImpl.c
@@ -2121,6 +2121,9 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32
pStart += colLength[i];
}
+ // bool blankFill = *(bool*)p;
+ p += sizeof(bool);
+
if (convertUcs4) {
code = doConvertUCS4(pResultInfo, numOfRows, numOfCols, colLength);
}
diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c
index 1ea3eaf219..448243cc3d 100644
--- a/source/client/src/clientRawBlockWrite.c
+++ b/source/client/src/clientRawBlockWrite.c
@@ -21,8 +21,8 @@
#include "tglobal.h"
#include "tmsgtype.h"
-#define LOG_ID_TAG "connId:0x%"PRIx64",reqId:0x%"PRIx64
-#define LOG_ID_VALUE *(int64_t*)taos,pRequest->requestId
+#define LOG_ID_TAG "connId:0x%" PRIx64 ",reqId:0x%" PRIx64
+#define LOG_ID_VALUE *(int64_t*)taos, pRequest->requestId
static tb_uid_t processSuid(tb_uid_t suid, char* db) { return suid + MurmurHash3_32(db, strlen(db)); }
@@ -31,8 +31,7 @@ static char* buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* sch
char* string = NULL;
cJSON* json = cJSON_CreateObject();
if (json == NULL) {
- uError("create json object failed")
- return NULL;
+ uError("create json object failed") return NULL;
}
cJSON* type = cJSON_CreateString("create");
cJSON_AddItemToObject(json, "type", type);
@@ -56,7 +55,7 @@ static char* buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* sch
cJSON_AddItemToObject(column, "name", cname);
cJSON* ctype = cJSON_CreateNumber(s->type);
cJSON_AddItemToObject(column, "type", ctype);
- if (s->type == TSDB_DATA_TYPE_BINARY || s->type == TSDB_DATA_TYPE_VARBINARY|| s->type == TSDB_DATA_TYPE_GEOMETRY) {
+ if (s->type == TSDB_DATA_TYPE_BINARY || s->type == TSDB_DATA_TYPE_VARBINARY || s->type == TSDB_DATA_TYPE_GEOMETRY) {
int32_t length = s->bytes - VARSTR_HEADER_SIZE;
cJSON* cbytes = cJSON_CreateNumber(length);
cJSON_AddItemToObject(column, "length", cbytes);
@@ -131,7 +130,8 @@ static char* buildAlterSTableJson(void* alterData, int32_t alterDataLen) {
cJSON* colType = cJSON_CreateNumber(field->type);
cJSON_AddItemToObject(json, "colType", colType);
- if (field->type == TSDB_DATA_TYPE_BINARY || field->type == TSDB_DATA_TYPE_VARBINARY || field->type == TSDB_DATA_TYPE_GEOMETRY) {
+ if (field->type == TSDB_DATA_TYPE_BINARY || field->type == TSDB_DATA_TYPE_VARBINARY ||
+ field->type == TSDB_DATA_TYPE_GEOMETRY) {
int32_t length = field->bytes - VARSTR_HEADER_SIZE;
cJSON* cbytes = cJSON_CreateNumber(length);
cJSON_AddItemToObject(json, "colLength", cbytes);
@@ -156,7 +156,8 @@ static char* buildAlterSTableJson(void* alterData, int32_t alterDataLen) {
cJSON_AddItemToObject(json, "colName", colName);
cJSON* colType = cJSON_CreateNumber(field->type);
cJSON_AddItemToObject(json, "colType", colType);
- if (field->type == TSDB_DATA_TYPE_BINARY || field->type == TSDB_DATA_TYPE_VARBINARY || field->type == TSDB_DATA_TYPE_GEOMETRY) {
+ if (field->type == TSDB_DATA_TYPE_BINARY || field->type == TSDB_DATA_TYPE_VARBINARY ||
+ field->type == TSDB_DATA_TYPE_GEOMETRY) {
int32_t length = field->bytes - VARSTR_HEADER_SIZE;
cJSON* cbytes = cJSON_CreateNumber(length);
cJSON_AddItemToObject(json, "colLength", cbytes);
@@ -182,7 +183,7 @@ static char* buildAlterSTableJson(void* alterData, int32_t alterDataLen) {
}
string = cJSON_PrintUnformatted(json);
- end:
+end:
cJSON_Delete(json);
tFreeSMAltertbReq(&req);
return string;
@@ -295,9 +296,9 @@ static void buildChildElement(cJSON* json, SVCreateTbReq* pCreateReq) {
cJSON* tvalue = NULL;
if (IS_VAR_DATA_TYPE(pTagVal->type)) {
char* buf = NULL;
- if(pTagVal->type == TSDB_DATA_TYPE_VARBINARY){
- buf = taosMemoryCalloc(pTagVal->nData*2 + 2 + 3, 1);
- }else{
+ if (pTagVal->type == TSDB_DATA_TYPE_VARBINARY) {
+ buf = taosMemoryCalloc(pTagVal->nData * 2 + 2 + 3, 1);
+ } else {
buf = taosMemoryCalloc(pTagVal->nData + 3, 1);
}
@@ -315,7 +316,7 @@ static void buildChildElement(cJSON* json, SVCreateTbReq* pCreateReq) {
cJSON_AddItemToArray(tags, tag);
}
- end:
+end:
cJSON_AddItemToObject(json, "tags", tags);
taosArrayDestroy(pTagVals);
}
@@ -469,7 +470,8 @@ static char* processAlterTable(SMqMetaRsp* metaRsp) {
cJSON* colType = cJSON_CreateNumber(vAlterTbReq.type);
cJSON_AddItemToObject(json, "colType", colType);
- if (vAlterTbReq.type == TSDB_DATA_TYPE_BINARY || vAlterTbReq.type == TSDB_DATA_TYPE_VARBINARY || vAlterTbReq.type == TSDB_DATA_TYPE_GEOMETRY) {
+ if (vAlterTbReq.type == TSDB_DATA_TYPE_BINARY || vAlterTbReq.type == TSDB_DATA_TYPE_VARBINARY ||
+ vAlterTbReq.type == TSDB_DATA_TYPE_GEOMETRY) {
int32_t length = vAlterTbReq.bytes - VARSTR_HEADER_SIZE;
cJSON* cbytes = cJSON_CreateNumber(length);
cJSON_AddItemToObject(json, "colLength", cbytes);
@@ -490,7 +492,8 @@ static char* processAlterTable(SMqMetaRsp* metaRsp) {
cJSON_AddItemToObject(json, "colName", colName);
cJSON* colType = cJSON_CreateNumber(vAlterTbReq.colModType);
cJSON_AddItemToObject(json, "colType", colType);
- if (vAlterTbReq.colModType == TSDB_DATA_TYPE_BINARY || vAlterTbReq.colModType == TSDB_DATA_TYPE_VARBINARY || vAlterTbReq.colModType == TSDB_DATA_TYPE_GEOMETRY) {
+ if (vAlterTbReq.colModType == TSDB_DATA_TYPE_BINARY || vAlterTbReq.colModType == TSDB_DATA_TYPE_VARBINARY ||
+ vAlterTbReq.colModType == TSDB_DATA_TYPE_GEOMETRY) {
int32_t length = vAlterTbReq.colModBytes - VARSTR_HEADER_SIZE;
cJSON* cbytes = cJSON_CreateNumber(length);
cJSON_AddItemToObject(json, "colLength", cbytes);
@@ -527,9 +530,9 @@ static char* processAlterTable(SMqMetaRsp* metaRsp) {
}
buf = parseTagDatatoJson(vAlterTbReq.pTagVal);
} else {
- if(vAlterTbReq.tagType == TSDB_DATA_TYPE_VARBINARY){
- buf = taosMemoryCalloc(vAlterTbReq.nTagVal*2 + 2 + 3, 1);
- }else{
+ if (vAlterTbReq.tagType == TSDB_DATA_TYPE_VARBINARY) {
+ buf = taosMemoryCalloc(vAlterTbReq.nTagVal * 2 + 2 + 3, 1);
+ } else {
buf = taosMemoryCalloc(vAlterTbReq.nTagVal + 3, 1);
}
dataConverToStr(buf, vAlterTbReq.tagType, vAlterTbReq.pTagVal, vAlterTbReq.nTagVal, NULL);
@@ -677,7 +680,7 @@ _exit:
}
static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) {
- if(taos == NULL || meta == NULL) {
+ if (taos == NULL || meta == NULL) {
terrno = TSDB_CODE_INVALID_PARA;
return terrno;
}
@@ -692,7 +695,7 @@ static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) {
terrno = code;
return code;
}
- uDebug(LOG_ID_TAG" create stable, meta:%p, metaLen:%d", LOG_ID_VALUE, meta, metaLen);
+ uDebug(LOG_ID_TAG " create stable, meta:%p, metaLen:%d", LOG_ID_VALUE, meta, metaLen);
pRequest->syncQuery = true;
if (!pRequest->pDb) {
code = TSDB_CODE_PAR_DB_NOT_SPECIFIED;
@@ -731,8 +734,8 @@ static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) {
pReq.source = TD_REQ_FROM_TAOX;
pReq.igExists = true;
- uDebug(LOG_ID_TAG" create stable name:%s suid:%" PRId64 " processSuid:%" PRId64,
- LOG_ID_VALUE, req.name, req.suid, pReq.suid);
+ uDebug(LOG_ID_TAG " create stable name:%s suid:%" PRId64 " processSuid:%" PRId64, LOG_ID_VALUE, req.name, req.suid,
+ pReq.suid);
STscObj* pTscObj = pRequest->pTscObj;
SName tableName;
tNameExtractFullName(toName(pTscObj->acctId, pRequest->pDb, req.name, &tableName), pReq.name);
@@ -766,7 +769,7 @@ static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) {
taosMemoryFree(pCmdMsg.pMsg);
end:
- uDebug(LOG_ID_TAG" create stable return, msg:%s", LOG_ID_VALUE, tstrerror(code));
+ uDebug(LOG_ID_TAG " create stable return, msg:%s", LOG_ID_VALUE, tstrerror(code));
destroyRequest(pRequest);
tFreeSMCreateStbReq(&pReq);
tDecoderClear(&coder);
@@ -775,7 +778,7 @@ end:
}
static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) {
- if(taos == NULL || meta == NULL) {
+ if (taos == NULL || meta == NULL) {
terrno = TSDB_CODE_INVALID_PARA;
return terrno;
}
@@ -791,7 +794,7 @@ static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) {
return code;
}
- uDebug(LOG_ID_TAG" drop stable, meta:%p, metaLen:%d", LOG_ID_VALUE, meta, metaLen);
+ uDebug(LOG_ID_TAG " drop stable, meta:%p, metaLen:%d", LOG_ID_VALUE, meta, metaLen);
pRequest->syncQuery = true;
if (!pRequest->pDb) {
code = TSDB_CODE_PAR_DB_NOT_SPECIFIED;
@@ -812,9 +815,9 @@ static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) {
goto end;
}
SRequestConnInfo conn = {.pTrans = pRequest->pTscObj->pAppInfo->pTransporter,
- .requestId = pRequest->requestId,
- .requestObjRefId = pRequest->self,
- .mgmtEps = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp)};
+ .requestId = pRequest->requestId,
+ .requestObjRefId = pRequest->self,
+ .mgmtEps = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp)};
SName pName = {0};
toName(pRequest->pTscObj->acctId, pRequest->pDb, req.name, &pName);
STableMeta* pTableMeta = NULL;
@@ -835,8 +838,8 @@ static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) {
pReq.source = TD_REQ_FROM_TAOX;
// pReq.suid = processSuid(req.suid, pRequest->pDb);
- uDebug(LOG_ID_TAG" drop stable name:%s suid:%" PRId64 " new suid:%" PRId64,
- LOG_ID_VALUE, req.name, req.suid, pReq.suid);
+ uDebug(LOG_ID_TAG " drop stable name:%s suid:%" PRId64 " new suid:%" PRId64, LOG_ID_VALUE, req.name, req.suid,
+ pReq.suid);
STscObj* pTscObj = pRequest->pTscObj;
SName tableName = {0};
tNameExtractFullName(toName(pTscObj->acctId, pRequest->pDb, req.name, &tableName), pReq.name);
@@ -870,7 +873,7 @@ static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) {
taosMemoryFree(pCmdMsg.pMsg);
end:
- uDebug(LOG_ID_TAG" drop stable return, msg:%s", LOG_ID_VALUE, tstrerror(code));
+ uDebug(LOG_ID_TAG " drop stable return, msg:%s", LOG_ID_VALUE, tstrerror(code));
destroyRequest(pRequest);
tDecoderClear(&coder);
terrno = code;
@@ -889,7 +892,7 @@ static void destroyCreateTbReqBatch(void* data) {
}
static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) {
- if(taos == NULL || meta == NULL) {
+ if (taos == NULL || meta == NULL) {
terrno = TSDB_CODE_INVALID_PARA;
return terrno;
}
@@ -939,9 +942,9 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) {
taosHashSetFreeFp(pVgroupHashmap, destroyCreateTbReqBatch);
SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter,
- .requestId = pRequest->requestId,
- .requestObjRefId = pRequest->self,
- .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)};
+ .requestId = pRequest->requestId,
+ .requestObjRefId = pRequest->self,
+ .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)};
pRequest->tableList = taosArrayInit(req.nReqs, sizeof(SName));
// loop to create table
@@ -1033,7 +1036,7 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) {
code = pRequest->code;
end:
- uDebug(LOG_ID_TAG" create table return, msg:%s", LOG_ID_VALUE, tstrerror(code));
+ uDebug(LOG_ID_TAG " create table return, msg:%s", LOG_ID_VALUE, tstrerror(code));
for (int32_t iReq = 0; iReq < req.nReqs; iReq++) {
pCreateReq = req.pReqs + iReq;
taosMemoryFreeClear(pCreateReq->comment);
@@ -1062,7 +1065,7 @@ static void destroyDropTbReqBatch(void* data) {
}
static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) {
- if(taos == NULL || meta == NULL) {
+ if (taos == NULL || meta == NULL) {
terrno = TSDB_CODE_INVALID_PARA;
return terrno;
}
@@ -1111,9 +1114,9 @@ static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) {
taosHashSetFreeFp(pVgroupHashmap, destroyDropTbReqBatch);
SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter,
- .requestId = pRequest->requestId,
- .requestObjRefId = pRequest->self,
- .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)};
+ .requestId = pRequest->requestId,
+ .requestObjRefId = pRequest->self,
+ .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)};
pRequest->tableList = taosArrayInit(req.nReqs, sizeof(SName));
// loop to create table
for (int32_t iReq = 0; iReq < req.nReqs; iReq++) {
@@ -1142,7 +1145,8 @@ static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) {
tb_uid_t oldSuid = pDropReq->suid;
pDropReq->suid = pTableMeta->suid;
taosMemoryFreeClear(pTableMeta);
- uDebug(LOG_ID_TAG" drop table name:%s suid:%" PRId64 " new suid:%" PRId64, LOG_ID_VALUE, pDropReq->name, oldSuid, pDropReq->suid);
+ uDebug(LOG_ID_TAG " drop table name:%s suid:%" PRId64 " new suid:%" PRId64, LOG_ID_VALUE, pDropReq->name, oldSuid,
+ pDropReq->suid);
taosArrayPush(pRequest->tableList, &pName);
SVgroupDropTableBatch* pTableBatch = taosHashGet(pVgroupHashmap, &pInfo.vgId, sizeof(pInfo.vgId));
@@ -1185,7 +1189,7 @@ static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) {
code = pRequest->code;
end:
- uDebug(LOG_ID_TAG" drop table return, msg:%s", LOG_ID_VALUE, tstrerror(code));
+ uDebug(LOG_ID_TAG " drop table return, msg:%s", LOG_ID_VALUE, tstrerror(code));
taosHashCleanup(pVgroupHashmap);
destroyRequest(pRequest);
tDecoderClear(&coder);
@@ -1227,16 +1231,16 @@ end:
//}
static int32_t taosDeleteData(TAOS* taos, void* meta, int32_t metaLen) {
- if(taos == NULL || meta == NULL) {
+ if (taos == NULL || meta == NULL) {
terrno = TSDB_CODE_INVALID_PARA;
return terrno;
}
- SDeleteRes req = {0};
- SDecoder coder = {0};
+ SDeleteRes req = {0};
+ SDecoder coder = {0};
char sql[256] = {0};
int32_t code = TSDB_CODE_SUCCESS;
- uDebug("connId:0x%"PRIx64" delete data, meta:%p, len:%d", *(int64_t*)taos, meta, metaLen);
+ uDebug("connId:0x%" PRIx64 " delete data, meta:%p, len:%d", *(int64_t*)taos, meta, metaLen);
// decode and process req
void* data = POINTER_SHIFT(meta, sizeof(SMsgHead));
@@ -1260,14 +1264,14 @@ static int32_t taosDeleteData(TAOS* taos, void* meta, int32_t metaLen) {
taos_free_result(res);
end:
- uDebug("connId:0x%"PRIx64" delete data sql:%s, code:%s", *(int64_t*)taos, sql, tstrerror(code));
+ uDebug("connId:0x%" PRIx64 " delete data sql:%s, code:%s", *(int64_t*)taos, sql, tstrerror(code));
tDecoderClear(&coder);
terrno = code;
return code;
}
static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) {
- if(taos == NULL || meta == NULL) {
+ if (taos == NULL || meta == NULL) {
terrno = TSDB_CODE_INVALID_PARA;
return terrno;
}
@@ -1312,9 +1316,9 @@ static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) {
}
SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter,
- .requestId = pRequest->requestId,
- .requestObjRefId = pRequest->self,
- .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)};
+ .requestId = pRequest->requestId,
+ .requestObjRefId = pRequest->self,
+ .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)};
SVgroupInfo pInfo = {0};
SName pName = {0};
@@ -1394,8 +1398,8 @@ int taos_write_raw_block_with_fields(TAOS* taos, int rows, char* pData, const ch
return taos_write_raw_block_with_fields_with_reqid(taos, rows, pData, tbname, fields, numFields, 0);
}
-int taos_write_raw_block_with_fields_with_reqid(TAOS *taos, int rows, char *pData, const char *tbname,
- TAOS_FIELD *fields, int numFields, int64_t reqid){
+int taos_write_raw_block_with_fields_with_reqid(TAOS* taos, int rows, char* pData, const char* tbname,
+ TAOS_FIELD* fields, int numFields, int64_t reqid) {
if (!taos || !pData || !tbname) {
terrno = TSDB_CODE_INVALID_PARA;
return terrno;
@@ -1410,8 +1414,8 @@ int taos_write_raw_block_with_fields_with_reqid(TAOS *taos, int rows, char *pDat
return terrno;
}
- uDebug(LOG_ID_TAG " write raw block with field, rows:%d, pData:%p, tbname:%s, fields:%p, numFields:%d",
- LOG_ID_VALUE, rows, pData, tbname, fields, numFields);
+ uDebug(LOG_ID_TAG " write raw block with field, rows:%d, pData:%p, tbname:%s, fields:%p, numFields:%d", LOG_ID_VALUE,
+ rows, pData, tbname, fields, numFields);
pRequest->syncQuery = true;
if (!pRequest->pDb) {
@@ -1562,12 +1566,12 @@ end:
return code;
}
-static void* getRawDataFromRes(void *pRetrieve){
+static void* getRawDataFromRes(void* pRetrieve) {
void* rawData = NULL;
// deal with compatibility
- if(*(int64_t*)pRetrieve == 0){
+ if (*(int64_t*)pRetrieve == 0) {
rawData = ((SRetrieveTableRsp*)pRetrieve)->data;
- }else if(*(int64_t*)pRetrieve == 1){
+ } else if (*(int64_t*)pRetrieve == 1) {
rawData = ((SRetrieveTableRspForTmq*)pRetrieve)->data;
}
ASSERT(rawData != NULL);
@@ -1575,7 +1579,7 @@ static void* getRawDataFromRes(void *pRetrieve){
}
static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) {
- if(taos == NULL || data == NULL){
+ if (taos == NULL || data == NULL) {
terrno = TSDB_CODE_INVALID_PARA;
return terrno;
}
@@ -1644,11 +1648,11 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) {
strcpy(pName.tname, tbName);
code = catalogGetTableMeta(pCatalog, &conn, &pName, &pTableMeta);
-// if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST) {
-// uError("WriteRaw:catalogGetTableMeta table not exist. table name: %s", tbName);
-// code = TSDB_CODE_SUCCESS;
-// continue;
-// }
+ // if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST) {
+ // uError("WriteRaw:catalogGetTableMeta table not exist. table name: %s", tbName);
+ // code = TSDB_CODE_SUCCESS;
+ // continue;
+ // }
if (code != TSDB_CODE_SUCCESS) {
goto end;
}
@@ -1704,7 +1708,7 @@ end:
}
static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) {
- if(taos == NULL || data == NULL){
+ if (taos == NULL || data == NULL) {
terrno = TSDB_CODE_INVALID_PARA;
return terrno;
}
@@ -1757,7 +1761,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
}
pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK);
- uDebug(LOG_ID_TAG" write raw metadata block num:%d", LOG_ID_VALUE, rspObj.rsp.blockNum);
+ uDebug(LOG_ID_TAG " write raw metadata block num:%d", LOG_ID_VALUE, rspObj.rsp.blockNum);
while (++rspObj.resIter < rspObj.rsp.blockNum) {
void* pRetrieve = taosArrayGetP(rspObj.rsp.blockData, rspObj.resIter);
if (!rspObj.rsp.withSchema) {
@@ -1770,7 +1774,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
goto end;
}
- uDebug(LOG_ID_TAG" write raw metadata block tbname:%s", LOG_ID_VALUE, tbName);
+ uDebug(LOG_ID_TAG " write raw metadata block tbname:%s", LOG_ID_VALUE, tbName);
SName pName = {TSDB_TABLE_NAME_T, pRequest->pTscObj->acctId, {0}, {0}};
strcpy(pName.dbname, pRequest->pDb);
strcpy(pName.tname, tbName);
@@ -1817,11 +1821,11 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
strcpy(pName.tname, pCreateReqDst->ctb.stbName);
}
code = catalogGetTableMeta(pCatalog, &conn, &pName, &pTableMeta);
-// if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST) {
-// uError("WriteRaw:catalogGetTableMeta table not exist. table name: %s", tbName);
-// code = TSDB_CODE_SUCCESS;
-// continue;
-// }
+ // if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST) {
+ // uError("WriteRaw:catalogGetTableMeta table not exist. table name: %s", tbName);
+ // code = TSDB_CODE_SUCCESS;
+ // continue;
+ // }
if (code != TSDB_CODE_SUCCESS) {
goto end;
}
diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c
index 3c3aee3032..1904874a0b 100644
--- a/source/client/src/clientTmq.c
+++ b/source/client/src/clientTmq.c
@@ -26,7 +26,7 @@
#define EMPTY_BLOCK_POLL_IDLE_DURATION 10
#define DEFAULT_AUTO_COMMIT_INTERVAL 5000
-#define DEFAULT_HEARTBEAT_INTERVAL 3000
+#define DEFAULT_HEARTBEAT_INTERVAL 3000
struct SMqMgmt {
int8_t inited;
@@ -63,7 +63,7 @@ struct tmq_conf_t {
int8_t withTbName;
int8_t snapEnable;
int8_t replayEnable;
- int8_t sourceExcluded; // do not consume, bit
+ int8_t sourceExcluded; // do not consume, bit
uint16_t port;
int32_t autoCommitInterval;
char* ip;
@@ -83,15 +83,15 @@ struct tmq_t {
int32_t autoCommitInterval;
int8_t resetOffsetCfg;
int8_t replayEnable;
- int8_t sourceExcluded; // do not consume, bit
+ int8_t sourceExcluded; // do not consume, bit
uint64_t consumerId;
tmq_commit_cb* commitCb;
void* commitCbUserParam;
// status
- SRWLatch lock;
- int8_t status;
- int32_t epoch;
+ SRWLatch lock;
+ int8_t status;
+ int32_t epoch;
// poll info
int64_t pollCnt;
int64_t totalRows;
@@ -132,8 +132,8 @@ enum {
typedef struct SVgOffsetInfo {
STqOffsetVal committedOffset;
- STqOffsetVal endOffset; // the last version in TAOS_RES + 1
- STqOffsetVal beginOffset; // the first version in TAOS_RES
+ STqOffsetVal endOffset; // the last version in TAOS_RES + 1
+ STqOffsetVal beginOffset; // the first version in TAOS_RES
int64_t walVerBegin;
int64_t walVerEnd;
} SVgOffsetInfo;
@@ -144,11 +144,11 @@ typedef struct {
SVgOffsetInfo offsetInfo;
int32_t vgId;
int32_t vgStatus;
- int32_t vgSkipCnt; // here used to mark the slow vgroups
- int64_t emptyBlockReceiveTs; // once empty block is received, idle for ignoreCnt then start to poll data
- int64_t blockReceiveTs; // once empty block is received, idle for ignoreCnt then start to poll data
- int64_t blockSleepForReplay; // once empty block is received, idle for ignoreCnt then start to poll data
- bool seekUpdated; // offset is updated by seek operator, therefore, not update by vnode rsp.
+ int32_t vgSkipCnt; // here used to mark the slow vgroups
+ int64_t emptyBlockReceiveTs; // once empty block is received, idle for ignoreCnt then start to poll data
+ int64_t blockReceiveTs; // once empty block is received, idle for ignoreCnt then start to poll data
+ int64_t blockSleepForReplay; // once empty block is received, idle for ignoreCnt then start to poll data
+ bool seekUpdated; // offset is updated by seek operator, therefore, not update by vnode rsp.
SEpSet epSet;
} SMqClientVg;
@@ -178,23 +178,23 @@ typedef struct {
} SMqPollRspWrapper;
typedef struct {
-// int64_t refId;
-// int32_t epoch;
+ // int64_t refId;
+ // int32_t epoch;
tsem_t rspSem;
int32_t rspErr;
} SMqSubscribeCbParam;
typedef struct {
- int64_t refId;
- bool sync;
- void* pParam;
+ int64_t refId;
+ bool sync;
+ void* pParam;
} SMqAskEpCbParam;
typedef struct {
- int64_t refId;
- char topicName[TSDB_TOPIC_FNAME_LEN];
- int32_t vgId;
- uint64_t requestId; // request id for debug purpose
+ int64_t refId;
+ char topicName[TSDB_TOPIC_FNAME_LEN];
+ int32_t vgId;
+ uint64_t requestId; // request id for debug purpose
} SMqPollCbParam;
typedef struct SMqVgCommon {
@@ -208,14 +208,14 @@ typedef struct SMqVgCommon {
} SMqVgCommon;
typedef struct SMqSeekParam {
- tsem_t sem;
- int32_t code;
+ tsem_t sem;
+ int32_t code;
} SMqSeekParam;
typedef struct SMqCommittedParam {
- tsem_t sem;
- int32_t code;
- SMqVgOffset vgOffset;
+ tsem_t sem;
+ int32_t code;
+ SMqVgOffset vgOffset;
} SMqCommittedParam;
typedef struct SMqVgWalInfoParam {
@@ -238,10 +238,10 @@ typedef struct {
typedef struct {
SMqCommitCbParamSet* params;
-// SMqVgOffset* pOffset;
- char topicName[TSDB_TOPIC_FNAME_LEN];
- int32_t vgId;
- tmq_t* pTmq;
+ // SMqVgOffset* pOffset;
+ char topicName[TSDB_TOPIC_FNAME_LEN];
+ int32_t vgId;
+ tmq_t* pTmq;
} SMqCommitCbParam;
typedef struct SSyncCommitInfo {
@@ -252,7 +252,8 @@ typedef struct SSyncCommitInfo {
static int32_t syncAskEp(tmq_t* tmq);
static int32_t makeTopicVgroupKey(char* dst, const char* topicName, int32_t vg);
static int32_t tmqCommitDone(SMqCommitCbParamSet* pParamSet);
-static int32_t doSendCommitMsg(tmq_t* tmq, int32_t vgId, SEpSet* epSet, STqOffsetVal* offset, const char* pTopicName, SMqCommitCbParamSet* pParamSet);
+static int32_t doSendCommitMsg(tmq_t* tmq, int32_t vgId, SEpSet* epSet, STqOffsetVal* offset, const char* pTopicName,
+ SMqCommitCbParamSet* pParamSet);
static void commitRspCountDown(SMqCommitCbParamSet* pParamSet, int64_t consumerId, const char* pTopic, int32_t vgId);
static void askEp(tmq_t* pTmq, void* param, bool sync, bool updateEpset);
@@ -287,7 +288,7 @@ void tmq_conf_destroy(tmq_conf_t* conf) {
}
tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value) {
- if (conf == NULL || key == NULL || value == NULL){
+ if (conf == NULL || key == NULL || value == NULL) {
return TMQ_CONF_INVALID;
}
if (strcasecmp(key, "group.id") == 0) {
@@ -402,7 +403,7 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
tmq_list_t* tmq_list_new() { return (tmq_list_t*)taosArrayInit(0, sizeof(void*)); }
int32_t tmq_list_append(tmq_list_t* list, const char* src) {
- if(list == NULL) return -1;
+ if (list == NULL) return -1;
SArray* container = &list->container;
if (src == NULL || src[0] == 0) return -1;
char* topic = taosStrdup(src);
@@ -411,19 +412,19 @@ int32_t tmq_list_append(tmq_list_t* list, const char* src) {
}
void tmq_list_destroy(tmq_list_t* list) {
- if(list == NULL) return;
+ if (list == NULL) return;
SArray* container = &list->container;
taosArrayDestroyP(container, taosMemoryFree);
}
int32_t tmq_list_get_size(const tmq_list_t* list) {
- if(list == NULL) return -1;
+ if (list == NULL) return -1;
const SArray* container = &list->container;
return taosArrayGetSize(container);
}
char** tmq_list_to_c_array(const tmq_list_t* list) {
- if(list == NULL) return NULL;
+ if (list == NULL) return NULL;
const SArray* container = &list->container;
return container->pData;
}
@@ -439,7 +440,8 @@ static int32_t tmqCommitCb(void* param, SDataBuf* pBuf, int32_t code) {
return 0;
}
-static int32_t doSendCommitMsg(tmq_t* tmq, int32_t vgId, SEpSet* epSet, STqOffsetVal* offset, const char* pTopicName, SMqCommitCbParamSet* pParamSet) {
+static int32_t doSendCommitMsg(tmq_t* tmq, int32_t vgId, SEpSet* epSet, STqOffsetVal* offset, const char* pTopicName,
+ SMqCommitCbParamSet* pParamSet) {
SMqVgOffset pOffset = {0};
pOffset.consumerId = tmq->consumerId;
@@ -479,7 +481,7 @@ static int32_t doSendCommitMsg(tmq_t* tmq, int32_t vgId, SEpSet* epSet, STqOffse
}
pParam->params = pParamSet;
-// pParam->pOffset = pOffset;
+ // pParam->pOffset = pOffset;
pParam->vgId = vgId;
pParam->pTmq = tmq;
@@ -493,7 +495,7 @@ static int32_t doSendCommitMsg(tmq_t* tmq, int32_t vgId, SEpSet* epSet, STqOffse
return TSDB_CODE_OUT_OF_MEMORY;
}
- pMsgSendInfo->msgInfo = (SDataBuf) { .pData = buf, .len = sizeof(SMsgHead) + len, .handle = NULL };
+ pMsgSendInfo->msgInfo = (SDataBuf){.pData = buf, .len = sizeof(SMsgHead) + len, .handle = NULL};
pMsgSendInfo->requestId = generateRequestId();
pMsgSendInfo->requestObjRefId = 0;
@@ -505,7 +507,7 @@ static int32_t doSendCommitMsg(tmq_t* tmq, int32_t vgId, SEpSet* epSet, STqOffse
int64_t transporterId = 0;
atomic_add_fetch_32(&pParamSet->waitingRspNum, 1);
code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, epSet, &transporterId, pMsgSendInfo);
- if(code != 0){
+ if (code != 0) {
atomic_sub_fetch_32(&pParamSet->waitingRspNum, 1);
return code;
}
@@ -527,7 +529,8 @@ static SMqClientTopic* getTopicByName(tmq_t* tmq, const char* pTopicName) {
return NULL;
}
-static SMqCommitCbParamSet* prepareCommitCbParamSet(tmq_t* tmq, tmq_commit_cb* pCommitFp, void* userParam, int32_t rspNum){
+static SMqCommitCbParamSet* prepareCommitCbParamSet(tmq_t* tmq, tmq_commit_cb* pCommitFp, void* userParam,
+ int32_t rspNum) {
SMqCommitCbParamSet* pParamSet = taosMemoryCalloc(1, sizeof(SMqCommitCbParamSet));
if (pParamSet == NULL) {
return NULL;
@@ -542,14 +545,14 @@ static SMqCommitCbParamSet* prepareCommitCbParamSet(tmq_t* tmq, tmq_commit_cb* p
return pParamSet;
}
-static int32_t getClientVg(tmq_t* tmq, char* pTopicName, int32_t vgId, SMqClientVg** pVg){
+static int32_t getClientVg(tmq_t* tmq, char* pTopicName, int32_t vgId, SMqClientVg** pVg) {
SMqClientTopic* pTopic = getTopicByName(tmq, pTopicName);
if (pTopic == NULL) {
tscError("consumer:0x%" PRIx64 " invalid topic name:%s", tmq->consumerId, pTopicName);
return TSDB_CODE_TMQ_INVALID_TOPIC;
}
- int32_t numOfVgs = taosArrayGetSize(pTopic->vgs);
+ int32_t numOfVgs = taosArrayGetSize(pTopic->vgs);
for (int32_t i = 0; i < numOfVgs; ++i) {
SMqClientVg* pClientVg = taosArrayGet(pTopic->vgs, i);
if (pClientVg->vgId == vgId) {
@@ -561,19 +564,20 @@ static int32_t getClientVg(tmq_t* tmq, char* pTopicName, int32_t vgId, SMqClient
return *pVg == NULL ? TSDB_CODE_TMQ_INVALID_VGID : TSDB_CODE_SUCCESS;
}
-static int32_t asyncCommitOffset(tmq_t* tmq, char* pTopicName, int32_t vgId, STqOffsetVal* offsetVal, tmq_commit_cb* pCommitFp, void* userParam) {
+static int32_t asyncCommitOffset(tmq_t* tmq, char* pTopicName, int32_t vgId, STqOffsetVal* offsetVal,
+ tmq_commit_cb* pCommitFp, void* userParam) {
tscInfo("consumer:0x%" PRIx64 " do manual commit offset for %s, vgId:%d", tmq->consumerId, pTopicName, vgId);
taosRLockLatch(&tmq->lock);
SMqClientVg* pVg = NULL;
- int32_t code = getClientVg(tmq, pTopicName, vgId, &pVg);
- if(code != 0){
+ int32_t code = getClientVg(tmq, pTopicName, vgId, &pVg);
+ if (code != 0) {
goto end;
}
if (offsetVal->type <= 0) {
code = TSDB_CODE_TMQ_INVALID_MSG;
goto end;
}
- if (tOffsetEqual(offsetVal, &pVg->offsetInfo.committedOffset)){
+ if (tOffsetEqual(offsetVal, &pVg->offsetInfo.committedOffset)) {
code = TSDB_CODE_TMQ_SAME_COMMITTED_VALUE;
goto end;
}
@@ -605,11 +609,11 @@ end:
return code;
}
-static void asyncCommitFromResult(tmq_t* tmq, const TAOS_RES* pRes, tmq_commit_cb* pCommitFp, void* userParam){
- char* pTopicName = NULL;
- int32_t vgId = 0;
+static void asyncCommitFromResult(tmq_t* tmq, const TAOS_RES* pRes, tmq_commit_cb* pCommitFp, void* userParam) {
+ char* pTopicName = NULL;
+ int32_t vgId = 0;
STqOffsetVal offsetVal = {0};
- int32_t code = 0;
+ int32_t code = 0;
if (pRes == NULL || tmq == NULL) {
code = TSDB_CODE_INVALID_PARA;
@@ -639,8 +643,8 @@ static void asyncCommitFromResult(tmq_t* tmq, const TAOS_RES* pRes, tmq_commit_c
code = asyncCommitOffset(tmq, pTopicName, vgId, &offsetVal, pCommitFp, userParam);
end:
- if(code != TSDB_CODE_SUCCESS && pCommitFp != NULL){
- if(code == TSDB_CODE_TMQ_SAME_COMMITTED_VALUE) code = TSDB_CODE_SUCCESS;
+ if (code != TSDB_CODE_SUCCESS && pCommitFp != NULL) {
+ if (code == TSDB_CODE_TMQ_SAME_COMMITTED_VALUE) code = TSDB_CODE_SUCCESS;
pCommitFp(tmq, code, userParam);
}
}
@@ -662,11 +666,13 @@ static void asyncCommitAllOffsets(tmq_t* tmq, tmq_commit_cb* pCommitFp, void* us
SMqClientTopic* pTopic = taosArrayGet(tmq->clientTopics, i);
int32_t numOfVgroups = taosArrayGetSize(pTopic->vgs);
- tscInfo("consumer:0x%" PRIx64 " commit offset for topics:%s, numOfVgs:%d", tmq->consumerId, pTopic->topicName, numOfVgroups);
+ tscInfo("consumer:0x%" PRIx64 " commit offset for topics:%s, numOfVgs:%d", tmq->consumerId, pTopic->topicName,
+ numOfVgroups);
for (int32_t j = 0; j < numOfVgroups; j++) {
SMqClientVg* pVg = taosArrayGet(pTopic->vgs, j);
- if (pVg->offsetInfo.endOffset.type > 0 && !tOffsetEqual(&pVg->offsetInfo.endOffset, &pVg->offsetInfo.committedOffset)) {
+ if (pVg->offsetInfo.endOffset.type > 0 &&
+ !tOffsetEqual(&pVg->offsetInfo.endOffset, &pVg->offsetInfo.committedOffset)) {
char offsetBuf[TSDB_OFFSET_LEN] = {0};
tFormatOffset(offsetBuf, tListLen(offsetBuf), &pVg->offsetInfo.endOffset);
@@ -675,23 +681,27 @@ static void asyncCommitAllOffsets(tmq_t* tmq, tmq_commit_cb* pCommitFp, void* us
code = doSendCommitMsg(tmq, pVg->vgId, &pVg->epSet, &pVg->offsetInfo.endOffset, pTopic->topicName, pParamSet);
if (code != TSDB_CODE_SUCCESS) {
- tscError("consumer:0x%" PRIx64 " topic:%s on vgId:%d end commit msg failed, send offset:%s committed:%s, code:%s ordinal:%d/%d",
- tmq->consumerId, pTopic->topicName, pVg->vgId, offsetBuf, commitBuf, tstrerror(terrno), j + 1, numOfVgroups);
+ tscError("consumer:0x%" PRIx64
+ " topic:%s on vgId:%d end commit msg failed, send offset:%s committed:%s, code:%s ordinal:%d/%d",
+ tmq->consumerId, pTopic->topicName, pVg->vgId, offsetBuf, commitBuf, tstrerror(terrno), j + 1,
+ numOfVgroups);
continue;
}
- tscInfo("consumer:0x%" PRIx64 " topic:%s on vgId:%d send commit msg success, send offset:%s committed:%s, ordinal:%d/%d",
+ tscInfo("consumer:0x%" PRIx64
+ " topic:%s on vgId:%d send commit msg success, send offset:%s committed:%s, ordinal:%d/%d",
tmq->consumerId, pTopic->topicName, pVg->vgId, offsetBuf, commitBuf, j + 1, numOfVgroups);
pVg->offsetInfo.committedOffset = pVg->offsetInfo.endOffset;
} else {
tscInfo("consumer:0x%" PRIx64 " topic:%s vgId:%d, no commit, current:%" PRId64 ", ordinal:%d/%d",
- tmq->consumerId, pTopic->topicName, pVg->vgId, pVg->offsetInfo.endOffset.version, j + 1, numOfVgroups);
+ tmq->consumerId, pTopic->topicName, pVg->vgId, pVg->offsetInfo.endOffset.version, j + 1, numOfVgroups);
}
}
}
taosRUnLockLatch(&tmq->lock);
- tscInfo("consumer:0x%" PRIx64 " total commit:%d for %d topics", tmq->consumerId, pParamSet->waitingRspNum - 1, numOfTopics);
+ tscInfo("consumer:0x%" PRIx64 " total commit:%d for %d topics", tmq->consumerId, pParamSet->waitingRspNum - 1,
+ numOfTopics);
// request is sent
if (pParamSet->waitingRspNum != 1) {
@@ -702,7 +712,7 @@ static void asyncCommitAllOffsets(tmq_t* tmq, tmq_commit_cb* pCommitFp, void* us
end:
taosMemoryFree(pParamSet);
- if(pCommitFp != NULL) {
+ if (pCommitFp != NULL) {
pCommitFp(tmq, code, userParam);
}
return;
@@ -710,10 +720,10 @@ end:
static void generateTimedTask(int64_t refId, int32_t type) {
tmq_t* tmq = taosAcquireRef(tmqMgmt.rsetId, refId);
- if(tmq == NULL) return;
+ if (tmq == NULL) return;
int8_t* pTaskType = taosAllocateQitem(sizeof(int8_t), DEF_QITEM, 0);
- if(pTaskType == NULL) return;
+ if (pTaskType == NULL) return;
*pTaskType = type;
taosWriteQitem(tmq->delayedTask, pTaskType);
@@ -729,8 +739,8 @@ void tmqAssignAskEpTask(void* param, void* tmrId) {
void tmqReplayTask(void* param, void* tmrId) {
int64_t refId = *(int64_t*)param;
- tmq_t* tmq = taosAcquireRef(tmqMgmt.rsetId, refId);
- if(tmq == NULL) goto END;
+ tmq_t* tmq = taosAcquireRef(tmqMgmt.rsetId, refId);
+ if (tmq == NULL) goto END;
tsem_post(&tmq->rspSem);
taosReleaseRef(tmqMgmt.rsetId, refId);
@@ -753,13 +763,13 @@ int32_t tmqHbCb(void* param, SDataBuf* pMsg, int32_t code) {
tmq_t* tmq = taosAcquireRef(tmqMgmt.rsetId, refId);
if (tmq != NULL) {
taosWLockLatch(&tmq->lock);
- for(int32_t i = 0; i < taosArrayGetSize(rsp.topicPrivileges); i++){
+ for (int32_t i = 0; i < taosArrayGetSize(rsp.topicPrivileges); i++) {
STopicPrivilege* privilege = taosArrayGet(rsp.topicPrivileges, i);
- if(privilege->noPrivilege == 1){
+ 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){
+ if (strcmp(pTopicCur->topicName, privilege->topic) == 0) {
tscInfo("consumer:0x%" PRIx64 ", has no privilege, topic:%s", tmq->consumerId, privilege->topic);
pTopicCur->noPrivilege = 1;
}
@@ -790,22 +800,22 @@ void tmqSendHbReq(void* param, void* tmrId) {
req.epoch = tmq->epoch;
taosRLockLatch(&tmq->lock);
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);
+ 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++){
+ for (int j = 0; j < numOfVgroups; j++) {
SMqClientVg* pVg = taosArrayGet(pTopic->vgs, j);
- OffsetRows* offRows = taosArrayReserve(data->offsetRows, 1);
+ OffsetRows* offRows = taosArrayReserve(data->offsetRows, 1);
offRows->vgId = pVg->vgId;
offRows->rows = pVg->numOfRows;
offRows->offset = pVg->offsetInfo.endOffset;
- offRows->ever = pVg->offsetInfo.walVerEnd;
+ 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,
+ 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);
}
}
@@ -835,13 +845,13 @@ void tmqSendHbReq(void* param, void* tmrId) {
goto OVER;
}
- sendInfo->msgInfo = (SDataBuf){ .pData = pReq, .len = tlen, .handle = NULL };
+ sendInfo->msgInfo = (SDataBuf){.pData = pReq, .len = tlen, .handle = NULL};
sendInfo->requestId = generateRequestId();
sendInfo->requestObjRefId = 0;
sendInfo->paramFreeFp = taosMemoryFree;
sendInfo->param = taosMemoryMalloc(sizeof(int64_t));
- *(int64_t *)sendInfo->param = refId;
+ *(int64_t*)sendInfo->param = refId;
sendInfo->fp = tmqHbCb;
sendInfo->msgType = TDMT_MND_TMQ_HB;
@@ -972,7 +982,7 @@ int32_t tmqSubscribeCb(void* param, SDataBuf* pMsg, int32_t code) {
}
int32_t tmq_subscription(tmq_t* tmq, tmq_list_t** topics) {
- if(tmq == NULL) return TSDB_CODE_INVALID_PARA;
+ if (tmq == NULL) return TSDB_CODE_INVALID_PARA;
if (*topics == NULL) {
*topics = tmq_list_new();
}
@@ -986,7 +996,7 @@ int32_t tmq_subscription(tmq_t* tmq, tmq_list_t** topics) {
}
int32_t tmq_unsubscribe(tmq_t* tmq) {
- if(tmq == NULL) return TSDB_CODE_INVALID_PARA;
+ if (tmq == NULL) return TSDB_CODE_INVALID_PARA;
if (tmq->status != TMQ_CONSUMER_STATUS__READY) {
tscInfo("consumer:0x%" PRIx64 " not in ready state, unsubscribe it directly", tmq->consumerId);
return 0;
@@ -1060,9 +1070,10 @@ static void tmqMgmtInit(void) {
}
}
-#define SET_ERROR_MSG(MSG) if(errstr!=NULL)snprintf(errstr,errstrLen,MSG);
+#define SET_ERROR_MSG(MSG) \
+ if (errstr != NULL) snprintf(errstr, errstrLen, MSG);
tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) {
- if(conf == NULL) {
+ if (conf == NULL) {
SET_ERROR_MSG("configure is null")
return NULL;
}
@@ -1114,7 +1125,7 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) {
pTmq->resetOffsetCfg = conf->resetOffset;
pTmq->replayEnable = conf->replayEnable;
pTmq->sourceExcluded = conf->sourceExcluded;
- if(conf->replayEnable){
+ if (conf->replayEnable) {
pTmq->autoCommit = false;
}
taosInitRWLatch(&pTmq->lock);
@@ -1154,7 +1165,8 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) {
tFormatOffset(buf, tListLen(buf), &offset);
tscInfo("consumer:0x%" PRIx64 " is setup, refId:%" PRId64
", groupId:%s, snapshot:%d, autoCommit:%d, commitInterval:%dms, offset:%s",
- pTmq->consumerId, pTmq->refId, pTmq->groupId, pTmq->useSnapshot, pTmq->autoCommit, pTmq->autoCommitInterval, buf);
+ pTmq->consumerId, pTmq->refId, pTmq->groupId, pTmq->useSnapshot, pTmq->autoCommit, pTmq->autoCommitInterval,
+ buf);
return pTmq;
@@ -1164,7 +1176,7 @@ _failed:
}
int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
- if(tmq == NULL || topic_list == NULL) return TSDB_CODE_INVALID_PARA;
+ if (tmq == NULL || topic_list == NULL) return TSDB_CODE_INVALID_PARA;
const int32_t MAX_RETRY_COUNT = 120 * 2; // let's wait for 2 mins at most
const SArray* container = &topic_list->container;
int32_t sz = taosArrayGetSize(container);
@@ -1224,7 +1236,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
goto FAIL;
}
- SMqSubscribeCbParam param = { .rspErr = 0};
+ SMqSubscribeCbParam param = {.rspErr = 0};
if (tsem_init(¶m.rspSem, 0, 0) != 0) {
code = TSDB_CODE_TSC_INTERNAL_ERROR;
goto FAIL;
@@ -1242,7 +1254,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) {
int64_t transporterId = 0;
code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, sendInfo);
- if(code != 0){
+ if (code != 0) {
goto FAIL;
}
@@ -1293,20 +1305,20 @@ FAIL:
}
void tmq_conf_set_auto_commit_cb(tmq_conf_t* conf, tmq_commit_cb* cb, void* param) {
- if(conf == NULL) return;
+ if (conf == NULL) return;
conf->commitCb = cb;
conf->commitCbUserParam = param;
}
-static SMqClientVg* getVgInfo(tmq_t* tmq, char* topicName, int32_t vgId){
+static SMqClientVg* getVgInfo(tmq_t* tmq, char* topicName, int32_t vgId) {
int32_t topicNumCur = taosArrayGetSize(tmq->clientTopics);
- for(int i = 0; i < topicNumCur; i++){
+ for (int i = 0; i < topicNumCur; i++) {
SMqClientTopic* pTopicCur = taosArrayGet(tmq->clientTopics, i);
- if(strcmp(pTopicCur->topicName, topicName) == 0){
+ if (strcmp(pTopicCur->topicName, topicName) == 0) {
int32_t vgNumCur = taosArrayGetSize(pTopicCur->vgs);
for (int32_t j = 0; j < vgNumCur; j++) {
SMqClientVg* pVgCur = taosArrayGet(pTopicCur->vgs, j);
- if(pVgCur->vgId == vgId){
+ if (pVgCur->vgId == vgId) {
return pVgCur;
}
}
@@ -1315,21 +1327,21 @@ static SMqClientVg* getVgInfo(tmq_t* tmq, char* topicName, int32_t vgId){
return NULL;
}
-static SMqClientTopic* getTopicInfo(tmq_t* tmq, char* topicName){
+static SMqClientTopic* getTopicInfo(tmq_t* tmq, char* topicName) {
int32_t topicNumCur = taosArrayGetSize(tmq->clientTopics);
- for(int i = 0; i < topicNumCur; i++){
+ for (int i = 0; i < topicNumCur; i++) {
SMqClientTopic* pTopicCur = taosArrayGet(tmq->clientTopics, i);
- if(strcmp(pTopicCur->topicName, topicName) == 0){
+ if (strcmp(pTopicCur->topicName, topicName) == 0) {
return pTopicCur;
}
}
return NULL;
}
-static void setVgIdle(tmq_t* tmq, char* topicName, int32_t vgId){
+static void setVgIdle(tmq_t* tmq, char* topicName, int32_t vgId) {
taosWLockLatch(&tmq->lock);
SMqClientVg* pVg = getVgInfo(tmq, topicName, vgId);
- if(pVg){
+ if (pVg) {
atomic_store_32(&pVg->vgStatus, TMQ_VG_STATUS__IDLE);
}
taosWUnLockLatch(&tmq->lock);
@@ -1337,10 +1349,10 @@ static void setVgIdle(tmq_t* tmq, char* topicName, int32_t vgId){
int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) {
SMqPollCbParam* pParam = (SMqPollCbParam*)param;
- int64_t refId = pParam->refId;
- int32_t vgId = pParam->vgId;
- uint64_t requestId = pParam->requestId;
- tmq_t* tmq = taosAcquireRef(tmqMgmt.rsetId, refId);
+ int64_t refId = pParam->refId;
+ int32_t vgId = pParam->vgId;
+ uint64_t requestId = pParam->requestId;
+ tmq_t* tmq = taosAcquireRef(tmqMgmt.rsetId, refId);
if (tmq == NULL) {
code = TSDB_CODE_TMQ_CONSUMER_CLOSED;
goto FAIL;
@@ -1354,7 +1366,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) {
goto FAIL;
}
- if(code != 0){
+ if (code != 0) {
goto END;
}
@@ -1363,7 +1375,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) {
if (msgEpoch < clientEpoch) {
// do not write into queue since updating epoch reset
tscWarn("consumer:0x%" PRIx64
- " msg discard from vgId:%d since from earlier epoch, rsp epoch %d, current epoch %d, reqId:0x%" PRIx64,
+ " msg discard from vgId:%d since from earlier epoch, rsp epoch %d, current epoch %d, reqId:0x%" PRIx64,
tmq->consumerId, vgId, msgEpoch, clientEpoch, requestId);
code = -1;
goto END;
@@ -1416,10 +1428,10 @@ END:
taosReleaseRef(tmqMgmt.rsetId, refId);
FAIL:
- if(tmq) tsem_post(&tmq->rspSem);
+ if (tmq) tsem_post(&tmq->rspSem);
taosMemoryFree(pParam);
- if(pMsg) taosMemoryFreeClear(pMsg->pData);
- if(pMsg) taosMemoryFreeClear(pMsg->pEpSet);
+ if (pMsg) taosMemoryFreeClear(pMsg->pData);
+ if (pMsg) taosMemoryFreeClear(pMsg->pEpSet);
return code;
}
@@ -1456,7 +1468,8 @@ static void initClientTopicFromRsp(SMqClientTopic* pTopic, SMqSubTopicEp* pTopic
STqOffsetVal offsetNew = {0};
offsetNew.type = tmq->resetOffsetCfg;
- tscInfo("consumer:0x%" PRIx64 ", update topic:%s, new numOfVgs:%d, num:%d, port:%d", tmq->consumerId, pTopic->topicName, vgNumGet, pVgEp->epSet.numOfEps,pVgEp->epSet.eps[pVgEp->epSet.inUse].port);
+ tscInfo("consumer:0x%" PRIx64 ", update topic:%s, new numOfVgs:%d, num:%d, port:%d", tmq->consumerId,
+ pTopic->topicName, vgNumGet, pVgEp->epSet.numOfEps, pVgEp->epSet.eps[pVgEp->epSet.inUse].port);
SMqClientVg clientVg = {
.pollCnt = 0,
@@ -1495,9 +1508,9 @@ static bool doUpdateLocalEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp)
int32_t topicNumGet = taosArrayGetSize(pRsp->topics);
if (epoch < tmq->epoch || (epoch == tmq->epoch && topicNumGet == 0)) {
- tscInfo("consumer:0x%" PRIx64 " no update ep epoch from %d to epoch %d, incoming topics:%d",
- tmq->consumerId, tmq->epoch, epoch, topicNumGet);
- if(atomic_load_8(&tmq->status) == TMQ_CONSUMER_STATUS__RECOVER){
+ tscInfo("consumer:0x%" PRIx64 " no update ep epoch from %d to epoch %d, incoming topics:%d", tmq->consumerId,
+ tmq->epoch, epoch, topicNumGet);
+ if (atomic_load_8(&tmq->status) == TMQ_CONSUMER_STATUS__RECOVER) {
atomic_store_8(&tmq->status, TMQ_CONSUMER_STATUS__READY);
}
return false;
@@ -1533,10 +1546,12 @@ static bool doUpdateLocalEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp)
char buf[TSDB_OFFSET_LEN] = {0};
tFormatOffset(buf, TSDB_OFFSET_LEN, &pVgCur->offsetInfo.endOffset);
tscInfo("consumer:0x%" PRIx64 ", epoch:%d vgId:%d vgKey:%s, offset:%s", tmq->consumerId, epoch, pVgCur->vgId,
- vgKey, buf);
+ vgKey, buf);
- SVgroupSaveInfo info = {.currentOffset = pVgCur->offsetInfo.endOffset, .seekOffset = pVgCur->offsetInfo.beginOffset,
- .commitOffset = pVgCur->offsetInfo.committedOffset, .numOfRows = pVgCur->numOfRows,
+ SVgroupSaveInfo info = {.currentOffset = pVgCur->offsetInfo.endOffset,
+ .seekOffset = pVgCur->offsetInfo.beginOffset,
+ .commitOffset = pVgCur->offsetInfo.committedOffset,
+ .numOfRows = pVgCur->numOfRows,
.vgStatus = pVgCur->vgStatus};
taosHashPut(pVgOffsetHashMap, vgKey, strlen(vgKey), &info, sizeof(SVgroupSaveInfo));
}
@@ -1616,16 +1631,16 @@ SMqRspObj* tmqBuildRspFromWrapper(SMqPollRspWrapper* pWrapper, SMqClientVg* pVg,
pRspObj->rsp.withSchema = true;
pRspObj->rsp.blockSchema = taosArrayInit(pRspObj->rsp.blockNum, sizeof(void*));
}
- // extract the rows in this data packet
+ // extract the rows in this data packet
for (int32_t i = 0; i < pRspObj->rsp.blockNum; ++i) {
SRetrieveTableRspForTmq* pRetrieve = (SRetrieveTableRspForTmq*)taosArrayGetP(pRspObj->rsp.blockData, i);
- int64_t rows = htobe64(pRetrieve->numOfRows);
+ int64_t rows = htobe64(pRetrieve->numOfRows);
pVg->numOfRows += rows;
(*numOfRows) += rows;
- if (needTransformSchema) { //withSchema is false if subscribe subquery, true if subscribe db or stable
- SSchemaWrapper *schema = tCloneSSchemaWrapper(&pWrapper->topicHandle->schema);
- if(schema){
+ if (needTransformSchema) { // withSchema is false if subscribe subquery, true if subscribe db or stable
+ SSchemaWrapper* schema = tCloneSSchemaWrapper(&pWrapper->topicHandle->schema);
+ if (schema) {
taosArrayPush(pRspObj->rsp.blockSchema, &schema);
}
}
@@ -1649,7 +1664,7 @@ SMqTaosxRspObj* tmqBuildTaosxRspFromWrapper(SMqPollRspWrapper* pWrapper, SMqClie
// extract the rows in this data packet
for (int32_t i = 0; i < pRspObj->rsp.blockNum; ++i) {
SRetrieveTableRspForTmq* pRetrieve = (SRetrieveTableRspForTmq*)taosArrayGetP(pRspObj->rsp.blockData, i);
- int64_t rows = htobe64(pRetrieve->numOfRows);
+ int64_t rows = htobe64(pRetrieve->numOfRows);
pVg->numOfRows += rows;
(*numOfRows) += rows;
}
@@ -1657,15 +1672,15 @@ SMqTaosxRspObj* tmqBuildTaosxRspFromWrapper(SMqPollRspWrapper* pWrapper, SMqClie
}
static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* pVg, int64_t timeout) {
- SMqPollReq req = {0};
- char* msg = NULL;
+ SMqPollReq req = {0};
+ char* msg = NULL;
SMqPollCbParam* pParam = NULL;
- SMsgSendInfo* sendInfo = NULL;
- int code = 0;
+ SMsgSendInfo* sendInfo = NULL;
+ int code = 0;
tmqBuildConsumeReqImpl(&req, pTmq, timeout, pTopic, pVg);
int32_t msgSize = tSerializeSMqPollReq(NULL, 0, &req);
- if (msgSize < 0){
+ if (msgSize < 0) {
code = TSDB_CODE_INVALID_MSG;
goto FAIL;
}
@@ -1709,14 +1724,14 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p
char offsetFormatBuf[TSDB_OFFSET_LEN] = {0};
tFormatOffset(offsetFormatBuf, tListLen(offsetFormatBuf), &pVg->offsetInfo.endOffset);
code = asyncSendMsgToServer(pTmq->pTscObj->pAppInfo->pTransporter, &pVg->epSet, &transporterId, sendInfo);
- tscDebug("consumer:0x%" PRIx64 " send poll to %s vgId:%d, code:%d, epoch %d, req:%s, reqId:0x%" PRIx64, pTmq->consumerId,
- pTopic->topicName, pVg->vgId, code, pTmq->epoch, offsetFormatBuf, req.reqId);
- if(code != 0){
+ tscDebug("consumer:0x%" PRIx64 " send poll to %s vgId:%d, code:%d, epoch %d, req:%s, reqId:0x%" PRIx64,
+ pTmq->consumerId, pTopic->topicName, pVg->vgId, code, pTmq->epoch, offsetFormatBuf, req.reqId);
+ if (code != 0) {
goto FAIL;
}
pVg->pollCnt++;
- pVg->seekUpdated = false; // reset this flag.
+ pVg->seekUpdated = false; // reset this flag.
pTmq->pollCnt++;
return 0;
@@ -1727,7 +1742,7 @@ FAIL:
// broadcast the poll request to all related vnodes
static int32_t tmqPollImpl(tmq_t* tmq, int64_t timeout) {
- if(atomic_load_8(&tmq->status) == TMQ_CONSUMER_STATUS__RECOVER){
+ if (atomic_load_8(&tmq->status) == TMQ_CONSUMER_STATUS__RECOVER) {
return 0;
}
int32_t code = 0;
@@ -1739,7 +1754,7 @@ 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){
+ if (pTopic->noPrivilege) {
tscDebug("consumer:0x%" PRIx64 " has no privilegr for topic:%s", tmq->consumerId, pTopic->topicName);
continue;
}
@@ -1751,9 +1766,10 @@ static int32_t tmqPollImpl(tmq_t* tmq, int64_t timeout) {
continue;
}
- if (tmq->replayEnable && taosGetTimestampMs() - pVg->blockReceiveTs < pVg->blockSleepForReplay) { // less than 10ms
- tscTrace("consumer:0x%" PRIx64 " epoch %d, vgId:%d idle for %" PRId64 "ms before start next poll when replay", tmq->consumerId,
- tmq->epoch, pVg->vgId, pVg->blockSleepForReplay);
+ if (tmq->replayEnable &&
+ taosGetTimestampMs() - pVg->blockReceiveTs < pVg->blockSleepForReplay) { // less than 10ms
+ tscTrace("consumer:0x%" PRIx64 " epoch %d, vgId:%d idle for %" PRId64 "ms before start next poll when replay",
+ tmq->consumerId, tmq->epoch, pVg->vgId, pVg->blockSleepForReplay);
continue;
}
@@ -1779,13 +1795,14 @@ end:
return code;
}
-static void updateVgInfo(SMqClientVg* pVg, STqOffsetVal* reqOffset, STqOffsetVal* rspOffset, int64_t sver, int64_t ever, int64_t consumerId, bool hasData){
+static void updateVgInfo(SMqClientVg* pVg, STqOffsetVal* reqOffset, STqOffsetVal* rspOffset, int64_t sver, int64_t ever,
+ int64_t consumerId, bool hasData) {
if (!pVg->seekUpdated) {
- tscDebug("consumer:0x%" PRIx64" local offset is update, since seekupdate not set", consumerId);
- if(hasData) pVg->offsetInfo.beginOffset = *reqOffset;
+ tscDebug("consumer:0x%" PRIx64 " local offset is update, since seekupdate not set", consumerId);
+ if (hasData) pVg->offsetInfo.beginOffset = *reqOffset;
pVg->offsetInfo.endOffset = *rspOffset;
} else {
- tscDebug("consumer:0x%" PRIx64" local offset is NOT update, since seekupdate is set", consumerId);
+ tscDebug("consumer:0x%" PRIx64 " local offset is NOT update, since seekupdate is set", consumerId);
}
// update the status
@@ -1820,17 +1837,19 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) {
tscDebug("consumer:0x%" PRIx64 " wait for the re-balance, set status to be RECOVER", tmq->consumerId);
} else if (pRspWrapper->code == TSDB_CODE_TQ_NO_COMMITTED_OFFSET) {
terrno = pRspWrapper->code;
- tscError("consumer:0x%" PRIx64 " unexpected rsp from poll, code:%s", tmq->consumerId, tstrerror(pRspWrapper->code));
+ tscError("consumer:0x%" PRIx64 " unexpected rsp from poll, code:%s", tmq->consumerId,
+ tstrerror(pRspWrapper->code));
taosFreeQitem(pRspWrapper);
return NULL;
- } else{
- if(pRspWrapper->code == TSDB_CODE_VND_INVALID_VGROUP_ID){ // for vnode transform
+ } else {
+ if (pRspWrapper->code == TSDB_CODE_VND_INVALID_VGROUP_ID) { // for vnode transform
askEp(tmq, NULL, false, true);
}
- tscError("consumer:0x%" PRIx64 " msg from vgId:%d discarded, since %s", tmq->consumerId, pollRspWrapper->vgId, tstrerror(pRspWrapper->code));
+ tscError("consumer:0x%" PRIx64 " msg from vgId:%d discarded, since %s", tmq->consumerId, pollRspWrapper->vgId,
+ tstrerror(pRspWrapper->code));
taosWLockLatch(&tmq->lock);
SMqClientVg* pVg = getVgInfo(tmq, pollRspWrapper->topicName, pollRspWrapper->vgId);
- if(pVg) pVg->emptyBlockReceiveTs = taosGetTimestampMs();
+ if (pVg) pVg->emptyBlockReceiveTs = taosGetTimestampMs();
taosWUnLockLatch(&tmq->lock);
}
setVgIdle(tmq, pollRspWrapper->topicName, pollRspWrapper->vgId);
@@ -1846,7 +1865,7 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) {
SMqClientVg* pVg = getVgInfo(tmq, pollRspWrapper->topicName, pollRspWrapper->vgId);
pollRspWrapper->vgHandle = pVg;
pollRspWrapper->topicHandle = getTopicInfo(tmq, pollRspWrapper->topicName);
- if(pollRspWrapper->vgHandle == NULL || pollRspWrapper->topicHandle == NULL){
+ if (pollRspWrapper->vgHandle == NULL || pollRspWrapper->topicHandle == NULL) {
tscError("consumer:0x%" PRIx64 " get vg or topic error, topic:%s vgId:%d", tmq->consumerId,
pollRspWrapper->topicName, pollRspWrapper->vgId);
taosWUnLockLatch(&tmq->lock);
@@ -1861,7 +1880,8 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) {
pVg->epSet = *pollRspWrapper->pEpset;
}
- updateVgInfo(pVg, &pDataRsp->reqOffset, &pDataRsp->rspOffset, pDataRsp->head.walsver, pDataRsp->head.walever, tmq->consumerId, pDataRsp->blockNum != 0);
+ updateVgInfo(pVg, &pDataRsp->reqOffset, &pDataRsp->rspOffset, pDataRsp->head.walsver, pDataRsp->head.walever,
+ tmq->consumerId, pDataRsp->blockNum != 0);
char buf[TSDB_OFFSET_LEN] = {0};
tFormatOffset(buf, TSDB_OFFSET_LEN, &pDataRsp->rspOffset);
@@ -1878,10 +1898,10 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) {
SMqRspObj* pRsp = tmqBuildRspFromWrapper(pollRspWrapper, pVg, &numOfRows);
tmq->totalRows += numOfRows;
pVg->emptyBlockReceiveTs = 0;
- if(tmq->replayEnable){
+ if (tmq->replayEnable) {
pVg->blockReceiveTs = taosGetTimestampMs();
pVg->blockSleepForReplay = pRsp->rsp.sleepTime;
- if(pVg->blockSleepForReplay > 0){
+ if (pVg->blockSleepForReplay > 0) {
int64_t* pRefId1 = taosMemoryMalloc(sizeof(int64_t));
*pRefId1 = tmq->refId;
taosTmrStart(tmqReplayTask, pVg->blockSleepForReplay, pRefId1, tmqMgmt.timer);
@@ -1897,7 +1917,7 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) {
}
} else {
tscInfo("consumer:0x%" PRIx64 " vgId:%d msg discard since epoch mismatch: msg epoch %d, consumer epoch %d",
- tmq->consumerId, pollRspWrapper->vgId, pDataRsp->head.epoch, consumerEpoch);
+ tmq->consumerId, pollRspWrapper->vgId, pDataRsp->head.epoch, consumerEpoch);
setVgIdle(tmq, pollRspWrapper->topicName, pollRspWrapper->vgId);
tmqFreeRspWrapper(pRspWrapper);
taosFreeQitem(pRspWrapper);
@@ -1913,14 +1933,15 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) {
SMqClientVg* pVg = getVgInfo(tmq, pollRspWrapper->topicName, pollRspWrapper->vgId);
pollRspWrapper->vgHandle = pVg;
pollRspWrapper->topicHandle = getTopicInfo(tmq, pollRspWrapper->topicName);
- if(pollRspWrapper->vgHandle == NULL || pollRspWrapper->topicHandle == NULL){
+ if (pollRspWrapper->vgHandle == NULL || pollRspWrapper->topicHandle == NULL) {
tscError("consumer:0x%" PRIx64 " get vg or topic error, topic:%s vgId:%d", tmq->consumerId,
pollRspWrapper->topicName, pollRspWrapper->vgId);
taosWUnLockLatch(&tmq->lock);
return NULL;
}
- updateVgInfo(pVg, &pollRspWrapper->metaRsp.rspOffset, &pollRspWrapper->metaRsp.rspOffset, pollRspWrapper->metaRsp.head.walsver, pollRspWrapper->metaRsp.head.walever, tmq->consumerId, true);
+ updateVgInfo(pVg, &pollRspWrapper->metaRsp.rspOffset, &pollRspWrapper->metaRsp.rspOffset,
+ pollRspWrapper->metaRsp.head.walsver, pollRspWrapper->metaRsp.head.walever, tmq->consumerId, true);
// build rsp
SMqMetaRspObj* pRsp = tmqBuildMetaRspFromWrapper(pollRspWrapper);
taosFreeQitem(pRspWrapper);
@@ -1928,7 +1949,7 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) {
return pRsp;
} else {
tscInfo("consumer:0x%" PRIx64 " vgId:%d msg discard since epoch mismatch: msg epoch %d, consumer epoch %d",
- tmq->consumerId, pollRspWrapper->vgId, pollRspWrapper->metaRsp.head.epoch, consumerEpoch);
+ tmq->consumerId, pollRspWrapper->vgId, pollRspWrapper->metaRsp.head.epoch, consumerEpoch);
setVgIdle(tmq, pollRspWrapper->topicName, pollRspWrapper->vgId);
tmqFreeRspWrapper(pRspWrapper);
taosFreeQitem(pRspWrapper);
@@ -1942,14 +1963,16 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) {
SMqClientVg* pVg = getVgInfo(tmq, pollRspWrapper->topicName, pollRspWrapper->vgId);
pollRspWrapper->vgHandle = pVg;
pollRspWrapper->topicHandle = getTopicInfo(tmq, pollRspWrapper->topicName);
- if(pollRspWrapper->vgHandle == NULL || pollRspWrapper->topicHandle == NULL){
+ if (pollRspWrapper->vgHandle == NULL || pollRspWrapper->topicHandle == NULL) {
tscError("consumer:0x%" PRIx64 " get vg or topic error, topic:%s vgId:%d", tmq->consumerId,
pollRspWrapper->topicName, pollRspWrapper->vgId);
taosWUnLockLatch(&tmq->lock);
return NULL;
}
- updateVgInfo(pVg, &pollRspWrapper->taosxRsp.reqOffset, &pollRspWrapper->taosxRsp.rspOffset, pollRspWrapper->taosxRsp.head.walsver, pollRspWrapper->taosxRsp.head.walever, tmq->consumerId, pollRspWrapper->taosxRsp.blockNum != 0);
+ updateVgInfo(pVg, &pollRspWrapper->taosxRsp.reqOffset, &pollRspWrapper->taosxRsp.rspOffset,
+ pollRspWrapper->taosxRsp.head.walsver, pollRspWrapper->taosxRsp.head.walever, tmq->consumerId,
+ pollRspWrapper->taosxRsp.blockNum != 0);
if (pollRspWrapper->taosxRsp.blockNum == 0) {
tscDebug("consumer:0x%" PRIx64 " taosx empty block received, vgId:%d, vg total:%" PRId64 ", reqId:0x%" PRIx64,
@@ -1967,7 +1990,7 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) {
void* pRsp = NULL;
int64_t numOfRows = 0;
if (pollRspWrapper->taosxRsp.createTableNum == 0) {
- tscError("consumer:0x%" PRIx64" createTableNum should > 0 if rsp type is data_meta", tmq->consumerId);
+ tscError("consumer:0x%" PRIx64 " createTableNum should > 0 if rsp type is data_meta", tmq->consumerId);
} else {
pRsp = tmqBuildTaosxRspFromWrapper(pollRspWrapper, pVg, &numOfRows);
}
@@ -1977,7 +2000,7 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) {
char buf[TSDB_OFFSET_LEN] = {0};
tFormatOffset(buf, TSDB_OFFSET_LEN, &pVg->offsetInfo.endOffset);
tscDebug("consumer:0x%" PRIx64 " process taosx poll rsp, vgId:%d, offset:%s, blocks:%d, rows:%" PRId64
- ", vg total:%" PRId64 ", total:%" PRId64 ", reqId:0x%" PRIx64,
+ ", vg total:%" PRId64 ", total:%" PRId64 ", reqId:0x%" PRIx64,
tmq->consumerId, pVg->vgId, buf, pollRspWrapper->dataRsp.blockNum, numOfRows, pVg->numOfRows,
tmq->totalRows, pollRspWrapper->reqId);
@@ -1986,12 +2009,12 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) {
return pRsp;
} else {
tscInfo("consumer:0x%" PRIx64 " vgId:%d msg discard since epoch mismatch: msg epoch %d, consumer epoch %d",
- tmq->consumerId, pollRspWrapper->vgId, pollRspWrapper->taosxRsp.head.epoch, consumerEpoch);
+ tmq->consumerId, pollRspWrapper->vgId, pollRspWrapper->taosxRsp.head.epoch, consumerEpoch);
setVgIdle(tmq, pollRspWrapper->topicName, pollRspWrapper->vgId);
tmqFreeRspWrapper(pRspWrapper);
taosFreeQitem(pRspWrapper);
}
- } else if(pRspWrapper->tmqRspType == TMQ_MSG_TYPE__EP_RSP){
+ } else if (pRspWrapper->tmqRspType == TMQ_MSG_TYPE__EP_RSP) {
tscDebug("consumer:0x%" PRIx64 " ep msg received", tmq->consumerId);
SMqAskEpRspWrapper* pEpRspWrapper = (SMqAskEpRspWrapper*)pRspWrapper;
SMqAskEpRsp* rspMsg = &pEpRspWrapper->msg;
@@ -2005,7 +2028,7 @@ static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) {
}
TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) {
- if(tmq == NULL) return NULL;
+ if (tmq == NULL) return NULL;
void* rspObj = NULL;
int64_t startTime = taosGetTimestampMs();
@@ -2021,7 +2044,7 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) {
}
while (1) {
- if(atomic_load_8(&tmq->status) != TMQ_CONSUMER_STATUS__RECOVER){
+ if (atomic_load_8(&tmq->status) != TMQ_CONSUMER_STATUS__RECOVER) {
break;
}
tscInfo("consumer:0x%" PRIx64 " tmq status is recover", tmq->consumerId);
@@ -2091,7 +2114,7 @@ static void displayConsumeStatistics(tmq_t* pTmq) {
}
int32_t tmq_consumer_close(tmq_t* tmq) {
- if(tmq == NULL) return TSDB_CODE_INVALID_PARA;
+ if (tmq == NULL) return TSDB_CODE_INVALID_PARA;
tscInfo("consumer:0x%" PRIx64 " start to close consumer, status:%d", tmq->consumerId, tmq->status);
displayConsumeStatistics(tmq);
@@ -2138,7 +2161,7 @@ const char* tmq_err2str(int32_t err) {
}
tmq_res_t tmq_get_res_type(TAOS_RES* res) {
- if (res == NULL){
+ if (res == NULL) {
return TMQ_RES_INVALID;
}
if (TD_RES_TMQ(res)) {
@@ -2153,7 +2176,7 @@ tmq_res_t tmq_get_res_type(TAOS_RES* res) {
}
const char* tmq_get_topic_name(TAOS_RES* res) {
- if (res == NULL){
+ if (res == NULL) {
return NULL;
}
if (TD_RES_TMQ(res)) {
@@ -2171,7 +2194,7 @@ const char* tmq_get_topic_name(TAOS_RES* res) {
}
const char* tmq_get_db_name(TAOS_RES* res) {
- if (res == NULL){
+ if (res == NULL) {
return NULL;
}
@@ -2190,7 +2213,7 @@ const char* tmq_get_db_name(TAOS_RES* res) {
}
int32_t tmq_get_vgroup_id(TAOS_RES* res) {
- if (res == NULL){
+ if (res == NULL) {
return -1;
}
if (TD_RES_TMQ(res)) {
@@ -2208,15 +2231,15 @@ int32_t tmq_get_vgroup_id(TAOS_RES* res) {
}
int64_t tmq_get_vgroup_offset(TAOS_RES* res) {
- if (res == NULL){
+ if (res == NULL) {
return TSDB_CODE_INVALID_PARA;
}
if (TD_RES_TMQ(res)) {
- SMqRspObj* pRspObj = (SMqRspObj*) res;
+ SMqRspObj* pRspObj = (SMqRspObj*)res;
STqOffsetVal* pOffset = &pRspObj->rsp.reqOffset;
if (pOffset->type == TMQ_OFFSET__LOG) {
return pRspObj->rsp.reqOffset.version;
- }else{
+ } else {
tscError("invalid offset type:%d", pOffset->type);
}
} else if (TD_RES_TMQ_META(res)) {
@@ -2225,11 +2248,11 @@ int64_t tmq_get_vgroup_offset(TAOS_RES* res) {
return pRspObj->metaRsp.rspOffset.version;
}
} else if (TD_RES_TMQ_METADATA(res)) {
- SMqTaosxRspObj* pRspObj = (SMqTaosxRspObj*) res;
+ SMqTaosxRspObj* pRspObj = (SMqTaosxRspObj*)res;
if (pRspObj->rsp.reqOffset.type == TMQ_OFFSET__LOG) {
return pRspObj->rsp.reqOffset.version;
}
- } else{
+ } else {
tscError("invalid tmq type:%d", *(int8_t*)res);
}
@@ -2238,7 +2261,7 @@ int64_t tmq_get_vgroup_offset(TAOS_RES* res) {
}
const char* tmq_get_table_name(TAOS_RES* res) {
- if (res == NULL){
+ if (res == NULL) {
return NULL;
}
if (TD_RES_TMQ(res)) {
@@ -2262,7 +2285,7 @@ const char* tmq_get_table_name(TAOS_RES* res) {
void tmq_commit_async(tmq_t* tmq, const TAOS_RES* pRes, tmq_commit_cb* cb, void* param) {
if (tmq == NULL) {
tscError("invalid tmq handle, null");
- if(cb != NULL) {
+ if (cb != NULL) {
cb(tmq, TSDB_CODE_INVALID_PARA, param);
}
return;
@@ -2274,8 +2297,8 @@ void tmq_commit_async(tmq_t* tmq, const TAOS_RES* pRes, tmq_commit_cb* cb, void*
}
}
-static void commitCallBackFn(tmq_t *UNUSED_PARAM(tmq), int32_t code, void* param) {
- SSyncCommitInfo* pInfo = (SSyncCommitInfo*) param;
+static void commitCallBackFn(tmq_t* UNUSED_PARAM(tmq), int32_t code, void* param) {
+ SSyncCommitInfo* pInfo = (SSyncCommitInfo*)param;
pInfo->code = code;
tsem_post(&pInfo->sem);
}
@@ -2309,34 +2332,35 @@ int32_t tmq_commit_sync(tmq_t* tmq, const TAOS_RES* pRes) {
}
// wal range will be ok after calling tmq_get_topic_assignment or poll interface
-static int32_t checkWalRange(SVgOffsetInfo* offset, int64_t value){
+static int32_t checkWalRange(SVgOffsetInfo* offset, int64_t value) {
if (offset->walVerBegin == -1 || offset->walVerEnd == -1) {
tscError("Assignment or poll interface need to be called first");
return TSDB_CODE_TMQ_NEED_INITIALIZED;
}
if (value != -1 && (value < offset->walVerBegin || value > offset->walVerEnd)) {
- tscError("invalid seek params, offset:%" PRId64 ", valid range:[%" PRId64 ", %" PRId64 "]", value, offset->walVerBegin, offset->walVerEnd);
+ tscError("invalid seek params, offset:%" PRId64 ", valid range:[%" PRId64 ", %" PRId64 "]", value,
+ offset->walVerBegin, offset->walVerEnd);
return TSDB_CODE_TMQ_VERSION_OUT_OF_RANGE;
}
return 0;
}
-int32_t tmq_commit_offset_sync(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset){
+int32_t tmq_commit_offset_sync(tmq_t* tmq, const char* pTopicName, int32_t vgId, int64_t offset) {
if (tmq == NULL || pTopicName == NULL) {
tscError("invalid tmq handle, null");
return TSDB_CODE_INVALID_PARA;
}
int32_t accId = tmq->pTscObj->acctId;
- char tname[TSDB_TOPIC_FNAME_LEN] = {0};
+ char tname[TSDB_TOPIC_FNAME_LEN] = {0};
sprintf(tname, "%d.%s", accId, pTopicName);
taosWLockLatch(&tmq->lock);
SMqClientVg* pVg = NULL;
- int32_t code = getClientVg(tmq, tname, vgId, &pVg);
- if(code != 0){
+ int32_t code = getClientVg(tmq, tname, vgId, &pVg);
+ if (code != 0) {
taosWUnLockLatch(&tmq->lock);
return code;
}
@@ -2353,7 +2377,7 @@ int32_t tmq_commit_offset_sync(tmq_t *tmq, const char *pTopicName, int32_t vgId,
SSyncCommitInfo* pInfo = taosMemoryMalloc(sizeof(SSyncCommitInfo));
if (pInfo == NULL) {
- tscError("consumer:0x%"PRIx64" failed to prepare seek operation", tmq->consumerId);
+ tscError("consumer:0x%" PRIx64 " failed to prepare seek operation", tmq->consumerId);
return TSDB_CODE_OUT_OF_MEMORY;
}
@@ -2361,36 +2385,38 @@ int32_t tmq_commit_offset_sync(tmq_t *tmq, const char *pTopicName, int32_t vgId,
pInfo->code = 0;
code = asyncCommitOffset(tmq, tname, vgId, &offsetVal, commitCallBackFn, pInfo);
- if(code == 0){
+ if (code == 0) {
tsem_wait(&pInfo->sem);
code = pInfo->code;
}
- if(code == TSDB_CODE_TMQ_SAME_COMMITTED_VALUE) code = TSDB_CODE_SUCCESS;
+ if (code == TSDB_CODE_TMQ_SAME_COMMITTED_VALUE) code = TSDB_CODE_SUCCESS;
tsem_destroy(&pInfo->sem);
taosMemoryFree(pInfo);
- tscInfo("consumer:0x%" PRIx64 " sync send commit to vgId:%d, offset:%" PRId64" code:%s", tmq->consumerId, vgId, offset, tstrerror(code));
+ tscInfo("consumer:0x%" PRIx64 " sync send commit to vgId:%d, offset:%" PRId64 " code:%s", tmq->consumerId, vgId,
+ offset, tstrerror(code));
return code;
}
-void tmq_commit_offset_async(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset, tmq_commit_cb *cb, void *param){
+void tmq_commit_offset_async(tmq_t* tmq, const char* pTopicName, int32_t vgId, int64_t offset, tmq_commit_cb* cb,
+ void* param) {
int32_t code = 0;
if (tmq == NULL || pTopicName == NULL) {
tscError("invalid tmq handle, null");
code = TSDB_CODE_INVALID_PARA;
- goto end;
+ goto end;
}
int32_t accId = tmq->pTscObj->acctId;
- char tname[TSDB_TOPIC_FNAME_LEN] = {0};
+ char tname[TSDB_TOPIC_FNAME_LEN] = {0};
sprintf(tname, "%d.%s", accId, pTopicName);
taosWLockLatch(&tmq->lock);
SMqClientVg* pVg = NULL;
code = getClientVg(tmq, tname, vgId, &pVg);
- if(code != 0){
+ if (code != 0) {
taosWUnLockLatch(&tmq->lock);
goto end;
}
@@ -2407,11 +2433,12 @@ void tmq_commit_offset_async(tmq_t *tmq, const char *pTopicName, int32_t vgId, i
code = asyncCommitOffset(tmq, tname, vgId, &offsetVal, cb, param);
- tscInfo("consumer:0x%" PRIx64 " async send commit to vgId:%d, offset:%" PRId64" code:%s", tmq->consumerId, vgId, offset, tstrerror(code));
+ tscInfo("consumer:0x%" PRIx64 " async send commit to vgId:%d, offset:%" PRId64 " code:%s", tmq->consumerId, vgId,
+ offset, tstrerror(code));
end:
- if(code != 0 && cb != NULL){
- if(code == TSDB_CODE_TMQ_SAME_COMMITTED_VALUE) code = TSDB_CODE_SUCCESS;
+ if (code != 0 && cb != NULL) {
+ if (code == TSDB_CODE_TMQ_SAME_COMMITTED_VALUE) code = TSDB_CODE_SUCCESS;
cb(tmq, code, param);
}
}
@@ -2431,14 +2458,13 @@ int32_t askEpCb(void* param, SDataBuf* pMsg, int32_t code) {
SMqRspHead* head = pMsg->pData;
int32_t epoch = atomic_load_32(&tmq->epoch);
- tscInfo("consumer:0x%" PRIx64 ", recv ep, msg epoch %d, current epoch %d", tmq->consumerId,
- head->epoch, epoch);
- if(pParam->sync){
+ tscInfo("consumer:0x%" PRIx64 ", recv ep, msg epoch %d, current epoch %d", tmq->consumerId, head->epoch, epoch);
+ if (pParam->sync) {
SMqAskEpRsp rsp = {0};
tDecodeSMqAskEpRsp(POINTER_SHIFT(pMsg->pData, sizeof(SMqRspHead)), &rsp);
doUpdateLocalEp(tmq, head->epoch, &rsp);
tDeleteSMqAskEpRsp(&rsp);
- }else{
+ } else {
SMqAskEpRspWrapper* pWrapper = taosAllocateQitem(sizeof(SMqAskEpRspWrapper), DEF_QITEM, 0);
if (pWrapper == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
@@ -2457,7 +2483,7 @@ END:
taosReleaseRef(tmqMgmt.rsetId, pParam->refId);
FAIL:
- if(pParam->sync){
+ if (pParam->sync) {
SAskEpInfo* pInfo = pParam->pParam;
pInfo->code = code;
tsem_post(&pInfo->sem);
@@ -2485,11 +2511,11 @@ int32_t syncAskEp(tmq_t* pTmq) {
void askEp(tmq_t* pTmq, void* param, bool sync, bool updateEpSet) {
SMqAskEpReq req = {0};
req.consumerId = pTmq->consumerId;
- req.epoch = updateEpSet ? -1 :pTmq->epoch;
+ req.epoch = updateEpSet ? -1 : pTmq->epoch;
strcpy(req.cgroup, pTmq->groupId);
- int code = 0;
+ int code = 0;
SMqAskEpCbParam* pParam = NULL;
- void* pReq = NULL;
+ void* pReq = NULL;
int32_t tlen = tSerializeSMqAskEpReq(NULL, 0, &req);
if (tlen < 0) {
@@ -2541,7 +2567,7 @@ void askEp(tmq_t* pTmq, void* param, bool sync, bool updateEpSet) {
int64_t transporterId = 0;
code = asyncSendMsgToServer(pTmq->pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, sendInfo);
- if(code == 0){
+ if (code == 0) {
return;
}
@@ -2566,7 +2592,7 @@ int32_t tmqCommitDone(SMqCommitCbParamSet* pParamSet) {
}
// if no more waiting rsp
- if(pParamSet->callbackFn != NULL){
+ if (pParamSet->callbackFn != NULL) {
pParamSet->callbackFn(tmq, pParamSet->code, pParamSet->userParam);
}
@@ -2578,10 +2604,12 @@ int32_t tmqCommitDone(SMqCommitCbParamSet* pParamSet) {
void commitRspCountDown(SMqCommitCbParamSet* pParamSet, int64_t consumerId, const char* pTopic, int32_t vgId) {
int32_t waitingRspNum = atomic_sub_fetch_32(&pParamSet->waitingRspNum, 1);
if (waitingRspNum == 0) {
- tscInfo("consumer:0x%" PRIx64 " topic:%s vgId:%d all commit-rsp received, commit completed", consumerId, pTopic, vgId);
+ tscInfo("consumer:0x%" PRIx64 " topic:%s vgId:%d all commit-rsp received, commit completed", consumerId, pTopic,
+ vgId);
tmqCommitDone(pParamSet);
} else {
- tscInfo("consumer:0x%" PRIx64 " topic:%s vgId:%d commit-rsp received, remain:%d", consumerId, pTopic, vgId, waitingRspNum);
+ tscInfo("consumer:0x%" PRIx64 " topic:%s vgId:%d commit-rsp received, remain:%d", consumerId, pTopic, vgId,
+ waitingRspNum);
}
}
@@ -2590,7 +2618,8 @@ SReqResultInfo* tmqGetNextResInfo(TAOS_RES* res, bool convertUcs4) {
pRspObj->resIter++;
if (pRspObj->resIter < pRspObj->rsp.blockNum) {
- SRetrieveTableRspForTmq* pRetrieveTmq = (SRetrieveTableRspForTmq*)taosArrayGetP(pRspObj->rsp.blockData, pRspObj->resIter);
+ SRetrieveTableRspForTmq* pRetrieveTmq =
+ (SRetrieveTableRspForTmq*)taosArrayGetP(pRspObj->rsp.blockData, pRspObj->resIter);
if (pRspObj->rsp.withSchema) {
SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(pRspObj->rsp.blockSchema, pRspObj->resIter);
setResSchemaInfo(&pRspObj->resInfo, pSW->pSchema, pSW->nCols);
@@ -2609,7 +2638,7 @@ SReqResultInfo* tmqGetNextResInfo(TAOS_RES* res, bool convertUcs4) {
// TODO handle the compressed case
pRspObj->resInfo.totalRows += pRspObj->resInfo.numOfRows;
setResultDataPtr(&pRspObj->resInfo, pRspObj->resInfo.fields, pRspObj->resInfo.numOfCols, pRspObj->resInfo.numOfRows,
- convertUcs4);
+ convertUcs4);
return &pRspObj->resInfo;
}
@@ -2619,7 +2648,7 @@ SReqResultInfo* tmqGetNextResInfo(TAOS_RES* res, bool convertUcs4) {
static int32_t tmqGetWalInfoCb(void* param, SDataBuf* pMsg, int32_t code) {
SMqVgWalInfoParam* pParam = param;
- SMqVgCommon* pCommon = pParam->pCommon;
+ SMqVgCommon* pCommon = pParam->pCommon;
int32_t total = atomic_add_fetch_32(&pCommon->numOfRsp, 1);
if (code != TSDB_CODE_SUCCESS) {
@@ -2628,7 +2657,7 @@ static int32_t tmqGetWalInfoCb(void* param, SDataBuf* pMsg, int32_t code) {
pCommon->code = code;
} else {
SMqDataRsp rsp;
- SDecoder decoder;
+ SDecoder decoder;
tDecoderInit(&decoder, POINTER_SHIFT(pMsg->pData, sizeof(SMqRspHead)), pMsg->len - sizeof(SMqRspHead));
tDecodeMqDataRsp(&decoder, &rsp);
tDecoderClear(&decoder);
@@ -2656,7 +2685,7 @@ static int32_t tmqGetWalInfoCb(void* param, SDataBuf* pMsg, int32_t code) {
}
static void destroyCommonInfo(SMqVgCommon* pCommon) {
- if(pCommon == NULL){
+ if (pCommon == NULL) {
return;
}
taosArrayDestroy(pCommon->pList);
@@ -2666,7 +2695,7 @@ static void destroyCommonInfo(SMqVgCommon* pCommon) {
taosMemoryFree(pCommon);
}
-static bool isInSnapshotMode(int8_t type, bool useSnapshot){
+static bool isInSnapshotMode(int8_t type, bool useSnapshot) {
if ((type < TMQ_OFFSET__LOG && useSnapshot) || type > TMQ_OFFSET__LOG) {
return true;
}
@@ -2676,7 +2705,7 @@ static bool isInSnapshotMode(int8_t type, bool useSnapshot){
static int32_t tmCommittedCb(void* param, SDataBuf* pMsg, int32_t code) {
SMqCommittedParam* pParam = param;
- if (code != 0){
+ if (code != 0) {
goto end;
}
if (pMsg) {
@@ -2689,8 +2718,8 @@ static int32_t tmCommittedCb(void* param, SDataBuf* pMsg, int32_t code) {
tDecoderClear(&decoder);
}
- end:
- if(pMsg){
+end:
+ if (pMsg) {
taosMemoryFree(pMsg->pData);
taosMemoryFree(pMsg->pEpSet);
}
@@ -2699,8 +2728,8 @@ static int32_t tmCommittedCb(void* param, SDataBuf* pMsg, int32_t code) {
return 0;
}
-int64_t getCommittedFromServer(tmq_t *tmq, char* tname, int32_t vgId, SEpSet* epSet){
- int32_t code = 0;
+int64_t getCommittedFromServer(tmq_t* tmq, char* tname, int32_t vgId, SEpSet* epSet) {
+ int32_t code = 0;
SMqVgOffset pOffset = {0};
pOffset.consumerId = tmq->consumerId;
@@ -2753,7 +2782,7 @@ int64_t getCommittedFromServer(tmq_t *tmq, char* tname, int32_t vgId, SEpSet* ep
int64_t transporterId = 0;
code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, epSet, &transporterId, sendInfo);
- if(code != 0){
+ if (code != 0) {
taosMemoryFree(buf);
taosMemoryFree(sendInfo);
tsem_destroy(&pParam->sem);
@@ -2763,10 +2792,10 @@ int64_t getCommittedFromServer(tmq_t *tmq, char* tname, int32_t vgId, SEpSet* ep
tsem_wait(&pParam->sem);
code = pParam->code;
- if(code == TSDB_CODE_SUCCESS){
- if(pParam->vgOffset.offset.val.type == TMQ_OFFSET__LOG){
+ if (code == TSDB_CODE_SUCCESS) {
+ if (pParam->vgOffset.offset.val.type == TMQ_OFFSET__LOG) {
code = pParam->vgOffset.offset.val.version;
- }else{
+ } else {
code = TSDB_CODE_TMQ_SNAPSHOT_ERROR;
}
}
@@ -2776,27 +2805,27 @@ int64_t getCommittedFromServer(tmq_t *tmq, char* tname, int32_t vgId, SEpSet* ep
return code;
}
-int64_t tmq_position(tmq_t *tmq, const char *pTopicName, int32_t vgId){
+int64_t tmq_position(tmq_t* tmq, const char* pTopicName, int32_t vgId) {
if (tmq == NULL || pTopicName == NULL) {
tscError("invalid tmq handle, null");
return TSDB_CODE_INVALID_PARA;
}
int32_t accId = tmq->pTscObj->acctId;
- char tname[TSDB_TOPIC_FNAME_LEN] = {0};
+ char tname[TSDB_TOPIC_FNAME_LEN] = {0};
sprintf(tname, "%d.%s", accId, pTopicName);
taosWLockLatch(&tmq->lock);
SMqClientVg* pVg = NULL;
- int32_t code = getClientVg(tmq, tname, vgId, &pVg);
- if(code != 0){
+ int32_t code = getClientVg(tmq, tname, vgId, &pVg);
+ if (code != 0) {
taosWUnLockLatch(&tmq->lock);
return code;
}
SVgOffsetInfo* pOffsetInfo = &pVg->offsetInfo;
- int32_t type = pOffsetInfo->endOffset.type;
+ int32_t type = pOffsetInfo->endOffset.type;
if (isInSnapshotMode(type, tmq->useSnapshot)) {
tscError("consumer:0x%" PRIx64 " offset type:%d not wal version, position error", tmq->consumerId, type);
taosWUnLockLatch(&tmq->lock);
@@ -2808,26 +2837,26 @@ int64_t tmq_position(tmq_t *tmq, const char *pTopicName, int32_t vgId){
taosWUnLockLatch(&tmq->lock);
return code;
}
- SEpSet epSet = pVg->epSet;
+ SEpSet epSet = pVg->epSet;
int64_t begin = pVg->offsetInfo.walVerBegin;
int64_t end = pVg->offsetInfo.walVerEnd;
taosWUnLockLatch(&tmq->lock);
int64_t position = 0;
- if(type == TMQ_OFFSET__LOG){
+ if (type == TMQ_OFFSET__LOG) {
position = pOffsetInfo->endOffset.version;
- }else if(type == TMQ_OFFSET__RESET_EARLIEST || type == TMQ_OFFSET__RESET_LATEST){
+ } else if (type == TMQ_OFFSET__RESET_EARLIEST || type == TMQ_OFFSET__RESET_LATEST) {
code = getCommittedFromServer(tmq, tname, vgId, &epSet);
- if(code == TSDB_CODE_TMQ_NO_COMMITTED){
- if(type == TMQ_OFFSET__RESET_EARLIEST){
+ if (code == TSDB_CODE_TMQ_NO_COMMITTED) {
+ if (type == TMQ_OFFSET__RESET_EARLIEST) {
position = begin;
- } else if(type == TMQ_OFFSET__RESET_LATEST){
+ } else if (type == TMQ_OFFSET__RESET_LATEST) {
position = end;
}
- }else{
+ } else {
position = code;
}
- }else{
+ } else {
tscError("consumer:0x%" PRIx64 " offset type:%d can not be reach here", tmq->consumerId, type);
}
@@ -2835,40 +2864,42 @@ int64_t tmq_position(tmq_t *tmq, const char *pTopicName, int32_t vgId){
return position;
}
-int64_t tmq_committed(tmq_t *tmq, const char *pTopicName, int32_t vgId){
+int64_t tmq_committed(tmq_t* tmq, const char* pTopicName, int32_t vgId) {
if (tmq == NULL || pTopicName == NULL) {
tscError("invalid tmq handle, null");
return TSDB_CODE_INVALID_PARA;
}
int32_t accId = tmq->pTscObj->acctId;
- char tname[TSDB_TOPIC_FNAME_LEN] = {0};
+ char tname[TSDB_TOPIC_FNAME_LEN] = {0};
sprintf(tname, "%d.%s", accId, pTopicName);
taosWLockLatch(&tmq->lock);
SMqClientVg* pVg = NULL;
- int32_t code = getClientVg(tmq, tname, vgId, &pVg);
- if(code != 0){
+ int32_t code = getClientVg(tmq, tname, vgId, &pVg);
+ if (code != 0) {
taosWUnLockLatch(&tmq->lock);
return code;
}
SVgOffsetInfo* pOffsetInfo = &pVg->offsetInfo;
if (isInSnapshotMode(pOffsetInfo->endOffset.type, tmq->useSnapshot)) {
- tscError("consumer:0x%" PRIx64 " offset type:%d not wal version, committed error", tmq->consumerId, pOffsetInfo->endOffset.type);
+ tscError("consumer:0x%" PRIx64 " offset type:%d not wal version, committed error", tmq->consumerId,
+ pOffsetInfo->endOffset.type);
taosWUnLockLatch(&tmq->lock);
return TSDB_CODE_TMQ_SNAPSHOT_ERROR;
}
if (isInSnapshotMode(pOffsetInfo->committedOffset.type, tmq->useSnapshot)) {
- tscError("consumer:0x%" PRIx64 " offset type:%d not wal version, committed error", tmq->consumerId, pOffsetInfo->committedOffset.type);
+ tscError("consumer:0x%" PRIx64 " offset type:%d not wal version, committed error", tmq->consumerId,
+ pOffsetInfo->committedOffset.type);
taosWUnLockLatch(&tmq->lock);
return TSDB_CODE_TMQ_SNAPSHOT_ERROR;
}
int64_t committed = 0;
- if(pOffsetInfo->committedOffset.type == TMQ_OFFSET__LOG){
+ if (pOffsetInfo->committedOffset.type == TMQ_OFFSET__LOG) {
committed = pOffsetInfo->committedOffset.version;
taosWUnLockLatch(&tmq->lock);
goto end;
@@ -2885,7 +2916,7 @@ end:
int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_assignment** assignment,
int32_t* numOfAssignment) {
- if(tmq == NULL || pTopicName == NULL || assignment == NULL || numOfAssignment == NULL){
+ if (tmq == NULL || pTopicName == NULL || assignment == NULL || numOfAssignment == NULL) {
tscError("invalid tmq handle, null");
return TSDB_CODE_INVALID_PARA;
}
@@ -2909,7 +2940,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
*numOfAssignment = taosArrayGetSize(pTopic->vgs);
for (int32_t j = 0; j < (*numOfAssignment); ++j) {
SMqClientVg* pClientVg = taosArrayGet(pTopic->vgs, j);
- int32_t type = pClientVg->offsetInfo.beginOffset.type;
+ int32_t type = pClientVg->offsetInfo.beginOffset.type;
if (isInSnapshotMode(type, tmq->useSnapshot)) {
tscError("consumer:0x%" PRIx64 " offset type:%d not wal version, assignment not allowed", tmq->consumerId, type);
code = TSDB_CODE_TMQ_SNAPSHOT_ERROR;
@@ -2939,8 +2970,8 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
pAssignment->begin = pClientVg->offsetInfo.walVerBegin;
pAssignment->end = pClientVg->offsetInfo.walVerEnd;
pAssignment->vgId = pClientVg->vgId;
- tscInfo("consumer:0x%" PRIx64 " get assignment from local:%d->%" PRId64, tmq->consumerId,
- pAssignment->vgId, pAssignment->currentOffset);
+ tscInfo("consumer:0x%" PRIx64 " get assignment from local:%d->%" PRId64, tmq->consumerId, pAssignment->vgId,
+ pAssignment->currentOffset);
}
if (needFetch) {
@@ -2951,7 +2982,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
goto end;
}
- pCommon->pList= taosArrayInit(4, sizeof(tmq_topic_assignment));
+ pCommon->pList = taosArrayInit(4, sizeof(tmq_topic_assignment));
tsem_init(&pCommon->rsp, 0, 0);
taosThreadMutexInit(&pCommon->mutex, 0);
pCommon->pTopicName = taosStrdup(pTopic->topicName);
@@ -3019,7 +3050,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
tscInfo("consumer:0x%" PRIx64 " %s retrieve wal info vgId:%d, epoch %d, req:%s, reqId:0x%" PRIx64,
tmq->consumerId, pTopic->topicName, pClientVg->vgId, tmq->epoch, offsetFormatBuf, req.reqId);
code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &pClientVg->epSet, &transporterId, sendInfo);
- if(code != 0){
+ if (code != 0) {
taosMemoryFree(pParam);
taosMemoryFree(msg);
goto end;
@@ -3034,7 +3065,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
goto end;
}
int32_t num = taosArrayGetSize(pCommon->pList);
- for(int32_t i = 0; i < num; ++i) {
+ for (int32_t i = 0; i < num; ++i) {
(*assignment)[i] = *(tmq_topic_assignment*)taosArrayGet(pCommon->pList, i);
}
*numOfAssignment = num;
@@ -3042,14 +3073,15 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
for (int32_t j = 0; j < (*numOfAssignment); ++j) {
tmq_topic_assignment* p = &(*assignment)[j];
- for(int32_t i = 0; i < taosArrayGetSize(pTopic->vgs); ++i) {
+ for (int32_t i = 0; i < taosArrayGetSize(pTopic->vgs); ++i) {
SMqClientVg* pClientVg = taosArrayGet(pTopic->vgs, i);
if (pClientVg->vgId != p->vgId) {
continue;
}
SVgOffsetInfo* pOffsetInfo = &pClientVg->offsetInfo;
- tscInfo("consumer:0x%" PRIx64 " %s vgId:%d offset is update to:%"PRId64, tmq->consumerId, pTopic->topicName, p->vgId, p->currentOffset);
+ tscInfo("consumer:0x%" PRIx64 " %s vgId:%d offset is update to:%" PRId64, tmq->consumerId, pTopic->topicName,
+ p->vgId, p->currentOffset);
pOffsetInfo->walVerBegin = p->begin;
pOffsetInfo->walVerEnd = p->end;
@@ -3058,7 +3090,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
}
end:
- if(code != TSDB_CODE_SUCCESS){
+ if (code != TSDB_CODE_SUCCESS) {
taosMemoryFree(*assignment);
*assignment = NULL;
*numOfAssignment = 0;
@@ -3069,11 +3101,11 @@ end:
}
void tmq_free_assignment(tmq_topic_assignment* pAssignment) {
- if (pAssignment == NULL) {
- return;
- }
+ if (pAssignment == NULL) {
+ return;
+ }
- taosMemoryFree(pAssignment);
+ taosMemoryFree(pAssignment);
}
static int32_t tmqSeekCb(void* param, SDataBuf* pMsg, int32_t code) {
@@ -3087,7 +3119,8 @@ static int32_t tmqSeekCb(void* param, SDataBuf* pMsg, int32_t code) {
return 0;
}
-// seek interface have to send msg to server to cancel push handle if needed, because consumer may be in wait status if there is no data to poll
+// seek interface have to send msg to server to cancel push handle if needed, because consumer may be in wait status if
+// there is no data to poll
int32_t tmq_offset_seek(tmq_t* tmq, const char* pTopicName, int32_t vgId, int64_t offset) {
if (tmq == NULL || pTopicName == NULL) {
tscError("invalid tmq handle, null");
@@ -3095,14 +3128,14 @@ int32_t tmq_offset_seek(tmq_t* tmq, const char* pTopicName, int32_t vgId, int64_
}
int32_t accId = tmq->pTscObj->acctId;
- char tname[TSDB_TOPIC_FNAME_LEN] = {0};
+ char tname[TSDB_TOPIC_FNAME_LEN] = {0};
sprintf(tname, "%d.%s", accId, pTopicName);
taosWLockLatch(&tmq->lock);
SMqClientVg* pVg = NULL;
- int32_t code = getClientVg(tmq, tname, vgId, &pVg);
- if(code != 0){
+ int32_t code = getClientVg(tmq, tname, vgId, &pVg);
+ if (code != 0) {
taosWUnLockLatch(&tmq->lock);
return code;
}
@@ -3174,7 +3207,7 @@ int32_t tmq_offset_seek(tmq_t* tmq, const char* pTopicName, int32_t vgId, int64_
int64_t transporterId = 0;
code = asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, sendInfo);
- if(code != 0){
+ if (code != 0) {
taosMemoryFree(msg);
taosMemoryFree(sendInfo);
tsem_destroy(&pParam->sem);
@@ -3192,9 +3225,9 @@ int32_t tmq_offset_seek(tmq_t* tmq, const char* pTopicName, int32_t vgId, int64_
return code;
}
-TAOS *tmq_get_connect(tmq_t *tmq){
+TAOS* tmq_get_connect(tmq_t* tmq) {
if (tmq && tmq->pTscObj) {
- return (TAOS *)(&(tmq->pTscObj->id));
+ return (TAOS*)(&(tmq->pTscObj->id));
}
return NULL;
}
diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c
index 1321567c1d..fcc44225ff 100644
--- a/source/common/src/tdatablock.c
+++ b/source/common/src/tdatablock.c
@@ -1027,9 +1027,9 @@ size_t blockDataGetRowSize(SSDataBlock* pBlock) {
* @return
*/
size_t blockDataGetSerialMetaSize(uint32_t numOfCols) {
- // | version | total length | total rows | total columns | flag seg| block group id | column schema
+ // | version | total length | total rows | blankFull | total columns | flag seg| block group id | column schema
// | each column length |
- return sizeof(int32_t) + sizeof(int32_t) + sizeof(int32_t) + sizeof(int32_t) + sizeof(int32_t) + sizeof(uint64_t) +
+ return sizeof(int32_t) + sizeof(int32_t) + sizeof(int32_t) + sizeof(bool) + sizeof(int32_t) + sizeof(int32_t) + sizeof(uint64_t) +
numOfCols * (sizeof(int8_t) + sizeof(int32_t)) + numOfCols * sizeof(int32_t);
}
@@ -1622,6 +1622,7 @@ SSDataBlock* createOneDataBlock(const SSDataBlock* pDataBlock, bool copyData) {
pBlock->info.capacity = 0;
pBlock->info.rowSize = 0;
pBlock->info.id = pDataBlock->info.id;
+ pBlock->info.blankFill = pDataBlock->info.blankFill;
size_t numOfCols = taosArrayGetSize(pDataBlock->pDataBlock);
for (int32_t i = 0; i < numOfCols; ++i) {
@@ -2468,6 +2469,10 @@ int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols) {
// htonl(colSizes[col]), colSizes[col]);
}
+ bool* blankFill = (bool*)data;
+ *blankFill = pBlock->info.blankFill;
+ data += sizeof(bool);
+
*actualLen = dataLen;
*groupId = pBlock->info.id.groupId;
ASSERT(dataLen > 0);
@@ -2561,8 +2566,12 @@ const char* blockDecode(SSDataBlock* pBlock, const char* pData) {
pStart += colLen[i];
}
+ bool blankFill = *(bool*)pStart;
+ pStart += sizeof(bool);
+
pBlock->info.dataLoad = 1;
pBlock->info.rows = numOfRows;
+ pBlock->info.blankFill = blankFill;
ASSERT(pStart - pData == dataLen);
return pStart;
}
diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c
index baa2a233d5..ee85a909e7 100644
--- a/source/common/src/tglobal.c
+++ b/source/common/src/tglobal.c
@@ -1606,10 +1606,6 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, char *name) {
tsTempSpace.reserved = (int64_t)(((double)pItem->fval) * 1024 * 1024 * 1024);
uInfo("%s set to %" PRId64, name, tsTempSpace.reserved);
matched = true;
- } else if (strcasecmp("minimalDataDirGB", name) == 0) {
- tsDataSpace.reserved = (int64_t)(((double)pItem->fval) * 1024 * 1024 * 1024);
- uInfo("%s set to %" PRId64, name, tsDataSpace.reserved);
- matched = true;
} else if (strcasecmp("minimalLogDirGB", name) == 0) {
tsLogSpace.reserved = (int64_t)(((double)pItem->fval) * 1024 * 1024 * 1024);
uInfo("%s set to %" PRId64, name, tsLogSpace.reserved);
@@ -1680,10 +1676,6 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, char *name) {
return -1;
}
matched = true;
- } else if (strcasecmp("telemetryServer", name) == 0) {
- uInfo("%s set from %s to %s", name, pItem->str, tsTelemServer);
- tstrncpy(tsTelemServer, pItem->str, TSDB_FQDN_LEN);
- matched = true;
}
break;
}
diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h
index 19de4561d6..fc58fabad5 100644
--- a/source/dnode/mnode/impl/inc/mndDef.h
+++ b/source/dnode/mnode/impl/inc/mndDef.h
@@ -699,6 +699,7 @@ typedef struct {
int64_t checkpointId;
int32_t indexForMultiAggBalance;
+ int8_t subTableWithoutMd5;
char reserve[256];
} SStreamObj;
@@ -776,8 +777,8 @@ typedef enum {
GRANT_STATE_REASON_MAX,
} EGrantStateReason;
-#define GRANT_STATE_NUM 30
-#define GRANT_ACTIVE_NUM 10
+#define GRANT_STATE_NUM 30
+#define GRANT_ACTIVE_NUM 10
#define GRANT_ACTIVE_HEAD_LEN 30
typedef struct {
@@ -812,7 +813,7 @@ typedef struct {
int64_t id : 24;
};
};
- char machine[TSDB_MACHINE_ID_LEN + 1];
+ char machine[TSDB_MACHINE_ID_LEN + 1];
} SGrantMachine;
typedef struct {
diff --git a/source/dnode/mnode/impl/inc/mndStream.h b/source/dnode/mnode/impl/inc/mndStream.h
index 4d1125a340..1084340dc2 100644
--- a/source/dnode/mnode/impl/inc/mndStream.h
+++ b/source/dnode/mnode/impl/inc/mndStream.h
@@ -24,7 +24,7 @@ extern "C" {
#endif
#define MND_STREAM_RESERVE_SIZE 64
-#define MND_STREAM_VER_NUMBER 4
+#define MND_STREAM_VER_NUMBER 5
#define MND_STREAM_CREATE_NAME "stream-create"
#define MND_STREAM_CHECKPOINT_NAME "stream-checkpoint"
diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c
index c7ae36b02c..f60d8035e3 100644
--- a/source/dnode/mnode/impl/src/mndConsumer.c
+++ b/source/dnode/mnode/impl/src/mndConsumer.c
@@ -15,20 +15,20 @@
#define _DEFAULT_SOURCE
#include "mndConsumer.h"
-#include "mndPrivilege.h"
-#include "mndVgroup.h"
-#include "mndShow.h"
#include "mndDb.h"
+#include "mndPrivilege.h"
+#include "mndShow.h"
#include "mndSubscribe.h"
#include "mndTopic.h"
#include "mndTrans.h"
+#include "mndVgroup.h"
#include "tcompare.h"
#include "tname.h"
#define MND_CONSUMER_VER_NUMBER 2
#define MND_CONSUMER_RESERVE_SIZE 64
-#define MND_MAX_GROUP_PER_TOPIC 100
+#define MND_MAX_GROUP_PER_TOPIC 100
static int32_t mndConsumerActionInsert(SSdb *pSdb, SMqConsumerObj *pConsumer);
static int32_t mndConsumerActionDelete(SSdb *pSdb, SMqConsumerObj *pConsumer);
@@ -56,7 +56,7 @@ int32_t mndInitConsumer(SMnode *pMnode) {
mndSetMsgHandle(pMnode, TDMT_MND_TMQ_SUBSCRIBE, mndProcessSubscribeReq);
mndSetMsgHandle(pMnode, TDMT_MND_TMQ_HB, mndProcessMqHbReq);
mndSetMsgHandle(pMnode, TDMT_MND_TMQ_ASK_EP, mndProcessAskEpReq);
-// mndSetMsgHandle(pMnode, TDMT_MND_TMQ_TIMER, mndProcessMqTimerMsg);
+ // mndSetMsgHandle(pMnode, TDMT_MND_TMQ_TIMER, mndProcessMqTimerMsg);
mndSetMsgHandle(pMnode, TDMT_MND_TMQ_CONSUMER_RECOVER, mndProcessConsumerRecoverMsg);
mndSetMsgHandle(pMnode, TDMT_MND_TMQ_LOST_CONSUMER_CLEAR, mndProcessConsumerClearMsg);
@@ -68,10 +68,11 @@ int32_t mndInitConsumer(SMnode *pMnode) {
void mndCleanupConsumer(SMnode *pMnode) {}
-void mndDropConsumerFromSdb(SMnode *pMnode, int64_t consumerId, SRpcHandleInfo* info){
+void mndDropConsumerFromSdb(SMnode *pMnode, int64_t consumerId, SRpcHandleInfo *info) {
SMqConsumerClearMsg *pClearMsg = rpcMallocCont(sizeof(SMqConsumerClearMsg));
if (pClearMsg == NULL) {
- mError("consumer:0x%"PRIx64" failed to clear consumer due to out of memory. alloc size:%d", consumerId, (int32_t)sizeof(SMqConsumerClearMsg));
+ mError("consumer:0x%" PRIx64 " failed to clear consumer due to out of memory. alloc size:%d", consumerId,
+ (int32_t)sizeof(SMqConsumerClearMsg));
return;
}
@@ -88,13 +89,14 @@ void mndDropConsumerFromSdb(SMnode *pMnode, int64_t consumerId, SRpcHandleInfo*
return;
}
-static int32_t validateTopics(STrans *pTrans, const SArray *pTopicList, SMnode *pMnode, const char *pUser, bool enableReplay) {
+static int32_t validateTopics(STrans *pTrans, const SArray *pTopicList, SMnode *pMnode, const char *pUser,
+ bool enableReplay) {
SMqTopicObj *pTopic = NULL;
- int32_t code = 0;
+ int32_t code = 0;
int32_t numOfTopics = taosArrayGetSize(pTopicList);
for (int32_t i = 0; i < numOfTopics; i++) {
- char *pOneTopic = taosArrayGetP(pTopicList, i);
+ char *pOneTopic = taosArrayGetP(pTopicList, i);
pTopic = mndAcquireTopic(pMnode, pOneTopic);
if (pTopic == NULL) { // terrno has been set by callee function
code = -1;
@@ -112,11 +114,11 @@ static int32_t validateTopics(STrans *pTrans, const SArray *pTopicList, SMnode *
goto FAILED;
}
- if(enableReplay){
- if(pTopic->subType != TOPIC_SUB_TYPE__COLUMN){
+ if (enableReplay) {
+ if (pTopic->subType != TOPIC_SUB_TYPE__COLUMN) {
code = TSDB_CODE_TMQ_REPLAY_NOT_SUPPORT;
goto FAILED;
- }else if(pTopic->ntbUid == 0 && pTopic->ctbStbUid == 0) {
+ } else if (pTopic->ntbUid == 0 && pTopic->ctbStbUid == 0) {
SDbObj *pDb = mndAcquireDb(pMnode, pTopic->db);
if (pDb == NULL) {
code = -1;
@@ -132,7 +134,7 @@ static int32_t validateTopics(STrans *pTrans, const SArray *pTopicList, SMnode *
}
mndTransSetDbName(pTrans, pOneTopic, NULL);
- if(mndTransCheckConflict(pMnode, pTrans) != 0){
+ if (mndTransCheckConflict(pMnode, pTrans) != 0) {
code = -1;
goto FAILED;
}
@@ -172,7 +174,7 @@ static int32_t mndProcessConsumerRecoverMsg(SRpcMsg *pMsg) {
if (pTrans == NULL) {
goto FAIL;
}
- if(validateTopics(pTrans, pConsumer->assignedTopics, pMnode, pMsg->info.conn.user, false) != 0){
+ if (validateTopics(pTrans, pConsumer->assignedTopics, pMnode, pMsg->info.conn.user, false) != 0) {
goto FAIL;
}
@@ -197,7 +199,7 @@ static int32_t mndProcessConsumerClearMsg(SRpcMsg *pMsg) {
SMqConsumerObj *pConsumer = mndAcquireConsumer(pMnode, pClearMsg->consumerId);
if (pConsumer == NULL) {
- mError("consumer:0x%"PRIx64" failed to be found to clear it", pClearMsg->consumerId);
+ mError("consumer:0x%" PRIx64 " failed to be found to clear it", pClearMsg->consumerId);
return 0;
}
@@ -226,15 +228,15 @@ FAIL:
return -1;
}
-static int32_t checkPrivilege(SMnode *pMnode, SMqConsumerObj *pConsumer, SMqHbRsp *rsp, char* user){
+static int32_t checkPrivilege(SMnode *pMnode, SMqConsumerObj *pConsumer, SMqHbRsp *rsp, char *user) {
rsp->topicPrivileges = taosArrayInit(taosArrayGetSize(pConsumer->currentTopics), sizeof(STopicPrivilege));
- if(rsp->topicPrivileges == NULL){
+ 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);
+ 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;
}
@@ -252,10 +254,10 @@ static int32_t checkPrivilege(SMnode *pMnode, SMqConsumerObj *pConsumer, SMqHbR
}
static int32_t mndProcessMqHbReq(SRpcMsg *pMsg) {
- int32_t code = 0;
- SMnode *pMnode = pMsg->info.node;
- SMqHbReq req = {0};
- SMqHbRsp rsp = {0};
+ int32_t code = 0;
+ SMnode *pMnode = pMsg->info.node;
+ SMqHbReq req = {0};
+ SMqHbRsp rsp = {0};
SMqConsumerObj *pConsumer = NULL;
if (tDeserializeSMqHbReq(pMsg->pCont, pMsg->contLen, &req) < 0) {
@@ -264,7 +266,7 @@ static int32_t mndProcessMqHbReq(SRpcMsg *pMsg) {
goto end;
}
- int64_t consumerId = req.consumerId;
+ int64_t consumerId = req.consumerId;
pConsumer = mndAcquireConsumer(pMnode, consumerId);
if (pConsumer == NULL) {
mError("consumer:0x%" PRIx64 " not exist", consumerId);
@@ -273,7 +275,7 @@ static int32_t mndProcessMqHbReq(SRpcMsg *pMsg) {
goto end;
}
code = checkPrivilege(pMnode, pConsumer, &rsp, pMsg->info.conn.user);
- if(code != 0){
+ if (code != 0) {
goto end;
}
@@ -295,12 +297,12 @@ static int32_t mndProcessMqHbReq(SRpcMsg *pMsg) {
tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &pRpcMsg);
}
- for(int i = 0; i < taosArrayGetSize(req.topics); i++){
- TopicOffsetRows* data = taosArrayGet(req.topics, i);
+ for (int i = 0; i < taosArrayGetSize(req.topics); i++) {
+ TopicOffsetRows *data = taosArrayGet(req.topics, i);
mInfo("heartbeat report offset rows.%s:%s", pConsumer->cgroup, data->topicName);
SMqSubscribeObj *pSub = mndAcquireSubscribe(pMnode, pConsumer->cgroup, data->topicName);
- if(pSub == NULL){
+ if (pSub == NULL) {
#ifdef TMQ_DEBUG
ASSERT(0);
#endif
@@ -308,7 +310,7 @@ static int32_t mndProcessMqHbReq(SRpcMsg *pMsg) {
}
taosWLockLatch(&pSub->lock);
SMqConsumerEp *pConsumerEp = taosHashGet(pSub->consumerHash, &consumerId, sizeof(int64_t));
- if(pConsumerEp){
+ if (pConsumerEp) {
taosArrayDestroy(pConsumerEp->offsetRows);
pConsumerEp->offsetRows = data->offsetRows;
data->offsetRows = NULL;
@@ -413,7 +415,7 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) {
char *topic = taosArrayGetP(pConsumer->currentTopics, i);
SMqSubscribeObj *pSub = mndAcquireSubscribe(pMnode, pConsumer->cgroup, topic);
// txn guarantees pSub is created
- if(pSub == NULL) {
+ if (pSub == NULL) {
#ifdef TMQ_DEBUG
ASSERT(0);
#endif
@@ -426,7 +428,7 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) {
// 2.1 fetch topic schema
SMqTopicObj *pTopic = mndAcquireTopic(pMnode, topic);
- if(pTopic == NULL) {
+ if (pTopic == NULL) {
#ifdef TMQ_DEBUG
ASSERT(0);
#endif
@@ -460,12 +462,12 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) {
for (int32_t j = 0; j < vgNum; j++) {
SMqVgEp *pVgEp = taosArrayGetP(pConsumerEp->vgs, j);
-// char offsetKey[TSDB_PARTITION_KEY_LEN];
-// mndMakePartitionKey(offsetKey, pConsumer->cgroup, topic, pVgEp->vgId);
+ // char offsetKey[TSDB_PARTITION_KEY_LEN];
+ // mndMakePartitionKey(offsetKey, pConsumer->cgroup, topic, pVgEp->vgId);
- if(epoch == -1){
+ if (epoch == -1) {
SVgObj *pVgroup = mndAcquireVgroup(pMnode, pVgEp->vgId);
- if(pVgroup){
+ if (pVgroup) {
pVgEp->epSet = mndGetVgroupEpset(pMnode, pVgroup);
mndReleaseVgroup(pMnode, pVgroup);
}
@@ -495,7 +497,7 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) {
goto FAIL;
}
- SMqRspHead* pHead = buf;
+ SMqRspHead *pHead = buf;
pHead->mqMsgType = TMQ_MSG_TYPE__EP_RSP;
pHead->epoch = serverEpoch;
@@ -503,7 +505,6 @@ static int32_t mndProcessAskEpReq(SRpcMsg *pMsg) {
pHead->walsver = 0;
pHead->walever = 0;
-
void *abuf = POINTER_SHIFT(buf, sizeof(SMqRspHead));
tEncodeSMqAskEpRsp(&abuf, &rsp);
@@ -552,29 +553,23 @@ int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
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);
- int64_t consumerId = subscribe.consumerId;
+ int64_t consumerId = subscribe.consumerId;
char *cgroup = subscribe.cgroup;
SMqConsumerObj *pExistedConsumer = NULL;
SMqConsumerObj *pConsumerNew = NULL;
- STrans *pTrans = NULL;
+ STrans *pTrans = NULL;
-
SArray *pTopicList = subscribe.topicNames;
taosArraySort(pTopicList, taosArrayCompareString);
taosArrayRemoveDuplicate(pTopicList, taosArrayCompareString, freeItem);
int32_t newTopicNum = taosArrayGetSize(pTopicList);
- for(int i = 0; i < newTopicNum; i++){
- int32_t gNum = mndGetGroupNumByTopic(pMnode, (const char*)taosArrayGetP(pTopicList, i));
- if(gNum >= MND_MAX_GROUP_PER_TOPIC){
+ for (int i = 0; i < newTopicNum; i++) {
+ int32_t gNum = mndGetGroupNumByTopic(pMnode, (const char *)taosArrayGetP(pTopicList, i));
+ if (gNum >= MND_MAX_GROUP_PER_TOPIC) {
terrno = TSDB_CODE_TMQ_GROUP_OUT_OF_RANGE;
code = terrno;
goto _over;
@@ -605,7 +600,7 @@ int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
pConsumerNew->autoCommitInterval = subscribe.autoCommitInterval;
pConsumerNew->resetOffsetCfg = subscribe.resetOffsetCfg;
-// pConsumerNew->updateType = CONSUMER_UPDATE_SUB; // use insert logic
+ // pConsumerNew->updateType = CONSUMER_UPDATE_SUB; // use insert logic
taosArrayDestroy(pConsumerNew->assignedTopics);
pConsumerNew->assignedTopics = taosArrayDup(pTopicList, topicNameDup);
@@ -792,16 +787,15 @@ CM_DECODE_OVER:
}
static int32_t mndConsumerActionInsert(SSdb *pSdb, SMqConsumerObj *pConsumer) {
- mInfo("consumer:0x%" PRIx64 " sub insert, cgroup:%s status:%d(%s) epoch:%d",
- pConsumer->consumerId, pConsumer->cgroup, pConsumer->status, mndConsumerStatusName(pConsumer->status),
- pConsumer->epoch);
+ mInfo("consumer:0x%" PRIx64 " sub insert, cgroup:%s status:%d(%s) epoch:%d", pConsumer->consumerId, pConsumer->cgroup,
+ pConsumer->status, mndConsumerStatusName(pConsumer->status), pConsumer->epoch);
pConsumer->subscribeTime = pConsumer->createTime;
return 0;
}
static int32_t mndConsumerActionDelete(SSdb *pSdb, SMqConsumerObj *pConsumer) {
mInfo("consumer:0x%" PRIx64 " perform delete action, status:(%d)%s", pConsumer->consumerId, pConsumer->status,
- mndConsumerStatusName(pConsumer->status));
+ mndConsumerStatusName(pConsumer->status));
tDeleteSMqConsumerObj(pConsumer, false);
return 0;
}
@@ -828,7 +822,7 @@ static void removeFromNewTopicList(SMqConsumerObj *pConsumer, const char *pTopic
taosMemoryFree(p);
mInfo("consumer:0x%" PRIx64 " remove new topic:%s in the topic list, remain newTopics:%d", pConsumer->consumerId,
- pTopic, (int)taosArrayGetSize(pConsumer->rebNewTopics));
+ pTopic, (int)taosArrayGetSize(pConsumer->rebNewTopics));
break;
}
}
@@ -844,7 +838,7 @@ static void removeFromRemoveTopicList(SMqConsumerObj *pConsumer, const char *pTo
taosMemoryFree(p);
mInfo("consumer:0x%" PRIx64 " remove topic:%s in the removed topic list, remain removedTopics:%d",
- pConsumer->consumerId, pTopic, (int)taosArrayGetSize(pConsumer->rebRemovedTopics));
+ pConsumer->consumerId, pTopic, (int)taosArrayGetSize(pConsumer->rebRemovedTopics));
break;
}
}
@@ -859,13 +853,13 @@ static void removeFromCurrentTopicList(SMqConsumerObj *pConsumer, const char *pT
taosMemoryFree(topic);
mInfo("consumer:0x%" PRIx64 " remove topic:%s in the current topic list, remain currentTopics:%d",
- pConsumer->consumerId, pTopic, (int)taosArrayGetSize(pConsumer->currentTopics));
+ pConsumer->consumerId, pTopic, (int)taosArrayGetSize(pConsumer->currentTopics));
break;
}
}
}
-static bool existInCurrentTopicList(const SMqConsumerObj* pConsumer, const char* pTopic) {
+static bool existInCurrentTopicList(const SMqConsumerObj *pConsumer, const char *pTopic) {
bool existing = false;
int32_t size = taosArrayGetSize(pConsumer->currentTopics);
for (int32_t i = 0; i < size; i++) {
@@ -882,7 +876,7 @@ static bool existInCurrentTopicList(const SMqConsumerObj* pConsumer, const char*
static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, SMqConsumerObj *pNewConsumer) {
mInfo("consumer:0x%" PRIx64 " perform update action, update type:%d, subscribe-time:%" PRId64 ", createTime:%" PRId64,
- pOldConsumer->consumerId, pNewConsumer->updateType, pOldConsumer->subscribeTime, pOldConsumer->createTime);
+ pOldConsumer->consumerId, pNewConsumer->updateType, pOldConsumer->subscribeTime, pOldConsumer->createTime);
taosWLockLatch(&pOldConsumer->lock);
@@ -893,19 +887,21 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer,
pOldConsumer->subscribeTime = taosGetTimestampMs();
pOldConsumer->status = MQ_CONSUMER_STATUS_REBALANCE;
- mInfo("consumer:0x%" PRIx64 " sub update, modify existed consumer",pOldConsumer->consumerId);
-// } else if (pNewConsumer->updateType == CONSUMER_UPDATE_TIMER_LOST) {
-// int32_t sz = taosArrayGetSize(pOldConsumer->currentTopics);
-// for (int32_t i = 0; i < sz; i++) {
-// char *topic = taosStrdup(taosArrayGetP(pOldConsumer->currentTopics, i));
-// taosArrayPush(pOldConsumer->rebRemovedTopics, &topic);
-// }
-//
-// int32_t prevStatus = pOldConsumer->status;
-// pOldConsumer->status = MQ_CONSUMER_STATUS_LOST;
-// mInfo("consumer:0x%" PRIx64 " timer update, timer lost. state %s -> %s, reb-time:%" PRId64 ", reb-removed-topics:%d",
-// pOldConsumer->consumerId, mndConsumerStatusName(prevStatus), mndConsumerStatusName(pOldConsumer->status),
-// pOldConsumer->rebalanceTime, (int)taosArrayGetSize(pOldConsumer->rebRemovedTopics));
+ mInfo("consumer:0x%" PRIx64 " sub update, modify existed consumer", pOldConsumer->consumerId);
+ // } else if (pNewConsumer->updateType == CONSUMER_UPDATE_TIMER_LOST) {
+ // int32_t sz = taosArrayGetSize(pOldConsumer->currentTopics);
+ // for (int32_t i = 0; i < sz; i++) {
+ // char *topic = taosStrdup(taosArrayGetP(pOldConsumer->currentTopics, i));
+ // taosArrayPush(pOldConsumer->rebRemovedTopics, &topic);
+ // }
+ //
+ // int32_t prevStatus = pOldConsumer->status;
+ // pOldConsumer->status = MQ_CONSUMER_STATUS_LOST;
+ // mInfo("consumer:0x%" PRIx64 " timer update, timer lost. state %s -> %s, reb-time:%" PRId64 ",
+ // reb-removed-topics:%d",
+ // pOldConsumer->consumerId, mndConsumerStatusName(prevStatus),
+ // mndConsumerStatusName(pOldConsumer->status), pOldConsumer->rebalanceTime,
+ // (int)taosArrayGetSize(pOldConsumer->rebRemovedTopics));
} else if (pNewConsumer->updateType == CONSUMER_UPDATE_REC) {
int32_t sz = taosArrayGetSize(pOldConsumer->assignedTopics);
for (int32_t i = 0; i < sz; i++) {
@@ -914,7 +910,7 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer,
}
pOldConsumer->status = MQ_CONSUMER_STATUS_REBALANCE;
- mInfo("consumer:0x%" PRIx64 " timer update, timer recover",pOldConsumer->consumerId);
+ mInfo("consumer:0x%" PRIx64 " timer update, timer recover", pOldConsumer->consumerId);
} else if (pNewConsumer->updateType == CONSUMER_UPDATE_REB) {
atomic_add_fetch_32(&pOldConsumer->epoch, 1);
@@ -945,11 +941,11 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer,
atomic_add_fetch_32(&pOldConsumer->epoch, 1);
mInfo("consumer:0x%" PRIx64 " reb update add, state (%d)%s -> (%d)%s, new epoch:%d, reb-time:%" PRId64
- ", current topics:%d, newTopics:%d, removeTopics:%d",
- pOldConsumer->consumerId, status, mndConsumerStatusName(status), pOldConsumer->status,
- mndConsumerStatusName(pOldConsumer->status), pOldConsumer->epoch, pOldConsumer->rebalanceTime,
- (int)taosArrayGetSize(pOldConsumer->currentTopics), (int)taosArrayGetSize(pOldConsumer->rebNewTopics),
- (int)taosArrayGetSize(pOldConsumer->rebRemovedTopics));
+ ", current topics:%d, newTopics:%d, removeTopics:%d",
+ pOldConsumer->consumerId, status, mndConsumerStatusName(status), pOldConsumer->status,
+ mndConsumerStatusName(pOldConsumer->status), pOldConsumer->epoch, pOldConsumer->rebalanceTime,
+ (int)taosArrayGetSize(pOldConsumer->currentTopics), (int)taosArrayGetSize(pOldConsumer->rebNewTopics),
+ (int)taosArrayGetSize(pOldConsumer->rebRemovedTopics));
} else if (pNewConsumer->updateType == CONSUMER_REMOVE_REB) {
char *removedTopic = taosArrayGetP(pNewConsumer->rebRemovedTopics, 0);
@@ -968,11 +964,11 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer,
atomic_add_fetch_32(&pOldConsumer->epoch, 1);
mInfo("consumer:0x%" PRIx64 " reb update remove, state (%d)%s -> (%d)%s, new epoch:%d, reb-time:%" PRId64
- ", current topics:%d, newTopics:%d, removeTopics:%d",
- pOldConsumer->consumerId, status, mndConsumerStatusName(status), pOldConsumer->status,
- mndConsumerStatusName(pOldConsumer->status), pOldConsumer->epoch, pOldConsumer->rebalanceTime,
- (int)taosArrayGetSize(pOldConsumer->currentTopics), (int)taosArrayGetSize(pOldConsumer->rebNewTopics),
- (int)taosArrayGetSize(pOldConsumer->rebRemovedTopics));
+ ", current topics:%d, newTopics:%d, removeTopics:%d",
+ pOldConsumer->consumerId, status, mndConsumerStatusName(status), pOldConsumer->status,
+ mndConsumerStatusName(pOldConsumer->status), pOldConsumer->epoch, pOldConsumer->rebalanceTime,
+ (int)taosArrayGetSize(pOldConsumer->currentTopics), (int)taosArrayGetSize(pOldConsumer->rebNewTopics),
+ (int)taosArrayGetSize(pOldConsumer->rebRemovedTopics));
}
taosWUnLockLatch(&pOldConsumer->lock);
@@ -1030,8 +1026,8 @@ static int32_t mndRetrieveConsumer(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *
int32_t cols = 0;
// consumer id
- char consumerIdHex[32] = {0};
- sprintf(varDataVal(consumerIdHex), "0x%"PRIx64, pConsumer->consumerId);
+ char consumerIdHex[32] = {0};
+ sprintf(varDataVal(consumerIdHex), "0x%" PRIx64, pConsumer->consumerId);
varDataSetLen(consumerIdHex, strlen(varDataVal(consumerIdHex)));
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
@@ -1086,12 +1082,13 @@ static int32_t mndRetrieveConsumer(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataSetVal(pColInfo, numOfRows, (const char *)&pConsumer->rebalanceTime, pConsumer->rebalanceTime == 0);
- char buf[TSDB_OFFSET_LEN] = {0};
+ char buf[TSDB_OFFSET_LEN] = {0};
STqOffsetVal pVal = {.type = pConsumer->resetOffsetCfg};
tFormatOffset(buf, TSDB_OFFSET_LEN, &pVal);
char parasStr[64 + TSDB_OFFSET_LEN + VARSTR_HEADER_SIZE] = {0};
- sprintf(varDataVal(parasStr), "tbname:%d,commit:%d,interval:%dms,reset:%s", pConsumer->withTbName, pConsumer->autoCommit, pConsumer->autoCommitInterval, buf);
+ sprintf(varDataVal(parasStr), "tbname:%d,commit:%d,interval:%dms,reset:%s", pConsumer->withTbName,
+ pConsumer->autoCommit, pConsumer->autoCommitInterval, buf);
varDataSetLen(parasStr, strlen(varDataVal(parasStr)));
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
diff --git a/source/dnode/mnode/impl/src/mndDef.c b/source/dnode/mnode/impl/src/mndDef.c
index d59354286d..5be641d1c2 100644
--- a/source/dnode/mnode/impl/src/mndDef.c
+++ b/source/dnode/mnode/impl/src/mndDef.c
@@ -85,6 +85,7 @@ int32_t tEncodeSStreamObj(SEncoder *pEncoder, const SStreamObj *pObj) {
// 3.0.50 ver = 3
if (tEncodeI64(pEncoder, pObj->checkpointId) < 0) return -1;
+ if (tEncodeI8(pEncoder, pObj->subTableWithoutMd5) < 0) return -1;
if (tEncodeCStrWithLen(pEncoder, pObj->reserve, sizeof(pObj->reserve) - 1) < 0) return -1;
@@ -168,6 +169,10 @@ int32_t tDecodeSStreamObj(SDecoder *pDecoder, SStreamObj *pObj, int32_t sver) {
if (sver >= 3) {
if (tDecodeI64(pDecoder, &pObj->checkpointId) < 0) return -1;
}
+
+ if (sver >= 5) {
+ if (tDecodeI8(pDecoder, &pObj->subTableWithoutMd5) < 0) return -1;
+ }
if (tDecodeCStrTo(pDecoder, pObj->reserve) < 0) return -1;
tEndDecode(pDecoder);
diff --git a/source/dnode/mnode/impl/src/mndScheduler.c b/source/dnode/mnode/impl/src/mndScheduler.c
index 88d326a5c4..cbc0ace75d 100644
--- a/source/dnode/mnode/impl/src/mndScheduler.c
+++ b/source/dnode/mnode/impl/src/mndScheduler.c
@@ -14,19 +14,41 @@
*/
#include "mndScheduler.h"
-#include "tmisce.h"
-#include "mndMnode.h"
#include "mndDb.h"
+#include "mndMnode.h"
#include "mndSnode.h"
#include "mndVgroup.h"
#include "parser.h"
#include "tcompare.h"
+#include "tmisce.h"
#include "tname.h"
#include "tuuid.h"
#define SINK_NODE_LEVEL (0)
extern bool tsDeployOnSnode;
+static bool hasCountWindowNode(SPhysiNode* pNode) {
+ if (nodeType(pNode) == QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT) {
+ return true;
+ } else {
+ size_t size = LIST_LENGTH(pNode->pChildren);
+
+ for (int32_t i = 0; i < size; ++i) {
+ SPhysiNode* pChild = (SPhysiNode*)nodesListGetNode(pNode->pChildren, i);
+ if (hasCountWindowNode(pChild)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
+
+static bool countWindowStreamTask(SSubplan* pPlan) {
+ SPhysiNode* pNode = pPlan->pNode;
+ return hasCountWindowNode(pNode);
+}
+
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;
@@ -189,7 +211,7 @@ SVgObj* mndSchedFetchOneVg(SMnode* pMnode, SStreamObj* pStream) {
return NULL;
}
- if(pStream->indexForMultiAggBalance == -1){
+ if (pStream->indexForMultiAggBalance == -1) {
taosSeedRand(taosSafeRand());
pStream->indexForMultiAggBalance = taosRand() % pDbObj->cfg.numOfVgroups;
}
@@ -204,7 +226,7 @@ SVgObj* mndSchedFetchOneVg(SMnode* pMnode, SStreamObj* pStream) {
sdbRelease(pMnode->pSdb, pVgroup);
continue;
}
- if (index++ == pStream->indexForMultiAggBalance){
+ if (index++ == pStream->indexForMultiAggBalance) {
pStream->indexForMultiAggBalance++;
pStream->indexForMultiAggBalance %= pDbObj->cfg.numOfVgroups;
sdbCancelFetch(pMnode->pSdb, pIter);
@@ -217,12 +239,12 @@ SVgObj* mndSchedFetchOneVg(SMnode* pMnode, SStreamObj* pStream) {
return pVgroup;
}
-static int32_t doAddSinkTask(SStreamObj* pStream, SMnode* pMnode, SVgObj* pVgroup,
- SEpSet* pEpset, bool isFillhistory) {
- int64_t uid = (isFillhistory) ? pStream->hTaskUid : pStream->uid;
+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);
+ SStreamTask* pTask = tNewStreamTask(uid, TASK_LEVEL__SINK, pEpset, isFillhistory, 0, *pTaskList,
+ pStream->conf.fillHistory, pStream->subTableWithoutMd5);
if (pTask == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return terrno;
@@ -235,12 +257,12 @@ static int32_t doAddSinkTask(SStreamObj* pStream, SMnode* pMnode, SVgObj* pVgrou
return mndSetSinkTaskInfo(pStream, pTask);
}
-static int32_t doAddSinkTaskToVg(SMnode* pMnode, SStreamObj* pStream, SEpSet* pEpset, SVgObj* vgObj){
+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){
+ if (pStream->conf.fillHistory) {
code = doAddSinkTask(pStream, pMnode, vgObj, pEpset, true);
if (code != 0) {
return code;
@@ -267,7 +289,7 @@ static int32_t doAddShuffleSinkTask(SMnode* pMnode, SStreamObj* pStream, SEpSet*
}
int32_t code = doAddSinkTaskToVg(pMnode, pStream, pEpset, pVgroup);
- if(code != 0){
+ if (code != 0) {
sdbRelease(pSdb, pVgroup);
return code;
}
@@ -279,7 +301,7 @@ static int32_t doAddShuffleSinkTask(SMnode* pMnode, SStreamObj* pStream, SEpSet*
}
static int64_t getVgroupLastVer(const SArray* pList, int32_t vgId) {
- for(int32_t i = 0; i < taosArrayGetSize(pList); ++i) {
+ for (int32_t i = 0; i < taosArrayGetSize(pList); ++i) {
SVgroupVer* pVer = taosArrayGet(pList, i);
if (pVer->vgId == vgId) {
return pVer->ver;
@@ -315,19 +337,29 @@ static void streamTaskSetDataRange(SStreamTask* pTask, int64_t skey, SArray* pVe
pRange->range.minVer = latestVer + 1;
pRange->range.maxVer = INT64_MAX;
- 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);
+ 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);
}
}
-static SStreamTask* buildSourceTask(SStreamObj* pStream, SEpSet* pEpset,
- bool isFillhistory, bool useTriggerParam) {
+static void haltInitialTaskStatus(SStreamTask* pTask, SSubplan* pPlan) {
+ bool hasCountWindowNode = countWindowStreamTask(pPlan);
+ bool isRelStreamTask = (pTask->hTaskInfo.id.taskId != 0);
+ if (hasCountWindowNode && isRelStreamTask) {
+ SStreamStatus* pStatus = &pTask->status;
+ mDebug("s-task:0x%x status is set to %s from %s for count window agg task with fill-history option set",
+ pTask->id.taskId, streamTaskGetStatusStr(pStatus->taskStatus), streamTaskGetStatusStr(TASK_STATUS__HALT));
+ pStatus->taskStatus = TASK_STATUS__HALT;
+ }
+}
+
+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);
+ SStreamTask* pTask =
+ tNewStreamTask(uid, TASK_LEVEL__SOURCE, pEpset, isFillhistory, useTriggerParam ? pStream->conf.triggerParam : 0,
+ *pTaskList, pStream->conf.fillHistory, pStream->subTableWithoutMd5);
if (pTask == NULL) {
return NULL;
}
@@ -335,7 +367,7 @@ static SStreamTask* buildSourceTask(SStreamObj* pStream, SEpSet* pEpset,
return pTask;
}
-static void addNewTaskList(SStreamObj* pStream){
+static void addNewTaskList(SStreamObj* pStream) {
SArray* pTaskList = taosArrayInit(0, POINTER_BYTES);
taosArrayPush(pStream->tasks, &pTaskList);
if (pStream->conf.fillHistory) {
@@ -364,28 +396,30 @@ static void setHTasksId(SStreamObj* pStream) {
}
}
-static int32_t doAddSourceTask(SMnode* pMnode, SSubplan* plan, SStreamObj* pStream, SEpSet* pEpset,
- int64_t skey, SArray* pVerList, SVgObj* pVgroup, bool isFillhistory, bool useTriggerParam ){
+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){
+ 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);
+ haltInitialTaskStatus(pTask, plan);
+
streamTaskSetDataRange(pTask, skey, pVerList, pVgroup->vgId);
int32_t code = mndAssignStreamTaskToVgroup(pMnode, pTask, plan, pVgroup);
- if(code != 0){
+ if (code != 0) {
terrno = code;
return terrno;
}
return TDB_CODE_SUCCESS;
}
-static SSubplan* getScanSubPlan(const SQueryPlan* pPlan){
- int32_t numOfPlanLevel = LIST_LENGTH(pPlan->pSubplans);
+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;
@@ -400,7 +434,7 @@ static SSubplan* getScanSubPlan(const SQueryPlan* pPlan){
return plan;
}
-static SSubplan* getAggSubPlan(const SQueryPlan* pPlan, int index){
+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;
@@ -415,8 +449,8 @@ static SSubplan* getAggSubPlan(const SQueryPlan* pPlan, int index){
return plan;
}
-static int32_t addSourceTask(SMnode* pMnode, SSubplan* plan, SStreamObj* pStream,
- SEpSet* pEpset, int64_t nextWindowSkey, SArray* pVerList, bool useTriggerParam) {
+static int32_t addSourceTask(SMnode* pMnode, SSubplan* plan, SStreamObj* pStream, SEpSet* pEpset,
+ int64_t nextWindowSkey, SArray* pVerList, bool useTriggerParam) {
addNewTaskList(pStream);
void* pIter = NULL;
@@ -433,15 +467,16 @@ static int32_t addSourceTask(SMnode* pMnode, SSubplan* plan, SStreamObj* pStream
continue;
}
- int code = doAddSourceTask(pMnode, plan, pStream, pEpset, nextWindowSkey, pVerList, pVgroup, false, useTriggerParam);
- if(code != 0){
+ int code =
+ doAddSourceTask(pMnode, plan, pStream, pEpset, nextWindowSkey, pVerList, pVgroup, false, useTriggerParam);
+ if (code != 0) {
sdbRelease(pSdb, pVgroup);
return code;
}
if (pStream->conf.fillHistory) {
code = doAddSourceTask(pMnode, plan, pStream, pEpset, nextWindowSkey, pVerList, pVgroup, true, useTriggerParam);
- if(code != 0){
+ if (code != 0) {
sdbRelease(pSdb, pVgroup);
return code;
}
@@ -461,9 +496,9 @@ static SStreamTask* buildAggTask(SStreamObj* pStream, SEpSet* pEpset, bool isFil
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);
+ SStreamTask* pAggTask =
+ tNewStreamTask(uid, TASK_LEVEL__AGG, pEpset, isFillhistory, useTriggerParam ? pStream->conf.triggerParam : 0,
+ *pTaskList, pStream->conf.fillHistory, pStream->subTableWithoutMd5);
if (pAggTask == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
@@ -472,8 +507,8 @@ static SStreamTask* buildAggTask(SStreamObj* pStream, SEpSet* pEpset, bool isFil
return pAggTask;
}
-static int32_t doAddAggTask(SStreamObj* pStream, SMnode* pMnode, SSubplan* plan, SEpSet* pEpset,
- SVgObj* pVgroup, SSnodeObj* pSnode, bool isFillhistory, bool useTriggerParam){
+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) {
@@ -490,7 +525,7 @@ static int32_t doAddAggTask(SStreamObj* pStream, SMnode* pMnode, SSubplan* plan,
return code;
}
-static int32_t addAggTask(SStreamObj* pStream, SMnode* pMnode, SSubplan* plan, SEpSet* pEpset, bool useTriggerParam){
+static int32_t addAggTask(SStreamObj* pStream, SMnode* pMnode, SSubplan* plan, SEpSet* pEpset, bool useTriggerParam) {
SVgObj* pVgroup = NULL;
SSnodeObj* pSnode = NULL;
int32_t code = 0;
@@ -504,20 +539,20 @@ static int32_t addAggTask(SStreamObj* pStream, SMnode* pMnode, SSubplan* plan, S
}
code = doAddAggTask(pStream, pMnode, plan, pEpset, pVgroup, pSnode, false, useTriggerParam);
- if(code != 0){
+ if (code != 0) {
goto END;
}
if (pStream->conf.fillHistory) {
code = doAddAggTask(pStream, pMnode, plan, pEpset, pVgroup, pSnode, true, useTriggerParam);
- if(code != 0){
+ if (code != 0) {
goto END;
}
setHTasksId(pStream);
}
- END:
+END:
if (pSnode != NULL) {
sdbRelease(pMnode->pSdb, pSnode);
} else {
@@ -526,7 +561,7 @@ static int32_t addAggTask(SStreamObj* pStream, SMnode* pMnode, SSubplan* plan, S
return code;
}
-static int32_t addSinkTask(SMnode* pMnode, SStreamObj* pStream, SEpSet* pEpset){
+static int32_t addSinkTask(SMnode* pMnode, SStreamObj* pStream, SEpSet* pEpset) {
int32_t code = 0;
addNewTaskList(pStream);
@@ -548,9 +583,9 @@ static int32_t addSinkTask(SMnode* pMnode, SStreamObj* pStream, SEpSet* pEpset){
return TDB_CODE_SUCCESS;
}
-static void bindTaskToSinkTask(SStreamObj* pStream, SMnode* pMnode, SArray* pSinkTaskList, SStreamTask* task){
+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++) {
+ for (int32_t k = 0; k < taosArrayGetSize(pSinkTaskList); k++) {
SStreamTask* pSinkTask = taosArrayGetP(pSinkTaskList, k);
streamTaskSetUpstreamInfo(pSinkTask, task);
}
@@ -558,10 +593,10 @@ static void bindTaskToSinkTask(SStreamObj* pStream, SMnode* pMnode, SArray* pSin
}
static void bindAggSink(SStreamObj* pStream, SMnode* pMnode, SArray* tasks) {
- SArray* pSinkTaskList = taosArrayGetP(tasks, SINK_NODE_LEVEL);
+ SArray* pSinkTaskList = taosArrayGetP(tasks, SINK_NODE_LEVEL);
SArray** pAggTaskList = taosArrayGetLast(tasks);
- for(int i = 0; i < taosArrayGetSize(*pAggTaskList); i++){
+ 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);
@@ -572,7 +607,7 @@ static void bindSourceSink(SStreamObj* pStream, SMnode* pMnode, SArray* tasks, b
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++){
+ for (int i = 0; i < taosArrayGetSize(pSourceTaskList); i++) {
SStreamTask* pSourceTask = taosArrayGetP(pSourceTaskList, i);
mDebug("bindSourceSink taskId:%s to sink task list", pSourceTask->id.idStr);
@@ -591,8 +626,8 @@ static void bindTwoLevel(SArray* tasks, int32_t begin, int32_t end) {
SArray* pUpTaskList = taosArrayGetP(tasks, size - 2);
SStreamTask** pDownTask = taosArrayGetLast(pDownTaskList);
- end = end > taosArrayGetSize(pUpTaskList) ? taosArrayGetSize(pUpTaskList): end;
- for(int i = begin; i < end; i++){
+ 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);
@@ -616,8 +651,8 @@ 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);
+ 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);
@@ -632,7 +667,7 @@ static int32_t doScheduleStream(SStreamObj* pStream, SMnode* pMnode, SQueryPlan*
pStream->totalLevel = numOfPlanLevel + hasExtraSink;
- SSubplan* plan = getScanSubPlan(pPlan); // source plan
+ SSubplan* plan = getScanSubPlan(pPlan); // source plan
if (plan == NULL) {
return terrno;
}
@@ -649,32 +684,32 @@ static int32_t doScheduleStream(SStreamObj* pStream, SMnode* pMnode, SQueryPlan*
return TDB_CODE_SUCCESS;
}
- if(numOfPlanLevel == 3){
+ if (numOfPlanLevel == 3) {
plan = getAggSubPlan(pPlan, 1); // middle agg plan
if (plan == NULL) {
return terrno;
}
- do{
+ do {
SArray** list = taosArrayGetLast(pStream->tasks);
- float size = (float)taosArrayGetSize(*list);
- size_t cnt = (size_t)ceil(size/tsStreamAggCnt);
- if(cnt <= 1) break;
+ 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++){
+ 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);
+ bindTwoLevel(pStream->tasks, j * tsStreamAggCnt, (j + 1) * tsStreamAggCnt);
if (pStream->conf.fillHistory) {
- bindTwoLevel(pStream->pHTasksList, j*tsStreamAggCnt, (j+1)*tsStreamAggCnt);
+ bindTwoLevel(pStream->pHTasksList, j * tsStreamAggCnt, (j + 1) * tsStreamAggCnt);
}
}
- }while(1);
+ } while (1);
}
plan = getAggSubPlan(pPlan, 0);
@@ -684,7 +719,7 @@ static int32_t doScheduleStream(SStreamObj* pStream, SMnode* pMnode, SQueryPlan*
mDebug("doScheduleStream add final agg");
SArray** list = taosArrayGetLast(pStream->tasks);
- size_t size = taosArrayGetSize(*list);
+ size_t size = taosArrayGetSize(*list);
addNewTaskList(pStream);
code = addAggTask(pStream, pMnode, plan, pEpset, true);
if (code != TSDB_CODE_SUCCESS) {
diff --git a/source/dnode/mnode/impl/src/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c
index 1e92b1a181..05189d5a53 100644
--- a/source/dnode/mnode/impl/src/mndSma.c
+++ b/source/dnode/mnode/impl/src/mndSma.c
@@ -567,6 +567,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
streamObj.conf.triggerParam = pCreate->maxDelay;
streamObj.ast = taosStrdup(smaObj.ast);
streamObj.indexForMultiAggBalance = -1;
+ streamObj.subTableWithoutMd5 = 1;
// check the maxDelay
if (streamObj.conf.triggerParam < TSDB_MIN_ROLLUP_MAX_DELAY) {
@@ -898,11 +899,11 @@ _OVER:
}
int32_t mndDropSmasByStb(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb) {
- SSdb *pSdb = pMnode->pSdb;
- SSmaObj *pSma = NULL;
- void *pIter = NULL;
- SVgObj *pVgroup = NULL;
- int32_t code = -1;
+ SSdb *pSdb = pMnode->pSdb;
+ SSmaObj *pSma = NULL;
+ void *pIter = NULL;
+ SVgObj *pVgroup = NULL;
+ int32_t code = -1;
while (1) {
pIter = sdbFetch(pSdb, SDB_SMA, pIter, (void **)&pSma);
diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c
index 190b4f28ce..4e0c76f6de 100644
--- a/source/dnode/mnode/impl/src/mndStream.c
+++ b/source/dnode/mnode/impl/src/mndStream.c
@@ -27,7 +27,7 @@
#include "tmisce.h"
#include "tname.h"
-#define MND_STREAM_MAX_NUM 60
+#define MND_STREAM_MAX_NUM 60
typedef struct SMStreamNodeCheckMsg {
int8_t placeHolder; // // to fix windows compile error, define place holder
@@ -152,7 +152,7 @@ SSdbRow *mndStreamActionDecode(SSdbRaw *pRaw) {
goto STREAM_DECODE_OVER;
}
- if (sver != MND_STREAM_VER_NUMBER) {
+ if (sver < 1 || sver > MND_STREAM_VER_NUMBER) {
terrno = 0;
mError("stream read invalid ver, data ver: %d, curr ver: %d", sver, MND_STREAM_VER_NUMBER);
goto STREAM_DECODE_OVER;
@@ -192,7 +192,7 @@ SSdbRow *mndStreamActionDecode(SSdbRaw *pRaw) {
STREAM_DECODE_OVER:
taosMemoryFreeClear(buf);
if (terrno != TSDB_CODE_SUCCESS) {
- char* p = (pStream == NULL) ? "null" : pStream->name;
+ char *p = (pStream == NULL) ? "null" : pStream->name;
mError("stream:%s, failed to decode from raw:%p since %s", p, pRaw, terrstr());
taosMemoryFreeClear(pRow);
return NULL;
@@ -634,7 +634,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
terrno = TSDB_CODE_SUCCESS;
if ((terrno = grantCheck(TSDB_GRANT_STREAMS)) < 0) {
- goto _OVER;
+ return terrno;
}
SCMCreateStreamReq createReq = {0};
@@ -802,8 +802,7 @@ static int32_t mndProcessStreamCheckpointTmr(SRpcMsg *pReq) {
}
static int32_t mndBuildStreamCheckpointSourceReq(void **pBuf, int32_t *pLen, int32_t nodeId, int64_t checkpointId,
- int64_t streamId, int32_t taskId, int32_t transId,
- int8_t mndTrigger) {
+ int64_t streamId, int32_t taskId, int32_t transId, int8_t mndTrigger) {
SStreamCheckpointSourceReq req = {0};
req.checkpointId = checkpointId;
req.nodeId = nodeId;
@@ -878,11 +877,10 @@ static int32_t mndProcessStreamCheckpointTrans(SMnode *pMnode, SStreamObj *pStre
int32_t code = -1;
int64_t ts = taosGetTimestampMs();
if (mndTrigger == 1 && (ts - pStream->checkpointFreq < tsStreamCheckpointInterval * 1000)) {
-// mWarn("checkpoint interval less than the threshold, ignore it");
+ // mWarn("checkpoint interval less than the threshold, ignore it");
return -1;
}
-
bool conflict = mndStreamTransConflictCheck(pMnode, pStream->uid, MND_STREAM_CHECKPOINT_NAME, lock);
if (conflict) {
mndAddtoCheckpointWaitingList(pStream, checkpointId);
@@ -1144,7 +1142,7 @@ static int32_t mndProcessDropStreamReq(SRpcMsg *pReq) {
return -1;
}
- STrans* pTrans = doCreateTrans(pMnode, pStream, pReq, MND_STREAM_DROP_NAME, "drop stream");
+ STrans *pTrans = doCreateTrans(pMnode, pStream, pReq, MND_STREAM_DROP_NAME, "drop stream");
if (pTrans == NULL) {
mError("stream:%s, failed to drop since %s", dropReq.name, terrstr());
sdbRelease(pMnode->pSdb, pStream);
@@ -1570,7 +1568,7 @@ static int32_t mndProcessPauseStreamReq(SRpcMsg *pReq) {
return -1;
}
- STrans* pTrans = doCreateTrans(pMnode, pStream, pReq, MND_STREAM_PAUSE_NAME, "pause the stream");
+ STrans *pTrans = doCreateTrans(pMnode, pStream, pReq, MND_STREAM_PAUSE_NAME, "pause the stream");
if (pTrans == NULL) {
mError("stream:%s failed to pause stream since %s", pauseReq.name, terrstr());
sdbRelease(pMnode->pSdb, pStream);
@@ -1590,7 +1588,7 @@ static int32_t mndProcessPauseStreamReq(SRpcMsg *pReq) {
// pause stream
taosWLockLatch(&pStream->lock);
pStream->status = STREAM_STATUS__PAUSE;
- if (mndPersistTransLog(pStream, pTrans,SDB_STATUS_READY) < 0) {
+ if (mndPersistTransLog(pStream, pTrans, SDB_STATUS_READY) < 0) {
taosWUnLockLatch(&pStream->lock);
sdbRelease(pMnode->pSdb, pStream);
@@ -1617,7 +1615,7 @@ static int32_t mndProcessResumeStreamReq(SRpcMsg *pReq) {
SMnode *pMnode = pReq->info.node;
SStreamObj *pStream = NULL;
- if(grantCheckExpire(TSDB_GRANT_STREAMS) < 0){
+ if (grantCheckExpire(TSDB_GRANT_STREAMS) < 0) {
terrno = TSDB_CODE_GRANT_EXPIRED;
return -1;
}
@@ -1659,7 +1657,7 @@ static int32_t mndProcessResumeStreamReq(SRpcMsg *pReq) {
return -1;
}
- STrans* pTrans = doCreateTrans(pMnode, pStream, pReq, MND_STREAM_RESUME_NAME, "resume the stream");
+ 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", resumeReq.name, terrstr());
sdbRelease(pMnode->pSdb, pStream);
@@ -2106,10 +2104,10 @@ void removeStreamTasksInBuf(SStreamObj *pStream, SStreamExecInfo *pExecNode) {
ASSERT(taosHashGetSize(pExecNode->pTaskMap) == taosArrayGetSize(pExecNode->pTaskList));
}
-static void doAddTaskId(SArray* pList, int32_t taskId, int64_t uid, int32_t numOfTotal) {
+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) {
- int32_t* pId = taosArrayGet(pList, i);
+ for (int32_t i = 0; i < num; ++i) {
+ int32_t *pId = taosArrayGet(pList, i);
if (taskId == *pId) {
return;
}
@@ -2122,7 +2120,7 @@ static void doAddTaskId(SArray* pList, int32_t taskId, int64_t uid, int32_t numO
}
int32_t mndProcessStreamReqCheckpoint(SRpcMsg *pReq) {
- SMnode *pMnode = pReq->info.node;
+ SMnode *pMnode = pReq->info.node;
SStreamTaskCheckpointReq req = {0};
SDecoder decoder = {0};
@@ -2143,7 +2141,7 @@ int32_t mndProcessStreamReqCheckpoint(SRpcMsg *pReq) {
SStreamObj *pStream = mndGetStreamObj(pMnode, req.streamId);
if (pStream == NULL) {
- mError("failed to find the stream:0x%"PRIx64" not handle the checkpoint req", req.streamId);
+ mError("failed to find the stream:0x%" PRIx64 " not handle the checkpoint req", req.streamId);
terrno = TSDB_CODE_MND_STREAM_NOT_EXIST;
taosThreadMutexUnlock(&execInfo.lock);
@@ -2151,13 +2149,13 @@ int32_t mndProcessStreamReqCheckpoint(SRpcMsg *pReq) {
}
int32_t numOfTasks = mndGetNumOfStreamTasks(pStream);
- SArray **pReqTaskList = (SArray**)taosHashGet(execInfo.pTransferStateStreams, &req.streamId, sizeof(req.streamId));
+ SArray **pReqTaskList = (SArray **)taosHashGet(execInfo.pTransferStateStreams, &req.streamId, sizeof(req.streamId));
if (pReqTaskList == NULL) {
SArray *pList = taosArrayInit(4, sizeof(int32_t));
doAddTaskId(pList, req.taskId, pStream->uid, numOfTasks);
taosHashPut(execInfo.pTransferStateStreams, &req.streamId, sizeof(int64_t), &pList, sizeof(void *));
- pReqTaskList = (SArray**)taosHashGet(execInfo.pTransferStateStreams, &req.streamId, sizeof(req.streamId));
+ pReqTaskList = (SArray **)taosHashGet(execInfo.pTransferStateStreams, &req.streamId, sizeof(req.streamId));
} else {
doAddTaskId(*pReqTaskList, req.taskId, pStream->uid, numOfTasks);
}
diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c
index 0d23db09e5..de543f4256 100644
--- a/source/dnode/mnode/impl/src/mndTopic.c
+++ b/source/dnode/mnode/impl/src/mndTopic.c
@@ -564,6 +564,10 @@ static int32_t mndProcessCreateTopicReq(SRpcMsg *pReq) {
return code;
}
+ if ((terrno = grantCheck(TSDB_GRANT_SUBSCRIPTION)) < 0) {
+ return code;
+ }
+
if (tDeserializeSCMCreateTopicReq(pReq->pCont, pReq->contLen, &createTopicReq) != 0) {
terrno = TSDB_CODE_INVALID_MSG;
goto _OVER;
diff --git a/source/dnode/snode/src/snode.c b/source/dnode/snode/src/snode.c
index f173c327c7..9a017e7074 100644
--- a/source/dnode/snode/src/snode.c
+++ b/source/dnode/snode/src/snode.c
@@ -85,8 +85,9 @@ int32_t sndExpandTask(SSnode *pSnode, 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;
+ pChkInfo->processedVer = pChkInfo->checkpointVer;
sndInfo("s-task:%s restore from the checkpointId:%" PRId64 " ver:%" PRId64 " nextProcessVer:%" PRId64,
pTask->id.idStr, pChkInfo->checkpointId, pChkInfo->checkpointVer, pChkInfo->nextProcessVer);
}
diff --git a/source/dnode/snode/src/snodeInitApi.c b/source/dnode/snode/src/snodeInitApi.c
index c605a8373e..3b60ef3427 100644
--- a/source/dnode/snode/src/snodeInitApi.c
+++ b/source/dnode/snode/src/snodeInitApi.c
@@ -67,12 +67,17 @@ void initStateStoreAPI(SStateStore* pStore) {
pStore->streamStateSessionPut = streamStateSessionPut;
pStore->streamStateSessionGet = streamStateSessionGet;
pStore->streamStateSessionDel = streamStateSessionDel;
+ pStore->streamStateSessionReset = streamStateSessionReset;
pStore->streamStateSessionClear = streamStateSessionClear;
pStore->streamStateSessionGetKVByCur = streamStateSessionGetKVByCur;
pStore->streamStateStateAddIfNotExist = streamStateStateAddIfNotExist;
pStore->streamStateSessionGetKeyByRange = streamStateSessionGetKeyByRange;
+ pStore->streamStateCountGetKeyByRange = streamStateCountGetKeyByRange;
pStore->streamStateSessionAllocWinBuffByNextPosition = streamStateSessionAllocWinBuffByNextPosition;
+ pStore->streamStateCountWinAddIfNotExist = streamStateCountWinAddIfNotExist;
+ pStore->streamStateCountWinAdd = streamStateCountWinAdd;
+
pStore->updateInfoInit = updateInfoInit;
pStore->updateInfoFillBlockData = updateInfoFillBlockData;
pStore->updateInfoIsUpdated = updateInfoIsUpdated;
@@ -89,6 +94,7 @@ void initStateStoreAPI(SStateStore* pStore) {
pStore->updateInfoDeserialize = updateInfoDeserialize;
pStore->streamStateSessionSeekKeyNext = streamStateSessionSeekKeyNext;
+ pStore->streamStateCountSeekKeyPrev = streamStateCountSeekKeyPrev;
pStore->streamStateSessionSeekKeyCurrentPrev = streamStateSessionSeekKeyCurrentPrev;
pStore->streamStateSessionSeekKeyCurrentNext = streamStateSessionSeekKeyCurrentNext;
diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h
index 23f79158c3..fb6a86843c 100644
--- a/source/dnode/vnode/src/inc/vnodeInt.h
+++ b/source/dnode/vnode/src/inc/vnodeInt.h
@@ -214,6 +214,13 @@ int32_t tsdbBegin(STsdb* pTsdb);
// int32_t tsdbPrepareCommit(STsdb* pTsdb);
// int32_t tsdbCommit(STsdb* pTsdb, SCommitInfo* pInfo);
int32_t tsdbCacheCommit(STsdb* pTsdb);
+int32_t tsdbCacheNewTable(STsdb* pTsdb, int64_t uid, tb_uid_t suid, SSchemaWrapper* pSchemaRow);
+int32_t tsdbCacheDropTable(STsdb* pTsdb, int64_t uid, tb_uid_t suid, SSchemaWrapper* pSchemaRow);
+int32_t tsdbCacheDropSubTables(STsdb* pTsdb, SArray* uids, tb_uid_t suid);
+int32_t tsdbCacheNewSTableColumn(STsdb* pTsdb, SArray* uids, int16_t cid, int8_t col_type);
+int32_t tsdbCacheDropSTableColumn(STsdb* pTsdb, SArray* uids, int16_t cid, int8_t col_type);
+int32_t tsdbCacheNewNTableColumn(STsdb* pTsdb, int64_t uid, int16_t cid, int8_t col_type);
+int32_t tsdbCacheDropNTableColumn(STsdb* pTsdb, int64_t uid, int16_t cid, int8_t col_type);
int32_t tsdbCompact(STsdb* pTsdb, SCompactInfo* pInfo);
int32_t tsdbRetention(STsdb* tsdb, int64_t now, int32_t sync);
int tsdbScanAndConvertSubmitMsg(STsdb* pTsdb, SSubmitReq2* pMsg);
diff --git a/source/dnode/vnode/src/meta/metaSnapshot.c b/source/dnode/vnode/src/meta/metaSnapshot.c
index 18190ac533..e86ed3b657 100644
--- a/source/dnode/vnode/src/meta/metaSnapshot.c
+++ b/source/dnode/vnode/src/meta/metaSnapshot.c
@@ -96,29 +96,29 @@ int32_t metaSnapRead(SMetaSnapReader* pReader, uint8_t** ppData) {
continue;
}
+ if (!pData || !nData) {
+ metaError("meta/snap: invalide nData: %" PRId32 " meta snap read failed.", nData);
+ goto _exit;
+ }
+
+ *ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + nData);
+ if (*ppData == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _err;
+ }
+
+ SSnapDataHdr* pHdr = (SSnapDataHdr*)(*ppData);
+ pHdr->type = SNAP_DATA_META;
+ pHdr->size = nData;
+ memcpy(pHdr->data, pData, nData);
+
+ metaDebug("vgId:%d, vnode snapshot meta read data, version:%" PRId64 " uid:%" PRId64 " blockLen:%d",
+ TD_VID(pReader->pMeta->pVnode), key.version, key.uid, nData);
+
tdbTbcMoveToNext(pReader->pTbc);
break;
}
- if (!pData || !nData) {
- metaError("meta/snap: invalide nData: %" PRId32 " meta snap read failed.", nData);
- goto _exit;
- }
-
- *ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + nData);
- if (*ppData == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- goto _err;
- }
-
- SSnapDataHdr* pHdr = (SSnapDataHdr*)(*ppData);
- pHdr->type = SNAP_DATA_META;
- pHdr->size = nData;
- memcpy(pHdr->data, pData, nData);
-
- metaDebug("vgId:%d, vnode snapshot meta read data, version:%" PRId64 " uid:%" PRId64 " blockLen:%d",
- TD_VID(pReader->pMeta->pVnode), key.version, key.uid, nData);
-
_exit:
return code;
@@ -619,7 +619,8 @@ SMetaTableInfo getMetaTableInfoFromSnapshot(SSnapContext* ctx) {
int32_t ret = MoveToPosition(ctx, idInfo->version, *uidTmp);
if (ret != 0) {
- metaDebug("tmqsnap getMetaTableInfoFromSnapshot not exist uid:%" PRIi64 " version:%" PRIi64, *uidTmp, idInfo->version);
+ metaDebug("tmqsnap getMetaTableInfoFromSnapshot not exist uid:%" PRIi64 " version:%" PRIi64, *uidTmp,
+ idInfo->version);
continue;
}
tdbTbcGet((TBC*)ctx->pCur, (const void**)&pKey, &kLen, (const void**)&pVal, &vLen);
diff --git a/source/dnode/vnode/src/meta/metaTable.c b/source/dnode/vnode/src/meta/metaTable.c
index ac2486eda1..a2c7a04ab3 100644
--- a/source/dnode/vnode/src/meta/metaTable.c
+++ b/source/dnode/vnode/src/meta/metaTable.c
@@ -303,6 +303,8 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq, SArray *tb
tdbTbcClose(pCtbIdxc);
+ (void)tsdbCacheDropSubTables(pMeta->pVnode->pTsdb, tbUidList, pReq->suid);
+
metaWLock(pMeta);
for (int32_t iChild = 0; iChild < taosArrayGetSize(tbUidList); iChild++) {
@@ -334,6 +336,40 @@ _exit:
return 0;
}
+static void metaGetSubtables(SMeta *pMeta, int64_t suid, SArray *uids) {
+ if (!uids) return;
+
+ int c = 0;
+ void *pKey = NULL;
+ int nKey = 0;
+ TBC *pCtbIdxc = NULL;
+
+ tdbTbcOpen(pMeta->pCtbIdx, &pCtbIdxc, NULL);
+ int rc = tdbTbcMoveTo(pCtbIdxc, &(SCtbIdxKey){.suid = suid, .uid = INT64_MIN}, sizeof(SCtbIdxKey), &c);
+ if (rc < 0) {
+ tdbTbcClose(pCtbIdxc);
+ metaWLock(pMeta);
+ return;
+ }
+
+ for (;;) {
+ rc = tdbTbcNext(pCtbIdxc, &pKey, &nKey, NULL, NULL);
+ if (rc < 0) break;
+
+ if (((SCtbIdxKey *)pKey)->suid < suid) {
+ continue;
+ } else if (((SCtbIdxKey *)pKey)->suid > suid) {
+ break;
+ }
+
+ taosArrayPush(uids, &(((SCtbIdxKey *)pKey)->uid));
+ }
+
+ tdbFree(pKey);
+
+ tdbTbcClose(pCtbIdxc);
+}
+
int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
SMetaEntry oStbEntry = {0};
SMetaEntry nStbEntry = {0};
@@ -397,9 +433,39 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
nStbEntry.stbEntry.schemaRow = pReq->schemaRow;
nStbEntry.stbEntry.schemaTag = pReq->schemaTag;
- int32_t deltaCol = pReq->schemaRow.nCols - oStbEntry.stbEntry.schemaRow.nCols;
+ int nCols = pReq->schemaRow.nCols;
+ int onCols = oStbEntry.stbEntry.schemaRow.nCols;
+ int32_t deltaCol = nCols - onCols;
bool updStat = deltaCol != 0 && !metaTbInFilterCache(pMeta, pReq->name, 1);
+ if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
+ STsdb *pTsdb = pMeta->pVnode->pTsdb;
+ SArray *uids = taosArrayInit(8, sizeof(int64_t));
+ if (deltaCol == 1) {
+ int16_t cid = pReq->schemaRow.pSchema[nCols - 1].colId;
+ int8_t col_type = pReq->schemaRow.pSchema[nCols - 1].type;
+
+ metaGetSubtables(pMeta, pReq->suid, uids);
+ tsdbCacheNewSTableColumn(pTsdb, uids, cid, col_type);
+ } else if (deltaCol == -1) {
+ int16_t cid = -1;
+ int8_t col_type = -1;
+ for (int i = 0, j = 0; i < nCols && j < onCols; ++i, ++j) {
+ if (pReq->schemaRow.pSchema[i].colId != oStbEntry.stbEntry.schemaRow.pSchema[j].colId) {
+ cid = oStbEntry.stbEntry.schemaRow.pSchema[j].colId;
+ col_type = oStbEntry.stbEntry.schemaRow.pSchema[j].type;
+ break;
+ }
+ }
+
+ if (cid != -1) {
+ metaGetSubtables(pMeta, pReq->suid, uids);
+ tsdbCacheDropSTableColumn(pTsdb, uids, cid, col_type);
+ }
+ }
+ if (uids) taosArrayDestroy(uids);
+ }
+
metaWLock(pMeta);
// compare two entry
if (oStbEntry.stbEntry.schemaRow.version != pReq->schemaRow.version) {
@@ -822,6 +888,10 @@ int metaCreateTable(SMeta *pMeta, int64_t ver, SVCreateTbReq *pReq, STableMetaRs
metaUidCacheClear(pMeta, me.ctbEntry.suid);
metaTbGroupCacheClear(pMeta, me.ctbEntry.suid);
metaULock(pMeta);
+
+ if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
+ tsdbCacheNewTable(pMeta->pVnode->pTsdb, me.uid, me.ctbEntry.suid, NULL);
+ }
} else {
me.ntbEntry.btime = pReq->btime;
me.ntbEntry.ttlDays = pReq->ttl;
@@ -832,6 +902,10 @@ int metaCreateTable(SMeta *pMeta, int64_t ver, SVCreateTbReq *pReq, STableMetaRs
++pStats->numOfNTables;
pStats->numOfNTimeSeries += me.ntbEntry.schemaRow.nCols - 1;
+
+ if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
+ tsdbCacheNewTable(pMeta->pVnode->pTsdb, me.uid, -1, &me.ntbEntry.schemaRow);
+ }
}
if (metaHandleEntry(pMeta, &me) < 0) goto _err;
@@ -896,6 +970,10 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq, SArray *tbUi
if ((type == TSDB_CHILD_TABLE || type == TSDB_NORMAL_TABLE) && tbUids) {
taosArrayPush(tbUids, &uid);
+
+ if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
+ tsdbCacheDropTable(pMeta->pVnode->pTsdb, uid, suid, NULL);
+ }
}
if ((type == TSDB_CHILD_TABLE) && tbUid) {
@@ -930,6 +1008,11 @@ void metaDropTables(SMeta *pMeta, SArray *tbUids) {
}
tSimpleHashPut(suidHash, &suid, sizeof(tb_uid_t), &nCtbDropped, sizeof(int64_t));
}
+
+ if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
+ tsdbCacheDropTable(pMeta->pVnode->pTsdb, uid, suid, NULL);
+ }
+
metaDebug("batch drop table:%" PRId64, uid);
}
metaULock(pMeta);
@@ -1172,11 +1255,22 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p
metaUpdateStbStats(pMeta, e.ctbEntry.suid, -1, 0);
metaUidCacheClear(pMeta, e.ctbEntry.suid);
metaTbGroupCacheClear(pMeta, e.ctbEntry.suid);
+ /*
+ if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
+ tsdbCacheDropTable(pMeta->pVnode->pTsdb, e.uid, e.ctbEntry.suid, NULL);
+ }
+ */
} else if (e.type == TSDB_NORMAL_TABLE) {
// drop schema.db (todo)
--pMeta->pVnode->config.vndStats.numOfNTables;
pMeta->pVnode->config.vndStats.numOfNTimeSeries -= e.ntbEntry.schemaRow.nCols - 1;
+
+ /*
+ if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
+ tsdbCacheDropTable(pMeta->pVnode->pTsdb, e.uid, -1, &e.ntbEntry.schemaRow);
+ }
+ */
} else if (e.type == TSDB_SUPER_TABLE) {
tdbTbDelete(pMeta->pSuidIdx, &e.uid, sizeof(tb_uid_t), pMeta->txn);
// drop schema.db (todo)
@@ -1364,6 +1458,12 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
++pMeta->pVnode->config.vndStats.numOfNTimeSeries;
metaTimeSeriesNotifyCheck(pMeta);
+
+ if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
+ int16_t cid = pSchema->pSchema[entry.ntbEntry.schemaRow.nCols - 1].colId;
+ int8_t col_type = pSchema->pSchema[entry.ntbEntry.schemaRow.nCols - 1].type;
+ (void)tsdbCacheNewNTableColumn(pMeta->pVnode->pTsdb, entry.uid, cid, col_type);
+ }
break;
case TSDB_ALTER_TABLE_DROP_COLUMN:
if (pColumn == NULL) {
@@ -1386,6 +1486,13 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
pSchema->nCols--;
--pMeta->pVnode->config.vndStats.numOfNTimeSeries;
+
+ if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
+ int16_t cid = pColumn->colId;
+ int8_t col_type = pColumn->type;
+
+ (void)tsdbCacheDropNTableColumn(pMeta->pVnode->pTsdb, entry.uid, cid, col_type);
+ }
break;
case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES:
if (pColumn == NULL) {
diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c
index bde6889ecd..6b7420b55f 100644
--- a/source/dnode/vnode/src/tq/tq.c
+++ b/source/dnode/vnode/src/tq/tq.c
@@ -14,8 +14,8 @@
*/
#include "tq.h"
-#include "vnd.h"
#include "tqCommon.h"
+#include "vnd.h"
// 0: not init
// 1: already inited
@@ -835,36 +835,37 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t nextProcessVer) {
// checkpoint ver is the kept version, handled data should be the next version.
if (pChkInfo->checkpointId != 0) {
pChkInfo->nextProcessVer = pChkInfo->checkpointVer + 1;
+ pChkInfo->processedVer = pChkInfo->checkpointVer;
tqInfo("s-task:%s restore from the checkpointId:%" PRId64 " ver:%" PRId64 " currentVer:%" PRId64, pTask->id.idStr,
pChkInfo->checkpointId, pChkInfo->checkpointVer, pChkInfo->nextProcessVer);
}
char* p = streamTaskGetStatus(pTask)->name;
+ const char* pNext = streamTaskGetStatusStr(pTask->status.taskStatus);
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, inputVer:%" PRId64,
+ " child id:%d, level:%d, cur-status:%s, next-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,
+ pTask->info.selfChildId, pTask->info.taskLevel, p, pNext, pTask->info.fillHistory,
(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, 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, nextProcessVer);
+ tqInfo(
+ "vgId:%d expand stream task, s-task:%s, checkpointId:%" PRId64 " checkpointVer:%" PRId64
+ " nextProcessVer:%" PRId64
+ " child id:%d, level:%d, cur-status:%s next-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, pNext, pTask->info.fillHistory,
+ (int32_t)pTask->hTaskInfo.id.taskId, pTask->info.triggerParam, nextProcessVer);
}
return 0;
}
-int32_t tqProcessTaskCheckReq(STQ* pTq, SRpcMsg* pMsg) {
- return tqStreamTaskProcessCheckReq(pTq->pStreamMeta, pMsg);
-}
+int32_t tqProcessTaskCheckReq(STQ* pTq, SRpcMsg* pMsg) { return tqStreamTaskProcessCheckReq(pTq->pStreamMeta, pMsg); }
int32_t tqProcessTaskCheckRsp(STQ* pTq, SRpcMsg* pMsg) {
return tqStreamTaskProcessCheckRsp(pTq->pStreamMeta, pMsg, vnodeIsRoleLeader(pTq->pVnode));
@@ -988,7 +989,7 @@ int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) {
streamReExecScanHistoryFuture(pTask, retInfo.idleTime);
} else {
SStreamTaskState* p = streamTaskGetStatus(pTask);
- ETaskStatus s = p->state;
+ ETaskStatus s = p->state;
if (s == TASK_STATUS__PAUSE) {
tqDebug("s-task:%s is paused in the step1, elapsed time:%.2fs total:%.2fs, sched-status:%d", pTask->id.idStr,
@@ -1015,8 +1016,8 @@ int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) {
tqError("failed to find s-task:0x%" PRIx64 ", it may have been destroyed, drop related fill-history task:%s",
pTask->streamTaskId.taskId, pTask->id.idStr);
- tqDebug("s-task:%s fill-history task set status to be dropping", id);
- streamBuildAndSendDropTaskMsg(pTask->pMsgCb, pMeta->vgId, &pTask->id);
+ tqDebug("s-task:%s fill-history task set status to be dropping and drop it", id);
+ streamBuildAndSendDropTaskMsg(pTask->pMsgCb, pMeta->vgId, &pTask->id, 0);
atomic_store_32(&pTask->status.inScanHistorySentinel, 0);
streamMetaReleaseTask(pMeta, pTask);
@@ -1062,7 +1063,7 @@ int32_t tqProcessTaskRunReq(STQ* pTq, SRpcMsg* pMsg) {
}
int32_t tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg) {
- return tqStreamTaskProcessDispatchReq(pTq->pStreamMeta, pMsg);
+ return tqStreamTaskProcessDispatchReq(pTq->pStreamMeta, pMsg);
}
int32_t tqProcessTaskDispatchRsp(STQ* pTq, SRpcMsg* pMsg) {
@@ -1101,7 +1102,7 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
pRsp->info.handle = NULL;
SStreamCheckpointSourceReq req = {0};
- SDecoder decoder;
+ SDecoder decoder;
tDecoderInit(&decoder, (uint8_t*)msg, len);
if (tDecodeStreamCheckpointSourceReq(&decoder, &req) < 0) {
code = TSDB_CODE_MSG_DECODE_ERROR;
@@ -1192,8 +1193,8 @@ int32_t tqProcessTaskCheckPointSourceReq(STQ* pTq, SRpcMsg* pMsg, SRpcMsg* pRsp)
streamProcessCheckpointSourceReq(pTask, &req);
taosThreadMutexUnlock(&pTask->lock);
- qInfo("s-task:%s (vgId:%d) level:%d receive checkpoint-source msg chkpt:%" PRId64 ", transId:%d",
- pTask->id.idStr, vgId, pTask->info.taskLevel, req.checkpointId, req.transId);
+ qInfo("s-task:%s (vgId:%d) level:%d receive checkpoint-source msg chkpt:%" PRId64 ", transId:%d", pTask->id.idStr,
+ vgId, pTask->info.taskLevel, req.checkpointId, req.transId);
code = streamAddCheckpointSourceRspMsg(&req, &pMsg->info, pTask, 1);
if (code != TSDB_CODE_SUCCESS) {
diff --git a/source/dnode/vnode/src/tq/tqHandleSnapshot.c b/source/dnode/vnode/src/tq/tqHandleSnapshot.c
index 3ce838ce8b..28fd315eb6 100644
--- a/source/dnode/vnode/src/tq/tqHandleSnapshot.c
+++ b/source/dnode/vnode/src/tq/tqHandleSnapshot.c
@@ -74,11 +74,11 @@ int32_t tqSnapReaderClose(STqSnapReader** ppReader) {
}
int32_t tqSnapRead(STqSnapReader* pReader, uint8_t** ppData) {
- int32_t code = 0;
- void* pKey = NULL;
- void* pVal = NULL;
- int32_t kLen = 0;
- int32_t vLen = 0;
+ int32_t code = 0;
+ void* pKey = NULL;
+ void* pVal = NULL;
+ int32_t kLen = 0;
+ int32_t vLen = 0;
if (tdbTbcNext(pReader->pCur, &pKey, &kLen, &pVal, &vLen)) {
goto _exit;
diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c
index 3ae007ce34..727157a2f8 100644
--- a/source/dnode/vnode/src/tq/tqRead.c
+++ b/source/dnode/vnode/src/tq/tqRead.c
@@ -207,8 +207,8 @@ int32_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, uint64_t
goto END;
}
- tqDebug("vgId:%d, consumer:0x%" PRIx64 " taosx get msg ver %" PRId64 ", type: %s, reqId:0x%" PRIx64" 0x%"PRIx64, vgId,
- pHandle->consumerId, offset, TMSG_INFO(pHandle->pWalReader->pHead->head.msgType), reqId, id);
+ tqDebug("vgId:%d, consumer:0x%" PRIx64 " taosx get msg ver %" PRId64 ", type: %s, reqId:0x%" PRIx64 " 0x%" PRIx64,
+ vgId, pHandle->consumerId, offset, TMSG_INFO(pHandle->pWalReader->pHead->head.msgType), reqId, id);
if (pHandle->pWalReader->pHead->head.msgType == TDMT_VND_SUBMIT) {
code = walFetchBody(pHandle->pWalReader);
@@ -303,7 +303,7 @@ int32_t tqReaderSeek(STqReader* pReader, int64_t ver, const char* id) {
int32_t extractMsgFromWal(SWalReader* pReader, void** pItem, int64_t maxVer, const char* id) {
int32_t code = 0;
- while(1) {
+ while (1) {
code = walNextValidMsg(pReader);
if (code != TSDB_CODE_SUCCESS) {
return code;
@@ -322,7 +322,8 @@ int32_t extractMsgFromWal(SWalReader* pReader, void** pItem, int64_t maxVer, con
void* data = taosMemoryMalloc(len);
if (data == NULL) {
- // todo: for all stream in this vnode, keep this offset in the offset files, and wait for a moment, and then retry
+ // todo: for all stream in this vnode, keep this offset in the offset files, and wait for a moment, and then
+ // retry
code = TSDB_CODE_OUT_OF_MEMORY;
terrno = code;
@@ -369,7 +370,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, int sourceExcluded) {
- SWalReader* pWalReader = pReader->pWalReader;
+ SWalReader* pWalReader = pReader->pWalReader;
SSDataBlock* pDataBlock = NULL;
uint64_t st = taosGetTimestampMs();
@@ -387,22 +388,22 @@ bool tqNextBlockInWal(STqReader* pReader, const char* id, int sourceExcluded) {
pReader->nextBlk = 0;
int32_t numOfBlocks = taosArrayGetSize(pReader->submit.aSubmitTbData);
while (pReader->nextBlk < numOfBlocks) {
- tqTrace("tq reader next data block %d/%d, len:%d %" PRId64, pReader->nextBlk,
- numOfBlocks, pReader->msg.msgLen, pReader->msg.ver);
+ tqTrace("tq reader next data block %d/%d, len:%d %" PRId64, pReader->nextBlk, numOfBlocks, pReader->msg.msgLen,
+ pReader->msg.ver);
SSubmitTbData* pSubmitTbData = taosArrayGet(pReader->submit.aSubmitTbData, pReader->nextBlk);
- if ((pSubmitTbData->source & sourceExcluded) != 0){
+ 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;
- int32_t code = tqRetrieveDataBlock(pReader, &pRes, NULL);
+ int32_t code = tqRetrieveDataBlock(pReader, &pRes, NULL);
if (code == TSDB_CODE_SUCCESS && pRes->info.rows > 0) {
- if(pDataBlock == NULL){
+ if (pDataBlock == NULL) {
pDataBlock = createOneDataBlock(pRes, true);
- }else{
+ } else {
blockDataMerge(pDataBlock, pRes);
}
}
@@ -414,16 +415,16 @@ bool tqNextBlockInWal(STqReader* pReader, const char* id, int sourceExcluded) {
tDestroySubmitReq(&pReader->submit, TSDB_MSG_FLG_DECODE);
pReader->msg.msgStr = NULL;
- if(pDataBlock != NULL){
+ if (pDataBlock != NULL) {
blockDataCleanup(pReader->pResBlock);
copyDataBlock(pReader->pResBlock, pDataBlock);
blockDataDestroy(pDataBlock);
return true;
- }else{
+ } else {
qTrace("stream scan return empty, all %d submit blocks consumed, %s", numOfBlocks, id);
}
- if(taosGetTimestampMs() - st > 1000){
+ if (taosGetTimestampMs() - st > 1000) {
return false;
}
}
@@ -448,17 +449,11 @@ int32_t tqReaderSetSubmitMsg(STqReader* pReader, void* msgStr, int32_t msgLen, i
return 0;
}
-SWalReader* tqGetWalReader(STqReader* pReader) {
- return pReader->pWalReader;
-}
+SWalReader* tqGetWalReader(STqReader* pReader) { return pReader->pWalReader; }
-SSDataBlock* tqGetResultBlock (STqReader* pReader) {
- return pReader->pResBlock;
-}
+SSDataBlock* tqGetResultBlock(STqReader* pReader) { return pReader->pResBlock; }
-int64_t tqGetResultBlockTime(STqReader *pReader){
- return pReader->lastTs;
-}
+int64_t tqGetResultBlockTime(STqReader* pReader) { return pReader->lastTs; }
bool tqNextBlockImpl(STqReader* pReader, const char* idstr) {
if (pReader->msg.msgStr == NULL) {
@@ -599,7 +594,7 @@ static int32_t doSetVal(SColumnInfoData* pColumnInfoData, int32_t rowIndex, SCol
if (IS_STR_DATA_TYPE(pColVal->type)) {
char val[65535 + 2] = {0};
- if(COL_VAL_IS_VALUE(pColVal)){
+ if (COL_VAL_IS_VALUE(pColVal)) {
if (pColVal->value.pData != NULL) {
memcpy(varDataVal(val), pColVal->value.pData, pColVal->value.nData);
}
@@ -874,7 +869,7 @@ int32_t tqRetrieveTaosxBlock(STqReader* pReader, SArray* blocks, SArray* schemas
sourceIdx++;
} else if (pCol->cid == pColData->info.colId) {
tColDataGetValue(pCol, i, &colVal);
- if(doSetVal(pColData, curRow - lastRow, &colVal) != TDB_CODE_SUCCESS){
+ if (doSetVal(pColData, curRow - lastRow, &colVal) != TDB_CODE_SUCCESS) {
goto FAIL;
}
sourceIdx++;
@@ -958,10 +953,10 @@ int32_t tqRetrieveTaosxBlock(STqReader* pReader, SArray* blocks, SArray* schemas
if (colVal.cid < pColData->info.colId) {
sourceIdx++;
} else if (colVal.cid == pColData->info.colId) {
- if(doSetVal(pColData, curRow - lastRow, &colVal) != TDB_CODE_SUCCESS){
+ if (doSetVal(pColData, curRow - lastRow, &colVal) != TDB_CODE_SUCCESS) {
goto FAIL;
}
- sourceIdx++;
+ sourceIdx++;
targetIdx++;
}
}
@@ -1001,7 +996,7 @@ int tqReaderSetTbUidList(STqReader* pReader, const SArray* tbUidList, const char
taosHashPut(pReader->tbIdHash, pKey, sizeof(int64_t), NULL, 0);
}
- tqDebug("s-task:%s %d tables are set to be queried target table", id, (int32_t) taosArrayGetSize(tbUidList));
+ tqDebug("s-task:%s %d tables are set to be queried target table", id, (int32_t)taosArrayGetSize(tbUidList));
return 0;
}
@@ -1027,9 +1022,7 @@ bool tqReaderIsQueriedTable(STqReader* pReader, uint64_t uid) {
return taosHashGet(pReader->tbIdHash, &uid, sizeof(uint64_t));
}
-bool tqCurrentBlockConsumed(const STqReader* pReader) {
- return pReader->msg.msgStr == NULL;
-}
+bool tqCurrentBlockConsumed(const STqReader* pReader) { return pReader->msg.msgStr == NULL; }
int tqReaderRemoveTbUidList(STqReader* pReader, const SArray* tbUidList) {
for (int32_t i = 0; i < taosArrayGetSize(tbUidList); i++) {
@@ -1071,9 +1064,11 @@ int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd) {
} else if (pTqHandle->execHandle.subType == TOPIC_SUB_TYPE__TABLE) {
if (isAdd) {
SArray* list = NULL;
- int ret = qGetTableList(pTqHandle->execHandle.execTb.suid, pTq->pVnode, pTqHandle->execHandle.execTb.node, &list, pTqHandle->execHandle.task);
- if(ret != TDB_CODE_SUCCESS) {
- tqError("qGetTableList in tqUpdateTbUidList error:%d handle %s consumer:0x%" PRIx64, ret, pTqHandle->subKey, pTqHandle->consumerId);
+ int ret = qGetTableList(pTqHandle->execHandle.execTb.suid, pTq->pVnode, pTqHandle->execHandle.execTb.node,
+ &list, pTqHandle->execHandle.task);
+ if (ret != TDB_CODE_SUCCESS) {
+ tqError("qGetTableList in tqUpdateTbUidList error:%d handle %s consumer:0x%" PRIx64, ret, pTqHandle->subKey,
+ pTqHandle->consumerId);
taosArrayDestroy(list);
taosHashCancelIterate(pTq->pHandle, pIter);
taosWUnLockLatch(&pTq->lock);
diff --git a/source/dnode/vnode/src/tq/tqScan.c b/source/dnode/vnode/src/tq/tqScan.c
index d86c0a0474..f108cedcf5 100644
--- a/source/dnode/vnode/src/tq/tqScan.c
+++ b/source/dnode/vnode/src/tq/tqScan.c
@@ -63,8 +63,8 @@ static int32_t tqAddTbNameToRsp(const STQ* pTq, int64_t uid, STaosxRsp* pRsp, in
return 0;
}
-int32_t getDataBlock(qTaskInfo_t task, const STqHandle* pHandle, int32_t vgId, SSDataBlock** res){
- uint64_t ts = 0;
+int32_t getDataBlock(qTaskInfo_t task, const STqHandle* pHandle, int32_t vgId, SSDataBlock** res) {
+ uint64_t ts = 0;
qStreamSetOpen(task);
tqDebug("consumer:0x%" PRIx64 " vgId:%d, tmq one task start execute", pHandle->consumerId, vgId);
@@ -97,27 +97,27 @@ int32_t tqScanData(STQ* pTq, STqHandle* pHandle, SMqDataRsp* pRsp, STqOffsetVal*
while (1) {
SSDataBlock* pDataBlock = NULL;
code = getDataBlock(task, pHandle, vgId, &pDataBlock);
- if (code != 0){
+ if (code != 0) {
return code;
}
- if(pRequest->enableReplay){
- if(IS_OFFSET_RESET_TYPE(pRequest->reqOffset.type) && pHandle->block != NULL){
+ if (pRequest->enableReplay) {
+ if (IS_OFFSET_RESET_TYPE(pRequest->reqOffset.type) && pHandle->block != NULL) {
blockDataDestroy(pHandle->block);
pHandle->block = NULL;
}
- if(pHandle->block == NULL){
+ if (pHandle->block == NULL) {
if (pDataBlock == NULL) {
break;
}
STqOffsetVal offset = {0};
qStreamExtractOffset(task, &offset);
pHandle->block = createOneDataBlock(pDataBlock, true);
-// pHandle->block = createDataBlock();
-// copyDataBlock(pHandle->block, pDataBlock);
+ // pHandle->block = createDataBlock();
+ // copyDataBlock(pHandle->block, pDataBlock);
pHandle->blockTime = offset.ts;
code = getDataBlock(task, pHandle, vgId, &pDataBlock);
- if (code != 0){
+ if (code != 0) {
return code;
}
}
@@ -132,7 +132,7 @@ int32_t tqScanData(STQ* pTq, STqHandle* pHandle, SMqDataRsp* pRsp, STqOffsetVal*
if (pDataBlock == NULL) {
blockDataDestroy(pHandle->block);
pHandle->block = NULL;
- }else{
+ } else {
copyDataBlock(pHandle->block, pDataBlock);
STqOffsetVal offset = {0};
@@ -141,7 +141,7 @@ int32_t tqScanData(STQ* pTq, STqHandle* pHandle, SMqDataRsp* pRsp, STqOffsetVal*
pHandle->blockTime = offset.ts;
}
break;
- }else{
+ } else {
if (pDataBlock == NULL) {
break;
}
@@ -250,7 +250,8 @@ 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, int8_t sourceExcluded) {
+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*));
@@ -266,7 +267,7 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxR
if (terrno == TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND) goto loop_table;
}
- if ((pSubmitTbDataRet->source & sourceExcluded) != 0){
+ if ((pSubmitTbDataRet->source & sourceExcluded) != 0) {
goto loop_table;
}
if (pRsp->withTbName) {
@@ -303,7 +304,7 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxR
tEncoderClear(&encoder);
}
- if (pHandle->fetchMeta == ONLY_META && pSubmitTbDataRet->pCreateTbReq == NULL){
+ if (pHandle->fetchMeta == ONLY_META && pSubmitTbDataRet->pCreateTbReq == NULL) {
goto loop_table;
}
for (int32_t i = 0; i < taosArrayGetSize(pBlocks); i++) {
@@ -334,7 +335,7 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxR
if (terrno == TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND) goto loop_db;
}
- if ((pSubmitTbDataRet->source & sourceExcluded) != 0){
+ if ((pSubmitTbDataRet->source & sourceExcluded) != 0) {
goto loop_db;
}
if (pRsp->withTbName) {
@@ -371,7 +372,7 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxR
tEncoderClear(&encoder);
}
- if (pHandle->fetchMeta == ONLY_META && pSubmitTbDataRet->pCreateTbReq == NULL){
+ if (pHandle->fetchMeta == ONLY_META && pSubmitTbDataRet->pCreateTbReq == NULL) {
goto loop_db;
}
for (int32_t i = 0; i < taosArrayGetSize(pBlocks); i++) {
diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c
index b438b2dc0a..b56bf3e0fe 100644
--- a/source/dnode/vnode/src/tq/tqSink.c
+++ b/source/dnode/vnode/src/tq/tqSink.c
@@ -33,15 +33,18 @@ static int32_t doBuildAndSendDeleteMsg(SVnode* pVnode, char* stbFullName, SSData
int64_t suid);
static int32_t doBuildAndSendSubmitMsg(SVnode* pVnode, SStreamTask* pTask, SSubmitReq2* pReq, int32_t numOfBlocks);
static int32_t buildSubmitMsgImpl(SSubmitReq2* pSubmitReq, int32_t vgId, void** pMsg, int32_t* msgLen);
-static int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDataBlock* pDataBlock, const char* id);
+static int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDataBlock* pDataBlock,
+ const char* id);
static int32_t doWaitForDstTableCreated(SVnode* pVnode, SStreamTask* pTask, STableSinkInfo* pTableSinkInfo,
const char* dstTableName, int64_t* uid);
-static int32_t doPutIntoCache(SSHashObj* pSinkTableMap, STableSinkInfo* pTableSinkInfo, uint64_t groupId, const char* id);
+static int32_t doPutIntoCache(SSHashObj* pSinkTableMap, STableSinkInfo* pTableSinkInfo, uint64_t groupId,
+ const char* id);
static bool isValidDstChildTable(SMetaReader* pReader, int32_t vgId, const char* ctbName, int64_t suid);
-static int32_t initCreateTableMsg(SVCreateTbReq* pCreateTableReq, uint64_t suid, const char* stbFullName, int32_t numOfTags);
+static int32_t initCreateTableMsg(SVCreateTbReq* pCreateTableReq, uint64_t suid, const char* stbFullName,
+ int32_t numOfTags);
static SArray* createDefaultTagColName();
-static void setCreateTableMsgTableName(SVCreateTbReq* pCreateTableReq, SSDataBlock* pDataBlock, const char* stbFullName,
- int64_t gid, bool newSubTableRule);
+static void setCreateTableMsgTableName(SVCreateTbReq* pCreateTableReq, SSDataBlock* pDataBlock, const char* stbFullName,
+ int64_t gid, bool newSubTableRule);
int32_t tqBuildDeleteReq(STQ* pTq, const char* stbFullName, const SSDataBlock* pDataBlock, SBatchDeleteReq* deleteReq,
const char* pIdStr, bool newSubTableRule) {
@@ -68,10 +71,7 @@ int32_t tqBuildDeleteReq(STQ* pTq, const char* stbFullName, const SSDataBlock* p
if (varTbName != NULL && varTbName != (void*)-1) {
name = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN);
memcpy(name, varDataVal(varTbName), varDataLen(varTbName));
- if(newSubTableRule &&
- !isAutoTableName(name) &&
- !alreadyAddGroupId(name) &&
- groupId != 0) {
+ if (newSubTableRule && !isAutoTableName(name) && !alreadyAddGroupId(name) && groupId != 0) {
buildCtbNameAddGruopId(name, groupId);
}
} else if (stbFullName) {
@@ -134,7 +134,7 @@ end:
return ret;
}
-static bool tqGetTableInfo(SSHashObj* pTableInfoMap,uint64_t groupId, STableSinkInfo** pInfo) {
+static bool tqGetTableInfo(SSHashObj* pTableInfoMap, uint64_t groupId, STableSinkInfo** pInfo) {
void* pVal = tSimpleHashGet(pTableInfoMap, &groupId, sizeof(uint64_t));
if (pVal) {
*pInfo = *(STableSinkInfo**)pVal;
@@ -149,7 +149,7 @@ static int32_t tqPutReqToQueue(SVnode* pVnode, SVCreateTbBatchReq* pReqs) {
int32_t tlen = 0;
encodeCreateChildTableForRPC(pReqs, TD_VID(pVnode), &buf, &tlen);
- SRpcMsg msg = { .msgType = TDMT_VND_CREATE_TABLE, .pCont = buf, .contLen = tlen };
+ SRpcMsg msg = {.msgType = TDMT_VND_CREATE_TABLE, .pCont = buf, .contLen = tlen};
if (tmsgPutToQueue(&pVnode->msgCb, WRITE_QUEUE, &msg) != 0) {
tqError("failed to put into write-queue since %s", terrstr());
}
@@ -181,14 +181,12 @@ SArray* createDefaultTagColName() {
void setCreateTableMsgTableName(SVCreateTbReq* pCreateTableReq, SSDataBlock* pDataBlock, const char* stbFullName,
int64_t gid, bool newSubTableRule) {
if (pDataBlock->info.parTbName[0]) {
- if(newSubTableRule &&
- !isAutoTableName(pDataBlock->info.parTbName) &&
- !alreadyAddGroupId(pDataBlock->info.parTbName) &&
- gid != 0) {
+ if (newSubTableRule && !isAutoTableName(pDataBlock->info.parTbName) &&
+ !alreadyAddGroupId(pDataBlock->info.parTbName) && gid != 0) {
pCreateTableReq->name = taosMemoryCalloc(1, TSDB_TABLE_NAME_LEN);
strcpy(pCreateTableReq->name, pDataBlock->info.parTbName);
buildCtbNameAddGruopId(pCreateTableReq->name, gid);
- }else{
+ } else {
pCreateTableReq->name = taosStrdup(pDataBlock->info.parTbName);
}
} else {
@@ -196,17 +194,18 @@ void setCreateTableMsgTableName(SVCreateTbReq* pCreateTableReq, SSDataBlock* pDa
}
}
-static int32_t doBuildAndSendCreateTableMsg(SVnode* pVnode, char* stbFullName, SSDataBlock* pDataBlock, SStreamTask* pTask,
- int64_t suid) {
+static int32_t doBuildAndSendCreateTableMsg(SVnode* pVnode, char* stbFullName, SSDataBlock* pDataBlock,
+ SStreamTask* pTask, int64_t suid) {
tqDebug("s-task:%s build create table msg", pTask->id.idStr);
STSchema* pTSchema = pTask->outputInfo.tbSink.pTSchema;
int32_t rows = pDataBlock->info.rows;
- SArray* tagArray = taosArrayInit(4, sizeof(STagVal));;
- int32_t code = 0;
+ SArray* tagArray = taosArrayInit(4, sizeof(STagVal));
+ ;
+ int32_t code = 0;
SVCreateTbBatchReq reqs = {0};
- SArray* crTblArray = reqs.pArray = taosArrayInit(1, sizeof(SVCreateTbReq));
+ SArray* crTblArray = reqs.pArray = taosArrayInit(1, sizeof(SVCreateTbReq));
if (NULL == reqs.pArray) {
tqError("s-task:%s failed to init create table msg, code:%s", pTask->id.idStr, tstrerror(terrno));
goto _end;
@@ -262,7 +261,8 @@ static int32_t doBuildAndSendCreateTableMsg(SVnode* pVnode, char* stbFullName, S
ASSERT(gid == *(int64_t*)pGpIdData);
}
- setCreateTableMsgTableName(pCreateTbReq, pDataBlock, stbFullName, gid, pTask->ver >= SSTREAM_TASK_SUBTABLE_CHANGED_VER);
+ setCreateTableMsgTableName(pCreateTbReq, pDataBlock, stbFullName, gid,
+ pTask->ver >= SSTREAM_TASK_SUBTABLE_CHANGED_VER && pTask->subtableWithoutMd5 != 1);
taosArrayPush(reqs.pArray, pCreateTbReq);
tqDebug("s-task:%s build create table:%s msg complete", pTask->id.idStr, pCreateTbReq->name);
@@ -274,7 +274,7 @@ static int32_t doBuildAndSendCreateTableMsg(SVnode* pVnode, char* stbFullName, S
tqError("s-task:%s failed to send create table msg", pTask->id.idStr);
}
- _end:
+_end:
taosArrayDestroy(tagArray);
taosArrayDestroyEx(crTblArray, (FDelete)tdDestroySVCreateTbReq);
return code;
@@ -361,7 +361,8 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c
pExisted->aRowP = pFinal;
tqTrace("s-task:%s rows merged, final rows:%d, uid:%" PRId64 ", existed auto-create table:%d, new-block:%d", id,
- (int32_t)taosArrayGetSize(pFinal), pExisted->uid, (pExisted->pCreateTbReq != NULL), (pNew->pCreateTbReq != NULL));
+ (int32_t)taosArrayGetSize(pFinal), pExisted->uid, (pExisted->pCreateTbReq != NULL),
+ (pNew->pCreateTbReq != NULL));
tdDestroySVCreateTbReq(pNew->pCreateTbReq);
taosMemoryFree(pNew->pCreateTbReq);
@@ -373,7 +374,7 @@ int32_t doBuildAndSendDeleteMsg(SVnode* pVnode, char* stbFullName, SSDataBlock*
SBatchDeleteReq deleteReq = {.suid = suid, .deleteReqs = taosArrayInit(0, sizeof(SSingleDeleteReq))};
int32_t code = tqBuildDeleteReq(pVnode->pTq, stbFullName, pDataBlock, &deleteReq, pTask->id.idStr,
- pTask->ver >= SSTREAM_TASK_SUBTABLE_CHANGED_VER);
+ pTask->ver >= SSTREAM_TASK_SUBTABLE_CHANGED_VER && pTask->subtableWithoutMd5 != 1);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@@ -416,8 +417,8 @@ bool isValidDstChildTable(SMetaReader* pReader, int32_t vgId, const char* ctbNam
}
if (pReader->me.ctbEntry.suid != suid) {
- tqError("vgId:%d, failed to write into %s, since suid mismatch, expect suid:%" PRId64 ", actual:%" PRId64,
- vgId, ctbName, suid, pReader->me.ctbEntry.suid);
+ tqError("vgId:%d, failed to write into %s, since suid mismatch, expect suid:%" PRId64 ", actual:%" PRId64, vgId,
+ ctbName, suid, pReader->me.ctbEntry.suid);
terrno = TSDB_CODE_TDB_TABLE_IN_OTHER_STABLE;
return false;
}
@@ -437,10 +438,10 @@ SVCreateTbReq* buildAutoCreateTableReq(const char* stbFullName, int64_t suid, in
taosArrayClear(pTagArray);
initCreateTableMsg(pCreateTbReq, suid, stbFullName, 1);
- STagVal tagVal = { .cid = numOfCols, .type = TSDB_DATA_TYPE_UBIGINT, .i64 = pDataBlock->info.id.groupId};
+ STagVal tagVal = {.cid = numOfCols, .type = TSDB_DATA_TYPE_UBIGINT, .i64 = pDataBlock->info.id.groupId};
taosArrayPush(pTagArray, &tagVal);
- tTagNew(pTagArray, 1, false, (STag**) &pCreateTbReq->ctb.pTag);
+ tTagNew(pTagArray, 1, false, (STag**)&pCreateTbReq->ctb.pTag);
if (pCreateTbReq->ctb.pTag == NULL) {
tdDestroySVCreateTbReq(pCreateTbReq);
@@ -513,13 +514,13 @@ int32_t buildSubmitMsgImpl(SSubmitReq2* pSubmitReq, int32_t vgId, void** pMsg, i
}
int32_t tsAscendingSortFn(const void* p1, const void* p2) {
- SRow* pRow1 = *(SRow**) p1;
- SRow* pRow2 = *(SRow**) p2;
+ SRow* pRow1 = *(SRow**)p1;
+ SRow* pRow2 = *(SRow**)p2;
if (pRow1->ts == pRow2->ts) {
return 0;
} else {
- return pRow1->ts > pRow2->ts? 1:-1;
+ return pRow1->ts > pRow2->ts ? 1 : -1;
}
}
@@ -563,7 +564,7 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat
void* colData = colDataGetData(pColData, j);
if (IS_STR_DATA_TYPE(pCol->type)) {
// address copy, no value
- SValue sv = (SValue){.nData = varDataLen(colData), .pData = (uint8_t*) varDataVal(colData)};
+ SValue sv = (SValue){.nData = varDataLen(colData), .pData = (uint8_t*)varDataVal(colData)};
SColVal cv = COL_VAL_VALUE(pCol->colId, pCol->type, sv);
taosArrayPush(pVals, &cv);
} else {
@@ -666,11 +667,9 @@ int32_t setDstTableDataUid(SVnode* pVnode, SStreamTask* pTask, SSDataBlock* pDat
if (dstTableName[0] == 0) {
memset(dstTableName, 0, TSDB_TABLE_NAME_LEN);
buildCtbNameByGroupIdImpl(stbFullName, groupId, dstTableName);
- }else{
- if(pTask->ver >= SSTREAM_TASK_SUBTABLE_CHANGED_VER &&
- !isAutoTableName(dstTableName) &&
- !alreadyAddGroupId(dstTableName) &&
- groupId != 0) {
+ } else {
+ if (pTask->ver >= SSTREAM_TASK_SUBTABLE_CHANGED_VER && pTask->subtableWithoutMd5 != 1 &&
+ !isAutoTableName(dstTableName) && !alreadyAddGroupId(dstTableName) && groupId != 0) {
buildCtbNameAddGruopId(dstTableName, groupId);
}
}
@@ -693,7 +692,7 @@ int32_t setDstTableDataUid(SVnode* pVnode, SStreamTask* pTask, SSDataBlock* pDat
tqTrace("s-task:%s cached tableInfo uid is invalid, acquire it from meta", id);
return doWaitForDstTableCreated(pVnode, pTask, pTableSinkInfo, dstTableName, &pTableData->uid);
} else {
- tqTrace("s-task:%s set the dstTable uid from cache:%"PRId64, id, pTableData->uid);
+ tqTrace("s-task:%s set the dstTable uid from cache:%" PRId64, id, pTableData->uid);
}
} else {
// The auto-create option will always set to be open for those submit messages, which arrive during the period
@@ -714,7 +713,8 @@ int32_t setDstTableDataUid(SVnode* pVnode, SStreamTask* pTask, SSDataBlock* pDat
pTableData->flags = SUBMIT_REQ_AUTO_CREATE_TABLE;
pTableData->pCreateTbReq =
- buildAutoCreateTableReq(stbFullName, suid, pTSchema->numOfCols + 1, pDataBlock, pTagArray, pTask->ver >= SSTREAM_TASK_SUBTABLE_CHANGED_VER);
+ buildAutoCreateTableReq(stbFullName, suid, pTSchema->numOfCols + 1, pDataBlock, pTagArray,
+ pTask->ver >= SSTREAM_TASK_SUBTABLE_CHANGED_VER && pTask->subtableWithoutMd5 != 1);
taosArrayDestroy(pTagArray);
if (pTableData->pCreateTbReq == NULL) {
@@ -746,12 +746,12 @@ int32_t setDstTableDataUid(SVnode* pVnode, SStreamTask* pTask, SSDataBlock* pDat
return TDB_CODE_SUCCESS;
}
-int32_t tqSetDstTableDataPayload(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 numOfRows = pDataBlock->info.rows;
- tqDebug("s-task:%s sink data pipeline, build submit msg from %dth resBlock, including %d rows, dst suid:%" PRId64,
- id, blockIndex + 1, numOfRows, suid);
+ tqDebug("s-task:%s sink data pipeline, build submit msg from %dth resBlock, including %d rows, dst suid:%" PRId64, id,
+ blockIndex + 1, numOfRows, suid);
char* dstTableName = pDataBlock->info.parTbName;
// convert all rows
@@ -767,14 +767,14 @@ int32_t tqSetDstTableDataPayload(uint64_t suid, const STSchema *pTSchema, int32_
}
bool hasOnlySubmitData(const SArray* pBlocks, int32_t numOfBlocks) {
- for(int32_t i = 0; i < numOfBlocks; ++i) {
+ for (int32_t i = 0; i < numOfBlocks; ++i) {
SSDataBlock* p = taosArrayGet(pBlocks, i);
if (p->info.type == STREAM_DELETE_RESULT || p->info.type == STREAM_CREATE_CHILD_TABLE) {
return false;
}
}
- return true;
+ return true;
}
void tqSinkDataIntoDstTable(SStreamTask* pTask, void* vnode, void* data) {
@@ -793,7 +793,7 @@ void tqSinkDataIntoDstTable(SStreamTask* pTask, void* vnode, void* data) {
tqDebug("vgId:%d, s-task:%s write %d stream resBlock(s) into table, has delete block, submit one-by-one", vgId, id,
numOfBlocks);
- for(int32_t i = 0; i < numOfBlocks; ++i) {
+ for (int32_t i = 0; i < numOfBlocks; ++i) {
if (streamTaskShouldStop(pTask)) {
return;
}
@@ -832,7 +832,8 @@ void tqSinkDataIntoDstTable(SStreamTask* pTask, void* vnode, void* data) {
}
} else {
tqDebug("vgId:%d, s-task:%s write %d stream resBlock(s) into table, merge submit msg", vgId, id, numOfBlocks);
- SHashObj* pTableIndexMap = taosHashInit(numOfBlocks, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
+ SHashObj* pTableIndexMap =
+ taosHashInit(numOfBlocks, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
SSubmitReq2 submitReq = {.aSubmitTbData = taosArrayInit(1, sizeof(SSubmitTbData))};
if (submitReq.aSubmitTbData == NULL) {
diff --git a/source/dnode/vnode/src/tq/tqUtil.c b/source/dnode/vnode/src/tq/tqUtil.c
index 72a73c0ff2..31267dbf52 100644
--- a/source/dnode/vnode/src/tq/tqUtil.c
+++ b/source/dnode/vnode/src/tq/tqUtil.c
@@ -72,10 +72,11 @@ static int32_t tqInitTaosxRsp(STaosxRsp* pRsp, STqOffsetVal pOffset) {
return 0;
}
-static int32_t extractResetOffsetVal(STqOffsetVal* pOffsetVal, STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequest, SRpcMsg* pMsg, bool* pBlockReturned) {
- uint64_t consumerId = pRequest->consumerId;
- STqOffset* pOffset = tqOffsetRead(pTq->pOffsetStore, pRequest->subKey);
- int32_t vgId = TD_VID(pTq->pVnode);
+static int32_t extractResetOffsetVal(STqOffsetVal* pOffsetVal, STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequest,
+ SRpcMsg* pMsg, bool* pBlockReturned) {
+ uint64_t consumerId = pRequest->consumerId;
+ STqOffset* pOffset = tqOffsetRead(pTq->pOffsetStore, pRequest->subKey);
+ int32_t vgId = TD_VID(pTq->pVnode);
*pBlockReturned = false;
// In this vnode, data has been polled by consumer for this topic, so let's continue from the last offset value.
@@ -132,7 +133,7 @@ static int32_t extractDataAndRspForNormalSubscribe(STQ* pTq, STqHandle* pHandle,
SRpcMsg* pMsg, STqOffsetVal* pOffset) {
uint64_t consumerId = pRequest->consumerId;
int32_t vgId = TD_VID(pTq->pVnode);
- terrno = 0;
+ terrno = 0;
SMqDataRsp dataRsp = {0};
tqInitDataRsp(&dataRsp, *pOffset);
@@ -156,7 +157,7 @@ static int32_t extractDataAndRspForNormalSubscribe(STQ* pTq, STqHandle* pHandle,
taosWUnLockLatch(&pTq->lock);
}
- dataRsp.reqOffset = *pOffset; // reqOffset represents the current date offset, may be changed if wal not exists
+ dataRsp.reqOffset = *pOffset; // reqOffset represents the current date offset, may be changed if wal not exists
code = tqSendDataRsp(pHandle, pMsg, pRequest, (SMqDataRsp*)&dataRsp, TMQ_MSG_TYPE__POLL_DATA_RSP, vgId);
end : {
@@ -167,15 +168,15 @@ end : {
consumerId, pHandle->subKey, vgId, dataRsp.blockNum, buf, pRequest->reqId, code);
tDeleteMqDataRsp(&dataRsp);
return code;
- }
+}
}
static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequest,
SRpcMsg* pMsg, STqOffsetVal* offset) {
- int code = 0;
- int32_t vgId = TD_VID(pTq->pVnode);
- SMqMetaRsp metaRsp = {0};
- STaosxRsp taosxRsp = {0};
+ int code = 0;
+ int32_t vgId = TD_VID(pTq->pVnode);
+ SMqMetaRsp metaRsp = {0};
+ STaosxRsp taosxRsp = {0};
tqInitTaosxRsp(&taosxRsp, *offset);
if (offset->type != TMQ_OFFSET__LOG) {
@@ -211,14 +212,16 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle,
int64_t fetchVer = offset->version;
uint64_t st = taosGetTimestampMs();
- int totalRows = 0;
+ int totalRows = 0;
while (1) {
int32_t savedEpoch = atomic_load_32(&pHandle->epoch);
ASSERT(savedEpoch <= pRequest->epoch);
if (tqFetchLog(pTq, pHandle, &fetchVer, pRequest->reqId) < 0) {
tqOffsetResetToLog(&taosxRsp.rspOffset, fetchVer);
- code = tqSendDataRsp(pHandle, pMsg, pRequest, (SMqDataRsp*)&taosxRsp, TMQ_MSG_TYPE__POLL_DATA_RSP, vgId);
+ code = tqSendDataRsp(
+ pHandle, pMsg, pRequest, (SMqDataRsp*)&taosxRsp,
+ taosxRsp.createTableNum > 0 ? TMQ_MSG_TYPE__POLL_DATA_META_RSP : TMQ_MSG_TYPE__POLL_DATA_RSP, vgId);
goto end;
}
@@ -230,7 +233,9 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle,
if (pHead->msgType != TDMT_VND_SUBMIT) {
if (totalRows > 0) {
tqOffsetResetToLog(&taosxRsp.rspOffset, fetchVer);
- code = tqSendDataRsp(pHandle, pMsg, pRequest, (SMqDataRsp*)&taosxRsp, TMQ_MSG_TYPE__POLL_DATA_RSP, vgId);
+ code = tqSendDataRsp(
+ pHandle, pMsg, pRequest, (SMqDataRsp*)&taosxRsp,
+ taosxRsp.createTableNum > 0 ? TMQ_MSG_TYPE__POLL_DATA_META_RSP : TMQ_MSG_TYPE__POLL_DATA_RSP, vgId);
goto end;
}
@@ -257,9 +262,11 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle,
goto end;
}
- if (totalRows >= 4096 || taosxRsp.createTableNum > 0 || (taosGetTimestampMs() - st > 1000)) {
+ if (totalRows >= 4096 || (taosGetTimestampMs() - st > 1000)) {
tqOffsetResetToLog(&taosxRsp.rspOffset, fetchVer + 1);
- code = tqSendDataRsp(pHandle, pMsg, pRequest, (SMqDataRsp*)&taosxRsp, taosxRsp.createTableNum > 0 ? TMQ_MSG_TYPE__POLL_DATA_META_RSP : TMQ_MSG_TYPE__POLL_DATA_RSP, vgId);
+ code = tqSendDataRsp(
+ pHandle, pMsg, pRequest, (SMqDataRsp*)&taosxRsp,
+ taosxRsp.createTableNum > 0 ? TMQ_MSG_TYPE__POLL_DATA_META_RSP : TMQ_MSG_TYPE__POLL_DATA_RSP, vgId);
goto end;
} else {
fetchVer++;
@@ -279,7 +286,7 @@ int32_t tqExtractDataForMq(STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequ
// 1. reset the offset if needed
if (IS_OFFSET_RESET_TYPE(pRequest->reqOffset.type)) {
// handle the reset offset cases, according to the consumer's choice.
- bool blockReturned = false;
+ bool blockReturned = false;
int32_t code = extractResetOffsetVal(&reqOffset, pTq, pHandle, pRequest, pMsg, &blockReturned);
if (code != 0) {
return code;
@@ -289,7 +296,7 @@ int32_t tqExtractDataForMq(STQ* pTq, STqHandle* pHandle, const SMqPollReq* pRequ
if (blockReturned) {
return 0;
}
- } else if(reqOffset.type == 0){ // use the consumer specified offset
+ } else if (reqOffset.type == 0) { // use the consumer specified offset
uError("req offset type is 0");
return TSDB_CODE_TMQ_INVALID_MSG;
}
@@ -452,8 +459,8 @@ int32_t tqExtractDelDataBlock(const void* pData, int32_t len, int64_t ver, void*
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;
+ int32_t numOfTasks = taosArrayGetSize(pMeta->pTaskList);
+ int32_t code = TSDB_CODE_SUCCESS;
if (pDelay != NULL) {
*pDelay = 0;
diff --git a/source/dnode/vnode/src/tqCommon/tqCommon.c b/source/dnode/vnode/src/tqCommon/tqCommon.c
index 9a22bc303b..cb940aa56c 100644
--- a/source/dnode/vnode/src/tqCommon/tqCommon.c
+++ b/source/dnode/vnode/src/tqCommon/tqCommon.c
@@ -317,14 +317,14 @@ 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);
+ tDeleteStreamRetrieveReq(&req);
return -1;
}
int32_t code = 0;
- if(pTask->info.taskLevel == TASK_LEVEL__SOURCE){
+ if (pTask->info.taskLevel == TASK_LEVEL__SOURCE) {
code = streamProcessRetrieveReq(pTask, &req);
- }else{
+ } else {
req.srcNodeId = pTask->info.nodeId;
req.srcTaskId = pTask->id.taskId;
code = broadcastRetrieveMsg(pTask, &req);
@@ -334,7 +334,7 @@ int32_t tqStreamTaskProcessRetrieveReq(SStreamMeta* pMeta, SRpcMsg* pMsg) {
sendRetrieveRsp(&req, &rsp);
streamMetaReleaseTask(pMeta, pTask);
- taosMemoryFree(req.pRetrieve);
+ tDeleteStreamRetrieveReq(&req);
return code;
}
@@ -612,6 +612,10 @@ int32_t tqStreamTaskProcessDropReq(SStreamMeta* pMeta, char* msg, int32_t msgLen
streamMetaReleaseTask(pMeta, pTask);
}
+ streamMetaWLock(pMeta);
+ streamTaskClearHTaskAttr(pTask, pReq->resetRelHalt, false);
+ streamMetaWUnLock(pMeta);
+
// drop the stream task now
streamMetaUnregisterTask(pMeta, pReq->streamId, pReq->taskId);
diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c
index 7390baa487..1ef2a451a7 100644
--- a/source/dnode/vnode/src/tsdb/tsdbCache.c
+++ b/source/dnode/vnode/src/tsdb/tsdbCache.c
@@ -21,6 +21,7 @@
#define ROCKS_BATCH_SIZE (4096)
+#if 0
static int32_t tsdbOpenBICache(STsdb *pTsdb) {
int32_t code = 0;
SLRUCache *pCache = taosLRUCacheInit(10 * 1024 * 1024, 0, .5);
@@ -52,6 +53,7 @@ static void tsdbCloseBICache(STsdb *pTsdb) {
taosThreadMutexDestroy(&pTsdb->biMutex);
}
}
+#endif
static int32_t tsdbOpenBCache(STsdb *pTsdb) {
int32_t code = 0;
@@ -431,25 +433,6 @@ int32_t tsdbCacheCommit(STsdb *pTsdb) {
return code;
}
-static SLastCol *tsdbCacheLookup(STsdb *pTsdb, tb_uid_t uid, int16_t cid, int8_t ltype) {
- SLastCol *pLastCol = NULL;
-
- char *err = NULL;
- size_t vlen = 0;
- SLastKey *key = &(SLastKey){.ltype = ltype, .uid = uid, .cid = cid};
- size_t klen = ROCKS_KEY_LEN;
- char *value = NULL;
- value = rocksdb_get(pTsdb->rCache.db, pTsdb->rCache.readoptions, (char *)key, klen, &vlen, &err);
- if (NULL != err) {
- tsdbError("vgId:%d, %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, err);
- rocksdb_free(err);
- }
-
- pLastCol = tsdbCacheDeserialize(value);
-
- return pLastCol;
-}
-
static void reallocVarData(SColVal *pColVal) {
if (IS_VAR_DATA_TYPE(pColVal->type)) {
uint8_t *pVal = pColVal->value.pData;
@@ -476,6 +459,355 @@ static void tsdbCacheDeleter(const void *key, size_t klen, void *value, void *ud
taosMemoryFree(value);
}
+static int32_t tsdbCacheNewTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, int8_t col_type, int8_t ltype) {
+ int32_t code = 0;
+
+ SLRUCache *pCache = pTsdb->lruCache;
+ rocksdb_writebatch_t *wb = pTsdb->rCache.writebatch;
+ SLastCol noneCol = {.ts = TSKEY_MIN, .colVal = COL_VAL_NONE(cid, col_type), .dirty = 1};
+ SLastCol *pLastCol = &noneCol;
+
+ SLastCol *pTmpLastCol = taosMemoryCalloc(1, sizeof(SLastCol));
+ *pTmpLastCol = *pLastCol;
+ pLastCol = pTmpLastCol;
+
+ reallocVarData(&pLastCol->colVal);
+ size_t charge = sizeof(*pLastCol);
+ if (IS_VAR_DATA_TYPE(pLastCol->colVal.type)) {
+ charge += pLastCol->colVal.value.nData;
+ }
+
+ SLastKey *pLastKey = &(SLastKey){.ltype = ltype, .uid = uid, .cid = cid};
+ LRUStatus status = taosLRUCacheInsert(pCache, pLastKey, ROCKS_KEY_LEN, pLastCol, charge, tsdbCacheDeleter, NULL,
+ TAOS_LRU_PRIORITY_LOW, &pTsdb->flushState);
+ if (status != TAOS_LRU_STATUS_OK) {
+ code = -1;
+ }
+ /*
+ // store result back to rocks cache
+ char *value = NULL;
+ size_t vlen = 0;
+ tsdbCacheSerialize(pLastCol, &value, &vlen);
+
+ SLastKey *key = pLastKey;
+ size_t klen = ROCKS_KEY_LEN;
+ rocksdb_writebatch_put(wb, (char *)key, klen, value, vlen);
+ taosMemoryFree(value);
+ */
+ return code;
+}
+
+int32_t tsdbCacheCommitNoLock(STsdb *pTsdb) {
+ int32_t code = 0;
+ char *err = NULL;
+
+ SLRUCache *pCache = pTsdb->lruCache;
+ rocksdb_writebatch_t *wb = pTsdb->rCache.writebatch;
+
+ taosLRUCacheApply(pCache, tsdbCacheFlushDirty, &pTsdb->flushState);
+
+ rocksMayWrite(pTsdb, true, false, false);
+ rocksMayWrite(pTsdb, true, true, false);
+ rocksdb_flush(pTsdb->rCache.db, pTsdb->rCache.flushoptions, &err);
+
+ if (NULL != err) {
+ tsdbError("vgId:%d, %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, err);
+ rocksdb_free(err);
+ code = -1;
+ }
+
+ return code;
+}
+
+static int32_t tsdbCacheDropTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, int8_t col_type, int8_t ltype) {
+ int32_t code = 0;
+
+ // build keys & multi get from rocks
+ char **keys_list = taosMemoryCalloc(2, sizeof(char *));
+ size_t *keys_list_sizes = taosMemoryCalloc(2, sizeof(size_t));
+ const size_t klen = ROCKS_KEY_LEN;
+
+ char *keys = taosMemoryCalloc(2, sizeof(SLastKey));
+ ((SLastKey *)keys)[0] = (SLastKey){.ltype = 1, .uid = uid, .cid = cid};
+ ((SLastKey *)keys)[1] = (SLastKey){.ltype = 0, .uid = uid, .cid = cid};
+
+ keys_list[0] = keys;
+ keys_list[1] = keys + sizeof(SLastKey);
+ keys_list_sizes[0] = klen;
+ keys_list_sizes[1] = klen;
+
+ char **values_list = taosMemoryCalloc(2, sizeof(char *));
+ size_t *values_list_sizes = taosMemoryCalloc(2, sizeof(size_t));
+ char **errs = taosMemoryCalloc(2, sizeof(char *));
+
+ // rocksMayWrite(pTsdb, true, false, false);
+ rocksdb_multi_get(pTsdb->rCache.db, pTsdb->rCache.readoptions, 2, (const char *const *)keys_list, keys_list_sizes,
+ values_list, values_list_sizes, errs);
+
+ for (int i = 0; i < 2; ++i) {
+ if (errs[i]) {
+ rocksdb_free(errs[i]);
+ }
+ }
+ taosMemoryFree(errs);
+
+ rocksdb_writebatch_t *wb = pTsdb->rCache.writebatch;
+ {
+ SLastCol *pLastCol = tsdbCacheDeserialize(values_list[0]);
+ if (NULL != pLastCol) {
+ rocksdb_writebatch_delete(wb, keys_list[0], klen);
+ }
+ pLastCol = tsdbCacheDeserialize(values_list[1]);
+ if (NULL != pLastCol) {
+ rocksdb_writebatch_delete(wb, keys_list[1], klen);
+ }
+
+ rocksdb_free(values_list[0]);
+ rocksdb_free(values_list[1]);
+
+ bool erase = false;
+ LRUHandle *h = taosLRUCacheLookup(pTsdb->lruCache, keys_list[0], klen);
+ if (h) {
+ SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pTsdb->lruCache, h);
+ erase = true;
+
+ taosLRUCacheRelease(pTsdb->lruCache, h, erase);
+ }
+ if (erase) {
+ taosLRUCacheErase(pTsdb->lruCache, keys_list[0], klen);
+ }
+
+ erase = false;
+ h = taosLRUCacheLookup(pTsdb->lruCache, keys_list[1], klen);
+ if (h) {
+ SLastCol *pLastCol = (SLastCol *)taosLRUCacheValue(pTsdb->lruCache, h);
+ erase = true;
+
+ taosLRUCacheRelease(pTsdb->lruCache, h, erase);
+ }
+ if (erase) {
+ taosLRUCacheErase(pTsdb->lruCache, keys_list[1], klen);
+ }
+ }
+
+ taosMemoryFree(keys_list[0]);
+
+ taosMemoryFree(keys_list);
+ taosMemoryFree(keys_list_sizes);
+ taosMemoryFree(values_list);
+ taosMemoryFree(values_list_sizes);
+
+ return code;
+}
+
+int32_t tsdbCacheNewTable(STsdb *pTsdb, tb_uid_t uid, tb_uid_t suid, SSchemaWrapper *pSchemaRow) {
+ int32_t code = 0;
+
+ taosThreadMutexLock(&pTsdb->lruMutex);
+
+ if (suid < 0) {
+ int nCols = pSchemaRow->nCols;
+ for (int i = 0; i < nCols; ++i) {
+ int16_t cid = pSchemaRow->pSchema[i].colId;
+ int8_t col_type = pSchemaRow->pSchema[i].type;
+
+ (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, 0);
+ (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, 1);
+ }
+ } else {
+ STSchema *pTSchema = NULL;
+ code = metaGetTbTSchemaEx(pTsdb->pVnode->pMeta, suid, uid, -1, &pTSchema);
+ if (code != TSDB_CODE_SUCCESS) {
+ terrno = code;
+ return -1;
+ }
+
+ int nCols = pTSchema->numOfCols;
+ for (int i = 0; i < nCols; ++i) {
+ int16_t cid = pTSchema->columns[i].colId;
+ int8_t col_type = pTSchema->columns[i].type;
+
+ (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, 0);
+ (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, 1);
+ }
+
+ taosMemoryFree(pTSchema);
+ }
+
+ taosThreadMutexUnlock(&pTsdb->lruMutex);
+
+ return code;
+}
+
+int32_t tsdbCacheDropTable(STsdb *pTsdb, tb_uid_t uid, tb_uid_t suid, SSchemaWrapper *pSchemaRow) {
+ int32_t code = 0;
+
+ taosThreadMutexLock(&pTsdb->lruMutex);
+
+ (void)tsdbCacheCommitNoLock(pTsdb);
+
+ if (suid < 0) {
+ int nCols = pSchemaRow->nCols;
+ for (int i = 0; i < nCols; ++i) {
+ int16_t cid = pSchemaRow->pSchema[i].colId;
+ int8_t col_type = pSchemaRow->pSchema[i].type;
+
+ (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 0);
+ (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 1);
+ }
+ } else {
+ STSchema *pTSchema = NULL;
+ code = metaGetTbTSchemaEx(pTsdb->pVnode->pMeta, suid, uid, -1, &pTSchema);
+ if (code != TSDB_CODE_SUCCESS) {
+ terrno = code;
+ return -1;
+ }
+
+ int nCols = pTSchema->numOfCols;
+ for (int i = 0; i < nCols; ++i) {
+ int16_t cid = pTSchema->columns[i].colId;
+ int8_t col_type = pTSchema->columns[i].type;
+
+ (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 0);
+ (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 1);
+ }
+
+ taosMemoryFree(pTSchema);
+ }
+
+ rocksMayWrite(pTsdb, true, false, false);
+
+ taosThreadMutexUnlock(&pTsdb->lruMutex);
+
+ return code;
+}
+
+int32_t tsdbCacheDropSubTables(STsdb *pTsdb, SArray *uids, tb_uid_t suid) {
+ int32_t code = 0;
+
+ taosThreadMutexLock(&pTsdb->lruMutex);
+
+ (void)tsdbCacheCommitNoLock(pTsdb);
+
+ STSchema *pTSchema = NULL;
+ code = metaGetTbTSchemaEx(pTsdb->pVnode->pMeta, suid, suid, -1, &pTSchema);
+ if (code != TSDB_CODE_SUCCESS) {
+ terrno = code;
+ return -1;
+ }
+ for (int i = 0; i < TARRAY_SIZE(uids); ++i) {
+ int64_t uid = ((tb_uid_t *)TARRAY_DATA(uids))[i];
+
+ int nCols = pTSchema->numOfCols;
+ for (int i = 0; i < nCols; ++i) {
+ int16_t cid = pTSchema->columns[i].colId;
+ int8_t col_type = pTSchema->columns[i].type;
+
+ (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 0);
+ (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 1);
+ }
+ }
+
+ taosMemoryFree(pTSchema);
+
+ rocksMayWrite(pTsdb, true, false, false);
+
+ taosThreadMutexUnlock(&pTsdb->lruMutex);
+
+ return code;
+}
+
+int32_t tsdbCacheNewNTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, int8_t col_type) {
+ int32_t code = 0;
+
+ taosThreadMutexLock(&pTsdb->lruMutex);
+
+ (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, 0);
+ (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, 1);
+
+ // rocksMayWrite(pTsdb, true, false, false);
+ taosThreadMutexUnlock(&pTsdb->lruMutex);
+ //(void)tsdbCacheCommit(pTsdb);
+
+ return code;
+}
+
+int32_t tsdbCacheDropNTableColumn(STsdb *pTsdb, int64_t uid, int16_t cid, int8_t col_type) {
+ int32_t code = 0;
+
+ taosThreadMutexLock(&pTsdb->lruMutex);
+
+ (void)tsdbCacheCommitNoLock(pTsdb);
+
+ (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 0);
+ (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 1);
+
+ rocksMayWrite(pTsdb, true, false, true);
+
+ taosThreadMutexUnlock(&pTsdb->lruMutex);
+
+ return code;
+}
+
+int32_t tsdbCacheNewSTableColumn(STsdb *pTsdb, SArray *uids, int16_t cid, int8_t col_type) {
+ int32_t code = 0;
+
+ taosThreadMutexLock(&pTsdb->lruMutex);
+
+ for (int i = 0; i < TARRAY_SIZE(uids); ++i) {
+ tb_uid_t uid = ((tb_uid_t *)TARRAY_DATA(uids))[i];
+
+ (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, 0);
+ (void)tsdbCacheNewTableColumn(pTsdb, uid, cid, col_type, 1);
+ }
+
+ // rocksMayWrite(pTsdb, true, false, false);
+ taosThreadMutexUnlock(&pTsdb->lruMutex);
+ //(void)tsdbCacheCommit(pTsdb);
+
+ return code;
+}
+
+int32_t tsdbCacheDropSTableColumn(STsdb *pTsdb, SArray *uids, int16_t cid, int8_t col_type) {
+ int32_t code = 0;
+
+ taosThreadMutexLock(&pTsdb->lruMutex);
+
+ (void)tsdbCacheCommitNoLock(pTsdb);
+
+ for (int i = 0; i < TARRAY_SIZE(uids); ++i) {
+ int64_t uid = ((tb_uid_t *)TARRAY_DATA(uids))[i];
+
+ (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 0);
+ (void)tsdbCacheDropTableColumn(pTsdb, uid, cid, col_type, 1);
+ }
+
+ rocksMayWrite(pTsdb, true, false, true);
+
+ taosThreadMutexUnlock(&pTsdb->lruMutex);
+
+ return code;
+}
+
+static SLastCol *tsdbCacheLookup(STsdb *pTsdb, tb_uid_t uid, int16_t cid, int8_t ltype) {
+ SLastCol *pLastCol = NULL;
+
+ char *err = NULL;
+ size_t vlen = 0;
+ SLastKey *key = &(SLastKey){.ltype = ltype, .uid = uid, .cid = cid};
+ size_t klen = ROCKS_KEY_LEN;
+ char *value = NULL;
+ value = rocksdb_get(pTsdb->rCache.db, pTsdb->rCache.readoptions, (char *)key, klen, &vlen, &err);
+ if (NULL != err) {
+ tsdbError("vgId:%d, %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, err);
+ rocksdb_free(err);
+ }
+
+ pLastCol = tsdbCacheDeserialize(value);
+
+ return pLastCol;
+}
+
typedef struct {
int idx;
SLastKey key;
@@ -1297,11 +1629,13 @@ int32_t tsdbOpenCache(STsdb *pTsdb) {
goto _err;
}
+#if 0
code = tsdbOpenBICache(pTsdb);
if (code != TSDB_CODE_SUCCESS) {
code = TSDB_CODE_OUT_OF_MEMORY;
goto _err;
}
+#endif
code = tsdbOpenBCache(pTsdb);
if (code != TSDB_CODE_SUCCESS) {
@@ -1343,7 +1677,9 @@ void tsdbCloseCache(STsdb *pTsdb) {
taosThreadMutexDestroy(&pTsdb->lruMutex);
}
+#if 0
tsdbCloseBICache(pTsdb);
+#endif
tsdbCloseBCache(pTsdb);
tsdbClosePgCache(pTsdb);
tsdbCloseRocksCache(pTsdb);
@@ -3117,6 +3453,7 @@ int32_t tsdbCacheGetElems(SVnode *pVnode) {
return elems;
}
+#if 0
static void getBICacheKey(int32_t fid, int64_t commitID, char *key, int *len) {
struct {
int32_t fid;
@@ -3193,7 +3530,6 @@ 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;
diff --git a/source/dnode/vnode/src/vnd/vnodeAsync.c b/source/dnode/vnode/src/vnd/vnodeAsync.c
index 66668b60df..313603b19f 100644
--- a/source/dnode/vnode/src/vnd/vnodeAsync.c
+++ b/source/dnode/vnode/src/vnd/vnodeAsync.c
@@ -433,10 +433,12 @@ static int32_t vnodeAsyncLaunchWorker(SVAsync *async) {
return 0;
}
+#ifdef BUILD_NO_CALL
int32_t vnodeAsync(SVAsync *async, EVAPriority priority, int32_t (*execute)(void *), void (*complete)(void *),
void *arg, int64_t *taskId) {
return vnodeAsyncC(async, 0, priority, execute, complete, arg, taskId);
}
+#endif
int32_t vnodeAsyncC(SVAsync *async, int64_t channelId, EVAPriority priority, int32_t (*execute)(void *),
void (*complete)(void *), void *arg, int64_t *taskId) {
diff --git a/source/dnode/vnode/src/vnd/vnodeInitApi.c b/source/dnode/vnode/src/vnd/vnodeInitApi.c
index 2392716bbf..aff7e4642b 100644
--- a/source/dnode/vnode/src/vnd/vnodeInitApi.c
+++ b/source/dnode/vnode/src/vnd/vnodeInitApi.c
@@ -181,12 +181,17 @@ void initStateStoreAPI(SStateStore* pStore) {
pStore->streamStateSessionPut = streamStateSessionPut;
pStore->streamStateSessionGet = streamStateSessionGet;
pStore->streamStateSessionDel = streamStateSessionDel;
+ pStore->streamStateSessionReset = streamStateSessionReset;
pStore->streamStateSessionClear = streamStateSessionClear;
pStore->streamStateSessionGetKVByCur = streamStateSessionGetKVByCur;
pStore->streamStateStateAddIfNotExist = streamStateStateAddIfNotExist;
pStore->streamStateSessionGetKeyByRange = streamStateSessionGetKeyByRange;
+ pStore->streamStateCountGetKeyByRange = streamStateCountGetKeyByRange;
pStore->streamStateSessionAllocWinBuffByNextPosition = streamStateSessionAllocWinBuffByNextPosition;
+ pStore->streamStateCountWinAddIfNotExist = streamStateCountWinAddIfNotExist;
+ pStore->streamStateCountWinAdd = streamStateCountWinAdd;
+
pStore->updateInfoInit = updateInfoInit;
pStore->updateInfoFillBlockData = updateInfoFillBlockData;
pStore->updateInfoIsUpdated = updateInfoIsUpdated;
@@ -203,6 +208,7 @@ void initStateStoreAPI(SStateStore* pStore) {
pStore->updateInfoDeserialize = updateInfoDeserialize;
pStore->streamStateSessionSeekKeyNext = streamStateSessionSeekKeyNext;
+ pStore->streamStateCountSeekKeyPrev = streamStateCountSeekKeyPrev;
pStore->streamStateSessionSeekKeyCurrentPrev = streamStateSessionSeekKeyCurrentPrev;
pStore->streamStateSessionSeekKeyCurrentNext = streamStateSessionSeekKeyCurrentNext;
diff --git a/source/libs/catalog/inc/catalogInt.h b/source/libs/catalog/inc/catalogInt.h
index f9f4ee7dfc..dc30e88b29 100644
--- a/source/libs/catalog/inc/catalogInt.h
+++ b/source/libs/catalog/inc/catalogInt.h
@@ -848,6 +848,7 @@ typedef struct SCtgCacheItemInfo {
do { \
CTG_UNLOCK(CTG_READ, &gCtgMgmt.lock); \
CTG_API_DEBUG("CTG API leave %s", __FUNCTION__); \
+ return; \
} while (0)
#define CTG_API_ENTER() \
diff --git a/source/libs/catalog/src/ctgCache.c b/source/libs/catalog/src/ctgCache.c
index 1b693b4e07..f81f9a6954 100644
--- a/source/libs/catalog/src/ctgCache.c
+++ b/source/libs/catalog/src/ctgCache.c
@@ -2851,7 +2851,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
CTG_UNLOCK(CTG_READ, &pCache->metaLock);
taosHashRelease(dbCache->tbCache, pCache);
- ctgDebug("Got tb %s meta from cache, type:%d, dbFName:%s", pName->tname, tbMeta->tableType, dbFName);
+ ctgDebug("Got tb %s meta from cache, type:%d, dbFName:%s", pName->tname, pTableMeta->tableType, dbFName);
res.pRes = pTableMeta;
taosArrayPush(ctx->pResList, &res);
@@ -2868,7 +2868,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
CTG_UNLOCK(CTG_READ, &pCache->metaLock);
taosHashRelease(dbCache->tbCache, pCache);
- ctgDebug("Got tb %s meta from cache, type:%d, dbFName:%s", pName->tname, tbMeta->tableType, dbFName);
+ ctgDebug("Got tb %s meta from cache, type:%d, dbFName:%s", pName->tname, pTableMeta->tableType, dbFName);
res.pRes = pTableMeta;
taosArrayPush(ctx->pResList, &res);
diff --git a/source/libs/command/inc/commandInt.h b/source/libs/command/inc/commandInt.h
index d7ded9d6f1..f8f932903f 100644
--- a/source/libs/command/inc/commandInt.h
+++ b/source/libs/command/inc/commandInt.h
@@ -69,6 +69,10 @@ extern "C" {
#define EXPLAIN_EVENT_END_FORMAT "End Cond: "
#define EXPLAIN_GROUP_CACHE_FORMAT "Group Cache"
#define EXPLAIN_DYN_QRY_CTRL_FORMAT "Dynamic Query Control for %s"
+#define EXPLAIN_COUNT_FORMAT "Count"
+#define EXPLAIN_COUNT_INFO_FORMAT "Window Count Info"
+#define EXPLAIN_COUNT_NUM_FORMAT "Window Count=%" PRId64
+#define EXPLAIN_COUNT_SLIDING_FORMAT "Window Sliding=%" PRId64
#define EXPLAIN_PLANNING_TIME_FORMAT "Planning Time: %.3f ms"
#define EXPLAIN_EXEC_TIME_FORMAT "Execution Time: %.3f ms"
diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c
index d8268660b3..63856c25c0 100644
--- a/source/libs/command/src/explain.c
+++ b/source/libs/command/src/explain.c
@@ -1740,6 +1740,31 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
}
break;
}
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT: {
+ SCountWinodwPhysiNode *pCountNode = (SCountWinodwPhysiNode *)pNode;
+ EXPLAIN_ROW_NEW(level, EXPLAIN_COUNT_FORMAT);
+ EXPLAIN_ROW_APPEND(EXPLAIN_LEFT_PARENTHESIS_FORMAT);
+ if (pResNode->pExecInfo) {
+ QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen));
+ EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT);
+ }
+ EXPLAIN_ROW_APPEND(EXPLAIN_FUNCTIONS_FORMAT, pCountNode->window.pFuncs->length);
+ EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT);
+ EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pCountNode->window.node.pOutputDataBlockDesc->totalRowSize);
+ EXPLAIN_ROW_APPEND(EXPLAIN_RIGHT_PARENTHESIS_FORMAT);
+ EXPLAIN_ROW_END();
+ QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level));
+
+ if (verbose) {
+ EXPLAIN_ROW_NEW(level + 1, EXPLAIN_COUNT_NUM_FORMAT, pCountNode->windowCount);
+ EXPLAIN_ROW_END();
+ QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1));
+ EXPLAIN_ROW_NEW(level + 1, EXPLAIN_COUNT_SLIDING_FORMAT, pCountNode->windowSliding);
+ EXPLAIN_ROW_END();
+ QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1));
+ }
+ break;
+ }
default:
qError("not supported physical node type %d", pNode->type);
return TSDB_CODE_APP_ERROR;
diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h
index 1f0a047b99..9b427a7bad 100644
--- a/source/libs/executor/inc/executorInt.h
+++ b/source/libs/executor/inc/executorInt.h
@@ -371,6 +371,8 @@ typedef struct SStreamAggSupporter {
STimeWindow winRange;
SStorageAPI* pSessionAPI;
struct SUpdateInfo* pUpdateInfo;
+ int32_t windowCount;
+ int32_t windowSliding;
} SStreamAggSupporter;
typedef struct SWindowSupporter {
@@ -663,6 +665,27 @@ typedef struct SStreamEventAggOperatorInfo {
SFilterInfo* pEndCondInfo;
} SStreamEventAggOperatorInfo;
+typedef struct SStreamCountAggOperatorInfo {
+ SOptrBasicInfo binfo;
+ SStreamAggSupporter streamAggSup;
+ SExprSupp scalarSupp; // supporter for perform scalar function
+ SGroupResInfo groupResInfo;
+ int32_t primaryTsIndex; // primary timestamp slot id
+ STimeWindowAggSupp twAggSup;
+ SSDataBlock* pDelRes;
+ SSHashObj* pStDeleted;
+ void* pDelIterator;
+ bool ignoreExpiredData;
+ bool ignoreExpiredDataSaved;
+ SArray* pUpdated;
+ SSHashObj* pStUpdated;
+ int64_t dataVersion;
+ SArray* historyWins;
+ bool reCkBlock;
+ bool recvGetAll;
+ SSDataBlock* pCheckpointRes;
+} SStreamCountAggOperatorInfo;
+
typedef struct SStreamPartitionOperatorInfo {
SOptrBasicInfo binfo;
SPartitionBySupporter partitionSup;
@@ -800,6 +823,9 @@ bool isDeletedStreamWindow(STimeWindow* pWin, uint64_t groupId, void* pState, ST
SStateStore* pStore);
void appendOneRowToStreamSpecialBlock(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, uint64_t* pUid,
uint64_t* pGp, void* pTbName);
+void appendAllColumnToStreamSpecialBlock(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, TSKEY* pCalStartTs,
+ TSKEY* pCalEndTs, uint64_t* pUid, uint64_t* pGp, void* pTbName);
+
uint64_t calGroupIdByData(SPartitionBySupporter* pParSup, SExprSupp* pExprSup, SSDataBlock* pBlock, int32_t rowId);
int32_t finalizeResultRows(SDiskbasedBuf* pBuf, SResultRowPosition* resultRowPosition, SExprSupp* pSup,
@@ -864,7 +890,7 @@ void resetWinRange(STimeWindow* winRange);
bool checkExpiredData(SStateStore* pAPI, SUpdateInfo* pUpdateInfo, STimeWindowAggSupp* pTwSup, uint64_t tableId, TSKEY ts);
int64_t getDeleteMark(SWindowPhysiNode* pWinPhyNode, int64_t interval);
void resetUnCloseSessionWinInfo(SSHashObj* winMap);
-void setStreamOperatorCompleted(struct SOperatorInfo* pOperator);
+void setStreamOperatorCompleted(struct SOperatorInfo* pOperator);
void reloadAggSupFromDownStream(struct SOperatorInfo* downstream, SStreamAggSupporter* pAggSup);
int32_t encodeSSessionKey(void** buf, SSessionKey* key);
@@ -881,11 +907,18 @@ void freeExchangeGetBasicOperatorParam(void* pParam);
void freeOperatorParam(SOperatorParam* pParam, SOperatorParamType type);
void freeResetOperatorParams(struct SOperatorInfo* pOperator, SOperatorParamType type, bool allFree);
SSDataBlock* getNextBlockFromDownstreamImpl(struct SOperatorInfo* pOperator, int32_t idx, bool clearParam);
+void getCountWinRange(SStreamAggSupporter* pAggSup, const SSessionKey* pKey, EStreamType mode, SSessionKey* pDelRange);
+bool doDeleteSessionWindow(SStreamAggSupporter* pAggSup, SSessionKey* pKey);
+
+void saveDeleteInfo(SArray* pWins, SSessionKey key);
+void removeSessionResults(SStreamAggSupporter* pAggSup, SSHashObj* pHashMap, SArray* pWins);
+void copyDeleteWindowInfo(SArray* pResWins, SSHashObj* pStDeleted);
bool inSlidingWindow(SInterval* pInterval, STimeWindow* pWin, SDataBlockInfo* pBlockInfo);
bool inCalSlidingWindow(SInterval* pInterval, STimeWindow* pWin, TSKEY calStart, TSKEY calEnd, EStreamType blockType);
bool compareVal(const char* v, const SStateKeys* pKey);
bool inWinRange(STimeWindow* range, STimeWindow* cur);
+void doDeleteTimeWindows(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SArray* result);
int32_t getNextQualifiedWindow(SInterval* pInterval, STimeWindow* pNext, SDataBlockInfo* pDataBlockInfo,
TSKEY* primaryKeys, int32_t prevPosition, int32_t order);
diff --git a/source/libs/executor/inc/operator.h b/source/libs/executor/inc/operator.h
index 0858a7e595..95208545bd 100644
--- a/source/libs/executor/inc/operator.h
+++ b/source/libs/executor/inc/operator.h
@@ -154,10 +154,14 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi
SOperatorInfo* createStreamEventAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, SReadHandle* pHandle);
+SOperatorInfo* createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, SReadHandle* pHandle);
+
SOperatorInfo* createGroupSortOperatorInfo(SOperatorInfo* downstream, SGroupSortPhysiNode* pSortPhyNode, SExecTaskInfo* pTaskInfo);
SOperatorInfo* createEventwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* physiNode, SExecTaskInfo* pTaskInfo);
+SOperatorInfo* createCountwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* physiNode, SExecTaskInfo* pTaskInfo);
+
SOperatorInfo* createGroupCacheOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream, SGroupCachePhysiNode* pPhyciNode, SExecTaskInfo* pTaskInfo);
SOperatorInfo* createDynQueryCtrlOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream, SDynQueryCtrlPhysiNode* pPhyciNode, SExecTaskInfo* pTaskInfo);
diff --git a/source/libs/executor/inc/querytask.h b/source/libs/executor/inc/querytask.h
index 0c9a5e3197..886ce9705d 100644
--- a/source/libs/executor/inc/querytask.h
+++ b/source/libs/executor/inc/querytask.h
@@ -64,8 +64,6 @@ typedef struct {
SSchemaWrapper* schema;
char tbName[TSDB_TABLE_NAME_LEN]; // this is the current scan table: todo refactor
int8_t recoverStep;
-// bool recoverStep1Finished;
-// bool recoverStep2Finished;
int8_t recoverScanFinished;
SQueryTableDataCond tableCond;
SVersionRange fillHistoryVer;
@@ -84,7 +82,6 @@ struct SExecTaskInfo {
int64_t version; // used for stream to record wal version, why not move to sschemainfo
SStreamTaskInfo streamInfo;
SArray* schemaInfos;
- SSchemaInfo schemaInfo;
const char* sql; // query sql string
jmp_buf env; // jump to this position when error happens.
EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model]
diff --git a/source/libs/executor/src/countwindowoperator.c b/source/libs/executor/src/countwindowoperator.c
new file mode 100644
index 0000000000..3980e5ae4d
--- /dev/null
+++ b/source/libs/executor/src/countwindowoperator.c
@@ -0,0 +1,271 @@
+/*
+ * 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 "executorInt.h"
+#include "filter.h"
+#include "function.h"
+#include "functionMgt.h"
+#include "operator.h"
+#include "querytask.h"
+#include "tcommon.h"
+#include "tcompare.h"
+#include "tdatablock.h"
+#include "ttime.h"
+
+typedef struct SCountWindowResult {
+ int32_t winRows;
+ SResultRow row;
+} SCountWindowResult;
+
+typedef struct SCountWindowSupp {
+ SArray* pWinStates;
+ int32_t stateIndex;
+} SCountWindowSupp;
+
+typedef struct SCountWindowOperatorInfo {
+ SOptrBasicInfo binfo;
+ SAggSupporter aggSup;
+ SExprSupp scalarSup;
+ int32_t tsSlotId; // primary timestamp column slot id
+ STimeWindowAggSupp twAggSup;
+ uint64_t groupId; // current group id, used to identify the data block from different groups
+ SResultRow* pRow;
+ int32_t windowCount;
+ int32_t windowSliding;
+ SCountWindowSupp countSup;
+} SCountWindowOperatorInfo;
+
+void destroyCountWindowOperatorInfo(void* param) {
+ SCountWindowOperatorInfo* pInfo = (SCountWindowOperatorInfo*)param;
+ if (pInfo == NULL) {
+ return;
+ }
+ cleanupBasicInfo(&pInfo->binfo);
+ colDataDestroy(&pInfo->twAggSup.timeWindowData);
+
+ cleanupAggSup(&pInfo->aggSup);
+ cleanupExprSupp(&pInfo->scalarSup);
+ taosArrayDestroy(pInfo->countSup.pWinStates);
+ taosMemoryFreeClear(param);
+}
+
+static void clearWinStateBuff(SCountWindowResult* pBuff) {
+ pBuff->winRows = 0;
+}
+
+static SCountWindowResult* getCountWinStateInfo(SCountWindowSupp* pCountSup) {
+ SCountWindowResult* pBuffInfo = taosArrayGet(pCountSup->pWinStates, pCountSup->stateIndex);
+ pCountSup->stateIndex = (pCountSup->stateIndex + 1) % taosArrayGetSize(pCountSup->pWinStates);
+ return pBuffInfo;
+}
+
+static SCountWindowResult* setCountWindowOutputBuff(SExprSupp* pExprSup, SCountWindowSupp* pCountSup, SResultRow** pResult) {
+ SCountWindowResult* pBuff = getCountWinStateInfo(pCountSup);
+ (*pResult) = &pBuff->row;
+ setResultRowInitCtx(*pResult, pExprSup->pCtx, pExprSup->numOfExprs, pExprSup->rowEntryInfoOffset);
+ return pBuff;
+}
+
+static int32_t updateCountWindowInfo(int32_t start, int32_t blockRows, int32_t countWinRows, int32_t* pCurrentRows) {
+ int32_t rows = TMIN(countWinRows - (*pCurrentRows), blockRows - start);
+ (*pCurrentRows) += rows;
+ return rows;
+}
+
+int32_t doCountWindowAggImpl(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
+ SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
+ SExprSupp* pExprSup = &pOperator->exprSupp;
+ SCountWindowOperatorInfo* pInfo = pOperator->info;
+ SSDataBlock* pRes = pInfo->binfo.pRes;
+ SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, pInfo->tsSlotId);
+ TSKEY* tsCols = (TSKEY*)pColInfoData->pData;
+ int32_t code = TSDB_CODE_SUCCESS;
+
+ for (int32_t i = 0; i < pBlock->info.rows;) {
+ int32_t step = pInfo->windowSliding;
+ SCountWindowResult* pBuffInfo = setCountWindowOutputBuff(pExprSup, &pInfo->countSup, &pInfo->pRow);
+ int32_t prevRows = pBuffInfo->winRows;
+ int32_t num = updateCountWindowInfo(i, pBlock->info.rows, pInfo->windowCount, &pBuffInfo->winRows);
+ if (prevRows == 0) {
+ pInfo->pRow->win.skey = tsCols[i];
+ }
+ pInfo->pRow->win.ekey = tsCols[num + i - 1];
+
+ updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pInfo->pRow->win, 0);
+ applyAggFunctionOnPartialTuples(pTaskInfo, pExprSup->pCtx, &pInfo->twAggSup.timeWindowData, i, num,
+ pBlock->info.rows, pExprSup->numOfExprs);
+ if (pBuffInfo->winRows == pInfo->windowCount) {
+ doUpdateNumOfRows(pExprSup->pCtx, pInfo->pRow, pExprSup->numOfExprs, pExprSup->rowEntryInfoOffset);
+ copyResultrowToDataBlock(pExprSup->pExprInfo, pExprSup->numOfExprs, pInfo->pRow, pExprSup->pCtx, pRes,
+ pExprSup->rowEntryInfoOffset, pTaskInfo);
+ pRes->info.rows += pInfo->pRow->numOfRows;
+ clearWinStateBuff(pBuffInfo);
+ clearResultRowInitFlag(pExprSup->pCtx, pExprSup->numOfExprs);
+ }
+ if (pInfo->windowCount != pInfo->windowSliding) {
+ if (prevRows <= pInfo->windowSliding) {
+ if (pBuffInfo->winRows > pInfo->windowSliding) {
+ step = pInfo->windowSliding - prevRows;
+ }
+ } else {
+ step = 0;
+ }
+ }
+ i += step;
+ }
+
+ return code;
+}
+
+static void buildCountResult(SExprSupp* pExprSup, SCountWindowSupp* pCountSup, SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock) {
+ SResultRow* pResultRow = NULL;
+ for (int32_t i = 0; i < taosArrayGetSize(pCountSup->pWinStates); i++) {
+ SCountWindowResult* pBuff = setCountWindowOutputBuff(pExprSup, pCountSup, &pResultRow);
+ if (pBuff->winRows == 0) {
+ continue;;
+ }
+ doUpdateNumOfRows(pExprSup->pCtx, pResultRow, pExprSup->numOfExprs, pExprSup->rowEntryInfoOffset);
+ copyResultrowToDataBlock(pExprSup->pExprInfo, pExprSup->numOfExprs, pResultRow, pExprSup->pCtx, pBlock,
+ pExprSup->rowEntryInfoOffset, pTaskInfo);
+ pBlock->info.rows += pResultRow->numOfRows;
+ clearWinStateBuff(pBuff);
+ clearResultRowInitFlag(pExprSup->pCtx, pExprSup->numOfExprs);
+ }
+}
+
+static SSDataBlock* countWindowAggregate(SOperatorInfo* pOperator) {
+ SCountWindowOperatorInfo* pInfo = pOperator->info;
+ SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
+ SExprSupp* pExprSup = &pOperator->exprSupp;
+ int32_t order = pInfo->binfo.inputTsOrder;
+ SSDataBlock* pRes = pInfo->binfo.pRes;
+ SOperatorInfo* downstream = pOperator->pDownstream[0];
+
+ blockDataCleanup(pRes);
+
+ while (1) {
+ SSDataBlock* pBlock = getNextBlockFromDownstream(pOperator, 0);
+ if (pBlock == NULL) {
+ break;
+ }
+
+ pRes->info.scanFlag = pBlock->info.scanFlag;
+ setInputDataBlock(pExprSup, pBlock, order, MAIN_SCAN, true);
+ blockDataUpdateTsWindow(pBlock, pInfo->tsSlotId);
+
+ // there is an scalar expression that needs to be calculated right before apply the group aggregation.
+ if (pInfo->scalarSup.pExprInfo != NULL) {
+ pTaskInfo->code = projectApplyFunctions(pInfo->scalarSup.pExprInfo, pBlock, pBlock, pInfo->scalarSup.pCtx,
+ pInfo->scalarSup.numOfExprs, NULL);
+ if (pTaskInfo->code != TSDB_CODE_SUCCESS) {
+ T_LONG_JMP(pTaskInfo->env, pTaskInfo->code);
+ }
+ }
+
+ if (pInfo->groupId == 0) {
+ pInfo->groupId = pBlock->info.id.groupId;
+ } else if (pInfo->groupId != pBlock->info.id.groupId) {
+ buildCountResult(pExprSup, &pInfo->countSup, pTaskInfo, pRes);
+ pInfo->groupId = pBlock->info.id.groupId;
+ }
+
+ doCountWindowAggImpl(pOperator, pBlock);
+ if (pRes->info.rows >= pOperator->resultInfo.threshold) {
+ return pRes;
+ }
+ }
+
+ buildCountResult(pExprSup, &pInfo->countSup, pTaskInfo, pRes);
+ return pRes->info.rows == 0 ? NULL : pRes;
+}
+
+SOperatorInfo* createCountwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* physiNode,
+ SExecTaskInfo* pTaskInfo) {
+ SCountWindowOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SCountWindowOperatorInfo));
+ SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
+ if (pInfo == NULL || pOperator == NULL) {
+ goto _error;
+ }
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ SCountWinodwPhysiNode* pCountWindowNode = (SCountWinodwPhysiNode*)physiNode;
+
+ pInfo->tsSlotId = ((SColumnNode*)pCountWindowNode->window.pTspk)->slotId;
+
+ if (pCountWindowNode->window.pExprs != NULL) {
+ int32_t numOfScalarExpr = 0;
+ SExprInfo* pScalarExprInfo = createExprInfo(pCountWindowNode->window.pExprs, NULL, &numOfScalarExpr);
+ code = initExprSupp(&pInfo->scalarSup, pScalarExprInfo, numOfScalarExpr, &pTaskInfo->storageAPI.functionStore);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
+ }
+
+ size_t keyBufSize = 0;
+ int32_t num = 0;
+ SExprInfo* pExprInfo = createExprInfo(pCountWindowNode->window.pFuncs, NULL, &num);
+ initResultSizeInfo(&pOperator->resultInfo, 4096);
+
+ code = initAggSup(&pOperator->exprSupp, &pInfo->aggSup, pExprInfo, num, keyBufSize, pTaskInfo->id.str,
+ pTaskInfo->streamInfo.pState, &pTaskInfo->storageAPI.functionStore);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
+
+ SSDataBlock* pResBlock = createDataBlockFromDescNode(pCountWindowNode->window.node.pOutputDataBlockDesc);
+ blockDataEnsureCapacity(pResBlock, pOperator->resultInfo.capacity);
+
+ initBasicInfo(&pInfo->binfo, pResBlock);
+ initResultRowInfo(&pInfo->binfo.resultRowInfo);
+ pInfo->binfo.inputTsOrder = physiNode->inputTsOrder;
+ pInfo->binfo.outputTsOrder = physiNode->outputTsOrder;
+ pInfo->windowCount = pCountWindowNode->windowCount;
+ pInfo->windowSliding = pCountWindowNode->windowSliding;
+ //sizeof(SCountWindowResult)
+ int32_t itemSize = sizeof(int32_t) + pInfo->aggSup.resultRowSize;
+ int32_t numOfItem = 1;
+ if (pInfo->windowCount != pInfo->windowSliding) {
+ numOfItem = pInfo->windowCount / pInfo->windowSliding + 1;
+ }
+ pInfo->countSup.pWinStates = taosArrayInit_s(itemSize, numOfItem);
+ if (!pInfo->countSup.pWinStates) {
+ goto _error;
+ }
+
+ pInfo->countSup.stateIndex = 0;
+
+ initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window);
+
+ setOperatorInfo(pOperator, "CountWindowOperator", QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT, true, OP_NOT_OPENED, pInfo,
+ pTaskInfo);
+ pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, countWindowAggregate, NULL, destroyCountWindowOperatorInfo,
+ optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
+
+ code = appendDownstream(pOperator, &downstream, 1);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
+
+ return pOperator;
+
+_error:
+ if (pInfo != NULL) {
+ destroyCountWindowOperatorInfo(pInfo);
+ }
+
+ taosMemoryFreeClear(pOperator);
+ pTaskInfo->code = code;
+ return NULL;
+}
diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c
index 8bd83ee0fb..bb89fb587b 100644
--- a/source/libs/executor/src/executil.c
+++ b/source/libs/executor/src/executil.c
@@ -2245,6 +2245,8 @@ char* getStreamOpName(uint16_t opType) {
return "stream partitionby";
case QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT:
return "stream event";
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT:
+ return "stream count";
}
return "";
}
diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c
index 6d80b79d9d..2534c5e9f0 100644
--- a/source/libs/executor/src/executor.c
+++ b/source/libs/executor/src/executor.c
@@ -1027,52 +1027,6 @@ int32_t qSetStreamOperatorOptionForScanHistory(qTaskInfo_t tinfo) {
return 0;
}
-int32_t qRestoreStreamOperatorOption(qTaskInfo_t tinfo) {
- SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
- const char* id = GET_TASKID(pTaskInfo);
- SOperatorInfo* pOperator = pTaskInfo->pRoot;
-
- 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_MID_INTERVAL) {
- SStreamIntervalOperatorInfo* pInfo = pOperator->info;
- pInfo->twAggSup.calTrigger = pInfo->twAggSup.calTriggerSaved;
- pInfo->twAggSup.deleteMark = pInfo->twAggSup.deleteMarkSaved;
- pInfo->ignoreExpiredData = pInfo->ignoreExpiredDataSaved;
- qInfo("%s restore stream agg executors param for interval: %d, %" PRId64, id, pInfo->twAggSup.calTrigger,
- pInfo->twAggSup.deleteMark);
- } else if (type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION ||
- type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION ||
- type == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) {
- SStreamSessionAggOperatorInfo* pInfo = pOperator->info;
- pInfo->twAggSup.calTrigger = pInfo->twAggSup.calTriggerSaved;
- pInfo->twAggSup.deleteMark = pInfo->twAggSup.deleteMarkSaved;
- pInfo->ignoreExpiredData = pInfo->ignoreExpiredDataSaved;
- qInfo("%s restore stream agg executor param for session: %d, %" PRId64, id, pInfo->twAggSup.calTrigger,
- pInfo->twAggSup.deleteMark);
- } else if (type == QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE) {
- SStreamStateAggOperatorInfo* pInfo = pOperator->info;
- pInfo->twAggSup.calTrigger = pInfo->twAggSup.calTriggerSaved;
- pInfo->twAggSup.deleteMark = pInfo->twAggSup.deleteMarkSaved;
- pInfo->ignoreExpiredData = pInfo->ignoreExpiredDataSaved;
- qInfo("%s restore stream agg executor param for state: %d, %" PRId64, id, pInfo->twAggSup.calTrigger,
- pInfo->twAggSup.deleteMark);
- }
-
- // iterate operator tree
- if (pOperator->numOfDownstream != 1 || pOperator->pDownstream[0] == NULL) {
- if (pOperator->numOfDownstream > 1) {
- qError("unexpected stream, multiple downstream");
- return -1;
- }
- return 0;
- } else {
- pOperator = pOperator->pDownstream[0];
- }
- }
-}
-
bool qStreamScanhistoryFinished(qTaskInfo_t tinfo) {
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
return pTaskInfo->streamInfo.recoverScanFinished;
diff --git a/source/libs/executor/src/operator.c b/source/libs/executor/src/operator.c
index fd4b3cd7db..494794f8c2 100644
--- a/source/libs/executor/src/operator.c
+++ b/source/libs/executor/src/operator.c
@@ -542,6 +542,10 @@ SOperatorInfo* createOperator(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, SR
pOptr = createGroupCacheOperatorInfo(ops, size, (SGroupCachePhysiNode*)pPhyNode, pTaskInfo);
} else if (QUERY_NODE_PHYSICAL_PLAN_DYN_QUERY_CTRL == type) {
pOptr = createDynQueryCtrlOperatorInfo(ops, size, (SDynQueryCtrlPhysiNode*)pPhyNode, pTaskInfo);
+ } else if (QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT == type) {
+ pOptr = createStreamCountAggOperatorInfo(ops[0], pPhyNode, pTaskInfo, pHandle);
+ } else if (QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT == type) {
+ pOptr = createCountwindowOperatorInfo(ops[0], pPhyNode, pTaskInfo);
} else {
terrno = TSDB_CODE_INVALID_PARA;
pTaskInfo->code = terrno;
diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c
index cb6ec56235..3e256c651b 100644
--- a/source/libs/executor/src/scanoperator.c
+++ b/source/libs/executor/src/scanoperator.c
@@ -1284,6 +1284,14 @@ static bool isSlidingWindow(SStreamScanInfo* pInfo) {
return isIntervalWindow(pInfo) && pInfo->interval.interval != pInfo->interval.sliding;
}
+static bool isCountSlidingWindow(SStreamScanInfo* pInfo) {
+ return pInfo->windowSup.pStreamAggSup && (pInfo->windowSup.pStreamAggSup->windowCount != pInfo->windowSup.pStreamAggSup->windowSliding);
+}
+
+static bool isCountWindow(SStreamScanInfo* pInfo) {
+ return pInfo->windowSup.parentType == QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT;
+}
+
static void setGroupId(SStreamScanInfo* pInfo, SSDataBlock* pBlock, int32_t groupColIndex, int32_t rowIndex) {
SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, groupColIndex);
uint64_t* groupCol = (uint64_t*)pColInfo->pData;
@@ -1394,7 +1402,7 @@ static bool prepareRangeScan(SStreamScanInfo* pInfo, SSDataBlock* pBlock, int32_
TSKEY* calEndData = (TSKEY*)pCalEndTsCol->pData;
setGroupId(pInfo, pBlock, GROUPID_COLUMN_INDEX, *pRowIndex);
- if (isSlidingWindow(pInfo)) {
+ if (isSlidingWindow(pInfo) || isCountSlidingWindow(pInfo)) {
pInfo->updateWin.skey = calStartData[*pRowIndex];
pInfo->updateWin.ekey = calEndData[*pRowIndex];
}
@@ -1588,6 +1596,47 @@ static int32_t generateSessionScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSr
return TSDB_CODE_SUCCESS;
}
+static int32_t generateCountScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock, EStreamType mode) {
+ blockDataCleanup(pDestBlock);
+ if (pSrcBlock->info.rows == 0) {
+ return TSDB_CODE_SUCCESS;
+ }
+ int32_t code = blockDataEnsureCapacity(pDestBlock, pSrcBlock->info.rows);
+ if (code != TSDB_CODE_SUCCESS) {
+ return code;
+ }
+ ASSERT(taosArrayGetSize(pSrcBlock->pDataBlock) >= 3);
+ SColumnInfoData* pStartTsCol = taosArrayGet(pSrcBlock->pDataBlock, START_TS_COLUMN_INDEX);
+ TSKEY* startData = (TSKEY*)pStartTsCol->pData;
+ SColumnInfoData* pEndTsCol = taosArrayGet(pSrcBlock->pDataBlock, END_TS_COLUMN_INDEX);
+ TSKEY* endData = (TSKEY*)pEndTsCol->pData;
+ SColumnInfoData* pUidCol = taosArrayGet(pSrcBlock->pDataBlock, UID_COLUMN_INDEX);
+ uint64_t* uidCol = (uint64_t*)pUidCol->pData;
+
+ SColumnInfoData* pDestStartCol = taosArrayGet(pDestBlock->pDataBlock, START_TS_COLUMN_INDEX);
+ SColumnInfoData* pDestEndCol = taosArrayGet(pDestBlock->pDataBlock, END_TS_COLUMN_INDEX);
+ SColumnInfoData* pDestUidCol = taosArrayGet(pDestBlock->pDataBlock, UID_COLUMN_INDEX);
+ SColumnInfoData* pDestGpCol = taosArrayGet(pDestBlock->pDataBlock, GROUPID_COLUMN_INDEX);
+ SColumnInfoData* pDestCalStartTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX);
+ SColumnInfoData* pDestCalEndTsCol = taosArrayGet(pDestBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX);
+ int64_t ver = pSrcBlock->info.version - 1;
+ for (int32_t i = 0; i < pSrcBlock->info.rows; i++) {
+ uint64_t groupId = getGroupIdByData(pInfo, uidCol[i], startData[i], ver);
+ SSessionKey startWin = {.win.skey = startData[i], .win.ekey = endData[i], .groupId = groupId};
+ SSessionKey range = {0};
+ getCountWinRange(pInfo->windowSup.pStreamAggSup, &startWin, mode, &range);
+ colDataSetVal(pDestStartCol, i, (const char*)&range.win.skey, false);
+ colDataSetVal(pDestEndCol, i, (const char*)&range.win.ekey, false);
+
+ colDataSetNULL(pDestUidCol, i);
+ colDataSetVal(pDestGpCol, i, (const char*)&groupId, false);
+ colDataSetVal(pDestCalStartTsCol, i, (const char*)&range.win.skey, false);
+ colDataSetVal(pDestCalEndTsCol, i, (const char*)&range.win.ekey, false);
+ pDestBlock->info.rows++;
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
static int32_t generateIntervalScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock) {
blockDataCleanup(pDestBlock);
int32_t rows = pSrcBlock->info.rows;
@@ -1724,12 +1773,14 @@ static int32_t generateDeleteResultBlock(SStreamScanInfo* pInfo, SSDataBlock* pS
return TSDB_CODE_SUCCESS;
}
-static int32_t generateScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock) {
+static int32_t generateScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock, SSDataBlock* pDestBlock, EStreamType type) {
int32_t code = TSDB_CODE_SUCCESS;
if (isIntervalWindow(pInfo)) {
code = generateIntervalScanRange(pInfo, pSrcBlock, pDestBlock);
} else if (isSessionWindow(pInfo) || isStateWindow(pInfo)) {
code = generateSessionScanRange(pInfo, pSrcBlock, pDestBlock);
+ } else if (isCountWindow(pInfo)) {
+ code = generateCountScanRange(pInfo, pSrcBlock, pDestBlock, type);
} else {
code = generateDeleteResultBlock(pInfo, pSrcBlock, pDestBlock);
}
@@ -1742,6 +1793,11 @@ static int32_t generateScanRange(SStreamScanInfo* pInfo, SSDataBlock* pSrcBlock,
void appendOneRowToStreamSpecialBlock(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, uint64_t* pUid,
uint64_t* pGp, void* pTbName) {
+ appendAllColumnToStreamSpecialBlock(pBlock, pStartTs, pEndTs, pStartTs, pEndTs, pUid, pGp, pTbName);
+}
+
+void appendAllColumnToStreamSpecialBlock(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, TSKEY* pCalStartTs,
+ TSKEY* pCalEndTs, uint64_t* pUid, uint64_t* pGp, void* pTbName) {
SColumnInfoData* pStartTsCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX);
SColumnInfoData* pEndTsCol = taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX);
SColumnInfoData* pUidCol = taosArrayGet(pBlock->pDataBlock, UID_COLUMN_INDEX);
@@ -1753,8 +1809,8 @@ void appendOneRowToStreamSpecialBlock(SSDataBlock* pBlock, TSKEY* pStartTs, TSKE
colDataSetVal(pEndTsCol, pBlock->info.rows, (const char*)pEndTs, false);
colDataSetVal(pUidCol, pBlock->info.rows, (const char*)pUid, false);
colDataSetVal(pGpCol, pBlock->info.rows, (const char*)pGp, false);
- colDataSetVal(pCalStartCol, pBlock->info.rows, (const char*)pStartTs, false);
- colDataSetVal(pCalEndCol, pBlock->info.rows, (const char*)pEndTs, false);
+ colDataSetVal(pCalStartCol, pBlock->info.rows, (const char*)pCalStartTs, false);
+ colDataSetVal(pCalEndCol, pBlock->info.rows, (const char*)pCalEndTs, false);
colDataSetVal(pTableCol, pBlock->info.rows, (const char*)pTbName, pTbName == NULL);
pBlock->info.rows++;
}
@@ -2159,6 +2215,14 @@ void streamScanOperatorDecode(void* pBuff, int32_t len, SStreamScanInfo* pInfo)
taosMemoryFree(pUpInfo);
}
}
+static bool hasScanRange(SStreamScanInfo* pInfo) {
+ SStreamAggSupporter* pSup = pInfo->windowSup.pStreamAggSup;
+ return pSup && pSup->pScanBlock->info.rows > 0 && (isStateWindow(pInfo) || isCountWindow(pInfo));
+}
+
+static bool isStreamWindow(SStreamScanInfo* pInfo) {
+ return isIntervalWindow(pInfo) || isSessionWindow(pInfo) || isStateWindow(pInfo) || isCountWindow(pInfo);
+}
static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
// NOTE: this operator does never check if current status is done or not
@@ -2307,7 +2371,7 @@ FETCH_NEXT_BLOCK:
goto FETCH_NEXT_BLOCK;
}
- if (!isIntervalWindow(pInfo) && !isSessionWindow(pInfo) && !isStateWindow(pInfo)) {
+ if (!isStreamWindow(pInfo)) {
generateDeleteResultBlock(pInfo, pDelBlock, pInfo->pDeleteDataRes);
pInfo->pDeleteDataRes->info.type = STREAM_DELETE_RESULT;
printSpecDataBlock(pDelBlock, getStreamOpName(pOperator->operatorType), "delete result", GET_TASKID(pTaskInfo));
@@ -2321,7 +2385,7 @@ FETCH_NEXT_BLOCK:
} else {
pInfo->blockType = STREAM_INPUT__DATA_SUBMIT;
pInfo->updateResIndex = 0;
- generateScanRange(pInfo, pDelBlock, pInfo->pUpdateRes);
+ generateScanRange(pInfo, pDelBlock, pInfo->pUpdateRes, STREAM_DELETE_DATA);
prepareRangeScan(pInfo, pInfo->pUpdateRes, &pInfo->updateResIndex);
copyDataBlock(pInfo->pDeleteDataRes, pInfo->pUpdateRes);
pInfo->pDeleteDataRes->info.type = STREAM_DELETE_DATA;
@@ -2359,7 +2423,7 @@ FETCH_NEXT_BLOCK:
}
} break;
case STREAM_SCAN_FROM_DELETE_DATA: {
- generateScanRange(pInfo, pInfo->pUpdateDataRes, pInfo->pUpdateRes);
+ generateScanRange(pInfo, pInfo->pUpdateDataRes, pInfo->pUpdateRes, STREAM_DELETE_DATA);
prepareRangeScan(pInfo, pInfo->pUpdateRes, &pInfo->updateResIndex);
pInfo->scanMode = STREAM_SCAN_FROM_DATAREADER_RANGE;
copyDataBlock(pInfo->pDeleteDataRes, pInfo->pUpdateRes);
@@ -2367,7 +2431,7 @@ FETCH_NEXT_BLOCK:
return pInfo->pDeleteDataRes;
} break;
case STREAM_SCAN_FROM_UPDATERES: {
- generateScanRange(pInfo, pInfo->pUpdateDataRes, pInfo->pUpdateRes);
+ generateScanRange(pInfo, pInfo->pUpdateDataRes, pInfo->pUpdateRes, STREAM_CLEAR);
prepareRangeScan(pInfo, pInfo->pUpdateRes, &pInfo->updateResIndex);
pInfo->scanMode = STREAM_SCAN_FROM_DATAREADER_RANGE;
return pInfo->pUpdateRes;
@@ -2392,10 +2456,10 @@ FETCH_NEXT_BLOCK:
break;
}
- SStreamAggSupporter* pSup = pInfo->windowSup.pStreamAggSup;
- if (isStateWindow(pInfo) && pSup->pScanBlock->info.rows > 0) {
+ if (hasScanRange(pInfo)) {
pInfo->scanMode = STREAM_SCAN_FROM_DATAREADER_RANGE;
pInfo->updateResIndex = 0;
+ SStreamAggSupporter* pSup = pInfo->windowSup.pStreamAggSup;
copyDataBlock(pInfo->pUpdateRes, pSup->pScanBlock);
blockDataCleanup(pSup->pScanBlock);
prepareRangeScan(pInfo, pInfo->pUpdateRes, &pInfo->updateResIndex);
diff --git a/source/libs/executor/src/streamcountwindowoperator.c b/source/libs/executor/src/streamcountwindowoperator.c
new file mode 100644
index 0000000000..706b4c5a01
--- /dev/null
+++ b/source/libs/executor/src/streamcountwindowoperator.c
@@ -0,0 +1,714 @@
+/*
+ * 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 "executorInt.h"
+#include "function.h"
+#include "functionMgt.h"
+#include "operator.h"
+#include "querytask.h"
+#include "tchecksum.h"
+#include "tcommon.h"
+#include "tdatablock.h"
+#include "tglobal.h"
+#include "tlog.h"
+#include "ttime.h"
+
+#define IS_FINAL_COUNT_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_COUNT)
+#define STREAM_COUNT_OP_STATE_NAME "StreamCountHistoryState"
+#define STREAM_COUNT_OP_CHECKPOINT_NAME "StreamCountOperator_Checkpoint"
+
+typedef struct SCountWindowInfo {
+ SResultWindowInfo winInfo;
+ COUNT_TYPE* pWindowCount;
+} SCountWindowInfo;
+
+typedef enum {
+ NONE_WINDOW = 0,
+ CREATE_NEW_WINDOW,
+ MOVE_NEXT_WINDOW,
+} BuffOp;
+typedef struct SBuffInfo {
+ bool rebuildWindow;
+ BuffOp winBuffOp;
+ SStreamStateCur* pCur;
+} SBuffInfo;
+
+void destroyStreamCountAggOperatorInfo(void* param) {
+ SStreamCountAggOperatorInfo* pInfo = (SStreamCountAggOperatorInfo*)param;
+ cleanupBasicInfo(&pInfo->binfo);
+ destroyStreamAggSupporter(&pInfo->streamAggSup);
+ cleanupExprSupp(&pInfo->scalarSupp);
+ clearGroupResInfo(&pInfo->groupResInfo);
+
+ colDataDestroy(&pInfo->twAggSup.timeWindowData);
+ blockDataDestroy(pInfo->pDelRes);
+ tSimpleHashCleanup(pInfo->pStUpdated);
+ tSimpleHashCleanup(pInfo->pStDeleted);
+ pInfo->pUpdated = taosArrayDestroy(pInfo->pUpdated);
+ cleanupGroupResInfo(&pInfo->groupResInfo);
+
+ taosArrayDestroy(pInfo->historyWins);
+ blockDataDestroy(pInfo->pCheckpointRes);
+
+ taosMemoryFreeClear(param);
+}
+
+bool isSlidingCountWindow(SStreamAggSupporter* pAggSup) {
+ return pAggSup->windowCount != pAggSup->windowSliding;
+}
+
+void setCountOutputBuf(SStreamAggSupporter* pAggSup, TSKEY ts, uint64_t groupId, SCountWindowInfo* pCurWin,
+ SBuffInfo* pBuffInfo) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ int32_t size = pAggSup->resultRowSize;
+ pCurWin->winInfo.sessionWin.groupId = groupId;
+ pCurWin->winInfo.sessionWin.win.skey = ts;
+ pCurWin->winInfo.sessionWin.win.ekey = ts;
+
+ if (isSlidingCountWindow(pAggSup)) {
+ if (pBuffInfo->winBuffOp == CREATE_NEW_WINDOW) {
+ pAggSup->stateStore.streamStateCountWinAdd(pAggSup->pState, &pCurWin->winInfo.sessionWin,
+ (void**)&pCurWin->winInfo.pStatePos, &size);
+ code = TSDB_CODE_FAILED;
+ } else if (pBuffInfo->winBuffOp == MOVE_NEXT_WINDOW) {
+ ASSERT(pBuffInfo->pCur);
+ pAggSup->stateStore.streamStateCurNext(pAggSup->pState, pBuffInfo->pCur);
+ code = pAggSup->stateStore.streamStateSessionGetKVByCur(pBuffInfo->pCur, &pCurWin->winInfo.sessionWin,
+ (void**)&pCurWin->winInfo.pStatePos, &size);
+ if (code == TSDB_CODE_FAILED) {
+ pAggSup->stateStore.streamStateCountWinAdd(pAggSup->pState, &pCurWin->winInfo.sessionWin,
+ (void**)&pCurWin->winInfo.pStatePos, &size);
+ }
+ } else {
+ pBuffInfo->pCur = pAggSup->stateStore.streamStateCountSeekKeyPrev(pAggSup->pState, &pCurWin->winInfo.sessionWin, pAggSup->windowCount);
+ code = pAggSup->stateStore.streamStateSessionGetKVByCur(pBuffInfo->pCur, &pCurWin->winInfo.sessionWin,
+ (void**)&pCurWin->winInfo.pStatePos, &size);
+ if (code == TSDB_CODE_FAILED) {
+ pAggSup->stateStore.streamStateCountWinAdd(pAggSup->pState, &pCurWin->winInfo.sessionWin,
+ (void**)&pCurWin->winInfo.pStatePos, &size);
+ }
+ }
+ } else {
+ code = pAggSup->stateStore.streamStateCountWinAddIfNotExist(
+ pAggSup->pState, &pCurWin->winInfo.sessionWin, pAggSup->windowCount, (void**)&pCurWin->winInfo.pStatePos, &size);
+ }
+
+ if (code == TSDB_CODE_SUCCESS) {
+ pCurWin->winInfo.isOutput = true;
+ }
+ pCurWin->pWindowCount=
+ (COUNT_TYPE*) ((char*)pCurWin->winInfo.pStatePos->pRowBuff + (pAggSup->resultRowSize - sizeof(COUNT_TYPE)));
+
+ if (*pCurWin->pWindowCount == pAggSup->windowCount) {
+ pBuffInfo->rebuildWindow = true;
+ }
+}
+
+static int32_t updateCountWindowInfo(SStreamAggSupporter* pAggSup, SCountWindowInfo* pWinInfo, TSKEY* pTs, int32_t start, int32_t rows, int32_t maxRows,
+ SSHashObj* pStDeleted, bool* pRebuild) {
+ SSessionKey sWinKey = pWinInfo->winInfo.sessionWin;
+ int32_t num = 0;
+ for (int32_t i = start; i < rows; i++) {
+ if (pTs[i] < pWinInfo->winInfo.sessionWin.win.ekey) {
+ num++;
+ } else {
+ break;
+ }
+ }
+ int32_t maxNum = TMIN(maxRows - *pWinInfo->pWindowCount, rows - start);
+ if (num > maxNum) {
+ *pRebuild = true;
+ }
+ *pWinInfo->pWindowCount += maxNum;
+ bool needDelState = false;
+ if (pWinInfo->winInfo.sessionWin.win.skey > pTs[start]) {
+ needDelState = true;
+ if (pStDeleted && pWinInfo->winInfo.isOutput) {
+ saveDeleteRes(pStDeleted, pWinInfo->winInfo.sessionWin);
+ }
+
+ pWinInfo->winInfo.sessionWin.win.skey = pTs[start];
+ }
+
+ if (pWinInfo->winInfo.sessionWin.win.ekey < pTs[maxNum + start - 1]) {
+ needDelState = true;
+ pWinInfo->winInfo.sessionWin.win.ekey = pTs[maxNum + start - 1];
+ }
+
+ if (needDelState) {
+ memcpy(pWinInfo->winInfo.pStatePos->pKey, &pWinInfo->winInfo.sessionWin, sizeof(SSessionKey));
+ if (pWinInfo->winInfo.pStatePos->needFree) {
+ pAggSup->stateStore.streamStateSessionDel(pAggSup->pState, &sWinKey);
+ }
+ }
+
+ return maxNum;
+}
+
+void getCountWinRange(SStreamAggSupporter* pAggSup, const SSessionKey* pKey, EStreamType mode, SSessionKey* pDelRange) {
+ *pDelRange = *pKey;
+ SStreamStateCur* pCur = NULL;
+ if (isSlidingCountWindow(pAggSup)) {
+ pCur = pAggSup->stateStore.streamStateCountSeekKeyPrev(pAggSup->pState, pKey, pAggSup->windowCount);
+ } else {
+ pCur = pAggSup->stateStore.streamStateSessionSeekKeyCurrentNext(pAggSup->pState, pKey);
+ }
+ SSessionKey tmpKey = {0};
+ int32_t code = pAggSup->stateStore.streamStateSessionGetKVByCur(pCur, &tmpKey, NULL, 0);
+ if (code != TSDB_CODE_SUCCESS) {
+ pAggSup->stateStore.streamStateFreeCur(pCur);
+ return;
+ }
+ pDelRange->win = tmpKey.win;
+ while (mode == STREAM_DELETE_DATA) {
+ pAggSup->stateStore.streamStateCurNext(pAggSup->pState, pCur);
+ code = pAggSup->stateStore.streamStateSessionGetKVByCur(pCur, &tmpKey, NULL, 0);
+ if (code != TSDB_CODE_SUCCESS) {
+ break;
+ }
+ pDelRange->win.ekey = TMAX(pDelRange->win.ekey, tmpKey.win.ekey);
+ }
+ pAggSup->stateStore.streamStateFreeCur(pCur);
+}
+
+static void destroySBuffInfo(SStreamAggSupporter* pAggSup, SBuffInfo* pBuffInfo) {
+ pAggSup->stateStore.streamStateFreeCur(pBuffInfo->pCur);
+}
+
+bool inCountCalSlidingWindow(SStreamAggSupporter* pAggSup, STimeWindow* pWin, TSKEY sKey, TSKEY eKey) {
+ if (pAggSup->windowCount == pAggSup->windowSliding) {
+ return true;
+ }
+ if (sKey <= pWin->skey && pWin->ekey <= eKey) {
+ return true;
+ }
+ return false;
+}
+
+bool inCountSlidingWindow(SStreamAggSupporter* pAggSup, STimeWindow* pWin, SDataBlockInfo* pBlockInfo) {
+ return inCountCalSlidingWindow(pAggSup, pWin, pBlockInfo->calWin.skey, pBlockInfo->calWin.ekey);
+}
+
+static void doStreamCountAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBlock, SSHashObj* pStUpdated,
+ SSHashObj* pStDeleted) {
+ SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
+ SStreamCountAggOperatorInfo* pInfo = pOperator->info;
+ int32_t numOfOutput = pOperator->exprSupp.numOfExprs;
+ uint64_t groupId = pSDataBlock->info.id.groupId;
+ int64_t code = TSDB_CODE_SUCCESS;
+ SResultRow* pResult = NULL;
+ int32_t rows = pSDataBlock->info.rows;
+ int32_t winRows = 0;
+ SStreamAggSupporter* pAggSup = &pInfo->streamAggSup;
+ SBuffInfo buffInfo = {.rebuildWindow = false, .winBuffOp = NONE_WINDOW, .pCur = NULL};
+
+ pInfo->dataVersion = TMAX(pInfo->dataVersion, pSDataBlock->info.version);
+ pAggSup->winRange = pTaskInfo->streamInfo.fillHistoryWindow;
+ if (pAggSup->winRange.ekey <= 0) {
+ pAggSup->winRange.ekey = INT64_MAX;
+ }
+
+ SColumnInfoData* pStartTsCol = taosArrayGet(pSDataBlock->pDataBlock, pInfo->primaryTsIndex);
+ TSKEY* startTsCols = (int64_t*)pStartTsCol->pData;
+ blockDataEnsureCapacity(pAggSup->pScanBlock, rows * 2);
+ SStreamStateCur* pCur = NULL;
+ COUNT_TYPE slidingRows = 0;
+
+ for (int32_t i = 0; i < rows;) {
+ if (pInfo->ignoreExpiredData &&
+ checkExpiredData(&pInfo->streamAggSup.stateStore, pInfo->streamAggSup.pUpdateInfo, &pInfo->twAggSup,
+ pSDataBlock->info.id.uid, startTsCols[i])) {
+ i++;
+ continue;
+ }
+ SCountWindowInfo curWin = {0};
+ buffInfo.rebuildWindow = false;
+ setCountOutputBuf(pAggSup, startTsCols[i], groupId, &curWin, &buffInfo);
+ if (!inCountSlidingWindow(pAggSup, &curWin.winInfo.sessionWin.win, &pSDataBlock->info)) {
+ buffInfo.winBuffOp = MOVE_NEXT_WINDOW;
+ continue;
+ }
+ setSessionWinOutputInfo(pStUpdated, &curWin.winInfo);
+ slidingRows = *curWin.pWindowCount;
+ if (!buffInfo.rebuildWindow) {
+ winRows = updateCountWindowInfo(pAggSup, &curWin, startTsCols, i, rows, pAggSup->windowCount, pStDeleted, &buffInfo.rebuildWindow);
+ }
+ if (buffInfo.rebuildWindow) {
+ SSessionKey range = {0};
+ if (isSlidingCountWindow(pAggSup)) {
+ curWin.winInfo.sessionWin.win.skey = startTsCols[i];
+ curWin.winInfo.sessionWin.win.ekey = startTsCols[i];
+ }
+ getCountWinRange(pAggSup, &curWin.winInfo.sessionWin, STREAM_DELETE_DATA, &range);
+ range.win.skey = TMIN(startTsCols[i], range.win.skey);
+ range.win.ekey = TMAX(startTsCols[rows-1], range.win.ekey);
+ uint64_t uid = 0;
+ appendOneRowToStreamSpecialBlock(pAggSup->pScanBlock, &range.win.skey, &range.win.ekey, &uid, &range.groupId, NULL);
+ break;
+ }
+ code = doOneWindowAggImpl(&pInfo->twAggSup.timeWindowData, &curWin.winInfo, &pResult, i, winRows, rows, numOfOutput,
+ pOperator, 0);
+ if (code != TSDB_CODE_SUCCESS || pResult == NULL) {
+ qError("%s do stream count aggregate impl error, code %s", GET_TASKID(pTaskInfo), tstrerror(code));
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY);
+ }
+ saveSessionOutputBuf(pAggSup, &curWin.winInfo);
+
+ if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE && pStUpdated) {
+ code = saveResult(curWin.winInfo, pStUpdated);
+ if (code != TSDB_CODE_SUCCESS) {
+ qError("%s do stream count aggregate impl, set result error, code %s", GET_TASKID(pTaskInfo),
+ tstrerror(code));
+ T_LONG_JMP(pTaskInfo->env, TSDB_CODE_OUT_OF_MEMORY);
+ }
+ }
+ if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE) {
+ SSessionKey key = {0};
+ getSessionHashKey(&curWin.winInfo.sessionWin, &key);
+ tSimpleHashPut(pAggSup->pResultRows, &key, sizeof(SSessionKey), &curWin.winInfo, sizeof(SResultWindowInfo));
+ }
+
+ if (isSlidingCountWindow(pAggSup)) {
+ if (slidingRows <= pAggSup->windowSliding) {
+ if (slidingRows + winRows > pAggSup->windowSliding) {
+ buffInfo.winBuffOp = CREATE_NEW_WINDOW;
+ winRows = pAggSup->windowSliding - slidingRows;
+ ASSERT(i >= 0);
+ }
+ } else {
+ buffInfo.winBuffOp = MOVE_NEXT_WINDOW;
+ winRows = 0;
+ }
+ }
+ i += winRows;
+ }
+ destroySBuffInfo(pAggSup, &buffInfo);
+}
+
+static SSDataBlock* buildCountResult(SOperatorInfo* pOperator) {
+ SStreamCountAggOperatorInfo* pInfo = pOperator->info;
+ SStreamAggSupporter* pAggSup = &pInfo->streamAggSup;
+ SOptrBasicInfo* pBInfo = &pInfo->binfo;
+ SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
+ doBuildDeleteDataBlock(pOperator, pInfo->pStDeleted, pInfo->pDelRes, &pInfo->pDelIterator);
+ if (pInfo->pDelRes->info.rows > 0) {
+ printDataBlock(pInfo->pDelRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo));
+ return pInfo->pDelRes;
+ }
+
+ doBuildSessionResult(pOperator, pAggSup->pState, &pInfo->groupResInfo, pBInfo->pRes);
+ if (pBInfo->pRes->info.rows > 0) {
+ printDataBlock(pBInfo->pRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo));
+ return pBInfo->pRes;
+ }
+ return NULL;
+}
+
+int32_t doStreamCountEncodeOpState(void** buf, int32_t len, SOperatorInfo* pOperator, bool isParent) {
+ SStreamCountAggOperatorInfo* pInfo = pOperator->info;
+ if (!pInfo) {
+ return 0;
+ }
+
+ void* pData = (buf == NULL) ? NULL : *buf;
+
+ // 1.streamAggSup.pResultRows
+ int32_t tlen = 0;
+ int32_t mapSize = tSimpleHashGetSize(pInfo->streamAggSup.pResultRows);
+ tlen += taosEncodeFixedI32(buf, mapSize);
+ void* pIte = NULL;
+ size_t keyLen = 0;
+ int32_t iter = 0;
+ while ((pIte = tSimpleHashIterate(pInfo->streamAggSup.pResultRows, pIte, &iter)) != NULL) {
+ void* key = taosHashGetKey(pIte, &keyLen);
+ tlen += encodeSSessionKey(buf, key);
+ tlen += encodeSResultWindowInfo(buf, pIte, pInfo->streamAggSup.resultRowSize);
+ }
+
+ // 2.twAggSup
+ tlen += encodeSTimeWindowAggSupp(buf, &pInfo->twAggSup);
+
+ // 3.dataVersion
+ tlen += taosEncodeFixedI32(buf, pInfo->dataVersion);
+
+ // 4.checksum
+ if (isParent) {
+ if (buf) {
+ uint32_t cksum = taosCalcChecksum(0, pData, len - sizeof(uint32_t));
+ tlen += taosEncodeFixedU32(buf, cksum);
+ } else {
+ tlen += sizeof(uint32_t);
+ }
+ }
+
+ return tlen;
+}
+
+void* doStreamCountDecodeOpState(void* buf, int32_t len, SOperatorInfo* pOperator, bool isParent) {
+ SStreamCountAggOperatorInfo* pInfo = pOperator->info;
+ if (!pInfo) {
+ return buf;
+ }
+
+ // 4.checksum
+ if (isParent) {
+ int32_t dataLen = len - sizeof(uint32_t);
+ void* pCksum = POINTER_SHIFT(buf, dataLen);
+ if (taosCheckChecksum(buf, dataLen, *(uint32_t*)pCksum) != TSDB_CODE_SUCCESS) {
+ qError("stream count state is invalid");
+ return buf;
+ }
+ }
+
+ // 1.streamAggSup.pResultRows
+ int32_t mapSize = 0;
+ buf = taosDecodeFixedI32(buf, &mapSize);
+ for (int32_t i = 0; i < mapSize; i++) {
+ SSessionKey key = {0};
+ SResultWindowInfo winfo = {0};
+ buf = decodeSSessionKey(buf, &key);
+ buf = decodeSResultWindowInfo(buf, &winfo, pInfo->streamAggSup.resultRowSize);
+ tSimpleHashPut(pInfo->streamAggSup.pResultRows, &key, sizeof(SSessionKey), &winfo, sizeof(SResultWindowInfo));
+ }
+
+ // 2.twAggSup
+ buf = decodeSTimeWindowAggSupp(buf, &pInfo->twAggSup);
+
+ // 3.dataVersion
+ buf = taosDecodeFixedI64(buf, &pInfo->dataVersion);
+ return buf;
+}
+
+void doStreamCountSaveCheckpoint(SOperatorInfo* pOperator) {
+ SStreamCountAggOperatorInfo* pInfo = pOperator->info;
+ int32_t len = doStreamCountEncodeOpState(NULL, 0, pOperator, true);
+ void* buf = taosMemoryCalloc(1, len);
+ void* pBuf = buf;
+ len = doStreamCountEncodeOpState(&pBuf, len, pOperator, true);
+ pInfo->streamAggSup.stateStore.streamStateSaveInfo(pInfo->streamAggSup.pState, STREAM_COUNT_OP_CHECKPOINT_NAME,
+ strlen(STREAM_COUNT_OP_CHECKPOINT_NAME), buf, len);
+ taosMemoryFree(buf);
+}
+
+void doResetCountWindows(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock) {
+ SColumnInfoData* pStartTsCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX);
+ TSKEY* startDatas = (TSKEY*)pStartTsCol->pData;
+ SColumnInfoData* pEndTsCol = taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX);
+ TSKEY* endDatas = (TSKEY*)pEndTsCol->pData;
+ SColumnInfoData* pCalStartTsCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX);
+ TSKEY* calStartDatas = (TSKEY*)pStartTsCol->pData;
+ SColumnInfoData* pCalEndTsCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX);
+ TSKEY* calEndDatas = (TSKEY*)pEndTsCol->pData;
+ SColumnInfoData* pGroupCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX);
+ uint64_t* gpDatas = (uint64_t*)pGroupCol->pData;
+
+ SRowBuffPos* pPos = NULL;
+ int32_t size = 0;
+ for (int32_t i = 0; i < pBlock->info.rows; i++) {
+ SSessionKey key = {.groupId = gpDatas[i], .win.skey = startDatas[i], .win.ekey = endDatas[i]};
+ SStreamStateCur* pCur = NULL;
+ if (isSlidingCountWindow(pAggSup)) {
+ pCur = pAggSup->stateStore.streamStateCountSeekKeyPrev(pAggSup->pState, &key, pAggSup->windowCount);
+ } else {
+ pCur = pAggSup->stateStore.streamStateSessionSeekKeyCurrentNext(pAggSup->pState, &key);
+ }
+ while (1) {
+ SSessionKey tmpKey = {0};
+ int32_t code = pAggSup->stateStore.streamStateSessionGetKVByCur(pCur, &tmpKey, (void **)&pPos, &size);
+ if (code != TSDB_CODE_SUCCESS || tmpKey.win.skey > endDatas[i]) {
+ pAggSup->stateStore.streamStateFreeCur(pCur);
+ break;
+ }
+ if (!inCountCalSlidingWindow(pAggSup, &tmpKey.win, calStartDatas[i], calEndDatas[i])) {
+ pAggSup->stateStore.streamStateCurNext(pAggSup->pState, pCur);
+ continue;
+ }
+ pAggSup->stateStore.streamStateSessionReset(pAggSup->pState, pPos->pRowBuff);
+ pAggSup->stateStore.streamStateCurNext(pAggSup->pState, pCur);
+ }
+ }
+}
+
+void doDeleteCountWindows(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SArray* result) {
+ SColumnInfoData* pStartTsCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX);
+ TSKEY* startDatas = (TSKEY*)pStartTsCol->pData;
+ SColumnInfoData* pEndTsCol = taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX);
+ TSKEY* endDatas = (TSKEY*)pEndTsCol->pData;
+ SColumnInfoData* pCalStartTsCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX);
+ TSKEY* calStartDatas = (TSKEY*)pStartTsCol->pData;
+ SColumnInfoData* pCalEndTsCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX);
+ TSKEY* calEndDatas = (TSKEY*)pEndTsCol->pData;
+ SColumnInfoData* pGroupCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX);
+ uint64_t* gpDatas = (uint64_t*)pGroupCol->pData;
+ for (int32_t i = 0; i < pBlock->info.rows; i++) {
+ SSessionKey key = {.win.skey = startDatas[i], .win.ekey = endDatas[i], .groupId = gpDatas[i]};
+ while (1) {
+ SSessionKey curWin = {0};
+ int32_t code = pAggSup->stateStore.streamStateCountGetKeyByRange(pAggSup->pState, &key, &curWin);
+ if (code == TSDB_CODE_FAILED) {
+ break;
+ }
+ doDeleteSessionWindow(pAggSup, &curWin);
+ if (result) {
+ saveDeleteInfo(result, curWin);
+ }
+ }
+ }
+}
+
+void deleteCountWinState(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SSHashObj* pMapUpdate,
+ SSHashObj* pMapDelete) {
+ SArray* pWins = taosArrayInit(16, sizeof(SSessionKey));
+ if (isSlidingCountWindow(pAggSup)) {
+ doDeleteCountWindows(pAggSup, pBlock, pWins);
+ } else {
+ doDeleteTimeWindows(pAggSup, pBlock, pWins);
+ }
+ removeSessionResults(pAggSup, pMapUpdate, pWins);
+ copyDeleteWindowInfo(pWins, pMapDelete);
+ taosArrayDestroy(pWins);
+}
+
+static SSDataBlock* doStreamCountAgg(SOperatorInfo* pOperator) {
+ SExprSupp* pSup = &pOperator->exprSupp;
+ SStreamCountAggOperatorInfo* pInfo = pOperator->info;
+ SOptrBasicInfo* pBInfo = &pInfo->binfo;
+ SStreamAggSupporter* pAggSup = &pInfo->streamAggSup;
+ SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
+ 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* opRes = buildCountResult(pOperator);
+ if (opRes) {
+ return opRes;
+ }
+
+ if (pInfo->recvGetAll) {
+ pInfo->recvGetAll = false;
+ resetUnCloseSessionWinInfo(pInfo->streamAggSup.pResultRows);
+ }
+
+ if (pInfo->reCkBlock) {
+ pInfo->reCkBlock = false;
+ printDataBlock(pInfo->pCheckpointRes, getStreamOpName(pOperator->operatorType), GET_TASKID(pTaskInfo));
+ return pInfo->pCheckpointRes;
+ }
+
+ setStreamOperatorCompleted(pOperator);
+ return NULL;
+ }
+
+ SOperatorInfo* downstream = pOperator->pDownstream[0];
+ if (!pInfo->pUpdated) {
+ pInfo->pUpdated = taosArrayInit(16, sizeof(SResultWindowInfo));
+ }
+ if (!pInfo->pStUpdated) {
+ _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
+ pInfo->pStUpdated = tSimpleHashInit(64, hashFn);
+ }
+ while (1) {
+ SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream);
+ if (pBlock == NULL) {
+ break;
+ }
+ printSpecDataBlock(pBlock, getStreamOpName(pOperator->operatorType), "recv", GET_TASKID(pTaskInfo));
+
+ if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT) {
+ deleteCountWinState(&pInfo->streamAggSup, pBlock, pInfo->pStUpdated, pInfo->pStDeleted);
+ continue;
+ } else if (pBlock->info.type == STREAM_CLEAR) {
+ doResetCountWindows(&pInfo->streamAggSup, pBlock);
+ continue;
+ } else if (pBlock->info.type == STREAM_GET_ALL) {
+ pInfo->recvGetAll = true;
+ getAllSessionWindow(pAggSup->pResultRows, pInfo->pStUpdated);
+ continue;
+ } else if (pBlock->info.type == STREAM_CREATE_CHILD_TABLE) {
+ return pBlock;
+ } else if (pBlock->info.type == STREAM_CHECKPOINT) {
+ pAggSup->stateStore.streamStateCommit(pAggSup->pState);
+ doStreamCountSaveCheckpoint(pOperator);
+ copyDataBlock(pInfo->pCheckpointRes, pBlock);
+ continue;
+ } else {
+ ASSERTS(pBlock->info.type == STREAM_NORMAL || 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);
+ }
+ // the pDataBlock are always the same one, no need to call this again
+ setInputDataBlock(pSup, pBlock, TSDB_ORDER_ASC, MAIN_SCAN, true);
+ doStreamCountAggImpl(pOperator, pBlock, pInfo->pStUpdated, pInfo->pStDeleted);
+ pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, pBlock->info.window.ekey);
+ pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, pBlock->info.watermark);
+ }
+ // restore the value
+ pOperator->status = OP_RES_TO_RETURN;
+
+ closeSessionWindow(pAggSup->pResultRows, &pInfo->twAggSup, pInfo->pStUpdated);
+ copyUpdateResult(&pInfo->pStUpdated, pInfo->pUpdated, sessionKeyCompareAsc);
+ removeSessionDeleteResults(pInfo->pStDeleted, pInfo->pUpdated);
+ initGroupResInfoFromArrayList(&pInfo->groupResInfo, pInfo->pUpdated);
+ pInfo->pUpdated = NULL;
+ blockDataEnsureCapacity(pInfo->binfo.pRes, pOperator->resultInfo.capacity);
+
+ SSDataBlock* opRes = buildCountResult(pOperator);
+ if (opRes) {
+ return opRes;
+ }
+
+ setStreamOperatorCompleted(pOperator);
+ return NULL;
+}
+
+void streamCountReleaseState(SOperatorInfo* pOperator) {
+ SStreamEventAggOperatorInfo* pInfo = pOperator->info;
+ int32_t resSize = sizeof(TSKEY);
+ char* pBuff = taosMemoryCalloc(1, resSize);
+ memcpy(pBuff, &pInfo->twAggSup.maxTs, sizeof(TSKEY));
+ qDebug("===stream=== count window operator relase state. ");
+ pInfo->streamAggSup.stateStore.streamStateSaveInfo(pInfo->streamAggSup.pState, STREAM_COUNT_OP_STATE_NAME,
+ strlen(STREAM_COUNT_OP_STATE_NAME), pBuff, resSize);
+ pInfo->streamAggSup.stateStore.streamStateCommit(pInfo->streamAggSup.pState);
+ taosMemoryFreeClear(pBuff);
+ SOperatorInfo* downstream = pOperator->pDownstream[0];
+ if (downstream->fpSet.releaseStreamStateFn) {
+ downstream->fpSet.releaseStreamStateFn(downstream);
+ }
+}
+
+void streamCountReloadState(SOperatorInfo* pOperator) {
+ SStreamCountAggOperatorInfo* pInfo = pOperator->info;
+ SStreamAggSupporter* pAggSup = &pInfo->streamAggSup;
+ int32_t size = 0;
+ void* pBuf = NULL;
+
+ int32_t code = pAggSup->stateStore.streamStateGetInfo(pAggSup->pState, STREAM_COUNT_OP_STATE_NAME,
+ strlen(STREAM_COUNT_OP_STATE_NAME), &pBuf, &size);
+ TSKEY ts = *(TSKEY*)pBuf;
+ pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, ts);
+ taosMemoryFree(pBuf);
+
+ SOperatorInfo* downstream = pOperator->pDownstream[0];
+ if (downstream->fpSet.reloadStreamStateFn) {
+ downstream->fpSet.reloadStreamStateFn(downstream);
+ }
+ reloadAggSupFromDownStream(downstream, &pInfo->streamAggSup);
+}
+
+SOperatorInfo* createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode,
+ SExecTaskInfo* pTaskInfo, SReadHandle* pHandle) {
+ SCountWinodwPhysiNode* pCountNode = (SCountWinodwPhysiNode*)pPhyNode;
+ int32_t numOfCols = 0;
+ int32_t code = TSDB_CODE_OUT_OF_MEMORY;
+ SStreamCountAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamCountAggOperatorInfo));
+ SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
+ if (pInfo == NULL || pOperator == NULL) {
+ goto _error;
+ }
+
+ pOperator->pTaskInfo = pTaskInfo;
+
+ initResultSizeInfo(&pOperator->resultInfo, 4096);
+ if (pCountNode->window.pExprs != NULL) {
+ int32_t numOfScalar = 0;
+ SExprInfo* pScalarExprInfo = createExprInfo(pCountNode->window.pExprs, NULL, &numOfScalar);
+ code = initExprSupp(&pInfo->scalarSupp, pScalarExprInfo, numOfScalar, &pTaskInfo->storageAPI.functionStore);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
+ }
+ SExprSupp* pExpSup = &pOperator->exprSupp;
+
+ SExprInfo* pExprInfo = createExprInfo(pCountNode->window.pFuncs, NULL, &numOfCols);
+ SSDataBlock* pResBlock = createDataBlockFromDescNode(pPhyNode->pOutputDataBlockDesc);
+ code = initBasicInfoEx(&pInfo->binfo, pExpSup, pExprInfo, numOfCols, pResBlock, &pTaskInfo->storageAPI.functionStore);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
+
+ code = initStreamAggSupporter(&pInfo->streamAggSup, pExpSup, numOfCols, 0,
+ pTaskInfo->streamInfo.pState, sizeof(COUNT_TYPE), 0, &pTaskInfo->storageAPI.stateStore, pHandle,
+ &pInfo->twAggSup, GET_TASKID(pTaskInfo), &pTaskInfo->storageAPI);
+ if (code != TSDB_CODE_SUCCESS) {
+ goto _error;
+ }
+ pInfo->streamAggSup.windowCount = pCountNode->windowCount;
+ pInfo->streamAggSup.windowSliding = pCountNode->windowSliding;
+
+ pInfo->twAggSup = (STimeWindowAggSupp){
+ .waterMark = pCountNode->window.watermark,
+ .calTrigger = pCountNode->window.triggerType,
+ .maxTs = INT64_MIN,
+ .minTs = INT64_MAX,
+ };
+
+ initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window);
+
+ pInfo->primaryTsIndex = ((SColumnNode*)pCountNode->window.pTspk)->slotId;
+
+ pInfo->binfo.pRes = pResBlock;
+ _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
+ pInfo->pStDeleted = tSimpleHashInit(64, hashFn);
+ pInfo->pDelIterator = NULL;
+ pInfo->pDelRes = createSpecialDataBlock(STREAM_DELETE_RESULT);
+ pInfo->ignoreExpiredData = pCountNode->window.igExpired;
+ pInfo->ignoreExpiredDataSaved = false;
+ pInfo->pUpdated = NULL;
+ pInfo->pStUpdated = NULL;
+ pInfo->dataVersion = 0;
+ pInfo->historyWins = taosArrayInit(4, sizeof(SSessionKey));
+ if (!pInfo->historyWins) {
+ goto _error;
+ }
+
+ pInfo->pCheckpointRes = createSpecialDataBlock(STREAM_CHECKPOINT);
+ pInfo->recvGetAll = false;
+
+ pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT;
+ // for stream
+ void* buff = NULL;
+ int32_t len = 0;
+ int32_t res =
+ pInfo->streamAggSup.stateStore.streamStateGetInfo(pInfo->streamAggSup.pState, STREAM_COUNT_OP_CHECKPOINT_NAME,
+ strlen(STREAM_COUNT_OP_CHECKPOINT_NAME), &buff, &len);
+ if (res == TSDB_CODE_SUCCESS) {
+ doStreamCountDecodeOpState(buff, len, pOperator, true);
+ taosMemoryFree(buff);
+ }
+ setOperatorInfo(pOperator, getStreamOpName(pOperator->operatorType), QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT, true,
+ OP_NOT_OPENED, pInfo, pTaskInfo);
+ pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doStreamCountAgg, NULL, destroyStreamCountAggOperatorInfo,
+ optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
+ setOperatorStreamStateFn(pOperator, streamCountReleaseState, streamCountReloadState);
+
+ if (downstream) {
+ initDownStream(downstream, &pInfo->streamAggSup, pOperator->operatorType, pInfo->primaryTsIndex, &pInfo->twAggSup);
+ code = appendDownstream(pOperator, &downstream, 1);
+ }
+ return pOperator;
+
+_error:
+ if (pInfo != NULL) {
+ destroyStreamCountAggOperatorInfo(pInfo);
+ }
+
+ taosMemoryFreeClear(pOperator);
+ pTaskInfo->code = code;
+ return NULL;
+}
+
diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c
index b3f18d08ac..2838d005ab 100644
--- a/source/libs/executor/src/streamtimewindowoperator.c
+++ b/source/libs/executor/src/streamtimewindowoperator.c
@@ -1945,7 +1945,7 @@ int32_t doOneWindowAggImpl(SColumnInfoData* pTimeWindowData, SResultWindowInfo*
return TSDB_CODE_SUCCESS;
}
-static bool doDeleteSessionWindow(SStreamAggSupporter* pAggSup, SSessionKey* pKey) {
+bool doDeleteSessionWindow(SStreamAggSupporter* pAggSup, SSessionKey* pKey) {
pAggSup->stateStore.streamStateSessionDel(pAggSup->pState, pKey);
SSessionKey hashKey = {0};
getSessionHashKey(pKey, &hashKey);
@@ -2343,7 +2343,7 @@ int32_t getAllSessionWindow(SSHashObj* pHashMap, SSHashObj* pStUpdated) {
return TSDB_CODE_SUCCESS;
}
-static void copyDeleteWindowInfo(SArray* pResWins, SSHashObj* pStDeleted) {
+void copyDeleteWindowInfo(SArray* pResWins, SSHashObj* pStDeleted) {
int32_t size = taosArrayGetSize(pResWins);
for (int32_t i = 0; i < size; i++) {
SSessionKey* pWinKey = taosArrayGet(pResWins, i);
diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c
index 3559e57ebc..fde5f22aaa 100644
--- a/source/libs/executor/src/tsort.c
+++ b/source/libs/executor/src/tsort.c
@@ -1043,7 +1043,7 @@ static int32_t sortBlocksToExtSource(SSortHandle* pHandle, SArray* aBlk, SBlockO
return 0;
}
-static SSDataBlock* getRowsBlockWithinMergeLimit(const SSortHandle* pHandle, SSHashObj* mTableNumRows, SSDataBlock* pOrigBlk, bool* pExtractedBlock) {
+static SSDataBlock* getRowsBlockWithinMergeLimit(const SSortHandle* pHandle, SSHashObj* mTableNumRows, SSDataBlock* pOrigBlk, bool* pExtractedBlock, bool *pSkipBlock) {
int64_t nRows = 0;
int64_t prevRows = 0;
void* pNum = tSimpleHashGet(mTableNumRows, &pOrigBlk->info.id.uid, sizeof(pOrigBlk->info.id.uid));
@@ -1062,9 +1062,15 @@ static SSDataBlock* getRowsBlockWithinMergeLimit(const SSortHandle* pHandle, SSH
if (pHandle->mergeLimitReachedFn) {
pHandle->mergeLimitReachedFn(pOrigBlk->info.id.uid, pHandle->mergeLimitReachedParam);
}
- keepRows = pHandle->mergeLimit - prevRows;
+ keepRows = pHandle->mergeLimit > prevRows ? (pHandle->mergeLimit - prevRows) : 0;
}
-
+
+ if (keepRows == 0) {
+ *pSkipBlock = true;
+ return pOrigBlk;
+ }
+
+ *pSkipBlock = false;
SSDataBlock* pBlock = NULL;
if (keepRows != pOrigBlk->info.rows) {
pBlock = blockDataExtractBlock(pOrigBlk, 0, keepRows);
@@ -1106,8 +1112,12 @@ static int32_t createBlocksMergeSortInitialSources(SSortHandle* pHandle) {
int64_t p = taosGetTimestampUs();
bool bExtractedBlock = false;
+ bool bSkipBlock = false;
if (pBlk != NULL && pHandle->mergeLimit > 0) {
- pBlk = getRowsBlockWithinMergeLimit(pHandle, mTableNumRows, pBlk, &bExtractedBlock);
+ pBlk = getRowsBlockWithinMergeLimit(pHandle, mTableNumRows, pBlk, &bExtractedBlock, &bSkipBlock);
+ if (bSkipBlock) {
+ continue;
+ }
}
if (pBlk != NULL) {
@@ -1121,7 +1131,6 @@ static int32_t createBlocksMergeSortInitialSources(SSortHandle* pHandle) {
if (pBlk != NULL) {
szSort += blockDataGetSize(pBlk);
-
void* ppBlk = tSimpleHashGet(mUidBlk, &pBlk->info.id.uid, sizeof(pBlk->info.id.uid));
if (ppBlk != NULL) {
SSDataBlock* tBlk = *(SSDataBlock**)(ppBlk);
@@ -1138,7 +1147,6 @@ static int32_t createBlocksMergeSortInitialSources(SSortHandle* pHandle) {
if ((pBlk != NULL && szSort > maxBufSize) || (pBlk == NULL && szSort > 0)) {
tSimpleHashClear(mUidBlk);
-
code = sortBlocksToExtSource(pHandle, aBlkSort, pOrder, aExtSrc);
if (code != TSDB_CODE_SUCCESS) {
tSimpleHashCleanup(mUidBlk);
diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c
index 3addacae77..654c8f8336 100644
--- a/source/libs/nodes/src/nodesCloneFuncs.c
+++ b/source/libs/nodes/src/nodesCloneFuncs.c
@@ -330,6 +330,13 @@ static int32_t eventWindowNodeCopy(const SEventWindowNode* pSrc, SEventWindowNod
return TSDB_CODE_SUCCESS;
}
+static int32_t countWindowNodeCopy(const SCountWindowNode* pSrc, SCountWindowNode* pDst) {
+ CLONE_NODE_FIELD(pCol);
+ COPY_SCALAR_FIELD(windowCount);
+ COPY_SCALAR_FIELD(windowSliding);
+ return TSDB_CODE_SUCCESS;
+}
+
static int32_t sessionWindowNodeCopy(const SSessionWindowNode* pSrc, SSessionWindowNode* pDst) {
CLONE_NODE_FIELD_EX(pCol, SColumnNode*);
CLONE_NODE_FIELD_EX(pGap, SValueNode*);
@@ -565,6 +572,8 @@ static int32_t logicWindowCopy(const SWindowLogicNode* pSrc, SWindowLogicNode* p
COPY_SCALAR_FIELD(igExpired);
COPY_SCALAR_FIELD(igCheckUpdate);
COPY_SCALAR_FIELD(windowAlgo);
+ COPY_SCALAR_FIELD(windowCount);
+ COPY_SCALAR_FIELD(windowSliding);
return TSDB_CODE_SUCCESS;
}
@@ -867,6 +876,9 @@ SNode* nodesCloneNode(const SNode* pNode) {
case QUERY_NODE_EVENT_WINDOW:
code = eventWindowNodeCopy((const SEventWindowNode*)pNode, (SEventWindowNode*)pDst);
break;
+ case QUERY_NODE_COUNT_WINDOW:
+ code = countWindowNodeCopy((const SCountWindowNode*)pNode, (SCountWindowNode*)pDst);
+ break;
case QUERY_NODE_SESSION_WINDOW:
code = sessionWindowNodeCopy((const SSessionWindowNode*)pNode, (SSessionWindowNode*)pDst);
break;
diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c
index c727e613f3..854101a726 100644
--- a/source/libs/nodes/src/nodesCodeFuncs.c
+++ b/source/libs/nodes/src/nodesCodeFuncs.c
@@ -93,6 +93,8 @@ const char* nodesNodeName(ENodeType type) {
return "EventWindow";
case QUERY_NODE_WINDOW_OFFSET:
return "WindowOffset";
+ case QUERY_NODE_COUNT_WINDOW:
+ return "CountWindow";
case QUERY_NODE_SET_OPERATOR:
return "SetOperator";
case QUERY_NODE_SELECT_STMT:
@@ -345,6 +347,10 @@ const char* nodesNodeName(ENodeType type) {
return "PhysiMergeEventWindow";
case QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT:
return "PhysiStreamEventWindow";
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT:
+ return "PhysiMergeCountWindow";
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT:
+ return "PhysiStreamCountWindow";
case QUERY_NODE_PHYSICAL_PLAN_PROJECT:
return "PhysiProject";
case QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN:
@@ -2839,6 +2845,36 @@ static int32_t jsonToPhysiEventWindowNode(const SJson* pJson, void* pObj) {
return code;
}
+static const char* jkCountWindowPhysiPlanWindowCount = "WindowCount";
+static const char* jkCountWindowPhysiPlanWindowSliding = "WindowSliding";
+
+static int32_t physiCountWindowNodeToJson(const void* pObj, SJson* pJson) {
+ const SCountWinodwPhysiNode* pNode = (const SCountWinodwPhysiNode*)pObj;
+
+ int32_t code = physiWindowNodeToJson(pObj, pJson);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddIntegerToObject(pJson, jkCountWindowPhysiPlanWindowCount, pNode->windowCount);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddIntegerToObject(pJson, jkCountWindowPhysiPlanWindowSliding, pNode->windowSliding);
+ }
+ return code;
+}
+
+static int32_t jsonToPhysiCountWindowNode(const SJson* pJson, void* pObj) {
+ SCountWinodwPhysiNode* pNode = (SCountWinodwPhysiNode*)pObj;
+
+ int32_t code = jsonToPhysiWindowNode(pJson, pObj);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetBigIntValue(pJson, jkCountWindowPhysiPlanWindowCount, &pNode->windowCount);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetBigIntValue(pJson, jkCountWindowPhysiPlanWindowSliding, &pNode->windowSliding);
+ }
+
+ return code;
+}
+
static const char* jkPartitionPhysiPlanExprs = "Exprs";
static const char* jkPartitionPhysiPlanPartitionKeys = "PartitionKeys";
static const char* jkPartitionPhysiPlanTargets = "Targets";
@@ -4509,6 +4545,36 @@ static int32_t jsonToEventWindowNode(const SJson* pJson, void* pObj) {
return code;
}
+static const char* jkCountWindowTsPrimaryKey = "CountTsPrimaryKey";
+static const char* jkCountWindowCount = "CountWindowCount";
+static const char* jkCountWindowSliding = "CountWindowSliding";
+
+static int32_t countWindowNodeToJson(const void* pObj, SJson* pJson) {
+ const SCountWindowNode* pNode = (const SCountWindowNode*)pObj;
+
+ int32_t code = tjsonAddObject(pJson, jkCountWindowTsPrimaryKey, nodeToJson, pNode->pCol);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddIntegerToObject(pJson, jkCountWindowCount, pNode->windowCount);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddIntegerToObject(pJson, jkCountWindowSliding, pNode->windowSliding);
+ }
+ return code;
+}
+
+static int32_t jsonToCountWindowNode(const SJson* pJson, void* pObj) {
+ SCountWindowNode* pNode = (SCountWindowNode*)pObj;
+
+ int32_t code = jsonToNodeObject(pJson, jkCountWindowTsPrimaryKey, &pNode->pCol);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetBigIntValue(pJson, jkCountWindowCount, &pNode->windowCount);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetBigIntValue(pJson, jkCountWindowSliding, &pNode->windowSliding);
+ }
+ return code;
+}
+
static const char* jkIntervalWindowInterval = "Interval";
static const char* jkIntervalWindowOffset = "Offset";
static const char* jkIntervalWindowSliding = "Sliding";
@@ -7111,6 +7177,8 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
return eventWindowNodeToJson(pObj, pJson);
case QUERY_NODE_WINDOW_OFFSET:
return windowOffsetNodeToJson(pObj, pJson);
+ case QUERY_NODE_COUNT_WINDOW:
+ return countWindowNodeToJson(pObj, pJson);
case QUERY_NODE_SET_OPERATOR:
return setOperatorToJson(pObj, pJson);
case QUERY_NODE_SELECT_STMT:
@@ -7350,6 +7418,9 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
case QUERY_NODE_PHYSICAL_PLAN_MERGE_EVENT:
case QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT:
return physiEventWindowNodeToJson(pObj, pJson);
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT:
+ return physiCountWindowNodeToJson(pObj, pJson);
case QUERY_NODE_PHYSICAL_PLAN_PARTITION:
return physiPartitionNodeToJson(pObj, pJson);
case QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION:
@@ -7445,6 +7516,8 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
return jsonToEventWindowNode(pJson, pObj);
case QUERY_NODE_WINDOW_OFFSET:
return jsonToWindowOffsetNode(pJson, pObj);
+ case QUERY_NODE_COUNT_WINDOW:
+ return jsonToCountWindowNode(pJson, pObj);
case QUERY_NODE_SET_OPERATOR:
return jsonToSetOperator(pJson, pObj);
case QUERY_NODE_SELECT_STMT:
@@ -7692,6 +7765,9 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
case QUERY_NODE_PHYSICAL_PLAN_MERGE_EVENT:
case QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT:
return jsonToPhysiEventWindowNode(pJson, pObj);
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT:
+ return jsonToPhysiCountWindowNode(pJson, pObj);
case QUERY_NODE_PHYSICAL_PLAN_PARTITION:
return jsonToPhysiPartitionNode(pJson, pObj);
case QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION:
diff --git a/source/libs/nodes/src/nodesMsgFuncs.c b/source/libs/nodes/src/nodesMsgFuncs.c
index 8435ff3254..db014f67d2 100644
--- a/source/libs/nodes/src/nodesMsgFuncs.c
+++ b/source/libs/nodes/src/nodesMsgFuncs.c
@@ -3336,6 +3336,46 @@ static int32_t msgToPhysiEventWindowNode(STlvDecoder* pDecoder, void* pObj) {
return code;
}
+enum { PHY_COUNT_CODE_WINDOW = 1, PHY_COUNT_CODE_WINDOW_COUNT, PHY_COUNT_CODE_WINDOW_SLIDING };
+
+static int32_t physiCountWindowNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SCountWinodwPhysiNode* pNode = (const SCountWinodwPhysiNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_COUNT_CODE_WINDOW, physiWindowNodeToMsg, &pNode->window);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI64(pEncoder, PHY_COUNT_CODE_WINDOW_COUNT, pNode->windowCount);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeI64(pEncoder, PHY_COUNT_CODE_WINDOW_SLIDING, pNode->windowSliding);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiCountWindowNode(STlvDecoder* pDecoder, void* pObj) {
+ SCountWinodwPhysiNode* pNode = (SCountWinodwPhysiNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_COUNT_CODE_WINDOW:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysiWindowNode, &pNode->window);
+ break;
+ case PHY_COUNT_CODE_WINDOW_COUNT:
+ code = tlvDecodeI64(pTlv, &pNode->windowCount);
+ break;
+ case PHY_COUNT_CODE_WINDOW_SLIDING:
+ code = tlvDecodeI64(pTlv, &pNode->windowSliding);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
enum {
PHY_PARTITION_CODE_BASE_NODE = 1,
PHY_PARTITION_CODE_EXPR,
@@ -4329,6 +4369,10 @@ static int32_t specificNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
case QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT:
code = physiEventWindowNodeToMsg(pObj, pEncoder);
break;
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT:
+ code = physiCountWindowNodeToMsg(pObj, pEncoder);
+ break;
case QUERY_NODE_PHYSICAL_PLAN_PARTITION:
code = physiPartitionNodeToMsg(pObj, pEncoder);
break;
@@ -4487,6 +4531,10 @@ static int32_t msgToSpecificNode(STlvDecoder* pDecoder, void* pObj) {
case QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT:
code = msgToPhysiEventWindowNode(pDecoder, pObj);
break;
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT:
+ code = msgToPhysiCountWindowNode(pDecoder, pObj);
+ break;
case QUERY_NODE_PHYSICAL_PLAN_PARTITION:
code = msgToPhysiPartitionNode(pDecoder, pObj);
break;
diff --git a/source/libs/nodes/src/nodesTraverseFuncs.c b/source/libs/nodes/src/nodesTraverseFuncs.c
index b0b8e0af17..1edfa840e2 100644
--- a/source/libs/nodes/src/nodesTraverseFuncs.c
+++ b/source/libs/nodes/src/nodesTraverseFuncs.c
@@ -176,6 +176,11 @@ static EDealRes dispatchExpr(SNode* pNode, ETraversalOrder order, FNodeWalker wa
}
break;
}
+ case QUERY_NODE_COUNT_WINDOW: {
+ SCountWindowNode* pEvent = (SCountWindowNode*)pNode;
+ res = walkExpr(pEvent->pCol, order, walker, pContext);
+ break;
+ }
default:
break;
}
@@ -374,6 +379,11 @@ static EDealRes rewriteExpr(SNode** pRawNode, ETraversalOrder order, FNodeRewrit
res = rewriteExpr(&pWin->pEndOffset, order, rewriter, pContext);
}
break;
+ }
+ case QUERY_NODE_COUNT_WINDOW: {
+ SCountWindowNode* pEvent = (SCountWindowNode*)pNode;
+ res = rewriteExpr(&pEvent->pCol, order, rewriter, pContext);
+ break;
}
default:
break;
diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c
index ff4010fbe3..ce000f6eef 100644
--- a/source/libs/nodes/src/nodesUtilFuncs.c
+++ b/source/libs/nodes/src/nodesUtilFuncs.c
@@ -371,6 +371,8 @@ SNode* nodesMakeNode(ENodeType type) {
return makeNode(type, sizeof(SCaseWhenNode));
case QUERY_NODE_EVENT_WINDOW:
return makeNode(type, sizeof(SEventWindowNode));
+ case QUERY_NODE_COUNT_WINDOW:
+ return makeNode(type, sizeof(SCountWindowNode));
case QUERY_NODE_HINT:
return makeNode(type, sizeof(SHintNode));
case QUERY_NODE_VIEW:
@@ -656,6 +658,10 @@ SNode* nodesMakeNode(ENodeType type) {
return makeNode(type, sizeof(SEventWinodwPhysiNode));
case QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT:
return makeNode(type, sizeof(SStreamEventWinodwPhysiNode));
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT:
+ return makeNode(type, sizeof(SCountWinodwPhysiNode));
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT:
+ return makeNode(type, sizeof(SStreamCountWinodwPhysiNode));
case QUERY_NODE_PHYSICAL_PLAN_PARTITION:
return makeNode(type, sizeof(SPartitionPhysiNode));
case QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION:
@@ -924,6 +930,11 @@ void nodesDestroyNode(SNode* pNode) {
nodesDestroyNode(pEvent->pEndCond);
break;
}
+ case QUERY_NODE_COUNT_WINDOW: {
+ SCountWindowNode* pEvent = (SCountWindowNode*)pNode;
+ nodesDestroyNode(pEvent->pCol);
+ break;
+ }
case QUERY_NODE_HINT: {
SHintNode* pHint = (SHintNode*)pNode;
destroyHintValue(pHint->option, pHint->value);
@@ -1518,6 +1529,12 @@ void nodesDestroyNode(SNode* pNode) {
nodesDestroyNode(pPhyNode->pEndCond);
break;
}
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT:
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT: {
+ SCountWinodwPhysiNode* pPhyNode = (SCountWinodwPhysiNode*)pNode;
+ destroyWinodwPhysiNode((SWindowPhysiNode*)pPhyNode);
+ break;
+ }
case QUERY_NODE_PHYSICAL_PLAN_PARTITION: {
destroyPartitionPhysiNode((SPartitionPhysiNode*)pNode);
break;
diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h
index b0b4b3eefc..15b4c330d1 100644
--- a/source/libs/parser/inc/parAst.h
+++ b/source/libs/parser/inc/parAst.h
@@ -132,6 +132,7 @@ SNode* createOrderByExprNode(SAstCreateContext* pCxt, SNode* pExpr, EOrder order
SNode* createSessionWindowNode(SAstCreateContext* pCxt, SNode* pCol, SNode* pGap);
SNode* createStateWindowNode(SAstCreateContext* pCxt, SNode* pExpr);
SNode* createEventWindowNode(SAstCreateContext* pCxt, SNode* pStartCond, SNode* pEndCond);
+SNode* createCountWindowNode(SAstCreateContext* pCxt, const SToken* pCountToken, const SToken* pSlidingToken);
SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode* pOffset, SNode* pSliding,
SNode* pFill);
SNode* createWindowOffsetNode(SAstCreateContext* pCxt, SNode* pStartOffset, SNode* pEndOffset);
diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y
index c7d3fa593e..0ceecaa4f5 100755
--- a/source/libs/parser/inc/sql.y
+++ b/source/libs/parser/inc/sql.y
@@ -516,7 +516,7 @@ cmd ::= SHOW VNODES.
// show alive
cmd ::= SHOW db_name_cond_opt(A) ALIVE. { pCxt->pRootNode = createShowAliveStmt(pCxt, A, QUERY_NODE_SHOW_DB_ALIVE_STMT); }
cmd ::= SHOW CLUSTER ALIVE. { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); }
-cmd ::= SHOW db_name_cond_opt(A) VIEWS. { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, A, NULL, OP_TYPE_LIKE); }
+cmd ::= SHOW db_name_cond_opt(A) VIEWS like_pattern_opt(B). { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, A, B, OP_TYPE_LIKE); }
cmd ::= SHOW CREATE VIEW full_table_name(A). { pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, A); }
cmd ::= SHOW COMPACTS. { pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); }
cmd ::= SHOW COMPACT NK_INTEGER(A). { pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &A)); }
@@ -1193,6 +1193,10 @@ twindow_clause_opt(A) ::=
sliding_opt(D) fill_opt(E). { A = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C), D, E); }
twindow_clause_opt(A) ::=
EVENT_WINDOW START WITH search_condition(B) END WITH search_condition(C). { A = createEventWindowNode(pCxt, B, C); }
+twindow_clause_opt(A) ::=
+ COUNT_WINDOW NK_LP NK_INTEGER(B) NK_RP. { A = createCountWindowNode(pCxt, &B, &B); }
+twindow_clause_opt(A) ::=
+ COUNT_WINDOW NK_LP NK_INTEGER(B) NK_COMMA NK_INTEGER(C) NK_RP. { A = createCountWindowNode(pCxt, &B, &C); }
sliding_opt(A) ::= . { A = NULL; }
sliding_opt(A) ::= SLIDING NK_LP interval_sliding_duration_literal(B) NK_RP. { A = releaseRawExprNode(pCxt, B); }
diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c
index 7da36a7972..0e392ab24e 100644
--- a/source/libs/parser/src/parAstCreater.c
+++ b/source/libs/parser/src/parAstCreater.c
@@ -928,6 +928,20 @@ SNode* createEventWindowNode(SAstCreateContext* pCxt, SNode* pStartCond, SNode*
return (SNode*)pEvent;
}
+SNode* createCountWindowNode(SAstCreateContext* pCxt, const SToken* pCountToken, const SToken* pSlidingToken) {
+ CHECK_PARSER_STATUS(pCxt);
+ SCountWindowNode* pCount = (SCountWindowNode*)nodesMakeNode(QUERY_NODE_COUNT_WINDOW);
+ CHECK_OUT_OF_MEM(pCount);
+ pCount->pCol = createPrimaryKeyCol(pCxt, NULL);
+ if (NULL == pCount->pCol) {
+ nodesDestroyNode((SNode*)pCount);
+ CHECK_OUT_OF_MEM(NULL);
+ }
+ pCount->windowCount = taosStr2Int64(pCountToken->z, NULL, 10);
+ pCount->windowSliding = taosStr2Int64(pSlidingToken->z, NULL, 10);
+ return (SNode*)pCount;
+}
+
SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode* pOffset, SNode* pSliding,
SNode* pFill) {
CHECK_PARSER_STATUS(pCxt);
diff --git a/source/libs/parser/src/parInsertUtil.c b/source/libs/parser/src/parInsertUtil.c
index a1f682f4cf..8900ef8e7f 100644
--- a/source/libs/parser/src/parInsertUtil.c
+++ b/source/libs/parser/src/parInsertUtil.c
@@ -663,7 +663,7 @@ int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreate
}
char* p = (char*)data;
- // | version | total length | total rows | total columns | flag seg| block group id | column schema | each column
+ // | version | total length | total rows | blankFill | total columns | flag seg| block group id | column schema | each column
// length |
int32_t version = *(int32_t*)data;
p += sizeof(int32_t);
diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c
index 32a03cb874..b4e9b9609a 100644
--- a/source/libs/parser/src/parTokenizer.c
+++ b/source/libs/parser/src/parTokenizer.c
@@ -75,6 +75,7 @@ static SKeyword keywordTable[] = {
{"CONSUMERS", TK_CONSUMERS},
{"CONTAINS", TK_CONTAINS},
{"COUNT", TK_COUNT},
+ {"COUNT_WINDOW", TK_COUNT_WINDOW},
{"CREATE", TK_CREATE},
{"CURRENT_USER", TK_CURRENT_USER},
{"DATABASE", TK_DATABASE},
diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c
index 8791beb5f5..f026b29d04 100644
--- a/source/libs/parser/src/parTranslater.c
+++ b/source/libs/parser/src/parTranslater.c
@@ -4222,6 +4222,15 @@ static int32_t translateEventWindow(STranslateContext* pCxt, SSelectStmt* pSelec
return TSDB_CODE_SUCCESS;
}
+static int32_t translateCountWindow(STranslateContext* pCxt, SSelectStmt* pSelect) {
+ if (QUERY_NODE_TEMP_TABLE == nodeType(pSelect->pFromTable) &&
+ !isGlobalTimeLineQuery(((STempTableNode*)pSelect->pFromTable)->pSubquery)) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TIMELINE_QUERY,
+ "COUNT_WINDOW requires valid time series input");
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
static int32_t translateSpecificWindow(STranslateContext* pCxt, SSelectStmt* pSelect) {
switch (nodeType(pSelect->pWindow)) {
case QUERY_NODE_STATE_WINDOW:
@@ -4232,6 +4241,8 @@ static int32_t translateSpecificWindow(STranslateContext* pCxt, SSelectStmt* pSe
return translateIntervalWindow(pCxt, pSelect);
case QUERY_NODE_EVENT_WINDOW:
return translateEventWindow(pCxt, pSelect);
+ case QUERY_NODE_COUNT_WINDOW:
+ return translateCountWindow(pCxt, pSelect);
default:
break;
}
@@ -8007,6 +8018,53 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
"The trigger mode of non window query can only be AT_ONCE");
}
+
+ if (pSelect->pWindow != NULL && pSelect->pWindow->type == QUERY_NODE_COUNT_WINDOW) {
+ if ( (SRealTableNode*)pSelect->pFromTable && ((SRealTableNode*)pSelect->pFromTable)->pMeta
+ && TSDB_SUPER_TABLE == ((SRealTableNode*)pSelect->pFromTable)->pMeta->tableType
+ && !hasPartitionByTbname(pSelect->pPartitionByList) ) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
+ "Count window for stream on super table must patitioned by table name");
+ }
+
+ int64_t watermark = 0;
+ if (pStmt->pOptions->pWatermark) {
+ translateValue(pCxt, (SValueNode*)pStmt->pOptions->pWatermark);
+ watermark =((SValueNode*)pStmt->pOptions->pWatermark)->datum.i;
+ }
+ if (watermark <= 0) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
+ "Watermark of Count window must exceed 0.");
+ }
+
+ if (pStmt->pOptions->ignoreExpired != 1) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
+ "Ignore expired data of Count window must be 1.");
+ }
+
+ SCountWindowNode* pCountWin = (SCountWindowNode*)pSelect->pWindow;
+ if (pCountWin->windowCount <= 1) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
+ "Size of Count window must exceed 1.");
+ }
+
+ if (pCountWin->windowSliding <= 0) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
+ "Size of Count window must exceed 0.");
+ }
+
+ if (pCountWin->windowSliding > pCountWin->windowCount) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
+ "sliding value no larger than the count value.");
+ }
+
+ if (pCountWin->windowCount > INT32_MAX) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
+ "Size of Count window must less than 2147483647(INT32_MAX).");
+ }
+
+ }
+
return TSDB_CODE_SUCCESS;
}
@@ -9619,7 +9677,20 @@ static int32_t createOperatorNode(EOperatorType opType, const char* pColName, SN
}
static const char* getTbNameColName(ENodeType type) {
- return (QUERY_NODE_SHOW_STABLES_STMT == type ? "stable_name" : "table_name");
+ const char* colName;
+ switch (type)
+ {
+ case QUERY_NODE_SHOW_VIEWS_STMT:
+ colName = "view_name";
+ break;
+ case QUERY_NODE_SHOW_STABLES_STMT:
+ colName = "stable_name";
+ break;
+ default:
+ colName = "table_name";
+ break;
+ }
+ return colName;
}
static int32_t createLogicCondNode(SNode* pCond1, SNode* pCond2, SNode** pCond, ELogicConditionType logicCondType) {
diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c
index e209901043..a9c36e0996 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 524
+#define YYNOCODE 525
#define YYACTIONTYPE unsigned short int
#define ParseTOKENTYPE SToken
typedef union {
int yyinit;
ParseTOKENTYPE yy0;
- 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;
- EFillMode yy926;
- SAlterOption yy941;
- bool yy985;
- SNode* yy1000;
- int64_t yy1005;
+ SToken yy29;
+ SAlterOption yy95;
+ SNodeList* yy124;
+ EFillMode yy144;
+ STokenPair yy147;
+ EJoinType yy162;
+ EJoinSubType yy354;
+ int64_t yy459;
+ EOperatorType yy590;
+ EOrder yy638;
+ SShowTablesOption yy667;
+ int32_t yy760;
+ SDataType yy784;
+ EShowKind yy789;
+ int8_t yy803;
+ SNode* yy812;
+ bool yy887;
+ ENullOrder yy907;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
@@ -143,18 +143,18 @@ typedef union {
#define ParseCTX_FETCH
#define ParseCTX_STORE
#define YYFALLBACK 1
-#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
+#define YYNSTATE 862
+#define YYNRULE 666
+#define YYNRULE_WITH_ACTION 666
+#define YYNTOKEN 359
+#define YY_MAX_SHIFT 861
+#define YY_MIN_SHIFTREDUCE 1279
+#define YY_MAX_SHIFTREDUCE 1944
+#define YY_ERROR_ACTION 1945
+#define YY_ACCEPT_ACTION 1946
+#define YY_NO_ACTION 1947
+#define YY_MIN_REDUCE 1948
+#define YY_MAX_REDUCE 2613
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
@@ -221,855 +221,881 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
-#define YY_ACTTAB_COUNT (2950)
+#define YY_ACTTAB_COUNT (3063)
static const YYACTIONTYPE yy_action[] = {
- /* 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,
+ /* 0 */ 2276, 572, 480, 473, 573, 1991, 580, 714, 472, 573,
+ /* 10 */ 1991, 2127, 48, 46, 1866, 2584, 38, 326, 2274, 734,
+ /* 20 */ 424, 746, 1690, 41, 40, 652, 2209, 47, 45, 44,
+ /* 30 */ 43, 42, 202, 713, 208, 1775, 2034, 1688, 2585, 715,
+ /* 40 */ 650, 174, 648, 274, 273, 2396, 577, 539, 537, 2077,
+ /* 50 */ 372, 2501, 574, 680, 221, 726, 147, 2276, 729, 189,
+ /* 60 */ 1715, 2584, 41, 40, 1715, 1770, 47, 45, 44, 43,
+ /* 70 */ 42, 19, 417, 1715, 2589, 2273, 734, 2498, 1696, 2590,
+ /* 80 */ 208, 390, 2584, 2256, 2585, 715, 2414, 201, 429, 41,
+ /* 90 */ 40, 2184, 2186, 47, 45, 44, 43, 42, 2362, 2178,
+ /* 100 */ 763, 2588, 489, 2252, 858, 2585, 2587, 15, 51, 833,
+ /* 110 */ 832, 831, 830, 436, 63, 829, 828, 152, 823, 822,
+ /* 120 */ 821, 820, 819, 818, 817, 151, 811, 810, 809, 435,
+ /* 130 */ 434, 806, 805, 804, 188, 187, 803, 52, 1345, 2395,
+ /* 140 */ 1344, 704, 2433, 1777, 1778, 114, 2397, 767, 2399, 2400,
+ /* 150 */ 762, 223, 757, 1971, 242, 143, 2191, 191, 575, 2486,
+ /* 160 */ 1999, 1970, 1910, 420, 2482, 184, 2494, 725, 244, 139,
+ /* 170 */ 724, 733, 575, 1346, 1999, 2191, 2589, 2584, 747, 2138,
+ /* 180 */ 1750, 1760, 388, 209, 2584, 518, 517, 1776, 1779, 1882,
+ /* 190 */ 2189, 2533, 746, 726, 147, 713, 208, 533, 138, 2372,
+ /* 200 */ 2585, 715, 1691, 2588, 1689, 615, 2362, 2585, 2586, 1941,
+ /* 210 */ 1806, 41, 40, 2129, 2362, 47, 45, 44, 43, 42,
+ /* 220 */ 1589, 1590, 128, 2376, 1751, 127, 126, 125, 124, 123,
+ /* 230 */ 122, 121, 120, 119, 1694, 1695, 1747, 703, 1749, 1752,
+ /* 240 */ 1753, 1754, 1755, 1756, 1757, 1758, 1759, 759, 755, 1768,
+ /* 250 */ 1769, 1771, 1772, 1773, 1774, 2, 48, 46, 2589, 232,
+ /* 260 */ 714, 370, 1716, 1713, 424, 2414, 1690, 2378, 2584, 592,
+ /* 270 */ 523, 746, 2396, 542, 382, 1718, 1328, 757, 541, 1775,
+ /* 280 */ 1748, 1688, 1714, 532, 231, 761, 713, 208, 310, 277,
+ /* 290 */ 35, 2585, 715, 276, 503, 106, 543, 747, 2138, 1716,
+ /* 300 */ 1811, 371, 505, 117, 2494, 2495, 1969, 145, 2499, 1770,
+ /* 310 */ 1319, 310, 483, 2414, 663, 19, 1483, 138, 1804, 1719,
+ /* 320 */ 2131, 457, 1696, 1940, 620, 2362, 702, 763, 802, 1326,
+ /* 330 */ 1474, 792, 791, 790, 1478, 789, 1480, 1481, 788, 785,
+ /* 340 */ 189, 1489, 782, 1491, 1492, 779, 776, 773, 858, 391,
+ /* 350 */ 2588, 15, 1321, 1324, 1325, 2343, 1690, 1747, 51, 2362,
+ /* 360 */ 491, 2037, 98, 1934, 2257, 377, 2395, 112, 403, 2433,
+ /* 370 */ 654, 1688, 362, 2397, 767, 2399, 2400, 762, 760, 757,
+ /* 380 */ 748, 2451, 1805, 1870, 148, 1609, 1610, 1777, 1778, 1715,
+ /* 390 */ 2263, 2242, 2130, 530, 529, 528, 527, 522, 521, 520,
+ /* 400 */ 519, 374, 588, 726, 147, 509, 508, 507, 506, 500,
+ /* 410 */ 499, 498, 1696, 493, 492, 389, 12, 589, 1715, 484,
+ /* 420 */ 1577, 1578, 1518, 1519, 1750, 1760, 1596, 2185, 2186, 1608,
+ /* 430 */ 1611, 1776, 1779, 1718, 634, 633, 632, 308, 858, 661,
+ /* 440 */ 68, 624, 144, 628, 14, 13, 1691, 627, 1689, 461,
+ /* 450 */ 433, 432, 626, 631, 398, 397, 63, 1968, 625, 495,
+ /* 460 */ 2252, 621, 37, 422, 1799, 1800, 1801, 1802, 1803, 1807,
+ /* 470 */ 1808, 1809, 1810, 590, 2269, 1697, 463, 459, 1694, 1695,
+ /* 480 */ 1747, 199, 1749, 1752, 1753, 1754, 1755, 1756, 1757, 1758,
+ /* 490 */ 1759, 759, 755, 1768, 1769, 1771, 1772, 1773, 1774, 2,
+ /* 500 */ 12, 48, 46, 1348, 1349, 63, 2396, 2501, 225, 424,
+ /* 510 */ 2362, 1690, 728, 177, 2494, 2495, 1438, 145, 2499, 764,
+ /* 520 */ 1696, 634, 633, 632, 1775, 699, 1688, 1899, 624, 144,
+ /* 530 */ 628, 1437, 310, 2497, 627, 1720, 1691, 331, 1689, 626,
+ /* 540 */ 631, 398, 397, 63, 2396, 625, 1948, 2414, 621, 1751,
+ /* 550 */ 471, 1818, 470, 1719, 1770, 525, 2252, 729, 793, 2362,
+ /* 560 */ 19, 763, 1843, 1844, 1845, 1846, 1847, 1696, 1694, 1695,
+ /* 570 */ 137, 136, 135, 134, 133, 132, 131, 130, 129, 611,
+ /* 580 */ 610, 2396, 469, 214, 9, 2414, 696, 695, 1897, 1898,
+ /* 590 */ 1900, 1901, 1902, 858, 764, 308, 15, 2362, 544, 763,
+ /* 600 */ 2395, 2225, 2396, 2433, 230, 1748, 114, 2397, 767, 2399,
+ /* 610 */ 2400, 762, 182, 757, 303, 764, 150, 2001, 157, 2457,
+ /* 620 */ 2486, 1967, 2414, 664, 420, 2482, 705, 700, 693, 689,
+ /* 630 */ 310, 721, 1777, 1778, 2362, 175, 763, 1960, 2395, 747,
+ /* 640 */ 2138, 2433, 1700, 2414, 114, 2397, 767, 2399, 2400, 762,
+ /* 650 */ 717, 757, 747, 2138, 34, 2362, 191, 763, 2486, 212,
+ /* 660 */ 41, 40, 420, 2482, 47, 45, 44, 43, 42, 1750,
+ /* 670 */ 1760, 12, 56, 10, 2362, 2395, 1776, 1779, 2433, 310,
+ /* 680 */ 3, 115, 2397, 767, 2399, 2400, 762, 1345, 757, 1344,
+ /* 690 */ 2534, 1691, 54, 1689, 1841, 2486, 2395, 582, 2315, 2433,
+ /* 700 */ 2483, 1841, 114, 2397, 767, 2399, 2400, 762, 1426, 757,
+ /* 710 */ 111, 2191, 726, 147, 2604, 203, 2486, 310, 404, 108,
+ /* 720 */ 420, 2482, 1346, 1694, 1695, 1747, 2189, 1749, 1752, 1753,
+ /* 730 */ 1754, 1755, 1756, 1757, 1758, 1759, 759, 755, 1768, 1769,
+ /* 740 */ 1771, 1772, 1773, 1774, 2, 48, 46, 1780, 569, 1428,
+ /* 750 */ 2396, 747, 2138, 424, 619, 1690, 278, 567, 618, 260,
+ /* 760 */ 563, 559, 516, 764, 95, 2541, 515, 813, 1775, 1720,
+ /* 770 */ 1688, 477, 41, 40, 514, 183, 47, 45, 44, 43,
+ /* 780 */ 42, 392, 747, 2138, 609, 605, 601, 597, 2396, 259,
+ /* 790 */ 2133, 2414, 47, 45, 44, 43, 42, 30, 1770, 613,
+ /* 800 */ 612, 764, 478, 2362, 1785, 763, 1838, 1839, 1840, 2114,
+ /* 810 */ 1715, 1696, 2506, 1838, 1839, 1840, 2506, 2506, 2506, 2506,
+ /* 820 */ 2506, 2191, 178, 2494, 2495, 2396, 145, 2499, 414, 2414,
+ /* 830 */ 96, 2191, 815, 257, 1658, 1659, 2189, 858, 764, 816,
+ /* 840 */ 49, 2362, 2099, 763, 2395, 2396, 742, 2433, 630, 629,
+ /* 850 */ 114, 2397, 767, 2399, 2400, 762, 1863, 757, 764, 749,
+ /* 860 */ 2554, 2458, 2604, 160, 2486, 2115, 2414, 2078, 420, 2482,
+ /* 870 */ 2501, 408, 1911, 172, 747, 2138, 1777, 1778, 2362, 802,
+ /* 880 */ 763, 2141, 2395, 747, 2138, 2433, 2414, 2372, 115, 2397,
+ /* 890 */ 767, 2399, 2400, 762, 497, 757, 2496, 1891, 2362, 247,
+ /* 900 */ 763, 2380, 2486, 510, 1841, 722, 2485, 2482, 256, 249,
+ /* 910 */ 95, 2376, 1892, 1750, 1760, 254, 586, 827, 825, 2395,
+ /* 920 */ 1776, 1779, 2433, 747, 2138, 363, 2397, 767, 2399, 2400,
+ /* 930 */ 762, 751, 757, 2458, 246, 1691, 2134, 1689, 55, 2395,
+ /* 940 */ 747, 2138, 2433, 511, 2123, 114, 2397, 767, 2399, 2400,
+ /* 950 */ 762, 2191, 757, 1890, 2235, 2378, 421, 2604, 419, 2486,
+ /* 960 */ 512, 1976, 853, 420, 2482, 757, 2189, 1694, 1695, 1747,
+ /* 970 */ 1751, 1749, 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759,
+ /* 980 */ 759, 755, 1768, 1769, 1771, 1772, 1773, 1774, 2, 48,
+ /* 990 */ 46, 747, 2138, 317, 318, 2396, 487, 424, 316, 1690,
+ /* 1000 */ 227, 800, 162, 161, 797, 796, 795, 159, 764, 1442,
+ /* 1010 */ 691, 591, 1775, 2113, 1688, 2506, 1838, 1839, 1840, 2506,
+ /* 1020 */ 2506, 2506, 2506, 2506, 1441, 2396, 1748, 41, 40, 747,
+ /* 1030 */ 2138, 47, 45, 44, 43, 42, 2414, 2372, 764, 622,
+ /* 1040 */ 2577, 90, 1770, 1949, 89, 1719, 36, 2191, 2362, 2135,
+ /* 1050 */ 763, 2381, 41, 40, 428, 1696, 47, 45, 44, 43,
+ /* 1060 */ 42, 2376, 2189, 1423, 128, 1966, 2414, 127, 126, 125,
+ /* 1070 */ 124, 123, 122, 121, 120, 119, 1943, 1944, 2362, 1326,
+ /* 1080 */ 763, 858, 1715, 1965, 49, 1964, 641, 149, 2324, 2395,
+ /* 1090 */ 2457, 546, 2433, 2396, 2346, 114, 2397, 767, 2399, 2400,
+ /* 1100 */ 762, 653, 757, 1324, 1325, 2378, 764, 2604, 427, 2486,
+ /* 1110 */ 88, 664, 718, 420, 2482, 757, 169, 275, 2362, 2395,
+ /* 1120 */ 1777, 1778, 2433, 405, 2140, 114, 2397, 767, 2399, 2400,
+ /* 1130 */ 762, 2189, 757, 644, 2414, 1862, 2362, 2604, 2362, 2486,
+ /* 1140 */ 638, 636, 279, 420, 2482, 446, 2362, 272, 763, 800,
+ /* 1150 */ 162, 161, 797, 796, 795, 159, 794, 1750, 1760, 2182,
+ /* 1160 */ 747, 2138, 41, 40, 1776, 1779, 47, 45, 44, 43,
+ /* 1170 */ 42, 800, 162, 161, 797, 796, 795, 159, 2125, 1691,
+ /* 1180 */ 280, 1689, 747, 2138, 679, 666, 2315, 2395, 72, 2355,
+ /* 1190 */ 2433, 71, 2191, 179, 2397, 767, 2399, 2400, 762, 2121,
+ /* 1200 */ 757, 171, 288, 2116, 2142, 396, 395, 2190, 44, 43,
+ /* 1210 */ 42, 1694, 1695, 1747, 285, 1749, 1752, 1753, 1754, 1755,
+ /* 1220 */ 1756, 1757, 1758, 1759, 759, 755, 1768, 1769, 1771, 1772,
+ /* 1230 */ 1773, 1774, 2, 48, 46, 1963, 153, 747, 2138, 680,
+ /* 1240 */ 656, 424, 655, 1690, 747, 2138, 418, 2584, 798, 758,
+ /* 1250 */ 1962, 2182, 716, 2605, 172, 2396, 1775, 732, 1688, 747,
+ /* 1260 */ 2138, 1720, 2140, 76, 321, 2590, 208, 427, 764, 2356,
+ /* 1270 */ 2585, 715, 708, 747, 2138, 172, 2396, 394, 393, 744,
+ /* 1280 */ 617, 747, 2138, 2140, 430, 1959, 1770, 623, 2362, 764,
+ /* 1290 */ 1958, 2518, 172, 745, 747, 2138, 2414, 160, 1748, 1696,
+ /* 1300 */ 2140, 327, 619, 2362, 799, 99, 618, 2182, 2362, 340,
+ /* 1310 */ 763, 1421, 2168, 2021, 431, 87, 61, 2414, 173, 680,
+ /* 1320 */ 754, 1957, 2547, 346, 677, 858, 2019, 2584, 15, 2362,
+ /* 1330 */ 140, 763, 1956, 1955, 2396, 635, 1637, 1852, 2362, 2010,
+ /* 1340 */ 344, 74, 86, 2362, 73, 2590, 208, 764, 637, 2395,
+ /* 1350 */ 2585, 715, 2433, 1954, 373, 176, 2397, 767, 2399, 2400,
+ /* 1360 */ 762, 639, 757, 2383, 1777, 1778, 240, 554, 552, 549,
+ /* 1370 */ 2395, 1953, 1653, 2433, 2362, 2414, 114, 2397, 767, 2399,
+ /* 1380 */ 2400, 762, 2008, 757, 719, 2362, 2362, 2362, 2604, 763,
+ /* 1390 */ 2486, 1952, 14, 13, 420, 2482, 1951, 265, 289, 1381,
+ /* 1400 */ 263, 1750, 1760, 2545, 642, 160, 2362, 63, 1776, 1779,
+ /* 1410 */ 41, 40, 687, 50, 47, 45, 44, 43, 42, 182,
+ /* 1420 */ 1961, 2385, 1719, 1691, 2362, 1689, 267, 269, 2395, 266,
+ /* 1430 */ 268, 2433, 1946, 1699, 114, 2397, 767, 2399, 2400, 762,
+ /* 1440 */ 1382, 757, 100, 659, 2362, 64, 2461, 271, 2486, 2362,
+ /* 1450 */ 270, 1698, 420, 2482, 304, 1694, 1695, 1747, 697, 1749,
+ /* 1460 */ 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, 759, 755,
+ /* 1470 */ 1768, 1769, 1771, 1772, 1773, 1774, 2, 665, 296, 807,
+ /* 1480 */ 1656, 433, 432, 1796, 727, 808, 142, 1886, 1896, 50,
+ /* 1490 */ 192, 1704, 2002, 680, 84, 83, 476, 160, 730, 220,
+ /* 1500 */ 2415, 2584, 2396, 1400, 1775, 2075, 1697, 50, 315, 1398,
+ /* 1510 */ 75, 439, 468, 466, 158, 764, 438, 2074, 2261, 2590,
+ /* 1520 */ 208, 1992, 160, 369, 2585, 715, 455, 680, 2537, 452,
+ /* 1530 */ 448, 444, 441, 469, 1770, 2584, 66, 437, 50, 694,
+ /* 1540 */ 50, 410, 771, 2414, 851, 2262, 406, 1696, 680, 158,
+ /* 1550 */ 160, 701, 736, 2590, 208, 2362, 2584, 763, 2585, 715,
+ /* 1560 */ 141, 680, 1998, 2179, 1895, 294, 158, 673, 306, 2584,
+ /* 1570 */ 2538, 2548, 731, 753, 2590, 208, 709, 301, 2396, 2585,
+ /* 1580 */ 715, 310, 1606, 319, 204, 739, 710, 2590, 208, 323,
+ /* 1590 */ 309, 764, 2585, 715, 2100, 5, 2395, 1468, 445, 2433,
+ /* 1600 */ 1702, 440, 114, 2397, 767, 2399, 2400, 762, 386, 757,
+ /* 1610 */ 453, 1812, 454, 1761, 2459, 339, 2486, 1496, 1701, 2414,
+ /* 1620 */ 420, 2482, 1723, 465, 1500, 1507, 464, 215, 216, 467,
+ /* 1630 */ 218, 2362, 334, 763, 1630, 1505, 1713, 481, 1720, 1714,
+ /* 1640 */ 488, 163, 229, 490, 494, 501, 496, 535, 524, 513,
+ /* 1650 */ 2254, 526, 2396, 531, 534, 536, 547, 548, 545, 235,
+ /* 1660 */ 550, 1721, 237, 234, 551, 764, 553, 555, 570, 571,
+ /* 1670 */ 4, 1705, 2395, 1700, 578, 2433, 579, 245, 114, 2397,
+ /* 1680 */ 767, 2399, 2400, 762, 1716, 757, 2396, 581, 583, 92,
+ /* 1690 */ 750, 248, 2486, 2414, 1722, 584, 420, 2482, 1724, 764,
+ /* 1700 */ 585, 251, 593, 1708, 1710, 2362, 587, 763, 253, 1725,
+ /* 1710 */ 93, 2270, 94, 614, 258, 616, 645, 755, 1768, 1769,
+ /* 1720 */ 1771, 1772, 1773, 1774, 2128, 262, 2124, 2414, 116, 646,
+ /* 1730 */ 366, 658, 660, 97, 154, 264, 335, 165, 166, 2362,
+ /* 1740 */ 281, 763, 1717, 2126, 2122, 167, 2395, 168, 2316, 2433,
+ /* 1750 */ 668, 2333, 115, 2397, 767, 2399, 2400, 762, 2330, 757,
+ /* 1760 */ 2329, 667, 669, 675, 672, 2396, 2486, 286, 698, 737,
+ /* 1770 */ 752, 2482, 684, 8, 2525, 707, 2553, 712, 764, 711,
+ /* 1780 */ 765, 291, 293, 2433, 284, 2552, 115, 2397, 767, 2399,
+ /* 1790 */ 2400, 762, 674, 757, 2396, 295, 685, 683, 298, 181,
+ /* 1800 */ 2486, 723, 411, 682, 381, 2482, 2414, 764, 300, 1718,
+ /* 1810 */ 720, 299, 297, 146, 2505, 2607, 2502, 1860, 2362, 305,
+ /* 1820 */ 763, 2583, 1858, 2396, 195, 311, 155, 336, 735, 740,
+ /* 1830 */ 2284, 2283, 2282, 337, 416, 2414, 764, 741, 338, 156,
+ /* 1840 */ 409, 105, 2139, 302, 62, 2467, 107, 2362, 769, 763,
+ /* 1850 */ 2183, 1, 329, 210, 341, 1303, 852, 365, 164, 2395,
+ /* 1860 */ 53, 378, 2433, 855, 2414, 176, 2397, 767, 2399, 2400,
+ /* 1870 */ 762, 857, 757, 343, 379, 345, 2362, 2354, 763, 350,
+ /* 1880 */ 364, 354, 2353, 2352, 81, 2347, 442, 443, 2395, 1681,
+ /* 1890 */ 1682, 2433, 2396, 213, 363, 2397, 767, 2399, 2400, 762,
+ /* 1900 */ 447, 757, 2345, 449, 450, 764, 451, 1680, 2344, 2342,
+ /* 1910 */ 387, 456, 681, 2544, 2341, 458, 2340, 2395, 2396, 460,
+ /* 1920 */ 2433, 2339, 2320, 356, 2397, 767, 2399, 2400, 762, 462,
+ /* 1930 */ 757, 764, 1669, 2414, 217, 2319, 219, 1633, 82, 2297,
+ /* 1940 */ 1632, 2296, 2295, 474, 475, 2362, 2294, 763, 2293, 2244,
+ /* 1950 */ 479, 2241, 1576, 2240, 482, 2234, 485, 486, 2231, 2414,
+ /* 1960 */ 222, 2230, 2229, 85, 415, 2228, 2233, 2232, 2227, 224,
+ /* 1970 */ 2226, 2362, 2224, 763, 706, 2223, 2222, 226, 2221, 504,
+ /* 1980 */ 502, 2219, 2218, 2217, 2216, 2239, 2395, 2215, 2214, 2433,
+ /* 1990 */ 2213, 2237, 179, 2397, 767, 2399, 2400, 762, 2220, 757,
+ /* 2000 */ 2212, 2211, 2210, 2208, 2207, 2206, 2205, 2204, 2203, 2202,
+ /* 2010 */ 2201, 2200, 2395, 228, 91, 2433, 2199, 2238, 363, 2397,
+ /* 2020 */ 767, 2399, 2400, 762, 2236, 757, 2198, 2197, 2396, 233,
+ /* 2030 */ 2195, 538, 2194, 540, 1582, 2196, 2193, 2192, 2040, 375,
+ /* 2040 */ 1439, 761, 1443, 376, 2396, 236, 2039, 2038, 2036, 2033,
+ /* 2050 */ 1435, 238, 2606, 2032, 2025, 2012, 556, 764, 1987, 2396,
+ /* 2060 */ 239, 1986, 560, 558, 562, 557, 561, 2318, 564, 2414,
+ /* 2070 */ 566, 568, 764, 1327, 565, 190, 2314, 2304, 241, 2292,
+ /* 2080 */ 2291, 2362, 78, 763, 243, 2414, 252, 2268, 2382, 2117,
+ /* 2090 */ 423, 2035, 200, 576, 79, 2031, 2029, 2362, 250, 763,
+ /* 2100 */ 2414, 594, 2396, 598, 596, 425, 255, 2027, 602, 2024,
+ /* 2110 */ 600, 595, 2362, 2007, 763, 764, 599, 604, 606, 2005,
+ /* 2120 */ 603, 607, 2395, 1374, 662, 2433, 608, 2006, 362, 2397,
+ /* 2130 */ 767, 2399, 2400, 762, 2004, 757, 1983, 2452, 2395, 2119,
+ /* 2140 */ 1511, 2433, 861, 2414, 363, 2397, 767, 2399, 2400, 762,
+ /* 2150 */ 2118, 757, 1512, 2395, 1425, 2362, 2433, 763, 333, 363,
+ /* 2160 */ 2397, 767, 2399, 2400, 762, 65, 757, 1424, 1422, 2396,
+ /* 2170 */ 1420, 1411, 1419, 2022, 198, 1418, 261, 1417, 1416, 824,
+ /* 2180 */ 826, 1413, 764, 849, 845, 841, 837, 399, 330, 1412,
+ /* 2190 */ 1410, 2020, 400, 2011, 401, 640, 657, 2009, 2396, 2433,
+ /* 2200 */ 402, 643, 358, 2397, 767, 2399, 2400, 762, 1982, 757,
+ /* 2210 */ 2414, 764, 1981, 1980, 647, 1979, 649, 1978, 651, 118,
+ /* 2220 */ 1667, 1663, 2362, 1665, 763, 1662, 2317, 2396, 29, 113,
+ /* 2230 */ 283, 69, 324, 2313, 2303, 1639, 1641, 2290, 670, 2414,
+ /* 2240 */ 764, 2289, 2589, 20, 31, 17, 686, 1853, 407, 205,
+ /* 2250 */ 290, 2362, 688, 763, 57, 58, 1913, 6, 692, 1887,
+ /* 2260 */ 671, 690, 292, 2395, 743, 1618, 2433, 1617, 2414, 348,
+ /* 2270 */ 2397, 767, 2399, 2400, 762, 287, 757, 676, 7, 21,
+ /* 2280 */ 2362, 678, 763, 1643, 22, 194, 33, 170, 1894, 180,
+ /* 2290 */ 206, 2383, 2395, 1881, 193, 2433, 2396, 32, 347, 2397,
+ /* 2300 */ 767, 2399, 2400, 762, 1855, 757, 67, 313, 80, 764,
+ /* 2310 */ 1851, 207, 24, 1933, 312, 1928, 2288, 1927, 412, 1932,
+ /* 2320 */ 1931, 2395, 2396, 413, 2433, 307, 1934, 349, 2397, 767,
+ /* 2330 */ 2399, 2400, 762, 282, 757, 764, 185, 2414, 1835, 1834,
+ /* 2340 */ 60, 2267, 101, 102, 314, 25, 2266, 738, 103, 2362,
+ /* 2350 */ 196, 763, 1889, 325, 320, 70, 104, 26, 322, 1787,
+ /* 2360 */ 1786, 108, 11, 2414, 59, 13, 1706, 2436, 186, 1765,
+ /* 2370 */ 756, 39, 23, 1763, 1762, 2362, 197, 763, 16, 18,
+ /* 2380 */ 27, 1740, 1732, 1497, 28, 768, 770, 426, 774, 328,
+ /* 2390 */ 2395, 2396, 1797, 2433, 766, 772, 355, 2397, 767, 2399,
+ /* 2400 */ 2400, 762, 1494, 757, 764, 775, 777, 2396, 1493, 778,
+ /* 2410 */ 780, 783, 786, 1490, 1506, 781, 2395, 1484, 784, 2433,
+ /* 2420 */ 764, 1482, 359, 2397, 767, 2399, 2400, 762, 787, 757,
+ /* 2430 */ 109, 1502, 2414, 110, 1372, 77, 801, 1407, 1488, 1404,
+ /* 2440 */ 1487, 1403, 1486, 1485, 2362, 1402, 763, 1401, 2414, 1399,
+ /* 2450 */ 1397, 1396, 1395, 211, 1433, 812, 1432, 1390, 814, 1393,
+ /* 2460 */ 2362, 1392, 763, 1391, 1389, 2396, 1388, 1387, 1429, 1427,
+ /* 2470 */ 1384, 1383, 1378, 1380, 1379, 1377, 2030, 834, 764, 835,
+ /* 2480 */ 2028, 836, 839, 838, 840, 2395, 2026, 2396, 2433, 842,
+ /* 2490 */ 2023, 351, 2397, 767, 2399, 2400, 762, 844, 757, 843,
+ /* 2500 */ 764, 2395, 846, 848, 2433, 847, 2414, 360, 2397, 767,
+ /* 2510 */ 2399, 2400, 762, 2003, 757, 850, 1977, 1304, 2362, 1316,
+ /* 2520 */ 763, 854, 2396, 332, 856, 1947, 1692, 342, 2414, 859,
+ /* 2530 */ 860, 1947, 1947, 1947, 1947, 764, 1947, 1947, 1947, 1947,
+ /* 2540 */ 2362, 1947, 763, 1947, 1947, 2396, 1947, 1947, 1947, 1947,
+ /* 2550 */ 1947, 1947, 1947, 1947, 1947, 1947, 1947, 1947, 764, 2395,
+ /* 2560 */ 1947, 1947, 2433, 2414, 1947, 352, 2397, 767, 2399, 2400,
+ /* 2570 */ 762, 1947, 757, 1947, 1947, 2362, 1947, 763, 1947, 1947,
+ /* 2580 */ 1947, 2395, 1947, 1947, 2433, 1947, 2414, 361, 2397, 767,
+ /* 2590 */ 2399, 2400, 762, 1947, 757, 1947, 1947, 1947, 2362, 1947,
+ /* 2600 */ 763, 1947, 2396, 1947, 1947, 1947, 1947, 1947, 1947, 1947,
+ /* 2610 */ 1947, 1947, 1947, 1947, 1947, 764, 2395, 1947, 1947, 2433,
+ /* 2620 */ 1947, 1947, 353, 2397, 767, 2399, 2400, 762, 1947, 757,
+ /* 2630 */ 1947, 2396, 1947, 1947, 1947, 1947, 1947, 1947, 1947, 2395,
+ /* 2640 */ 1947, 1947, 2433, 2414, 764, 367, 2397, 767, 2399, 2400,
+ /* 2650 */ 762, 1947, 757, 1947, 1947, 2362, 1947, 763, 1947, 1947,
+ /* 2660 */ 1947, 1947, 1947, 1947, 1947, 1947, 1947, 1947, 1947, 1947,
+ /* 2670 */ 1947, 1947, 2414, 1947, 1947, 1947, 1947, 1947, 1947, 1947,
+ /* 2680 */ 1947, 1947, 1947, 1947, 2362, 1947, 763, 1947, 1947, 1947,
+ /* 2690 */ 1947, 1947, 1947, 1947, 1947, 1947, 2395, 1947, 2396, 2433,
+ /* 2700 */ 1947, 1947, 368, 2397, 767, 2399, 2400, 762, 1947, 757,
+ /* 2710 */ 1947, 764, 1947, 1947, 2396, 1947, 1947, 1947, 1947, 1947,
+ /* 2720 */ 1947, 1947, 1947, 1947, 1947, 2395, 1947, 764, 2433, 1947,
+ /* 2730 */ 1947, 2408, 2397, 767, 2399, 2400, 762, 1947, 757, 2414,
+ /* 2740 */ 1947, 1947, 1947, 1947, 1947, 1947, 1947, 1947, 1947, 1947,
+ /* 2750 */ 1947, 2362, 1947, 763, 1947, 2414, 1947, 1947, 1947, 1947,
+ /* 2760 */ 1947, 1947, 1947, 1947, 1947, 1947, 1947, 2362, 1947, 763,
+ /* 2770 */ 1947, 1947, 1947, 1947, 1947, 1947, 1947, 1947, 1947, 1947,
+ /* 2780 */ 1947, 1947, 1947, 2396, 1947, 1947, 1947, 1947, 1947, 1947,
+ /* 2790 */ 1947, 1947, 2395, 1947, 1947, 2433, 764, 1947, 2407, 2397,
+ /* 2800 */ 767, 2399, 2400, 762, 1947, 757, 1947, 2396, 2395, 1947,
+ /* 2810 */ 1947, 2433, 1947, 1947, 2406, 2397, 767, 2399, 2400, 762,
+ /* 2820 */ 764, 757, 1947, 1947, 2414, 1947, 1947, 1947, 1947, 1947,
+ /* 2830 */ 1947, 1947, 1947, 1947, 1947, 1947, 2362, 1947, 763, 1947,
+ /* 2840 */ 1947, 2396, 1947, 1947, 1947, 1947, 1947, 1947, 2414, 1947,
+ /* 2850 */ 1947, 1947, 1947, 1947, 764, 1947, 1947, 1947, 1947, 1947,
+ /* 2860 */ 2362, 1947, 763, 1947, 1947, 1947, 1947, 1947, 1947, 1947,
+ /* 2870 */ 1947, 1947, 1947, 1947, 1947, 1947, 1947, 2395, 1947, 1947,
+ /* 2880 */ 2433, 1947, 2414, 383, 2397, 767, 2399, 2400, 762, 1947,
+ /* 2890 */ 757, 1947, 1947, 1947, 2362, 1947, 763, 1947, 1947, 1947,
+ /* 2900 */ 1947, 2395, 1947, 1947, 2433, 1947, 1947, 384, 2397, 767,
+ /* 2910 */ 2399, 2400, 762, 1947, 757, 1947, 1947, 1947, 1947, 1947,
+ /* 2920 */ 1947, 2396, 1947, 1947, 1947, 1947, 1947, 1947, 1947, 1947,
+ /* 2930 */ 1947, 1947, 1947, 1947, 764, 2395, 1947, 1947, 2433, 1947,
+ /* 2940 */ 2396, 380, 2397, 767, 2399, 2400, 762, 1947, 757, 1947,
+ /* 2950 */ 1947, 1947, 1947, 764, 1947, 2396, 1947, 1947, 1947, 1947,
+ /* 2960 */ 1947, 1947, 2414, 1947, 1947, 1947, 1947, 1947, 764, 1947,
+ /* 2970 */ 1947, 1947, 1947, 1947, 2362, 1947, 763, 1947, 1947, 1947,
+ /* 2980 */ 1947, 2414, 1947, 1947, 1947, 1947, 1947, 1947, 1947, 1947,
+ /* 2990 */ 1947, 1947, 1947, 2362, 1947, 763, 2414, 1947, 1947, 1947,
+ /* 3000 */ 1947, 1947, 1947, 1947, 1947, 1947, 1947, 1947, 2362, 1947,
+ /* 3010 */ 763, 1947, 1947, 1947, 1947, 2395, 1947, 1947, 2433, 1947,
+ /* 3020 */ 1947, 385, 2397, 767, 2399, 2400, 762, 1947, 757, 1947,
+ /* 3030 */ 1947, 1947, 1947, 1947, 765, 1947, 1947, 2433, 1947, 1947,
+ /* 3040 */ 358, 2397, 767, 2399, 2400, 762, 1947, 757, 1947, 2395,
+ /* 3050 */ 1947, 1947, 2433, 1947, 1947, 357, 2397, 767, 2399, 2400,
+ /* 3060 */ 762, 1947, 757,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 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,
+ /* 0 */ 417, 369, 374, 438, 372, 373, 369, 488, 443, 372,
+ /* 10 */ 373, 404, 12, 13, 14, 496, 477, 478, 435, 436,
+ /* 20 */ 20, 20, 22, 8, 9, 21, 0, 12, 13, 14,
+ /* 30 */ 15, 16, 444, 514, 515, 35, 0, 37, 519, 520,
+ /* 40 */ 36, 384, 38, 39, 40, 362, 14, 419, 420, 392,
+ /* 50 */ 422, 461, 20, 488, 426, 374, 375, 417, 375, 403,
+ /* 60 */ 20, 496, 8, 9, 20, 65, 12, 13, 14, 15,
+ /* 70 */ 16, 71, 432, 20, 488, 435, 436, 487, 78, 514,
+ /* 80 */ 515, 425, 496, 427, 519, 520, 403, 402, 413, 8,
+ /* 90 */ 9, 416, 417, 12, 13, 14, 15, 16, 415, 414,
+ /* 100 */ 417, 515, 374, 375, 104, 519, 520, 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, 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,
+ /* 130 */ 94, 95, 96, 97, 98, 99, 100, 107, 20, 456,
+ /* 140 */ 22, 20, 459, 143, 144, 462, 463, 464, 465, 466,
+ /* 150 */ 467, 423, 469, 362, 370, 37, 403, 474, 374, 476,
+ /* 160 */ 376, 362, 108, 480, 481, 484, 485, 486, 370, 488,
+ /* 170 */ 489, 418, 374, 55, 376, 403, 488, 496, 374, 375,
+ /* 180 */ 180, 181, 410, 500, 496, 159, 160, 187, 188, 108,
+ /* 190 */ 418, 508, 20, 374, 375, 514, 515, 87, 394, 391,
+ /* 200 */ 519, 520, 202, 515, 204, 401, 415, 519, 520, 194,
+ /* 210 */ 179, 8, 9, 405, 415, 12, 13, 14, 15, 16,
+ /* 220 */ 180, 181, 21, 415, 180, 24, 25, 26, 27, 28,
+ /* 230 */ 29, 30, 31, 32, 234, 235, 236, 375, 238, 239,
/* 240 */ 240, 241, 242, 243, 244, 245, 246, 247, 248, 249,
- /* 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,
+ /* 250 */ 250, 251, 252, 253, 254, 255, 12, 13, 3, 149,
+ /* 260 */ 488, 18, 20, 20, 20, 403, 22, 459, 496, 70,
+ /* 270 */ 27, 20, 362, 30, 71, 20, 14, 469, 35, 35,
+ /* 280 */ 236, 37, 20, 173, 174, 375, 514, 515, 281, 138,
+ /* 290 */ 259, 519, 520, 142, 51, 381, 53, 374, 375, 20,
+ /* 300 */ 269, 58, 59, 484, 485, 486, 362, 488, 489, 65,
+ /* 310 */ 4, 281, 69, 403, 20, 71, 104, 394, 115, 20,
+ /* 320 */ 406, 69, 78, 308, 401, 415, 464, 417, 70, 23,
/* 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,
+ /* 340 */ 403, 129, 130, 131, 132, 133, 134, 135, 104, 106,
+ /* 350 */ 3, 107, 46, 47, 48, 0, 22, 236, 107, 415,
+ /* 360 */ 117, 0, 211, 108, 427, 214, 456, 381, 217, 459,
+ /* 370 */ 219, 37, 462, 463, 464, 465, 466, 467, 468, 469,
+ /* 380 */ 470, 471, 179, 14, 398, 143, 144, 143, 144, 20,
+ /* 390 */ 147, 148, 406, 150, 151, 152, 153, 154, 155, 156,
+ /* 400 */ 157, 158, 20, 374, 375, 162, 163, 164, 165, 166,
+ /* 410 */ 167, 168, 78, 170, 171, 172, 256, 374, 20, 176,
+ /* 420 */ 177, 178, 143, 144, 180, 181, 183, 416, 417, 187,
+ /* 430 */ 188, 187, 188, 20, 73, 74, 75, 182, 104, 117,
+ /* 440 */ 4, 80, 81, 82, 1, 2, 202, 86, 204, 197,
+ /* 450 */ 12, 13, 91, 92, 93, 94, 107, 362, 97, 374,
+ /* 460 */ 375, 100, 259, 260, 261, 262, 263, 264, 265, 266,
+ /* 470 */ 267, 268, 269, 430, 431, 37, 224, 225, 234, 235,
+ /* 480 */ 236, 182, 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,
+ /* 500 */ 256, 12, 13, 56, 57, 107, 362, 461, 423, 20,
+ /* 510 */ 415, 22, 483, 484, 485, 486, 22, 488, 489, 375,
+ /* 520 */ 78, 73, 74, 75, 35, 186, 37, 234, 80, 81,
+ /* 530 */ 82, 37, 281, 487, 86, 236, 202, 34, 204, 91,
+ /* 540 */ 92, 93, 94, 107, 362, 97, 0, 403, 100, 180,
+ /* 550 */ 201, 108, 203, 20, 65, 374, 375, 375, 117, 415,
+ /* 560 */ 71, 417, 274, 275, 276, 277, 278, 78, 234, 235,
+ /* 570 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 379,
+ /* 580 */ 380, 362, 233, 228, 42, 403, 293, 294, 295, 296,
+ /* 590 */ 297, 298, 299, 104, 375, 182, 107, 415, 104, 417,
+ /* 600 */ 456, 0, 362, 459, 423, 236, 462, 463, 464, 465,
+ /* 610 */ 466, 467, 490, 469, 492, 375, 472, 377, 474, 475,
+ /* 620 */ 476, 362, 403, 374, 480, 481, 287, 288, 289, 290,
+ /* 630 */ 281, 33, 143, 144, 415, 361, 417, 363, 456, 374,
+ /* 640 */ 375, 459, 204, 403, 462, 463, 464, 465, 466, 467,
+ /* 650 */ 303, 469, 374, 375, 2, 415, 474, 417, 476, 394,
+ /* 660 */ 8, 9, 480, 481, 12, 13, 14, 15, 16, 180,
+ /* 670 */ 181, 256, 394, 258, 415, 456, 187, 188, 459, 281,
+ /* 680 */ 33, 462, 463, 464, 465, 466, 467, 20, 469, 22,
+ /* 690 */ 508, 202, 45, 204, 159, 476, 456, 448, 449, 459,
+ /* 700 */ 481, 159, 462, 463, 464, 465, 466, 467, 37, 469,
+ /* 710 */ 107, 403, 374, 375, 474, 182, 476, 281, 410, 116,
+ /* 720 */ 480, 481, 55, 234, 235, 236, 418, 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,
+ /* 740 */ 251, 252, 253, 254, 255, 12, 13, 14, 51, 78,
+ /* 750 */ 362, 374, 375, 20, 136, 22, 137, 60, 140, 35,
+ /* 760 */ 63, 64, 161, 375, 383, 377, 165, 13, 35, 236,
+ /* 770 */ 37, 394, 8, 9, 173, 51, 12, 13, 14, 15,
+ /* 780 */ 16, 400, 374, 375, 60, 61, 62, 63, 362, 65,
+ /* 790 */ 409, 403, 12, 13, 14, 15, 16, 33, 65, 379,
+ /* 800 */ 380, 375, 394, 415, 14, 417, 271, 272, 273, 0,
+ /* 810 */ 20, 78, 270, 271, 272, 273, 274, 275, 276, 277,
+ /* 820 */ 278, 403, 484, 485, 486, 362, 488, 489, 410, 403,
+ /* 830 */ 106, 403, 78, 109, 215, 216, 418, 104, 375, 390,
+ /* 840 */ 107, 415, 393, 417, 456, 362, 418, 459, 388, 389,
+ /* 850 */ 462, 463, 464, 465, 466, 467, 4, 469, 375, 473,
+ /* 860 */ 377, 475, 474, 33, 476, 0, 403, 392, 480, 481,
+ /* 870 */ 461, 408, 108, 403, 374, 375, 143, 144, 415, 70,
+ /* 880 */ 417, 411, 456, 374, 375, 459, 403, 391, 462, 463,
+ /* 890 */ 464, 465, 466, 467, 394, 469, 487, 22, 415, 175,
+ /* 900 */ 417, 405, 476, 394, 159, 307, 480, 481, 184, 185,
+ /* 910 */ 383, 415, 37, 180, 181, 191, 192, 388, 389, 456,
+ /* 920 */ 187, 188, 459, 374, 375, 462, 463, 464, 465, 466,
+ /* 930 */ 467, 473, 469, 475, 210, 202, 409, 204, 108, 456,
+ /* 940 */ 374, 375, 459, 394, 404, 462, 463, 464, 465, 466,
+ /* 950 */ 467, 403, 469, 78, 0, 459, 460, 474, 410, 476,
+ /* 960 */ 394, 365, 366, 480, 481, 469, 418, 234, 235, 236,
+ /* 970 */ 180, 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,
+ /* 990 */ 13, 374, 375, 137, 138, 362, 42, 20, 142, 22,
+ /* 1000 */ 65, 136, 137, 138, 139, 140, 141, 142, 375, 22,
+ /* 1010 */ 377, 394, 35, 0, 37, 270, 271, 272, 273, 274,
+ /* 1020 */ 275, 276, 277, 278, 37, 362, 236, 8, 9, 374,
+ /* 1030 */ 375, 12, 13, 14, 15, 16, 403, 391, 375, 13,
+ /* 1040 */ 377, 106, 65, 0, 109, 20, 2, 403, 415, 394,
+ /* 1050 */ 417, 405, 8, 9, 410, 78, 12, 13, 14, 15,
+ /* 1060 */ 16, 415, 418, 37, 21, 362, 403, 24, 25, 26,
+ /* 1070 */ 27, 28, 29, 30, 31, 32, 143, 144, 415, 23,
+ /* 1080 */ 417, 104, 20, 362, 107, 362, 4, 472, 399, 456,
+ /* 1090 */ 475, 104, 459, 362, 0, 462, 463, 464, 465, 466,
+ /* 1100 */ 467, 19, 469, 47, 48, 459, 375, 474, 395, 476,
+ /* 1110 */ 175, 374, 33, 480, 481, 469, 403, 35, 415, 456,
+ /* 1120 */ 143, 144, 459, 410, 411, 462, 463, 464, 465, 466,
+ /* 1130 */ 467, 418, 469, 51, 403, 283, 415, 474, 415, 476,
+ /* 1140 */ 58, 59, 453, 480, 481, 51, 415, 65, 417, 136,
+ /* 1150 */ 137, 138, 139, 140, 141, 142, 412, 180, 181, 415,
+ /* 1160 */ 374, 375, 8, 9, 187, 188, 12, 13, 14, 15,
+ /* 1170 */ 16, 136, 137, 138, 139, 140, 141, 142, 404, 202,
+ /* 1180 */ 394, 204, 374, 375, 50, 448, 449, 456, 106, 438,
+ /* 1190 */ 459, 109, 403, 462, 463, 464, 465, 466, 467, 404,
+ /* 1200 */ 469, 182, 394, 0, 404, 39, 40, 418, 14, 15,
+ /* 1210 */ 16, 234, 235, 236, 404, 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,
+ /* 1230 */ 253, 254, 255, 12, 13, 362, 33, 374, 375, 488,
+ /* 1240 */ 218, 20, 220, 22, 374, 375, 395, 496, 412, 404,
+ /* 1250 */ 362, 415, 521, 522, 403, 362, 35, 394, 37, 374,
+ /* 1260 */ 375, 236, 411, 117, 394, 514, 515, 395, 375, 438,
+ /* 1270 */ 519, 520, 13, 374, 375, 403, 362, 111, 112, 394,
+ /* 1280 */ 114, 374, 375, 411, 395, 362, 65, 13, 415, 375,
+ /* 1290 */ 362, 377, 403, 394, 374, 375, 403, 33, 236, 78,
+ /* 1300 */ 411, 394, 136, 415, 412, 175, 140, 415, 415, 396,
+ /* 1310 */ 417, 37, 399, 0, 394, 169, 182, 403, 18, 488,
+ /* 1320 */ 71, 362, 428, 23, 190, 104, 0, 496, 107, 415,
+ /* 1330 */ 33, 417, 362, 362, 362, 22, 206, 78, 415, 0,
+ /* 1340 */ 40, 41, 45, 415, 44, 514, 515, 375, 22, 456,
+ /* 1350 */ 519, 520, 459, 362, 54, 462, 463, 464, 465, 466,
+ /* 1360 */ 467, 22, 469, 49, 143, 144, 66, 67, 68, 69,
+ /* 1370 */ 456, 362, 108, 459, 415, 403, 462, 463, 464, 465,
+ /* 1380 */ 466, 467, 0, 469, 305, 415, 415, 415, 474, 417,
+ /* 1390 */ 476, 362, 1, 2, 480, 481, 362, 110, 65, 37,
+ /* 1400 */ 113, 180, 181, 510, 22, 33, 415, 107, 187, 188,
+ /* 1410 */ 8, 9, 33, 33, 12, 13, 14, 15, 16, 490,
+ /* 1420 */ 363, 107, 20, 202, 415, 204, 110, 110, 456, 113,
+ /* 1430 */ 113, 459, 359, 37, 462, 463, 464, 465, 466, 467,
+ /* 1440 */ 78, 469, 109, 438, 415, 145, 474, 110, 476, 415,
+ /* 1450 */ 113, 37, 480, 481, 523, 234, 235, 236, 512, 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,
+ /* 1470 */ 249, 250, 251, 252, 253, 254, 255, 438, 505, 13,
+ /* 1480 */ 108, 12, 13, 234, 491, 13, 378, 108, 108, 33,
+ /* 1490 */ 33, 22, 0, 488, 194, 195, 196, 33, 438, 199,
+ /* 1500 */ 403, 496, 362, 37, 35, 391, 37, 33, 33, 37,
+ /* 1510 */ 33, 438, 212, 213, 33, 375, 443, 391, 428, 514,
+ /* 1520 */ 515, 373, 33, 223, 519, 520, 226, 488, 428, 229,
+ /* 1530 */ 230, 231, 232, 233, 65, 496, 33, 378, 33, 511,
+ /* 1540 */ 33, 511, 33, 403, 52, 428, 437, 78, 488, 33,
+ /* 1550 */ 33, 511, 511, 514, 515, 415, 496, 417, 519, 520,
+ /* 1560 */ 33, 488, 375, 414, 108, 108, 33, 445, 516, 496,
+ /* 1570 */ 428, 428, 108, 104, 514, 515, 495, 482, 362, 519,
+ /* 1580 */ 520, 281, 108, 108, 182, 108, 495, 514, 515, 108,
+ /* 1590 */ 498, 375, 519, 520, 393, 284, 456, 108, 51, 459,
+ /* 1600 */ 204, 439, 462, 463, 464, 465, 466, 467, 458, 469,
+ /* 1610 */ 42, 108, 457, 108, 474, 108, 476, 108, 204, 403,
+ /* 1620 */ 480, 481, 20, 450, 108, 108, 217, 455, 383, 450,
+ /* 1630 */ 383, 415, 441, 417, 200, 108, 20, 374, 236, 20,
+ /* 1640 */ 375, 108, 45, 424, 375, 421, 424, 179, 375, 374,
+ /* 1650 */ 374, 424, 362, 421, 421, 421, 105, 387, 103, 374,
+ /* 1660 */ 102, 20, 374, 386, 385, 375, 374, 374, 367, 371,
+ /* 1670 */ 50, 202, 456, 204, 367, 459, 371, 383, 462, 463,
+ /* 1680 */ 464, 465, 466, 467, 20, 469, 362, 450, 417, 383,
+ /* 1690 */ 474, 383, 476, 403, 20, 376, 480, 481, 20, 375,
+ /* 1700 */ 440, 383, 374, 234, 235, 415, 376, 417, 383, 20,
+ /* 1710 */ 383, 431, 383, 367, 383, 403, 365, 248, 249, 250,
+ /* 1720 */ 251, 252, 253, 254, 403, 403, 403, 403, 374, 365,
+ /* 1730 */ 367, 221, 454, 107, 452, 403, 450, 403, 403, 415,
+ /* 1740 */ 381, 417, 20, 403, 403, 403, 456, 403, 449, 459,
+ /* 1750 */ 208, 415, 462, 463, 464, 465, 466, 467, 415, 469,
+ /* 1760 */ 415, 207, 447, 374, 417, 362, 476, 381, 292, 291,
+ /* 1770 */ 480, 481, 415, 300, 507, 193, 504, 280, 375, 279,
+ /* 1780 */ 456, 433, 433, 459, 446, 504, 462, 463, 464, 465,
+ /* 1790 */ 466, 467, 439, 469, 362, 506, 302, 301, 502, 504,
+ /* 1800 */ 476, 306, 309, 285, 480, 481, 403, 375, 439, 20,
+ /* 1810 */ 304, 501, 503, 375, 494, 524, 461, 117, 415, 517,
+ /* 1820 */ 417, 518, 282, 362, 376, 381, 381, 433, 415, 185,
+ /* 1830 */ 415, 415, 415, 433, 415, 403, 375, 429, 399, 381,
+ /* 1840 */ 408, 381, 375, 493, 107, 479, 107, 415, 407, 417,
+ /* 1850 */ 415, 499, 381, 497, 374, 22, 38, 451, 368, 456,
+ /* 1860 */ 442, 434, 459, 364, 403, 462, 463, 464, 465, 466,
+ /* 1870 */ 467, 367, 469, 382, 434, 360, 415, 0, 417, 397,
+ /* 1880 */ 397, 397, 0, 0, 45, 0, 37, 227, 456, 37,
+ /* 1890 */ 37, 459, 362, 37, 462, 463, 464, 465, 466, 467,
+ /* 1900 */ 227, 469, 0, 37, 37, 375, 227, 37, 0, 0,
+ /* 1910 */ 227, 37, 509, 510, 0, 37, 0, 456, 362, 22,
+ /* 1920 */ 459, 0, 0, 462, 463, 464, 465, 466, 467, 37,
+ /* 1930 */ 469, 375, 222, 403, 210, 0, 210, 204, 211, 0,
+ /* 1940 */ 202, 0, 0, 198, 197, 415, 0, 417, 0, 148,
+ /* 1950 */ 49, 0, 49, 0, 37, 0, 37, 51, 0, 403,
+ /* 1960 */ 49, 0, 0, 45, 408, 0, 0, 0, 0, 49,
+ /* 1970 */ 0, 415, 0, 417, 513, 0, 0, 165, 0, 165,
+ /* 1980 */ 37, 0, 0, 0, 0, 0, 456, 0, 0, 459,
+ /* 1990 */ 0, 0, 462, 463, 464, 465, 466, 467, 0, 469,
+ /* 2000 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 2010 */ 0, 0, 456, 49, 45, 459, 0, 0, 462, 463,
+ /* 2020 */ 464, 465, 466, 467, 0, 469, 0, 0, 362, 148,
+ /* 2030 */ 0, 147, 0, 146, 22, 0, 0, 0, 0, 50,
+ /* 2040 */ 22, 375, 22, 50, 362, 65, 0, 0, 0, 0,
+ /* 2050 */ 37, 65, 522, 0, 0, 0, 37, 375, 0, 362,
+ /* 2060 */ 65, 0, 37, 42, 42, 51, 51, 0, 37, 403,
+ /* 2070 */ 42, 37, 375, 14, 51, 33, 0, 0, 45, 0,
+ /* 2080 */ 0, 415, 42, 417, 43, 403, 193, 0, 49, 0,
+ /* 2090 */ 408, 0, 49, 49, 42, 0, 0, 415, 42, 417,
+ /* 2100 */ 403, 37, 362, 37, 42, 408, 49, 0, 37, 0,
+ /* 2110 */ 42, 51, 415, 0, 417, 375, 51, 42, 37, 0,
+ /* 2120 */ 51, 51, 456, 72, 1, 459, 42, 0, 462, 463,
+ /* 2130 */ 464, 465, 466, 467, 0, 469, 0, 471, 456, 0,
+ /* 2140 */ 22, 459, 19, 403, 462, 463, 464, 465, 466, 467,
+ /* 2150 */ 0, 469, 37, 456, 37, 415, 459, 417, 35, 462,
+ /* 2160 */ 463, 464, 465, 466, 467, 115, 469, 37, 37, 362,
+ /* 2170 */ 37, 22, 37, 0, 51, 37, 113, 37, 37, 33,
+ /* 2180 */ 33, 37, 375, 60, 61, 62, 63, 22, 65, 37,
+ /* 2190 */ 37, 0, 22, 0, 22, 53, 456, 0, 362, 459,
+ /* 2200 */ 22, 37, 462, 463, 464, 465, 466, 467, 0, 469,
+ /* 2210 */ 403, 375, 0, 0, 37, 0, 37, 0, 22, 20,
+ /* 2220 */ 108, 37, 415, 37, 417, 37, 0, 362, 107, 106,
+ /* 2230 */ 49, 107, 109, 0, 0, 37, 22, 0, 22, 403,
+ /* 2240 */ 375, 0, 3, 33, 107, 286, 37, 78, 37, 49,
+ /* 2250 */ 107, 415, 107, 417, 182, 182, 108, 50, 103, 108,
+ /* 2260 */ 182, 105, 108, 456, 141, 182, 459, 182, 403, 462,
+ /* 2270 */ 463, 464, 465, 466, 467, 185, 469, 189, 50, 33,
+ /* 2280 */ 415, 189, 417, 209, 33, 33, 33, 205, 108, 107,
+ /* 2290 */ 33, 49, 456, 108, 107, 459, 362, 107, 462, 463,
+ /* 2300 */ 464, 465, 466, 467, 37, 469, 3, 184, 107, 375,
+ /* 2310 */ 108, 107, 33, 108, 191, 37, 0, 37, 37, 37,
+ /* 2320 */ 37, 456, 362, 37, 459, 49, 108, 462, 463, 464,
+ /* 2330 */ 465, 466, 467, 210, 469, 375, 49, 403, 108, 108,
+ /* 2340 */ 33, 0, 107, 42, 108, 107, 0, 186, 42, 415,
+ /* 2350 */ 107, 417, 108, 49, 107, 107, 107, 33, 184, 105,
+ /* 2360 */ 105, 116, 257, 403, 270, 2, 22, 107, 49, 108,
+ /* 2370 */ 107, 107, 286, 108, 108, 415, 49, 417, 107, 286,
+ /* 2380 */ 107, 22, 108, 108, 107, 117, 37, 37, 37, 33,
+ /* 2390 */ 456, 362, 234, 459, 237, 107, 462, 463, 464, 465,
+ /* 2400 */ 466, 467, 108, 469, 375, 107, 37, 362, 108, 107,
+ /* 2410 */ 37, 37, 37, 108, 37, 107, 456, 108, 107, 459,
+ /* 2420 */ 375, 108, 462, 463, 464, 465, 466, 467, 107, 469,
+ /* 2430 */ 107, 22, 403, 107, 72, 107, 71, 37, 128, 37,
+ /* 2440 */ 128, 37, 128, 128, 415, 37, 417, 37, 403, 37,
+ /* 2450 */ 37, 37, 37, 33, 78, 101, 78, 22, 101, 37,
+ /* 2460 */ 415, 37, 417, 37, 37, 362, 37, 37, 78, 37,
+ /* 2470 */ 37, 37, 22, 37, 37, 37, 0, 37, 375, 51,
+ /* 2480 */ 0, 42, 51, 37, 42, 456, 0, 362, 459, 37,
+ /* 2490 */ 0, 462, 463, 464, 465, 466, 467, 42, 469, 51,
+ /* 2500 */ 375, 456, 37, 42, 459, 51, 403, 462, 463, 464,
+ /* 2510 */ 465, 466, 467, 0, 469, 37, 0, 22, 415, 37,
+ /* 2520 */ 417, 33, 362, 22, 21, 525, 22, 22, 403, 21,
+ /* 2530 */ 20, 525, 525, 525, 525, 375, 525, 525, 525, 525,
+ /* 2540 */ 415, 525, 417, 525, 525, 362, 525, 525, 525, 525,
+ /* 2550 */ 525, 525, 525, 525, 525, 525, 525, 525, 375, 456,
+ /* 2560 */ 525, 525, 459, 403, 525, 462, 463, 464, 465, 466,
+ /* 2570 */ 467, 525, 469, 525, 525, 415, 525, 417, 525, 525,
+ /* 2580 */ 525, 456, 525, 525, 459, 525, 403, 462, 463, 464,
+ /* 2590 */ 465, 466, 467, 525, 469, 525, 525, 525, 415, 525,
+ /* 2600 */ 417, 525, 362, 525, 525, 525, 525, 525, 525, 525,
+ /* 2610 */ 525, 525, 525, 525, 525, 375, 456, 525, 525, 459,
+ /* 2620 */ 525, 525, 462, 463, 464, 465, 466, 467, 525, 469,
+ /* 2630 */ 525, 362, 525, 525, 525, 525, 525, 525, 525, 456,
+ /* 2640 */ 525, 525, 459, 403, 375, 462, 463, 464, 465, 466,
+ /* 2650 */ 467, 525, 469, 525, 525, 415, 525, 417, 525, 525,
+ /* 2660 */ 525, 525, 525, 525, 525, 525, 525, 525, 525, 525,
+ /* 2670 */ 525, 525, 403, 525, 525, 525, 525, 525, 525, 525,
+ /* 2680 */ 525, 525, 525, 525, 415, 525, 417, 525, 525, 525,
+ /* 2690 */ 525, 525, 525, 525, 525, 525, 456, 525, 362, 459,
+ /* 2700 */ 525, 525, 462, 463, 464, 465, 466, 467, 525, 469,
+ /* 2710 */ 525, 375, 525, 525, 362, 525, 525, 525, 525, 525,
+ /* 2720 */ 525, 525, 525, 525, 525, 456, 525, 375, 459, 525,
+ /* 2730 */ 525, 462, 463, 464, 465, 466, 467, 525, 469, 403,
+ /* 2740 */ 525, 525, 525, 525, 525, 525, 525, 525, 525, 525,
+ /* 2750 */ 525, 415, 525, 417, 525, 403, 525, 525, 525, 525,
+ /* 2760 */ 525, 525, 525, 525, 525, 525, 525, 415, 525, 417,
+ /* 2770 */ 525, 525, 525, 525, 525, 525, 525, 525, 525, 525,
+ /* 2780 */ 525, 525, 525, 362, 525, 525, 525, 525, 525, 525,
+ /* 2790 */ 525, 525, 456, 525, 525, 459, 375, 525, 462, 463,
+ /* 2800 */ 464, 465, 466, 467, 525, 469, 525, 362, 456, 525,
+ /* 2810 */ 525, 459, 525, 525, 462, 463, 464, 465, 466, 467,
+ /* 2820 */ 375, 469, 525, 525, 403, 525, 525, 525, 525, 525,
+ /* 2830 */ 525, 525, 525, 525, 525, 525, 415, 525, 417, 525,
+ /* 2840 */ 525, 362, 525, 525, 525, 525, 525, 525, 403, 525,
+ /* 2850 */ 525, 525, 525, 525, 375, 525, 525, 525, 525, 525,
+ /* 2860 */ 415, 525, 417, 525, 525, 525, 525, 525, 525, 525,
+ /* 2870 */ 525, 525, 525, 525, 525, 525, 525, 456, 525, 525,
+ /* 2880 */ 459, 525, 403, 462, 463, 464, 465, 466, 467, 525,
+ /* 2890 */ 469, 525, 525, 525, 415, 525, 417, 525, 525, 525,
+ /* 2900 */ 525, 456, 525, 525, 459, 525, 525, 462, 463, 464,
+ /* 2910 */ 465, 466, 467, 525, 469, 525, 525, 525, 525, 525,
+ /* 2920 */ 525, 362, 525, 525, 525, 525, 525, 525, 525, 525,
+ /* 2930 */ 525, 525, 525, 525, 375, 456, 525, 525, 459, 525,
+ /* 2940 */ 362, 462, 463, 464, 465, 466, 467, 525, 469, 525,
+ /* 2950 */ 525, 525, 525, 375, 525, 362, 525, 525, 525, 525,
+ /* 2960 */ 525, 525, 403, 525, 525, 525, 525, 525, 375, 525,
+ /* 2970 */ 525, 525, 525, 525, 415, 525, 417, 525, 525, 525,
+ /* 2980 */ 525, 403, 525, 525, 525, 525, 525, 525, 525, 525,
+ /* 2990 */ 525, 525, 525, 415, 525, 417, 403, 525, 525, 525,
+ /* 3000 */ 525, 525, 525, 525, 525, 525, 525, 525, 415, 525,
+ /* 3010 */ 417, 525, 525, 525, 525, 456, 525, 525, 459, 525,
+ /* 3020 */ 525, 462, 463, 464, 465, 466, 467, 525, 469, 525,
+ /* 3030 */ 525, 525, 525, 525, 456, 525, 525, 459, 525, 525,
+ /* 3040 */ 462, 463, 464, 465, 466, 467, 525, 469, 525, 456,
+ /* 3050 */ 525, 525, 459, 525, 525, 462, 463, 464, 465, 466,
+ /* 3060 */ 467, 525, 469, 359, 359, 359, 359, 359, 359, 359,
+ /* 3070 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3080 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3090 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3100 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3110 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3120 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3130 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3140 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3150 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3160 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3170 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3180 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3190 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3200 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3210 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3220 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3230 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3240 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3250 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3260 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3270 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3280 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3290 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3300 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3310 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3320 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3330 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3340 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3350 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3360 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3370 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3380 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3390 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3400 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3410 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ /* 3420 */ 359, 359,
};
-#define YY_SHIFT_COUNT (855)
+#define YY_SHIFT_COUNT (861)
#define YY_SHIFT_MIN (0)
-#define YY_SHIFT_MAX (2556)
+#define YY_SHIFT_MAX (2516)
static const unsigned short int yy_shift_ofst[] = {
/* 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,
+ /* 50 */ 977, 251, 398, 349, 1, 7, 30, 7, 7, 1,
+ /* 60 */ 1, 7, 1469, 7, 243, 1469, 1469, 436, 7, 53,
+ /* 70 */ 242, 172, 172, 306, 306, 242, 40, 279, 32, 32,
+ /* 80 */ 121, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ /* 90 */ 172, 172, 294, 382, 172, 172, 199, 53, 172, 294,
+ /* 100 */ 172, 53, 172, 172, 53, 172, 172, 53, 172, 53,
+ /* 110 */ 53, 53, 172, 258, 203, 203, 448, 542, 201, 334,
+ /* 120 */ 334, 334, 334, 334, 334, 334, 334, 334, 334, 334,
+ /* 130 */ 334, 334, 334, 334, 334, 334, 334, 334, 1166, 255,
+ /* 140 */ 40, 279, 447, 447, 671, 413, 413, 413, 809, 415,
+ /* 150 */ 415, 754, 671, 199, 322, 53, 53, 160, 53, 442,
+ /* 160 */ 53, 442, 442, 441, 503, 212, 212, 212, 212, 212,
+ /* 170 */ 212, 212, 212, 2123, 361, 1043, 1402, 745, 745, 15,
+ /* 180 */ 293, 339, 288, 118, 535, 369, 790, 438, 438, 299,
+ /* 190 */ 1056, 533, 875, 875, 875, 1134, 875, 44, 667, 1025,
+ /* 200 */ 262, 618, 1130, 1025, 1025, 1062, 1259, 1259, 347, 647,
+ /* 210 */ 852, 754, 1311, 1547, 1568, 1602, 1409, 199, 1602, 199,
+ /* 220 */ 1434, 1616, 1619, 1597, 1619, 1597, 1468, 1616, 1619, 1616,
+ /* 230 */ 1597, 1468, 1468, 1468, 1551, 1555, 1616, 1558, 1616, 1616,
+ /* 240 */ 1616, 1641, 1620, 1641, 1620, 1602, 199, 199, 1664, 199,
+ /* 250 */ 1674, 1678, 199, 1674, 199, 1689, 199, 199, 1616, 199,
+ /* 260 */ 1641, 53, 53, 53, 53, 53, 53, 53, 53, 53,
+ /* 270 */ 53, 53, 1616, 503, 503, 1641, 442, 442, 442, 1510,
+ /* 280 */ 1626, 1602, 258, 1722, 1542, 1554, 1664, 258, 1311, 1616,
+ /* 290 */ 442, 1476, 1478, 1476, 1478, 1473, 1582, 1476, 1494, 1496,
+ /* 300 */ 1518, 1311, 1497, 1500, 1493, 1495, 1506, 1619, 1789, 1700,
+ /* 310 */ 1540, 1674, 258, 258, 1478, 442, 442, 442, 442, 1478,
+ /* 320 */ 442, 1644, 258, 441, 258, 1619, 1737, 1739, 442, 1616,
+ /* 330 */ 258, 1833, 1818, 1641, 3063, 3063, 3063, 3063, 3063, 3063,
+ /* 340 */ 3063, 3063, 3063, 36, 724, 546, 1082, 764, 54, 81,
+ /* 350 */ 865, 652, 1044, 1019, 1013, 1154, 1154, 1154, 1154, 1154,
+ /* 360 */ 1154, 1154, 1154, 1154, 1035, 151, 4, 780, 780, 252,
+ /* 370 */ 935, 601, 110, 697, 26, 494, 987, 619, 856, 856,
+ /* 380 */ 1194, 443, 31, 1194, 1194, 1194, 1094, 355, 830, 954,
+ /* 390 */ 1297, 1146, 1203, 1287, 1316, 1317, 1337, 1026, 1274, 1313,
+ /* 400 */ 1326, 1339, 1382, 1022, 1264, 1372, 1333, 1379, 1380, 1456,
+ /* 410 */ 1457, 933, 1079, 598, 1464, 1474, 1475, 1477, 1481, 1489,
+ /* 420 */ 1391, 1503, 1249, 1505, 1314, 1507, 1509, 1516, 1517, 1527,
+ /* 430 */ 1533, 603, 1396, 1414, 1466, 1472, 1362, 1492, 1877, 1882,
+ /* 440 */ 1883, 1839, 1885, 1849, 1660, 1852, 1853, 1856, 1673, 1902,
+ /* 450 */ 1866, 1867, 1679, 1870, 1908, 1683, 1909, 1874, 1914, 1878,
+ /* 460 */ 1916, 1897, 1921, 1892, 1710, 1922, 1724, 1935, 1726, 1727,
+ /* 470 */ 1733, 1738, 1939, 1941, 1942, 1745, 1747, 1946, 1948, 1801,
+ /* 480 */ 1901, 1903, 1951, 1917, 1953, 1955, 1919, 1906, 1958, 1911,
+ /* 490 */ 1961, 1918, 1962, 1965, 1966, 1920, 1967, 1968, 1970, 1972,
+ /* 500 */ 1975, 1976, 1812, 1943, 1978, 1814, 1981, 1982, 1983, 1984,
+ /* 510 */ 1985, 1987, 1988, 1990, 1991, 1998, 2000, 2001, 2002, 2003,
+ /* 520 */ 2004, 2005, 2006, 2007, 2008, 1964, 2009, 1969, 2010, 2011,
+ /* 530 */ 2016, 2017, 2024, 2026, 2027, 2012, 2035, 1881, 2030, 1884,
+ /* 540 */ 2032, 1887, 2036, 2037, 2018, 1989, 2020, 1993, 2038, 1980,
+ /* 550 */ 2013, 2046, 1986, 2047, 1995, 2048, 2049, 2019, 2014, 2021,
+ /* 560 */ 2053, 2025, 2015, 2022, 2054, 2031, 2023, 2028, 2055, 2034,
+ /* 570 */ 2058, 2033, 2040, 2042, 2039, 2043, 2059, 2044, 2061, 2041,
+ /* 580 */ 2052, 2067, 2076, 2077, 2079, 2056, 1893, 2080, 2039, 2057,
+ /* 590 */ 2087, 2089, 2051, 2091, 2095, 2064, 2060, 2062, 2096, 2066,
+ /* 600 */ 2065, 2068, 2107, 2071, 2069, 2075, 2109, 2081, 2070, 2084,
+ /* 610 */ 2113, 2119, 2127, 2134, 2136, 2139, 2050, 2063, 2115, 2118,
+ /* 620 */ 2150, 2117, 2130, 2131, 2133, 2135, 2138, 2140, 2141, 2146,
+ /* 630 */ 2147, 2144, 2152, 2149, 2153, 2173, 2165, 2191, 2170, 2193,
+ /* 640 */ 2172, 2142, 2197, 2178, 2164, 2208, 2212, 2213, 2177, 2215,
+ /* 650 */ 2179, 2217, 2196, 2199, 2184, 2186, 2188, 2112, 2121, 2226,
+ /* 660 */ 2072, 2124, 2074, 2039, 2181, 2233, 2073, 2198, 2214, 2234,
+ /* 670 */ 2082, 2216, 2078, 2090, 2237, 2241, 2083, 2088, 2085, 2092,
+ /* 680 */ 2239, 2210, 1959, 2137, 2148, 2143, 2151, 2209, 2211, 2145,
+ /* 690 */ 2207, 2156, 2228, 2155, 2154, 2246, 2251, 2180, 2182, 2187,
+ /* 700 */ 2190, 2185, 2252, 2200, 2242, 2201, 2253, 2086, 2169, 2202,
+ /* 710 */ 2257, 2204, 2267, 2205, 2218, 2303, 2279, 2093, 2278, 2280,
+ /* 720 */ 2281, 2282, 2283, 2286, 2230, 2231, 2276, 2094, 2307, 2287,
+ /* 730 */ 2316, 2341, 2235, 2301, 2238, 2236, 2244, 2243, 2247, 2161,
+ /* 740 */ 2248, 2346, 2306, 2174, 2249, 2245, 2039, 2304, 2324, 2254,
+ /* 750 */ 2105, 2255, 2363, 2344, 2158, 2260, 2261, 2263, 2265, 2264,
+ /* 760 */ 2266, 2319, 2271, 2273, 2327, 2274, 2359, 2157, 2277, 2268,
+ /* 770 */ 2275, 2349, 2350, 2288, 2294, 2351, 2298, 2300, 2369, 2302,
+ /* 780 */ 2305, 2373, 2308, 2309, 2374, 2311, 2313, 2375, 2321, 2310,
+ /* 790 */ 2312, 2314, 2315, 2323, 2356, 2326, 2377, 2328, 2356, 2356,
+ /* 800 */ 2409, 2362, 2365, 2400, 2402, 2404, 2408, 2410, 2412, 2413,
+ /* 810 */ 2414, 2415, 2376, 2354, 2378, 2357, 2420, 2422, 2424, 2426,
+ /* 820 */ 2435, 2427, 2429, 2430, 2390, 2146, 2432, 2147, 2433, 2434,
+ /* 830 */ 2436, 2437, 2450, 2438, 2476, 2440, 2428, 2439, 2480, 2446,
+ /* 840 */ 2431, 2442, 2486, 2452, 2448, 2455, 2490, 2465, 2454, 2461,
+ /* 850 */ 2513, 2478, 2482, 2516, 2495, 2488, 2501, 2503, 2504, 2505,
+ /* 860 */ 2508, 2510,
};
-#define YY_REDUCE_COUNT (341)
-#define YY_REDUCE_MIN (-480)
-#define YY_REDUCE_MAX (2481)
+#define YY_REDUCE_COUNT (342)
+#define YY_REDUCE_MIN (-481)
+#define YY_REDUCE_MAX (2593)
static const short yy_reduce_ofst[] = {
- /* 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,
+ /* 0 */ 1073, -317, 144, 182, 240, 388, 483, 633, 663, 914,
+ /* 10 */ 972, 1140, 1216, 426, 1290, 1324, -90, 1403, 731, 219,
+ /* 20 */ 893, 463, 1432, 1461, 1530, 1556, 1666, 1682, 1697, 1740,
+ /* 30 */ 1807, 1836, 1865, 1934, 1960, 2029, 2045, 2103, 2125, 2160,
+ /* 40 */ 2183, 2240, 2269, 2336, 2352, 2421, 2445, 2479, 2559, 2578,
+ /* 50 */ 2593, -319, -228, -435, 29, 751, 831, 1005, 1039, -181,
+ /* 60 */ 338, 1060, 496, -481, -372, -192, 646, -414, -312, 713,
+ /* 70 */ -360, -196, -77, -368, -363, -417, -344, -325, -216, -202,
+ /* 80 */ -138, 265, 278, 377, 408, -272, 85, 500, 509, 549,
+ /* 90 */ 566, 181, 249, 43, 617, 655, 381, 308, 786, 737,
+ /* 100 */ 808, 418, 863, 870, 851, 885, 899, 548, 907, 872,
+ /* 110 */ 644, 889, 920, -14, -461, -461, -343, 122, 274, -209,
+ /* 120 */ -201, -56, 95, 259, 703, 721, 723, 873, 888, 923,
+ /* 130 */ 928, 959, 970, 971, 991, 1009, 1029, 1034, -315, -410,
+ /* 140 */ -63, 11, 200, 420, 460, -410, 46, 409, -86, 386,
+ /* 150 */ 458, 449, 529, 527, 689, -247, 428, 615, 470, 744,
+ /* 160 */ 789, 836, 892, 913, 596, -393, 540, 774, 795, 800,
+ /* 170 */ 810, 845, 800, -412, 475, 1057, 894, 929, 929, 931,
+ /* 180 */ 946, 973, 993, 1108, 929, 1097, 1097, 1114, 1126, 1090,
+ /* 190 */ 1148, 1100, 1028, 1030, 1040, 1109, 1041, 1097, 1159, 1117,
+ /* 200 */ 1187, 1149, 1122, 1142, 1143, 1097, 1081, 1091, 1052, 1095,
+ /* 210 */ 1092, 1201, 1162, 1150, 1155, 1173, 1172, 1245, 1179, 1247,
+ /* 220 */ 1191, 1263, 1265, 1219, 1269, 1222, 1224, 1275, 1273, 1276,
+ /* 230 */ 1227, 1232, 1233, 1234, 1270, 1277, 1285, 1279, 1288, 1292,
+ /* 240 */ 1293, 1301, 1298, 1307, 1305, 1237, 1294, 1306, 1271, 1308,
+ /* 250 */ 1319, 1260, 1318, 1330, 1325, 1280, 1327, 1329, 1328, 1331,
+ /* 260 */ 1346, 1312, 1321, 1322, 1323, 1332, 1334, 1335, 1340, 1341,
+ /* 270 */ 1342, 1344, 1354, 1351, 1364, 1363, 1336, 1343, 1345, 1278,
+ /* 280 */ 1282, 1286, 1359, 1299, 1315, 1338, 1347, 1386, 1353, 1389,
+ /* 290 */ 1357, 1272, 1348, 1281, 1349, 1267, 1289, 1295, 1309, 1296,
+ /* 300 */ 1310, 1369, 1320, 1350, 1291, 1303, 1302, 1438, 1355, 1352,
+ /* 310 */ 1356, 1448, 1444, 1445, 1394, 1413, 1415, 1416, 1417, 1400,
+ /* 320 */ 1419, 1408, 1458, 1439, 1460, 1467, 1366, 1441, 1435, 1480,
+ /* 330 */ 1471, 1499, 1490, 1504, 1418, 1406, 1427, 1440, 1482, 1483,
+ /* 340 */ 1484, 1491, 1515,
};
static const YYACTIONTYPE yy_default[] = {
- /* 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,
+ /* 0 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 10 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 20 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 30 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 40 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 50 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 60 */ 1945, 2285, 1945, 1945, 2248, 1945, 1945, 1945, 1945, 1945,
+ /* 70 */ 1945, 1945, 1945, 1945, 1945, 1945, 2255, 1945, 1945, 1945,
+ /* 80 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 90 */ 1945, 1945, 1945, 1945, 1945, 1945, 2044, 1945, 1945, 1945,
+ /* 100 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 110 */ 1945, 1945, 1945, 2042, 2488, 1945, 1945, 2517, 1945, 1945,
+ /* 120 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 130 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 2500,
+ /* 140 */ 1945, 1945, 2016, 2016, 1945, 2500, 2500, 2500, 2042, 2460,
+ /* 150 */ 2460, 1945, 1945, 2044, 2323, 1945, 1945, 1945, 1945, 1945,
+ /* 160 */ 1945, 1945, 1945, 2167, 1975, 1945, 1945, 1945, 1945, 2191,
+ /* 170 */ 1945, 1945, 1945, 2311, 1945, 1945, 2546, 2492, 2493, 2608,
+ /* 180 */ 1945, 2549, 2511, 1945, 2506, 1945, 1945, 1945, 1945, 2260,
+ /* 190 */ 1945, 2536, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 200 */ 1945, 2120, 2305, 1945, 1945, 1945, 1945, 1945, 2592, 2490,
+ /* 210 */ 2530, 1945, 2540, 1945, 2348, 1945, 2337, 2044, 1945, 2044,
+ /* 220 */ 2298, 2243, 1945, 2253, 1945, 2253, 2250, 1945, 1945, 1945,
+ /* 230 */ 2253, 2250, 2250, 2250, 2109, 2105, 1945, 2103, 1945, 1945,
+ /* 240 */ 1945, 1945, 2000, 1945, 2000, 1945, 2044, 2044, 1945, 2044,
+ /* 250 */ 1945, 1945, 2044, 1945, 2044, 1945, 2044, 2044, 1945, 2044,
+ /* 260 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 270 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 2335,
+ /* 280 */ 2321, 1945, 2042, 1945, 2309, 2307, 1945, 2042, 2540, 1945,
+ /* 290 */ 1945, 2562, 2557, 2562, 2557, 2576, 2572, 2562, 2581, 2578,
+ /* 300 */ 2542, 2540, 2523, 2519, 2611, 2598, 2594, 1945, 1945, 2528,
+ /* 310 */ 2526, 1945, 2042, 2042, 2557, 1945, 1945, 1945, 1945, 2557,
+ /* 320 */ 1945, 1945, 2042, 1945, 2042, 1945, 1945, 2136, 1945, 1945,
+ /* 330 */ 2042, 1945, 1984, 1945, 2300, 2326, 2281, 2281, 2170, 2170,
+ /* 340 */ 2170, 2045, 1950, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 350 */ 1945, 1945, 1945, 1945, 1945, 2575, 2574, 2413, 1945, 2464,
+ /* 360 */ 2463, 2462, 2453, 2412, 2132, 1945, 1945, 2411, 2410, 1945,
+ /* 370 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 2272, 2271,
+ /* 380 */ 2404, 1945, 1945, 2405, 2403, 2402, 1945, 1945, 1945, 1945,
+ /* 390 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 400 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 410 */ 1945, 1945, 2595, 2599, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 420 */ 2489, 1945, 1945, 1945, 2384, 1945, 1945, 1945, 1945, 1945,
+ /* 430 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 440 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 450 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 460 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 470 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 2249,
+ /* 480 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 490 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 500 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 510 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 520 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 530 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 540 */ 1945, 2264, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 550 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 560 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 570 */ 1945, 1945, 1945, 1989, 2391, 1945, 1945, 1945, 1945, 1945,
+ /* 580 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 2394, 1945,
+ /* 590 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 600 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 610 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 620 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 2084,
+ /* 630 */ 2083, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 640 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 650 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 2395, 1945, 1945,
+ /* 660 */ 1945, 1945, 1945, 2386, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 670 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 680 */ 2591, 2543, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 690 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 700 */ 1945, 1945, 1945, 1945, 2384, 1945, 2573, 1945, 1945, 1945,
+ /* 710 */ 1945, 1945, 1945, 1945, 2589, 1945, 2593, 1945, 1945, 1945,
+ /* 720 */ 1945, 1945, 1945, 1945, 2499, 2495, 1945, 1945, 2491, 1945,
+ /* 730 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 740 */ 1945, 1945, 1945, 1945, 1945, 1945, 2383, 1945, 2450, 1945,
+ /* 750 */ 1945, 1945, 2484, 1945, 1945, 2435, 1945, 1945, 1945, 1945,
+ /* 760 */ 1945, 1945, 1945, 1945, 1945, 2395, 1945, 2398, 1945, 1945,
+ /* 770 */ 1945, 1945, 1945, 2164, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 780 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 2148,
+ /* 790 */ 2146, 2145, 2144, 1945, 2177, 1945, 1945, 1945, 2173, 2172,
+ /* 800 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 810 */ 1945, 1945, 1945, 1945, 1945, 1945, 2063, 1945, 1945, 1945,
+ /* 820 */ 1945, 1945, 1945, 1945, 1945, 2055, 1945, 2054, 1945, 1945,
+ /* 830 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 840 */ 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945, 1945,
+ /* 850 */ 1945, 1945, 1945, 1945, 1945, 1974, 1945, 1945, 1945, 1945,
+ /* 860 */ 1945, 1945,
};
/********** End of lemon-generated parsing tables *****************************/
@@ -1194,7 +1220,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* BWLIMIT => nothing */
0, /* START => nothing */
0, /* TIMESTAMP => nothing */
- 309, /* END => ABORT */
+ 310, /* END => ABORT */
0, /* TABLE => nothing */
0, /* NK_LP => nothing */
0, /* NK_RP => nothing */
@@ -1264,7 +1290,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* VNODES => nothing */
0, /* ALIVE => nothing */
0, /* VIEWS => nothing */
- 309, /* VIEW => ABORT */
+ 310, /* VIEW => ABORT */
0, /* COMPACTS => nothing */
0, /* NORMAL => nothing */
0, /* CHILD => nothing */
@@ -1364,7 +1390,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* LEFT => nothing */
0, /* RIGHT => nothing */
0, /* OUTER => nothing */
- 309, /* SEMI => ABORT */
+ 310, /* SEMI => ABORT */
0, /* ANTI => nothing */
0, /* ASOF => nothing */
0, /* WINDOW => nothing */
@@ -1379,6 +1405,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* SESSION => nothing */
0, /* STATE_WINDOW => nothing */
0, /* EVENT_WINDOW => nothing */
+ 0, /* COUNT_WINDOW => nothing */
0, /* SLIDING => nothing */
0, /* FILL => nothing */
0, /* VALUE => nothing */
@@ -1399,54 +1426,54 @@ static const YYCODETYPE yyFallback[] = {
0, /* ASC => nothing */
0, /* NULLS => nothing */
0, /* ABORT => nothing */
- 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 */
+ 310, /* AFTER => ABORT */
+ 310, /* ATTACH => ABORT */
+ 310, /* BEFORE => ABORT */
+ 310, /* BEGIN => ABORT */
+ 310, /* BITAND => ABORT */
+ 310, /* BITNOT => ABORT */
+ 310, /* BITOR => ABORT */
+ 310, /* BLOCKS => ABORT */
+ 310, /* CHANGE => ABORT */
+ 310, /* COMMA => ABORT */
+ 310, /* CONCAT => ABORT */
+ 310, /* CONFLICT => ABORT */
+ 310, /* COPY => ABORT */
+ 310, /* DEFERRED => ABORT */
+ 310, /* DELIMITERS => ABORT */
+ 310, /* DETACH => ABORT */
+ 310, /* DIVIDE => ABORT */
+ 310, /* DOT => ABORT */
+ 310, /* EACH => ABORT */
+ 310, /* FAIL => ABORT */
+ 310, /* FILE => ABORT */
+ 310, /* FOR => ABORT */
+ 310, /* GLOB => ABORT */
+ 310, /* ID => ABORT */
+ 310, /* IMMEDIATE => ABORT */
+ 310, /* IMPORT => ABORT */
+ 310, /* INITIALLY => ABORT */
+ 310, /* INSTEAD => ABORT */
+ 310, /* ISNULL => ABORT */
+ 310, /* KEY => ABORT */
+ 310, /* MODULES => ABORT */
+ 310, /* NK_BITNOT => ABORT */
+ 310, /* NK_SEMI => ABORT */
+ 310, /* NOTNULL => ABORT */
+ 310, /* OF => ABORT */
+ 310, /* PLUS => ABORT */
+ 310, /* PRIVILEGE => ABORT */
+ 310, /* RAISE => ABORT */
+ 310, /* RESTRICT => ABORT */
+ 310, /* ROW => ABORT */
+ 310, /* STAR => ABORT */
+ 310, /* STATEMENT => ABORT */
+ 310, /* STRICT => ABORT */
+ 310, /* STRING => ABORT */
+ 310, /* TIMES => ABORT */
+ 310, /* VALUES => ABORT */
+ 310, /* VARIABLE => ABORT */
+ 310, /* WAL => ABORT */
};
#endif /* YYFALLBACK */
@@ -1824,240 +1851,241 @@ static const char *const yyTokenName[] = {
/* 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",
+ /* 290 */ "COUNT_WINDOW",
+ /* 291 */ "SLIDING",
+ /* 292 */ "FILL",
+ /* 293 */ "VALUE",
+ /* 294 */ "VALUE_F",
+ /* 295 */ "NONE",
+ /* 296 */ "PREV",
+ /* 297 */ "NULL_F",
+ /* 298 */ "LINEAR",
+ /* 299 */ "NEXT",
+ /* 300 */ "HAVING",
+ /* 301 */ "RANGE",
+ /* 302 */ "EVERY",
+ /* 303 */ "ORDER",
+ /* 304 */ "SLIMIT",
+ /* 305 */ "SOFFSET",
+ /* 306 */ "LIMIT",
+ /* 307 */ "OFFSET",
+ /* 308 */ "ASC",
+ /* 309 */ "NULLS",
+ /* 310 */ "ABORT",
+ /* 311 */ "AFTER",
+ /* 312 */ "ATTACH",
+ /* 313 */ "BEFORE",
+ /* 314 */ "BEGIN",
+ /* 315 */ "BITAND",
+ /* 316 */ "BITNOT",
+ /* 317 */ "BITOR",
+ /* 318 */ "BLOCKS",
+ /* 319 */ "CHANGE",
+ /* 320 */ "COMMA",
+ /* 321 */ "CONCAT",
+ /* 322 */ "CONFLICT",
+ /* 323 */ "COPY",
+ /* 324 */ "DEFERRED",
+ /* 325 */ "DELIMITERS",
+ /* 326 */ "DETACH",
+ /* 327 */ "DIVIDE",
+ /* 328 */ "DOT",
+ /* 329 */ "EACH",
+ /* 330 */ "FAIL",
+ /* 331 */ "FILE",
+ /* 332 */ "FOR",
+ /* 333 */ "GLOB",
+ /* 334 */ "ID",
+ /* 335 */ "IMMEDIATE",
+ /* 336 */ "IMPORT",
+ /* 337 */ "INITIALLY",
+ /* 338 */ "INSTEAD",
+ /* 339 */ "ISNULL",
+ /* 340 */ "KEY",
+ /* 341 */ "MODULES",
+ /* 342 */ "NK_BITNOT",
+ /* 343 */ "NK_SEMI",
+ /* 344 */ "NOTNULL",
+ /* 345 */ "OF",
+ /* 346 */ "PLUS",
+ /* 347 */ "PRIVILEGE",
+ /* 348 */ "RAISE",
+ /* 349 */ "RESTRICT",
+ /* 350 */ "ROW",
+ /* 351 */ "STAR",
+ /* 352 */ "STATEMENT",
+ /* 353 */ "STRICT",
+ /* 354 */ "STRING",
+ /* 355 */ "TIMES",
+ /* 356 */ "VALUES",
+ /* 357 */ "VARIABLE",
+ /* 358 */ "WAL",
+ /* 359 */ "cmd",
+ /* 360 */ "account_options",
+ /* 361 */ "alter_account_options",
+ /* 362 */ "literal",
+ /* 363 */ "alter_account_option",
+ /* 364 */ "ip_range_list",
+ /* 365 */ "white_list",
+ /* 366 */ "white_list_opt",
+ /* 367 */ "user_name",
+ /* 368 */ "sysinfo_opt",
+ /* 369 */ "privileges",
+ /* 370 */ "priv_level",
+ /* 371 */ "with_opt",
+ /* 372 */ "priv_type_list",
+ /* 373 */ "priv_type",
+ /* 374 */ "db_name",
+ /* 375 */ "table_name",
+ /* 376 */ "topic_name",
+ /* 377 */ "search_condition",
+ /* 378 */ "dnode_endpoint",
+ /* 379 */ "force_opt",
+ /* 380 */ "unsafe_opt",
+ /* 381 */ "not_exists_opt",
+ /* 382 */ "db_options",
+ /* 383 */ "exists_opt",
+ /* 384 */ "alter_db_options",
+ /* 385 */ "speed_opt",
+ /* 386 */ "start_opt",
+ /* 387 */ "end_opt",
+ /* 388 */ "integer_list",
+ /* 389 */ "variable_list",
+ /* 390 */ "retention_list",
+ /* 391 */ "signed",
+ /* 392 */ "alter_db_option",
+ /* 393 */ "retention",
+ /* 394 */ "full_table_name",
+ /* 395 */ "column_def_list",
+ /* 396 */ "tags_def_opt",
+ /* 397 */ "table_options",
+ /* 398 */ "multi_create_clause",
+ /* 399 */ "tags_def",
+ /* 400 */ "multi_drop_clause",
+ /* 401 */ "alter_table_clause",
+ /* 402 */ "alter_table_options",
+ /* 403 */ "column_name",
+ /* 404 */ "type_name",
+ /* 405 */ "signed_literal",
+ /* 406 */ "create_subtable_clause",
+ /* 407 */ "specific_cols_opt",
+ /* 408 */ "expression_list",
+ /* 409 */ "drop_table_clause",
+ /* 410 */ "col_name_list",
+ /* 411 */ "column_def",
+ /* 412 */ "duration_list",
+ /* 413 */ "rollup_func_list",
+ /* 414 */ "alter_table_option",
+ /* 415 */ "duration_literal",
+ /* 416 */ "rollup_func_name",
+ /* 417 */ "function_name",
+ /* 418 */ "col_name",
+ /* 419 */ "db_kind_opt",
+ /* 420 */ "table_kind_db_name_cond_opt",
+ /* 421 */ "like_pattern_opt",
+ /* 422 */ "db_name_cond_opt",
+ /* 423 */ "table_name_cond",
+ /* 424 */ "from_db_opt",
+ /* 425 */ "tag_list_opt",
+ /* 426 */ "table_kind",
+ /* 427 */ "tag_item",
+ /* 428 */ "column_alias",
+ /* 429 */ "index_options",
+ /* 430 */ "full_index_name",
+ /* 431 */ "index_name",
+ /* 432 */ "func_list",
+ /* 433 */ "sliding_opt",
+ /* 434 */ "sma_stream_opt",
+ /* 435 */ "func",
+ /* 436 */ "sma_func_name",
+ /* 437 */ "with_meta",
+ /* 438 */ "query_or_subquery",
+ /* 439 */ "where_clause_opt",
+ /* 440 */ "cgroup_name",
+ /* 441 */ "analyze_opt",
+ /* 442 */ "explain_options",
+ /* 443 */ "insert_query",
+ /* 444 */ "or_replace_opt",
+ /* 445 */ "agg_func_opt",
+ /* 446 */ "bufsize_opt",
+ /* 447 */ "language_opt",
+ /* 448 */ "full_view_name",
+ /* 449 */ "view_name",
+ /* 450 */ "stream_name",
+ /* 451 */ "stream_options",
+ /* 452 */ "col_list_opt",
+ /* 453 */ "tag_def_or_ref_opt",
+ /* 454 */ "subtable_opt",
+ /* 455 */ "ignore_opt",
+ /* 456 */ "expression",
+ /* 457 */ "on_vgroup_id",
+ /* 458 */ "dnode_list",
+ /* 459 */ "literal_func",
+ /* 460 */ "literal_list",
+ /* 461 */ "table_alias",
+ /* 462 */ "expr_or_subquery",
+ /* 463 */ "pseudo_column",
+ /* 464 */ "column_reference",
+ /* 465 */ "function_expression",
+ /* 466 */ "case_when_expression",
+ /* 467 */ "star_func",
+ /* 468 */ "star_func_para_list",
+ /* 469 */ "noarg_func",
+ /* 470 */ "other_para_list",
+ /* 471 */ "star_func_para",
+ /* 472 */ "when_then_list",
+ /* 473 */ "case_when_else_opt",
+ /* 474 */ "common_expression",
+ /* 475 */ "when_then_expr",
+ /* 476 */ "predicate",
+ /* 477 */ "compare_op",
+ /* 478 */ "in_op",
+ /* 479 */ "in_predicate_value",
+ /* 480 */ "boolean_value_expression",
+ /* 481 */ "boolean_primary",
+ /* 482 */ "from_clause_opt",
+ /* 483 */ "table_reference_list",
+ /* 484 */ "table_reference",
+ /* 485 */ "table_primary",
+ /* 486 */ "joined_table",
+ /* 487 */ "alias_opt",
+ /* 488 */ "subquery",
+ /* 489 */ "parenthesized_joined_table",
+ /* 490 */ "join_type",
+ /* 491 */ "join_subtype",
+ /* 492 */ "join_on_clause_opt",
+ /* 493 */ "window_offset_clause_opt",
+ /* 494 */ "jlimit_clause_opt",
+ /* 495 */ "window_offset_literal",
+ /* 496 */ "query_specification",
+ /* 497 */ "hint_list",
+ /* 498 */ "set_quantifier_opt",
+ /* 499 */ "tag_mode_opt",
+ /* 500 */ "select_list",
+ /* 501 */ "partition_by_clause_opt",
+ /* 502 */ "range_opt",
+ /* 503 */ "every_opt",
+ /* 504 */ "fill_opt",
+ /* 505 */ "twindow_clause_opt",
+ /* 506 */ "group_by_clause_opt",
+ /* 507 */ "having_clause_opt",
+ /* 508 */ "select_item",
+ /* 509 */ "partition_list",
+ /* 510 */ "partition_item",
+ /* 511 */ "interval_sliding_duration_literal",
+ /* 512 */ "fill_mode",
+ /* 513 */ "group_by_list",
+ /* 514 */ "query_expression",
+ /* 515 */ "query_simple",
+ /* 516 */ "order_by_clause_opt",
+ /* 517 */ "slimit_clause_opt",
+ /* 518 */ "limit_clause_opt",
+ /* 519 */ "union_query_expression",
+ /* 520 */ "query_simple_or_subquery",
+ /* 521 */ "sort_specification_list",
+ /* 522 */ "sort_specification",
+ /* 523 */ "ordering_specification_opt",
+ /* 524 */ "null_ordering_opt",
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
@@ -2355,7 +2383,7 @@ static const char *const yyRuleName[] = {
/* 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",
+ /* 290 */ "cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt",
/* 291 */ "cmd ::= SHOW CREATE VIEW full_table_name",
/* 292 */ "cmd ::= SHOW COMPACTS",
/* 293 */ "cmd ::= SHOW COMPACT NK_INTEGER",
@@ -2672,63 +2700,65 @@ static const char *const yyRuleName[] = {
/* 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",
+ /* 607 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP",
+ /* 608 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP",
+ /* 609 */ "sliding_opt ::=",
+ /* 610 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP",
+ /* 611 */ "interval_sliding_duration_literal ::= NK_VARIABLE",
+ /* 612 */ "interval_sliding_duration_literal ::= NK_STRING",
+ /* 613 */ "interval_sliding_duration_literal ::= NK_INTEGER",
+ /* 614 */ "fill_opt ::=",
+ /* 615 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
+ /* 616 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP",
+ /* 617 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP",
+ /* 618 */ "fill_mode ::= NONE",
+ /* 619 */ "fill_mode ::= PREV",
+ /* 620 */ "fill_mode ::= NULL",
+ /* 621 */ "fill_mode ::= NULL_F",
+ /* 622 */ "fill_mode ::= LINEAR",
+ /* 623 */ "fill_mode ::= NEXT",
+ /* 624 */ "group_by_clause_opt ::=",
+ /* 625 */ "group_by_clause_opt ::= GROUP BY group_by_list",
+ /* 626 */ "group_by_list ::= expr_or_subquery",
+ /* 627 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery",
+ /* 628 */ "having_clause_opt ::=",
+ /* 629 */ "having_clause_opt ::= HAVING search_condition",
+ /* 630 */ "range_opt ::=",
+ /* 631 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP",
+ /* 632 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP",
+ /* 633 */ "every_opt ::=",
+ /* 634 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
+ /* 635 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt",
+ /* 636 */ "query_simple ::= query_specification",
+ /* 637 */ "query_simple ::= union_query_expression",
+ /* 638 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery",
+ /* 639 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery",
+ /* 640 */ "query_simple_or_subquery ::= query_simple",
+ /* 641 */ "query_simple_or_subquery ::= subquery",
+ /* 642 */ "query_or_subquery ::= query_expression",
+ /* 643 */ "query_or_subquery ::= subquery",
+ /* 644 */ "order_by_clause_opt ::=",
+ /* 645 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
+ /* 646 */ "slimit_clause_opt ::=",
+ /* 647 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
+ /* 648 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
+ /* 649 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 650 */ "limit_clause_opt ::=",
+ /* 651 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
+ /* 652 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
+ /* 653 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 654 */ "subquery ::= NK_LP query_expression NK_RP",
+ /* 655 */ "subquery ::= NK_LP subquery NK_RP",
+ /* 656 */ "search_condition ::= common_expression",
+ /* 657 */ "sort_specification_list ::= sort_specification",
+ /* 658 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
+ /* 659 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt",
+ /* 660 */ "ordering_specification_opt ::=",
+ /* 661 */ "ordering_specification_opt ::= ASC",
+ /* 662 */ "ordering_specification_opt ::= DESC",
+ /* 663 */ "null_ordering_opt ::=",
+ /* 664 */ "null_ordering_opt ::= NULLS FIRST",
+ /* 665 */ "null_ordering_opt ::= NULLS LAST",
};
#endif /* NDEBUG */
@@ -2855,240 +2885,240 @@ static void yy_destructor(
*/
/********* Begin destructor definitions ***************************************/
/* Default NON-TERMINAL Destructor */
- 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 */
+ case 359: /* cmd */
+ case 362: /* literal */
+ case 371: /* with_opt */
+ case 377: /* search_condition */
+ case 382: /* db_options */
+ case 384: /* alter_db_options */
+ case 386: /* start_opt */
+ case 387: /* end_opt */
+ case 391: /* signed */
+ case 393: /* retention */
+ case 394: /* full_table_name */
+ case 397: /* table_options */
+ case 401: /* alter_table_clause */
+ case 402: /* alter_table_options */
+ case 405: /* signed_literal */
+ case 406: /* create_subtable_clause */
+ case 409: /* drop_table_clause */
+ case 411: /* column_def */
+ case 415: /* duration_literal */
+ case 416: /* rollup_func_name */
+ case 418: /* col_name */
+ case 421: /* like_pattern_opt */
+ case 422: /* db_name_cond_opt */
+ case 423: /* table_name_cond */
+ case 424: /* from_db_opt */
+ case 427: /* tag_item */
+ case 429: /* index_options */
+ case 430: /* full_index_name */
+ case 433: /* sliding_opt */
+ case 434: /* sma_stream_opt */
+ case 435: /* func */
+ case 438: /* query_or_subquery */
+ case 439: /* where_clause_opt */
+ case 442: /* explain_options */
+ case 443: /* insert_query */
+ case 448: /* full_view_name */
+ case 451: /* stream_options */
+ case 454: /* subtable_opt */
+ case 456: /* expression */
+ case 459: /* literal_func */
+ case 462: /* expr_or_subquery */
+ case 463: /* pseudo_column */
+ case 464: /* column_reference */
+ case 465: /* function_expression */
+ case 466: /* case_when_expression */
+ case 471: /* star_func_para */
+ case 473: /* case_when_else_opt */
+ case 474: /* common_expression */
+ case 475: /* when_then_expr */
+ case 476: /* predicate */
+ case 479: /* in_predicate_value */
+ case 480: /* boolean_value_expression */
+ case 481: /* boolean_primary */
+ case 482: /* from_clause_opt */
+ case 483: /* table_reference_list */
+ case 484: /* table_reference */
+ case 485: /* table_primary */
+ case 486: /* joined_table */
+ case 488: /* subquery */
+ case 489: /* parenthesized_joined_table */
+ case 492: /* join_on_clause_opt */
+ case 493: /* window_offset_clause_opt */
+ case 494: /* jlimit_clause_opt */
+ case 495: /* window_offset_literal */
+ case 496: /* query_specification */
+ case 502: /* range_opt */
+ case 503: /* every_opt */
+ case 504: /* fill_opt */
+ case 505: /* twindow_clause_opt */
+ case 507: /* having_clause_opt */
+ case 508: /* select_item */
+ case 510: /* partition_item */
+ case 511: /* interval_sliding_duration_literal */
+ case 514: /* query_expression */
+ case 515: /* query_simple */
+ case 517: /* slimit_clause_opt */
+ case 518: /* limit_clause_opt */
+ case 519: /* union_query_expression */
+ case 520: /* query_simple_or_subquery */
+ case 522: /* sort_specification */
{
- nodesDestroyNode((yypminor->yy1000));
+ nodesDestroyNode((yypminor->yy812));
}
break;
- 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 */
+ case 360: /* account_options */
+ case 361: /* alter_account_options */
+ case 363: /* alter_account_option */
+ case 385: /* speed_opt */
+ case 437: /* with_meta */
+ case 446: /* bufsize_opt */
{
}
break;
- 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 */
+ case 364: /* ip_range_list */
+ case 365: /* white_list */
+ case 366: /* white_list_opt */
+ case 388: /* integer_list */
+ case 389: /* variable_list */
+ case 390: /* retention_list */
+ case 395: /* column_def_list */
+ case 396: /* tags_def_opt */
+ case 398: /* multi_create_clause */
+ case 399: /* tags_def */
+ case 400: /* multi_drop_clause */
+ case 407: /* specific_cols_opt */
+ case 408: /* expression_list */
+ case 410: /* col_name_list */
+ case 412: /* duration_list */
+ case 413: /* rollup_func_list */
+ case 425: /* tag_list_opt */
+ case 432: /* func_list */
+ case 452: /* col_list_opt */
+ case 453: /* tag_def_or_ref_opt */
+ case 458: /* dnode_list */
+ case 460: /* literal_list */
+ case 468: /* star_func_para_list */
+ case 470: /* other_para_list */
+ case 472: /* when_then_list */
+ case 497: /* hint_list */
+ case 500: /* select_list */
+ case 501: /* partition_by_clause_opt */
+ case 506: /* group_by_clause_opt */
+ case 509: /* partition_list */
+ case 513: /* group_by_list */
+ case 516: /* order_by_clause_opt */
+ case 521: /* sort_specification_list */
{
- nodesDestroyList((yypminor->yy72));
+ nodesDestroyList((yypminor->yy124));
}
break;
- 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 */
+ case 367: /* user_name */
+ case 374: /* db_name */
+ case 375: /* table_name */
+ case 376: /* topic_name */
+ case 378: /* dnode_endpoint */
+ case 403: /* column_name */
+ case 417: /* function_name */
+ case 428: /* column_alias */
+ case 431: /* index_name */
+ case 436: /* sma_func_name */
+ case 440: /* cgroup_name */
+ case 447: /* language_opt */
+ case 449: /* view_name */
+ case 450: /* stream_name */
+ case 457: /* on_vgroup_id */
+ case 461: /* table_alias */
+ case 467: /* star_func */
+ case 469: /* noarg_func */
+ case 487: /* alias_opt */
{
}
break;
- case 367: /* sysinfo_opt */
+ case 368: /* sysinfo_opt */
{
}
break;
- case 368: /* privileges */
- case 371: /* priv_type_list */
- case 372: /* priv_type */
+ case 369: /* privileges */
+ case 372: /* priv_type_list */
+ case 373: /* priv_type */
{
}
break;
- case 369: /* priv_level */
+ case 370: /* priv_level */
{
}
break;
- 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 */
+ case 379: /* force_opt */
+ case 380: /* unsafe_opt */
+ case 381: /* not_exists_opt */
+ case 383: /* exists_opt */
+ case 441: /* analyze_opt */
+ case 444: /* or_replace_opt */
+ case 445: /* agg_func_opt */
+ case 455: /* ignore_opt */
+ case 498: /* set_quantifier_opt */
+ case 499: /* tag_mode_opt */
{
}
break;
- case 391: /* alter_db_option */
- case 413: /* alter_table_option */
+ case 392: /* alter_db_option */
+ case 414: /* alter_table_option */
{
}
break;
- case 403: /* type_name */
+ case 404: /* type_name */
{
}
break;
- case 418: /* db_kind_opt */
- case 425: /* table_kind */
+ case 419: /* db_kind_opt */
+ case 426: /* table_kind */
{
}
break;
- case 419: /* table_kind_db_name_cond_opt */
+ case 420: /* table_kind_db_name_cond_opt */
{
}
break;
- case 476: /* compare_op */
- case 477: /* in_op */
+ case 477: /* compare_op */
+ case 478: /* in_op */
{
}
break;
- case 489: /* join_type */
+ case 490: /* join_type */
{
}
break;
- case 490: /* join_subtype */
+ case 491: /* join_subtype */
{
}
break;
- case 511: /* fill_mode */
+ case 512: /* fill_mode */
{
}
break;
- case 522: /* ordering_specification_opt */
+ case 523: /* ordering_specification_opt */
{
}
break;
- case 523: /* null_ordering_opt */
+ case 524: /* null_ordering_opt */
{
}
@@ -3379,670 +3409,672 @@ static void yy_shift(
/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
** of that rule */
static const YYCODETYPE yyRuleInfoLhs[] = {
- 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 */
+ 359, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
+ 359, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
+ 360, /* (2) account_options ::= */
+ 360, /* (3) account_options ::= account_options PPS literal */
+ 360, /* (4) account_options ::= account_options TSERIES literal */
+ 360, /* (5) account_options ::= account_options STORAGE literal */
+ 360, /* (6) account_options ::= account_options STREAMS literal */
+ 360, /* (7) account_options ::= account_options QTIME literal */
+ 360, /* (8) account_options ::= account_options DBS literal */
+ 360, /* (9) account_options ::= account_options USERS literal */
+ 360, /* (10) account_options ::= account_options CONNS literal */
+ 360, /* (11) account_options ::= account_options STATE literal */
+ 361, /* (12) alter_account_options ::= alter_account_option */
+ 361, /* (13) alter_account_options ::= alter_account_options alter_account_option */
+ 363, /* (14) alter_account_option ::= PASS literal */
+ 363, /* (15) alter_account_option ::= PPS literal */
+ 363, /* (16) alter_account_option ::= TSERIES literal */
+ 363, /* (17) alter_account_option ::= STORAGE literal */
+ 363, /* (18) alter_account_option ::= STREAMS literal */
+ 363, /* (19) alter_account_option ::= QTIME literal */
+ 363, /* (20) alter_account_option ::= DBS literal */
+ 363, /* (21) alter_account_option ::= USERS literal */
+ 363, /* (22) alter_account_option ::= CONNS literal */
+ 363, /* (23) alter_account_option ::= STATE literal */
+ 364, /* (24) ip_range_list ::= NK_STRING */
+ 364, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */
+ 365, /* (26) white_list ::= HOST ip_range_list */
+ 366, /* (27) white_list_opt ::= */
+ 366, /* (28) white_list_opt ::= white_list */
+ 359, /* (29) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt white_list_opt */
+ 359, /* (30) cmd ::= ALTER USER user_name PASS NK_STRING */
+ 359, /* (31) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
+ 359, /* (32) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
+ 359, /* (33) cmd ::= ALTER USER user_name ADD white_list */
+ 359, /* (34) cmd ::= ALTER USER user_name DROP white_list */
+ 359, /* (35) cmd ::= DROP USER user_name */
+ 368, /* (36) sysinfo_opt ::= */
+ 368, /* (37) sysinfo_opt ::= SYSINFO NK_INTEGER */
+ 359, /* (38) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */
+ 359, /* (39) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */
+ 369, /* (40) privileges ::= ALL */
+ 369, /* (41) privileges ::= priv_type_list */
+ 369, /* (42) privileges ::= SUBSCRIBE */
+ 372, /* (43) priv_type_list ::= priv_type */
+ 372, /* (44) priv_type_list ::= priv_type_list NK_COMMA priv_type */
+ 373, /* (45) priv_type ::= READ */
+ 373, /* (46) priv_type ::= WRITE */
+ 373, /* (47) priv_type ::= ALTER */
+ 370, /* (48) priv_level ::= NK_STAR NK_DOT NK_STAR */
+ 370, /* (49) priv_level ::= db_name NK_DOT NK_STAR */
+ 370, /* (50) priv_level ::= db_name NK_DOT table_name */
+ 370, /* (51) priv_level ::= topic_name */
+ 371, /* (52) with_opt ::= */
+ 371, /* (53) with_opt ::= WITH search_condition */
+ 359, /* (54) cmd ::= CREATE DNODE dnode_endpoint */
+ 359, /* (55) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
+ 359, /* (56) cmd ::= DROP DNODE NK_INTEGER force_opt */
+ 359, /* (57) cmd ::= DROP DNODE dnode_endpoint force_opt */
+ 359, /* (58) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */
+ 359, /* (59) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */
+ 359, /* (60) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
+ 359, /* (61) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
+ 359, /* (62) cmd ::= ALTER ALL DNODES NK_STRING */
+ 359, /* (63) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
+ 359, /* (64) cmd ::= RESTORE DNODE NK_INTEGER */
+ 378, /* (65) dnode_endpoint ::= NK_STRING */
+ 378, /* (66) dnode_endpoint ::= NK_ID */
+ 378, /* (67) dnode_endpoint ::= NK_IPTOKEN */
+ 379, /* (68) force_opt ::= */
+ 379, /* (69) force_opt ::= FORCE */
+ 380, /* (70) unsafe_opt ::= UNSAFE */
+ 359, /* (71) cmd ::= ALTER CLUSTER NK_STRING */
+ 359, /* (72) cmd ::= ALTER CLUSTER NK_STRING NK_STRING */
+ 359, /* (73) cmd ::= ALTER LOCAL NK_STRING */
+ 359, /* (74) cmd ::= ALTER LOCAL NK_STRING NK_STRING */
+ 359, /* (75) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
+ 359, /* (76) cmd ::= DROP QNODE ON DNODE NK_INTEGER */
+ 359, /* (77) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */
+ 359, /* (78) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
+ 359, /* (79) cmd ::= DROP BNODE ON DNODE NK_INTEGER */
+ 359, /* (80) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
+ 359, /* (81) cmd ::= DROP SNODE ON DNODE NK_INTEGER */
+ 359, /* (82) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
+ 359, /* (83) cmd ::= DROP MNODE ON DNODE NK_INTEGER */
+ 359, /* (84) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */
+ 359, /* (85) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */
+ 359, /* (86) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
+ 359, /* (87) cmd ::= DROP DATABASE exists_opt db_name */
+ 359, /* (88) cmd ::= USE db_name */
+ 359, /* (89) cmd ::= ALTER DATABASE db_name alter_db_options */
+ 359, /* (90) cmd ::= FLUSH DATABASE db_name */
+ 359, /* (91) cmd ::= TRIM DATABASE db_name speed_opt */
+ 359, /* (92) cmd ::= COMPACT DATABASE db_name start_opt end_opt */
+ 381, /* (93) not_exists_opt ::= IF NOT EXISTS */
+ 381, /* (94) not_exists_opt ::= */
+ 383, /* (95) exists_opt ::= IF EXISTS */
+ 383, /* (96) exists_opt ::= */
+ 382, /* (97) db_options ::= */
+ 382, /* (98) db_options ::= db_options BUFFER NK_INTEGER */
+ 382, /* (99) db_options ::= db_options CACHEMODEL NK_STRING */
+ 382, /* (100) db_options ::= db_options CACHESIZE NK_INTEGER */
+ 382, /* (101) db_options ::= db_options COMP NK_INTEGER */
+ 382, /* (102) db_options ::= db_options DURATION NK_INTEGER */
+ 382, /* (103) db_options ::= db_options DURATION NK_VARIABLE */
+ 382, /* (104) db_options ::= db_options MAXROWS NK_INTEGER */
+ 382, /* (105) db_options ::= db_options MINROWS NK_INTEGER */
+ 382, /* (106) db_options ::= db_options KEEP integer_list */
+ 382, /* (107) db_options ::= db_options KEEP variable_list */
+ 382, /* (108) db_options ::= db_options PAGES NK_INTEGER */
+ 382, /* (109) db_options ::= db_options PAGESIZE NK_INTEGER */
+ 382, /* (110) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
+ 382, /* (111) db_options ::= db_options PRECISION NK_STRING */
+ 382, /* (112) db_options ::= db_options REPLICA NK_INTEGER */
+ 382, /* (113) db_options ::= db_options VGROUPS NK_INTEGER */
+ 382, /* (114) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
+ 382, /* (115) db_options ::= db_options RETENTIONS retention_list */
+ 382, /* (116) db_options ::= db_options SCHEMALESS NK_INTEGER */
+ 382, /* (117) db_options ::= db_options WAL_LEVEL NK_INTEGER */
+ 382, /* (118) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
+ 382, /* (119) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
+ 382, /* (120) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
+ 382, /* (121) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
+ 382, /* (122) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
+ 382, /* (123) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
+ 382, /* (124) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
+ 382, /* (125) db_options ::= db_options STT_TRIGGER NK_INTEGER */
+ 382, /* (126) db_options ::= db_options TABLE_PREFIX signed */
+ 382, /* (127) db_options ::= db_options TABLE_SUFFIX signed */
+ 382, /* (128) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */
+ 384, /* (129) alter_db_options ::= alter_db_option */
+ 384, /* (130) alter_db_options ::= alter_db_options alter_db_option */
+ 392, /* (131) alter_db_option ::= BUFFER NK_INTEGER */
+ 392, /* (132) alter_db_option ::= CACHEMODEL NK_STRING */
+ 392, /* (133) alter_db_option ::= CACHESIZE NK_INTEGER */
+ 392, /* (134) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
+ 392, /* (135) alter_db_option ::= KEEP integer_list */
+ 392, /* (136) alter_db_option ::= KEEP variable_list */
+ 392, /* (137) alter_db_option ::= PAGES NK_INTEGER */
+ 392, /* (138) alter_db_option ::= REPLICA NK_INTEGER */
+ 392, /* (139) alter_db_option ::= WAL_LEVEL NK_INTEGER */
+ 392, /* (140) alter_db_option ::= STT_TRIGGER NK_INTEGER */
+ 392, /* (141) alter_db_option ::= MINROWS NK_INTEGER */
+ 392, /* (142) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */
+ 392, /* (143) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
+ 392, /* (144) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */
+ 392, /* (145) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
+ 392, /* (146) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */
+ 388, /* (147) integer_list ::= NK_INTEGER */
+ 388, /* (148) integer_list ::= integer_list NK_COMMA NK_INTEGER */
+ 389, /* (149) variable_list ::= NK_VARIABLE */
+ 389, /* (150) variable_list ::= variable_list NK_COMMA NK_VARIABLE */
+ 390, /* (151) retention_list ::= retention */
+ 390, /* (152) retention_list ::= retention_list NK_COMMA retention */
+ 393, /* (153) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
+ 393, /* (154) retention ::= NK_MINUS NK_COLON NK_VARIABLE */
+ 385, /* (155) speed_opt ::= */
+ 385, /* (156) speed_opt ::= BWLIMIT NK_INTEGER */
+ 386, /* (157) start_opt ::= */
+ 386, /* (158) start_opt ::= START WITH NK_INTEGER */
+ 386, /* (159) start_opt ::= START WITH NK_STRING */
+ 386, /* (160) start_opt ::= START WITH TIMESTAMP NK_STRING */
+ 387, /* (161) end_opt ::= */
+ 387, /* (162) end_opt ::= END WITH NK_INTEGER */
+ 387, /* (163) end_opt ::= END WITH NK_STRING */
+ 387, /* (164) end_opt ::= END WITH TIMESTAMP NK_STRING */
+ 359, /* (165) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
+ 359, /* (166) cmd ::= CREATE TABLE multi_create_clause */
+ 359, /* (167) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
+ 359, /* (168) cmd ::= DROP TABLE multi_drop_clause */
+ 359, /* (169) cmd ::= DROP STABLE exists_opt full_table_name */
+ 359, /* (170) cmd ::= ALTER TABLE alter_table_clause */
+ 359, /* (171) cmd ::= ALTER STABLE alter_table_clause */
+ 401, /* (172) alter_table_clause ::= full_table_name alter_table_options */
+ 401, /* (173) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
+ 401, /* (174) alter_table_clause ::= full_table_name DROP COLUMN column_name */
+ 401, /* (175) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
+ 401, /* (176) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
+ 401, /* (177) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
+ 401, /* (178) alter_table_clause ::= full_table_name DROP TAG column_name */
+ 401, /* (179) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
+ 401, /* (180) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
+ 401, /* (181) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
+ 398, /* (182) multi_create_clause ::= create_subtable_clause */
+ 398, /* (183) multi_create_clause ::= multi_create_clause create_subtable_clause */
+ 406, /* (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 */
+ 400, /* (185) multi_drop_clause ::= drop_table_clause */
+ 400, /* (186) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */
+ 409, /* (187) drop_table_clause ::= exists_opt full_table_name */
+ 407, /* (188) specific_cols_opt ::= */
+ 407, /* (189) specific_cols_opt ::= NK_LP col_name_list NK_RP */
+ 394, /* (190) full_table_name ::= table_name */
+ 394, /* (191) full_table_name ::= db_name NK_DOT table_name */
+ 395, /* (192) column_def_list ::= column_def */
+ 395, /* (193) column_def_list ::= column_def_list NK_COMMA column_def */
+ 411, /* (194) column_def ::= column_name type_name */
+ 404, /* (195) type_name ::= BOOL */
+ 404, /* (196) type_name ::= TINYINT */
+ 404, /* (197) type_name ::= SMALLINT */
+ 404, /* (198) type_name ::= INT */
+ 404, /* (199) type_name ::= INTEGER */
+ 404, /* (200) type_name ::= BIGINT */
+ 404, /* (201) type_name ::= FLOAT */
+ 404, /* (202) type_name ::= DOUBLE */
+ 404, /* (203) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
+ 404, /* (204) type_name ::= TIMESTAMP */
+ 404, /* (205) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
+ 404, /* (206) type_name ::= TINYINT UNSIGNED */
+ 404, /* (207) type_name ::= SMALLINT UNSIGNED */
+ 404, /* (208) type_name ::= INT UNSIGNED */
+ 404, /* (209) type_name ::= BIGINT UNSIGNED */
+ 404, /* (210) type_name ::= JSON */
+ 404, /* (211) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
+ 404, /* (212) type_name ::= MEDIUMBLOB */
+ 404, /* (213) type_name ::= BLOB */
+ 404, /* (214) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
+ 404, /* (215) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */
+ 404, /* (216) type_name ::= DECIMAL */
+ 404, /* (217) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
+ 404, /* (218) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+ 396, /* (219) tags_def_opt ::= */
+ 396, /* (220) tags_def_opt ::= tags_def */
+ 399, /* (221) tags_def ::= TAGS NK_LP column_def_list NK_RP */
+ 397, /* (222) table_options ::= */
+ 397, /* (223) table_options ::= table_options COMMENT NK_STRING */
+ 397, /* (224) table_options ::= table_options MAX_DELAY duration_list */
+ 397, /* (225) table_options ::= table_options WATERMARK duration_list */
+ 397, /* (226) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
+ 397, /* (227) table_options ::= table_options TTL NK_INTEGER */
+ 397, /* (228) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
+ 397, /* (229) table_options ::= table_options DELETE_MARK duration_list */
+ 402, /* (230) alter_table_options ::= alter_table_option */
+ 402, /* (231) alter_table_options ::= alter_table_options alter_table_option */
+ 414, /* (232) alter_table_option ::= COMMENT NK_STRING */
+ 414, /* (233) alter_table_option ::= TTL NK_INTEGER */
+ 412, /* (234) duration_list ::= duration_literal */
+ 412, /* (235) duration_list ::= duration_list NK_COMMA duration_literal */
+ 413, /* (236) rollup_func_list ::= rollup_func_name */
+ 413, /* (237) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */
+ 416, /* (238) rollup_func_name ::= function_name */
+ 416, /* (239) rollup_func_name ::= FIRST */
+ 416, /* (240) rollup_func_name ::= LAST */
+ 410, /* (241) col_name_list ::= col_name */
+ 410, /* (242) col_name_list ::= col_name_list NK_COMMA col_name */
+ 418, /* (243) col_name ::= column_name */
+ 359, /* (244) cmd ::= SHOW DNODES */
+ 359, /* (245) cmd ::= SHOW USERS */
+ 359, /* (246) cmd ::= SHOW USER PRIVILEGES */
+ 359, /* (247) cmd ::= SHOW db_kind_opt DATABASES */
+ 359, /* (248) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */
+ 359, /* (249) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
+ 359, /* (250) cmd ::= SHOW db_name_cond_opt VGROUPS */
+ 359, /* (251) cmd ::= SHOW MNODES */
+ 359, /* (252) cmd ::= SHOW QNODES */
+ 359, /* (253) cmd ::= SHOW FUNCTIONS */
+ 359, /* (254) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
+ 359, /* (255) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */
+ 359, /* (256) cmd ::= SHOW STREAMS */
+ 359, /* (257) cmd ::= SHOW ACCOUNTS */
+ 359, /* (258) cmd ::= SHOW APPS */
+ 359, /* (259) cmd ::= SHOW CONNECTIONS */
+ 359, /* (260) cmd ::= SHOW LICENCES */
+ 359, /* (261) cmd ::= SHOW GRANTS */
+ 359, /* (262) cmd ::= SHOW GRANTS FULL */
+ 359, /* (263) cmd ::= SHOW GRANTS LOGS */
+ 359, /* (264) cmd ::= SHOW CLUSTER MACHINES */
+ 359, /* (265) cmd ::= SHOW CREATE DATABASE db_name */
+ 359, /* (266) cmd ::= SHOW CREATE TABLE full_table_name */
+ 359, /* (267) cmd ::= SHOW CREATE STABLE full_table_name */
+ 359, /* (268) cmd ::= SHOW QUERIES */
+ 359, /* (269) cmd ::= SHOW SCORES */
+ 359, /* (270) cmd ::= SHOW TOPICS */
+ 359, /* (271) cmd ::= SHOW VARIABLES */
+ 359, /* (272) cmd ::= SHOW CLUSTER VARIABLES */
+ 359, /* (273) cmd ::= SHOW LOCAL VARIABLES */
+ 359, /* (274) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
+ 359, /* (275) cmd ::= SHOW BNODES */
+ 359, /* (276) cmd ::= SHOW SNODES */
+ 359, /* (277) cmd ::= SHOW CLUSTER */
+ 359, /* (278) cmd ::= SHOW TRANSACTIONS */
+ 359, /* (279) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
+ 359, /* (280) cmd ::= SHOW CONSUMERS */
+ 359, /* (281) cmd ::= SHOW SUBSCRIPTIONS */
+ 359, /* (282) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
+ 359, /* (283) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */
+ 359, /* (284) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
+ 359, /* (285) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */
+ 359, /* (286) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */
+ 359, /* (287) cmd ::= SHOW VNODES */
+ 359, /* (288) cmd ::= SHOW db_name_cond_opt ALIVE */
+ 359, /* (289) cmd ::= SHOW CLUSTER ALIVE */
+ 359, /* (290) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */
+ 359, /* (291) cmd ::= SHOW CREATE VIEW full_table_name */
+ 359, /* (292) cmd ::= SHOW COMPACTS */
+ 359, /* (293) cmd ::= SHOW COMPACT NK_INTEGER */
+ 420, /* (294) table_kind_db_name_cond_opt ::= */
+ 420, /* (295) table_kind_db_name_cond_opt ::= table_kind */
+ 420, /* (296) table_kind_db_name_cond_opt ::= db_name NK_DOT */
+ 420, /* (297) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */
+ 426, /* (298) table_kind ::= NORMAL */
+ 426, /* (299) table_kind ::= CHILD */
+ 422, /* (300) db_name_cond_opt ::= */
+ 422, /* (301) db_name_cond_opt ::= db_name NK_DOT */
+ 421, /* (302) like_pattern_opt ::= */
+ 421, /* (303) like_pattern_opt ::= LIKE NK_STRING */
+ 423, /* (304) table_name_cond ::= table_name */
+ 424, /* (305) from_db_opt ::= */
+ 424, /* (306) from_db_opt ::= FROM db_name */
+ 425, /* (307) tag_list_opt ::= */
+ 425, /* (308) tag_list_opt ::= tag_item */
+ 425, /* (309) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */
+ 427, /* (310) tag_item ::= TBNAME */
+ 427, /* (311) tag_item ::= QTAGS */
+ 427, /* (312) tag_item ::= column_name */
+ 427, /* (313) tag_item ::= column_name column_alias */
+ 427, /* (314) tag_item ::= column_name AS column_alias */
+ 419, /* (315) db_kind_opt ::= */
+ 419, /* (316) db_kind_opt ::= USER */
+ 419, /* (317) db_kind_opt ::= SYSTEM */
+ 359, /* (318) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */
+ 359, /* (319) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */
+ 359, /* (320) cmd ::= DROP INDEX exists_opt full_index_name */
+ 430, /* (321) full_index_name ::= index_name */
+ 430, /* (322) full_index_name ::= db_name NK_DOT index_name */
+ 429, /* (323) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
+ 429, /* (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 */
+ 432, /* (325) func_list ::= func */
+ 432, /* (326) func_list ::= func_list NK_COMMA func */
+ 435, /* (327) func ::= sma_func_name NK_LP expression_list NK_RP */
+ 436, /* (328) sma_func_name ::= function_name */
+ 436, /* (329) sma_func_name ::= COUNT */
+ 436, /* (330) sma_func_name ::= FIRST */
+ 436, /* (331) sma_func_name ::= LAST */
+ 436, /* (332) sma_func_name ::= LAST_ROW */
+ 434, /* (333) sma_stream_opt ::= */
+ 434, /* (334) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
+ 434, /* (335) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
+ 434, /* (336) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
+ 437, /* (337) with_meta ::= AS */
+ 437, /* (338) with_meta ::= WITH META AS */
+ 437, /* (339) with_meta ::= ONLY META AS */
+ 359, /* (340) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
+ 359, /* (341) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */
+ 359, /* (342) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */
+ 359, /* (343) cmd ::= DROP TOPIC exists_opt topic_name */
+ 359, /* (344) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
+ 359, /* (345) cmd ::= DESC full_table_name */
+ 359, /* (346) cmd ::= DESCRIBE full_table_name */
+ 359, /* (347) cmd ::= RESET QUERY CACHE */
+ 359, /* (348) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
+ 359, /* (349) cmd ::= EXPLAIN analyze_opt explain_options insert_query */
+ 441, /* (350) analyze_opt ::= */
+ 441, /* (351) analyze_opt ::= ANALYZE */
+ 442, /* (352) explain_options ::= */
+ 442, /* (353) explain_options ::= explain_options VERBOSE NK_BOOL */
+ 442, /* (354) explain_options ::= explain_options RATIO NK_FLOAT */
+ 359, /* (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 */
+ 359, /* (356) cmd ::= DROP FUNCTION exists_opt function_name */
+ 445, /* (357) agg_func_opt ::= */
+ 445, /* (358) agg_func_opt ::= AGGREGATE */
+ 446, /* (359) bufsize_opt ::= */
+ 446, /* (360) bufsize_opt ::= BUFSIZE NK_INTEGER */
+ 447, /* (361) language_opt ::= */
+ 447, /* (362) language_opt ::= LANGUAGE NK_STRING */
+ 444, /* (363) or_replace_opt ::= */
+ 444, /* (364) or_replace_opt ::= OR REPLACE */
+ 359, /* (365) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */
+ 359, /* (366) cmd ::= DROP VIEW exists_opt full_view_name */
+ 448, /* (367) full_view_name ::= view_name */
+ 448, /* (368) full_view_name ::= db_name NK_DOT view_name */
+ 359, /* (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 */
+ 359, /* (370) cmd ::= DROP STREAM exists_opt stream_name */
+ 359, /* (371) cmd ::= PAUSE STREAM exists_opt stream_name */
+ 359, /* (372) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */
+ 452, /* (373) col_list_opt ::= */
+ 452, /* (374) col_list_opt ::= NK_LP col_name_list NK_RP */
+ 453, /* (375) tag_def_or_ref_opt ::= */
+ 453, /* (376) tag_def_or_ref_opt ::= tags_def */
+ 453, /* (377) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */
+ 451, /* (378) stream_options ::= */
+ 451, /* (379) stream_options ::= stream_options TRIGGER AT_ONCE */
+ 451, /* (380) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
+ 451, /* (381) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
+ 451, /* (382) stream_options ::= stream_options WATERMARK duration_literal */
+ 451, /* (383) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
+ 451, /* (384) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
+ 451, /* (385) stream_options ::= stream_options DELETE_MARK duration_literal */
+ 451, /* (386) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
+ 454, /* (387) subtable_opt ::= */
+ 454, /* (388) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
+ 455, /* (389) ignore_opt ::= */
+ 455, /* (390) ignore_opt ::= IGNORE UNTREATED */
+ 359, /* (391) cmd ::= KILL CONNECTION NK_INTEGER */
+ 359, /* (392) cmd ::= KILL QUERY NK_STRING */
+ 359, /* (393) cmd ::= KILL TRANSACTION NK_INTEGER */
+ 359, /* (394) cmd ::= KILL COMPACT NK_INTEGER */
+ 359, /* (395) cmd ::= BALANCE VGROUP */
+ 359, /* (396) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */
+ 359, /* (397) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
+ 359, /* (398) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+ 359, /* (399) cmd ::= SPLIT VGROUP NK_INTEGER */
+ 457, /* (400) on_vgroup_id ::= */
+ 457, /* (401) on_vgroup_id ::= ON NK_INTEGER */
+ 458, /* (402) dnode_list ::= DNODE NK_INTEGER */
+ 458, /* (403) dnode_list ::= dnode_list DNODE NK_INTEGER */
+ 359, /* (404) cmd ::= DELETE FROM full_table_name where_clause_opt */
+ 359, /* (405) cmd ::= query_or_subquery */
+ 359, /* (406) cmd ::= insert_query */
+ 443, /* (407) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
+ 443, /* (408) insert_query ::= INSERT INTO full_table_name query_or_subquery */
+ 362, /* (409) literal ::= NK_INTEGER */
+ 362, /* (410) literal ::= NK_FLOAT */
+ 362, /* (411) literal ::= NK_STRING */
+ 362, /* (412) literal ::= NK_BOOL */
+ 362, /* (413) literal ::= TIMESTAMP NK_STRING */
+ 362, /* (414) literal ::= duration_literal */
+ 362, /* (415) literal ::= NULL */
+ 362, /* (416) literal ::= NK_QUESTION */
+ 415, /* (417) duration_literal ::= NK_VARIABLE */
+ 391, /* (418) signed ::= NK_INTEGER */
+ 391, /* (419) signed ::= NK_PLUS NK_INTEGER */
+ 391, /* (420) signed ::= NK_MINUS NK_INTEGER */
+ 391, /* (421) signed ::= NK_FLOAT */
+ 391, /* (422) signed ::= NK_PLUS NK_FLOAT */
+ 391, /* (423) signed ::= NK_MINUS NK_FLOAT */
+ 405, /* (424) signed_literal ::= signed */
+ 405, /* (425) signed_literal ::= NK_STRING */
+ 405, /* (426) signed_literal ::= NK_BOOL */
+ 405, /* (427) signed_literal ::= TIMESTAMP NK_STRING */
+ 405, /* (428) signed_literal ::= duration_literal */
+ 405, /* (429) signed_literal ::= NULL */
+ 405, /* (430) signed_literal ::= literal_func */
+ 405, /* (431) signed_literal ::= NK_QUESTION */
+ 460, /* (432) literal_list ::= signed_literal */
+ 460, /* (433) literal_list ::= literal_list NK_COMMA signed_literal */
+ 374, /* (434) db_name ::= NK_ID */
+ 375, /* (435) table_name ::= NK_ID */
+ 403, /* (436) column_name ::= NK_ID */
+ 417, /* (437) function_name ::= NK_ID */
+ 449, /* (438) view_name ::= NK_ID */
+ 461, /* (439) table_alias ::= NK_ID */
+ 428, /* (440) column_alias ::= NK_ID */
+ 428, /* (441) column_alias ::= NK_ALIAS */
+ 367, /* (442) user_name ::= NK_ID */
+ 376, /* (443) topic_name ::= NK_ID */
+ 450, /* (444) stream_name ::= NK_ID */
+ 440, /* (445) cgroup_name ::= NK_ID */
+ 431, /* (446) index_name ::= NK_ID */
+ 462, /* (447) expr_or_subquery ::= expression */
+ 456, /* (448) expression ::= literal */
+ 456, /* (449) expression ::= pseudo_column */
+ 456, /* (450) expression ::= column_reference */
+ 456, /* (451) expression ::= function_expression */
+ 456, /* (452) expression ::= case_when_expression */
+ 456, /* (453) expression ::= NK_LP expression NK_RP */
+ 456, /* (454) expression ::= NK_PLUS expr_or_subquery */
+ 456, /* (455) expression ::= NK_MINUS expr_or_subquery */
+ 456, /* (456) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
+ 456, /* (457) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
+ 456, /* (458) expression ::= expr_or_subquery NK_STAR expr_or_subquery */
+ 456, /* (459) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
+ 456, /* (460) expression ::= expr_or_subquery NK_REM expr_or_subquery */
+ 456, /* (461) expression ::= column_reference NK_ARROW NK_STRING */
+ 456, /* (462) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
+ 456, /* (463) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
+ 408, /* (464) expression_list ::= expr_or_subquery */
+ 408, /* (465) expression_list ::= expression_list NK_COMMA expr_or_subquery */
+ 464, /* (466) column_reference ::= column_name */
+ 464, /* (467) column_reference ::= table_name NK_DOT column_name */
+ 464, /* (468) column_reference ::= NK_ALIAS */
+ 464, /* (469) column_reference ::= table_name NK_DOT NK_ALIAS */
+ 463, /* (470) pseudo_column ::= ROWTS */
+ 463, /* (471) pseudo_column ::= TBNAME */
+ 463, /* (472) pseudo_column ::= table_name NK_DOT TBNAME */
+ 463, /* (473) pseudo_column ::= QSTART */
+ 463, /* (474) pseudo_column ::= QEND */
+ 463, /* (475) pseudo_column ::= QDURATION */
+ 463, /* (476) pseudo_column ::= WSTART */
+ 463, /* (477) pseudo_column ::= WEND */
+ 463, /* (478) pseudo_column ::= WDURATION */
+ 463, /* (479) pseudo_column ::= IROWTS */
+ 463, /* (480) pseudo_column ::= ISFILLED */
+ 463, /* (481) pseudo_column ::= QTAGS */
+ 465, /* (482) function_expression ::= function_name NK_LP expression_list NK_RP */
+ 465, /* (483) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
+ 465, /* (484) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
+ 465, /* (485) function_expression ::= literal_func */
+ 459, /* (486) literal_func ::= noarg_func NK_LP NK_RP */
+ 459, /* (487) literal_func ::= NOW */
+ 469, /* (488) noarg_func ::= NOW */
+ 469, /* (489) noarg_func ::= TODAY */
+ 469, /* (490) noarg_func ::= TIMEZONE */
+ 469, /* (491) noarg_func ::= DATABASE */
+ 469, /* (492) noarg_func ::= CLIENT_VERSION */
+ 469, /* (493) noarg_func ::= SERVER_VERSION */
+ 469, /* (494) noarg_func ::= SERVER_STATUS */
+ 469, /* (495) noarg_func ::= CURRENT_USER */
+ 469, /* (496) noarg_func ::= USER */
+ 467, /* (497) star_func ::= COUNT */
+ 467, /* (498) star_func ::= FIRST */
+ 467, /* (499) star_func ::= LAST */
+ 467, /* (500) star_func ::= LAST_ROW */
+ 468, /* (501) star_func_para_list ::= NK_STAR */
+ 468, /* (502) star_func_para_list ::= other_para_list */
+ 470, /* (503) other_para_list ::= star_func_para */
+ 470, /* (504) other_para_list ::= other_para_list NK_COMMA star_func_para */
+ 471, /* (505) star_func_para ::= expr_or_subquery */
+ 471, /* (506) star_func_para ::= table_name NK_DOT NK_STAR */
+ 466, /* (507) case_when_expression ::= CASE when_then_list case_when_else_opt END */
+ 466, /* (508) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
+ 472, /* (509) when_then_list ::= when_then_expr */
+ 472, /* (510) when_then_list ::= when_then_list when_then_expr */
+ 475, /* (511) when_then_expr ::= WHEN common_expression THEN common_expression */
+ 473, /* (512) case_when_else_opt ::= */
+ 473, /* (513) case_when_else_opt ::= ELSE common_expression */
+ 476, /* (514) predicate ::= expr_or_subquery compare_op expr_or_subquery */
+ 476, /* (515) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
+ 476, /* (516) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
+ 476, /* (517) predicate ::= expr_or_subquery IS NULL */
+ 476, /* (518) predicate ::= expr_or_subquery IS NOT NULL */
+ 476, /* (519) predicate ::= expr_or_subquery in_op in_predicate_value */
+ 477, /* (520) compare_op ::= NK_LT */
+ 477, /* (521) compare_op ::= NK_GT */
+ 477, /* (522) compare_op ::= NK_LE */
+ 477, /* (523) compare_op ::= NK_GE */
+ 477, /* (524) compare_op ::= NK_NE */
+ 477, /* (525) compare_op ::= NK_EQ */
+ 477, /* (526) compare_op ::= LIKE */
+ 477, /* (527) compare_op ::= NOT LIKE */
+ 477, /* (528) compare_op ::= MATCH */
+ 477, /* (529) compare_op ::= NMATCH */
+ 477, /* (530) compare_op ::= CONTAINS */
+ 478, /* (531) in_op ::= IN */
+ 478, /* (532) in_op ::= NOT IN */
+ 479, /* (533) in_predicate_value ::= NK_LP literal_list NK_RP */
+ 480, /* (534) boolean_value_expression ::= boolean_primary */
+ 480, /* (535) boolean_value_expression ::= NOT boolean_primary */
+ 480, /* (536) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ 480, /* (537) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ 481, /* (538) boolean_primary ::= predicate */
+ 481, /* (539) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
+ 474, /* (540) common_expression ::= expr_or_subquery */
+ 474, /* (541) common_expression ::= boolean_value_expression */
+ 482, /* (542) from_clause_opt ::= */
+ 482, /* (543) from_clause_opt ::= FROM table_reference_list */
+ 483, /* (544) table_reference_list ::= table_reference */
+ 483, /* (545) table_reference_list ::= table_reference_list NK_COMMA table_reference */
+ 484, /* (546) table_reference ::= table_primary */
+ 484, /* (547) table_reference ::= joined_table */
+ 485, /* (548) table_primary ::= table_name alias_opt */
+ 485, /* (549) table_primary ::= db_name NK_DOT table_name alias_opt */
+ 485, /* (550) table_primary ::= subquery alias_opt */
+ 485, /* (551) table_primary ::= parenthesized_joined_table */
+ 487, /* (552) alias_opt ::= */
+ 487, /* (553) alias_opt ::= table_alias */
+ 487, /* (554) alias_opt ::= AS table_alias */
+ 489, /* (555) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ 489, /* (556) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
+ 486, /* (557) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */
+ 490, /* (558) join_type ::= */
+ 490, /* (559) join_type ::= INNER */
+ 490, /* (560) join_type ::= LEFT */
+ 490, /* (561) join_type ::= RIGHT */
+ 490, /* (562) join_type ::= FULL */
+ 491, /* (563) join_subtype ::= */
+ 491, /* (564) join_subtype ::= OUTER */
+ 491, /* (565) join_subtype ::= SEMI */
+ 491, /* (566) join_subtype ::= ANTI */
+ 491, /* (567) join_subtype ::= ASOF */
+ 491, /* (568) join_subtype ::= WINDOW */
+ 492, /* (569) join_on_clause_opt ::= */
+ 492, /* (570) join_on_clause_opt ::= ON search_condition */
+ 493, /* (571) window_offset_clause_opt ::= */
+ 493, /* (572) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */
+ 495, /* (573) window_offset_literal ::= NK_VARIABLE */
+ 495, /* (574) window_offset_literal ::= NK_MINUS NK_VARIABLE */
+ 494, /* (575) jlimit_clause_opt ::= */
+ 494, /* (576) jlimit_clause_opt ::= JLIMIT NK_INTEGER */
+ 496, /* (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 */
+ 497, /* (578) hint_list ::= */
+ 497, /* (579) hint_list ::= NK_HINT */
+ 499, /* (580) tag_mode_opt ::= */
+ 499, /* (581) tag_mode_opt ::= TAGS */
+ 498, /* (582) set_quantifier_opt ::= */
+ 498, /* (583) set_quantifier_opt ::= DISTINCT */
+ 498, /* (584) set_quantifier_opt ::= ALL */
+ 500, /* (585) select_list ::= select_item */
+ 500, /* (586) select_list ::= select_list NK_COMMA select_item */
+ 508, /* (587) select_item ::= NK_STAR */
+ 508, /* (588) select_item ::= common_expression */
+ 508, /* (589) select_item ::= common_expression column_alias */
+ 508, /* (590) select_item ::= common_expression AS column_alias */
+ 508, /* (591) select_item ::= table_name NK_DOT NK_STAR */
+ 439, /* (592) where_clause_opt ::= */
+ 439, /* (593) where_clause_opt ::= WHERE search_condition */
+ 501, /* (594) partition_by_clause_opt ::= */
+ 501, /* (595) partition_by_clause_opt ::= PARTITION BY partition_list */
+ 509, /* (596) partition_list ::= partition_item */
+ 509, /* (597) partition_list ::= partition_list NK_COMMA partition_item */
+ 510, /* (598) partition_item ::= expr_or_subquery */
+ 510, /* (599) partition_item ::= expr_or_subquery column_alias */
+ 510, /* (600) partition_item ::= expr_or_subquery AS column_alias */
+ 505, /* (601) twindow_clause_opt ::= */
+ 505, /* (602) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */
+ 505, /* (603) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
+ 505, /* (604) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
+ 505, /* (605) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
+ 505, /* (606) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
+ 505, /* (607) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */
+ 505, /* (608) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+ 433, /* (609) sliding_opt ::= */
+ 433, /* (610) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */
+ 511, /* (611) interval_sliding_duration_literal ::= NK_VARIABLE */
+ 511, /* (612) interval_sliding_duration_literal ::= NK_STRING */
+ 511, /* (613) interval_sliding_duration_literal ::= NK_INTEGER */
+ 504, /* (614) fill_opt ::= */
+ 504, /* (615) fill_opt ::= FILL NK_LP fill_mode NK_RP */
+ 504, /* (616) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
+ 504, /* (617) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
+ 512, /* (618) fill_mode ::= NONE */
+ 512, /* (619) fill_mode ::= PREV */
+ 512, /* (620) fill_mode ::= NULL */
+ 512, /* (621) fill_mode ::= NULL_F */
+ 512, /* (622) fill_mode ::= LINEAR */
+ 512, /* (623) fill_mode ::= NEXT */
+ 506, /* (624) group_by_clause_opt ::= */
+ 506, /* (625) group_by_clause_opt ::= GROUP BY group_by_list */
+ 513, /* (626) group_by_list ::= expr_or_subquery */
+ 513, /* (627) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+ 507, /* (628) having_clause_opt ::= */
+ 507, /* (629) having_clause_opt ::= HAVING search_condition */
+ 502, /* (630) range_opt ::= */
+ 502, /* (631) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+ 502, /* (632) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
+ 503, /* (633) every_opt ::= */
+ 503, /* (634) every_opt ::= EVERY NK_LP duration_literal NK_RP */
+ 514, /* (635) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ 515, /* (636) query_simple ::= query_specification */
+ 515, /* (637) query_simple ::= union_query_expression */
+ 519, /* (638) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+ 519, /* (639) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+ 520, /* (640) query_simple_or_subquery ::= query_simple */
+ 520, /* (641) query_simple_or_subquery ::= subquery */
+ 438, /* (642) query_or_subquery ::= query_expression */
+ 438, /* (643) query_or_subquery ::= subquery */
+ 516, /* (644) order_by_clause_opt ::= */
+ 516, /* (645) order_by_clause_opt ::= ORDER BY sort_specification_list */
+ 517, /* (646) slimit_clause_opt ::= */
+ 517, /* (647) slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ 517, /* (648) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ 517, /* (649) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ 518, /* (650) limit_clause_opt ::= */
+ 518, /* (651) limit_clause_opt ::= LIMIT NK_INTEGER */
+ 518, /* (652) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
+ 518, /* (653) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ 488, /* (654) subquery ::= NK_LP query_expression NK_RP */
+ 488, /* (655) subquery ::= NK_LP subquery NK_RP */
+ 377, /* (656) search_condition ::= common_expression */
+ 521, /* (657) sort_specification_list ::= sort_specification */
+ 521, /* (658) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
+ 522, /* (659) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+ 523, /* (660) ordering_specification_opt ::= */
+ 523, /* (661) ordering_specification_opt ::= ASC */
+ 523, /* (662) ordering_specification_opt ::= DESC */
+ 524, /* (663) null_ordering_opt ::= */
+ 524, /* (664) null_ordering_opt ::= NULLS FIRST */
+ 524, /* (665) null_ordering_opt ::= NULLS LAST */
};
/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
@@ -4338,7 +4370,7 @@ static const signed char yyRuleInfoNRhs[] = {
-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, /* (290) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */
-4, /* (291) cmd ::= SHOW CREATE VIEW full_table_name */
-2, /* (292) cmd ::= SHOW COMPACTS */
-3, /* (293) cmd ::= SHOW COMPACT NK_INTEGER */
@@ -4655,63 +4687,65 @@ static const signed char yyRuleInfoNRhs[] = {
-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 */
+ -4, /* (607) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */
+ -6, /* (608) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+ 0, /* (609) sliding_opt ::= */
+ -4, /* (610) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */
+ -1, /* (611) interval_sliding_duration_literal ::= NK_VARIABLE */
+ -1, /* (612) interval_sliding_duration_literal ::= NK_STRING */
+ -1, /* (613) interval_sliding_duration_literal ::= NK_INTEGER */
+ 0, /* (614) fill_opt ::= */
+ -4, /* (615) fill_opt ::= FILL NK_LP fill_mode NK_RP */
+ -6, /* (616) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
+ -6, /* (617) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
+ -1, /* (618) fill_mode ::= NONE */
+ -1, /* (619) fill_mode ::= PREV */
+ -1, /* (620) fill_mode ::= NULL */
+ -1, /* (621) fill_mode ::= NULL_F */
+ -1, /* (622) fill_mode ::= LINEAR */
+ -1, /* (623) fill_mode ::= NEXT */
+ 0, /* (624) group_by_clause_opt ::= */
+ -3, /* (625) group_by_clause_opt ::= GROUP BY group_by_list */
+ -1, /* (626) group_by_list ::= expr_or_subquery */
+ -3, /* (627) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+ 0, /* (628) having_clause_opt ::= */
+ -2, /* (629) having_clause_opt ::= HAVING search_condition */
+ 0, /* (630) range_opt ::= */
+ -6, /* (631) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+ -4, /* (632) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
+ 0, /* (633) every_opt ::= */
+ -4, /* (634) every_opt ::= EVERY NK_LP duration_literal NK_RP */
+ -4, /* (635) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ -1, /* (636) query_simple ::= query_specification */
+ -1, /* (637) query_simple ::= union_query_expression */
+ -4, /* (638) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+ -3, /* (639) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+ -1, /* (640) query_simple_or_subquery ::= query_simple */
+ -1, /* (641) query_simple_or_subquery ::= subquery */
+ -1, /* (642) query_or_subquery ::= query_expression */
+ -1, /* (643) query_or_subquery ::= subquery */
+ 0, /* (644) order_by_clause_opt ::= */
+ -3, /* (645) order_by_clause_opt ::= ORDER BY sort_specification_list */
+ 0, /* (646) slimit_clause_opt ::= */
+ -2, /* (647) slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ -4, /* (648) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ -4, /* (649) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ 0, /* (650) limit_clause_opt ::= */
+ -2, /* (651) limit_clause_opt ::= LIMIT NK_INTEGER */
+ -4, /* (652) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
+ -4, /* (653) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ -3, /* (654) subquery ::= NK_LP query_expression NK_RP */
+ -3, /* (655) subquery ::= NK_LP subquery NK_RP */
+ -1, /* (656) search_condition ::= common_expression */
+ -1, /* (657) sort_specification_list ::= sort_specification */
+ -3, /* (658) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
+ -3, /* (659) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+ 0, /* (660) ordering_specification_opt ::= */
+ -1, /* (661) ordering_specification_opt ::= ASC */
+ -1, /* (662) ordering_specification_opt ::= DESC */
+ 0, /* (663) null_ordering_opt ::= */
+ -2, /* (664) null_ordering_opt ::= NULLS FIRST */
+ -2, /* (665) null_ordering_opt ::= NULLS LAST */
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -4803,11 +4837,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,359,&yymsp[0].minor);
+ yy_destructor(yypParser,360,&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,360,&yymsp[0].minor);
+ yy_destructor(yypParser,361,&yymsp[0].minor);
break;
case 2: /* account_options ::= */
{ }
@@ -4821,20 +4855,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,359,&yymsp[-2].minor);
+{ yy_destructor(yypParser,360,&yymsp[-2].minor);
{ }
- yy_destructor(yypParser,361,&yymsp[0].minor);
+ yy_destructor(yypParser,362,&yymsp[0].minor);
}
break;
case 12: /* alter_account_options ::= alter_account_option */
-{ yy_destructor(yypParser,362,&yymsp[0].minor);
+{ yy_destructor(yypParser,363,&yymsp[0].minor);
{ }
}
break;
case 13: /* alter_account_options ::= alter_account_options alter_account_option */
-{ yy_destructor(yypParser,360,&yymsp[-1].minor);
+{ yy_destructor(yypParser,361,&yymsp[-1].minor);
{ }
- yy_destructor(yypParser,362,&yymsp[0].minor);
+ yy_destructor(yypParser,363,&yymsp[0].minor);
}
break;
case 14: /* alter_account_option ::= PASS literal */
@@ -4848,18 +4882,18 @@ 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,361,&yymsp[0].minor);
+ yy_destructor(yypParser,362,&yymsp[0].minor);
break;
case 24: /* ip_range_list ::= NK_STRING */
-{ yylhsminor.yy72 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy72 = yylhsminor.yy72;
+{ yylhsminor.yy124 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy124 = yylhsminor.yy124;
break;
case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */
-{ yylhsminor.yy72 = addNodeToList(pCxt, yymsp[-2].minor.yy72, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy72 = yylhsminor.yy72;
+{ yylhsminor.yy124 = addNodeToList(pCxt, yymsp[-2].minor.yy124, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy124 = yylhsminor.yy124;
break;
case 26: /* white_list ::= HOST ip_range_list */
-{ yymsp[-1].minor.yy72 = yymsp[0].minor.yy72; }
+{ yymsp[-1].minor.yy124 = yymsp[0].minor.yy124; }
break;
case 27: /* white_list_opt ::= */
case 188: /* specific_cols_opt ::= */ yytestcase(yyruleno==188);
@@ -4868,92 +4902,92 @@ static YYACTIONTYPE yy_reduce(
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; }
+ case 624: /* group_by_clause_opt ::= */ yytestcase(yyruleno==624);
+ case 644: /* order_by_clause_opt ::= */ yytestcase(yyruleno==644);
+{ yymsp[1].minor.yy124 = NULL; }
break;
case 28: /* white_list_opt ::= white_list */
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;
+{ yylhsminor.yy124 = yymsp[0].minor.yy124; }
+ yymsp[0].minor.yy124 = yylhsminor.yy124;
break;
case 29: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt white_list_opt */
{
- 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);
+ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-4].minor.yy29, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy803);
+ pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy124);
}
break;
case 30: /* cmd ::= ALTER USER user_name PASS NK_STRING */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy305, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy29, 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.yy305, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy29, 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.yy305, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy29, 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.yy305, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy72); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy29, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy124); }
break;
case 34: /* cmd ::= ALTER USER user_name DROP white_list */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy305, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy72); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy29, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy124); }
break;
case 35: /* cmd ::= DROP USER user_name */
-{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy305); }
+{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy29); }
break;
case 36: /* sysinfo_opt ::= */
-{ yymsp[1].minor.yy359 = 1; }
+{ yymsp[1].minor.yy803 = 1; }
break;
case 37: /* sysinfo_opt ::= SYSINFO NK_INTEGER */
-{ yymsp[-1].minor.yy359 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yymsp[-1].minor.yy803 = 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.yy1005, &yymsp[-3].minor.yy361, &yymsp[0].minor.yy305, yymsp[-2].minor.yy1000); }
+{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy459, &yymsp[-3].minor.yy147, &yymsp[0].minor.yy29, yymsp[-2].minor.yy812); }
break;
case 39: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */
-{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy1005, &yymsp[-3].minor.yy361, &yymsp[0].minor.yy305, yymsp[-2].minor.yy1000); }
+{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy459, &yymsp[-3].minor.yy147, &yymsp[0].minor.yy29, yymsp[-2].minor.yy812); }
break;
case 40: /* privileges ::= ALL */
-{ yymsp[0].minor.yy1005 = PRIVILEGE_TYPE_ALL; }
+{ yymsp[0].minor.yy459 = PRIVILEGE_TYPE_ALL; }
break;
case 41: /* privileges ::= priv_type_list */
case 43: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==43);
-{ yylhsminor.yy1005 = yymsp[0].minor.yy1005; }
- yymsp[0].minor.yy1005 = yylhsminor.yy1005;
+{ yylhsminor.yy459 = yymsp[0].minor.yy459; }
+ yymsp[0].minor.yy459 = yylhsminor.yy459;
break;
case 42: /* privileges ::= SUBSCRIBE */
-{ yymsp[0].minor.yy1005 = PRIVILEGE_TYPE_SUBSCRIBE; }
+{ yymsp[0].minor.yy459 = PRIVILEGE_TYPE_SUBSCRIBE; }
break;
case 44: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */
-{ yylhsminor.yy1005 = yymsp[-2].minor.yy1005 | yymsp[0].minor.yy1005; }
- yymsp[-2].minor.yy1005 = yylhsminor.yy1005;
+{ yylhsminor.yy459 = yymsp[-2].minor.yy459 | yymsp[0].minor.yy459; }
+ yymsp[-2].minor.yy459 = yylhsminor.yy459;
break;
case 45: /* priv_type ::= READ */
-{ yymsp[0].minor.yy1005 = PRIVILEGE_TYPE_READ; }
+{ yymsp[0].minor.yy459 = PRIVILEGE_TYPE_READ; }
break;
case 46: /* priv_type ::= WRITE */
-{ yymsp[0].minor.yy1005 = PRIVILEGE_TYPE_WRITE; }
+{ yymsp[0].minor.yy459 = PRIVILEGE_TYPE_WRITE; }
break;
case 47: /* priv_type ::= ALTER */
-{ yymsp[0].minor.yy1005 = PRIVILEGE_TYPE_ALTER; }
+{ yymsp[0].minor.yy459 = PRIVILEGE_TYPE_ALTER; }
break;
case 48: /* priv_level ::= NK_STAR NK_DOT NK_STAR */
-{ yylhsminor.yy361.first = yymsp[-2].minor.yy0; yylhsminor.yy361.second = yymsp[0].minor.yy0; }
- yymsp[-2].minor.yy361 = yylhsminor.yy361;
+{ yylhsminor.yy147.first = yymsp[-2].minor.yy0; yylhsminor.yy147.second = yymsp[0].minor.yy0; }
+ yymsp[-2].minor.yy147 = yylhsminor.yy147;
break;
case 49: /* priv_level ::= db_name NK_DOT NK_STAR */
-{ yylhsminor.yy361.first = yymsp[-2].minor.yy305; yylhsminor.yy361.second = yymsp[0].minor.yy0; }
- yymsp[-2].minor.yy361 = yylhsminor.yy361;
+{ yylhsminor.yy147.first = yymsp[-2].minor.yy29; yylhsminor.yy147.second = yymsp[0].minor.yy0; }
+ yymsp[-2].minor.yy147 = yylhsminor.yy147;
break;
case 50: /* priv_level ::= db_name NK_DOT table_name */
-{ yylhsminor.yy361.first = yymsp[-2].minor.yy305; yylhsminor.yy361.second = yymsp[0].minor.yy305; }
- yymsp[-2].minor.yy361 = yylhsminor.yy361;
+{ yylhsminor.yy147.first = yymsp[-2].minor.yy29; yylhsminor.yy147.second = yymsp[0].minor.yy29; }
+ yymsp[-2].minor.yy147 = yylhsminor.yy147;
break;
case 51: /* priv_level ::= topic_name */
-{ yylhsminor.yy361.first = yymsp[0].minor.yy305; yylhsminor.yy361.second = nil_token; }
- yymsp[0].minor.yy361 = yylhsminor.yy361;
+{ yylhsminor.yy147.first = yymsp[0].minor.yy29; yylhsminor.yy147.second = nil_token; }
+ yymsp[0].minor.yy147 = yylhsminor.yy147;
break;
case 52: /* with_opt ::= */
case 157: /* start_opt ::= */ yytestcase(yyruleno==157);
@@ -4967,39 +5001,39 @@ static YYACTIONTYPE yy_reduce(
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; }
+ case 609: /* sliding_opt ::= */ yytestcase(yyruleno==609);
+ case 614: /* fill_opt ::= */ yytestcase(yyruleno==614);
+ case 628: /* having_clause_opt ::= */ yytestcase(yyruleno==628);
+ case 630: /* range_opt ::= */ yytestcase(yyruleno==630);
+ case 633: /* every_opt ::= */ yytestcase(yyruleno==633);
+ case 646: /* slimit_clause_opt ::= */ yytestcase(yyruleno==646);
+ case 650: /* limit_clause_opt ::= */ yytestcase(yyruleno==650);
+{ yymsp[1].minor.yy812 = NULL; }
break;
case 53: /* with_opt ::= WITH search_condition */
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; }
+ case 629: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==629);
+{ yymsp[-1].minor.yy812 = yymsp[0].minor.yy812; }
break;
case 54: /* cmd ::= CREATE DNODE dnode_endpoint */
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy305, NULL); }
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy29, NULL); }
break;
case 55: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy305, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy29, &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.yy985, false); }
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy887, false); }
break;
case 57: /* cmd ::= DROP DNODE dnode_endpoint force_opt */
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy305, yymsp[0].minor.yy985, false); }
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy29, yymsp[0].minor.yy887, false); }
break;
case 58: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy985); }
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy887); }
break;
case 59: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy305, false, yymsp[0].minor.yy985); }
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy29, false, yymsp[0].minor.yy887); }
break;
case 60: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); }
@@ -5049,8 +5083,8 @@ static YYACTIONTYPE yy_reduce(
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;
+{ yylhsminor.yy29 = yymsp[0].minor.yy0; }
+ yymsp[0].minor.yy29 = yylhsminor.yy29;
break;
case 68: /* force_opt ::= */
case 94: /* not_exists_opt ::= */ yytestcase(yyruleno==94);
@@ -5061,7 +5095,7 @@ static YYACTIONTYPE yy_reduce(
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; }
+{ yymsp[1].minor.yy887 = false; }
break;
case 69: /* force_opt ::= FORCE */
case 70: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==70);
@@ -5069,7 +5103,7 @@ static YYACTIONTYPE yy_reduce(
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; }
+{ yymsp[0].minor.yy887 = true; }
break;
case 71: /* cmd ::= ALTER CLUSTER NK_STRING */
{ pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[0].minor.yy0, NULL); }
@@ -5117,241 +5151,241 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); }
break;
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); }
+{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy887, &yymsp[-1].minor.yy29, yymsp[0].minor.yy812); }
break;
case 87: /* cmd ::= DROP DATABASE exists_opt db_name */
-{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy985, &yymsp[0].minor.yy305); }
+{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy887, &yymsp[0].minor.yy29); }
break;
case 88: /* cmd ::= USE db_name */
-{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy305); }
+{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy29); }
break;
case 89: /* cmd ::= ALTER DATABASE db_name alter_db_options */
-{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy305, yymsp[0].minor.yy1000); }
+{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy29, yymsp[0].minor.yy812); }
break;
case 90: /* cmd ::= FLUSH DATABASE db_name */
-{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy305); }
+{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy29); }
break;
case 91: /* cmd ::= TRIM DATABASE db_name speed_opt */
-{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy305, yymsp[0].minor.yy444); }
+{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy29, yymsp[0].minor.yy760); }
break;
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); }
+{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy29, yymsp[-1].minor.yy812, yymsp[0].minor.yy812); }
break;
case 93: /* not_exists_opt ::= IF NOT EXISTS */
-{ yymsp[-2].minor.yy985 = true; }
+{ yymsp[-2].minor.yy887 = true; }
break;
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; }
+{ yymsp[-1].minor.yy887 = true; }
break;
case 97: /* db_options ::= */
-{ yymsp[1].minor.yy1000 = createDefaultDatabaseOptions(pCxt); }
+{ yymsp[1].minor.yy812 = createDefaultDatabaseOptions(pCxt); }
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_KEEP, yymsp[0].minor.yy124); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_RETENTIONS, yymsp[0].minor.yy124); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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.yy1000 = setDatabaseOption(pCxt, yymsp[-3].minor.yy1000, DB_OPTION_WAL_RETENTION_PERIOD, &t);
+ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-3].minor.yy812, DB_OPTION_WAL_RETENTION_PERIOD, &t);
}
- yymsp[-3].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-3].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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.yy1000 = setDatabaseOption(pCxt, yymsp[-3].minor.yy1000, DB_OPTION_WAL_RETENTION_SIZE, &t);
+ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-3].minor.yy812, DB_OPTION_WAL_RETENTION_SIZE, &t);
}
- yymsp[-3].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-3].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy812); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy812); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setDatabaseOption(pCxt, yymsp[-2].minor.yy812, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createAlterDatabaseOptions(pCxt); yylhsminor.yy812 = setAlterDatabaseOption(pCxt, yylhsminor.yy812, &yymsp[0].minor.yy95); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy812, &yymsp[0].minor.yy95); }
+ yymsp[-1].minor.yy812 = yylhsminor.yy812;
break;
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; }
+{ yymsp[-1].minor.yy95.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy95.val = yymsp[0].minor.yy0; }
break;
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; }
+{ yymsp[-1].minor.yy95.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy95.val = yymsp[0].minor.yy0; }
break;
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; }
+{ yymsp[-1].minor.yy95.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy95.val = yymsp[0].minor.yy0; }
break;
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; }
+{ yymsp[-1].minor.yy95.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy95.val = yymsp[0].minor.yy0; }
break;
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; }
+{ yymsp[-1].minor.yy95.type = DB_OPTION_KEEP; yymsp[-1].minor.yy95.pList = yymsp[0].minor.yy124; }
break;
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; }
+{ yymsp[-1].minor.yy95.type = DB_OPTION_PAGES; yymsp[-1].minor.yy95.val = yymsp[0].minor.yy0; }
break;
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; }
+{ yymsp[-1].minor.yy95.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy95.val = yymsp[0].minor.yy0; }
break;
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; }
+{ yymsp[-1].minor.yy95.type = DB_OPTION_WAL; yymsp[-1].minor.yy95.val = yymsp[0].minor.yy0; }
break;
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; }
+{ yymsp[-1].minor.yy95.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy95.val = yymsp[0].minor.yy0; }
break;
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; }
+{ yymsp[-1].minor.yy95.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy95.val = yymsp[0].minor.yy0; }
break;
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; }
+{ yymsp[-1].minor.yy95.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy95.val = yymsp[0].minor.yy0; }
break;
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.yy941.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy941.val = t;
+ yymsp[-2].minor.yy95.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy95.val = t;
}
break;
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; }
+{ yymsp[-1].minor.yy95.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy95.val = yymsp[0].minor.yy0; }
break;
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.yy941.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy941.val = t;
+ yymsp[-2].minor.yy95.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy95.val = t;
}
break;
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; }
+{ yymsp[-1].minor.yy95.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy95.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;
+{ yylhsminor.yy124 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy124 = yylhsminor.yy124;
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;
+{ yylhsminor.yy124 = addNodeToList(pCxt, yymsp[-2].minor.yy124, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy124 = yylhsminor.yy124;
break;
case 149: /* variable_list ::= NK_VARIABLE */
-{ yylhsminor.yy72 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy72 = yylhsminor.yy72;
+{ yylhsminor.yy124 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy124 = yylhsminor.yy124;
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;
+{ yylhsminor.yy124 = addNodeToList(pCxt, yymsp[-2].minor.yy124, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy124 = yylhsminor.yy124;
break;
case 151: /* retention_list ::= retention */
case 182: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==182);
@@ -5366,9 +5400,9 @@ static YYACTIONTYPE yy_reduce(
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;
+ case 657: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==657);
+{ yylhsminor.yy124 = createNodeList(pCxt, yymsp[0].minor.yy812); }
+ yymsp[0].minor.yy124 = yylhsminor.yy124;
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);
@@ -5381,268 +5415,268 @@ static YYACTIONTYPE yy_reduce(
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;
+ case 658: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==658);
+{ yylhsminor.yy124 = addNodeToList(pCxt, yymsp[-2].minor.yy124, yymsp[0].minor.yy812); }
+ yymsp[-2].minor.yy124 = yylhsminor.yy124;
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;
+{ yylhsminor.yy812 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
case 155: /* speed_opt ::= */
case 359: /* bufsize_opt ::= */ yytestcase(yyruleno==359);
-{ yymsp[1].minor.yy444 = 0; }
+{ yymsp[1].minor.yy760 = 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); }
+{ yymsp[-1].minor.yy760 = 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); }
+{ yymsp[-2].minor.yy812 = 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); }
+{ yymsp[-2].minor.yy812 = 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); }
+{ yymsp[-3].minor.yy812 = 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); }
+{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy887, yymsp[-5].minor.yy812, yymsp[-3].minor.yy124, yymsp[-1].minor.yy124, yymsp[0].minor.yy812); }
break;
case 166: /* cmd ::= CREATE TABLE multi_create_clause */
-{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy72); }
+{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy124); }
break;
case 168: /* cmd ::= DROP TABLE multi_drop_clause */
-{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy72); }
+{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy124); }
break;
case 169: /* cmd ::= DROP STABLE exists_opt full_table_name */
-{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy985, yymsp[0].minor.yy1000); }
+{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy887, yymsp[0].minor.yy812); }
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; }
+{ pCxt->pRootNode = yymsp[0].minor.yy812; }
break;
case 171: /* cmd ::= ALTER STABLE alter_table_clause */
-{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy1000); }
+{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy812); }
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;
+{ yylhsminor.yy812 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy812, yymsp[0].minor.yy812); }
+ yymsp[-1].minor.yy812 = yylhsminor.yy812;
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;
+{ yylhsminor.yy812 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy812, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy29, yymsp[0].minor.yy784); }
+ yymsp[-4].minor.yy812 = yylhsminor.yy812;
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;
+{ yylhsminor.yy812 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy812, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy29); }
+ yymsp[-3].minor.yy812 = yylhsminor.yy812;
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;
+{ yylhsminor.yy812 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy812, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy29, yymsp[0].minor.yy784); }
+ yymsp[-4].minor.yy812 = yylhsminor.yy812;
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;
+{ yylhsminor.yy812 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy812, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy29, &yymsp[0].minor.yy29); }
+ yymsp[-4].minor.yy812 = yylhsminor.yy812;
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;
+{ yylhsminor.yy812 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy812, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy29, yymsp[0].minor.yy784); }
+ yymsp[-4].minor.yy812 = yylhsminor.yy812;
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;
+{ yylhsminor.yy812 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy812, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy29); }
+ yymsp[-3].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy812, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy29, yymsp[0].minor.yy784); }
+ yymsp[-4].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy812, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy29, &yymsp[0].minor.yy29); }
+ yymsp[-4].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy812, &yymsp[-2].minor.yy29, yymsp[0].minor.yy812); }
+ yymsp[-5].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy124 = addNodeToList(pCxt, yymsp[-1].minor.yy124, yymsp[0].minor.yy812); }
+ yymsp[-1].minor.yy124 = yylhsminor.yy124;
break;
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;
+{ yylhsminor.yy812 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy887, yymsp[-8].minor.yy812, yymsp[-6].minor.yy812, yymsp[-5].minor.yy124, yymsp[-2].minor.yy124, yymsp[0].minor.yy812); }
+ yymsp[-9].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createDropTableClause(pCxt, yymsp[-1].minor.yy887, yymsp[0].minor.yy812); }
+ yymsp[-1].minor.yy812 = yylhsminor.yy812;
break;
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; }
+{ yymsp[-2].minor.yy124 = yymsp[-1].minor.yy124; }
break;
case 190: /* full_table_name ::= table_name */
-{ yylhsminor.yy1000 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy305, NULL); }
- yymsp[0].minor.yy1000 = yylhsminor.yy1000;
+{ yylhsminor.yy812 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy29, NULL); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createRealTableNode(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy29, NULL); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy29, yymsp[0].minor.yy784, NULL); }
+ yymsp[-1].minor.yy812 = yylhsminor.yy812;
break;
case 195: /* type_name ::= BOOL */
-{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_BOOL); }
+{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_BOOL); }
break;
case 196: /* type_name ::= TINYINT */
-{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_TINYINT); }
+{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_TINYINT); }
break;
case 197: /* type_name ::= SMALLINT */
-{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
+{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
break;
case 198: /* type_name ::= INT */
case 199: /* type_name ::= INTEGER */ yytestcase(yyruleno==199);
-{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_INT); }
+{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_INT); }
break;
case 200: /* type_name ::= BIGINT */
-{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_BIGINT); }
+{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_BIGINT); }
break;
case 201: /* type_name ::= FLOAT */
-{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_FLOAT); }
+{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_FLOAT); }
break;
case 202: /* type_name ::= DOUBLE */
-{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
+{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
break;
case 203: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy56 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy784 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
break;
case 204: /* type_name ::= TIMESTAMP */
-{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
+{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
break;
case 205: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy56 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy784 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
break;
case 206: /* type_name ::= TINYINT UNSIGNED */
-{ yymsp[-1].minor.yy56 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
+{ yymsp[-1].minor.yy784 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
break;
case 207: /* type_name ::= SMALLINT UNSIGNED */
-{ yymsp[-1].minor.yy56 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
+{ yymsp[-1].minor.yy784 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
break;
case 208: /* type_name ::= INT UNSIGNED */
-{ yymsp[-1].minor.yy56 = createDataType(TSDB_DATA_TYPE_UINT); }
+{ yymsp[-1].minor.yy784 = createDataType(TSDB_DATA_TYPE_UINT); }
break;
case 209: /* type_name ::= BIGINT UNSIGNED */
-{ yymsp[-1].minor.yy56 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
+{ yymsp[-1].minor.yy784 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
break;
case 210: /* type_name ::= JSON */
-{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_JSON); }
+{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_JSON); }
break;
case 211: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy56 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy784 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
break;
case 212: /* type_name ::= MEDIUMBLOB */
-{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
+{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
break;
case 213: /* type_name ::= BLOB */
-{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_BLOB); }
+{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_BLOB); }
break;
case 214: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy56 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy784 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
break;
case 215: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy56 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy784 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); }
break;
case 216: /* type_name ::= DECIMAL */
-{ yymsp[0].minor.yy56 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+{ yymsp[0].minor.yy784 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 217: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy56 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+{ yymsp[-3].minor.yy784 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 218: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
-{ yymsp[-5].minor.yy56 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+{ yymsp[-5].minor.yy784 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
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; }
+{ yymsp[-3].minor.yy124 = yymsp[-1].minor.yy124; }
break;
case 222: /* table_options ::= */
-{ yymsp[1].minor.yy1000 = createDefaultTableOptions(pCxt); }
+{ yymsp[1].minor.yy812 = createDefaultTableOptions(pCxt); }
break;
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;
+{ yylhsminor.yy812 = setTableOption(pCxt, yymsp[-2].minor.yy812, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setTableOption(pCxt, yymsp[-2].minor.yy812, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy124); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setTableOption(pCxt, yymsp[-2].minor.yy812, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy124); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setTableOption(pCxt, yymsp[-4].minor.yy812, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy124); }
+ yymsp[-4].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setTableOption(pCxt, yymsp[-2].minor.yy812, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setTableOption(pCxt, yymsp[-4].minor.yy812, TABLE_OPTION_SMA, yymsp[-1].minor.yy124); }
+ yymsp[-4].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setTableOption(pCxt, yymsp[-2].minor.yy812, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy124); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createAlterTableOptions(pCxt); yylhsminor.yy812 = setTableOption(pCxt, yylhsminor.yy812, yymsp[0].minor.yy95.type, &yymsp[0].minor.yy95.val); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setTableOption(pCxt, yymsp[-1].minor.yy812, yymsp[0].minor.yy95.type, &yymsp[0].minor.yy95.val); }
+ yymsp[-1].minor.yy812 = yylhsminor.yy812;
break;
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; }
+{ yymsp[-1].minor.yy95.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy95.val = yymsp[0].minor.yy0; }
break;
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; }
+{ yymsp[-1].minor.yy95.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy95.val = yymsp[0].minor.yy0; }
break;
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;
+{ yylhsminor.yy124 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy812)); }
+ yymsp[0].minor.yy124 = yylhsminor.yy124;
break;
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;
+{ yylhsminor.yy124 = addNodeToList(pCxt, yymsp[-2].minor.yy124, releaseRawExprNode(pCxt, yymsp[0].minor.yy812)); }
+ yymsp[-2].minor.yy124 = yylhsminor.yy124;
break;
case 238: /* rollup_func_name ::= function_name */
-{ yylhsminor.yy1000 = createFunctionNode(pCxt, &yymsp[0].minor.yy305, NULL); }
- yymsp[0].minor.yy1000 = yylhsminor.yy1000;
+{ yylhsminor.yy812 = createFunctionNode(pCxt, &yymsp[0].minor.yy29, NULL); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy29); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
case 244: /* cmd ::= SHOW DNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); }
@@ -5656,19 +5690,19 @@ static YYACTIONTYPE yy_reduce(
case 247: /* cmd ::= SHOW db_kind_opt DATABASES */
{
pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT);
- setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy761);
+ setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy789);
}
break;
case 248: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */
{
- pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy517, yymsp[0].minor.yy1000, OP_TYPE_LIKE);
+ pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy667, yymsp[0].minor.yy812, OP_TYPE_LIKE);
}
break;
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); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy812, yymsp[0].minor.yy812, OP_TYPE_LIKE); }
break;
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); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy812, NULL, OP_TYPE_LIKE); }
break;
case 251: /* cmd ::= SHOW MNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); }
@@ -5680,10 +5714,10 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); }
break;
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); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy812, yymsp[-1].minor.yy812, OP_TYPE_EQUAL); }
break;
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); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy29), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy29), OP_TYPE_EQUAL); }
break;
case 256: /* cmd ::= SHOW STREAMS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); }
@@ -5711,13 +5745,13 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); }
break;
case 265: /* cmd ::= SHOW CREATE DATABASE db_name */
-{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy305); }
+{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy29); }
break;
case 266: /* cmd ::= SHOW CREATE TABLE full_table_name */
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy1000); }
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy812); }
break;
case 267: /* cmd ::= SHOW CREATE STABLE full_table_name */
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy1000); }
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy812); }
break;
case 268: /* cmd ::= SHOW QUERIES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); }
@@ -5736,7 +5770,7 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); }
break;
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); }
+{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy812); }
break;
case 275: /* cmd ::= SHOW BNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); }
@@ -5751,7 +5785,7 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); }
break;
case 279: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
-{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy1000); }
+{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy812); }
break;
case 280: /* cmd ::= SHOW CONSUMERS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); }
@@ -5760,16 +5794,16 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); }
break;
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); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy812, yymsp[-1].minor.yy812, OP_TYPE_EQUAL); }
break;
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); }
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy29), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy29), OP_TYPE_EQUAL); }
break;
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); }
+{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy812, yymsp[0].minor.yy812, yymsp[-3].minor.yy124); }
break;
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); }
+{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy29), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy29), yymsp[-4].minor.yy124); }
break;
case 286: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); }
@@ -5778,16 +5812,16 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); }
break;
case 288: /* cmd ::= SHOW db_name_cond_opt ALIVE */
-{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy1000, QUERY_NODE_SHOW_DB_ALIVE_STMT); }
+{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy812, QUERY_NODE_SHOW_DB_ALIVE_STMT); }
break;
case 289: /* cmd ::= SHOW CLUSTER ALIVE */
{ pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); }
break;
- 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); }
+ case 290: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy812, yymsp[0].minor.yy812, OP_TYPE_LIKE); }
break;
case 291: /* cmd ::= SHOW CREATE VIEW full_table_name */
-{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy1000); }
+{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy812); }
break;
case 292: /* cmd ::= SHOW COMPACTS */
{ pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); }
@@ -5796,232 +5830,232 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
break;
case 294: /* table_kind_db_name_cond_opt ::= */
-{ yymsp[1].minor.yy517.kind = SHOW_KIND_ALL; yymsp[1].minor.yy517.dbName = nil_token; }
+{ yymsp[1].minor.yy667.kind = SHOW_KIND_ALL; yymsp[1].minor.yy667.dbName = nil_token; }
break;
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;
+{ yylhsminor.yy667.kind = yymsp[0].minor.yy789; yylhsminor.yy667.dbName = nil_token; }
+ yymsp[0].minor.yy667 = yylhsminor.yy667;
break;
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;
+{ yylhsminor.yy667.kind = SHOW_KIND_ALL; yylhsminor.yy667.dbName = yymsp[-1].minor.yy29; }
+ yymsp[-1].minor.yy667 = yylhsminor.yy667;
break;
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;
+{ yylhsminor.yy667.kind = yymsp[-2].minor.yy789; yylhsminor.yy667.dbName = yymsp[-1].minor.yy29; }
+ yymsp[-2].minor.yy667 = yylhsminor.yy667;
break;
case 298: /* table_kind ::= NORMAL */
-{ yymsp[0].minor.yy761 = SHOW_KIND_TABLES_NORMAL; }
+{ yymsp[0].minor.yy789 = SHOW_KIND_TABLES_NORMAL; }
break;
case 299: /* table_kind ::= CHILD */
-{ yymsp[0].minor.yy761 = SHOW_KIND_TABLES_CHILD; }
+{ yymsp[0].minor.yy789 = SHOW_KIND_TABLES_CHILD; }
break;
case 300: /* db_name_cond_opt ::= */
case 305: /* from_db_opt ::= */ yytestcase(yyruleno==305);
-{ yymsp[1].minor.yy1000 = createDefaultDatabaseCondValue(pCxt); }
+{ yymsp[1].minor.yy812 = createDefaultDatabaseCondValue(pCxt); }
break;
case 301: /* db_name_cond_opt ::= db_name NK_DOT */
-{ yylhsminor.yy1000 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy305); }
- yymsp[-1].minor.yy1000 = yylhsminor.yy1000;
+{ yylhsminor.yy812 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy29); }
+ yymsp[-1].minor.yy812 = yylhsminor.yy812;
break;
case 303: /* like_pattern_opt ::= LIKE NK_STRING */
-{ yymsp[-1].minor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+{ yymsp[-1].minor.yy812 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
break;
case 304: /* table_name_cond ::= table_name */
-{ yylhsminor.yy1000 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy305); }
- yymsp[0].minor.yy1000 = yylhsminor.yy1000;
+{ yylhsminor.yy812 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy29); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
case 306: /* from_db_opt ::= FROM db_name */
-{ yymsp[-1].minor.yy1000 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy305); }
+{ yymsp[-1].minor.yy812 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy29); }
break;
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;
+{ yylhsminor.yy812 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy29), &yymsp[0].minor.yy29); }
+ yymsp[-1].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy29), &yymsp[0].minor.yy29); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
case 315: /* db_kind_opt ::= */
-{ yymsp[1].minor.yy761 = SHOW_KIND_ALL; }
+{ yymsp[1].minor.yy789 = SHOW_KIND_ALL; }
break;
case 316: /* db_kind_opt ::= USER */
-{ yymsp[0].minor.yy761 = SHOW_KIND_DATABASES_USER; }
+{ yymsp[0].minor.yy789 = SHOW_KIND_DATABASES_USER; }
break;
case 317: /* db_kind_opt ::= SYSTEM */
-{ yymsp[0].minor.yy761 = SHOW_KIND_DATABASES_SYSTEM; }
+{ yymsp[0].minor.yy789 = SHOW_KIND_DATABASES_SYSTEM; }
break;
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); }
+{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy887, yymsp[-3].minor.yy812, yymsp[-1].minor.yy812, NULL, yymsp[0].minor.yy812); }
break;
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); }
+{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy887, yymsp[-5].minor.yy812, yymsp[-3].minor.yy812, yymsp[-1].minor.yy124, NULL); }
break;
case 320: /* cmd ::= DROP INDEX exists_opt full_index_name */
-{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy985, yymsp[0].minor.yy1000); }
+{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy887, yymsp[0].minor.yy812); }
break;
case 321: /* full_index_name ::= index_name */
-{ yylhsminor.yy1000 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy305); }
- yymsp[0].minor.yy1000 = yylhsminor.yy1000;
+{ yylhsminor.yy812 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy29); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy29); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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); }
+{ yymsp[-9].minor.yy812 = createIndexOption(pCxt, yymsp[-7].minor.yy124, releaseRawExprNode(pCxt, yymsp[-3].minor.yy812), NULL, yymsp[-1].minor.yy812, yymsp[0].minor.yy812); }
break;
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); }
+{ yymsp[-11].minor.yy812 = createIndexOption(pCxt, yymsp[-9].minor.yy124, releaseRawExprNode(pCxt, yymsp[-5].minor.yy812), releaseRawExprNode(pCxt, yymsp[-3].minor.yy812), yymsp[-1].minor.yy812, yymsp[0].minor.yy812); }
break;
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;
+{ yylhsminor.yy812 = createFunctionNode(pCxt, &yymsp[-3].minor.yy29, yymsp[-1].minor.yy124); }
+ yymsp[-3].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy29 = yymsp[0].minor.yy29; }
+ yymsp[0].minor.yy29 = yylhsminor.yy29;
break;
case 333: /* sma_stream_opt ::= */
case 378: /* stream_options ::= */ yytestcase(yyruleno==378);
-{ yymsp[1].minor.yy1000 = createStreamOptions(pCxt); }
+{ yymsp[1].minor.yy812 = createStreamOptions(pCxt); }
break;
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;
+{ ((SStreamOptions*)yymsp[-2].minor.yy812)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy812); yylhsminor.yy812 = yymsp[-2].minor.yy812; }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ ((SStreamOptions*)yymsp[-2].minor.yy812)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy812); yylhsminor.yy812 = yymsp[-2].minor.yy812; }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ ((SStreamOptions*)yymsp[-2].minor.yy812)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy812); yylhsminor.yy812 = yymsp[-2].minor.yy812; }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
case 337: /* with_meta ::= AS */
-{ yymsp[0].minor.yy444 = 0; }
+{ yymsp[0].minor.yy760 = 0; }
break;
case 338: /* with_meta ::= WITH META AS */
-{ yymsp[-2].minor.yy444 = 1; }
+{ yymsp[-2].minor.yy760 = 1; }
break;
case 339: /* with_meta ::= ONLY META AS */
-{ yymsp[-2].minor.yy444 = 2; }
+{ yymsp[-2].minor.yy760 = 2; }
break;
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); }
+{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy887, &yymsp[-2].minor.yy29, yymsp[0].minor.yy812); }
break;
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); }
+{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy887, &yymsp[-3].minor.yy29, &yymsp[0].minor.yy29, yymsp[-2].minor.yy760); }
break;
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); }
+{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy887, &yymsp[-4].minor.yy29, yymsp[-1].minor.yy812, yymsp[-3].minor.yy760, yymsp[0].minor.yy812); }
break;
case 343: /* cmd ::= DROP TOPIC exists_opt topic_name */
-{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy985, &yymsp[0].minor.yy305); }
+{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy887, &yymsp[0].minor.yy29); }
break;
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); }
+{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy887, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy29); }
break;
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); }
+{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy812); }
break;
case 347: /* cmd ::= RESET QUERY CACHE */
{ pCxt->pRootNode = createResetQueryCacheStmt(pCxt); }
break;
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); }
+{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy887, yymsp[-1].minor.yy812, yymsp[0].minor.yy812); }
break;
case 352: /* explain_options ::= */
-{ yymsp[1].minor.yy1000 = createDefaultExplainOptions(pCxt); }
+{ yymsp[1].minor.yy812 = createDefaultExplainOptions(pCxt); }
break;
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;
+{ yylhsminor.yy812 = setExplainVerbose(pCxt, yymsp[-2].minor.yy812, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setExplainRatio(pCxt, yymsp[-2].minor.yy812, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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); }
+{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy887, yymsp[-9].minor.yy887, &yymsp[-6].minor.yy29, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy784, yymsp[-1].minor.yy760, &yymsp[0].minor.yy29, yymsp[-10].minor.yy887); }
break;
case 356: /* cmd ::= DROP FUNCTION exists_opt function_name */
-{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy985, &yymsp[0].minor.yy305); }
+{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy887, &yymsp[0].minor.yy29); }
break;
case 361: /* language_opt ::= */
case 400: /* on_vgroup_id ::= */ yytestcase(yyruleno==400);
-{ yymsp[1].minor.yy305 = nil_token; }
+{ yymsp[1].minor.yy29 = nil_token; }
break;
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; }
+{ yymsp[-1].minor.yy29 = yymsp[0].minor.yy0; }
break;
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); }
+{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy887, yymsp[-2].minor.yy812, &yymsp[-1].minor.yy0, yymsp[0].minor.yy812); }
break;
case 366: /* cmd ::= DROP VIEW exists_opt full_view_name */
-{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy985, yymsp[0].minor.yy1000); }
+{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy887, yymsp[0].minor.yy812); }
break;
case 367: /* full_view_name ::= view_name */
-{ yylhsminor.yy1000 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy305); }
- yymsp[0].minor.yy1000 = yylhsminor.yy1000;
+{ yylhsminor.yy812 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy29); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createViewNode(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy29); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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); }
+{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy887, &yymsp[-8].minor.yy29, yymsp[-5].minor.yy812, yymsp[-7].minor.yy812, yymsp[-3].minor.yy124, yymsp[-2].minor.yy812, yymsp[0].minor.yy812, yymsp[-4].minor.yy124); }
break;
case 370: /* cmd ::= DROP STREAM exists_opt stream_name */
-{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy985, &yymsp[0].minor.yy305); }
+{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy887, &yymsp[0].minor.yy29); }
break;
case 371: /* cmd ::= PAUSE STREAM exists_opt stream_name */
-{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy985, &yymsp[0].minor.yy305); }
+{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy887, &yymsp[0].minor.yy29); }
break;
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); }
+{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy887, yymsp[-1].minor.yy887, &yymsp[0].minor.yy29); }
break;
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;
+{ yylhsminor.yy812 = setStreamOptions(pCxt, yymsp[-2].minor.yy812, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setStreamOptions(pCxt, yymsp[-3].minor.yy812, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy812)); }
+ yymsp[-3].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setStreamOptions(pCxt, yymsp[-2].minor.yy812, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy812)); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setStreamOptions(pCxt, yymsp[-3].minor.yy812, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-3].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setStreamOptions(pCxt, yymsp[-2].minor.yy812, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setStreamOptions(pCxt, yymsp[-2].minor.yy812, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy812)); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setStreamOptions(pCxt, yymsp[-3].minor.yy812, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-3].minor.yy812 = yylhsminor.yy812;
break;
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); }
+ case 610: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==610);
+ case 634: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==634);
+{ yymsp[-3].minor.yy812 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy812); }
break;
case 391: /* cmd ::= KILL CONNECTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); }
@@ -6039,48 +6073,48 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createBalanceVgroupStmt(pCxt); }
break;
case 396: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */
-{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy305); }
+{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy29); }
break;
case 397: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
{ pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
case 398: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
-{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy72); }
+{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy124); }
break;
case 399: /* cmd ::= SPLIT VGROUP NK_INTEGER */
{ pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); }
break;
case 402: /* dnode_list ::= DNODE NK_INTEGER */
-{ yymsp[-1].minor.yy72 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+{ yymsp[-1].minor.yy124 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
break;
case 404: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
-{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy1000, yymsp[0].minor.yy1000); }
+{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy812, yymsp[0].minor.yy812); }
break;
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); }
+{ yymsp[-6].minor.yy812 = createInsertStmt(pCxt, yymsp[-4].minor.yy812, yymsp[-2].minor.yy124, yymsp[0].minor.yy812); }
break;
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); }
+{ yymsp[-3].minor.yy812 = createInsertStmt(pCxt, yymsp[-1].minor.yy812, NULL, yymsp[0].minor.yy812); }
break;
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;
+{ yylhsminor.yy812 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
+ yymsp[-1].minor.yy812 = yylhsminor.yy812;
break;
case 414: /* literal ::= duration_literal */
case 424: /* signed_literal ::= signed */ yytestcase(yyruleno==424);
@@ -6098,190 +6132,190 @@ static YYACTIONTYPE yy_reduce(
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;
+ case 636: /* query_simple ::= query_specification */ yytestcase(yyruleno==636);
+ case 637: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==637);
+ case 640: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==640);
+ case 642: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==642);
+{ yylhsminor.yy812 = yymsp[0].minor.yy812; }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
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;
+ case 611: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==611);
+ case 612: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==612);
+ case 613: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==613);
+{ yylhsminor.yy812 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
case 418: /* signed ::= NK_INTEGER */
-{ yylhsminor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy1000 = yylhsminor.yy1000;
+{ yylhsminor.yy812 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
case 419: /* signed ::= NK_PLUS NK_INTEGER */
-{ yymsp[-1].minor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+{ yymsp[-1].minor.yy812 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
break;
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.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
+ yylhsminor.yy812 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
}
- yymsp[-1].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-1].minor.yy812 = yylhsminor.yy812;
break;
case 421: /* signed ::= NK_FLOAT */
-{ yylhsminor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy1000 = yylhsminor.yy1000;
+{ yylhsminor.yy812 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
case 422: /* signed ::= NK_PLUS NK_FLOAT */
-{ yymsp[-1].minor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+{ yymsp[-1].minor.yy812 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
break;
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.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
+ yylhsminor.yy812 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
}
- yymsp[-1].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-1].minor.yy812 = yylhsminor.yy812;
break;
case 425: /* signed_literal ::= NK_STRING */
-{ yylhsminor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy1000 = yylhsminor.yy1000;
+{ yylhsminor.yy812 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
case 426: /* signed_literal ::= NK_BOOL */
-{ yylhsminor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy1000 = yylhsminor.yy1000;
+{ yylhsminor.yy812 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
case 427: /* signed_literal ::= TIMESTAMP NK_STRING */
-{ yymsp[-1].minor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
+{ yymsp[-1].minor.yy812 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
break;
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;
+ case 641: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==641);
+ case 643: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==643);
+ case 656: /* search_condition ::= common_expression */ yytestcase(yyruleno==656);
+{ yylhsminor.yy812 = releaseRawExprNode(pCxt, yymsp[0].minor.yy812); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
case 429: /* signed_literal ::= NULL */
-{ yylhsminor.yy1000 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy1000 = yylhsminor.yy1000;
+{ yylhsminor.yy812 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
case 431: /* signed_literal ::= NK_QUESTION */
-{ yylhsminor.yy1000 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy1000 = yylhsminor.yy1000;
+{ yylhsminor.yy812 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
case 449: /* expression ::= pseudo_column */
-{ yylhsminor.yy1000 = yymsp[0].minor.yy1000; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy1000, true); }
- yymsp[0].minor.yy1000 = yylhsminor.yy1000;
+{ yylhsminor.yy812 = yymsp[0].minor.yy812; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy812, true); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
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;
+ case 655: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==655);
+{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy812)); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
case 454: /* expression ::= NK_PLUS expr_or_subquery */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy1000);
- yylhsminor.yy1000 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy1000));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
+ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy812));
}
- yymsp[-1].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-1].minor.yy812 = yylhsminor.yy812;
break;
case 455: /* expression ::= NK_MINUS expr_or_subquery */
{
- 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));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
+ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy812), NULL));
}
- yymsp[-1].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-1].minor.yy812 = yylhsminor.yy812;
break;
case 456: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
{
- 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)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
+ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
}
- yymsp[-2].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
case 457: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
{
- 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)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
+ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
}
- yymsp[-2].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
case 458: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */
{
- 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)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
+ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
}
- yymsp[-2].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
case 459: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
{
- 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)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
+ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
}
- yymsp[-2].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
case 460: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */
{
- 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)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
+ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
}
- yymsp[-2].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
case 461: /* expression ::= column_reference NK_ARROW NK_STRING */
{
- 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)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
+ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
}
- yymsp[-2].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
case 462: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
{
- 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)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
+ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
}
- yymsp[-2].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
case 463: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
{
- 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)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
+ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
}
- yymsp[-2].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createRawExprNode(pCxt, &yymsp[0].minor.yy29, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy29)); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy29, createColumnNode(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy29)); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
case 470: /* pseudo_column ::= ROWTS */
case 471: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==471);
@@ -6295,389 +6329,395 @@ static YYACTIONTYPE yy_reduce(
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;
+{ yylhsminor.yy812 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy29)))); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy29, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy29, yymsp[-1].minor.yy124)); }
+ yymsp[-3].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy812), yymsp[-1].minor.yy784)); }
+ yymsp[-5].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy29, NULL)); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy124 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy124 = yylhsminor.yy124;
break;
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;
+{ yylhsminor.yy812 = createColumnNode(pCxt, &yymsp[-2].minor.yy29, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy124, yymsp[-1].minor.yy812)); }
+ yymsp[-3].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy812), yymsp[-2].minor.yy124, yymsp[-1].minor.yy812)); }
+ yymsp[-4].minor.yy812 = yylhsminor.yy812;
break;
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)); }
+{ yymsp[-3].minor.yy812 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)); }
break;
case 513: /* case_when_else_opt ::= ELSE common_expression */
-{ yymsp[-1].minor.yy1000 = releaseRawExprNode(pCxt, yymsp[0].minor.yy1000); }
+{ yymsp[-1].minor.yy812 = releaseRawExprNode(pCxt, yymsp[0].minor.yy812); }
break;
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.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)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
+ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy590, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
}
- yymsp[-2].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
case 515: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
{
- 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)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy812);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
+ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy812), releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
}
- yymsp[-4].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-4].minor.yy812 = yylhsminor.yy812;
break;
case 516: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
{
- 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)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy812);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
+ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy812), releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
}
- yymsp[-5].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-5].minor.yy812 = yylhsminor.yy812;
break;
case 517: /* predicate ::= expr_or_subquery IS 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));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
+ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), NULL));
}
- yymsp[-2].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
case 518: /* predicate ::= expr_or_subquery IS NOT 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));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy812);
+ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy812), NULL));
}
- yymsp[-3].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-3].minor.yy812 = yylhsminor.yy812;
break;
case 520: /* compare_op ::= NK_LT */
-{ yymsp[0].minor.yy324 = OP_TYPE_LOWER_THAN; }
+{ yymsp[0].minor.yy590 = OP_TYPE_LOWER_THAN; }
break;
case 521: /* compare_op ::= NK_GT */
-{ yymsp[0].minor.yy324 = OP_TYPE_GREATER_THAN; }
+{ yymsp[0].minor.yy590 = OP_TYPE_GREATER_THAN; }
break;
case 522: /* compare_op ::= NK_LE */
-{ yymsp[0].minor.yy324 = OP_TYPE_LOWER_EQUAL; }
+{ yymsp[0].minor.yy590 = OP_TYPE_LOWER_EQUAL; }
break;
case 523: /* compare_op ::= NK_GE */
-{ yymsp[0].minor.yy324 = OP_TYPE_GREATER_EQUAL; }
+{ yymsp[0].minor.yy590 = OP_TYPE_GREATER_EQUAL; }
break;
case 524: /* compare_op ::= NK_NE */
-{ yymsp[0].minor.yy324 = OP_TYPE_NOT_EQUAL; }
+{ yymsp[0].minor.yy590 = OP_TYPE_NOT_EQUAL; }
break;
case 525: /* compare_op ::= NK_EQ */
-{ yymsp[0].minor.yy324 = OP_TYPE_EQUAL; }
+{ yymsp[0].minor.yy590 = OP_TYPE_EQUAL; }
break;
case 526: /* compare_op ::= LIKE */
-{ yymsp[0].minor.yy324 = OP_TYPE_LIKE; }
+{ yymsp[0].minor.yy590 = OP_TYPE_LIKE; }
break;
case 527: /* compare_op ::= NOT LIKE */
-{ yymsp[-1].minor.yy324 = OP_TYPE_NOT_LIKE; }
+{ yymsp[-1].minor.yy590 = OP_TYPE_NOT_LIKE; }
break;
case 528: /* compare_op ::= MATCH */
-{ yymsp[0].minor.yy324 = OP_TYPE_MATCH; }
+{ yymsp[0].minor.yy590 = OP_TYPE_MATCH; }
break;
case 529: /* compare_op ::= NMATCH */
-{ yymsp[0].minor.yy324 = OP_TYPE_NMATCH; }
+{ yymsp[0].minor.yy590 = OP_TYPE_NMATCH; }
break;
case 530: /* compare_op ::= CONTAINS */
-{ yymsp[0].minor.yy324 = OP_TYPE_JSON_CONTAINS; }
+{ yymsp[0].minor.yy590 = OP_TYPE_JSON_CONTAINS; }
break;
case 531: /* in_op ::= IN */
-{ yymsp[0].minor.yy324 = OP_TYPE_IN; }
+{ yymsp[0].minor.yy590 = OP_TYPE_IN; }
break;
case 532: /* in_op ::= NOT IN */
-{ yymsp[-1].minor.yy324 = OP_TYPE_NOT_IN; }
+{ yymsp[-1].minor.yy590 = OP_TYPE_NOT_IN; }
break;
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;
+{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy124)); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
case 535: /* boolean_value_expression ::= NOT boolean_primary */
{
- 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));
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
+ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy812), NULL));
}
- yymsp[-1].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-1].minor.yy812 = yylhsminor.yy812;
break;
case 536: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{
- 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)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
+ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
}
- yymsp[-2].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
case 537: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{
- 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)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy812);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy812);
+ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), releaseRawExprNode(pCxt, yymsp[0].minor.yy812)));
}
- yymsp[-2].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy812, yymsp[0].minor.yy812, NULL); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy29, &yymsp[0].minor.yy29); }
+ yymsp[-1].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createRealTableNode(pCxt, &yymsp[-3].minor.yy29, &yymsp[-1].minor.yy29, &yymsp[0].minor.yy29); }
+ yymsp[-3].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy812), &yymsp[0].minor.yy29); }
+ yymsp[-1].minor.yy812 = yylhsminor.yy812;
break;
case 552: /* alias_opt ::= */
-{ yymsp[1].minor.yy305 = nil_token; }
+{ yymsp[1].minor.yy29 = nil_token; }
break;
case 554: /* alias_opt ::= AS table_alias */
-{ yymsp[-1].minor.yy305 = yymsp[0].minor.yy305; }
+{ yymsp[-1].minor.yy29 = yymsp[0].minor.yy29; }
break;
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; }
+{ yymsp[-2].minor.yy812 = yymsp[-1].minor.yy812; }
break;
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.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);
+ yylhsminor.yy812 = createJoinTableNode(pCxt, yymsp[-6].minor.yy162, yymsp[-5].minor.yy354, yymsp[-7].minor.yy812, yymsp[-3].minor.yy812, yymsp[-2].minor.yy812);
+ yylhsminor.yy812 = addWindowOffsetClause(pCxt, yylhsminor.yy812, yymsp[-1].minor.yy812);
+ yylhsminor.yy812 = addJLimitClause(pCxt, yylhsminor.yy812, yymsp[0].minor.yy812);
}
- yymsp[-7].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-7].minor.yy812 = yylhsminor.yy812;
break;
case 558: /* join_type ::= */
-{ yymsp[1].minor.yy828 = JOIN_TYPE_INNER; }
+{ yymsp[1].minor.yy162 = JOIN_TYPE_INNER; }
break;
case 559: /* join_type ::= INNER */
-{ yymsp[0].minor.yy828 = JOIN_TYPE_INNER; }
+{ yymsp[0].minor.yy162 = JOIN_TYPE_INNER; }
break;
case 560: /* join_type ::= LEFT */
-{ yymsp[0].minor.yy828 = JOIN_TYPE_LEFT; }
+{ yymsp[0].minor.yy162 = JOIN_TYPE_LEFT; }
break;
case 561: /* join_type ::= RIGHT */
-{ yymsp[0].minor.yy828 = JOIN_TYPE_RIGHT; }
+{ yymsp[0].minor.yy162 = JOIN_TYPE_RIGHT; }
break;
case 562: /* join_type ::= FULL */
-{ yymsp[0].minor.yy828 = JOIN_TYPE_FULL; }
+{ yymsp[0].minor.yy162 = JOIN_TYPE_FULL; }
break;
case 563: /* join_subtype ::= */
-{ yymsp[1].minor.yy166 = JOIN_STYPE_NONE; }
+{ yymsp[1].minor.yy354 = JOIN_STYPE_NONE; }
break;
case 564: /* join_subtype ::= OUTER */
-{ yymsp[0].minor.yy166 = JOIN_STYPE_OUTER; }
+{ yymsp[0].minor.yy354 = JOIN_STYPE_OUTER; }
break;
case 565: /* join_subtype ::= SEMI */
-{ yymsp[0].minor.yy166 = JOIN_STYPE_SEMI; }
+{ yymsp[0].minor.yy354 = JOIN_STYPE_SEMI; }
break;
case 566: /* join_subtype ::= ANTI */
-{ yymsp[0].minor.yy166 = JOIN_STYPE_ANTI; }
+{ yymsp[0].minor.yy354 = JOIN_STYPE_ANTI; }
break;
case 567: /* join_subtype ::= ASOF */
-{ yymsp[0].minor.yy166 = JOIN_STYPE_ASOF; }
+{ yymsp[0].minor.yy354 = JOIN_STYPE_ASOF; }
break;
case 568: /* join_subtype ::= WINDOW */
-{ yymsp[0].minor.yy166 = JOIN_STYPE_WIN; }
+{ yymsp[0].minor.yy354 = JOIN_STYPE_WIN; }
break;
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)); }
+{ yymsp[-5].minor.yy812 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy812), releaseRawExprNode(pCxt, yymsp[-1].minor.yy812)); }
break;
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;
+{ yylhsminor.yy812 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
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.yy1000 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t));
+ yylhsminor.yy812 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t));
}
- yymsp[-1].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-1].minor.yy812 = yylhsminor.yy812;
break;
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); }
+ case 647: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==647);
+ case 651: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==651);
+{ yymsp[-1].minor.yy812 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
break;
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.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);
+ yymsp[-13].minor.yy812 = createSelectStmt(pCxt, yymsp[-11].minor.yy887, yymsp[-9].minor.yy124, yymsp[-8].minor.yy812, yymsp[-12].minor.yy124);
+ yymsp[-13].minor.yy812 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy812, yymsp[-10].minor.yy887);
+ yymsp[-13].minor.yy812 = addWhereClause(pCxt, yymsp[-13].minor.yy812, yymsp[-7].minor.yy812);
+ yymsp[-13].minor.yy812 = addPartitionByClause(pCxt, yymsp[-13].minor.yy812, yymsp[-6].minor.yy124);
+ yymsp[-13].minor.yy812 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy812, yymsp[-2].minor.yy812);
+ yymsp[-13].minor.yy812 = addGroupByClause(pCxt, yymsp[-13].minor.yy812, yymsp[-1].minor.yy124);
+ yymsp[-13].minor.yy812 = addHavingClause(pCxt, yymsp[-13].minor.yy812, yymsp[0].minor.yy812);
+ yymsp[-13].minor.yy812 = addRangeClause(pCxt, yymsp[-13].minor.yy812, yymsp[-5].minor.yy812);
+ yymsp[-13].minor.yy812 = addEveryClause(pCxt, yymsp[-13].minor.yy812, yymsp[-4].minor.yy812);
+ yymsp[-13].minor.yy812 = addFillClause(pCxt, yymsp[-13].minor.yy812, yymsp[-3].minor.yy812);
}
break;
case 578: /* hint_list ::= */
-{ yymsp[1].minor.yy72 = createHintNodeList(pCxt, NULL); }
+{ yymsp[1].minor.yy124 = createHintNodeList(pCxt, NULL); }
break;
case 579: /* hint_list ::= NK_HINT */
-{ yylhsminor.yy72 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy72 = yylhsminor.yy72;
+{ yylhsminor.yy124 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy124 = yylhsminor.yy124;
break;
case 584: /* set_quantifier_opt ::= ALL */
-{ yymsp[0].minor.yy985 = false; }
+{ yymsp[0].minor.yy887 = false; }
break;
case 587: /* select_item ::= NK_STAR */
-{ yylhsminor.yy1000 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy1000 = yylhsminor.yy1000;
+{ yylhsminor.yy812 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy812), &yymsp[0].minor.yy29); }
+ yymsp[-1].minor.yy812 = yylhsminor.yy812;
break;
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;
+{ yylhsminor.yy812 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), &yymsp[0].minor.yy29); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
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; }
+ case 625: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==625);
+ case 645: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==645);
+{ yymsp[-2].minor.yy124 = yymsp[0].minor.yy124; }
break;
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)); }
+{ yymsp[-5].minor.yy812 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy812), releaseRawExprNode(pCxt, yymsp[-1].minor.yy812)); }
break;
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)); }
+{ yymsp[-3].minor.yy812 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy812)); }
break;
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); }
+{ yymsp[-5].minor.yy812 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy812), NULL, yymsp[-1].minor.yy812, yymsp[0].minor.yy812); }
break;
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); }
+{ yymsp[-7].minor.yy812 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy812), releaseRawExprNode(pCxt, yymsp[-3].minor.yy812), yymsp[-1].minor.yy812, yymsp[0].minor.yy812); }
break;
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); }
+{ yymsp[-6].minor.yy812 = createEventWindowNode(pCxt, yymsp[-3].minor.yy812, yymsp[0].minor.yy812); }
break;
- case 613: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
-{ yymsp[-3].minor.yy1000 = createFillNode(pCxt, yymsp[-1].minor.yy926, NULL); }
+ case 607: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy812 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); }
break;
- 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)); }
+ case 608: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+{ yymsp[-5].minor.yy812 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); }
break;
- 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)); }
+ case 615: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
+{ yymsp[-3].minor.yy812 = createFillNode(pCxt, yymsp[-1].minor.yy144, NULL); }
break;
- case 616: /* fill_mode ::= NONE */
-{ yymsp[0].minor.yy926 = FILL_MODE_NONE; }
+ case 616: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
+{ yymsp[-5].minor.yy812 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy124)); }
break;
- case 617: /* fill_mode ::= PREV */
-{ yymsp[0].minor.yy926 = FILL_MODE_PREV; }
+ case 617: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
+{ yymsp[-5].minor.yy812 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy124)); }
break;
- case 618: /* fill_mode ::= NULL */
-{ yymsp[0].minor.yy926 = FILL_MODE_NULL; }
+ case 618: /* fill_mode ::= NONE */
+{ yymsp[0].minor.yy144 = FILL_MODE_NONE; }
break;
- case 619: /* fill_mode ::= NULL_F */
-{ yymsp[0].minor.yy926 = FILL_MODE_NULL_F; }
+ case 619: /* fill_mode ::= PREV */
+{ yymsp[0].minor.yy144 = FILL_MODE_PREV; }
break;
- case 620: /* fill_mode ::= LINEAR */
-{ yymsp[0].minor.yy926 = FILL_MODE_LINEAR; }
+ case 620: /* fill_mode ::= NULL */
+{ yymsp[0].minor.yy144 = FILL_MODE_NULL; }
break;
- case 621: /* fill_mode ::= NEXT */
-{ yymsp[0].minor.yy926 = FILL_MODE_NEXT; }
+ case 621: /* fill_mode ::= NULL_F */
+{ yymsp[0].minor.yy144 = FILL_MODE_NULL_F; }
break;
- 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;
+ case 622: /* fill_mode ::= LINEAR */
+{ yymsp[0].minor.yy144 = FILL_MODE_LINEAR; }
break;
- 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;
+ case 623: /* fill_mode ::= NEXT */
+{ yymsp[0].minor.yy144 = FILL_MODE_NEXT; }
break;
- 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)); }
+ case 626: /* group_by_list ::= expr_or_subquery */
+{ yylhsminor.yy124 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy812))); }
+ yymsp[0].minor.yy124 = yylhsminor.yy124;
break;
- case 630: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
-{ yymsp[-3].minor.yy1000 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy1000)); }
+ case 627: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+{ yylhsminor.yy124 = addNodeToList(pCxt, yymsp[-2].minor.yy124, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy812))); }
+ yymsp[-2].minor.yy124 = yylhsminor.yy124;
break;
- case 633: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ case 631: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+{ yymsp[-5].minor.yy812 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy812), releaseRawExprNode(pCxt, yymsp[-1].minor.yy812)); }
+ break;
+ case 632: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
+{ yymsp[-3].minor.yy812 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy812)); }
+ break;
+ case 635: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
{
- 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);
+ yylhsminor.yy812 = addOrderByClause(pCxt, yymsp[-3].minor.yy812, yymsp[-2].minor.yy124);
+ yylhsminor.yy812 = addSlimitClause(pCxt, yylhsminor.yy812, yymsp[-1].minor.yy812);
+ yylhsminor.yy812 = addLimitClause(pCxt, yylhsminor.yy812, yymsp[0].minor.yy812);
}
- yymsp[-3].minor.yy1000 = yylhsminor.yy1000;
+ yymsp[-3].minor.yy812 = yylhsminor.yy812;
break;
- 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;
+ case 638: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+{ yylhsminor.yy812 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy812, yymsp[0].minor.yy812); }
+ yymsp[-3].minor.yy812 = yylhsminor.yy812;
break;
- 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;
+ case 639: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+{ yylhsminor.yy812 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy812, yymsp[0].minor.yy812); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
- 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); }
+ case 648: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ case 652: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==652);
+{ yymsp[-3].minor.yy812 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
break;
- 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); }
+ case 649: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ case 653: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==653);
+{ yymsp[-3].minor.yy812 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
break;
- 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;
+ case 654: /* subquery ::= NK_LP query_expression NK_RP */
+{ yylhsminor.yy812 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy812); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
- 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;
+ case 659: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+{ yylhsminor.yy812 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy812), yymsp[-1].minor.yy638, yymsp[0].minor.yy907); }
+ yymsp[-2].minor.yy812 = yylhsminor.yy812;
break;
- case 658: /* ordering_specification_opt ::= */
-{ yymsp[1].minor.yy130 = ORDER_ASC; }
+ case 660: /* ordering_specification_opt ::= */
+{ yymsp[1].minor.yy638 = ORDER_ASC; }
break;
- case 659: /* ordering_specification_opt ::= ASC */
-{ yymsp[0].minor.yy130 = ORDER_ASC; }
+ case 661: /* ordering_specification_opt ::= ASC */
+{ yymsp[0].minor.yy638 = ORDER_ASC; }
break;
- case 660: /* ordering_specification_opt ::= DESC */
-{ yymsp[0].minor.yy130 = ORDER_DESC; }
+ case 662: /* ordering_specification_opt ::= DESC */
+{ yymsp[0].minor.yy638 = ORDER_DESC; }
break;
- case 661: /* null_ordering_opt ::= */
-{ yymsp[1].minor.yy681 = NULL_ORDER_DEFAULT; }
+ case 663: /* null_ordering_opt ::= */
+{ yymsp[1].minor.yy907 = NULL_ORDER_DEFAULT; }
break;
- case 662: /* null_ordering_opt ::= NULLS FIRST */
-{ yymsp[-1].minor.yy681 = NULL_ORDER_FIRST; }
+ case 664: /* null_ordering_opt ::= NULLS FIRST */
+{ yymsp[-1].minor.yy907 = NULL_ORDER_FIRST; }
break;
- case 663: /* null_ordering_opt ::= NULLS LAST */
-{ yymsp[-1].minor.yy681 = NULL_ORDER_LAST; }
+ case 665: /* null_ordering_opt ::= NULLS LAST */
+{ yymsp[-1].minor.yy907 = NULL_ORDER_LAST; }
break;
default:
break;
diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c
index 125ddb3c1c..bc48012d01 100644
--- a/source/libs/planner/src/planLogicCreater.c
+++ b/source/libs/planner/src/planLogicCreater.c
@@ -1041,6 +1041,29 @@ static int32_t createWindowLogicNodeByEvent(SLogicPlanContext* pCxt, SEventWindo
return createWindowLogicNodeFinalize(pCxt, pSelect, pWindow, pLogicNode);
}
+static int32_t createWindowLogicNodeByCount(SLogicPlanContext* pCxt, SCountWindowNode* pCount, SSelectStmt* pSelect,
+ SLogicNode** pLogicNode) {
+ SWindowLogicNode* pWindow = (SWindowLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_WINDOW);
+ if (NULL == pWindow) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ pWindow->winType = WINDOW_TYPE_COUNT;
+ pWindow->node.groupAction = getGroupAction(pCxt, pSelect);
+ pWindow->node.requireDataOrder =
+ pCxt->pPlanCxt->streamQuery ? DATA_ORDER_LEVEL_IN_BLOCK : getRequireDataOrder(true, pSelect);
+ pWindow->node.resultDataOrder =
+ pCxt->pPlanCxt->streamQuery ? DATA_ORDER_LEVEL_GLOBAL : pWindow->node.requireDataOrder;
+ pWindow->windowCount = pCount->windowCount;
+ pWindow->windowSliding = pCount->windowSliding;
+ pWindow->pTspk = nodesCloneNode(pCount->pCol);
+ if (NULL == pWindow->pTspk) {
+ nodesDestroyNode((SNode*)pWindow);
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ return createWindowLogicNodeFinalize(pCxt, pSelect, pWindow, pLogicNode);
+}
+
static int32_t createWindowLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SLogicNode** pLogicNode) {
if (NULL == pSelect->pWindow) {
return TSDB_CODE_SUCCESS;
@@ -1054,6 +1077,8 @@ static int32_t createWindowLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSele
return createWindowLogicNodeByInterval(pCxt, (SIntervalWindowNode*)pSelect->pWindow, pSelect, pLogicNode);
case QUERY_NODE_EVENT_WINDOW:
return createWindowLogicNodeByEvent(pCxt, (SEventWindowNode*)pSelect->pWindow, pSelect, pLogicNode);
+ case QUERY_NODE_COUNT_WINDOW:
+ return createWindowLogicNodeByCount(pCxt, (SCountWindowNode*)pSelect->pWindow, pSelect, pLogicNode);
default:
break;
}
diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c
index 34c2fd7768..90cf0590ee 100644
--- a/source/libs/planner/src/planPhysiCreater.c
+++ b/source/libs/planner/src/planPhysiCreater.c
@@ -1893,6 +1893,27 @@ static int32_t createEventWindowPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pC
return code;
}
+static int32_t createCountWindowPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren,
+ SWindowLogicNode* pWindowLogicNode, SPhysiNode** pPhyNode) {
+ SCountWinodwPhysiNode* pCount = (SCountWinodwPhysiNode*)makePhysiNode(
+ pCxt, (SLogicNode*)pWindowLogicNode,
+ (pCxt->pPlanCxt->streamQuery ? QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT : QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT));
+ if (NULL == pCount) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ pCount->windowCount = pWindowLogicNode->windowCount;
+ pCount->windowSliding = pWindowLogicNode->windowSliding;
+
+ int32_t code = createWindowPhysiNodeFinalize(pCxt, pChildren, &pCount->window, pWindowLogicNode);
+ if (TSDB_CODE_SUCCESS == code) {
+ *pPhyNode = (SPhysiNode*)pCount;
+ } else {
+ nodesDestroyNode((SNode*)pCount);
+ }
+
+ return code;
+}
+
static int32_t createWindowPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren, SWindowLogicNode* pWindowLogicNode,
SPhysiNode** pPhyNode) {
switch (pWindowLogicNode->winType) {
@@ -1904,6 +1925,8 @@ static int32_t createWindowPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildr
return createStateWindowPhysiNode(pCxt, pChildren, pWindowLogicNode, pPhyNode);
case WINDOW_TYPE_EVENT:
return createEventWindowPhysiNode(pCxt, pChildren, pWindowLogicNode, pPhyNode);
+ case WINDOW_TYPE_COUNT:
+ return createCountWindowPhysiNode(pCxt, pChildren, pWindowLogicNode, pPhyNode);
default:
break;
}
diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c
index 4099f2be42..d9a7475f59 100644
--- a/source/libs/planner/src/planSpliter.c
+++ b/source/libs/planner/src/planSpliter.c
@@ -872,6 +872,18 @@ static int32_t stbSplSplitEvent(SSplitContext* pCxt, SStableSplitInfo* pInfo) {
}
}
+static int32_t stbSplSplitCountForStream(SSplitContext* pCxt, SStableSplitInfo* pInfo) {
+ return TSDB_CODE_PLAN_INTERNAL_ERROR;
+}
+
+static int32_t stbSplSplitCount(SSplitContext* pCxt, SStableSplitInfo* pInfo) {
+ if (pCxt->pPlanCxt->streamQuery) {
+ return stbSplSplitCountForStream(pCxt, pInfo);
+ } else {
+ return stbSplSplitSessionOrStateForBatch(pCxt, pInfo);
+ }
+}
+
static int32_t stbSplSplitWindowForCrossTable(SSplitContext* pCxt, SStableSplitInfo* pInfo) {
switch (((SWindowLogicNode*)pInfo->pSplitNode)->winType) {
case WINDOW_TYPE_INTERVAL:
@@ -882,6 +894,8 @@ static int32_t stbSplSplitWindowForCrossTable(SSplitContext* pCxt, SStableSplitI
return stbSplSplitState(pCxt, pInfo);
case WINDOW_TYPE_EVENT:
return stbSplSplitEvent(pCxt, pInfo);
+ case WINDOW_TYPE_COUNT:
+ return stbSplSplitCount(pCxt, pInfo);
default:
break;
}
diff --git a/source/libs/planner/src/planUtil.c b/source/libs/planner/src/planUtil.c
index aeef3f2487..74b325a298 100644
--- a/source/libs/planner/src/planUtil.c
+++ b/source/libs/planner/src/planUtil.c
@@ -237,6 +237,15 @@ static int32_t adjustEventDataRequirement(SWindowLogicNode* pWindow, EDataOrderL
return TSDB_CODE_SUCCESS;
}
+static int32_t adjustCountDataRequirement(SWindowLogicNode* pWindow, EDataOrderLevel requirement) {
+ if (requirement <= pWindow->node.resultDataOrder) {
+ return TSDB_CODE_SUCCESS;
+ }
+ pWindow->node.resultDataOrder = requirement;
+ pWindow->node.requireDataOrder = requirement;
+ return TSDB_CODE_SUCCESS;
+}
+
static int32_t adjustWindowDataRequirement(SWindowLogicNode* pWindow, EDataOrderLevel requirement) {
switch (pWindow->winType) {
case WINDOW_TYPE_INTERVAL:
@@ -247,6 +256,8 @@ static int32_t adjustWindowDataRequirement(SWindowLogicNode* pWindow, EDataOrder
return adjustStateDataRequirement(pWindow, requirement);
case WINDOW_TYPE_EVENT:
return adjustEventDataRequirement(pWindow, requirement);
+ case WINDOW_TYPE_COUNT:
+ return adjustCountDataRequirement(pWindow, requirement);
default:
break;
}
diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c
index 6e312f0e6f..e50ec64d54 100644
--- a/source/libs/scheduler/src/schJob.c
+++ b/source/libs/scheduler/src/schJob.c
@@ -66,7 +66,7 @@ FORCE_INLINE bool schJobNeedToStop(SSchJob *pJob, int8_t *pStatus) {
return true;
}
- if ((*pJob->chkKillFp)(pJob->chkKillParam)) {
+ if (pJob->chkKillFp && (*pJob->chkKillFp)(pJob->chkKillParam)) {
schUpdateJobErrCode(pJob, TSDB_CODE_TSC_QUERY_KILLED);
return true;
}
diff --git a/source/libs/scheduler/src/schUtil.c b/source/libs/scheduler/src/schUtil.c
index 39c54ea731..47e6d53b46 100644
--- a/source/libs/scheduler/src/schUtil.c
+++ b/source/libs/scheduler/src/schUtil.c
@@ -263,6 +263,7 @@ void schCloseJobRef(void) {
uint64_t schGenTaskId(void) { return atomic_add_fetch_64(&schMgmt.taskId, 1); }
+#ifdef BUILD_NO_CALL
uint64_t schGenUUID(void) {
static uint64_t hashId = 0;
static int32_t requestSerialId = 0;
@@ -284,6 +285,7 @@ uint64_t schGenUUID(void) {
uint64_t id = ((hashId & 0x0FFF) << 52) | ((pid & 0x0FFF) << 40) | ((ts & 0xFFFFFF) << 16) | (val & 0xFFFF);
return id;
}
+#endif
void schFreeRpcCtxVal(const void *arg) {
if (NULL == arg) {
diff --git a/source/libs/scheduler/test/CMakeLists.txt b/source/libs/scheduler/test/CMakeLists.txt
index 703bd5932b..9605cc7a1c 100644
--- a/source/libs/scheduler/test/CMakeLists.txt
+++ b/source/libs/scheduler/test/CMakeLists.txt
@@ -25,4 +25,9 @@ IF(NOT TD_DARWIN)
PUBLIC "${TD_SOURCE_DIR}/include/libs/scheduler/"
PRIVATE "${TD_SOURCE_DIR}/source/libs/scheduler/inc"
)
+ add_test(
+ NAME schedulerTest
+ COMMAND schedulerTest
+ )
+
ENDIF()
\ No newline at end of file
diff --git a/source/libs/scheduler/test/schedulerTests.cpp b/source/libs/scheduler/test/schedulerTests.cpp
index 5605a4b842..c52a8599a0 100644
--- a/source/libs/scheduler/test/schedulerTests.cpp
+++ b/source/libs/scheduler/test/schedulerTests.cpp
@@ -54,20 +54,20 @@
namespace {
-extern "C" int32_t schHandleResponseMsg(SSchJob *job, SSchTask *task, int32_t msgType, char *msg, int32_t msgSize,
- int32_t rspCode);
-extern "C" int32_t schHandleCallback(void *param, const SDataBuf *pMsg, int32_t msgType, int32_t rspCode);
+extern "C" int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDataBuf *pMsg, int32_t rspCode);
+extern "C" int32_t schHandleCallback(void *param, const SDataBuf *pMsg, int32_t rspCode);
int64_t insertJobRefId = 0;
int64_t queryJobRefId = 0;
+bool schtJobDone = false;
uint64_t schtMergeTemplateId = 0x4;
uint64_t schtFetchTaskId = 0;
uint64_t schtQueryId = 1;
bool schtTestStop = false;
bool schtTestDeadLoop = false;
-int32_t schtTestMTRunSec = 10;
+int32_t schtTestMTRunSec = 1;
int32_t schtTestPrintNum = 1000;
int32_t schtStartFetch = 0;
@@ -85,10 +85,69 @@ void schtInitLogFile() {
}
void schtQueryCb(SExecResult *pResult, void *param, int32_t code) {
- assert(TSDB_CODE_SUCCESS == code);
*(int32_t *)param = 1;
}
+int32_t schtBuildQueryRspMsg(uint32_t *msize, void** rspMsg) {
+ SQueryTableRsp rsp = {0};
+ rsp.code = 0;
+ rsp.affectedRows = 0;
+ rsp.tbVerInfo = NULL;
+
+ int32_t msgSize = tSerializeSQueryTableRsp(NULL, 0, &rsp);
+ if (msgSize < 0) {
+ qError("tSerializeSQueryTableRsp failed");
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ void *pRsp = taosMemoryCalloc(msgSize, 1);
+ if (NULL == pRsp) {
+ qError("rpcMallocCont %d failed", msgSize);
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ if (tSerializeSQueryTableRsp(pRsp, msgSize, &rsp) < 0) {
+ qError("tSerializeSQueryTableRsp %d failed", msgSize);
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ *rspMsg = pRsp;
+ *msize = msgSize;
+
+ return TSDB_CODE_SUCCESS;
+}
+
+
+int32_t schtBuildFetchRspMsg(uint32_t *msize, void** rspMsg) {
+ SRetrieveTableRsp* rsp = (SRetrieveTableRsp*)taosMemoryCalloc(sizeof(SRetrieveTableRsp), 1);
+ rsp->completed = 1;
+ rsp->numOfRows = 10;
+ rsp->compLen = 0;
+
+ *rspMsg = rsp;
+ *msize = sizeof(SRetrieveTableRsp);
+
+ return TSDB_CODE_SUCCESS;
+}
+
+int32_t schtBuildSubmitRspMsg(uint32_t *msize, void** rspMsg) {
+ SSubmitRsp2 submitRsp = {0};
+ int32_t msgSize = 0, ret = 0;
+ SEncoder ec = {0};
+
+ tEncodeSize(tEncodeSSubmitRsp2, &submitRsp, msgSize, ret);
+ void* msg = taosMemoryCalloc(1, msgSize);
+ tEncoderInit(&ec, (uint8_t*)msg, msgSize);
+ tEncodeSSubmitRsp2(&ec, &submitRsp);
+ tEncoderClear(&ec);
+
+ *rspMsg = msg;
+ *msize = msgSize;
+
+ return TSDB_CODE_SUCCESS;
+}
+
+
void schtBuildQueryDag(SQueryPlan *dag) {
uint64_t qId = schtQueryId;
@@ -98,8 +157,8 @@ void schtBuildQueryDag(SQueryPlan *dag) {
SNodeListNode *scan = (SNodeListNode *)nodesMakeNode(QUERY_NODE_NODE_LIST);
SNodeListNode *merge = (SNodeListNode *)nodesMakeNode(QUERY_NODE_NODE_LIST);
- SSubplan *scanPlan = (SSubplan *)taosMemoryCalloc(1, sizeof(SSubplan));
- SSubplan *mergePlan = (SSubplan *)taosMemoryCalloc(1, sizeof(SSubplan));
+ SSubplan *scanPlan = (SSubplan*)nodesMakeNode(QUERY_NODE_PHYSICAL_SUBPLAN);
+ SSubplan *mergePlan = (SSubplan*)nodesMakeNode(QUERY_NODE_PHYSICAL_SUBPLAN);
scanPlan->id.queryId = qId;
scanPlan->id.groupId = 0x0000000000000002;
@@ -113,7 +172,7 @@ void schtBuildQueryDag(SQueryPlan *dag) {
scanPlan->pChildren = NULL;
scanPlan->level = 1;
scanPlan->pParents = nodesMakeList();
- scanPlan->pNode = (SPhysiNode *)taosMemoryCalloc(1, sizeof(SPhysiNode));
+ scanPlan->pNode = (SPhysiNode *)nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN);
scanPlan->msgType = TDMT_SCH_QUERY;
mergePlan->id.queryId = qId;
@@ -125,7 +184,7 @@ void schtBuildQueryDag(SQueryPlan *dag) {
mergePlan->pChildren = nodesMakeList();
mergePlan->pParents = NULL;
- mergePlan->pNode = (SPhysiNode *)taosMemoryCalloc(1, sizeof(SPhysiNode));
+ mergePlan->pNode = (SPhysiNode *)nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN_MERGE);
mergePlan->msgType = TDMT_SCH_QUERY;
merge->pNodeList = nodesMakeList();
@@ -151,8 +210,7 @@ void schtBuildQueryFlowCtrlDag(SQueryPlan *dag) {
SNodeListNode *scan = (SNodeListNode *)nodesMakeNode(QUERY_NODE_NODE_LIST);
SNodeListNode *merge = (SNodeListNode *)nodesMakeNode(QUERY_NODE_NODE_LIST);
- SSubplan *scanPlan = (SSubplan *)taosMemoryCalloc(scanPlanNum, sizeof(SSubplan));
- SSubplan *mergePlan = (SSubplan *)taosMemoryCalloc(1, sizeof(SSubplan));
+ SSubplan *mergePlan = (SSubplan*)nodesMakeNode(QUERY_NODE_PHYSICAL_SUBPLAN);
merge->pNodeList = nodesMakeList();
scan->pNodeList = nodesMakeList();
@@ -160,29 +218,30 @@ void schtBuildQueryFlowCtrlDag(SQueryPlan *dag) {
mergePlan->pChildren = nodesMakeList();
for (int32_t i = 0; i < scanPlanNum; ++i) {
- scanPlan[i].id.queryId = qId;
- scanPlan[i].id.groupId = 0x0000000000000002;
- scanPlan[i].id.subplanId = 0x0000000000000003 + i;
- scanPlan[i].subplanType = SUBPLAN_TYPE_SCAN;
+ SSubplan *scanPlan = (SSubplan*)nodesMakeNode(QUERY_NODE_PHYSICAL_SUBPLAN);
+ scanPlan->id.queryId = qId;
+ scanPlan->id.groupId = 0x0000000000000002;
+ scanPlan->id.subplanId = 0x0000000000000003 + i;
+ scanPlan->subplanType = SUBPLAN_TYPE_SCAN;
- scanPlan[i].execNode.nodeId = 1 + i;
- scanPlan[i].execNode.epSet.inUse = 0;
- scanPlan[i].execNodeStat.tableNum = taosRand() % 30;
- addEpIntoEpSet(&scanPlan[i].execNode.epSet, "ep0", 6030);
- addEpIntoEpSet(&scanPlan[i].execNode.epSet, "ep1", 6030);
- addEpIntoEpSet(&scanPlan[i].execNode.epSet, "ep2", 6030);
- scanPlan[i].execNode.epSet.inUse = taosRand() % 3;
+ scanPlan->execNode.nodeId = 1 + i;
+ scanPlan->execNode.epSet.inUse = 0;
+ scanPlan->execNodeStat.tableNum = taosRand() % 30;
+ addEpIntoEpSet(&scanPlan->execNode.epSet, "ep0", 6030);
+ addEpIntoEpSet(&scanPlan->execNode.epSet, "ep1", 6030);
+ addEpIntoEpSet(&scanPlan->execNode.epSet, "ep2", 6030);
+ scanPlan->execNode.epSet.inUse = taosRand() % 3;
- scanPlan[i].pChildren = NULL;
- scanPlan[i].level = 1;
- scanPlan[i].pParents = nodesMakeList();
- scanPlan[i].pNode = (SPhysiNode *)taosMemoryCalloc(1, sizeof(SPhysiNode));
- scanPlan[i].msgType = TDMT_SCH_QUERY;
+ scanPlan->pChildren = NULL;
+ scanPlan->level = 1;
+ scanPlan->pParents = nodesMakeList();
+ scanPlan->pNode = (SPhysiNode *)nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN);
+ scanPlan->msgType = TDMT_SCH_QUERY;
- nodesListAppend(scanPlan[i].pParents, (SNode *)mergePlan);
- nodesListAppend(mergePlan->pChildren, (SNode *)(scanPlan + i));
+ nodesListAppend(scanPlan->pParents, (SNode *)mergePlan);
+ nodesListAppend(mergePlan->pChildren, (SNode *)scanPlan);
- nodesListAppend(scan->pNodeList, (SNode *)(scanPlan + i));
+ nodesListAppend(scan->pNodeList, (SNode *)scanPlan);
}
mergePlan->id.queryId = qId;
@@ -193,7 +252,7 @@ void schtBuildQueryFlowCtrlDag(SQueryPlan *dag) {
mergePlan->execNode.epSet.numOfEps = 0;
mergePlan->pParents = NULL;
- mergePlan->pNode = (SPhysiNode *)taosMemoryCalloc(1, sizeof(SPhysiNode));
+ mergePlan->pNode = (SPhysiNode *)nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN_MERGE);
mergePlan->msgType = TDMT_SCH_QUERY;
nodesListAppend(merge->pNodeList, (SNode *)mergePlan);
@@ -211,45 +270,50 @@ void schtBuildInsertDag(SQueryPlan *dag) {
dag->numOfSubplans = 2;
dag->pSubplans = nodesMakeList();
SNodeListNode *inserta = (SNodeListNode *)nodesMakeNode(QUERY_NODE_NODE_LIST);
-
- SSubplan *insertPlan = (SSubplan *)taosMemoryCalloc(2, sizeof(SSubplan));
-
- insertPlan[0].id.queryId = qId;
- insertPlan[0].id.groupId = 0x0000000000000003;
- insertPlan[0].id.subplanId = 0x0000000000000004;
- insertPlan[0].subplanType = SUBPLAN_TYPE_MODIFY;
- insertPlan[0].level = 0;
-
- insertPlan[0].execNode.nodeId = 1;
- insertPlan[0].execNode.epSet.inUse = 0;
- addEpIntoEpSet(&insertPlan[0].execNode.epSet, "ep0", 6030);
-
- insertPlan[0].pChildren = NULL;
- insertPlan[0].pParents = NULL;
- insertPlan[0].pNode = NULL;
- insertPlan[0].pDataSink = (SDataSinkNode *)taosMemoryCalloc(1, sizeof(SDataSinkNode));
- insertPlan[0].msgType = TDMT_VND_SUBMIT;
-
- insertPlan[1].id.queryId = qId;
- insertPlan[1].id.groupId = 0x0000000000000003;
- insertPlan[1].id.subplanId = 0x0000000000000005;
- insertPlan[1].subplanType = SUBPLAN_TYPE_MODIFY;
- insertPlan[1].level = 0;
-
- insertPlan[1].execNode.nodeId = 1;
- insertPlan[1].execNode.epSet.inUse = 0;
- addEpIntoEpSet(&insertPlan[1].execNode.epSet, "ep0", 6030);
-
- insertPlan[1].pChildren = NULL;
- insertPlan[1].pParents = NULL;
- insertPlan[1].pNode = NULL;
- insertPlan[1].pDataSink = (SDataSinkNode *)taosMemoryCalloc(1, sizeof(SDataSinkNode));
- insertPlan[1].msgType = TDMT_VND_SUBMIT;
-
inserta->pNodeList = nodesMakeList();
+ SSubplan *insertPlan = (SSubplan*)nodesMakeNode(QUERY_NODE_PHYSICAL_SUBPLAN);
+
+ insertPlan->id.queryId = qId;
+ insertPlan->id.groupId = 0x0000000000000003;
+ insertPlan->id.subplanId = 0x0000000000000004;
+ insertPlan->subplanType = SUBPLAN_TYPE_MODIFY;
+ insertPlan->level = 0;
+
+ insertPlan->execNode.nodeId = 1;
+ insertPlan->execNode.epSet.inUse = 0;
+ addEpIntoEpSet(&insertPlan->execNode.epSet, "ep0", 6030);
+
+ insertPlan->pChildren = NULL;
+ insertPlan->pParents = NULL;
+ insertPlan->pNode = NULL;
+ insertPlan->pDataSink = (SDataSinkNode*)nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN_INSERT);
+ ((SDataInserterNode*)insertPlan->pDataSink)->size = 1;
+ ((SDataInserterNode*)insertPlan->pDataSink)->pData = taosMemoryCalloc(1, 1);
+ insertPlan->msgType = TDMT_VND_SUBMIT;
+
nodesListAppend(inserta->pNodeList, (SNode *)insertPlan);
- insertPlan += 1;
+
+ insertPlan = (SSubplan*)nodesMakeNode(QUERY_NODE_PHYSICAL_SUBPLAN);
+
+ insertPlan->id.queryId = qId;
+ insertPlan->id.groupId = 0x0000000000000003;
+ insertPlan->id.subplanId = 0x0000000000000005;
+ insertPlan->subplanType = SUBPLAN_TYPE_MODIFY;
+ insertPlan->level = 0;
+
+ insertPlan->execNode.nodeId = 1;
+ insertPlan->execNode.epSet.inUse = 0;
+ addEpIntoEpSet(&insertPlan->execNode.epSet, "ep0", 6030);
+
+ insertPlan->pChildren = NULL;
+ insertPlan->pParents = NULL;
+ insertPlan->pNode = NULL;
+ insertPlan->pDataSink = (SDataSinkNode*)nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN_INSERT);
+ ((SDataInserterNode*)insertPlan->pDataSink)->size = 1;
+ ((SDataInserterNode*)insertPlan->pDataSink)->pData = taosMemoryCalloc(1, 1);
+ insertPlan->msgType = TDMT_VND_SUBMIT;
+
nodesListAppend(inserta->pNodeList, (SNode *)insertPlan);
nodesListAppend(dag->pSubplans, (SNode *)inserta);
@@ -325,7 +389,7 @@ void schtSetRpcSendRequest() {
}
}
-int32_t schtAsyncSendMsgToServer(void *pTransporter, SEpSet *epSet, int64_t *pTransporterId, SMsgSendInfo *pInfo) {
+int32_t schtAsyncSendMsgToServer(void *pTransporter, SEpSet *epSet, int64_t *pTransporterId, SMsgSendInfo *pInfo, bool persistHandle, void* rpcCtx) {
if (pInfo) {
taosMemoryFreeClear(pInfo->param);
taosMemoryFreeClear(pInfo->msgInfo.pData);
@@ -336,17 +400,17 @@ int32_t schtAsyncSendMsgToServer(void *pTransporter, SEpSet *epSet, int64_t *pTr
void schtSetAsyncSendMsgToServer() {
static Stub stub;
- stub.set(asyncSendMsgToServer, schtAsyncSendMsgToServer);
+ stub.set(asyncSendMsgToServerExt, schtAsyncSendMsgToServer);
{
#ifdef WINDOWS
AddrAny any;
std::map result;
- any.get_func_addr("asyncSendMsgToServer", result);
+ any.get_func_addr("asyncSendMsgToServerExt", result);
#endif
#ifdef LINUX
AddrAny any("libtransport.so");
std::map result;
- any.get_global_func_addr_dynsym("^asyncSendMsgToServer$", result);
+ any.get_global_func_addr_dynsym("^asyncSendMsgToServerExt$", result);
#endif
for (const auto &f : result) {
stub.set(f.second, schtAsyncSendMsgToServer);
@@ -374,15 +438,21 @@ void *schtSendRsp(void *param) {
while (pIter) {
SSchTask *task = *(SSchTask **)pIter;
- SSubmitRsp rsp = {0};
- rsp.affectedRows = 10;
- schHandleResponseMsg(pJob, task, TDMT_VND_SUBMIT_RSP, (char *)&rsp, sizeof(rsp), 0);
+ SDataBuf msg = {0};
+ void* rmsg = NULL;
+ schtBuildSubmitRspMsg(&msg.len, &rmsg);
+ msg.msgType = TDMT_VND_SUBMIT_RSP;
+ msg.pData = rmsg;
+
+ schHandleResponseMsg(pJob, task, task->execId, &msg, 0);
pIter = taosHashIterate(pJob->execTasks, pIter);
}
schReleaseJob(job);
+ schtJobDone = true;
+
return NULL;
}
@@ -393,11 +463,13 @@ void *schtCreateFetchRspThread(void *param) {
taosSsleep(1);
int32_t code = 0;
- SRetrieveTableRsp *rsp = (SRetrieveTableRsp *)taosMemoryCalloc(1, sizeof(SRetrieveTableRsp));
- rsp->completed = 1;
- rsp->numOfRows = 10;
-
- code = schHandleResponseMsg(pJob, pJob->fetchTask, TDMT_SCH_FETCH_RSP, (char *)rsp, sizeof(*rsp), 0);
+ SDataBuf msg = {0};
+ void* rmsg = NULL;
+ schtBuildFetchRspMsg(&msg.len, &rmsg);
+ msg.msgType = TDMT_SCH_MERGE_FETCH_RSP;
+ msg.pData = rmsg;
+
+ code = schHandleResponseMsg(pJob, pJob->fetchTask, pJob->fetchTask->execId, &msg, 0);
schReleaseJob(job);
@@ -414,7 +486,7 @@ void *schtFetchRspThread(void *aa) {
continue;
}
- taosUsleep(1);
+ taosUsleep(100);
param = (SSchTaskCallbackParam *)taosMemoryCalloc(1, sizeof(*param));
@@ -426,10 +498,11 @@ void *schtFetchRspThread(void *aa) {
rsp->completed = 1;
rsp->numOfRows = 10;
+ dataBuf.msgType = TDMT_SCH_FETCH_RSP;
dataBuf.pData = rsp;
dataBuf.len = sizeof(*rsp);
- code = schHandleCallback(param, &dataBuf, TDMT_SCH_FETCH_RSP, 0);
+ code = schHandleCallback(param, &dataBuf, 0);
assert(code == 0 || code);
}
@@ -456,7 +529,7 @@ void *schtRunJobThread(void *aa) {
char *dbname = "1.db1";
char *tablename = "table1";
SVgroupInfo vgInfo = {0};
- SQueryPlan dag;
+ SQueryPlan* dag = (SQueryPlan*)nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN);
schtInitLogFile();
@@ -470,19 +543,19 @@ void *schtRunJobThread(void *aa) {
SSchJob *pJob = NULL;
SSchTaskCallbackParam *param = NULL;
SHashObj *execTasks = NULL;
- SDataBuf dataBuf = {0};
uint32_t jobFinished = 0;
int32_t queryDone = 0;
while (!schtTestStop) {
- schtBuildQueryDag(&dag);
+ schtBuildQueryDag(dag);
- SArray *qnodeList = taosArrayInit(1, sizeof(SEp));
+ SArray *qnodeList = taosArrayInit(1, sizeof(SQueryNodeLoad));
- SEp qnodeAddr = {0};
- strcpy(qnodeAddr.fqdn, "qnode0.ep");
- qnodeAddr.port = 6031;
- taosArrayPush(qnodeList, &qnodeAddr);
+ SQueryNodeLoad load = {0};
+ load.addr.epSet.numOfEps = 1;
+ strcpy(load.addr.epSet.eps[0].fqdn, "qnode0.ep");
+ load.addr.epSet.eps[0].port = 6031;
+ taosArrayPush(qnodeList, &load);
queryDone = 0;
@@ -492,7 +565,7 @@ void *schtRunJobThread(void *aa) {
req.syncReq = false;
req.pConn = &conn;
req.pNodeList = qnodeList;
- req.pDag = &dag;
+ req.pDag = dag;
req.sql = "select * from tb";
req.execFp = schtQueryCb;
req.cbParam = &queryDone;
@@ -503,7 +576,7 @@ void *schtRunJobThread(void *aa) {
pJob = schAcquireJob(queryJobRefId);
if (NULL == pJob) {
taosArrayDestroy(qnodeList);
- schtFreeQueryDag(&dag);
+ schtFreeQueryDag(dag);
continue;
}
@@ -526,11 +599,14 @@ void *schtRunJobThread(void *aa) {
SSchTask *task = (SSchTask *)pIter;
param->taskId = task->taskId;
- SQueryTableRsp rsp = {0};
- dataBuf.pData = &rsp;
- dataBuf.len = sizeof(rsp);
- code = schHandleCallback(param, &dataBuf, TDMT_SCH_QUERY_RSP, 0);
+ SDataBuf msg = {0};
+ void* rmsg = NULL;
+ schtBuildQueryRspMsg(&msg.len, &rmsg);
+ msg.msgType = TDMT_SCH_QUERY_RSP;
+ msg.pData = rmsg;
+
+ code = schHandleCallback(param, &msg, 0);
assert(code == 0 || code);
pIter = taosHashIterate(execTasks, pIter);
@@ -545,11 +621,13 @@ void *schtRunJobThread(void *aa) {
SSchTask *task = (SSchTask *)pIter;
param->taskId = task->taskId - 1;
- SQueryTableRsp rsp = {0};
- dataBuf.pData = &rsp;
- dataBuf.len = sizeof(rsp);
+ SDataBuf msg = {0};
+ void* rmsg = NULL;
+ schtBuildQueryRspMsg(&msg.len, &rmsg);
+ msg.msgType = TDMT_SCH_QUERY_RSP;
+ msg.pData = rmsg;
- code = schHandleCallback(param, &dataBuf, TDMT_SCH_QUERY_RSP, 0);
+ code = schHandleCallback(param, &msg, 0);
assert(code == 0 || code);
pIter = taosHashIterate(execTasks, pIter);
@@ -575,7 +653,6 @@ void *schtRunJobThread(void *aa) {
if (0 == code) {
SRetrieveTableRsp *pRsp = (SRetrieveTableRsp *)data;
assert(pRsp->completed == 1);
- assert(pRsp->numOfRows == 10);
}
data = NULL;
@@ -587,7 +664,7 @@ void *schtRunJobThread(void *aa) {
taosHashCleanup(execTasks);
taosArrayDestroy(qnodeList);
- schtFreeQueryDag(&dag);
+ schtFreeQueryDag(dag);
if (++jobFinished % schtTestPrintNum == 0) {
printf("jobFinished:%d\n", jobFinished);
@@ -609,6 +686,7 @@ void *schtFreeJobThread(void *aa) {
return NULL;
}
+
} // namespace
TEST(queryTest, normalCase) {
@@ -618,21 +696,20 @@ TEST(queryTest, normalCase) {
char *tablename = "table1";
SVgroupInfo vgInfo = {0};
int64_t job = 0;
- SQueryPlan dag;
+ SQueryPlan* dag = (SQueryPlan*)nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN);
- memset(&dag, 0, sizeof(dag));
+ SArray *qnodeList = taosArrayInit(1, sizeof(SQueryNodeLoad));
- SArray *qnodeList = taosArrayInit(1, sizeof(SEp));
-
- SEp qnodeAddr = {0};
- strcpy(qnodeAddr.fqdn, "qnode0.ep");
- qnodeAddr.port = 6031;
- taosArrayPush(qnodeList, &qnodeAddr);
+ SQueryNodeLoad load = {0};
+ load.addr.epSet.numOfEps = 1;
+ strcpy(load.addr.epSet.eps[0].fqdn, "qnode0.ep");
+ load.addr.epSet.eps[0].port = 6031;
+ taosArrayPush(qnodeList, &load);
int32_t code = schedulerInit();
ASSERT_EQ(code, 0);
- schtBuildQueryDag(&dag);
+ schtBuildQueryDag(dag);
schtSetPlanToString();
schtSetExecNode();
@@ -645,7 +722,7 @@ TEST(queryTest, normalCase) {
SSchedulerReq req = {0};
req.pConn = &conn;
req.pNodeList = qnodeList;
- req.pDag = &dag;
+ req.pDag = dag;
req.sql = "select * from tb";
req.execFp = schtQueryCb;
req.cbParam = &queryDone;
@@ -659,9 +736,14 @@ TEST(queryTest, normalCase) {
while (pIter) {
SSchTask *task = *(SSchTask **)pIter;
- SQueryTableRsp rsp = {0};
- code = schHandleResponseMsg(pJob, task, TDMT_SCH_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0);
-
+ SDataBuf msg = {0};
+ void* rmsg = NULL;
+ schtBuildQueryRspMsg(&msg.len, &rmsg);
+ msg.msgType = TDMT_SCH_QUERY_RSP;
+ msg.pData = rmsg;
+
+ code = schHandleResponseMsg(pJob, task, task->execId, &msg, 0);
+
ASSERT_EQ(code, 0);
pIter = taosHashIterate(pJob->execTasks, pIter);
}
@@ -669,11 +751,18 @@ TEST(queryTest, normalCase) {
pIter = taosHashIterate(pJob->execTasks, NULL);
while (pIter) {
SSchTask *task = *(SSchTask **)pIter;
+ if (JOB_TASK_STATUS_EXEC == task->status) {
+ SDataBuf msg = {0};
+ void* rmsg = NULL;
+ schtBuildQueryRspMsg(&msg.len, &rmsg);
+ msg.msgType = TDMT_SCH_QUERY_RSP;
+ msg.pData = rmsg;
+
+ code = schHandleResponseMsg(pJob, task, task->execId, &msg, 0);
+
+ ASSERT_EQ(code, 0);
+ }
- SQueryTableRsp rsp = {0};
- code = schHandleResponseMsg(pJob, task, TDMT_SCH_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0);
-
- ASSERT_EQ(code, 0);
pIter = taosHashIterate(pJob->execTasks, pIter);
}
@@ -703,18 +792,12 @@ TEST(queryTest, normalCase) {
ASSERT_EQ(pRsp->numOfRows, 10);
taosMemoryFreeClear(data);
- data = NULL;
- code = schedulerFetchRows(job, &req);
- ASSERT_EQ(code, 0);
- ASSERT_TRUE(data == NULL);
-
schReleaseJob(job);
+
+ schedulerDestroy();
schedulerFreeJob(&job, 0);
- schtFreeQueryDag(&dag);
-
- schedulerDestroy();
}
TEST(queryTest, readyFirstCase) {
@@ -724,21 +807,20 @@ TEST(queryTest, readyFirstCase) {
char *tablename = "table1";
SVgroupInfo vgInfo = {0};
int64_t job = 0;
- SQueryPlan dag;
+ SQueryPlan* dag = (SQueryPlan*)nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN);
- memset(&dag, 0, sizeof(dag));
+ SArray *qnodeList = taosArrayInit(1, sizeof(SQueryNodeLoad));
- SArray *qnodeList = taosArrayInit(1, sizeof(SEp));
-
- SEp qnodeAddr = {0};
- strcpy(qnodeAddr.fqdn, "qnode0.ep");
- qnodeAddr.port = 6031;
- taosArrayPush(qnodeList, &qnodeAddr);
+ SQueryNodeLoad load = {0};
+ load.addr.epSet.numOfEps = 1;
+ strcpy(load.addr.epSet.eps[0].fqdn, "qnode0.ep");
+ load.addr.epSet.eps[0].port = 6031;
+ taosArrayPush(qnodeList, &load);
int32_t code = schedulerInit();
ASSERT_EQ(code, 0);
- schtBuildQueryDag(&dag);
+ schtBuildQueryDag(dag);
schtSetPlanToString();
schtSetExecNode();
@@ -751,7 +833,7 @@ TEST(queryTest, readyFirstCase) {
SSchedulerReq req = {0};
req.pConn = &conn;
req.pNodeList = qnodeList;
- req.pDag = &dag;
+ req.pDag = dag;
req.sql = "select * from tb";
req.execFp = schtQueryCb;
req.cbParam = &queryDone;
@@ -764,8 +846,13 @@ TEST(queryTest, readyFirstCase) {
while (pIter) {
SSchTask *task = *(SSchTask **)pIter;
- SQueryTableRsp rsp = {0};
- code = schHandleResponseMsg(pJob, task, TDMT_SCH_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0);
+ SDataBuf msg = {0};
+ void* rmsg = NULL;
+ schtBuildQueryRspMsg(&msg.len, &rmsg);
+ msg.msgType = TDMT_SCH_QUERY_RSP;
+ msg.pData = rmsg;
+
+ code = schHandleResponseMsg(pJob, task, task->execId, &msg, 0);
ASSERT_EQ(code, 0);
pIter = taosHashIterate(pJob->execTasks, pIter);
@@ -775,10 +862,18 @@ TEST(queryTest, readyFirstCase) {
while (pIter) {
SSchTask *task = *(SSchTask **)pIter;
- SQueryTableRsp rsp = {0};
- code = schHandleResponseMsg(pJob, task, TDMT_SCH_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0);
+ if (JOB_TASK_STATUS_EXEC == task->status) {
+ SDataBuf msg = {0};
+ void* rmsg = NULL;
+ schtBuildQueryRspMsg(&msg.len, &rmsg);
+ msg.msgType = TDMT_SCH_QUERY_RSP;
+ msg.pData = rmsg;
+
+ code = schHandleResponseMsg(pJob, task, task->execId, &msg, 0);
+
+ ASSERT_EQ(code, 0);
+ }
- ASSERT_EQ(code, 0);
pIter = taosHashIterate(pJob->execTasks, pIter);
}
@@ -807,18 +902,11 @@ TEST(queryTest, readyFirstCase) {
ASSERT_EQ(pRsp->numOfRows, 10);
taosMemoryFreeClear(data);
- data = NULL;
- code = schedulerFetchRows(job, &req);
- ASSERT_EQ(code, 0);
- ASSERT_TRUE(data == NULL);
-
schReleaseJob(job);
- schedulerFreeJob(&job, 0);
-
- schtFreeQueryDag(&dag);
-
schedulerDestroy();
+
+ schedulerFreeJob(&job, 0);
}
TEST(queryTest, flowCtrlCase) {
@@ -828,35 +916,39 @@ TEST(queryTest, flowCtrlCase) {
char *tablename = "table1";
SVgroupInfo vgInfo = {0};
int64_t job = 0;
- SQueryPlan dag;
+ SQueryPlan* dag = (SQueryPlan*)nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN);
schtInitLogFile();
taosSeedRand(taosGetTimestampSec());
- SArray *qnodeList = taosArrayInit(1, sizeof(SEp));
+ SArray *qnodeList = taosArrayInit(1, sizeof(SQueryNodeLoad));
+
+ SQueryNodeLoad load = {0};
+ load.addr.epSet.numOfEps = 1;
+ strcpy(load.addr.epSet.eps[0].fqdn, "qnode0.ep");
+ load.addr.epSet.eps[0].port = 6031;
+ taosArrayPush(qnodeList, &load);
- SEp qnodeAddr = {0};
- strcpy(qnodeAddr.fqdn, "qnode0.ep");
- qnodeAddr.port = 6031;
- taosArrayPush(qnodeList, &qnodeAddr);
int32_t code = schedulerInit();
ASSERT_EQ(code, 0);
- schtBuildQueryFlowCtrlDag(&dag);
+ schtBuildQueryFlowCtrlDag(dag);
schtSetPlanToString();
schtSetExecNode();
schtSetAsyncSendMsgToServer();
+ initTaskQueue();
+
int32_t queryDone = 0;
SRequestConnInfo conn = {0};
conn.pTrans = mockPointer;
SSchedulerReq req = {0};
req.pConn = &conn;
req.pNodeList = qnodeList;
- req.pDag = &dag;
+ req.pDag = dag;
req.sql = "select * from tb";
req.execFp = schtQueryCb;
req.cbParam = &queryDone;
@@ -866,41 +958,27 @@ TEST(queryTest, flowCtrlCase) {
SSchJob *pJob = schAcquireJob(job);
- bool qDone = false;
-
- while (!qDone) {
+ while (!queryDone) {
void *pIter = taosHashIterate(pJob->execTasks, NULL);
- if (NULL == pIter) {
- break;
- }
-
while (pIter) {
SSchTask *task = *(SSchTask **)pIter;
- taosHashCancelIterate(pJob->execTasks, pIter);
-
- if (task->lastMsgType == TDMT_SCH_QUERY) {
- SQueryTableRsp rsp = {0};
- code = schHandleResponseMsg(pJob, task, TDMT_SCH_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0);
-
+ if (JOB_TASK_STATUS_EXEC == task->status && 0 != task->lastMsgType) {
+ SDataBuf msg = {0};
+ void* rmsg = NULL;
+ schtBuildQueryRspMsg(&msg.len, &rmsg);
+ msg.msgType = TDMT_SCH_QUERY_RSP;
+ msg.pData = rmsg;
+
+ code = schHandleResponseMsg(pJob, task, task->execId, &msg, 0);
+
ASSERT_EQ(code, 0);
- } else {
- qDone = true;
- break;
}
- pIter = NULL;
+ pIter = taosHashIterate(pJob->execTasks, pIter);
}
}
- while (true) {
- if (queryDone) {
- break;
- }
-
- taosUsleep(10000);
- }
-
TdThreadAttr thattr;
taosThreadAttrInit(&thattr);
@@ -918,18 +996,11 @@ TEST(queryTest, flowCtrlCase) {
ASSERT_EQ(pRsp->numOfRows, 10);
taosMemoryFreeClear(data);
- data = NULL;
- code = schedulerFetchRows(job, &req);
- ASSERT_EQ(code, 0);
- ASSERT_TRUE(data == NULL);
-
schReleaseJob(job);
- schedulerFreeJob(&job, 0);
-
- schtFreeQueryDag(&dag);
-
schedulerDestroy();
+
+ schedulerFreeJob(&job, 0);
}
TEST(insertTest, normalCase) {
@@ -938,20 +1009,21 @@ TEST(insertTest, normalCase) {
char *dbname = "1.db1";
char *tablename = "table1";
SVgroupInfo vgInfo = {0};
- SQueryPlan dag;
+ SQueryPlan* dag = (SQueryPlan*)nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN);
uint64_t numOfRows = 0;
- SArray *qnodeList = taosArrayInit(1, sizeof(SEp));
+ SArray *qnodeList = taosArrayInit(1, sizeof(SQueryNodeLoad));
- SEp qnodeAddr = {0};
- strcpy(qnodeAddr.fqdn, "qnode0.ep");
- qnodeAddr.port = 6031;
- taosArrayPush(qnodeList, &qnodeAddr);
+ SQueryNodeLoad load = {0};
+ load.addr.epSet.numOfEps = 1;
+ strcpy(load.addr.epSet.eps[0].fqdn, "qnode0.ep");
+ load.addr.epSet.eps[0].port = 6031;
+ taosArrayPush(qnodeList, &load);
int32_t code = schedulerInit();
ASSERT_EQ(code, 0);
- schtBuildInsertDag(&dag);
+ schtBuildInsertDag(dag);
schtSetPlanToString();
schtSetAsyncSendMsgToServer();
@@ -959,24 +1031,32 @@ TEST(insertTest, normalCase) {
TdThreadAttr thattr;
taosThreadAttrInit(&thattr);
+ schtJobDone = false;
+
TdThread thread1;
taosThreadCreate(&(thread1), &thattr, schtSendRsp, &insertJobRefId);
- SExecResult res = {0};
-
+ int32_t queryDone = 0;
SRequestConnInfo conn = {0};
conn.pTrans = mockPointer;
SSchedulerReq req = {0};
req.pConn = &conn;
req.pNodeList = qnodeList;
- req.pDag = &dag;
+ req.pDag = dag;
req.sql = "insert into tb values(now,1)";
req.execFp = schtQueryCb;
- req.cbParam = NULL;
+ req.cbParam = &queryDone;
code = schedulerExecJob(&req, &insertJobRefId);
ASSERT_EQ(code, 0);
- ASSERT_EQ(res.numOfRows, 20);
+
+ while (true) {
+ if (schtJobDone) {
+ break;
+ }
+
+ taosUsleep(10000);
+ }
schedulerFreeJob(&insertJobRefId, 0);
@@ -989,7 +1069,7 @@ TEST(multiThread, forceFree) {
TdThread thread1, thread2, thread3;
taosThreadCreate(&(thread1), &thattr, schtRunJobThread, NULL);
- taosThreadCreate(&(thread2), &thattr, schtFreeJobThread, NULL);
+// taosThreadCreate(&(thread2), &thattr, schtFreeJobThread, NULL);
taosThreadCreate(&(thread3), &thattr, schtFetchRspThread, NULL);
while (true) {
@@ -1002,7 +1082,17 @@ TEST(multiThread, forceFree) {
}
schtTestStop = true;
- taosSsleep(3);
+ //taosSsleep(3);
+}
+
+TEST(otherTest, otherCase) {
+ // excpet test
+ schReleaseJob(0);
+ schFreeRpcCtx(NULL);
+
+ ASSERT_EQ(schDumpEpSet(NULL), (char*)NULL);
+ ASSERT_EQ(strcmp(schGetOpStr(SCH_OP_NULL), "NULL"), 0);
+ ASSERT_EQ(strcmp(schGetOpStr((SCH_OP_TYPE)100), "UNKNOWN"), 0);
}
int main(int argc, char **argv) {
diff --git a/source/libs/stream/inc/streamBackendRocksdb.h b/source/libs/stream/inc/streamBackendRocksdb.h
index b89664a6c1..03f70604b7 100644
--- a/source/libs/stream/inc/streamBackendRocksdb.h
+++ b/source/libs/stream/inc/streamBackendRocksdb.h
@@ -179,7 +179,8 @@ int32_t streamStateSessionDel_rocksdb(SStreamState* pState, const SSessionKey* k
SStreamStateCur* streamStateSessionSeekKeyCurrentPrev_rocksdb(SStreamState* pState, const SSessionKey* key);
SStreamStateCur* streamStateSessionSeekKeyCurrentNext_rocksdb(SStreamState* pState, SSessionKey* key);
SStreamStateCur* streamStateSessionSeekKeyNext_rocksdb(SStreamState* pState, const SSessionKey* key);
-SStreamStateCur* streamStateSessionSeekToLast_rocksdb(SStreamState* pState);
+SStreamStateCur* streamStateSessionSeekKeyPrev_rocksdb(SStreamState* pState, const SSessionKey* key);
+SStreamStateCur* streamStateSessionSeekToLast_rocksdb(SStreamState* pState, int64_t groupId);
int32_t streamStateSessionCurPrev_rocksdb(SStreamStateCur* pCur);
int32_t streamStateSessionGetKVByCur_rocksdb(SStreamStateCur* pCur, SSessionKey* pKey, void** pVal, int32_t* pVLen);
diff --git a/source/libs/stream/inc/streamInt.h b/source/libs/stream/inc/streamInt.h
index 300b0a7f24..87f63b48ed 100644
--- a/source/libs/stream/inc/streamInt.h
+++ b/source/libs/stream/inc/streamInt.h
@@ -109,8 +109,6 @@ void destroyStreamDataBlock(SStreamDataBlock* pBlock);
int32_t streamRetrieveReqToData(const SStreamRetrieveReq* pReq, SStreamDataBlock* pData);
int32_t streamBroadcastToUpTasks(SStreamTask* pTask, const SSDataBlock* pBlock);
-int32_t tEncodeStreamRetrieveReq(SEncoder* pEncoder, const SStreamRetrieveReq* pReq);
-
int32_t streamSaveTaskCheckpointInfo(SStreamTask* p, int64_t checkpointId);
int32_t streamSendCheckMsg(SStreamTask* pTask, const SStreamTaskCheckReq* pReq, int32_t nodeId, SEpSet* pEpSet);
diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c
index acec9b7da9..f173157da6 100644
--- a/source/libs/stream/src/streamBackendRocksdb.c
+++ b/source/libs/stream/src/streamBackendRocksdb.c
@@ -2883,13 +2883,13 @@ int32_t streamStateSessionDel_rocksdb(SStreamState* pState, const SSessionKey* k
return code;
}
-SStreamStateCur* streamStateSessionSeekToLast_rocksdb(SStreamState* pState) {
+SStreamStateCur* streamStateSessionSeekToLast_rocksdb(SStreamState* pState, int64_t groupId) {
stDebug("streamStateSessionSeekToLast_rocksdb");
int32_t code = 0;
- SSessionKey maxSessionKey = {.groupId = UINT64_MAX, .win = {.skey = INT64_MAX, .ekey = INT64_MAX}};
- SStateSessionKey maxKey = {.key = maxSessionKey, .opNum = INT64_MAX};
+ SSessionKey maxSessionKey = {.groupId = groupId, .win = {.skey = INT64_MAX, .ekey = INT64_MAX}};
+ SStateSessionKey maxKey = {.key = maxSessionKey, .opNum = pState->number};
STREAM_STATE_PUT_ROCKSDB(pState, "sess", &maxKey, "", 0);
if (code != 0) {
@@ -3048,6 +3048,46 @@ SStreamStateCur* streamStateSessionSeekKeyNext_rocksdb(SStreamState* pState, con
return pCur;
}
+SStreamStateCur* streamStateSessionSeekKeyPrev_rocksdb(SStreamState* pState, const SSessionKey* key) {
+ stDebug("streamStateSessionSeekKeyPrev_rocksdb");
+ STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend;
+ SStreamStateCur* pCur = createStreamStateCursor();
+ if (pCur == NULL) {
+ return NULL;
+ }
+ pCur->db = wrapper->db;
+ pCur->iter = streamStateIterCreate(pState, "sess", (rocksdb_snapshot_t**)&pCur->snapshot,
+ (rocksdb_readoptions_t**)&pCur->readOpt);
+ pCur->number = pState->number;
+
+ SStateSessionKey sKey = {.key = *key, .opNum = pState->number};
+
+ char buf[128] = {0};
+ int len = stateSessionKeyEncode(&sKey, buf);
+ if (!streamStateIterSeekAndValid(pCur->iter, buf, len)) {
+ streamStateFreeCur(pCur);
+ return NULL;
+ }
+ while (rocksdb_iter_valid(pCur->iter) && iterValueIsStale(pCur->iter)) rocksdb_iter_prev(pCur->iter);
+ if (!rocksdb_iter_valid(pCur->iter)) {
+ streamStateFreeCur(pCur);
+ return NULL;
+ }
+
+ size_t klen;
+ const char* iKey = rocksdb_iter_key(pCur->iter, &klen);
+ SStateSessionKey curKey = {0};
+ stateSessionKeyDecode(&curKey, (char*)iKey);
+ if (stateSessionKeyCmpr(&sKey, sizeof(sKey), &curKey, sizeof(curKey)) > 0) return pCur;
+
+ rocksdb_iter_prev(pCur->iter);
+ if (!rocksdb_iter_valid(pCur->iter)) {
+ streamStateFreeCur(pCur);
+ return NULL;
+ }
+ return pCur;
+}
+
int32_t streamStateSessionGetKVByCur_rocksdb(SStreamStateCur* pCur, SSessionKey* pKey, void** pVal, int32_t* pVLen) {
stDebug("streamStateSessionGetKVByCur_rocksdb");
if (!pCur) {
diff --git a/source/libs/stream/src/streamCheckpoint.c b/source/libs/stream/src/streamCheckpoint.c
index b1783fb640..607e31bfe6 100644
--- a/source/libs/stream/src/streamCheckpoint.c
+++ b/source/libs/stream/src/streamCheckpoint.c
@@ -68,18 +68,6 @@ int32_t tEncodeStreamCheckpointSourceRsp(SEncoder* pEncoder, const SStreamCheckp
return pEncoder->pos;
}
-int32_t tDecodeStreamCheckpointSourceRsp(SDecoder* pDecoder, SStreamCheckpointSourceRsp* pRsp) {
- if (tStartDecode(pDecoder) < 0) return -1;
- if (tDecodeI64(pDecoder, &pRsp->streamId) < 0) return -1;
- if (tDecodeI64(pDecoder, &pRsp->checkpointId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->taskId) < 0) return -1;
- if (tDecodeI32(pDecoder, &pRsp->nodeId) < 0) return -1;
- if (tDecodeI64(pDecoder, &pRsp->expireTime) < 0) return -1;
- if (tDecodeI8(pDecoder, &pRsp->success) < 0) return -1;
- tEndDecode(pDecoder);
- return 0;
-}
-
int32_t tEncodeStreamCheckpointReadyMsg(SEncoder* pEncoder, const SStreamCheckpointReadyMsg* pReq) {
if (tStartEncode(pEncoder) < 0) return -1;
if (tEncodeI64(pEncoder, pReq->streamId) < 0) return -1;
@@ -512,7 +500,7 @@ int32_t streamTaskBuildCheckpoint(SStreamTask* pTask) {
SStreamTaskId hTaskId = {.streamId = pTask->hTaskInfo.id.streamId, .taskId = pTask->hTaskInfo.id.taskId};
stDebug("s-task:%s fill-history finish checkpoint done, drop related fill-history task:0x%x", id, hTaskId.taskId);
- streamBuildAndSendDropTaskMsg(pTask->pMsgCb, pTask->pMeta->vgId, &hTaskId);
+ streamBuildAndSendDropTaskMsg(pTask->pMsgCb, pTask->pMeta->vgId, &hTaskId, 1);
} else {
stWarn("s-task:%s related fill-history task:0x%x is erased", id, (int32_t)pTask->hTaskInfo.id.taskId);
}
diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c
index 98d9a29c87..9383383dc0 100644
--- a/source/libs/stream/src/streamDispatch.c
+++ b/source/libs/stream/src/streamDispatch.c
@@ -162,6 +162,8 @@ 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);
@@ -174,7 +176,7 @@ void sendRetrieveRsp(SStreamRetrieveReq *pReq, SRpcMsg* pRsp){
tmsgSendRsp(pRsp);
}
-int32_t broadcastRetrieveMsg(SStreamTask* pTask, SStreamRetrieveReq *req){
+int32_t broadcastRetrieveMsg(SStreamTask* pTask, SStreamRetrieveReq* req) {
int32_t code = 0;
void* buf = NULL;
int32_t sz = taosArrayGetSize(pTask->upstreamInfo.pList);
@@ -569,6 +571,7 @@ int32_t streamSearchAndAddBlock(SStreamTask* pTask, SStreamDispatchReq* pReqs, S
char ctbName[TSDB_TABLE_FNAME_LEN] = {0};
if (pDataBlock->info.parTbName[0]) {
if(pTask->ver >= SSTREAM_TASK_SUBTABLE_CHANGED_VER &&
+ pTask->subtableWithoutMd5 != 1 &&
!isAutoTableName(pDataBlock->info.parTbName) &&
!alreadyAddGroupId(pDataBlock->info.parTbName) &&
groupId != 0){
diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c
index 840a7678f2..bac6022834 100644
--- a/source/libs/stream/src/streamExec.c
+++ b/source/libs/stream/src/streamExec.c
@@ -328,7 +328,7 @@ int32_t streamDoTransferStateToStreamTask(SStreamTask* pTask) {
id, (int32_t) pTask->streamTaskId.taskId);
// 1. free it and remove fill-history task from disk meta-store
- streamBuildAndSendDropTaskMsg(pTask->pMsgCb, pMeta->vgId, &pTask->id);
+ streamBuildAndSendDropTaskMsg(pTask->pMsgCb, pMeta->vgId, &pTask->id, 0);
// 2. save to disk
streamMetaWLock(pMeta);
diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c
index db74ce9897..ab519e2b4b 100644
--- a/source/libs/stream/src/streamMeta.c
+++ b/source/libs/stream/src/streamMeta.c
@@ -725,9 +725,6 @@ int32_t streamMetaUnregisterTask(SStreamMeta* pMeta, int64_t streamId, int32_t t
// it is an fill-history task, remove the related stream task's id that points to it
atomic_sub_fetch_32(&pMeta->numOfStreamTasks, 1);
- if (pTask->info.fillHistory == 1) {
- streamTaskClearHTaskAttr(pTask, false);
- }
taosHashRemove(pMeta->pTasksMap, &id, sizeof(id));
doRemoveIdFromList(pMeta, (int32_t)taosArrayGetSize(pMeta->pTaskList), &pTask->id);
diff --git a/source/libs/stream/src/streamSessionState.c b/source/libs/stream/src/streamSessionState.c
index 1f991d309f..bd28d2bca9 100644
--- a/source/libs/stream/src/streamSessionState.c
+++ b/source/libs/stream/src/streamSessionState.c
@@ -28,6 +28,12 @@ int sessionStateKeyCompare(const SSessionKey* pWin1, const void* pDatas, int pos
return sessionWinKeyCmpr(pWin1, pWin2);
}
+int sessionStateRangeKeyCompare(const SSessionKey* pWin1, const void* pDatas, int pos) {
+ SRowBuffPos* pPos2 = taosArrayGetP(pDatas, pos);
+ SSessionKey* pWin2 = (SSessionKey*)pPos2->pKey;
+ return sessionRangeKeyCmpr(pWin1, pWin2);
+}
+
int32_t binarySearch(void* keyList, int num, const void* key, __session_compare_fn_t cmpFn) {
int firstPos = 0, lastPos = num - 1, midPos = -1;
int numOfRows = 0;
@@ -69,6 +75,12 @@ bool inSessionWindow(SSessionKey* pKey, TSKEY ts, int64_t gap) {
return false;
}
+SStreamStateCur* createSessionStateCursor(SStreamFileState* pFileState) {
+ SStreamStateCur* pCur = createStreamStateCursor();
+ pCur->pStreamFileState = pFileState;
+ return pCur;
+}
+
static SRowBuffPos* addNewSessionWindow(SStreamFileState* pFileState, SArray* pWinInfos, const SSessionKey* pKey) {
SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState);
ASSERT(pNewPos->pRowBuff);
@@ -91,7 +103,12 @@ SRowBuffPos* createSessionWinBuff(SStreamFileState* pFileState, SSessionKey* pKe
memcpy(pNewPos->pKey, pKey, sizeof(SSessionKey));
pNewPos->needFree = true;
pNewPos->beFlushed = true;
- memcpy(pNewPos->pRowBuff, p, *pVLen);
+ if(p) {
+ memcpy(pNewPos->pRowBuff, p, *pVLen);
+ } else {
+ int32_t len = getRowStateRowSize(pFileState);
+ memset(pNewPos->pRowBuff, 0, len);
+ }
taosMemoryFree(p);
return pNewPos;
}
@@ -364,9 +381,8 @@ static SStreamStateCur* seekKeyCurrentPrev_buff(SStreamFileState* pFileState, co
}
if (index >= 0) {
- pCur = createStreamStateCursor();
+ pCur = createSessionStateCursor(pFileState);
pCur->buffIndex = index;
- pCur->pStreamFileState = pFileState;
if (pIndex) {
*pIndex = index;
}
@@ -405,7 +421,7 @@ static void checkAndTransformCursor(SStreamFileState* pFileState, const uint64_t
if (taosArrayGetSize(pWinStates) > 0 &&
(code == TSDB_CODE_FAILED || sessionStateKeyCompare(&key, pWinStates, 0) >= 0)) {
if (!(*ppCur)) {
- (*ppCur) = createStreamStateCursor();
+ (*ppCur) = createSessionStateCursor(pFileState);
}
transformCursor(pFileState, *ppCur);
} else if (*ppCur) {
@@ -419,7 +435,7 @@ SStreamStateCur* sessionWinStateSeekKeyCurrentNext(SStreamFileState* pFileState,
int32_t index = -1;
SStreamStateCur* pCur = seekKeyCurrentPrev_buff(pFileState, pWinKey, &pWinStates, &index);
if (pCur) {
- if (sessionStateKeyCompare(pWinKey, pWinStates, index) > 0) {
+ if (sessionStateRangeKeyCompare(pWinKey, pWinStates, index) > 0) {
sessionWinStateMoveToNext(pCur);
}
return pCur;
@@ -446,6 +462,66 @@ SStreamStateCur* sessionWinStateSeekKeyNext(SStreamFileState* pFileState, const
return pCur;
}
+SStreamStateCur* countWinStateSeekKeyPrev(SStreamFileState* pFileState, const SSessionKey* pWinKey, COUNT_TYPE count) {
+ SArray* pWinStates = NULL;
+ int32_t index = -1;
+ SStreamStateCur* pBuffCur = seekKeyCurrentPrev_buff(pFileState, pWinKey, &pWinStates, &index);
+ int32_t resSize = getRowStateRowSize(pFileState);
+ COUNT_TYPE winCount = 0;
+ if (pBuffCur) {
+ while (index >= 0) {
+ SRowBuffPos* pPos = taosArrayGetP(pWinStates, index);
+ winCount = *((COUNT_TYPE*) ((char*)pPos->pRowBuff + (resSize - sizeof(COUNT_TYPE))));
+ if (sessionStateRangeKeyCompare(pWinKey, pWinStates, index) == 0 || winCount < count) {
+ index--;
+ } else if (index >= 0) {
+ pBuffCur->buffIndex = index + 1;
+ return pBuffCur;
+ }
+ }
+ pBuffCur->buffIndex = 0;
+ } else if (taosArrayGetSize(pWinStates) > 0) {
+ pBuffCur = createSessionStateCursor(pFileState);
+ pBuffCur->buffIndex = 0;
+ }
+
+ void* pFileStore = getStateFileStore(pFileState);
+ SStreamStateCur* pCur = streamStateSessionSeekKeyPrev_rocksdb(pFileStore, pWinKey);
+ if (pCur) {
+ SSessionKey key = {0};
+ void* pVal = NULL;
+ int len = 0;
+ int32_t code = streamStateSessionGetKVByCur_rocksdb(pCur, &key, &pVal, &len);
+ if (code == TSDB_CODE_FAILED) {
+ streamStateFreeCur(pCur);
+ return pBuffCur;
+ }
+ winCount = *((COUNT_TYPE*) ((char*)pVal + (resSize - sizeof(COUNT_TYPE))));
+ if (sessionRangeKeyCmpr(pWinKey, &key) != 0 && winCount == count) {
+ streamStateFreeCur(pCur);
+ return pBuffCur;
+ }
+ streamStateCurPrev(pFileStore, pCur);
+ while (1) {
+ code = streamStateSessionGetKVByCur_rocksdb(pCur, &key, &pVal, &len);
+ if (code == TSDB_CODE_FAILED) {
+ streamStateCurNext(pFileStore, pCur);
+ streamStateFreeCur(pBuffCur);
+ return pCur;
+ }
+ winCount = *((COUNT_TYPE*) ((char*)pVal + (resSize - sizeof(COUNT_TYPE))));
+ if (sessionRangeKeyCmpr(pWinKey, &key) == 0 || winCount < count) {
+ streamStateCurPrev(pFileStore, pCur);
+ } else {
+ streamStateCurNext(pFileStore, pCur);
+ streamStateFreeCur(pBuffCur);
+ return pCur;
+ }
+ }
+ }
+ return pBuffCur;
+}
+
int32_t sessionWinStateGetKVByCur(SStreamStateCur* pCur, SSessionKey* pKey, void** pVal, int32_t* pVLen) {
if (!pCur) {
return TSDB_CODE_FAILED;
@@ -503,7 +579,7 @@ int32_t sessionWinStateMoveToNext(SStreamStateCur* pCur) {
return TSDB_CODE_SUCCESS;
}
-int32_t sessionWinStateGetKeyByRange(SStreamFileState* pFileState, const SSessionKey* key, SSessionKey* curKey) {
+int32_t sessionWinStateGetKeyByRange(SStreamFileState* pFileState, const SSessionKey* key, SSessionKey* curKey, range_cmpr_fn cmpFn) {
SStreamStateCur* pCur = sessionWinStateSeekKeyCurrentPrev(pFileState, key);
SSessionKey tmpKey = *key;
int32_t code = sessionWinStateGetKVByCur(pCur, &tmpKey, NULL, NULL);
@@ -520,7 +596,7 @@ int32_t sessionWinStateGetKeyByRange(SStreamFileState* pFileState, const SSessio
goto _end;
}
- if (sessionRangeKeyCmpr(key, &tmpKey) == 0) {
+ if (cmpFn(key, &tmpKey) == 0) {
*curKey = tmpKey;
goto _end;
} else if (!hasCurrentPrev) {
@@ -530,7 +606,7 @@ int32_t sessionWinStateGetKeyByRange(SStreamFileState* pFileState, const SSessio
sessionWinStateMoveToNext(pCur);
code = sessionWinStateGetKVByCur(pCur, &tmpKey, NULL, NULL);
- if (code == TSDB_CODE_SUCCESS && sessionRangeKeyCmpr(key, &tmpKey) == 0) {
+ if (code == TSDB_CODE_SUCCESS && cmpFn(key, &tmpKey) == 0) {
*curKey = tmpKey;
} else {
code = TSDB_CODE_FAILED;
@@ -636,3 +712,143 @@ int32_t getStateWinResultBuff(SStreamFileState* pFileState, SSessionKey* key, ch
_end:
return code;
}
+
+int32_t getCountWinResultBuff(SStreamFileState* pFileState, SSessionKey* pKey, COUNT_TYPE winCount, void** pVal, int32_t* pVLen) {
+ SSessionKey* pWinKey = pKey;
+ const TSKEY gap = 0;
+ int32_t code = TSDB_CODE_SUCCESS;
+ SSHashObj* pSessionBuff = getRowStateBuff(pFileState);
+ SArray* pWinStates = NULL;
+ void** ppBuff = tSimpleHashGet(pSessionBuff, &pWinKey->groupId, sizeof(uint64_t));
+ if (ppBuff) {
+ pWinStates = (SArray*)(*ppBuff);
+ } else {
+ pWinStates = taosArrayInit(16, POINTER_BYTES);
+ tSimpleHashPut(pSessionBuff, &pWinKey->groupId, sizeof(uint64_t), &pWinStates, POINTER_BYTES);
+ }
+
+ TSKEY startTs = pWinKey->win.skey;
+ TSKEY endTs = pWinKey->win.ekey;
+
+ int32_t size = taosArrayGetSize(pWinStates);
+ if (size == 0) {
+ void* pFileStore = getStateFileStore(pFileState);
+ void* pRockVal = NULL;
+ SStreamStateCur* pCur = streamStateSessionSeekToLast_rocksdb(pFileStore, pKey->groupId);
+ code = streamStateSessionGetKVByCur_rocksdb(pCur, pWinKey, &pRockVal, pVLen);
+ if (code == TSDB_CODE_SUCCESS || isFlushedState(pFileState, endTs, 0)) {
+ qDebug("===stream===0 get state win:%" PRId64 ",%" PRId64 " from disc, res %d", pWinKey->win.skey, pWinKey->win.ekey, code);
+ if (code == TSDB_CODE_SUCCESS) {
+ int32_t valSize = *pVLen;
+ COUNT_TYPE* pWinStateCout = (COUNT_TYPE*)( (char*)(pRockVal) + (valSize - sizeof(COUNT_TYPE)) );
+ if (inSessionWindow(pWinKey, startTs, gap) || (*pWinStateCout) < winCount) {
+ (*pVal) = createSessionWinBuff(pFileState, pWinKey, pRockVal, pVLen);
+ streamStateFreeCur(pCur);
+ goto _end;
+ }
+ }
+ pWinKey->win.skey = startTs;
+ pWinKey->win.ekey = endTs;
+ (*pVal) = createSessionWinBuff(pFileState, pWinKey, NULL, NULL);
+ taosMemoryFree(pRockVal);
+ streamStateFreeCur(pCur);
+ } else {
+ (*pVal) = addNewSessionWindow(pFileState, pWinStates, pWinKey);
+ code = TSDB_CODE_FAILED;
+ }
+ goto _end;
+ }
+
+ // find the first position which is smaller than the pWinKey
+ int32_t index = binarySearch(pWinStates, size, pWinKey, sessionStateKeyCompare);
+ SRowBuffPos* pPos = NULL;
+ int32_t valSize = *pVLen;
+
+ if (index >= 0) {
+ pPos = taosArrayGetP(pWinStates, index);
+ COUNT_TYPE* pWinStateCout = (COUNT_TYPE*)( (char*)(pPos->pRowBuff) + (valSize - sizeof(COUNT_TYPE)) );
+ if (inSessionWindow(pPos->pKey, startTs, gap) || (index == size - 1 && (*pWinStateCout) < winCount) ) {
+ (*pVal) = pPos;
+ SSessionKey* pDestWinKey = (SSessionKey*)pPos->pKey;
+ pPos->beUsed = true;
+ *pWinKey = *pDestWinKey;
+ goto _end;
+ }
+ }
+
+ if (index == -1) {
+ if (!isDeteled(pFileState, endTs)) {
+ void* p = NULL;
+ void* pFileStore = getStateFileStore(pFileState);
+ SStreamStateCur* pCur = streamStateSessionSeekToLast_rocksdb(pFileStore, pKey->groupId);
+ int32_t code_file = streamStateSessionGetKVByCur_rocksdb(pCur, pWinKey, &p, pVLen);
+ if (code_file == TSDB_CODE_SUCCESS) {
+ (*pVal) = createSessionWinBuff(pFileState, pWinKey, p, pVLen);
+ code = code_file;
+ qDebug("===stream===1 get state win:%" PRId64 ",%" PRId64 " from disc, res %d", pWinKey->win.skey, pWinKey->win.ekey, code_file);
+ streamStateFreeCur(pCur);
+ goto _end;
+ }
+ taosMemoryFree(p);
+ streamStateFreeCur(pCur);
+ }
+ }
+
+ if (index + 1 < size) {
+ pPos = taosArrayGetP(pWinStates, index + 1);
+ (*pVal) = pPos;
+ SSessionKey* pDestWinKey = (SSessionKey*)pPos->pKey;
+ pPos->beUsed = true;
+ *pWinKey = *pDestWinKey;
+ goto _end;
+ }
+
+ (*pVal) = addNewSessionWindow(pFileState, pWinStates, pWinKey);
+ code = TSDB_CODE_FAILED;
+
+_end:
+ return code;
+}
+
+int32_t createCountWinResultBuff(SStreamFileState* pFileState, SSessionKey* pKey, void** pVal, int32_t* pVLen) {
+ SSessionKey* pWinKey = pKey;
+ const TSKEY gap = 0;
+ int32_t code = TSDB_CODE_SUCCESS;
+ SSHashObj* pSessionBuff = getRowStateBuff(pFileState);
+ SArray* pWinStates = NULL;
+ void** ppBuff = tSimpleHashGet(pSessionBuff, &pWinKey->groupId, sizeof(uint64_t));
+ if (ppBuff) {
+ pWinStates = (SArray*)(*ppBuff);
+ } else {
+ pWinStates = taosArrayInit(16, POINTER_BYTES);
+ tSimpleHashPut(pSessionBuff, &pWinKey->groupId, sizeof(uint64_t), &pWinStates, POINTER_BYTES);
+ }
+
+ TSKEY startTs = pWinKey->win.skey;
+ TSKEY endTs = pWinKey->win.ekey;
+
+ int32_t size = taosArrayGetSize(pWinStates);
+ if (size == 0) {
+ void* pFileStore = getStateFileStore(pFileState);
+ void* p = NULL;
+
+ SStreamStateCur* pCur = streamStateSessionSeekToLast_rocksdb(pFileStore, pKey->groupId);
+ int32_t code_file = streamStateSessionGetKVByCur_rocksdb(pCur, pWinKey, &p, pVLen);
+ if (code_file == TSDB_CODE_SUCCESS || isFlushedState(pFileState, endTs, 0)) {
+ (*pVal) = createSessionWinBuff(pFileState, pWinKey, p, pVLen);
+ code = code_file;
+ qDebug("===stream===0 get state win:%" PRId64 ",%" PRId64 " from disc, res %d", pWinKey->win.skey, pWinKey->win.ekey, code_file);
+ } else {
+ (*pVal) = addNewSessionWindow(pFileState, pWinStates, pWinKey);
+ code = TSDB_CODE_FAILED;
+ taosMemoryFree(p);
+ }
+ streamStateFreeCur(pCur);
+ goto _end;
+ } else {
+ (*pVal) = addNewSessionWindow(pFileState, pWinStates, pWinKey);
+ }
+
+_end:
+ return code;
+}
diff --git a/source/libs/stream/src/streamStart.c b/source/libs/stream/src/streamStart.c
index ee98bc801b..6112a208c6 100644
--- a/source/libs/stream/src/streamStart.c
+++ b/source/libs/stream/src/streamStart.c
@@ -391,6 +391,16 @@ void doProcessDownstreamReadyRsp(SStreamTask* pTask) {
int64_t startTs = pTask->execInfo.start;
streamMetaAddTaskLaunchResult(pTask->pMeta, pTask->id.streamId, pTask->id.taskId, initTs, startTs, true);
+ if (pTask->status.taskStatus == TASK_STATUS__HALT) {
+ ASSERT(HAS_RELATED_FILLHISTORY_TASK(pTask) && (pTask->info.fillHistory == 0));
+
+ // halt it self for count window stream task until the related
+ // fill history task completd.
+ stDebug("s-task:%s level:%d initial status is %s from mnode, set it to be halt", pTask->id.idStr,
+ pTask->info.taskLevel, streamTaskGetStatusStr(pTask->status.taskStatus));
+ streamTaskHandleEvent(pTask->status.pSM, TASK_EVENT_HALT);
+ }
+
// start the related fill-history task, when current task is ready
// not invoke in success callback due to the deadlock.
if (HAS_RELATED_FILLHISTORY_TASK(pTask)) {
@@ -539,11 +549,6 @@ int32_t streamSetParamForScanHistory(SStreamTask* pTask) {
return qSetStreamOperatorOptionForScanHistory(pTask->exec.pExecutor);
}
-int32_t streamRestoreParam(SStreamTask* pTask) {
- stDebug("s-task:%s restore operator param after scan-history", pTask->id.idStr);
- return qRestoreStreamOperatorOption(pTask->exec.pExecutor);
-}
-
// source
int32_t streamSetParamForStreamScannerStep1(SStreamTask* pTask, SVersionRange* pVerRange, STimeWindow* pWindow) {
return qStreamSourceScanParamForHistoryScanStep1(pTask->exec.pExecutor, pVerRange, pWindow);
@@ -804,7 +809,7 @@ int32_t streamLaunchFillHistoryTask(SStreamTask* pTask) {
// check stream task status in the first place.
SStreamTaskState* pStatus = streamTaskGetStatus(pTask);
- if (pStatus->state != TASK_STATUS__READY) {
+ if (pStatus->state != TASK_STATUS__READY && pStatus->state != TASK_STATUS__HALT) {
stDebug("s-task:%s not launch related fill-history task:0x%" PRIx64 "-0x%x, status:%s", idStr, hStreamId, hTaskId,
pStatus->name);
diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c
index e370312338..b53dc9daa6 100644
--- a/source/libs/stream/src/streamState.c
+++ b/source/libs/stream/src/streamState.c
@@ -42,6 +42,14 @@ int sessionRangeKeyCmpr(const SSessionKey* pWin1, const SSessionKey* pWin2) {
return 0;
}
+int countRangeKeyEqual(const SSessionKey* pWin1, const SSessionKey* pWin2) {
+ if (pWin1->groupId == pWin2->groupId && pWin1->win.skey <= pWin2->win.skey && pWin2->win.skey <= pWin1->win.ekey) {
+ return 0;
+ }
+
+ return 1;
+}
+
int sessionWinKeyCmpr(const SSessionKey* pWin1, const SSessionKey* pWin2) {
if (pWin1->groupId > pWin2->groupId) {
return 1;
@@ -752,6 +760,12 @@ int32_t streamStateSessionDel(SStreamState* pState, const SSessionKey* key) {
#endif
}
+int32_t streamStateSessionReset(SStreamState* pState, void* pVal) {
+ int32_t len = getRowStateRowSize(pState->pFileState);
+ memset(pVal, 0, len);
+ return TSDB_CODE_SUCCESS;
+}
+
SStreamStateCur* streamStateSessionSeekKeyCurrentPrev(SStreamState* pState, const SSessionKey* key) {
#ifdef USE_ROCKSDB
return sessionWinStateSeekKeyCurrentPrev(pState->pFileState, key);
@@ -846,6 +860,13 @@ SStreamStateCur* streamStateSessionSeekKeyNext(SStreamState* pState, const SSess
#endif
}
+SStreamStateCur* streamStateCountSeekKeyPrev(SStreamState* pState, const SSessionKey* key, COUNT_TYPE count) {
+#ifdef USE_ROCKSDB
+ return countWinStateSeekKeyPrev(pState->pFileState, key, count);
+#else
+#endif
+}
+
int32_t streamStateSessionGetKVByCur(SStreamStateCur* pCur, SSessionKey* pKey, void** pVal, int32_t* pVLen) {
#ifdef USE_ROCKSDB
return sessionWinStateGetKVByCur(pCur, pKey, pVal, pVLen);
@@ -896,7 +917,7 @@ int32_t streamStateSessionClear(SStreamState* pState) {
int32_t streamStateSessionGetKeyByRange(SStreamState* pState, const SSessionKey* key, SSessionKey* curKey) {
#ifdef USE_ROCKSDB
- return sessionWinStateGetKeyByRange(pState->pFileState, key, curKey);
+ return sessionWinStateGetKeyByRange(pState->pFileState, key, curKey, sessionRangeKeyCmpr);
#else
SStreamStateCur* pCur = taosMemoryCalloc(1, sizeof(SStreamStateCur));
if (pCur == NULL) {
@@ -946,6 +967,13 @@ int32_t streamStateSessionGetKeyByRange(SStreamState* pState, const SSessionKey*
#endif
}
+int32_t streamStateCountGetKeyByRange(SStreamState* pState, const SSessionKey* key, SSessionKey* curKey) {
+#ifdef USE_ROCKSDB
+ return sessionWinStateGetKeyByRange(pState->pFileState, key, curKey, countRangeKeyEqual);
+#else
+#endif
+}
+
int32_t streamStateSessionAddIfNotExist(SStreamState* pState, SSessionKey* key, TSKEY gap, void** pVal,
int32_t* pVLen) {
#ifdef USE_ROCKSDB
@@ -1135,90 +1163,11 @@ SStreamStateCur* createStreamStateCursor() {
return pCur;
}
-#if 0
-char* streamStateSessionDump(SStreamState* pState) {
- SStreamStateCur* pCur = taosMemoryCalloc(1, sizeof(SStreamStateCur));
- if (pCur == NULL) {
- return NULL;
- }
- pCur->number = pState->number;
- if (tdbTbcOpen(pState->pTdbState->pSessionStateDb, &pCur->pCur, NULL) < 0) {
- streamStateFreeCur(pCur);
- return NULL;
- }
- tdbTbcMoveToFirst(pCur->pCur);
-
- SSessionKey key = {0};
- void* buf = NULL;
- int32_t bufSize = 0;
- int32_t code = streamStateSessionGetKVByCur(pCur, &key, &buf, &bufSize);
- if (code != 0) {
- streamStateFreeCur(pCur);
- return NULL;
- }
-
- int32_t size = 2048;
- char* dumpBuf = taosMemoryCalloc(size, 1);
- int64_t len = 0;
- len += snprintf(dumpBuf + len, size - len, "||s:%15" PRId64 ",", key.win.skey);
- len += snprintf(dumpBuf + len, size - len, "e:%15" PRId64 ",", key.win.ekey);
- len += snprintf(dumpBuf + len, size - len, "g:%15" PRId64 "||", key.groupId);
- while (1) {
- tdbTbcMoveToNext(pCur->pCur);
- key = (SSessionKey){0};
- code = streamStateSessionGetKVByCur(pCur, &key, NULL, 0);
- if (code != 0) {
- streamStateFreeCur(pCur);
- return dumpBuf;
- }
- len += snprintf(dumpBuf + len, size - len, "||s:%15" PRId64 ",", key.win.skey);
- len += snprintf(dumpBuf + len, size - len, "e:%15" PRId64 ",", key.win.ekey);
- len += snprintf(dumpBuf + len, size - len, "g:%15" PRId64 "||", key.groupId);
- }
- streamStateFreeCur(pCur);
- return dumpBuf;
+// count window
+int32_t streamStateCountWinAddIfNotExist(SStreamState* pState, SSessionKey* pKey, COUNT_TYPE winCount, void** ppVal, int32_t* pVLen) {
+ return getCountWinResultBuff(pState->pFileState, pKey, winCount, ppVal, pVLen);
}
-char* streamStateIntervalDump(SStreamState* pState) {
- SStreamStateCur* pCur = taosMemoryCalloc(1, sizeof(SStreamStateCur));
- if (pCur == NULL) {
- return NULL;
- }
- pCur->number = pState->number;
- if (tdbTbcOpen(pState->pTdbState->pStateDb, &pCur->pCur, NULL) < 0) {
- streamStateFreeCur(pCur);
- return NULL;
- }
- tdbTbcMoveToFirst(pCur->pCur);
-
- SWinKey key = {0};
- void* buf = NULL;
- int32_t bufSize = 0;
- int32_t code = streamStateGetKVByCur(pCur, &key, (const void **)&buf, &bufSize);
- if (code != 0) {
- streamStateFreeCur(pCur);
- return NULL;
- }
-
- int32_t size = 2048;
- char* dumpBuf = taosMemoryCalloc(size, 1);
- int64_t len = 0;
- len += snprintf(dumpBuf + len, size - len, "||s:%15" PRId64 ",", key.ts);
- // len += snprintf(dumpBuf + len, size - len, "e:%15" PRId64 ",", key.win.ekey);
- len += snprintf(dumpBuf + len, size - len, "g:%15" PRId64 "||", key.groupId);
- while (1) {
- tdbTbcMoveToNext(pCur->pCur);
- key = (SWinKey){0};
- code = streamStateGetKVByCur(pCur, &key, NULL, 0);
- if (code != 0) {
- streamStateFreeCur(pCur);
- return dumpBuf;
- }
- len += snprintf(dumpBuf + len, size - len, "||s:%15" PRId64 ",", key.ts);
- // len += snprintf(dumpBuf + len, size - len, "e:%15" PRId64 ",", key.win.ekey);
- len += snprintf(dumpBuf + len, size - len, "g:%15" PRId64 "||", key.groupId);
- }
- streamStateFreeCur(pCur);
- return dumpBuf;
+int32_t streamStateCountWinAdd(SStreamState* pState, SSessionKey* pKey, void** pVal, int32_t* pVLen) {
+ return createCountWinResultBuff(pState->pFileState, pKey, pVal, pVLen);
}
-#endif
\ No newline at end of file
diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c
index 9f08a55b21..281e2ed550 100644
--- a/source/libs/stream/src/streamTask.c
+++ b/source/libs/stream/src/streamTask.c
@@ -80,7 +80,7 @@ static SStreamChildEpInfo* createStreamTaskEpInfo(const SStreamTask* pTask) {
}
SStreamTask* tNewStreamTask(int64_t streamId, int8_t taskLevel, SEpSet* pEpset, bool fillHistory, int64_t triggerParam,
- SArray* pTaskList, bool hasFillhistory) {
+ SArray* pTaskList, bool hasFillhistory, int8_t subtableWithoutMd5) {
SStreamTask* pTask = (SStreamTask*)taosMemoryCalloc(1, sizeof(SStreamTask));
if (pTask == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
@@ -96,6 +96,7 @@ SStreamTask* tNewStreamTask(int64_t streamId, int8_t taskLevel, SEpSet* pEpset,
pTask->info.taskLevel = taskLevel;
pTask->info.fillHistory = fillHistory;
pTask->info.triggerParam = triggerParam;
+ pTask->subtableWithoutMd5 = subtableWithoutMd5;
pTask->status.pSM = streamCreateStateMachine(pTask);
if (pTask->status.pSM == NULL) {
@@ -108,7 +109,7 @@ SStreamTask* tNewStreamTask(int64_t streamId, int8_t taskLevel, SEpSet* pEpset,
pTask->id.idStr = taosStrdup(buf);
pTask->status.schedStatus = TASK_SCHED_STATUS__INACTIVE;
- pTask->status.taskStatus = (fillHistory || hasFillhistory) ? TASK_STATUS__SCAN_HISTORY : TASK_STATUS__READY;
+ pTask->status.taskStatus = fillHistory? TASK_STATUS__SCAN_HISTORY : TASK_STATUS__READY;
pTask->inputq.status = TASK_INPUT_STATUS__NORMAL;
pTask->outputq.status = TASK_OUTPUT_STATUS__NORMAL;
@@ -126,7 +127,6 @@ int32_t tEncodeStreamEpInfo(SEncoder* pEncoder, const SStreamChildEpInfo* pInfo)
if (tEncodeI32(pEncoder, pInfo->taskId) < 0) return -1;
if (tEncodeI32(pEncoder, pInfo->nodeId) < 0) return -1;
if (tEncodeI32(pEncoder, pInfo->childId) < 0) return -1;
- /*if (tEncodeI64(pEncoder, pInfo->processedVer) < 0) return -1;*/
if (tEncodeSEpSet(pEncoder, &pInfo->epSet) < 0) return -1;
if (tEncodeI64(pEncoder, pInfo->stage) < 0) return -1;
return 0;
@@ -136,7 +136,6 @@ int32_t tDecodeStreamEpInfo(SDecoder* pDecoder, SStreamChildEpInfo* pInfo) {
if (tDecodeI32(pDecoder, &pInfo->taskId) < 0) return -1;
if (tDecodeI32(pDecoder, &pInfo->nodeId) < 0) return -1;
if (tDecodeI32(pDecoder, &pInfo->childId) < 0) return -1;
- /*if (tDecodeI64(pDecoder, &pInfo->processedVer) < 0) return -1;*/
if (tDecodeSEpSet(pDecoder, &pInfo->epSet) < 0) return -1;
if (tDecodeI64(pDecoder, &pInfo->stage) < 0) return -1;
return 0;
@@ -205,6 +204,7 @@ int32_t tEncodeStreamTask(SEncoder* pEncoder, const SStreamTask* pTask) {
if (tEncodeCStr(pEncoder, pTask->outputInfo.shuffleDispatcher.stbFullName) < 0) return -1;
}
if (tEncodeI64(pEncoder, pTask->info.triggerParam) < 0) return -1;
+ if (tEncodeI8(pEncoder, pTask->subtableWithoutMd5) < 0) return -1;
if (tEncodeCStrWithLen(pEncoder, pTask->reserve, sizeof(pTask->reserve) - 1) < 0) return -1;
tEndEncode(pEncoder);
@@ -287,6 +287,7 @@ int32_t tDecodeStreamTask(SDecoder* pDecoder, SStreamTask* pTask) {
if (tDecodeCStrTo(pDecoder, pTask->outputInfo.shuffleDispatcher.stbFullName) < 0) return -1;
}
if (tDecodeI64(pDecoder, &pTask->info.triggerParam) < 0) return -1;
+ if (tDecodeI8(pDecoder, &pTask->subtableWithoutMd5) < 0) return -1;
if (tDecodeCStrTo(pDecoder, pTask->reserve) < 0) return -1;
tEndDecode(pDecoder);
@@ -294,7 +295,6 @@ int32_t tDecodeStreamTask(SDecoder* pDecoder, SStreamTask* pTask) {
}
int32_t tDecodeStreamTaskChkInfo(SDecoder* pDecoder, SCheckpointInfo* pChkpInfo) {
- int64_t ver;
int64_t skip64;
int8_t skip8;
int32_t skip32;
@@ -482,7 +482,7 @@ int32_t streamTaskInit(SStreamTask* pTask, SStreamMeta* pMeta, SMsgCb* pMsgCb, i
pTask->execInfo.created = taosGetTimestampMs();
SCheckpointInfo* pChkInfo = &pTask->chkInfo;
- SDataRange* pRange = &pTask->dataRange;
+ SDataRange* pRange = &pTask->dataRange;
// only set the version info for stream tasks without fill-history task
if (pTask->info.taskLevel == TASK_LEVEL__SOURCE) {
@@ -648,7 +648,7 @@ int32_t streamTaskStop(SStreamTask* pTask) {
streamTaskHandleEvent(pTask->status.pSM, TASK_EVENT_STOP);
qKillTask(pTask->exec.pExecutor, TSDB_CODE_SUCCESS);
- while (/*pTask->status.schedStatus != TASK_SCHED_STATUS__INACTIVE */ !streamTaskIsIdle(pTask)) {
+ while (!streamTaskIsIdle(pTask)) {
stDebug("s-task:%s level:%d wait for task to be idle and then close, check again in 100ms", id,
pTask->info.taskLevel);
taosMsleep(100);
@@ -755,9 +755,9 @@ int8_t streamTaskSetSchedStatusInactive(SStreamTask* pTask) {
return status;
}
-int32_t streamTaskClearHTaskAttr(SStreamTask* pTask, bool metaLock) {
- SStreamMeta* pMeta = pTask->pMeta;
- STaskId sTaskId = {.streamId = pTask->streamTaskId.streamId, .taskId = pTask->streamTaskId.taskId};
+int32_t streamTaskClearHTaskAttr(SStreamTask* pTask, int32_t resetRelHalt, bool metaLock) {
+ SStreamMeta* pMeta = pTask->pMeta;
+ STaskId sTaskId = {.streamId = pTask->streamTaskId.streamId, .taskId = pTask->streamTaskId.taskId};
if (pTask->info.fillHistory == 0) {
return 0;
}
@@ -773,6 +773,12 @@ int32_t streamTaskClearHTaskAttr(SStreamTask* pTask, bool metaLock) {
taosThreadMutexLock(&(*ppStreamTask)->lock);
CLEAR_RELATED_FILLHISTORY_TASK((*ppStreamTask));
+
+ if (resetRelHalt) {
+ (*ppStreamTask)->status.taskStatus = TASK_STATUS__READY;
+ stDebug("s-task:0x%" PRIx64 " set the status to be ready", sTaskId.taskId);
+ }
+
streamMetaSaveTask(pMeta, *ppStreamTask);
taosThreadMutexUnlock(&(*ppStreamTask)->lock);
}
@@ -784,7 +790,7 @@ int32_t streamTaskClearHTaskAttr(SStreamTask* pTask, bool metaLock) {
return TSDB_CODE_SUCCESS;
}
-int32_t streamBuildAndSendDropTaskMsg(SMsgCb* pMsgCb, int32_t vgId, SStreamTaskId* pTaskId) {
+int32_t streamBuildAndSendDropTaskMsg(SMsgCb* pMsgCb, int32_t vgId, SStreamTaskId* pTaskId, int64_t resetRelHalt) {
SVDropStreamTaskReq* pReq = rpcMallocCont(sizeof(SVDropStreamTaskReq));
if (pReq == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
@@ -794,6 +800,7 @@ int32_t streamBuildAndSendDropTaskMsg(SMsgCb* pMsgCb, int32_t vgId, SStreamTaskI
pReq->head.vgId = vgId;
pReq->taskId = pTaskId->taskId;
pReq->streamId = pTaskId->streamId;
+ pReq->resetRelHalt = resetRelHalt;
SRpcMsg msg = {.msgType = TDMT_STREAM_TASK_DROP, .pCont = pReq, .contLen = sizeof(SVDropStreamTaskReq)};
int32_t code = tmsgPutToQueue(pMsgCb, WRITE_QUEUE, &msg);
@@ -864,7 +871,7 @@ void streamTaskPause(SStreamMeta* pMeta, SStreamTask* pTask) {
void streamTaskResume(SStreamTask* pTask) {
SStreamTaskState prevState = *streamTaskGetStatus(pTask);
- SStreamMeta* pMeta = pTask->pMeta;
+ SStreamMeta* pMeta = pTask->pMeta;
if (prevState.state == TASK_STATUS__PAUSE || prevState.state == TASK_STATUS__HALT) {
streamTaskRestoreStatus(pTask);
@@ -881,9 +888,7 @@ void streamTaskResume(SStreamTask* pTask) {
}
}
-bool streamTaskIsSinkTask(const SStreamTask* pTask) {
- return pTask->info.taskLevel == TASK_LEVEL__SINK;
-}
+bool streamTaskIsSinkTask(const SStreamTask* pTask) { return pTask->info.taskLevel == TASK_LEVEL__SINK; }
int32_t streamTaskSendCheckpointReq(SStreamTask* pTask) {
int32_t code;
diff --git a/source/libs/stream/src/streamUpdate.c b/source/libs/stream/src/streamUpdate.c
index d607f26de3..454ed4297c 100644
--- a/source/libs/stream/src/streamUpdate.c
+++ b/source/libs/stream/src/streamUpdate.c
@@ -261,6 +261,7 @@ void updateInfoDestroy(SUpdateInfo *pInfo) {
taosArrayDestroy(pInfo->pTsSBFs);
taosHashCleanup(pInfo->pMap);
+ updateInfoDestoryColseWinSBF(pInfo);
taosMemoryFree(pInfo);
}
diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c
index fb5e02c827..f86ab6b8a3 100644
--- a/source/libs/stream/src/tstreamFileState.c
+++ b/source/libs/stream/src/tstreamFileState.c
@@ -480,6 +480,15 @@ int32_t deleteRowBuff(SStreamFileState* pFileState, const void* pKey, int32_t ke
return TSDB_CODE_FAILED;
}
+int32_t resetRowBuff(SStreamFileState* pFileState, const void* pKey, int32_t keyLen) {
+ int32_t code_buff = pFileState->stateBuffRemoveFn(pFileState->rowStateBuff, pKey, keyLen);
+ int32_t code_file = pFileState->stateFileRemoveFn(pFileState, pKey);
+ if (code_buff == TSDB_CODE_SUCCESS || code_file == TSDB_CODE_SUCCESS) {
+ return TSDB_CODE_SUCCESS;
+ }
+ return TSDB_CODE_FAILED;
+}
+
static void recoverSessionRowBuff(SStreamFileState* pFileState, SRowBuffPos* pPos) {
int32_t len = 0;
void* pBuff = NULL;
@@ -656,7 +665,7 @@ int32_t recoverSesssion(SStreamFileState* pFileState, int64_t ckId) {
deleteExpiredCheckPoint(pFileState, mark);
}
- SStreamStateCur* pCur = streamStateSessionSeekToLast_rocksdb(pFileState->pFileStore);
+ SStreamStateCur* pCur = streamStateSessionSeekToLast_rocksdb(pFileState->pFileStore, INT64_MAX);
if (pCur == NULL) {
return -1;
}
diff --git a/source/libs/stream/test/CMakeLists.txt b/source/libs/stream/test/CMakeLists.txt
index c11d8fe3e6..c90e05bcf6 100644
--- a/source/libs/stream/test/CMakeLists.txt
+++ b/source/libs/stream/test/CMakeLists.txt
@@ -34,7 +34,7 @@ add_test(
COMMAND streamUpdateTest
)
-# add_test(
-# NAME checkpointTest
-# COMMAND checkpointTest
-# )
\ No newline at end of file
+add_test(
+ NAME checkpointTest
+ COMMAND checkpointTest
+)
\ No newline at end of file
diff --git a/source/libs/transport/src/trans.c b/source/libs/transport/src/trans.c
index 64302a78fc..f658947144 100644
--- a/source/libs/transport/src/trans.c
+++ b/source/libs/transport/src/trans.c
@@ -140,11 +140,7 @@ void* rpcMallocCont(int64_t contLen) {
return start + sizeof(STransMsgHead);
}
-void rpcFreeCont(void* cont) {
- if (cont == NULL) return;
- taosMemoryFree((char*)cont - TRANS_MSG_OVERHEAD);
- tTrace("rpc free cont:%p", (char*)cont - TRANS_MSG_OVERHEAD);
-}
+void rpcFreeCont(void* cont) { transFreeMsg(cont); }
void* rpcReallocCont(void* ptr, int64_t contLen) {
if (ptr == NULL) return rpcMallocCont(contLen);
diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c
index b6942655a9..e2b69dd145 100644
--- a/source/libs/transport/src/transCli.c
+++ b/source/libs/transport/src/transCli.c
@@ -218,7 +218,6 @@ static void (*cliAsyncHandle[])(SCliMsg* pMsg, SCliThrd* pThrd) = {cliHandleReq,
/// static void (*cliAsyncHandle[])(SCliMsg* pMsg, SCliThrd* pThrd) = {cliHandleReq, cliHandleQuit, cliHandleRelease,
/// NULL,cliHandleUpdate};
-static FORCE_INLINE void destroyUserdata(STransMsg* userdata);
static FORCE_INLINE void destroyCmsg(void* cmsg);
static FORCE_INLINE void destroyCmsgAndAhandle(void* cmsg);
static FORCE_INLINE int cliRBChoseIdx(STrans* pTransInst);
@@ -962,6 +961,10 @@ static void cliSendCb(uv_write_t* req, int status) {
tTrace("%s conn %p send cost:%dus ", CONN_GET_INST_LABEL(pConn), pConn, (int)cost);
}
}
+ if (pMsg->msg.contLen == 0 && pMsg->msg.pCont != 0) {
+ rpcFreeCont(pMsg->msg.pCont);
+ pMsg->msg.pCont = 0;
+ }
if (status == 0) {
tDebug("%s conn %p data already was written out", CONN_GET_INST_LABEL(pConn), pConn);
@@ -1950,14 +1953,6 @@ _err:
return NULL;
}
-static FORCE_INLINE void destroyUserdata(STransMsg* userdata) {
- if (userdata->pCont == NULL) {
- return;
- }
- transFreeMsg(userdata->pCont);
- userdata->pCont = NULL;
-}
-
static FORCE_INLINE void destroyCmsg(void* arg) {
SCliMsg* pMsg = arg;
if (pMsg == NULL) {
@@ -1965,7 +1960,7 @@ static FORCE_INLINE void destroyCmsg(void* arg) {
}
transDestroyConnCtx(pMsg->ctx);
- destroyUserdata(&pMsg->msg);
+ transFreeMsg(pMsg->msg.pCont);
taosMemoryFree(pMsg);
}
@@ -1984,7 +1979,7 @@ static FORCE_INLINE void destroyCmsgAndAhandle(void* param) {
tDebug("destroy Ahandle C");
transDestroyConnCtx(pMsg->ctx);
- destroyUserdata(&pMsg->msg);
+ transFreeMsg(pMsg->msg.pCont);
taosMemoryFree(pMsg);
}
diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c
index b1fb9a2450..4619722743 100644
--- a/source/libs/transport/src/transComm.c
+++ b/source/libs/transport/src/transComm.c
@@ -87,6 +87,7 @@ void transFreeMsg(void* msg) {
if (msg == NULL) {
return;
}
+ tTrace("rpc free cont:%p", (char*)msg - TRANS_MSG_OVERHEAD);
taosMemoryFree((char*)msg - sizeof(STransMsgHead));
}
int transSockInfo2Str(struct sockaddr* sockname, char* dst) {
diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c
index f4e35c5b7f..bab9ba0cea 100644
--- a/source/os/src/osFile.c
+++ b/source/os/src/osFile.c
@@ -632,6 +632,11 @@ int64_t taosFSendFile(TdFilePtr pFileOut, TdFilePtr pFileIn, int64_t *offset, in
return writeLen;
}
+bool lastErrorIsFileNotExist() {
+ DWORD dwError = GetLastError();
+ return dwError == ERROR_FILE_NOT_FOUND;
+}
+
#else
int taosOpenFileNotStream(const char *path, int32_t tdFileOptions) {
int access = O_BINARY;
@@ -1028,6 +1033,8 @@ int64_t taosFSendFile(TdFilePtr pFileOut, TdFilePtr pFileIn, int64_t *offset, in
#endif
}
+bool lastErrorIsFileNotExist() { return errno == ENOENT; }
+
#endif // WINDOWS
TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions) {
diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c
index 505ce61eca..eae02125d2 100644
--- a/source/util/src/tlog.c
+++ b/source/util/src/tlog.c
@@ -350,7 +350,7 @@ void taosResetLog() {
static bool taosCheckFileIsOpen(char *logFileName) {
TdFilePtr pFile = taosOpenFile(logFileName, TD_FILE_WRITE);
if (pFile == NULL) {
- if (errno == ENOENT) {
+ if (lastErrorIsFileNotExist()) {
return false;
} else {
printf("\nfailed to open log file:%s, reason:%s\n", logFileName, strerror(errno));
diff --git a/tests/army/community/cluster/incSnapshot.py b/tests/army/community/cluster/incSnapshot.py
index d309bae72c..6bcf547136 100644
--- a/tests/army/community/cluster/incSnapshot.py
+++ b/tests/army/community/cluster/incSnapshot.py
@@ -18,6 +18,9 @@ from frame.autogen import *
class TDTestCase(TBase):
+ updatecfgDict = {
+ 'slowLogScope':"query"
+ }
def init(self, conn, logSql, replicaVar=3):
super(TDTestCase, self).init(conn, logSql, replicaVar=3, db="snapshot", checkColName="c1")
diff --git a/tests/army/community/cluster/snapshot.py b/tests/army/community/cluster/snapshot.py
index b4c4d3c4c8..b21cbb1ad8 100644
--- a/tests/army/community/cluster/snapshot.py
+++ b/tests/army/community/cluster/snapshot.py
@@ -33,7 +33,8 @@ class TDTestCase(TBase):
"lossyColumns" : "float,double",
"fPrecision" : "0.000000001",
"dPrecision" : "0.00000000000000001",
- "ifAdtFse" : "1"
+ "ifAdtFse" : "1",
+ 'slowLogScope' : "insert"
}
def insertData(self):
@@ -56,7 +57,7 @@ class TDTestCase(TBase):
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"
+ sql = f"select * from {self.db}.{self.stb} where dc!=200"
tdSql.query(sql)
tdSql.checkRows(0)
sql = f"select avg(fc) from {self.db}.{self.stb}"
diff --git a/tests/army/community/cluster/splitVgroupByLearner.py b/tests/army/community/cluster/splitVgroupByLearner.py
index 5f75db2db5..c2025a331d 100644
--- a/tests/army/community/cluster/splitVgroupByLearner.py
+++ b/tests/army/community/cluster/splitVgroupByLearner.py
@@ -31,6 +31,9 @@ from frame.srvCtl import *
class TDTestCase(TBase):
+ updatecfgDict = {
+ 'slowLogScope' : "others"
+ }
def init(self, conn, logSql, replicaVar=1):
tdLog.debug(f"start to init {__file__}")
diff --git a/tests/army/community/cmdline/fullopt.py b/tests/army/community/cmdline/fullopt.py
index c0ce709801..c03ba428a1 100644
--- a/tests/army/community/cmdline/fullopt.py
+++ b/tests/army/community/cmdline/fullopt.py
@@ -31,10 +31,10 @@ class TDTestCase(TBase):
'queryMaxConcurrentTables': '2K',
'streamMax': '1M',
'totalMemoryKB': '1G',
- #'rpcQueueMemoryAllowed': '1T',
- #'mndLogRetention': '1P',
- 'streamBufferSize':'2G'
- }
+ 'streamMax': '1P',
+ 'streamBufferSize':'1T',
+ 'slowLogScope':"query"
+ }
def insertData(self):
tdLog.info(f"insert data.")
@@ -47,8 +47,40 @@ class TDTestCase(TBase):
# taosBenchmark run
etool.benchMark(command = f"-d {self.db} -t {self.childtable_count} -n {self.insert_rows} -v 2 -y")
+ def checkQueryOK(self, rets):
+ if rets[-2][:9] != "Query OK,":
+ tdLog.exit(f"check taos -s return unecpect: {rets}")
+
def doTaos(self):
tdLog.info(f"check taos command options...")
+
+ # local command
+ options = [
+ "DebugFlag 143",
+ "enableCoreFile 1",
+ "fqdn 127.0.0.1",
+ "firstEp 127.0.0.1",
+ "locale ENG",
+ "metaCacheMaxSize 10000",
+ "minimalTmpDirGB 5",
+ "minimalLogDirGB 1",
+ "secondEp 127.0.0.2",
+ "smlChildTableName smltbname",
+ "smlAutoChildTableNameDelimiter autochild",
+ "smlTagName tagname",
+ "smlTsDefaultName tsdef",
+ "serverPort 6030",
+ "slowLogScope insert",
+ "timezone tz",
+ "tempDir /var/tmp"
+ ]
+ # exec
+ for option in options:
+ rets = etool.runBinFile("taos", f"-s \"alter local '{option}'\";")
+ self.checkQueryOK(rets)
+ # error
+ etool.runBinFile("taos", f"-s \"alter local 'nocmd check'\";")
+
# help
rets = etool.runBinFile("taos", "--help")
self.checkListNotEmpty(rets)
diff --git a/tests/army/community/query/fill/fill_desc.py b/tests/army/community/query/fill/fill_desc.py
index bec29c49fd..02e316a4fb 100644
--- a/tests/army/community/query/fill/fill_desc.py
+++ b/tests/army/community/query/fill/fill_desc.py
@@ -8,6 +8,9 @@ from frame.caseBase import *
from frame import *
class TDTestCase(TBase):
+ updatecfgDict = {
+ 'slowLogScope':"all"
+ }
def init(self, conn, logSql, replicaVar=1):
self.replicaVar = int(replicaVar)
diff --git a/tests/army/community/query/query_basic.py b/tests/army/community/query/query_basic.py
index bfe88e483e..d2e0201860 100644
--- a/tests/army/community/query/query_basic.py
+++ b/tests/army/community/query/query_basic.py
@@ -29,9 +29,11 @@ from frame import *
class TDTestCase(TBase):
updatecfgDict = {
- "keepColumnName" : "1",
+ "keepColumnName" : "1",
"ttlChangeOnWrite" : "1",
- "querySmaOptimize": "1"
+ "querySmaOptimize" : "1",
+ "slowLogScope" : "none",
+ "queryBufferSize" : 10240
}
diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task
index d43a9a7ee6..9395753510 100644
--- a/tests/parallel_test/cases.task
+++ b/tests/parallel_test/cases.task
@@ -160,6 +160,14 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/td-28068.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/td-28068.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/td-28068.py -Q 4
+,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/agg_group_AlwaysReturnValue.py
+,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/agg_group_AlwaysReturnValue.py -Q 2
+,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/agg_group_AlwaysReturnValue.py -Q 3
+,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/agg_group_AlwaysReturnValue.py -Q 4
+,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/agg_group_NotReturnValue.py
+,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/agg_group_NotReturnValue.py -Q 2
+,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/agg_group_NotReturnValue.py -Q 3
+,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/agg_group_NotReturnValue.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 3-enterprise/restore/restoreDnode.py -N 5 -M 3 -i False
,,y,system-test,./pytest.sh python3 ./test.py -f 3-enterprise/restore/restoreVnode.py -N 5 -M 3 -i False
@@ -575,6 +583,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/ts_3405_3398_3423.py -N 3 -n 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/ts-4348-td-27939.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/backslash_g.py
+,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/test_ts4467.py
,,n,system-test,python3 ./test.py -f 2-query/queryQnode.py
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode1mnode.py
@@ -1140,6 +1149,8 @@
,,y,script,./test.sh -f tsim/query/bug3398.sim
,,y,script,./test.sh -f tsim/query/explain_tsorder.sim
,,y,script,./test.sh -f tsim/query/apercentile.sim
+,,y,script,./test.sh -f tsim/query/query_count0.sim
+,,y,script,./test.sh -f tsim/query/query_count_sliding0.sim
,,y,script,./test.sh -f tsim/qnode/basic1.sim
,,y,script,./test.sh -f tsim/snode/basic1.sim
,,y,script,./test.sh -f tsim/mnode/basic1.sim
@@ -1184,6 +1195,13 @@
,,y,script,./test.sh -f tsim/stream/checkpointInterval0.sim
,,y,script,./test.sh -f tsim/stream/checkStreamSTable1.sim
,,y,script,./test.sh -f tsim/stream/checkStreamSTable.sim
+,,y,script,./test.sh -f tsim/stream/count0.sim
+,,y,script,./test.sh -f tsim/stream/count1.sim
+,,y,script,./test.sh -f tsim/stream/count2.sim
+,,y,script,./test.sh -f tsim/stream/count3.sim
+,,y,script,./test.sh -f tsim/stream/countSliding0.sim
+,,y,script,./test.sh -f tsim/stream/countSliding1.sim
+,,y,script,./test.sh -f tsim/stream/countSliding2.sim
,,y,script,./test.sh -f tsim/stream/deleteInterval.sim
,,y,script,./test.sh -f tsim/stream/deleteSession.sim
,,y,script,./test.sh -f tsim/stream/deleteState.sim
diff --git a/tests/script/tsim/parser/like.sim b/tests/script/tsim/parser/like.sim
index 5cac026b57..298dbce0e5 100644
--- a/tests/script/tsim/parser/like.sim
+++ b/tests/script/tsim/parser/like.sim
@@ -51,6 +51,22 @@ if $rows != 1 then
return -1
endi
+$view1 = view1_name
+$view2 = view2_name
+
+sql CREATE VIEW $view1 as select * from $table1
+sql CREATE VIEW $view2 AS select * from $table2
+
+sql show views like 'view%'
+if $rows != 2 then
+ return -1
+endi
+
+sql show views like 'view1%'
+if $rows != 1 then
+ return -1
+endi
+
system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/query/query_count0.sim b/tests/script/tsim/query/query_count0.sim
new file mode 100644
index 0000000000..c3a75d635b
--- /dev/null
+++ b/tests/script/tsim/query/query_count0.sim
@@ -0,0 +1,179 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/exec.sh -n dnode1 -s start
+sleep 50
+sql connect
+
+print step1
+print =============== create database
+sql create database test vgroups 1;
+sql use test;
+
+sql create table t1(ts timestamp, a int, b int , c int, d double);
+
+sql insert into t1 values(1648791213000,0,1,1,1.0);
+sql insert into t1 values(1648791213001,9,2,2,1.1);
+sql insert into t1 values(1648791213009,0,3,3,1.0);
+
+
+sql insert into t1 values(1648791223000,0,1,1,1.0);
+sql insert into t1 values(1648791223001,9,2,2,1.1);
+sql insert into t1 values(1648791223009,0,3,3,1.0);
+
+$loop_count = 0
+loop2:
+
+sleep 300
+print 1 sql select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(3);
+sql select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(3);
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $data01 != 3 then
+ print ======data01=$data01
+ goto loop2
+endi
+
+if $data02 != 6 then
+ print ======data02=$data02
+ goto loop2
+endi
+
+if $data03 != 3 then
+ print ======data03=$data03
+ goto loop2
+endi
+
+# row 1
+if $data11 != 3 then
+ print ======data11=$data11
+ goto loop2
+endi
+
+if $data12 != 6 then
+ print ======data12=$data12
+ goto loop2
+endi
+
+if $data13 != 3 then
+ print ======data13=$data13
+ goto loop2
+endi
+
+
+
+print step2
+print =============== create database
+sql create database test2 vgroups 4;
+sql use test2;
+
+sql create stable st(ts timestamp, a int, b int , c int, d double) tags(ta int,tb int,tc int);
+sql create table t1 using st tags(1,1,1);
+sql create table t2 using st tags(2,2,2);
+
+sql insert into t1 values(1648791213000,0,1,1,1.0);
+sql insert into t1 values(1648791213001,9,2,2,1.1);
+sql insert into t1 values(1648791213009,0,3,3,1.0);
+
+sql insert into t2 values(1648791213000,0,1,1,1.0);
+sql insert into t2 values(1648791213001,9,2,2,1.1);
+sql insert into t2 values(1648791213009,0,3,3,1.0);
+
+sql insert into t1 values(1648791223000,0,1,1,1.0);
+sql insert into t1 values(1648791223001,9,2,2,1.1);
+sql insert into t1 values(1648791223009,0,3,3,1.0);
+
+sql insert into t2 values(1648791223000,0,1,1,1.0);
+sql insert into t2 values(1648791223001,9,2,2,1.1);
+sql insert into t2 values(1648791223009,0,3,3,1.0);
+
+$loop_count = 0
+loop3:
+
+sleep 300
+print 1 sql select _wstart as s, count(*) c1, sum(b), max(c) from st partition by tbname count_window(3);
+sql select _wstart as s, count(*) c1, sum(b), max(c) from st partition by tbname count_window(3);
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $data01 != 3 then
+ print ======data01=$data01
+ goto loop3
+endi
+
+if $data02 != 6 then
+ print ======data02=$data02
+ goto loop3
+endi
+
+if $data03 != 3 then
+ print ======data03=$data03
+ goto loop3
+endi
+
+# row 1
+if $data11 != 3 then
+ print ======data11=$data11
+ goto loop3
+endi
+
+if $data12 != 6 then
+ print ======data12=$data12
+ goto loop3
+endi
+
+if $data13 != 3 then
+ print ======data13=$data13
+ goto loop3
+endi
+
+# row 2
+if $data21 != 3 then
+ print ======data21=$data21
+ goto loop3
+endi
+
+if $data22 != 6 then
+ print ======data22=$data22
+ goto loop3
+endi
+
+if $data23 != 3 then
+ print ======data23=$data23
+ goto loop3
+endi
+
+# row 3
+if $data31 != 3 then
+ print ======data31=$data31
+ goto loop3
+endi
+
+if $data32 != 6 then
+ print ======data32=$data32
+ goto loop3
+endi
+
+if $data33 != 3 then
+ print ======data33=$data33
+ goto loop3
+endi
+
+print query_count0 end
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/query/query_count1.sim b/tests/script/tsim/query/query_count1.sim
new file mode 100644
index 0000000000..0694ab062a
--- /dev/null
+++ b/tests/script/tsim/query/query_count1.sim
@@ -0,0 +1,83 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/exec.sh -n dnode1 -s start
+sleep 50
+sql connect
+
+print step1
+print =============== create database
+sql create database test vgroups 4;
+sql use test;
+
+sql create stable st(ts timestamp, a int, b int , c int, d double) tags(ta int,tb int,tc int);
+sql create table t1 using st tags(1,1,1);
+sql create table t2 using st tags(2,2,2);
+
+sql insert into t1 values(1648791213000,0,1,1,1.0);
+sql insert into t1 values(1648791213001,9,1,2,1.1);
+sql insert into t1 values(1648791213009,0,1,3,1.0);
+
+sql insert into t2 values(1648791213000,0,1,4,1.0);
+sql insert into t2 values(1648791213001,9,1,5,1.1);
+sql insert into t2 values(1648791213009,0,1,6,1.0);
+
+sql insert into t1 values(1648791223000,0,1,7,1.0);
+sql insert into t1 values(1648791223001,9,1,8,1.1);
+sql insert into t1 values(1648791223009,0,1,9,1.0);
+
+sql insert into t2 values(1648791223000,0,1,10,1.0);
+sql insert into t2 values(1648791223001,9,1,11,1.1);
+sql insert into t2 values(1648791223009,0,1,12,1.0);
+
+$loop_count = 0
+loop3:
+
+sleep 300
+print 1 sql select _wstart as s, count(*) c1, sum(b), max(c) from st count_window(4);
+sql select _wstart as s, count(*) c1, sum(b), max(c) from st count_window(4);
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $data01 != 4 then
+ print ======data01=$data01
+ goto loop3
+endi
+
+if $data02 != 4 then
+ print ======data02=$data02
+ goto loop3
+endi
+
+# row 1
+if $data11 != 4 then
+ print ======data11=$data11
+ goto loop3
+endi
+
+if $data12 != 4 then
+ print ======data12=$data12
+ goto loop3
+endi
+
+# row 2
+if $data21 != 4 then
+ print ======data21=$data21
+ goto loop3
+endi
+
+if $data22 != 4 then
+ print ======data22=$data22
+ goto loop3
+endi
+
+print query_count0 end
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/query/query_count_sliding0.sim b/tests/script/tsim/query/query_count_sliding0.sim
new file mode 100644
index 0000000000..464aec6b97
--- /dev/null
+++ b/tests/script/tsim/query/query_count_sliding0.sim
@@ -0,0 +1,670 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/exec.sh -n dnode1 -s start
+sleep 50
+sql connect
+
+print step1
+print =============== create database
+sql create database test vgroups 1;
+sql use test;
+
+sql create table t1(ts timestamp, a int, b int , c int, d double);
+
+sql insert into t1 values(1648791213000,0,1,1,1.0);
+
+$loop_count = 0
+loop00:
+
+sleep 300
+print 00 sql select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(4, 2);
+sql select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(4, 2);
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 1 then
+ print ======rows=$rows
+ goto loop00
+endi
+
+# row 0
+if $data01 != 1 then
+ print ======data01=$data01
+ goto loop00
+endi
+
+sql insert into t1 values(1648791213001,9,2,2,1.1);
+
+$loop_count = 0
+loop01:
+
+sleep 300
+print 01 sql select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(4, 2);
+sql select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(4, 2);
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 1 then
+ print ======rows=$rows
+ goto loop01
+endi
+
+# row 0
+if $data01 != 2 then
+ print ======data01=$data01
+ goto loop01
+endi
+
+
+sql insert into t1 values(1648791213002,0,3,3,1.0);
+
+$loop_count = 0
+loop02:
+
+sleep 300
+print 02 sql select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(4, 2);
+sql select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(4, 2);
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 2 then
+ print ======rows=$rows
+ goto loop02
+endi
+
+# row 0
+if $data01 != 3 then
+ print ======data01=$data01
+ goto loop02
+endi
+
+# row 1
+if $data11 != 1 then
+ print ======data01=$data01
+ goto loop02
+endi
+
+sql insert into t1 values(1648791213009,0,3,3,1.0);
+
+$loop_count = 0
+loop0:
+
+sleep 300
+print 1 sql select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(4, 2);
+sql select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(4, 2);
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 2 then
+ print ======rows=$rows
+ goto loop0
+endi
+
+# row 0
+if $data01 != 4 then
+ print ======data01=$data01
+ goto loop0
+endi
+
+# row 1
+if $data11 != 2 then
+ print ======data11=$data11
+ goto loop0
+endi
+
+sql insert into t1 values(1648791223000,0,1,1,1.0);
+sql insert into t1 values(1648791223001,9,2,2,1.1);
+sql insert into t1 values(1648791223002,9,2,2,1.1);
+sql insert into t1 values(1648791223009,0,3,3,1.0);
+
+$loop_count = 0
+loop2:
+
+sleep 300
+print 1 sql select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(4, 2);
+sql select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(4, 2);
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 4 then
+ print ======rows=$rows
+ goto loop2
+endi
+
+# row 0
+if $data01 != 4 then
+ print ======data01=$data01
+ goto loop2
+endi
+
+# row 1
+if $data11 != 4 then
+ print ======data11=$data11
+ goto loop2
+endi
+
+# row 2
+if $data21 != 4 then
+ print ======data21=$data21
+ goto loop2
+endi
+
+# row 3
+if $data31 != 2 then
+ print ======data31=$data31
+ goto loop2
+endi
+
+sql insert into t1 values(1648791233000,0,1,1,1.0) (1648791233001,9,2,2,1.1) (1648791233002,9,2,2,1.1) (1648791233009,0,3,3,1.0);
+
+$loop_count = 0
+loop3:
+
+sleep 300
+print 1 sql select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(4, 2);
+sql select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(4, 2);
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+print $data50 $data51 $data52 $data53
+print $data60 $data61 $data62 $data63
+print $data70 $data71 $data72 $data73
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 6 then
+ print ======rows=$rows
+ goto loop3
+endi
+
+
+sql insert into t1 values(1648791243000,0,1,1,1.0) (1648791243001,9,2,2,1.1);
+
+$loop_count = 0
+loop4:
+
+sleep 300
+print 1 sql select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(4, 2);
+sql select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(4, 2);
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+print $data50 $data51 $data52 $data53
+print $data60 $data61 $data62 $data63
+print $data70 $data71 $data72 $data73
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 7 then
+ print ======rows=$rows
+ goto loop4
+endi
+
+sql insert into t1 values(1648791253000,0,1,1,1.0) (1648791253001,9,2,2,1.1) (1648791253002,9,2,2,1.1);
+
+$loop_count = 0
+loop5:
+
+sleep 300
+print 1 sql select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(4, 2);
+sql select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(4, 2);
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+print $data50 $data51 $data52 $data53
+print $data60 $data61 $data62 $data63
+print $data70 $data71 $data72 $data73
+print $data80 $data81 $data82 $data83
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 9 then
+ print ======rows=$rows
+ goto loop5
+endi
+
+sql insert into t1 values(1648791263000,0,1,1,1.0);
+
+$loop_count = 0
+loop6:
+
+sleep 300
+print 1 sql select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(4, 2);
+sql select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(4, 2);
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+print $data50 $data51 $data52 $data53
+print $data60 $data61 $data62 $data63
+print $data70 $data71 $data72 $data73
+print $data80 $data81 $data82 $data83
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 9 then
+ print ======rows=$rows
+ goto loop6
+endi
+
+
+
+print step2
+print =============== create database
+sql create database test2 vgroups 4;
+sql use test2;
+
+sql create stable st(ts timestamp, a int, b int , c int, d double) tags(ta int,tb int,tc int);
+sql create table t1 using st tags(1,1,1);
+sql create table t2 using st tags(2,2,2);
+
+sql insert into t1 values(1648791213000,0,1,1,1.0);
+sql insert into t1 values(1648791213001,9,2,2,1.1);
+sql insert into t1 values(1648791213002,0,3,3,1.0);
+sql insert into t1 values(1648791213009,0,3,3,1.0);
+
+$loop_count = 0
+loop7:
+
+sleep 300
+print 1 sql select _wstart as s, count(*) c1, sum(b), max(c) from st partition by tbname count_window(4, 2);
+sql select _wstart as s, count(*) c1, sum(b), max(c) from st partition by tbname count_window(4, 2);
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 2 then
+ print ======rows=$rows
+ goto loop7
+endi
+
+# row 0
+if $data01 != 4 then
+ print ======data01=$data01
+ goto loop7
+endi
+
+# row 1
+if $data11 != 2 then
+ print ======data11=$data11
+ goto loop7
+endi
+
+sql insert into t1 values(1648791223000,0,1,1,1.0);
+sql insert into t1 values(1648791223001,9,2,2,1.1);
+sql insert into t1 values(1648791223002,9,2,2,1.1);
+sql insert into t1 values(1648791223009,0,3,3,1.0);
+
+$loop_count = 0
+loop8:
+
+sleep 300
+print 1 sql select _wstart as s, count(*) c1, sum(b), max(c) from st partition by tbname count_window(4, 2);
+sql select _wstart as s, count(*) c1, sum(b), max(c) from st partition by tbname count_window(4, 2);
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 4 then
+ print ======rows=$rows
+ goto loop8
+endi
+
+# row 0
+if $data01 != 4 then
+ print ======data01=$data01
+ goto loop8
+endi
+
+# row 1
+if $data11 != 4 then
+ print ======data11=$data11
+ goto loop8
+endi
+
+# row 2
+if $data21 != 4 then
+ print ======data21=$data21
+ goto loop8
+endi
+
+# row 3
+if $data31 != 2 then
+ print ======data31=$data31
+ goto loop8
+endi
+
+sql insert into t1 values(1648791233000,0,1,1,1.0) (1648791233001,9,2,2,1.1) (1648791233002,9,2,2,1.1) (1648791233009,0,3,3,1.0);
+
+$loop_count = 0
+loop9:
+
+sleep 300
+print 1 sql select _wstart as s, count(*) c1, sum(b), max(c) from st partition by tbname count_window(4, 2);
+sql select _wstart as s, count(*) c1, sum(b), max(c) from st partition by tbname count_window(4, 2);
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+print $data50 $data51 $data52 $data53
+print $data60 $data61 $data62 $data63
+print $data70 $data71 $data72 $data73
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 6 then
+ print ======rows=$rows
+ goto loop9
+endi
+
+
+sql insert into t1 values(1648791243000,0,1,1,1.0) (1648791243001,9,2,2,1.1);
+
+$loop_count = 0
+loop10:
+
+sleep 300
+print 1 sql select _wstart as s, count(*) c1, sum(b), max(c) from st partition by tbname count_window(4, 2);
+sql select _wstart as s, count(*) c1, sum(b), max(c) from st partition by tbname count_window(4, 2);
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+print $data50 $data51 $data52 $data53
+print $data60 $data61 $data62 $data63
+print $data70 $data71 $data72 $data73
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 7 then
+ print ======rows=$rows
+ goto loop10
+endi
+
+sql insert into t1 values(1648791253000,0,1,1,1.0) (1648791253001,9,2,2,1.1) (1648791253002,9,2,2,1.1);
+
+$loop_count = 0
+loop11:
+
+sleep 300
+print 1 sql select _wstart as s, count(*) c1, sum(b), max(c) from st partition by tbname count_window(4, 2);
+sql select _wstart as s, count(*) c1, sum(b), max(c) from st partition by tbname count_window(4, 2);
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+print $data50 $data51 $data52 $data53
+print $data60 $data61 $data62 $data63
+print $data70 $data71 $data72 $data73
+print $data80 $data81 $data82 $data83
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 9 then
+ print ======rows=$rows
+ goto loop11
+endi
+
+sql insert into t1 values(1648791263000,0,1,1,1.0);
+
+$loop_count = 0
+loop12:
+
+sleep 300
+print 1 sql select _wstart as s, count(*) c1, sum(b), max(c) from st partition by tbname count_window(4, 2);
+sql select _wstart as s, count(*) c1, sum(b), max(c) from st partition by tbname count_window(4, 2);
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+print $data50 $data51 $data52 $data53
+print $data60 $data61 $data62 $data63
+print $data70 $data71 $data72 $data73
+print $data80 $data81 $data82 $data83
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 9 then
+ print ======rows=$rows
+ goto loop12
+endi
+
+
+
+print step3
+print =============== create database
+sql create database test3 vgroups 4;
+sql use test3;
+
+sql create stable st(ts timestamp, a int, b int , c int, d double) tags(ta int,tb int,tc int);
+sql create table t1 using st tags(1,1,1);
+sql create table t2 using st tags(2,2,2);
+
+sql insert into t1 values(1648791213000,0,1,1,1.0);
+sql insert into t1 values(1648791213001,9,1,2,1.1);
+sql insert into t1 values(1648791213009,0,1,3,1.0);
+
+sql insert into t2 values(1648791213000,0,1,4,1.0);
+sql insert into t2 values(1648791213001,9,1,5,1.1);
+sql insert into t2 values(1648791213009,0,1,6,1.0);
+
+sql insert into t1 values(1648791223000,0,1,7,1.0);
+sql insert into t1 values(1648791223001,9,1,8,1.1);
+sql insert into t1 values(1648791223009,0,1,9,1.0);
+
+sql insert into t2 values(1648791223000,0,1,10,1.0);
+sql insert into t2 values(1648791223001,9,1,11,1.1);
+sql insert into t2 values(1648791223009,0,1,12,1.0);
+
+$loop_count = 0
+loop13:
+
+sleep 300
+print 1 sql select _wstart as s, count(*) c1, sum(b), max(c) from st count_window(4, 1);
+sql select _wstart as s, count(*) c1, sum(b), max(c) from st count_window(4,1);
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+print $data50 $data51 $data52 $data53
+print $data60 $data61 $data62 $data63
+print $data70 $data71 $data72 $data73
+print $data80 $data81 $data82 $data83
+print $data90 $data91 $data92 $data93
+print $data[10][0] $data[10][1] $data[10][2] $data[10][3]
+print $data[11][0] $data[11][1] $data[11][2] $data[11][3]
+print $data[12][0] $data[12][1] $data[12][2] $data[12][3]
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# rows
+if $rows != 12 then
+ print ======rows=$rows
+ goto loop13
+endi
+
+# row 0
+if $data01 != 4 then
+ print ======data01=$data01
+ goto loop13
+endi
+
+if $data02 != 4 then
+ print ======data02=$data02
+ goto loop13
+endi
+
+# row 1
+if $data11 != 4 then
+ print ======data11=$data11
+ goto loop13
+endi
+
+if $data12 != 4 then
+ print ======data12=$data12
+ goto loop13
+endi
+
+# row 2
+if $data21 != 4 then
+ print ======data21=$data21
+ goto loop13
+endi
+
+if $data22 != 4 then
+ print ======data22=$data22
+ goto loop13
+endi
+
+# row 9
+if $data91 != 3 then
+ print ======data91=$data91
+ goto loop13
+endi
+
+if $data92 != 3 then
+ print ======data92=$data92
+ goto loop13
+endi
+
+# row 10
+if $data[10][1] != 2 then
+ print ======data[10][1]=$data[10][1]
+ goto loop13
+endi
+
+if $data[10][2] != 2 then
+ print ======data[10][2]=$data[10][2]
+ goto loop13
+endi
+
+# row 11
+if $data[11][1] != 1 then
+ print ======data[11][1]=$data[11][1]
+ goto loop13
+endi
+
+if $data[11][2] != 1 then
+ print ======data[11][2]=$data[11][2]
+ goto loop13
+endi
+
+print count sliding 0 end
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/stream/count0.sim b/tests/script/tsim/stream/count0.sim
new file mode 100644
index 0000000000..5f5ec72275
--- /dev/null
+++ b/tests/script/tsim/stream/count0.sim
@@ -0,0 +1,249 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/exec.sh -n dnode1 -s start
+sleep 50
+sql connect
+
+print step1
+print =============== create database
+sql create database test vgroups 1;
+sql use test;
+
+sql create table t1(ts timestamp, a int, b int , c int, d double);
+sql create stream streams1 trigger at_once IGNORE EXPIRED 1 IGNORE UPDATE 0 WATERMARK 100s into streamt as select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(3);
+sleep 1000
+
+sql insert into t1 values(1648791213000,0,1,1,1.0);
+sql insert into t1 values(1648791213001,9,2,2,1.1);
+sql insert into t1 values(1648791213009,0,3,3,1.0);
+
+
+sql insert into t1 values(1648791223000,0,1,1,1.0);
+sql insert into t1 values(1648791223001,9,2,2,1.1);
+sql insert into t1 values(1648791223009,0,3,3,1.0);
+
+$loop_count = 0
+loop2:
+
+sleep 300
+print 1 sql select * from streamt;
+sql select * from streamt;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $data01 != 3 then
+ print ======data01=$data01
+ goto loop2
+endi
+
+if $data02 != 6 then
+ print ======data02=$data02
+ goto loop2
+endi
+
+if $data03 != 3 then
+ print ======data03=$data03
+ goto loop2
+endi
+
+# row 1
+if $data11 != 3 then
+ print ======data11=$data11
+ goto loop2
+endi
+
+if $data12 != 6 then
+ print ======data12=$data12
+ goto loop2
+endi
+
+if $data13 != 3 then
+ print ======data13=$data13
+ goto loop2
+endi
+
+
+
+print step2
+print =============== create database
+sql create database test2 vgroups 4;
+sql use test2;
+
+sql create stable st(ts timestamp, a int, b int , c int, d double) tags(ta int,tb int,tc int);
+sql create table t1 using st tags(1,1,1);
+sql create table t2 using st tags(2,2,2);
+sql create stream streams2 trigger at_once IGNORE EXPIRED 1 IGNORE UPDATE 0 WATERMARK 100s into streamt2 as select _wstart as s, count(*) c1, sum(b), max(c) from st partition by tbname count_window(3)
+sleep 1000
+
+sql insert into t1 values(1648791213000,0,1,1,1.0);
+sql insert into t1 values(1648791213001,9,2,2,1.1);
+sql insert into t1 values(1648791213009,0,3,3,1.0);
+
+sql insert into t2 values(1648791213000,0,1,1,1.0);
+sql insert into t2 values(1648791213001,9,2,2,1.1);
+sql insert into t2 values(1648791213009,0,3,3,1.0);
+
+sql insert into t1 values(1648791223000,0,1,1,1.0);
+sql insert into t1 values(1648791223001,9,2,2,1.1);
+sql insert into t1 values(1648791223009,0,3,3,1.0);
+
+sql insert into t2 values(1648791223000,0,1,1,1.0);
+sql insert into t2 values(1648791223001,9,2,2,1.1);
+sql insert into t2 values(1648791223009,0,3,3,1.0);
+
+$loop_count = 0
+loop3:
+
+sleep 300
+print 1 sql select * from streamt;
+sql select * from streamt2 order by 1,2;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $data01 != 3 then
+ print ======data01=$data01
+ goto loop3
+endi
+
+if $data02 != 6 then
+ print ======data02=$data02
+ goto loop3
+endi
+
+if $data03 != 3 then
+ print ======data03=$data03
+ goto loop3
+endi
+
+# row 1
+if $data11 != 3 then
+ print ======data11=$data11
+ goto loop3
+endi
+
+if $data12 != 6 then
+ print ======data12=$data12
+ goto loop3
+endi
+
+if $data13 != 3 then
+ print ======data13=$data13
+ goto loop3
+endi
+
+# row 2
+if $data21 != 3 then
+ print ======data21=$data21
+ goto loop3
+endi
+
+if $data22 != 6 then
+ print ======data22=$data22
+ goto loop3
+endi
+
+if $data23 != 3 then
+ print ======data23=$data23
+ goto loop3
+endi
+
+# row 3
+if $data31 != 3 then
+ print ======data31=$data31
+ goto loop3
+endi
+
+if $data32 != 6 then
+ print ======data32=$data32
+ goto loop3
+endi
+
+if $data33 != 3 then
+ print ======data33=$data33
+ goto loop3
+endi
+
+print step3
+print =============== create database
+sql create database test3 vgroups 1;
+sql use test3;
+
+sql create table t1(ts timestamp, a int, b int , c int, d double);
+sql insert into t1 values(1648791213000,0,1,1,1.0);
+sql insert into t1 values(1648791213001,9,2,2,1.1);
+sql insert into t1 values(1648791213009,0,3,3,1.0);
+
+sleep 500
+
+sql create stream streams3 trigger at_once FILL_HISTORY 1 IGNORE EXPIRED 1 IGNORE UPDATE 0 WATERMARK 100s into streamt3 as select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(3);
+sleep 1000
+
+sql insert into t1 values(1648791223000,0,1,1,1.0);
+sql insert into t1 values(1648791223001,9,2,2,1.1);
+sql insert into t1 values(1648791223009,0,3,3,1.0);
+
+$loop_count = 0
+loop4:
+
+sleep 300
+print 1 sql select * from streamt3;
+sql select * from streamt3;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $data01 != 3 then
+ print ======data01=$data01
+ goto loop4
+endi
+
+if $data02 != 6 then
+ print ======data02=$data02
+ goto loop4
+endi
+
+if $data03 != 3 then
+ print ======data03=$data03
+ goto loop4
+endi
+
+# row 1
+if $data11 != 3 then
+ print ======data11=$data11
+ goto loop4
+endi
+
+if $data12 != 6 then
+ print ======data12=$data12
+ goto loop4
+endi
+
+if $data13 != 3 then
+ print ======data13=$data13
+ goto loop4
+endi
+
+print count0 end
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/stream/count1.sim b/tests/script/tsim/stream/count1.sim
new file mode 100644
index 0000000000..694f801f77
--- /dev/null
+++ b/tests/script/tsim/stream/count1.sim
@@ -0,0 +1,36 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/exec.sh -n dnode1 -s start
+sleep 50
+sql connect
+
+print step1
+print =============== create database
+sql create database test vgroups 1;
+sql use test;
+
+sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int);
+sql create table t1 using st tags(1,1,1);
+sql create table t2 using st tags(2,2,2);
+
+# stable
+sql_error create stream streams1 trigger at_once IGNORE EXPIRED 1 IGNORE UPDATE 0 WATERMARK 10s into streamt as select _wstart as s, count(*) c1, sum(b), max(c) from st count_window(3);
+
+# IGNORE EXPIRED 0
+sql_error create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 WATERMARK 10s into streamt as select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(3);
+
+# WATERMARK 0
+sql_error create stream streams1 trigger at_once IGNORE EXPIRED 1 IGNORE UPDATE 0 into streamt as select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(3);
+
+# All
+sql_error create stream streams1 trigger at_once IGNORE EXPIRED 0 IGNORE UPDATE 0 into streamt as select _wstart as s, count(*) c1, sum(b), max(c) from st count_window(3);
+
+#2~INT32_MAX
+sql_error create stream streams1 trigger at_once IGNORE EXPIRED 1 IGNORE UPDATE 0 into streamt as select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(1);
+sql_error create stream streams1 trigger at_once IGNORE EXPIRED 1 IGNORE UPDATE 0 into streamt as select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(2147483648);
+
+sql create stream streams2 trigger at_once IGNORE EXPIRED 1 IGNORE UPDATE 0 WATERMARK 10s into streamt2 as select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(2);
+sql create stream streams3 trigger at_once IGNORE EXPIRED 1 IGNORE UPDATE 0 WATERMARK 10s into streamt3 as select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(2147483647);
+
+print count1 end
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/stream/count2.sim b/tests/script/tsim/stream/count2.sim
new file mode 100644
index 0000000000..2558bd1072
--- /dev/null
+++ b/tests/script/tsim/stream/count2.sim
@@ -0,0 +1,302 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/exec.sh -n dnode1 -s start
+sleep 50
+sql connect
+
+print step1
+print =============== create database
+sql create database test vgroups 1;
+sql use test;
+
+sql create table t1(ts timestamp, a int, b int , c int, d double);
+sql create stream streams1 trigger at_once IGNORE EXPIRED 1 IGNORE UPDATE 0 WATERMARK 100s into streamt as select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(3);
+sleep 1000
+
+sql insert into t1 values(1648791213001,9,2,2,1.1);
+sql insert into t1 values(1648791213009,0,3,3,1.0);
+
+$loop_count = 0
+loop0:
+
+sleep 300
+print 0 sql select * from streamt;
+sql select * from streamt;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $data01 != 2 then
+ print ======data01=$data01
+ goto loop0
+endi
+
+sql insert into t1 values(1648791213000,0,1,1,1.0);
+
+$loop_count = 0
+loop1:
+
+sleep 300
+print 1 sql select * from streamt;
+sql select * from streamt;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+
+if $rows != 1 then
+ print ======rows=$rows
+ goto loop1
+endi
+
+if $data01 != 3 then
+ print ======data01=$data01
+ goto loop1
+endi
+
+sql insert into t1 values(1648791223000,0,1,1,1.0);
+sql insert into t1 values(1648791223001,9,2,2,1.1);
+sql insert into t1 values(1648791223009,0,3,3,1.0);
+
+$loop_count = 0
+loop2:
+
+sleep 300
+print 2 sql select * from streamt order by 1;
+sql select * from streamt order by 1;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 2 then
+ print ======rows=$rows
+ goto loop2
+endi
+
+sql insert into t1 values(1648791212000,0,1,1,1.0);
+
+$loop_count = 0
+loop3:
+
+sleep 300
+print 3 sql select * from streamt order by 1;
+sql select * from streamt order by 1;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 3 then
+ print ======rows=$rows
+ goto loop3
+endi
+
+if $data01 != 3 then
+ print ======data01=$data01
+ goto loop3
+endi
+
+if $data11 != 3 then
+ print ======data11=$data11
+ goto loop3
+endi
+
+if $data21 != 1 then
+ print ======data21=$data21
+ goto loop3
+endi
+
+print step2
+print =============== create database
+sql create database test2 vgroups 1;
+sql use test2;
+
+sql create stable st(ts timestamp, a int, b int , c int, d double) tags(ta int,tb int,tc int);
+sql create table t1 using st tags(1,1,1);
+sql create table t2 using st tags(2,2,2);
+sql create stream streams2 trigger at_once IGNORE EXPIRED 1 IGNORE UPDATE 0 WATERMARK 100s into streamt2 as select _wstart as s, count(*) c1, sum(b), max(c) from st partition by tbname count_window(3)
+sleep 1000
+
+
+sql insert into t1 values(1648791213001,9,2,2,1.1);
+sql insert into t1 values(1648791213009,0,3,3,1.0);
+
+sql insert into t2 values(1648791213001,9,2,2,1.1);
+sql insert into t2 values(1648791213009,0,3,3,1.0);
+
+$loop_count = 0
+loop4:
+
+sleep 300
+print 0 sql select * from streamt2 order by 1;;
+sql select * from streamt2 order by 1;;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $data01 != 2 then
+ print ======data01=$data01
+ goto loop4
+endi
+
+if $data11 != 2 then
+ print ======data11=$data11
+ goto loop4
+endi
+
+sql insert into t1 values(1648791213000,0,1,1,1.0);
+sql insert into t2 values(1648791213000,0,1,1,1.0);
+
+$loop_count = 0
+loop5:
+
+sleep 300
+print 1 sql select * from streamt2 order by 1;;
+sql select * from streamt2 order by 1;;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+
+if $rows != 2 then
+ print ======rows=$rows
+ goto loop5
+endi
+
+if $data01 != 3 then
+ print ======data01=$data01
+ goto loop5
+endi
+
+if $data11 != 3 then
+ print ======data11=$data11
+ goto loop5
+endi
+
+sql insert into t1 values(1648791223000,0,1,1,1.0);
+sql insert into t1 values(1648791223001,9,2,2,1.1);
+sql insert into t1 values(1648791223009,0,3,3,1.0);
+
+sql insert into t2 values(1648791223000,0,1,1,1.0);
+sql insert into t2 values(1648791223001,9,2,2,1.1);
+sql insert into t2 values(1648791223009,0,3,3,1.0);
+
+$loop_count = 0
+loop6:
+
+sleep 300
+print 2 sql select * from streamt2 order by 1;
+sql select * from streamt2 order by 1;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 4 then
+ print ======rows=$rows
+ goto loop6
+endi
+
+sql insert into t1 values(1648791212000,0,1,1,1.0);
+sql insert into t2 values(1648791212000,0,1,1,1.0);
+
+$loop_count = 0
+loop7:
+
+sleep 300
+print 3 sql select * from streamt2 order by 1;
+sql select * from streamt2 order by 1;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 6 then
+ print ======rows=$rows
+ goto loop7
+endi
+
+if $data01 != 3 then
+ print ======data01=$data01
+ goto loop7
+endi
+
+if $data11 != 3 then
+ print ======data11=$data11
+ goto loop7
+endi
+
+if $data21 != 3 then
+ print ======data21=$data21
+ goto loop7
+endi
+
+if $data31 != 3 then
+ print ======data31=$data31
+ goto loop7
+endi
+
+if $data41 != 1 then
+ print ======data41=$data41
+ goto loop7
+endi
+
+if $data51 != 1 then
+ print ======data51=$data51
+ goto loop7
+endi
+
+print count2 end
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/stream/count3.sim b/tests/script/tsim/stream/count3.sim
new file mode 100644
index 0000000000..f04996cdaa
--- /dev/null
+++ b/tests/script/tsim/stream/count3.sim
@@ -0,0 +1,116 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/exec.sh -n dnode1 -s start
+sleep 50
+sql connect
+
+print step1
+print =============== create database
+sql create database test vgroups 1;
+sql use test;
+
+sql create table t1(ts timestamp, a int, b int , c int, d double);
+sql create stream streams1 trigger at_once IGNORE EXPIRED 1 IGNORE UPDATE 0 WATERMARK 100s into streamt as select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(3);
+sleep 1000
+
+sql insert into t1 values(1648791213000,0,1,1,1.0);
+sql insert into t1 values(1648791213001,9,2,2,1.1);
+sql insert into t1 values(1648791213009,0,3,3,1.0);
+
+sql insert into t1 values(1648791223000,0,1,1,1.0);
+sql insert into t1 values(1648791223001,9,2,2,1.1);
+sql insert into t1 values(1648791223009,0,3,3,1.0);
+
+$loop_count = 0
+loop2:
+
+sleep 300
+print 2 sql select * from streamt order by 1;
+sql select * from streamt order by 1;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 2 then
+ print ======rows=$rows
+ goto loop2
+endi
+
+sql insert into t1 values(1648791213000,4,4,4,4.0);
+
+$loop_count = 0
+loop3:
+
+sleep 300
+print 3 sql select * from streamt order by 1;
+sql select * from streamt order by 1;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 2 then
+ print ======rows=$rows
+ goto loop3
+endi
+
+if $data01 != 3 then
+ print ======data01=$data01
+ goto loop3
+endi
+
+if $data11 != 3 then
+ print ======data11=$data11
+ goto loop3
+endi
+
+sql delete from t1 where ts = 1648791223001;
+
+$loop_count = 0
+loop4:
+
+sleep 300
+print 3 sql select * from streamt order by 1;
+sql select * from streamt order by 1;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+if $rows != 2 then
+ print ======rows=$rows
+ goto loop4
+endi
+
+if $data01 != 3 then
+ print ======data01=$data01
+ goto loop4
+endi
+
+if $data11 != 2 then
+ print ======data11=$data11
+ goto loop4
+endi
+
+
+print count3 end
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/stream/countSliding0.sim b/tests/script/tsim/stream/countSliding0.sim
new file mode 100644
index 0000000000..82c54649b2
--- /dev/null
+++ b/tests/script/tsim/stream/countSliding0.sim
@@ -0,0 +1,463 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/exec.sh -n dnode1 -s start
+sleep 50
+sql connect
+
+print step1
+print =============== create database
+sql create database test vgroups 1;
+sql use test;
+
+sql create table t1(ts timestamp, a int, b int , c int, d double);
+sql create stream streams1 trigger at_once IGNORE EXPIRED 1 IGNORE UPDATE 0 WATERMARK 100s into streamt as select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(4, 2);
+sleep 1000
+
+sql insert into t1 values(1648791213000,0,1,1,1.0);
+sleep 100
+sql insert into t1 values(1648791213001,9,2,2,1.1);
+sleep 100
+sql insert into t1 values(1648791213002,0,3,3,1.0);
+sleep 100
+sql insert into t1 values(1648791213009,0,3,3,1.0);
+
+$loop_count = 0
+loop0:
+
+sleep 300
+print 1 sql select * from streamt;
+sql select * from streamt;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 2 then
+ print ======rows=$rows
+ goto loop0
+endi
+
+# row 0
+if $data01 != 4 then
+ print ======data01=$data01
+ goto loop0
+endi
+
+# row 1
+if $data11 != 2 then
+ print ======data11=$data11
+ goto loop0
+endi
+
+sql insert into t1 values(1648791223000,0,1,1,1.0);
+sleep 100
+sql insert into t1 values(1648791223001,9,2,2,1.1);
+sleep 100
+sql insert into t1 values(1648791223002,9,2,2,1.1);
+sleep 100
+sql insert into t1 values(1648791223009,0,3,3,1.0);
+
+$loop_count = 0
+loop2:
+
+sleep 300
+print 1 sql select * from streamt;
+sql select * from streamt;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 4 then
+ print ======rows=$rows
+ goto loop2
+endi
+
+# row 0
+if $data01 != 4 then
+ print ======data01=$data01
+ goto loop2
+endi
+
+# row 1
+if $data11 != 4 then
+ print ======data11=$data11
+ goto loop2
+endi
+
+# row 2
+if $data21 != 4 then
+ print ======data21=$data21
+ goto loop2
+endi
+
+# row 3
+if $data31 != 2 then
+ print ======data31=$data31
+ goto loop2
+endi
+
+sql insert into t1 values(1648791233000,0,1,1,1.0) (1648791233001,9,2,2,1.1) (1648791233002,9,2,2,1.1) (1648791233009,0,3,3,1.0);
+
+$loop_count = 0
+loop3:
+
+sleep 300
+print 1 sql select * from streamt;
+sql select * from streamt;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+print $data50 $data51 $data52 $data53
+print $data60 $data61 $data62 $data63
+print $data70 $data71 $data72 $data73
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 6 then
+ print ======rows=$rows
+ goto loop3
+endi
+
+
+sql insert into t1 values(1648791243000,0,1,1,1.0) (1648791243001,9,2,2,1.1);
+
+$loop_count = 0
+loop4:
+
+sleep 300
+print 1 sql select * from streamt;
+sql select * from streamt;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+print $data50 $data51 $data52 $data53
+print $data60 $data61 $data62 $data63
+print $data70 $data71 $data72 $data73
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 7 then
+ print ======rows=$rows
+ goto loop4
+endi
+
+sql insert into t1 values(1648791253000,0,1,1,1.0) (1648791253001,9,2,2,1.1) (1648791253002,9,2,2,1.1);
+
+$loop_count = 0
+loop5:
+
+sleep 300
+print 1 sql select * from streamt;
+sql select * from streamt;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+print $data50 $data51 $data52 $data53
+print $data60 $data61 $data62 $data63
+print $data70 $data71 $data72 $data73
+print $data80 $data81 $data82 $data83
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 9 then
+ print ======rows=$rows
+ goto loop5
+endi
+
+sql insert into t1 values(1648791263000,0,1,1,1.0);
+
+$loop_count = 0
+loop6:
+
+sleep 300
+print 1 sql select * from streamt;
+sql select * from streamt;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+print $data50 $data51 $data52 $data53
+print $data60 $data61 $data62 $data63
+print $data70 $data71 $data72 $data73
+print $data80 $data81 $data82 $data83
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 9 then
+ print ======rows=$rows
+ goto loop6
+endi
+
+
+
+print step2
+print =============== create database
+sql create database test2 vgroups 4;
+sql use test2;
+
+sql create stable st(ts timestamp, a int, b int , c int, d double) tags(ta int,tb int,tc int);
+sql create table t1 using st tags(1,1,1);
+sql create table t2 using st tags(2,2,2);
+sql create stream streams2 trigger at_once IGNORE EXPIRED 1 IGNORE UPDATE 0 WATERMARK 100s into streamt2 as select _wstart as s, count(*) c1, sum(b), max(c) from st partition by tbname count_window(4, 2);
+sleep 1000
+
+sql insert into t1 values(1648791213000,0,1,1,1.0);
+sleep 100
+sql insert into t1 values(1648791213001,9,2,2,1.1);
+sleep 100
+sql insert into t1 values(1648791213002,0,3,3,1.0);
+sleep 100
+sql insert into t1 values(1648791213009,0,3,3,1.0);
+
+$loop_count = 0
+loop7:
+
+sleep 300
+print 1 sql select * from streamt2;
+sql select * from streamt2;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 2 then
+ print ======rows=$rows
+ goto loop7
+endi
+
+# row 0
+if $data01 != 4 then
+ print ======data01=$data01
+ goto loop7
+endi
+
+# row 1
+if $data11 != 2 then
+ print ======data11=$data11
+ goto loop7
+endi
+
+sql insert into t1 values(1648791223000,0,1,1,1.0);
+sleep 100
+sql insert into t1 values(1648791223001,9,2,2,1.1);
+sleep 100
+sql insert into t1 values(1648791223002,9,2,2,1.1);
+sleep 100
+sql insert into t1 values(1648791223009,0,3,3,1.0);
+
+$loop_count = 0
+loop8:
+
+sleep 300
+print 1 sql select * from streamt2;
+sql select * from streamt2;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 4 then
+ print ======rows=$rows
+ goto loop8
+endi
+
+# row 0
+if $data01 != 4 then
+ print ======data01=$data01
+ goto loop8
+endi
+
+# row 1
+if $data11 != 4 then
+ print ======data11=$data11
+ goto loop8
+endi
+
+# row 2
+if $data21 != 4 then
+ print ======data21=$data21
+ goto loop8
+endi
+
+# row 3
+if $data31 != 2 then
+ print ======data31=$data31
+ goto loop8
+endi
+
+sql insert into t1 values(1648791233000,0,1,1,1.0) (1648791233001,9,2,2,1.1) (1648791233002,9,2,2,1.1) (1648791233009,0,3,3,1.0);
+
+$loop_count = 0
+loop9:
+
+sleep 300
+print 1 sql select * from streamt2;
+sql select * from streamt2;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+print $data50 $data51 $data52 $data53
+print $data60 $data61 $data62 $data63
+print $data70 $data71 $data72 $data73
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 6 then
+ print ======rows=$rows
+ goto loop9
+endi
+
+
+sql insert into t1 values(1648791243000,0,1,1,1.0) (1648791243001,9,2,2,1.1);
+
+$loop_count = 0
+loop10:
+
+sleep 300
+print 1 sql select * from streamt2;
+sql select * from streamt2;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+print $data50 $data51 $data52 $data53
+print $data60 $data61 $data62 $data63
+print $data70 $data71 $data72 $data73
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 7 then
+ print ======rows=$rows
+ goto loop10
+endi
+
+sql insert into t1 values(1648791253000,0,1,1,1.0) (1648791253001,9,2,2,1.1) (1648791253002,9,2,2,1.1);
+
+$loop_count = 0
+loop11:
+
+sleep 300
+print 1 sql select * from streamt2;
+sql select * from streamt2;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+print $data50 $data51 $data52 $data53
+print $data60 $data61 $data62 $data63
+print $data70 $data71 $data72 $data73
+print $data80 $data81 $data82 $data83
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 9 then
+ print ======rows=$rows
+ goto loop11
+endi
+
+sql insert into t1 values(1648791263000,0,1,1,1.0);
+
+$loop_count = 0
+loop12:
+
+sleep 300
+print 1 sql select * from streamt2;
+sql select * from streamt2;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+print $data40 $data41 $data42 $data43
+print $data50 $data51 $data52 $data53
+print $data60 $data61 $data62 $data63
+print $data70 $data71 $data72 $data73
+print $data80 $data81 $data82 $data83
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 9 then
+ print ======rows=$rows
+ goto loop12
+endi
+print count sliding 0 end
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/stream/countSliding1.sim b/tests/script/tsim/stream/countSliding1.sim
new file mode 100644
index 0000000000..6759ab7abd
--- /dev/null
+++ b/tests/script/tsim/stream/countSliding1.sim
@@ -0,0 +1,181 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/exec.sh -n dnode1 -s start
+sleep 50
+sql connect
+
+print step1
+print =============== create database
+sql create database test vgroups 1;
+sql use test;
+
+sql create table t1(ts timestamp, a int, b int , c int, d double);
+sql create stream streams1 trigger at_once IGNORE EXPIRED 1 IGNORE UPDATE 0 WATERMARK 100s into streamt as select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(4, 2);
+sleep 1000
+
+sql insert into t1 values(1648791213000,0,1,1,1.0);
+sleep 100
+sql insert into t1 values(1648791213001,9,2,2,1.1);
+sleep 100
+sql insert into t1 values(1648791213002,0,3,3,1.0);
+sleep 100
+sql insert into t1 values(1648791213009,0,3,3,1.0);
+sleep 100
+sql insert into t1 values(1648791223000,0,1,1,1.0);
+sleep 100
+sql insert into t1 values(1648791223001,9,2,2,1.1);
+sleep 100
+sql insert into t1 values(1648791223002,9,2,2,1.1);
+sleep 100
+sql insert into t1 values(1648791223009,0,3,3,1.0);
+
+$loop_count = 0
+loop0:
+
+sleep 300
+print 1 sql select * from streamt;
+sql select * from streamt;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 4 then
+ print ======rows=$rows
+ goto loop0
+endi
+
+# row 0
+if $data01 != 4 then
+ print ======data01=$data01
+ goto loop0
+endi
+
+# row 1
+if $data11 != 4 then
+ print ======data11=$data11
+ goto loop0
+endi
+
+# row 2
+if $data21 != 4 then
+ print ======data21=$data21
+ goto loop0
+endi
+
+# row 3
+if $data31 != 2 then
+ print ======data31=$data31
+ goto loop0
+endi
+
+sql insert into t1 values(1648791213000,0,1,1,1.0);
+
+
+$loop_count = 0
+loop1:
+
+sleep 300
+print 1 sql select * from streamt;
+sql select * from streamt;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 4 then
+ print ======rows=$rows
+ goto loop1
+endi
+
+# row 0
+if $data01 != 4 then
+ print ======data01=$data01
+ goto loop1
+endi
+
+# row 1
+if $data11 != 4 then
+ print ======data11=$data11
+ goto loop1
+endi
+
+# row 2
+if $data21 != 4 then
+ print ======data21=$data21
+ goto loop1
+endi
+
+# row 3
+if $data31 != 2 then
+ print ======data31=$data31
+ goto loop1
+endi
+
+sleep 500
+sql insert into t1 values(1648791223002,9,2,2,1.1);
+
+
+$loop_count = 0
+loop2:
+
+sleep 300
+print 1 sql select * from streamt;
+sql select * from streamt;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 4 then
+ print ======rows=$rows
+ goto loop2
+endi
+
+# row 0
+if $data01 != 4 then
+ print ======data01=$data01
+ goto loop2
+endi
+
+# row 1
+if $data11 != 4 then
+ print ======data11=$data11
+ goto loop2
+endi
+
+# row 2
+if $data21 != 4 then
+ print ======data21=$data21
+ goto loop2
+endi
+
+# row 3
+if $data31 != 2 then
+ print ======data31=$data31
+ goto loop2
+endi
+
+print count sliding 1 end
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/tsim/stream/countSliding2.sim b/tests/script/tsim/stream/countSliding2.sim
new file mode 100644
index 0000000000..8841283c81
--- /dev/null
+++ b/tests/script/tsim/stream/countSliding2.sim
@@ -0,0 +1,175 @@
+system sh/stop_dnodes.sh
+system sh/deploy.sh -n dnode1 -i 1
+system sh/exec.sh -n dnode1 -s start
+sleep 50
+sql connect
+
+print step1
+print =============== create database
+sql create database test vgroups 1;
+sql use test;
+
+sql create table t1(ts timestamp, a int, b int , c int, d double);
+sql create stream streams1 trigger at_once IGNORE EXPIRED 1 IGNORE UPDATE 0 WATERMARK 100s into streamt as select _wstart as s, count(*) c1, sum(b), max(c) from t1 count_window(4, 2);
+sleep 1000
+
+sql insert into t1 values(1648791213000,0,1,1,1.0);
+sleep 100
+sql insert into t1 values(1648791213001,9,2,2,1.1);
+sleep 100
+sql insert into t1 values(1648791213002,0,3,3,1.0);
+sleep 100
+sql insert into t1 values(1648791213009,0,3,3,1.0);
+sleep 100
+sql insert into t1 values(1648791223000,0,1,1,1.0);
+sleep 100
+sql insert into t1 values(1648791223001,9,2,2,1.1);
+sleep 100
+sql insert into t1 values(1648791223002,9,2,2,1.1);
+sleep 100
+sql insert into t1 values(1648791223009,0,3,3,1.0);
+
+$loop_count = 0
+loop0:
+
+sleep 300
+print 1 sql select * from streamt;
+sql select * from streamt;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 4 then
+ print ======rows=$rows
+ goto loop0
+endi
+
+# row 0
+if $data01 != 4 then
+ print ======data01=$data01
+ goto loop0
+endi
+
+# row 1
+if $data11 != 4 then
+ print ======data11=$data11
+ goto loop0
+endi
+
+# row 2
+if $data21 != 4 then
+ print ======data21=$data21
+ goto loop0
+endi
+
+# row 3
+if $data31 != 2 then
+ print ======data31=$data31
+ goto loop0
+endi
+
+sql delete from t1 where ts = 1648791213000;
+
+
+$loop_count = 0
+loop1:
+
+sleep 300
+print 1 sql select * from streamt;
+sql select * from streamt;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 4 then
+ print ======rows=$rows
+ goto loop1
+endi
+
+# row 0
+if $data01 != 4 then
+ print ======data01=$data01
+ goto loop1
+endi
+
+# row 1
+if $data11 != 4 then
+ print ======data11=$data11
+ goto loop1
+endi
+
+# row 2
+if $data21 != 3 then
+ print ======data21=$data21
+ goto loop1
+endi
+
+# row 3
+if $data31 != 1 then
+ print ======data31=$data31
+ goto loop1
+endi
+
+sleep 500
+sql delete from t1 where ts = 1648791223002;
+
+
+$loop_count = 0
+loop2:
+
+sleep 300
+print 1 sql select * from streamt;
+sql select * from streamt;
+
+print $data00 $data01 $data02 $data03
+print $data10 $data11 $data12 $data13
+print $data20 $data21 $data22 $data23
+print $data30 $data31 $data32 $data33
+
+$loop_count = $loop_count + 1
+if $loop_count == 10 then
+ return -1
+endi
+
+# row 0
+if $rows != 3 then
+ print ======rows=$rows
+ goto loop2
+endi
+
+# row 0
+if $data01 != 4 then
+ print ======data01=$data01
+ goto loop2
+endi
+
+# row 1
+if $data11 != 4 then
+ print ======data11=$data11
+ goto loop2
+endi
+
+# row 2
+if $data21 != 2 then
+ print ======data21=$data21
+ goto loop2
+endi
+
+print count sliding 1 end
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/system-test/2-query/agg_group_AlwaysReturnValue.py b/tests/system-test/2-query/agg_group_AlwaysReturnValue.py
new file mode 100755
index 0000000000..9ed0e3fc4a
--- /dev/null
+++ b/tests/system-test/2-query/agg_group_AlwaysReturnValue.py
@@ -0,0 +1,1605 @@
+###################################################################
+# 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.cases import tdCases
+#from .nestedQueryInterval import *
+from .nestedQuery import *
+from faker import Faker
+import random
+
+class TDTestCase(TDTestCase):
+
+ def data_check_tbname(self,sql,groupby='Y',partitionby='Y',base_fun='',replace_fun='',base_column='',replace_column=''):
+
+ if groupby=='Y':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(12)
+ tdSql.checkData(0, 1, 100)
+ tdSql.checkData(1, 1, 200)
+ tdSql.checkData(2, 1, 00)
+ tdSql.checkData(3, 1, 0)
+ tdSql.checkData(4, 1, 00)
+ tdSql.checkData(5, 1, 0)
+ tdSql.checkData(6, 1, 0)
+ tdSql.checkData(7, 1, 00)
+ tdSql.checkData(8, 1, 00)
+ tdSql.checkData(9, 1, 0)
+ tdSql.checkData(10, 1, 00)
+ tdSql.checkData(11, 1, 0)
+ elif groupby=='UNIONALL':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(24)
+ tdSql.checkData(0, 1, 100)
+ tdSql.checkData(1, 1, 100)
+ tdSql.checkData(2, 1, 200)
+ tdSql.checkData(3, 1, 200)
+ tdSql.checkData(4, 1, 00)
+ tdSql.checkData(5, 1, 0)
+ tdSql.checkData(6, 1, 0)
+ tdSql.checkData(7, 1, 00)
+ tdSql.checkData(8, 1, 00)
+ tdSql.checkData(9, 1, 0)
+ tdSql.checkData(10, 1, 00)
+ tdSql.checkData(11, 1, 0)
+ elif groupby=='UNIONALLNULL':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(24)
+ tdSql.checkData(0, 1, 0)
+ tdSql.checkData(1, 1, 00)
+ tdSql.checkData(2, 1, 00)
+ tdSql.checkData(3, 1, 0)
+ tdSql.checkData(4, 1, 00)
+ tdSql.checkData(5, 1, 0)
+ tdSql.checkData(6, 1, 0)
+ tdSql.checkData(7, 1, 00)
+ tdSql.checkData(8, 1, 00)
+ tdSql.checkData(9, 1, 0)
+ tdSql.checkData(10, 1, 00)
+ tdSql.checkData(11, 1, 0)
+ elif groupby=='NULL':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(12)
+ tdSql.checkData(0, 1, 0)
+ tdSql.checkData(1, 1, 0)
+ tdSql.checkData(2, 1, 00)
+ tdSql.checkData(3, 1, 0)
+ tdSql.checkData(4, 1, 00)
+ tdSql.checkData(5, 1, 0)
+ tdSql.checkData(6, 1, 0)
+ tdSql.checkData(7, 1, 00)
+ tdSql.checkData(8, 1, 00)
+ tdSql.checkData(9, 1, 0)
+ tdSql.checkData(10, 1, 00)
+ tdSql.checkData(11, 1, 0)
+ elif groupby=='HAVING=0':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(10)
+ tdSql.checkData(0, 1, 0)
+ tdSql.checkData(1, 1, 0)
+ tdSql.checkData(2, 1, 00)
+ tdSql.checkData(3, 1, 0)
+ tdSql.checkData(4, 1, 00)
+ tdSql.checkData(5, 1, 0)
+ tdSql.checkData(6, 1, 0)
+ tdSql.checkData(7, 1, 00)
+ tdSql.checkData(8, 1, 00)
+ tdSql.checkData(9, 1, 0)
+ elif groupby=='HAVING>0':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 1, 100)
+ tdSql.checkData(1, 1, 200)
+ elif groupby=='HAVING>04':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(4)
+ tdSql.checkData(0, 1, 100)
+ tdSql.checkData(1, 1, 100)
+ tdSql.checkData(2, 1, 200)
+ tdSql.checkData(3, 1, 200)
+ elif groupby=='HAVINGCOLUMN=0':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 1, 0)
+ tdSql.checkData(1, 1, 0)
+ elif groupby=='NOTSUPPORT':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 1, 0)
+ tdSql.checkData(1, 1, 0)
+ elif groupby=='AGG0':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(0)
+ elif groupby=='AGG2':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(2)
+ elif groupby=='AGG2_NULL':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 1, 'None')
+ tdSql.checkData(1, 1, 'None')
+ elif groupby=='AGG4':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(4)
+ elif groupby=='AGG4_NULL':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(4)
+ tdSql.checkData(0, 1, 'None')
+ tdSql.checkData(1, 1, 'None')
+ elif groupby=='AGG10':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(10)
+ elif groupby=='AGG12':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(12)
+ elif groupby=='AGG20':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(20)
+ elif groupby=='AGG24':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(24)
+ else:
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(12)
+
+
+ if partitionby=='Y':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(12)
+ tdSql.checkData(0, 1, 100)
+ tdSql.checkData(1, 1, 200)
+ tdSql.checkData(2, 1, 00)
+ tdSql.checkData(3, 1, 0)
+ tdSql.checkData(4, 1, 00)
+ tdSql.checkData(5, 1, 0)
+ tdSql.checkData(6, 1, 0)
+ tdSql.checkData(7, 1, 00)
+ tdSql.checkData(8, 1, 00)
+ tdSql.checkData(9, 1, 0)
+ tdSql.checkData(10, 1, 00)
+ tdSql.checkData(11, 1, 0)
+ elif groupby=='UNIONALL':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(24)
+ tdSql.checkData(0, 1, 100)
+ tdSql.checkData(1, 1, 100)
+ tdSql.checkData(2, 1, 200)
+ tdSql.checkData(3, 1, 200)
+ tdSql.checkData(4, 1, 00)
+ tdSql.checkData(5, 1, 0)
+ tdSql.checkData(6, 1, 0)
+ tdSql.checkData(7, 1, 00)
+ tdSql.checkData(8, 1, 00)
+ tdSql.checkData(9, 1, 0)
+ tdSql.checkData(10, 1, 00)
+ tdSql.checkData(11, 1, 0)
+ elif groupby=='UNIONALLNULL':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(24)
+ tdSql.checkData(0, 1, 00)
+ tdSql.checkData(1, 1, 00)
+ tdSql.checkData(2, 1, 00)
+ tdSql.checkData(3, 1, 0)
+ tdSql.checkData(4, 1, 00)
+ tdSql.checkData(5, 1, 0)
+ tdSql.checkData(6, 1, 0)
+ tdSql.checkData(7, 1, 00)
+ tdSql.checkData(8, 1, 00)
+ tdSql.checkData(9, 1, 0)
+ tdSql.checkData(10, 1, 00)
+ tdSql.checkData(11, 1, 0)
+ elif partitionby=='NULL':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(12)
+ tdSql.checkData(0, 1, 0)
+ tdSql.checkData(1, 1, 0)
+ tdSql.checkData(2, 1, 00)
+ tdSql.checkData(3, 1, 0)
+ tdSql.checkData(4, 1, 00)
+ tdSql.checkData(5, 1, 0)
+ tdSql.checkData(6, 1, 0)
+ tdSql.checkData(7, 1, 00)
+ tdSql.checkData(8, 1, 00)
+ tdSql.checkData(9, 1, 0)
+ tdSql.checkData(10, 1, 00)
+ tdSql.checkData(11, 1, 0)
+ elif partitionby=='HAVING=0':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(10)
+ tdSql.checkData(0, 1, 0)
+ tdSql.checkData(1, 1, 0)
+ tdSql.checkData(2, 1, 00)
+ tdSql.checkData(3, 1, 0)
+ tdSql.checkData(4, 1, 00)
+ tdSql.checkData(5, 1, 0)
+ tdSql.checkData(6, 1, 0)
+ tdSql.checkData(7, 1, 00)
+ tdSql.checkData(8, 1, 00)
+ tdSql.checkData(9, 1, 0)
+ elif partitionby=='HAVING>0':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 1, 100)
+ tdSql.checkData(1, 1, 200)
+ elif partitionby=='HAVING>04':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(4)
+ tdSql.checkData(0, 1, 100)
+ tdSql.checkData(1, 1, 100)
+ tdSql.checkData(2, 1, 200)
+ tdSql.checkData(3, 1, 200)
+ elif partitionby=='HAVINGCOLUMN=0':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 1, 0)
+ tdSql.checkData(1, 1, 0)
+ elif partitionby=='NOTSUPPORT':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 1, 0)
+ tdSql.checkData(1, 1, 0)
+ elif partitionby=='AGG0':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(0)
+ elif partitionby=='AGG2':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(2)
+ elif partitionby=='AGG2_NULL':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 1, 'None')
+ tdSql.checkData(1, 1, 'None')
+ elif partitionby=='AGG4':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(4)
+ elif partitionby=='AGG4_NULL':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(4)
+ tdSql.checkData(0, 1, 'None')
+ tdSql.checkData(1, 1, 'None')
+ elif partitionby=='AGG10':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(10)
+ elif partitionby=='AGG12':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(12)
+ elif partitionby=='AGG20':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(20)
+ elif partitionby=='AGG24':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(24)
+ else:
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(12)
+
+
+ def tbname_count(self, dbname="nested",base_fun="AGG",replace_fun="COUNT",base_column="COLUMN",replace_column="q_int",execute="Y"):
+
+ # stable count(*)
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname "
+ self.data_check_tbname(sql,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #where null \ not null
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is not null group by tbname order by tbname "
+ self.data_check_tbname(sql,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by tbname order by tbname "
+ self.data_check_tbname(sql,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname "
+ sql = f"({sql}) union ({sql}) order by tb"
+ self.data_check_tbname(sql,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union all
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname "
+ sql = f"({sql}) union all ({sql}) order by tb"
+ self.data_check_tbname(sql,'UNIONALL','UNIONALL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'UNIONALL','UNIONALL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'UNIONALL','UNIONALL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ #having <=0
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) = 0 order by tbname "
+ self.data_check_tbname(sql,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) <= 0 order by tbname "
+ self.data_check_tbname(sql,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by tbname having count(*) <= 0 order by tbname "
+ self.data_check_tbname(sql,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #count + having <=0
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having AGG(COLUMN) = 0 order by tbname "
+ self.data_check_tbname(sql,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having AGG(COLUMN) <= 0 order by tbname "
+ self.data_check_tbname(sql,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by tbname having AGG(COLUMN) = 0 order by tbname "
+ self.data_check_tbname(sql,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #having >0
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) != 0 order by tbname "
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) > 0 order by tbname "
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by tbname having count(*) > 0 order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #count + having >0
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having AGG(COLUMN) != 0 order by tbname "
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having AGG(COLUMN) > 0 order by tbname "
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by tbname having AGG(COLUMN) != 0 order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #order by count(*)
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname,count(*) "
+ self.data_check_tbname(sql,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by tbname order by tbname,count(*) "
+ self.data_check_tbname(sql,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ def tbname_count_null(self, dbname="nested",base_fun="AGG",replace_fun="COUNT",base_column="COLUMN",replace_column="q_int",execute="Y"):
+
+ # stable count(*)
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname "
+ self.data_check_tbname(sql,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #where null \ not null
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is not null group by tbname order by tbname "
+ self.data_check_tbname(sql,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by tbname order by tbname "
+ self.data_check_tbname(sql,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname "
+ sql = f"({sql}) union ({sql}) order by tb"
+ self.data_check_tbname(sql,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union all
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname "
+ sql = f"({sql}) union all ({sql}) order by tb"
+ self.data_check_tbname(sql,'UNIONALLNULL','UNIONALLNULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'UNIONALLNULL','UNIONALLNULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'UNIONALLNULL','UNIONALLNULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #having <=0
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) = 0 order by tbname "
+ self.data_check_tbname(sql,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) <= 0 order by tbname "
+ self.data_check_tbname(sql,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by tbname having count(*) <= 0 order by tbname "
+ self.data_check_tbname(sql,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #having >0
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) != 0 order by tbname "
+ self.data_check_tbname(sql,'HAVINGCOLUMN=0','HAVINGCOLUMN=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVINGCOLUMN=0','HAVINGCOLUMN=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'HAVINGCOLUMN=0','HAVINGCOLUMN=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) > 0 order by tbname "
+ self.data_check_tbname(sql,'HAVINGCOLUMN=0','HAVINGCOLUMN=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVINGCOLUMN=0','HAVINGCOLUMN=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'HAVINGCOLUMN=0','HAVINGCOLUMN=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by tbname having count(*) != 0 order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #order by count(*)
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname,count(*) "
+ self.data_check_tbname(sql,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by tbname order by tbname,count(*) "
+ self.data_check_tbname(sql,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ def tbname_count_all(self):
+ #random data
+ fake = Faker('zh_CN')
+ random_data_big = fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=10)
+ random_data_str = fake.pystr()
+ random_data_float = fake.pyfloat()
+
+ #random cal
+ calculations = ['+','-','*','/']
+ calculation = random.sample(calculations,1)
+ calculation = str(calculation).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ #random data column
+ data_columns = ['q_int','q_bigint','q_smallint','q_tinyint','q_float','q_double']
+ data_null_columns = ['q_int_null','q_bigint_null','q_smallint_null','q_tinyint_null','q_float_null','q_double_null']
+
+ data_column = random.sample(data_columns,1)
+ data_column = str(data_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ data_null_column = random.sample(data_null_columns,1)
+ data_null_column = str(data_null_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ data_all_columns = data_columns + data_null_columns
+ data_all_column = random.sample(data_all_columns,1)
+ data_all_column = str(data_all_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ #random data tag
+ data_tags = ['t_int','t_bigint','t_smallint','t_tinyint','t_float','t_double']
+ data_null_tags = ['t_int_null','t_bigint_null','t_smallint_null','t_tinyint_null','t_float_null','t_double_null']
+
+ data_tag = random.sample(data_tags,1)
+ data_tag = str(data_tag).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ data_null_tag = random.sample(data_null_tags,1)
+ data_null_tag = str(data_null_tag).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ data_all_tags = data_tags + data_null_tags
+ data_all_tag = random.sample(data_all_tags,1)
+ data_all_tag = str(data_all_tag).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ #random ts column
+ ts_columns = ['ts','_c0','_C0','_rowts']
+ ts_column = random.sample(ts_columns,1)
+ ts_column = str(ts_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+ #random other column
+ other_columns = ['q_bool','q_binary','q_nchar','q_ts','loc','t_bool','t_binary','t_nchar','t_ts']
+ other_column = random.sample(other_columns,1)
+ other_column = str(other_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ #random other null column and tag
+ other_null_columns = ['q_bool_null','q_binary_null','q_nchar_null','q_ts_null','t_bool_null','t_binary_null','t_nchar_null','t_ts_null']
+ other_null_column = random.sample(other_null_columns,1)
+ other_null_column = str(other_null_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ #random all column
+ all_columns = data_all_columns + data_all_tags + ts_columns + other_columns + other_null_columns
+ all_column = random.sample(all_columns,1)
+ all_column = str(all_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+
+ self.tbname_count_null(replace_fun='count',replace_column=f'{data_null_column}')
+ self.tbname_count_null(replace_fun='count',replace_column=f'{data_null_tag}')
+ self.tbname_count_null(replace_fun='count',replace_column=f'{other_null_column}')
+
+ self.tbname_count(replace_fun='count',replace_column='*')
+ self.tbname_count(replace_fun='count',replace_column=f'{data_column}')
+ self.tbname_count(replace_fun='count',replace_column=f'{ts_column}')
+
+ self.tbname_count(replace_fun='count',replace_column=f'{other_column}')
+ self.tbname_count(replace_fun='count',replace_column=f'{data_tag}')
+
+ self.tbname_count(replace_fun='count',replace_column=f'{random_data_big}')
+ self.tbname_count(replace_fun='count',replace_column=f'{random_data_float}')
+ self.tbname_count(replace_fun='count',replace_column=f'\'{random_data_str}\'')
+ self.tbname_count(replace_fun='count',replace_column=f'{random_data_big} {calculation} (abs({data_column})+1)')
+ self.tbname_count(replace_fun='count',replace_column=f'{random_data_float} {calculation} (abs({data_column})+1)')
+
+ def tbname_agg(self, dbname="nested",base_fun="AGG",replace_fun="",base_column="COLUMN",replace_column="q_int",execute="Y"):
+
+ # stable count(*)
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname "
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #where null \ not null
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is not null group by tbname order by tbname "
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by tbname order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ #union
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname "
+ sql = f"({sql}) union ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union all
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname "
+ sql = f"({sql}) union all ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ if execute=="Y":
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) = 0 order by tbname "
+ self.data_check_tbname(sql,'AGG10','AGG10',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG10','AGG10',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG10','AGG10',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) <= 0 order by tbname "
+ self.data_check_tbname(sql,'AGG10','AGG10',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG10','AGG10',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG10','AGG10',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) != 0 order by tbname "
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) > 0 order by tbname "
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname,count(*) "
+ self.data_check_tbname(sql,'AGG12','AGG12',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG12','AGG12',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG12','AGG12',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ # Mixed scene
+ if execute=="Y":
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) = 0 order by tbname "
+ self.data_check_tbname(sql,'AGG10','AGG10',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG10','AGG10',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG10','AGG10',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) <= 0 order by tbname "
+ self.data_check_tbname(sql,'AGG10','AGG10',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG10','AGG10',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG10','AGG10',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) = 0 order by tbname "
+ sql = f"({sql}) union ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG10','AGG10',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG10','AGG10',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG10','AGG10',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union all
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) <= 0 order by tbname "
+ sql = f"({sql}) union all ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG20','AGG20',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG20','AGG20',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG20','AGG20',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) != 0 order by tbname "
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) > 0 order by tbname "
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) != 0 order by tbname "
+ sql = f"({sql}) union ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union all
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) > 0 order by tbname "
+ sql = f"({sql}) union all ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname,AGG(COLUMN) "
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname,AGG(COLUMN) "
+ sql = f"({sql}) union ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union all
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname,AGG(COLUMN) "
+ sql = f"({sql}) union all ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+
+ sql = f"select tbname,AGG(COLUMN),count(*) from {dbname}.stable_1 group by tbname order by tbname,AGG(COLUMN) "
+ self.data_check_tbname(sql,'AGG12','AGG12',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG12','AGG12',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG12','AGG12',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union
+ sql = f"select tbname tb,AGG(COLUMN),count(*) from {dbname}.stable_1 group by tbname order by tbname,AGG(COLUMN)"
+ sql = f"({sql}) union ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG12','AGG12',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG12','AGG12',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG12','AGG12',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union all
+ sql = f"select tbname tb ,AGG(COLUMN),count(*) from {dbname}.stable_1 group by tbname order by tbname,AGG(COLUMN)"
+ sql = f"({sql}) union all ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG24','AGG24',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG24','AGG24',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG24','AGG24',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname,AGG(COLUMN),count(*) "
+ self.data_check_tbname(sql,'AGG12','AGG12',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG12','AGG12',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG12','AGG12',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname,AGG(COLUMN),count(*)"
+ sql = f"({sql}) union ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG12','AGG12',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG12','AGG12',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG12','AGG12',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union all
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname,AGG(COLUMN),count(*)"
+ sql = f"({sql}) union all ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG24','AGG24',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG24','AGG24',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG24','AGG24',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+
+ def tbname_agg_all(self):
+ #random data
+ fake = Faker('zh_CN')
+ random_data_big = fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=10)
+ random_data_str = fake.pystr()
+ random_data_float = fake.pyfloat()
+ random_data_start = fake.random_int(min=0, max=100, step=1)
+ random_data_end = fake.random_int(min=0, max=100, step=1)
+
+ #random cal
+ calculations = ['+','-','*','/']
+ calculation = random.sample(calculations,1)
+ calculation = str(calculation).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ #random data column
+ data_columns = ['q_int','q_bigint','q_smallint','q_tinyint','q_float','q_double','t_int','t_bigint','t_smallint','t_tinyint','t_float','t_double']
+ data_null_columns = ['q_int_null','q_bigint_null','q_smallint_null','q_tinyint_null','q_float_null','q_double_null','t_int','t_bigint','t_smallint','t_tinyint','t_float','t_double']
+ data_columns = data_columns + data_null_columns
+ data_column = random.sample(data_null_columns,1)
+ data_column = str(data_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+ #random ts column
+ ts_columns = ['ts','_c0','_C0','_rowts']
+ ts_column = random.sample(ts_columns,1)
+ ts_column = str(ts_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+ #random ts unit column
+ ts_units = ['1a','1s','1m','1h','1d','1w']
+ ts_unit = random.sample(ts_units,1)
+ ts_unit = str(ts_unit).replace("[","").replace("]","").replace("'","").replace(", ","")
+ #random str column
+ str_columns = ['q_int','q_bigint','q_smallint','q_tinyint','q_float','q_double','t_int','t_bigint','t_smallint','t_tinyint','t_float','t_double']
+ str_column = random.sample(str_columns,1)
+ str_column = str(str_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+ #random other column
+ other_columns = ['q_bool','q_binary','q_nchar','q_ts','loc','t_bool','t_binary','t_nchar','t_ts']
+ other_column = random.sample(other_columns,1)
+ other_column = str(other_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+ #random all column
+ all_columns = data_columns + ts_columns + str_columns + other_columns
+ all_column = random.sample(all_columns,1)
+ all_column = str(all_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ self.tbname_agg(replace_fun='sum',replace_column=f'{data_column}')
+ self.tbname_agg(replace_fun='sum',replace_column=f'{random_data_big}')
+ self.tbname_agg(replace_fun='sum',replace_column=f'{random_data_float}')
+ self.tbname_agg(replace_fun='sum',replace_column=f'{random_data_big} {calculation} {data_column}')
+ self.tbname_agg(replace_fun='sum',replace_column=f'{random_data_float} {calculation} {data_column}')
+
+ self.tbname_agg(replace_fun='avg',replace_column=f'{data_column}')
+ self.tbname_agg(replace_fun='avg',replace_column=f'{random_data_big}')
+ self.tbname_agg(replace_fun='avg',replace_column=f'{random_data_float}')
+ self.tbname_agg(replace_fun='avg',replace_column=f'{random_data_big} {calculation} {data_column}')
+ self.tbname_agg(replace_fun='avg',replace_column=f'{random_data_float} {calculation} {data_column}')
+
+ self.tbname_agg(replace_fun='spread',replace_column=f'{data_column}')
+ self.tbname_agg(replace_fun='spread',replace_column=f'{random_data_big}')
+ self.tbname_agg(replace_fun='spread',replace_column=f'{random_data_float}')
+ self.tbname_agg(replace_fun='spread',replace_column=f'{random_data_big} {calculation} {data_column}')
+ self.tbname_agg(replace_fun='spread',replace_column=f'{random_data_float} {calculation} {data_column}')
+
+ self.tbname_agg(replace_fun='stddev',replace_column=f'{data_column}')
+ self.tbname_agg(replace_fun='stddev',replace_column=f'{random_data_big}')
+ self.tbname_agg(replace_fun='stddev',replace_column=f'{random_data_float}')
+ self.tbname_agg(replace_fun='stddev',replace_column=f'{random_data_big} {calculation} {data_column}')
+ self.tbname_agg(replace_fun='stddev',replace_column=f'{random_data_float} {calculation} {data_column}')
+
+ self.tbname_agg(replace_fun='elapsed',replace_column=f'{ts_column}')
+ self.tbname_agg(replace_fun='elapsed',replace_column=f'{ts_column},{ts_unit}')
+
+ self.tbname_agg(replace_fun='hyperloglog',replace_column=f'{all_column}')
+ self.tbname_agg(replace_fun='hyperloglog',replace_column=f'{random_data_big}')
+ self.tbname_agg(replace_fun='hyperloglog',replace_column=f'{random_data_float}')
+ self.tbname_agg(replace_fun='hyperloglog',replace_column=f'\'{random_data_str}\'')
+ self.tbname_agg(replace_fun='hyperloglog',replace_column=f'{random_data_big} {calculation} {data_column}')
+ self.tbname_agg(replace_fun='hyperloglog',replace_column=f'{random_data_float} {calculation} {data_column}')
+
+ self.tbname_agg(replace_fun='apercentile',replace_column=f'{data_column},{random_data_start}')
+ self.tbname_agg(replace_fun='apercentile',replace_column=f'{data_column},{random_data_start},"default"')
+ self.tbname_agg(replace_fun='apercentile',replace_column=f'{data_column},{random_data_start},"t-digest"')
+ # not support
+ # self.tbname_agg(replace_fun='percentile',replace_column=f'{data_column},{random_data_start}')
+ # self.tbname_agg(replace_fun='percentile',replace_column=f'{data_column},{random_data_end}')
+ # self.tbname_agg(replace_fun='percentile',replace_column=f'{data_column},{random_data_big}')
+
+ self.tbname_agg(replace_fun='leastsquares',replace_column=f'{data_column},{random_data_start},{random_data_end}')
+ self.tbname_agg(replace_fun='leastsquares',replace_column=f'{data_column},{random_data_start},{random_data_big}')
+
+ self.tbname_agg(replace_fun='histogram',replace_column=f'{data_column},"user_input","[-100000000000,100000000000]",0',execute='N')
+ self.tbname_agg(replace_fun='histogram',replace_column=f'{data_column},"user_input","[-100000000000,100000000000]",1',execute='N')
+ histogram_logbin = '{"start":1.0, "factor": 2.0, "count": 1, "infinity": false}'
+ histogram_linear_bin = '{"start":1.0, "width": 2.0, "count": 1, "infinity": false}'
+ self.tbname_agg(replace_fun='histogram',replace_column=f'{data_column},"log_bin",\'{histogram_logbin}\',1',execute='N')
+ self.tbname_agg(replace_fun='histogram',replace_column=f'{data_column},"linear_bin",\'{histogram_linear_bin}\',1',execute='N')
+
+
+
+ def tag_count(self, dbname="nested",base_fun="AGG",replace_fun="COUNT",base_column="COLUMN",replace_column="q_int",execute="Y"):
+
+ # stable count(*)
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc order by loc "
+ self.data_check_tbname(sql,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #where null \ not null
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is not null group by loc order by loc "
+ self.data_check_tbname(sql,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by loc order by loc "
+ self.data_check_tbname(sql,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union
+ sql = f"select loc tb,AGG(COLUMN) from {dbname}.stable_1 group by loc order by loc "
+ sql = f"({sql}) union ({sql}) order by tb"
+ self.data_check_tbname(sql,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union all
+ sql = f"select loc tb,AGG(COLUMN) from {dbname}.stable_1 group by loc order by loc "
+ sql = f"({sql}) union all ({sql}) order by tb"
+ self.data_check_tbname(sql,'UNIONALL','UNIONALL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'UNIONALL','UNIONALL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'UNIONALL','UNIONALL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ #having <=0
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having count(*) = 0 order by loc "
+ self.data_check_tbname(sql,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having count(*) <= 0 order by loc "
+ self.data_check_tbname(sql,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by loc having count(*) <= 0 order by loc "
+ self.data_check_tbname(sql,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #count + having <=0
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having AGG(COLUMN) = 0 order by loc "
+ self.data_check_tbname(sql,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having AGG(COLUMN) <= 0 order by loc "
+ self.data_check_tbname(sql,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by loc having AGG(COLUMN) = 0 order by loc "
+ self.data_check_tbname(sql,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #having >0
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having count(*) != 0 order by loc "
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having count(*) > 0 order by loc "
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by loc having count(*) > 0 order by loc "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #count + having >0
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having AGG(COLUMN) != 0 order by loc "
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having AGG(COLUMN) > 0 order by loc "
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by loc having AGG(COLUMN) != 0 order by loc "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #order by count(*)
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc order by loc,count(*) "
+ self.data_check_tbname(sql,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'Y','Y',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by loc order by loc,count(*) "
+ self.data_check_tbname(sql,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ def tag_count_null(self, dbname="nested",base_fun="AGG",replace_fun="COUNT",base_column="COLUMN",replace_column="q_int",execute="Y"):
+
+ # stable count(*)
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc order by loc "
+ self.data_check_tbname(sql,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #where null \ not null
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is not null group by loc order by loc "
+ self.data_check_tbname(sql,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by loc order by loc "
+ self.data_check_tbname(sql,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union
+ sql = f"select loc tb,AGG(COLUMN) from {dbname}.stable_1 group by loc order by loc "
+ sql = f"({sql}) union ({sql}) order by tb"
+ self.data_check_tbname(sql,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union all
+ sql = f"select loc tb,AGG(COLUMN) from {dbname}.stable_1 group by loc order by loc "
+ sql = f"({sql}) union all ({sql}) order by tb"
+ self.data_check_tbname(sql,'UNIONALLNULL','UNIONALLNULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'UNIONALLNULL','UNIONALLNULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'UNIONALLNULL','UNIONALLNULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #having <=0
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having count(*) = 0 order by loc "
+ self.data_check_tbname(sql,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having count(*) <= 0 order by loc "
+ self.data_check_tbname(sql,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'HAVING=0','HAVING=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by loc having count(*) <= 0 order by loc "
+ self.data_check_tbname(sql,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #having >0
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having count(*) != 0 order by loc "
+ self.data_check_tbname(sql,'HAVINGCOLUMN=0','HAVINGCOLUMN=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVINGCOLUMN=0','HAVINGCOLUMN=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'HAVINGCOLUMN=0','HAVINGCOLUMN=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having count(*) > 0 order by loc "
+ self.data_check_tbname(sql,'HAVINGCOLUMN=0','HAVINGCOLUMN=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVINGCOLUMN=0','HAVINGCOLUMN=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'HAVINGCOLUMN=0','HAVINGCOLUMN=0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by loc having count(*) != 0 order by loc "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #order by count(*)
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc order by loc,count(*) "
+ self.data_check_tbname(sql,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by loc order by loc,count(*) "
+ self.data_check_tbname(sql,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'NULL','NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ def tag_count_all(self):
+ #random data
+ fake = Faker('zh_CN')
+ random_data_big = fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=10)
+ random_data_str = fake.pystr()
+ random_data_float = fake.pyfloat()
+
+ #random cal
+ calculations = ['+','-','*','/']
+ calculation = random.sample(calculations,1)
+ calculation = str(calculation).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ #random data column
+ data_columns = ['q_int','q_bigint','q_smallint','q_tinyint','q_float','q_double']
+ data_null_columns = ['q_int_null','q_bigint_null','q_smallint_null','q_tinyint_null','q_float_null','q_double_null']
+
+ data_column = random.sample(data_columns,1)
+ data_column = str(data_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ data_null_column = random.sample(data_null_columns,1)
+ data_null_column = str(data_null_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ data_all_columns = data_columns + data_null_columns
+ data_all_column = random.sample(data_all_columns,1)
+ data_all_column = str(data_all_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ #random data tag
+ data_tags = ['t_int','t_bigint','t_smallint','t_tinyint','t_float','t_double']
+ data_null_tags = ['t_int_null','t_bigint_null','t_smallint_null','t_tinyint_null','t_float_null','t_double_null']
+
+ data_tag = random.sample(data_tags,1)
+ data_tag = str(data_tag).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ data_null_tag = random.sample(data_null_tags,1)
+ data_null_tag = str(data_null_tag).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ data_all_tags = data_tags + data_null_tags
+ data_all_tag = random.sample(data_all_tags,1)
+ data_all_tag = str(data_all_tag).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ #random ts column
+ ts_columns = ['ts','_c0','_C0','_rowts']
+ ts_column = random.sample(ts_columns,1)
+ ts_column = str(ts_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+ #random other column
+ other_columns = ['q_bool','q_binary','q_nchar','q_ts','loc','t_bool','t_binary','t_nchar','t_ts']
+ other_column = random.sample(other_columns,1)
+ other_column = str(other_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ #random other null column and tag
+ other_null_columns = ['q_bool_null','q_binary_null','q_nchar_null','q_ts_null','t_bool_null','t_binary_null','t_nchar_null','t_ts_null']
+ other_null_column = random.sample(other_null_columns,1)
+ other_null_column = str(other_null_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ #random all column
+ all_columns = data_all_columns + data_all_tags + ts_columns + other_columns + other_null_columns
+ all_column = random.sample(all_columns,1)
+ all_column = str(all_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+
+ self.tag_count_null(replace_fun='count',replace_column=f'{data_null_column}')
+ self.tag_count_null(replace_fun='count',replace_column=f'{data_null_tag}')
+ self.tag_count_null(replace_fun='count',replace_column=f'{other_null_column}')
+
+ self.tag_count(replace_fun='count',replace_column='*')
+ self.tag_count(replace_fun='count',replace_column=f'{data_column}')
+ self.tag_count(replace_fun='count',replace_column=f'{ts_column}')
+
+ self.tag_count(replace_fun='count',replace_column=f'{other_column}')
+ self.tag_count(replace_fun='count',replace_column=f'{data_tag}')
+
+ self.tag_count(replace_fun='count',replace_column=f'{random_data_big}')
+ self.tag_count(replace_fun='count',replace_column=f'{random_data_float}')
+ self.tag_count(replace_fun='count',replace_column=f'\'{random_data_str}\'')
+ self.tag_count(replace_fun='count',replace_column=f'{random_data_big} {calculation} (abs({data_column})+1)')
+ self.tag_count(replace_fun='count',replace_column=f'{random_data_float} {calculation} (abs({data_column})+1)')
+
+
+
+ def modify_tables(self):
+ fake = Faker('zh_CN')
+ tdSql.execute('delete from stable_1_3;')
+ tdSql.execute('delete from stable_1_4;')
+ tdSql.execute('''create table stable_1_5 using stable_1 tags('stable_1_5', '%d' , '%d', '%d' , '%d' , 1 , 'binary6.%s' , 'nchar6.%s' , '%f', '%f' ,'%d') ;'''
+ %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+ tdSql.execute('''create table stable_1_6 using stable_1 tags('stable_1_6', '%d' , '%d', '%d' , '%d' , 1 , 'binary6.%s' , 'nchar6.%s' , '%f', '%f' ,'%d') ;'''
+ %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+ tdSql.execute('''create table stable_1_7 using stable_1 tags('stable_1_7', '%d' , '%d', '%d' , '%d' , 1 , 'binary6.%s' , 'nchar6.%s' , '%f', '%f' ,'%d') ;'''
+ %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+ tdSql.execute('''create table stable_1_8 using stable_1 tags('stable_1_8', '%d' , '%d', '%d' , '%d' , 1 , 'binary6.%s' , 'nchar6.%s' , '%f', '%f' ,'%d') ;'''
+ %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+ tdSql.execute('''create table stable_1_9 using stable_1 tags('stable_1_9', '%d' , '%d', '%d' , '%d' , 1 , 'binary6.%s' , 'nchar6.%s' , '%f', '%f' ,'%d') ;'''
+ %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+ tdSql.execute('''create table stable_1_90 using stable_1 tags('stable_1_90', '%d' , '%d', '%d' , '%d' , 1 , 'binary6.%s' , 'nchar6.%s' , '%f', '%f' ,'%d') ;'''
+ %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+ tdSql.execute('''create table stable_1_91 using stable_1 tags('stable_1_91', '%d' , '%d', '%d' , '%d' , 1 , 'binary6.%s' , 'nchar6.%s' , '%f', '%f' ,'%d') ;'''
+ %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+ tdSql.execute('''create table stable_1_92 using stable_1 tags('stable_1_92', '%d' , '%d', '%d' , '%d' , 1 , 'binary6.%s' , 'nchar6.%s' , '%f', '%f' ,'%d') ;'''
+ %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+
+ tdSql.execute('alter stable stable_1 add tag t_int_null INT;')
+ tdSql.execute('alter stable stable_1 add tag t_bigint_null BIGINT;')
+ tdSql.execute('alter stable stable_1 add tag t_smallint_null SMALLINT;')
+ tdSql.execute('alter stable stable_1 add tag t_tinyint_null TINYINT;')
+ tdSql.execute('alter stable stable_1 add tag t_bool_null BOOL;')
+ tdSql.execute('alter stable stable_1 add tag t_binary_null VARCHAR(100);')
+ tdSql.execute('alter stable stable_1 add tag t_nchar_null NCHAR(100);')
+ tdSql.execute('alter stable stable_1 add tag t_float_null FLOAT;')
+ tdSql.execute('alter stable stable_1 add tag t_double_null DOUBLE;')
+ tdSql.execute('alter stable stable_1 add tag t_ts_null TIMESTAMP;')
+
+ tdSql.execute('alter stable stable_1 drop column q_nchar8;')
+ tdSql.execute('alter stable stable_1 drop column q_binary8;')
+ tdSql.execute('alter stable stable_1 drop column q_nchar7;')
+ tdSql.execute('alter stable stable_1 drop column q_binary7;')
+ tdSql.execute('alter stable stable_1 drop column q_nchar6;')
+ tdSql.execute('alter stable stable_1 drop column q_binary6;')
+ tdSql.execute('alter stable stable_1 drop column q_nchar5;')
+ tdSql.execute('alter stable stable_1 drop column q_binary5;')
+ tdSql.execute('alter stable stable_1 drop column q_nchar4;')
+ tdSql.execute('alter stable stable_1 drop column q_binary4;')
+
+ def run(self):
+ tdSql.prepare()
+
+ startTime = time.time()
+
+ # self.create_tables()
+ # self.insert_data()
+
+ self.dropandcreateDB_random("nested", 1)
+ self.modify_tables()
+
+ for i in range(1):
+ self.tbname_count_all()
+ self.tag_count_all()
+ self.tbname_agg_all()
+
+
+ endTime = time.time()
+ print("total time %ds" % (endTime - startTime))
+
+
+
+
+ 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/2-query/agg_group_NotReturnValue.py b/tests/system-test/2-query/agg_group_NotReturnValue.py
new file mode 100755
index 0000000000..d25395cbbd
--- /dev/null
+++ b/tests/system-test/2-query/agg_group_NotReturnValue.py
@@ -0,0 +1,1606 @@
+###################################################################
+# 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.cases import tdCases
+#from .nestedQueryInterval import *
+from .nestedQuery import *
+from faker import Faker
+import random
+
+class TDTestCase(TDTestCase):
+ updatecfgDict = {'countAlwaysReturnValue':0}
+
+ def data_check_tbname(self,sql,groupby='Y',partitionby='Y',base_fun='',replace_fun='',base_column='',replace_column=''):
+
+ if groupby=='Y':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(12)
+ tdSql.checkData(0, 1, 100)
+ tdSql.checkData(1, 1, 200)
+ tdSql.checkData(2, 1, 00)
+ tdSql.checkData(3, 1, 0)
+ tdSql.checkData(4, 1, 00)
+ tdSql.checkData(5, 1, 0)
+ tdSql.checkData(6, 1, 0)
+ tdSql.checkData(7, 1, 00)
+ tdSql.checkData(8, 1, 00)
+ tdSql.checkData(9, 1, 0)
+ tdSql.checkData(10, 1, 00)
+ tdSql.checkData(11, 1, 0)
+ elif groupby=='UNIONALL':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(24)
+ tdSql.checkData(0, 1, 100)
+ tdSql.checkData(1, 1, 100)
+ tdSql.checkData(2, 1, 200)
+ tdSql.checkData(3, 1, 200)
+ tdSql.checkData(4, 1, 00)
+ tdSql.checkData(5, 1, 0)
+ tdSql.checkData(6, 1, 0)
+ tdSql.checkData(7, 1, 00)
+ tdSql.checkData(8, 1, 00)
+ tdSql.checkData(9, 1, 0)
+ tdSql.checkData(10, 1, 00)
+ tdSql.checkData(11, 1, 0)
+ elif groupby=='UNIONALLNULL':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(24)
+ tdSql.checkData(0, 1, 0)
+ tdSql.checkData(1, 1, 00)
+ tdSql.checkData(2, 1, 00)
+ tdSql.checkData(3, 1, 0)
+ tdSql.checkData(4, 1, 00)
+ tdSql.checkData(5, 1, 0)
+ tdSql.checkData(6, 1, 0)
+ tdSql.checkData(7, 1, 00)
+ tdSql.checkData(8, 1, 00)
+ tdSql.checkData(9, 1, 0)
+ tdSql.checkData(10, 1, 00)
+ tdSql.checkData(11, 1, 0)
+ elif groupby=='NULL':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(12)
+ tdSql.checkData(0, 1, 0)
+ tdSql.checkData(1, 1, 0)
+ tdSql.checkData(2, 1, 00)
+ tdSql.checkData(3, 1, 0)
+ tdSql.checkData(4, 1, 00)
+ tdSql.checkData(5, 1, 0)
+ tdSql.checkData(6, 1, 0)
+ tdSql.checkData(7, 1, 00)
+ tdSql.checkData(8, 1, 00)
+ tdSql.checkData(9, 1, 0)
+ tdSql.checkData(10, 1, 00)
+ tdSql.checkData(11, 1, 0)
+ elif groupby=='HAVING=0':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(10)
+ tdSql.checkData(0, 1, 0)
+ tdSql.checkData(1, 1, 0)
+ tdSql.checkData(2, 1, 00)
+ tdSql.checkData(3, 1, 0)
+ tdSql.checkData(4, 1, 00)
+ tdSql.checkData(5, 1, 0)
+ tdSql.checkData(6, 1, 0)
+ tdSql.checkData(7, 1, 00)
+ tdSql.checkData(8, 1, 00)
+ tdSql.checkData(9, 1, 0)
+ elif groupby=='HAVING>0':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 1, 100)
+ tdSql.checkData(1, 1, 200)
+ elif groupby=='HAVING>04':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(4)
+ tdSql.checkData(0, 1, 100)
+ tdSql.checkData(1, 1, 100)
+ tdSql.checkData(2, 1, 200)
+ tdSql.checkData(3, 1, 200)
+ elif groupby=='HAVINGCOLUMN=0':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 1, 0)
+ tdSql.checkData(1, 1, 0)
+ elif groupby=='NOTSUPPORT':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 1, 0)
+ tdSql.checkData(1, 1, 0)
+ elif groupby=='AGG0':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(0)
+ elif groupby=='AGG2':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(2)
+ elif groupby=='AGG2_NULL':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 1, 'None')
+ tdSql.checkData(1, 1, 'None')
+ elif groupby=='AGG4':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(4)
+ elif groupby=='AGG4_NULL':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(4)
+ tdSql.checkData(0, 1, 'None')
+ tdSql.checkData(1, 1, 'None')
+ elif groupby=='AGG10':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(10)
+ elif groupby=='AGG12':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(12)
+ elif groupby=='AGG20':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(20)
+ elif groupby=='AGG24':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(24)
+ else:
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(12)
+
+
+ if partitionby=='Y':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(12)
+ tdSql.checkData(0, 1, 100)
+ tdSql.checkData(1, 1, 200)
+ tdSql.checkData(2, 1, 00)
+ tdSql.checkData(3, 1, 0)
+ tdSql.checkData(4, 1, 00)
+ tdSql.checkData(5, 1, 0)
+ tdSql.checkData(6, 1, 0)
+ tdSql.checkData(7, 1, 00)
+ tdSql.checkData(8, 1, 00)
+ tdSql.checkData(9, 1, 0)
+ tdSql.checkData(10, 1, 00)
+ tdSql.checkData(11, 1, 0)
+ elif groupby=='UNIONALL':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(24)
+ tdSql.checkData(0, 1, 100)
+ tdSql.checkData(1, 1, 100)
+ tdSql.checkData(2, 1, 200)
+ tdSql.checkData(3, 1, 200)
+ tdSql.checkData(4, 1, 00)
+ tdSql.checkData(5, 1, 0)
+ tdSql.checkData(6, 1, 0)
+ tdSql.checkData(7, 1, 00)
+ tdSql.checkData(8, 1, 00)
+ tdSql.checkData(9, 1, 0)
+ tdSql.checkData(10, 1, 00)
+ tdSql.checkData(11, 1, 0)
+ elif groupby=='UNIONALLNULL':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(24)
+ tdSql.checkData(0, 1, 00)
+ tdSql.checkData(1, 1, 00)
+ tdSql.checkData(2, 1, 00)
+ tdSql.checkData(3, 1, 0)
+ tdSql.checkData(4, 1, 00)
+ tdSql.checkData(5, 1, 0)
+ tdSql.checkData(6, 1, 0)
+ tdSql.checkData(7, 1, 00)
+ tdSql.checkData(8, 1, 00)
+ tdSql.checkData(9, 1, 0)
+ tdSql.checkData(10, 1, 00)
+ tdSql.checkData(11, 1, 0)
+ elif partitionby=='NULL':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(12)
+ tdSql.checkData(0, 1, 0)
+ tdSql.checkData(1, 1, 0)
+ tdSql.checkData(2, 1, 00)
+ tdSql.checkData(3, 1, 0)
+ tdSql.checkData(4, 1, 00)
+ tdSql.checkData(5, 1, 0)
+ tdSql.checkData(6, 1, 0)
+ tdSql.checkData(7, 1, 00)
+ tdSql.checkData(8, 1, 00)
+ tdSql.checkData(9, 1, 0)
+ tdSql.checkData(10, 1, 00)
+ tdSql.checkData(11, 1, 0)
+ elif partitionby=='HAVING=0':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(10)
+ tdSql.checkData(0, 1, 0)
+ tdSql.checkData(1, 1, 0)
+ tdSql.checkData(2, 1, 00)
+ tdSql.checkData(3, 1, 0)
+ tdSql.checkData(4, 1, 00)
+ tdSql.checkData(5, 1, 0)
+ tdSql.checkData(6, 1, 0)
+ tdSql.checkData(7, 1, 00)
+ tdSql.checkData(8, 1, 00)
+ tdSql.checkData(9, 1, 0)
+ elif partitionby=='HAVING>0':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 1, 100)
+ tdSql.checkData(1, 1, 200)
+ elif partitionby=='HAVING>04':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(4)
+ tdSql.checkData(0, 1, 100)
+ tdSql.checkData(1, 1, 100)
+ tdSql.checkData(2, 1, 200)
+ tdSql.checkData(3, 1, 200)
+ elif partitionby=='HAVINGCOLUMN=0':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 1, 0)
+ tdSql.checkData(1, 1, 0)
+ elif partitionby=='NOTSUPPORT':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 1, 0)
+ tdSql.checkData(1, 1, 0)
+ elif partitionby=='AGG0':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(0)
+ elif partitionby=='AGG2':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(2)
+ elif partitionby=='AGG2_NULL':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 1, 'None')
+ tdSql.checkData(1, 1, 'None')
+ elif partitionby=='AGG4':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(4)
+ elif partitionby=='AGG4_NULL':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ tdSql.query(sql)
+ tdSql.checkRows(4)
+ tdSql.checkData(0, 1, 'None')
+ tdSql.checkData(1, 1, 'None')
+ elif partitionby=='AGG10':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(10)
+ elif partitionby=='AGG12':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(12)
+ elif partitionby=='AGG20':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(20)
+ elif partitionby=='AGG24':
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(24)
+ else:
+ sql = sql.replace(f'{base_fun}',f'{replace_fun}').replace(f'{base_column}',f'{replace_column}')
+ sql = sql.replace('group','partition')
+ tdSql.query(sql)
+ tdSql.checkRows(12)
+
+
+ def tbname_count(self, dbname="nested",base_fun="AGG",replace_fun="COUNT",base_column="COLUMN",replace_column="q_int",execute="Y"):
+
+ # stable count(*)
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname "
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #where null \ not null
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is not null group by tbname order by tbname "
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by tbname order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname "
+ sql = f"({sql}) union ({sql}) order by tb"
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union all
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname "
+ sql = f"({sql}) union all ({sql}) order by tb"
+ self.data_check_tbname(sql,'HAVING>04','HAVING>04',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>04','HAVING>04',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'HAVING>04','HAVING>04',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ #having <=0
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) = 0 order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) <= 0 order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by tbname having count(*) <= 0 order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #count + having <=0
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having AGG(COLUMN) = 0 order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having AGG(COLUMN) <= 0 order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by tbname having AGG(COLUMN) = 0 order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #having >0
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) != 0 order by tbname "
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) > 0 order by tbname "
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by tbname having count(*) > 0 order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #count + having >0
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having AGG(COLUMN) != 0 order by tbname "
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having AGG(COLUMN) > 0 order by tbname "
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by tbname having AGG(COLUMN) != 0 order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #order by count(*)
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname,count(*) "
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by tbname order by tbname,count(*) "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ def tbname_count_null(self, dbname="nested",base_fun="AGG",replace_fun="COUNT",base_column="COLUMN",replace_column="q_int",execute="Y"):
+
+ # stable count(*)
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname "
+ self.data_check_tbname(sql,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #where null \ not null
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is not null group by tbname order by tbname "
+ self.data_check_tbname(sql,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by tbname order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname "
+ sql = f"({sql}) union ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union all
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname "
+ sql = f"({sql}) union all ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG4_NULL','AGG4_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG4_NULL','AGG4_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG4_NULL','AGG4_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #having <=0
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) = 0 order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) <= 0 order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by tbname having count(*) <= 0 order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #having >0
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) != 0 order by tbname "
+ self.data_check_tbname(sql,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) > 0 order by tbname "
+ self.data_check_tbname(sql,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by tbname having count(*) != 0 order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #order by count(*)
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname,count(*) "
+ self.data_check_tbname(sql,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by tbname order by tbname,count(*) "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ def tbname_count_all(self):
+ #random data
+ fake = Faker('zh_CN')
+ random_data_big = fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=10)
+ random_data_str = fake.pystr()
+ random_data_float = fake.pyfloat()
+
+ #random cal
+ calculations = ['+','-','*','/']
+ calculation = random.sample(calculations,1)
+ calculation = str(calculation).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ #random data column
+ data_columns = ['q_int','q_bigint','q_smallint','q_tinyint','q_float','q_double']
+ data_null_columns = ['q_int_null','q_bigint_null','q_smallint_null','q_tinyint_null','q_float_null','q_double_null']
+
+ data_column = random.sample(data_columns,1)
+ data_column = str(data_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ data_null_column = random.sample(data_null_columns,1)
+ data_null_column = str(data_null_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ data_all_columns = data_columns + data_null_columns
+ data_all_column = random.sample(data_all_columns,1)
+ data_all_column = str(data_all_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ #random data tag
+ data_tags = ['t_int','t_bigint','t_smallint','t_tinyint','t_float','t_double']
+ data_null_tags = ['t_int_null','t_bigint_null','t_smallint_null','t_tinyint_null','t_float_null','t_double_null']
+
+ data_tag = random.sample(data_tags,1)
+ data_tag = str(data_tag).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ data_null_tag = random.sample(data_null_tags,1)
+ data_null_tag = str(data_null_tag).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ data_all_tags = data_tags + data_null_tags
+ data_all_tag = random.sample(data_all_tags,1)
+ data_all_tag = str(data_all_tag).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ #random ts column
+ ts_columns = ['ts','_c0','_C0','_rowts']
+ ts_column = random.sample(ts_columns,1)
+ ts_column = str(ts_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+ #random other column
+ other_columns = ['q_bool','q_binary','q_nchar','q_ts','loc','t_bool','t_binary','t_nchar','t_ts']
+ other_column = random.sample(other_columns,1)
+ other_column = str(other_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ #random other null column and tag
+ other_null_columns = ['q_bool_null','q_binary_null','q_nchar_null','q_ts_null','t_bool_null','t_binary_null','t_nchar_null','t_ts_null']
+ other_null_column = random.sample(other_null_columns,1)
+ other_null_column = str(other_null_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ #random all column
+ all_columns = data_all_columns + data_all_tags + ts_columns + other_columns + other_null_columns
+ all_column = random.sample(all_columns,1)
+ all_column = str(all_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+
+ self.tbname_count_null(replace_fun='count',replace_column=f'{data_null_column}')
+ self.tbname_count_null(replace_fun='count',replace_column=f'{data_null_tag}')
+ self.tbname_count_null(replace_fun='count',replace_column=f'{other_null_column}')
+
+ self.tbname_count(replace_fun='count',replace_column='*')
+ self.tbname_count(replace_fun='count',replace_column=f'{data_column}')
+ self.tbname_count(replace_fun='count',replace_column=f'{ts_column}')
+
+ self.tbname_count(replace_fun='count',replace_column=f'{other_column}')
+ self.tbname_count(replace_fun='count',replace_column=f'{data_tag}')
+
+ self.tbname_count(replace_fun='count',replace_column=f'{random_data_big}')
+ self.tbname_count(replace_fun='count',replace_column=f'{random_data_float}')
+ self.tbname_count(replace_fun='count',replace_column=f'\'{random_data_str}\'')
+ self.tbname_count(replace_fun='count',replace_column=f'{random_data_big} {calculation} (abs({data_column})+1)')
+ self.tbname_count(replace_fun='count',replace_column=f'{random_data_float} {calculation} (abs({data_column})+1)')
+
+ def tbname_agg(self, dbname="nested",base_fun="AGG",replace_fun="",base_column="COLUMN",replace_column="q_int",execute="Y"):
+
+ # stable count(*)
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname "
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #where null \ not null
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is not null group by tbname order by tbname "
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by tbname order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ #union
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname "
+ sql = f"({sql}) union ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union all
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname "
+ sql = f"({sql}) union all ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ if execute=="Y":
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) = 0 order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) <= 0 order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) != 0 order by tbname "
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) > 0 order by tbname "
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname,count(*) "
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ # Mixed scene
+ if execute=="Y":
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) = 0 order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) <= 0 order by tbname "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) = 0 order by tbname "
+ sql = f"({sql}) union ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union all
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) <= 0 order by tbname "
+ sql = f"({sql}) union all ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) != 0 order by tbname "
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) > 0 order by tbname "
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) != 0 order by tbname "
+ sql = f"({sql}) union ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union all
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname having count(*) > 0 order by tbname "
+ sql = f"({sql}) union all ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname,AGG(COLUMN) "
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname,AGG(COLUMN) "
+ sql = f"({sql}) union ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union all
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname,AGG(COLUMN) "
+ sql = f"({sql}) union all ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+
+ sql = f"select tbname,AGG(COLUMN),count(*) from {dbname}.stable_1 group by tbname order by tbname,AGG(COLUMN) "
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union
+ sql = f"select tbname tb,AGG(COLUMN),count(*) from {dbname}.stable_1 group by tbname order by tbname,AGG(COLUMN)"
+ sql = f"({sql}) union ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union all
+ sql = f"select tbname tb ,AGG(COLUMN),count(*) from {dbname}.stable_1 group by tbname order by tbname,AGG(COLUMN)"
+ sql = f"({sql}) union all ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+
+ sql = f"select tbname,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname,AGG(COLUMN),count(*) "
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tbname "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname,AGG(COLUMN),count(*)"
+ sql = f"({sql}) union ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG2','AGG2',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union all
+ sql = f"select tbname tb,AGG(COLUMN) from {dbname}.stable_1 group by tbname order by tbname,AGG(COLUMN),count(*)"
+ sql = f"({sql}) union all ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG4','AGG4',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+
+ def tbname_agg_all(self):
+ #random data
+ fake = Faker('zh_CN')
+ random_data_big = fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=10)
+ random_data_str = fake.pystr()
+ random_data_float = fake.pyfloat()
+ random_data_start = fake.random_int(min=0, max=100, step=1)
+ random_data_end = fake.random_int(min=0, max=100, step=1)
+
+ #random cal
+ calculations = ['+','-','*','/']
+ calculation = random.sample(calculations,1)
+ calculation = str(calculation).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ #random data column
+ data_columns = ['q_int','q_bigint','q_smallint','q_tinyint','q_float','q_double','t_int','t_bigint','t_smallint','t_tinyint','t_float','t_double']
+ data_null_columns = ['q_int_null','q_bigint_null','q_smallint_null','q_tinyint_null','q_float_null','q_double_null','t_int','t_bigint','t_smallint','t_tinyint','t_float','t_double']
+ data_columns = data_columns + data_null_columns
+ data_column = random.sample(data_null_columns,1)
+ data_column = str(data_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+ #random ts column
+ ts_columns = ['ts','_c0','_C0','_rowts']
+ ts_column = random.sample(ts_columns,1)
+ ts_column = str(ts_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+ #random ts unit column
+ ts_units = ['1a','1s','1m','1h','1d','1w']
+ ts_unit = random.sample(ts_units,1)
+ ts_unit = str(ts_unit).replace("[","").replace("]","").replace("'","").replace(", ","")
+ #random str column
+ str_columns = ['q_int','q_bigint','q_smallint','q_tinyint','q_float','q_double','t_int','t_bigint','t_smallint','t_tinyint','t_float','t_double']
+ str_column = random.sample(str_columns,1)
+ str_column = str(str_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+ #random other column
+ other_columns = ['q_bool','q_binary','q_nchar','q_ts','loc','t_bool','t_binary','t_nchar','t_ts']
+ other_column = random.sample(other_columns,1)
+ other_column = str(other_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+ #random all column
+ all_columns = data_columns + ts_columns + str_columns + other_columns
+ all_column = random.sample(all_columns,1)
+ all_column = str(all_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ self.tbname_agg(replace_fun='sum',replace_column=f'{data_column}')
+ self.tbname_agg(replace_fun='sum',replace_column=f'{random_data_big}')
+ self.tbname_agg(replace_fun='sum',replace_column=f'{random_data_float}')
+ self.tbname_agg(replace_fun='sum',replace_column=f'{random_data_big} {calculation} {data_column}')
+ self.tbname_agg(replace_fun='sum',replace_column=f'{random_data_float} {calculation} {data_column}')
+
+ self.tbname_agg(replace_fun='avg',replace_column=f'{data_column}')
+ self.tbname_agg(replace_fun='avg',replace_column=f'{random_data_big}')
+ self.tbname_agg(replace_fun='avg',replace_column=f'{random_data_float}')
+ self.tbname_agg(replace_fun='avg',replace_column=f'{random_data_big} {calculation} {data_column}')
+ self.tbname_agg(replace_fun='avg',replace_column=f'{random_data_float} {calculation} {data_column}')
+
+ self.tbname_agg(replace_fun='spread',replace_column=f'{data_column}')
+ self.tbname_agg(replace_fun='spread',replace_column=f'{random_data_big}')
+ self.tbname_agg(replace_fun='spread',replace_column=f'{random_data_float}')
+ self.tbname_agg(replace_fun='spread',replace_column=f'{random_data_big} {calculation} {data_column}')
+ self.tbname_agg(replace_fun='spread',replace_column=f'{random_data_float} {calculation} {data_column}')
+
+ self.tbname_agg(replace_fun='stddev',replace_column=f'{data_column}')
+ self.tbname_agg(replace_fun='stddev',replace_column=f'{random_data_big}')
+ self.tbname_agg(replace_fun='stddev',replace_column=f'{random_data_float}')
+ self.tbname_agg(replace_fun='stddev',replace_column=f'{random_data_big} {calculation} {data_column}')
+ self.tbname_agg(replace_fun='stddev',replace_column=f'{random_data_float} {calculation} {data_column}')
+
+ self.tbname_agg(replace_fun='elapsed',replace_column=f'{ts_column}')
+ self.tbname_agg(replace_fun='elapsed',replace_column=f'{ts_column},{ts_unit}')
+
+ self.tbname_agg(replace_fun='hyperloglog',replace_column=f'{all_column}')
+ self.tbname_agg(replace_fun='hyperloglog',replace_column=f'{random_data_big}')
+ self.tbname_agg(replace_fun='hyperloglog',replace_column=f'{random_data_float}')
+ self.tbname_agg(replace_fun='hyperloglog',replace_column=f'\'{random_data_str}\'')
+ self.tbname_agg(replace_fun='hyperloglog',replace_column=f'{random_data_big} {calculation} {data_column}')
+ self.tbname_agg(replace_fun='hyperloglog',replace_column=f'{random_data_float} {calculation} {data_column}')
+
+ self.tbname_agg(replace_fun='apercentile',replace_column=f'{data_column},{random_data_start}')
+ self.tbname_agg(replace_fun='apercentile',replace_column=f'{data_column},{random_data_start},"default"')
+ self.tbname_agg(replace_fun='apercentile',replace_column=f'{data_column},{random_data_start},"t-digest"')
+ # not support
+ # self.tbname_agg(replace_fun='percentile',replace_column=f'{data_column},{random_data_start}')
+ # self.tbname_agg(replace_fun='percentile',replace_column=f'{data_column},{random_data_end}')
+ # self.tbname_agg(replace_fun='percentile',replace_column=f'{data_column},{random_data_big}')
+
+ self.tbname_agg(replace_fun='leastsquares',replace_column=f'{data_column},{random_data_start},{random_data_end}')
+ self.tbname_agg(replace_fun='leastsquares',replace_column=f'{data_column},{random_data_start},{random_data_big}')
+
+ self.tbname_agg(replace_fun='histogram',replace_column=f'{data_column},"user_input","[-100000000000,100000000000]",0',execute='N')
+ self.tbname_agg(replace_fun='histogram',replace_column=f'{data_column},"user_input","[-100000000000,100000000000]",1',execute='N')
+ histogram_logbin = '{"start":1.0, "factor": 2.0, "count": 1, "infinity": false}'
+ histogram_linear_bin = '{"start":1.0, "width": 2.0, "count": 1, "infinity": false}'
+ self.tbname_agg(replace_fun='histogram',replace_column=f'{data_column},"log_bin",\'{histogram_logbin}\',1',execute='N')
+ self.tbname_agg(replace_fun='histogram',replace_column=f'{data_column},"linear_bin",\'{histogram_linear_bin}\',1',execute='N')
+
+
+
+ def tag_count(self, dbname="nested",base_fun="AGG",replace_fun="COUNT",base_column="COLUMN",replace_column="q_int",execute="Y"):
+
+ # stable count(*)
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc order by loc "
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #where null \ not null
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is not null group by loc order by loc "
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by loc order by loc "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union
+ sql = f"select loc tb,AGG(COLUMN) from {dbname}.stable_1 group by loc order by loc "
+ sql = f"({sql}) union ({sql}) order by tb"
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union all
+ sql = f"select loc tb,AGG(COLUMN) from {dbname}.stable_1 group by loc order by loc "
+ sql = f"({sql}) union all ({sql}) order by tb"
+ self.data_check_tbname(sql,'HAVING>04','HAVING>04',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>04','HAVING>04',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'HAVING>04','HAVING>04',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ #having <=0
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having count(*) = 0 order by loc "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having count(*) <= 0 order by loc "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by loc having count(*) <= 0 order by loc "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #count + having <=0
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having AGG(COLUMN) = 0 order by loc "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having AGG(COLUMN) <= 0 order by loc "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by loc having AGG(COLUMN) = 0 order by loc "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #having >0
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having count(*) != 0 order by loc "
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having count(*) > 0 order by loc "
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by loc having count(*) > 0 order by loc "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #count + having >0
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having AGG(COLUMN) != 0 order by loc "
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having AGG(COLUMN) > 0 order by loc "
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by loc having AGG(COLUMN) != 0 order by loc "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #order by count(*)
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc order by loc,count(*) "
+ self.data_check_tbname(sql,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'HAVING>0','HAVING>0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by loc order by loc,count(*) "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ def tag_count_null(self, dbname="nested",base_fun="AGG",replace_fun="COUNT",base_column="COLUMN",replace_column="q_int",execute="Y"):
+
+ # stable count(*)
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc order by loc "
+ self.data_check_tbname(sql,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #where null \ not null
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is not null group by loc order by loc "
+ self.data_check_tbname(sql,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by loc order by loc "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union
+ sql = f"select loc tb,AGG(COLUMN) from {dbname}.stable_1 group by loc order by loc "
+ sql = f"({sql}) union ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #union all
+ sql = f"select loc tb,AGG(COLUMN) from {dbname}.stable_1 group by loc order by loc "
+ sql = f"({sql}) union all ({sql}) order by tb"
+ self.data_check_tbname(sql,'AGG4_NULL','AGG4_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG4_NULL','AGG4_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by tb "
+ self.data_check_tbname(sql2,'AGG4_NULL','AGG4_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #having <=0
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having count(*) = 0 order by loc "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having count(*) <= 0 order by loc "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by loc having count(*) <= 0 order by loc "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #having >0
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having count(*) != 0 order by loc "
+ self.data_check_tbname(sql,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc having count(*) > 0 order by loc "
+ self.data_check_tbname(sql,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by loc having count(*) != 0 order by loc "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ #order by count(*)
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 group by loc order by loc,count(*) "
+ self.data_check_tbname(sql,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG2_NULL','AGG2_NULL',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql = f"select loc,AGG(COLUMN) from {dbname}.stable_1 where ts is null group by loc order by loc,count(*) "
+ self.data_check_tbname(sql,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql1 = f"select * from ({sql})"
+ self.data_check_tbname(sql1,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ sql2 = f"select * from ({sql}) order by loc "
+ self.data_check_tbname(sql2,'AGG0','AGG0',f'{base_fun}',f'{replace_fun}',f'{base_column}',f'{replace_column}')
+
+ def tag_count_all(self):
+ #random data
+ fake = Faker('zh_CN')
+ random_data_big = fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=10)
+ random_data_str = fake.pystr()
+ random_data_float = fake.pyfloat()
+
+ #random cal
+ calculations = ['+','-','*','/']
+ calculation = random.sample(calculations,1)
+ calculation = str(calculation).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ #random data column
+ data_columns = ['q_int','q_bigint','q_smallint','q_tinyint','q_float','q_double']
+ data_null_columns = ['q_int_null','q_bigint_null','q_smallint_null','q_tinyint_null','q_float_null','q_double_null']
+
+ data_column = random.sample(data_columns,1)
+ data_column = str(data_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ data_null_column = random.sample(data_null_columns,1)
+ data_null_column = str(data_null_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ data_all_columns = data_columns + data_null_columns
+ data_all_column = random.sample(data_all_columns,1)
+ data_all_column = str(data_all_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ #random data tag
+ data_tags = ['t_int','t_bigint','t_smallint','t_tinyint','t_float','t_double']
+ data_null_tags = ['t_int_null','t_bigint_null','t_smallint_null','t_tinyint_null','t_float_null','t_double_null']
+
+ data_tag = random.sample(data_tags,1)
+ data_tag = str(data_tag).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ data_null_tag = random.sample(data_null_tags,1)
+ data_null_tag = str(data_null_tag).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ data_all_tags = data_tags + data_null_tags
+ data_all_tag = random.sample(data_all_tags,1)
+ data_all_tag = str(data_all_tag).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ #random ts column
+ ts_columns = ['ts','_c0','_C0','_rowts']
+ ts_column = random.sample(ts_columns,1)
+ ts_column = str(ts_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+ #random other column
+ other_columns = ['q_bool','q_binary','q_nchar','q_ts','loc','t_bool','t_binary','t_nchar','t_ts']
+ other_column = random.sample(other_columns,1)
+ other_column = str(other_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ #random other null column and tag
+ other_null_columns = ['q_bool_null','q_binary_null','q_nchar_null','q_ts_null','t_bool_null','t_binary_null','t_nchar_null','t_ts_null']
+ other_null_column = random.sample(other_null_columns,1)
+ other_null_column = str(other_null_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ #random all column
+ all_columns = data_all_columns + data_all_tags + ts_columns + other_columns + other_null_columns
+ all_column = random.sample(all_columns,1)
+ all_column = str(all_column).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+
+ self.tag_count_null(replace_fun='count',replace_column=f'{data_null_column}')
+ self.tag_count_null(replace_fun='count',replace_column=f'{data_null_tag}')
+ self.tag_count_null(replace_fun='count',replace_column=f'{other_null_column}')
+
+ self.tag_count(replace_fun='count',replace_column='*')
+ self.tag_count(replace_fun='count',replace_column=f'{data_column}')
+ self.tag_count(replace_fun='count',replace_column=f'{ts_column}')
+
+ self.tag_count(replace_fun='count',replace_column=f'{other_column}')
+ self.tag_count(replace_fun='count',replace_column=f'{data_tag}')
+
+ self.tag_count(replace_fun='count',replace_column=f'{random_data_big}')
+ self.tag_count(replace_fun='count',replace_column=f'{random_data_float}')
+ self.tag_count(replace_fun='count',replace_column=f'\'{random_data_str}\'')
+ self.tag_count(replace_fun='count',replace_column=f'{random_data_big} {calculation} (abs({data_column})+1)')
+ self.tag_count(replace_fun='count',replace_column=f'{random_data_float} {calculation} (abs({data_column})+1)')
+
+
+
+ def modify_tables(self):
+ fake = Faker('zh_CN')
+ tdSql.execute('delete from stable_1_3;')
+ tdSql.execute('delete from stable_1_4;')
+ tdSql.execute('''create table stable_1_5 using stable_1 tags('stable_1_5', '%d' , '%d', '%d' , '%d' , 1 , 'binary6.%s' , 'nchar6.%s' , '%f', '%f' ,'%d') ;'''
+ %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+ tdSql.execute('''create table stable_1_6 using stable_1 tags('stable_1_6', '%d' , '%d', '%d' , '%d' , 1 , 'binary6.%s' , 'nchar6.%s' , '%f', '%f' ,'%d') ;'''
+ %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+ tdSql.execute('''create table stable_1_7 using stable_1 tags('stable_1_7', '%d' , '%d', '%d' , '%d' , 1 , 'binary6.%s' , 'nchar6.%s' , '%f', '%f' ,'%d') ;'''
+ %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+ tdSql.execute('''create table stable_1_8 using stable_1 tags('stable_1_8', '%d' , '%d', '%d' , '%d' , 1 , 'binary6.%s' , 'nchar6.%s' , '%f', '%f' ,'%d') ;'''
+ %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+ tdSql.execute('''create table stable_1_9 using stable_1 tags('stable_1_9', '%d' , '%d', '%d' , '%d' , 1 , 'binary6.%s' , 'nchar6.%s' , '%f', '%f' ,'%d') ;'''
+ %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+ tdSql.execute('''create table stable_1_90 using stable_1 tags('stable_1_90', '%d' , '%d', '%d' , '%d' , 1 , 'binary6.%s' , 'nchar6.%s' , '%f', '%f' ,'%d') ;'''
+ %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+ tdSql.execute('''create table stable_1_91 using stable_1 tags('stable_1_91', '%d' , '%d', '%d' , '%d' , 1 , 'binary6.%s' , 'nchar6.%s' , '%f', '%f' ,'%d') ;'''
+ %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+ tdSql.execute('''create table stable_1_92 using stable_1 tags('stable_1_92', '%d' , '%d', '%d' , '%d' , 1 , 'binary6.%s' , 'nchar6.%s' , '%f', '%f' ,'%d') ;'''
+ %(fake.random_int(min=-2147483647, max=2147483647, step=1), fake.random_int(min=-9223372036854775807, max=9223372036854775807, step=1),
+ fake.random_int(min=-32767, max=32767, step=1) , fake.random_int(min=-127, max=127, step=1) ,
+ fake.pystr() ,fake.pystr() ,fake.pyfloat(),fake.pyfloat(),fake.random_int(min=-2147483647, max=2147483647, step=1)))
+
+ tdSql.execute('alter stable stable_1 add tag t_int_null INT;')
+ tdSql.execute('alter stable stable_1 add tag t_bigint_null BIGINT;')
+ tdSql.execute('alter stable stable_1 add tag t_smallint_null SMALLINT;')
+ tdSql.execute('alter stable stable_1 add tag t_tinyint_null TINYINT;')
+ tdSql.execute('alter stable stable_1 add tag t_bool_null BOOL;')
+ tdSql.execute('alter stable stable_1 add tag t_binary_null VARCHAR(100);')
+ tdSql.execute('alter stable stable_1 add tag t_nchar_null NCHAR(100);')
+ tdSql.execute('alter stable stable_1 add tag t_float_null FLOAT;')
+ tdSql.execute('alter stable stable_1 add tag t_double_null DOUBLE;')
+ tdSql.execute('alter stable stable_1 add tag t_ts_null TIMESTAMP;')
+
+ tdSql.execute('alter stable stable_1 drop column q_nchar8;')
+ tdSql.execute('alter stable stable_1 drop column q_binary8;')
+ tdSql.execute('alter stable stable_1 drop column q_nchar7;')
+ tdSql.execute('alter stable stable_1 drop column q_binary7;')
+ tdSql.execute('alter stable stable_1 drop column q_nchar6;')
+ tdSql.execute('alter stable stable_1 drop column q_binary6;')
+ tdSql.execute('alter stable stable_1 drop column q_nchar5;')
+ tdSql.execute('alter stable stable_1 drop column q_binary5;')
+ tdSql.execute('alter stable stable_1 drop column q_nchar4;')
+ tdSql.execute('alter stable stable_1 drop column q_binary4;')
+
+ def run(self):
+ tdSql.prepare()
+
+ startTime = time.time()
+
+ # self.create_tables()
+ # self.insert_data()
+
+ self.dropandcreateDB_random("nested", 1)
+ self.modify_tables()
+
+ for i in range(2):
+ self.tag_count_all()
+ self.tbname_count_all()
+ self.tbname_agg_all()
+
+
+ endTime = time.time()
+ print("total time %ds" % (endTime - startTime))
+
+
+
+
+ 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/2-query/explain.py b/tests/system-test/2-query/explain.py
index f164d3aedf..92cd28a929 100644
--- a/tests/system-test/2-query/explain.py
+++ b/tests/system-test/2-query/explain.py
@@ -400,6 +400,9 @@ class TDTestCase:
self.explain_check()
+ # coverage explain.c add
+ tdSql.query(f"explain verbose true select * from {dbname}.stb1 partition by c1 order by c2")
+
def __test_error(self, dbname=DBNAME):
ratio = random.uniform(0.001,1)
diff --git a/tests/system-test/2-query/last_cache_scan.py b/tests/system-test/2-query/last_cache_scan.py
index b267cedc9d..049fe60f16 100644
--- a/tests/system-test/2-query/last_cache_scan.py
+++ b/tests/system-test/2-query/last_cache_scan.py
@@ -24,6 +24,11 @@ class TDTestCase:
self.ctbNum = 10
self.rowsPerTbl = 10000
self.duraion = '1h'
+ self.cachemodel = 'both'
+ self.cacheEnable = True
+ #self.cacheEnable = False
+ if not self.cacheEnable:
+ self.cachemodel = 'none'
def init(self, conn, logSql, replicaVar=1):
self.replicaVar = int(replicaVar)
@@ -34,7 +39,7 @@ class TDTestCase:
if dropFlag == 1:
tsql.execute("drop database if exists %s"%(dbName))
- tsql.execute("create database if not exists %s vgroups %d replica %d duration %s CACHEMODEL 'both'"%(dbName, vgroups, replica, duration))
+ tsql.execute("create database if not exists %s vgroups %d replica %d duration %s CACHEMODEL '%s'"%(dbName, vgroups, replica, duration, self.cachemodel))
tdLog.debug("complete to create database %s"%(dbName))
return
@@ -130,6 +135,9 @@ class TDTestCase:
return
def check_explain_res_has_row(self, plan_str_expect: str, rows, sql):
+ if not self.cacheEnable:
+ return
+
plan_found = False
for row in rows:
if str(row).find(plan_str_expect) >= 0:
@@ -343,10 +351,10 @@ class TDTestCase:
p.check_returncode()
tdSql.query_success_failed("select ts, last(c1), c1, ts, c1 from meters", queryTimes=10, expectErrInfo="Invalid column name: c1")
tdSql.query('select last(c12), c12, ts from meters', queryTimes=1)
- tdSql.checkRows(1)
- tdSql.checkCols(3)
- tdSql.checkData(0, 0, None)
- tdSql.checkData(0, 1, None)
+ tdSql.checkRows(0)
+ #tdSql.checkCols(3)
+ #tdSql.checkData(0, 0, None)
+ #tdSql.checkData(0, 1, None)
def test_cache_scan_with_drop_column(self):
tdSql.query('select last(*) from meters')
@@ -378,41 +386,41 @@ class TDTestCase:
p.check_returncode()
tdSql.query_success_failed("select ts, last(c2), c12, ts, c12 from meters", queryTimes=10, expectErrInfo="Invalid column name: c2")
tdSql.query('select last(c1), c1, ts from meters', queryTimes=1)
- tdSql.checkRows(1)
- tdSql.checkCols(3)
- tdSql.checkData(0, 0, None)
- tdSql.checkData(0, 1, None)
+ tdSql.checkRows(0)
+ #tdSql.checkCols(3)
+ #tdSql.checkData(0, 0, None)
+ #tdSql.checkData(0, 1, None)
def test_cache_scan_last_row_with_partition_by(self):
tdSql.query('select last(c1) from meters partition by t1')
print(str(tdSql.queryResult))
- tdSql.checkCols(1)
- tdSql.checkRows(5)
+ #tdSql.checkCols(1)
+ tdSql.checkRows(0)
p = subprocess.run(["taos", '-s', "alter table test.meters drop column c1; alter table test.meters add column c2 int"])
p.check_returncode()
tdSql.query_success_failed('select last(c1) from meters partition by t1', queryTimes=10, expectErrInfo="Invalid column name: c1")
tdSql.query('select last(c2), c2, ts from meters', queryTimes=1)
print(str(tdSql.queryResult))
- tdSql.checkRows(1)
- tdSql.checkCols(3)
- tdSql.checkData(0, 0, None)
- tdSql.checkData(0, 1, None)
+ tdSql.checkRows(0)
+ #tdSql.checkCols(3)
+ #tdSql.checkData(0, 0, None)
+ #tdSql.checkData(0, 1, None)
def test_cache_scan_last_row_with_partition_by_tbname(self):
tdSql.query('select last(c2) from meters partition by tbname')
print(str(tdSql.queryResult))
- tdSql.checkCols(1)
- tdSql.checkRows(10)
+ #tdSql.checkCols(1)
+ tdSql.checkRows(0)
p = subprocess.run(["taos", '-s', "alter table test.meters drop column c2; alter table test.meters add column c1 int"])
p.check_returncode()
tdSql.query_success_failed('select last_row(c2) from meters partition by tbname', queryTimes=10, expectErrInfo="Invalid column name: c2")
tdSql.query('select last(c1), c1, ts from meters', queryTimes=1)
print(str(tdSql.queryResult))
- tdSql.checkRows(1)
- tdSql.checkCols(3)
- tdSql.checkData(0, 0, None)
- tdSql.checkData(0, 1, None)
+ tdSql.checkRows(0)
+ #tdSql.checkCols(3)
+ #tdSql.checkData(0, 0, None)
+ #tdSql.checkData(0, 1, None)
diff --git a/tests/system-test/2-query/last_row.py b/tests/system-test/2-query/last_row.py
index 0744b3bae5..13d1e47f76 100644
--- a/tests/system-test/2-query/last_row.py
+++ b/tests/system-test/2-query/last_row.py
@@ -117,6 +117,10 @@ class TDTestCase:
( '2022-10-28 01:01:26.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", "1970-01-01 08:00:00.000" )
( '2022-12-01 01:01:30.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", "1969-01-01 01:00:00.000" )
( '2022-12-31 01:01:36.000', 9, -99999999999999999, -999, -99, -9.99, -999999999999999999999.99, 1, "binary9", "nchar9", "1900-01-01 00:00:00.000" )
+ '''
+ )
+ tdSql.execute(
+ f'''insert into {dbname}.t1 values
( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
'''
)
@@ -179,6 +183,10 @@ class TDTestCase:
( '2022-10-28 01:01:26.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", "1970-01-01 08:00:00.000" )
( '2022-12-01 01:01:30.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", "1969-01-01 01:00:00.000" )
( '2022-12-31 01:01:36.000', 9, -99999999999999999, -999, -99, -9.99, -999999999999999999999.99, 1, "binary9", "nchar9", "1900-01-01 00:00:00.000" )
+ '''
+ )
+ tdSql.execute(
+ f'''insert into {dbname}.t1 values
( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
'''
)
diff --git a/tests/system-test/2-query/test_ts4467.py b/tests/system-test/2-query/test_ts4467.py
new file mode 100644
index 0000000000..4e09a9fbbe
--- /dev/null
+++ b/tests/system-test/2-query/test_ts4467.py
@@ -0,0 +1,63 @@
+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 TS-4467
+ """
+ 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")
+
+ # table
+ tdSql.execute("create table t (ts timestamp, c1 varchar(16));")
+
+ # insert data
+ sql = "insert into t values"
+ for i in range(6):
+ sql += f"(now+{str(i+1)}s, '{'name' + str(i+1)}')"
+ sql += ";"
+ tdSql.execute(sql)
+ tdLog.debug("insert data successfully")
+
+ def run(self):
+ self.prepareData()
+
+ # join query with order by
+ sql = "select * from t t1, (select * from t order by ts limit 5) t2 where t1.ts = t2.ts;"
+ tdSql.query(sql)
+ tdSql.checkRows(5)
+
+ sql = "select * from t t1, (select * from t order by ts desc limit 5) t2 where t1.ts = t2.ts;"
+ tdSql.query(sql)
+ tdSql.checkRows(5)
+
+ sql = "select * from t t1, (select * from t order by ts limit 5) t2 where t1.ts = t2.ts order by t1.ts;"
+ tdSql.query(sql)
+ res1 = tdSql.queryResult
+ tdLog.debug("res1: %s" % str(res1))
+
+ sql = "select * from t t1, (select * from t order by ts limit 5) t2 where t1.ts = t2.ts order by t1.ts desc;"
+ tdSql.query(sql)
+ res2 = tdSql.queryResult
+ tdLog.debug("res2: %s" % str(res2))
+ assert(len(res1) == len(res2) and res1[0][0] == res2[4][0])
+
+ 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/tmq_taosx.py b/tests/system-test/7-tmq/tmq_taosx.py
index 5bd70a5d60..ac8a6f377c 100644
--- a/tests/system-test/7-tmq/tmq_taosx.py
+++ b/tests/system-test/7-tmq/tmq_taosx.py
@@ -311,44 +311,57 @@ class TDTestCase:
return
- def consumeExcluded(self):
- tdSql.execute(f'create topic topic_excluded as database db_taosx')
+ def consumeTest(self):
+ tdSql.execute(f'create database if not exists d1 vgroups 1')
+ tdSql.execute(f'use d1')
+ tdSql.execute(f'create table st(ts timestamp, i int) tags(t int)')
+ tdSql.execute(f'insert into t1 using st tags(1) values(now, 1) (now+1s, 2)')
+ tdSql.execute(f'insert into t2 using st tags(2) values(now, 1) (now+1s, 2)')
+ tdSql.execute(f'insert into t3 using st tags(3) values(now, 1) (now+1s, 2)')
+ tdSql.execute(f'insert into t1 using st tags(1) values(now+5s, 11) (now+10s, 12)')
+
+ tdSql.query("select * from st")
+ tdSql.checkRows(8)
+
+ tdSql.execute(f'create topic topic_excluded with meta as database d1')
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")
+ index = 0
try:
while True:
res = consumer.poll(1)
if not res:
+ if index != 1:
+ tdLog.exit("consume error")
break
- err = res.error()
- if err is not None:
- raise err
val = res.value()
-
+ if val is None:
+ continue
+ cnt = 0;
for block in val:
- print(block.fetchall())
+ cnt += len(block.fetchall())
+ if cnt != 8:
+ tdLog.exit("consume error")
+
+ index += 1
finally:
consumer.close()
def run(self):
+ self.consumeTest()
+
tdSql.prepare()
self.checkWal1VgroupOnlyMeta()
@@ -362,7 +375,6 @@ class TDTestCase:
self.checkSnapshotMultiVgroups()
self.checkWalMultiVgroupsWithDropTable()
- # self.consumeExcluded()
self.checkSnapshotMultiVgroupsWithDropTable()