diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0436f5b25923927edaa7568ba57c7b948446f8b1..8fe6cc69e05e47b9d9ecfd1b8534d215f597e033 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.16)
+cmake_minimum_required(VERSION 3.0)
project(
TDengine
diff --git a/cmake/cmake.define b/cmake/cmake.define
index a8bab17aba8a412099b34c6d82c9787468bc89e8..5637c666b99294a536288741948877450cdb9eb5 100644
--- a/cmake/cmake.define
+++ b/cmake/cmake.define
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.16)
+cmake_minimum_required(VERSION 3.0)
set(CMAKE_VERBOSE_MAKEFILE OFF)
diff --git a/cmake/cmake.platform b/cmake/cmake.platform
index 0312f92a5b4116cad03d4bb9c2e7556d7a35deb2..acf17e9427bc453e1ece67cca5cbfe45f8827337 100644
--- a/cmake/cmake.platform
+++ b/cmake/cmake.platform
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.16)
+cmake_minimum_required(VERSION 3.0)
MESSAGE("Current system is ${CMAKE_SYSTEM_NAME}")
diff --git a/docs-cn/07-develop/03-insert-data/01-sql-writing.mdx b/docs-cn/07-develop/03-insert-data/01-sql-writing.mdx
index e63ffce6dd07366da99fe1f41d0a2a8d7a623f31..99a92573c87d0f90f699a8d1352619f4df4aef39 100644
--- a/docs-cn/07-develop/03-insert-data/01-sql-writing.mdx
+++ b/docs-cn/07-develop/03-insert-data/01-sql-writing.mdx
@@ -52,7 +52,7 @@ INSERT INTO d1001 VALUES (1538548685000, 10.3, 219, 0.31) (1538548695000, 12.6,
:::info
-- 要提高写入效率,需要批量写入。一批写入的记录条数越多,插入效率就越高。但一条记录不能超过 16K,一条 SQL 语句总长度不能超过 1M 。
+- 要提高写入效率,需要批量写入。一批写入的记录条数越多,插入效率就越高。但一条记录不能超过 48K,一条 SQL 语句总长度不能超过 1M 。
- TDengine 支持多线程同时写入,要进一步提高写入速度,一个客户端需要打开 20 个以上的线程同时写。但线程数达到一定数量后,无法再提高,甚至还会下降,因为线程频繁切换,带来额外开销。
:::
diff --git a/docs-cn/12-taos-sql/01-data-type.md b/docs-cn/12-taos-sql/01-data-type.md
index be5c9a8cb4ed7f4ed9f9c7e11faf1b0f8f6e51b8..8ac6ee3b872bd31f616ea0aea3fd4a093abb4402 100644
--- a/docs-cn/12-taos-sql/01-data-type.md
+++ b/docs-cn/12-taos-sql/01-data-type.md
@@ -4,6 +4,8 @@ title: 支持的数据类型
description: "TDengine 支持的数据类型: 时间戳、浮点型、JSON 类型等"
---
+## 时间戳
+
使用 TDengine,最重要的是时间戳。创建并插入记录、查询历史记录的时候,均需要指定时间戳。时间戳有如下规则:
- 时间格式为 `YYYY-MM-DD HH:mm:ss.MS`,默认时间分辨率为毫秒。比如:`2017-08-12 18:25:58.128`
@@ -12,39 +14,59 @@ description: "TDengine 支持的数据类型: 时间戳、浮点型、JSON 类
- Epoch Time:时间戳也可以是一个长整数,表示从格林威治时间 1970-01-01 00:00:00.000 (UTC/GMT) 开始的毫秒数(相应地,如果所在 Database 的时间精度设置为“微秒”,则长整型格式的时间戳含义也就对应于从格林威治时间 1970-01-01 00:00:00.000 (UTC/GMT) 开始的微秒数;纳秒精度逻辑类似。)
- 时间可以加减,比如 now-2h,表明查询时刻向前推 2 个小时(最近 2 小时)。数字后面的时间单位可以是 b(纳秒)、u(微秒)、a(毫秒)、s(秒)、m(分)、h(小时)、d(天)、w(周)。 比如 `select * from t1 where ts > now-2w and ts <= now-1w`,表示查询两周前整整一周的数据。在指定降采样操作(down sampling)的时间窗口(interval)时,时间单位还可以使用 n (自然月) 和 y (自然年)。
-TDengine 缺省的时间戳精度是毫秒,但通过在 `CREATE DATABASE` 时传递的 PRECISION 参数也可以支持微秒和纳秒。(从 2.1.5.0 版本开始支持纳秒精度)
+TDengine 缺省的时间戳精度是毫秒,但通过在 `CREATE DATABASE` 时传递的 PRECISION 参数也可以支持微秒和纳秒。
```sql
CREATE DATABASE db_name PRECISION 'ns';
```
+## 数据类型
-在 TDengine 中,普通表的数据模型中可使用以下 10 种数据类型。
+在 TDengine 中,普通表的数据模型中可使用以下数据类型。
| # | **类型** | **Bytes** | **说明** |
| --- | :-------: | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| 1 | TIMESTAMP | 8 | 时间戳。缺省精度毫秒,可支持微秒和纳秒。从格林威治时间 1970-01-01 00:00:00.000 (UTC/GMT) 开始,计时不能早于该时间。(从 2.0.18.0 版本开始,已经去除了这一时间范围限制)(从 2.1.5.0 版本开始支持纳秒精度) |
-| 2 | INT | 4 | 整型,范围 [-2^31+1, 2^31-1], -2^31 用作 NULL |
-| 3 | BIGINT | 8 | 长整型,范围 [-2^63+1, 2^63-1], -2^63 用作 NULL |
-| 4 | FLOAT | 4 | 浮点型,有效位数 6-7,范围 [-3.4E38, 3.4E38] |
-| 5 | DOUBLE | 8 | 双精度浮点型,有效位数 15-16,范围 [-1.7E308, 1.7E308] |
-| 6 | BINARY | 自定义 | 记录单字节字符串,建议只用于处理 ASCII 可见字符,中文等多字节字符需使用 nchar。理论上,最长可以有 16374 字节。binary 仅支持字符串输入,字符串两端需使用单引号引用。使用时须指定大小,如 binary(20) 定义了最长为 20 个单字节字符的字符串,每个字符占 1 byte 的存储空间,总共固定占用 20 bytes 的空间,此时如果用户字符串超出 20 字节将会报错。对于字符串内的单引号,可以用转义字符反斜线加单引号来表示,即 `\’`。 |
-| 7 | SMALLINT | 2 | 短整型, 范围 [-32767, 32767], -32768 用作 NULL |
-| 8 | TINYINT | 1 | 单字节整型,范围 [-127, 127], -128 用作 NULL |
-| 9 | BOOL | 1 | 布尔型,{true, false} |
-| 10 | NCHAR | 自定义 | 记录包含多字节字符在内的字符串,如中文字符。每个 nchar 字符占用 4 bytes 的存储空间。字符串两端使用单引号引用,字符串内的单引号需用转义字符 `\’`。nchar 使用时须指定字符串大小,类型为 nchar(10) 的列表示此列的字符串最多存储 10 个 nchar 字符,会固定占用 40 bytes 的空间。如果用户字符串长度超出声明长度,将会报错。 |
-| 11 | JSON | | json 数据类型, 只有 tag 可以是 json 格式 |
-
-:::tip
-TDengine 对 SQL 语句中的英文字符不区分大小写,自动转化为小写执行。因此用户大小写敏感的字符串及密码,需要使用单引号将字符串引起来。
+| 1 | TIMESTAMP | 8 | 时间戳。缺省精度毫秒,可支持微秒和纳秒,详细说明见上节。 |
+| 2 | INT | 4 | 整型,范围 [-2^31, 2^31-1] |
+| 3 | INT UNSIGNED| 4| 无符号整数,[0, 2^32-1]
+| 4 | BIGINT | 8 | 长整型,范围 [-2^63, 2^63-1] |
+| 5 | BIGINT UNSIGNED | 8 | 长整型,范围 [0, 2^64-1] |
+| 6 | FLOAT | 4 | 浮点型,有效位数 6-7,范围 [-3.4E38, 3.4E38] |
+| 7 | DOUBLE | 8 | 双精度浮点型,有效位数 15-16,范围 [-1.7E308, 1.7E308] |
+| 8 | BINARY | 自定义 | 记录单字节字符串,建议只用于处理 ASCII 可见字符,中文等多字节字符需使用 nchar。 |
+| 9 | SMALLINT | 2 | 短整型, 范围 [-32768, 32767] |
+| 10 | SMALLINT UNSIGNED | 2| 无符号短整型,范围 [0, 655357] |
+| 11 | TINYINT | 1 | 单字节整型,范围 [-128, 127] |
+| 12 | TINYINT UNSIGNED | 1 | 无符号单字节整型,范围 [0, 255] |
+| 13 | BOOL | 1 | 布尔型,{true, false} |
+| 14 | NCHAR | 自定义 | 记录包含多字节字符在内的字符串,如中文字符。每个 nchar 字符占用 4 bytes 的存储空间。字符串两端使用单引号引用,字符串内的单引号需用转义字符 `\’`。nchar 使用时须指定字符串大小,类型为 nchar(10) 的列表示此列的字符串最多存储 10 个 nchar 字符,会固定占用 40 bytes 的空间。如果用户字符串长度超出声明长度,将会报错。 |
+| 15 | JSON | | json 数据类型, 只有 tag 可以是 json 格式 |
+| 16 | VARCHAR | 自定义 | BINARY类型的别名 |
-:::
:::note
-虽然 BINARY 类型在底层存储上支持字节型的二进制字符,但不同编程语言对二进制数据的处理方式并不保证一致,因此建议在 BINARY 类型中只存储 ASCII 可见字符,而避免存储不可见字符。多字节的数据,例如中文字符,则需要使用 NCHAR 类型进行保存。如果强行使用 BINARY 类型保存中文字符,虽然有时也能正常读写,但并不带有字符集信息,很容易出现数据乱码甚至数据损坏等情况。
+- TDengine 对 SQL 语句中的英文字符不区分大小写,自动转化为小写执行。因此用户大小写敏感的字符串及密码,需要使用单引号将字符串引起来。
+- 虽然 BINARY 类型在底层存储上支持字节型的二进制字符,但不同编程语言对二进制数据的处理方式并不保证一致,因此建议在 BINARY 类型中只存储 ASCII 可见字符,而避免存储不可见字符。多字节的数据,例如中文字符,则需要使用 NCHAR 类型进行保存。如果强行使用 BINARY 类型保存中文字符,虽然有时也能正常读写,但并不带有字符集信息,很容易出现数据乱码甚至数据损坏等情况。
+- BINARY 类型理论上最长可以有 16374 字节。binary 仅支持字符串输入,字符串两端需使用单引号引用。使用时须指定大小,如 binary(20) 定义了最长为 20 个单字节字符的字符串,每个字符占 1 byte 的存储空间,总共固定占用 20 bytes 的空间,此时如果用户字符串超出 20 字节将会报错。对于字符串内的单引号,可以用转义字符反斜线加单引号来表示,即 `\’`。
+- SQL 语句中的数值类型将依据是否存在小数点,或使用科学计数法表示,来判断数值类型是否为整型或者浮点型,因此在使用时要注意相应类型越界的情况。例如,9999999999999999999 会认为超过长整型的上边界而溢出,而 9999999999999999999.0 会被认为是有效的浮点数。
:::
+
+## 常量
+TDengine支持多个类型的常量,细节如下表:
+
+| # | **语法** | **类型** | **说明** |
+| --- | :-------: | --------- | -------------------------------------- |
+| 1 | [{+ \| -}]123 | BIGINT | 整型数值的字面量的类型均为BIGINT。如果用户输入超过了BIGINT的表示范围,TDengine 按BIGINT对数值进行截断。|
+| 2 | 123.45 | DOUBLE | 浮点数值的字面量的类型均为DOUBLE。TDengine依据是否存在小数点,或使用科学计数法表示,来判断数值类型是否为整型或者浮点型。|
+| 3 | 1.2E3 | DOUBLE | 科学计数法的字面量的类型为DOUBLE。|
+| 4 | 'abc' | BINARY | 单引号括住的内容为字符串字面值,其类型为BINARY,BINARY的size为实际的字符个数。对于字符串内的单引号,可以用转义字符反斜线加单引号来表示,即 \'。|
+| 5 | "abc" | BINARY | 双引号括住的内容为字符串字面值,其类型为BINARY,BINARY的size为实际的字符个数。对于字符串内的双引号,可以用转义字符反斜线加单引号来表示,即 \"。 |
+| 6 | TIMESTAMP {'literal' \| "literal"} | TIMESTAMP | TIMESTAMP关键字表示后面的字符串字面量需要被解释为TIMESTAMP类型。字符串需要满足YYYY-MM-DD HH:mm:ss.MS格式,其时间分辨率为当前数据库的时间分辨率。 |
+| 7 | {TRUE \| FALSE} | BOOL | 布尔类型字面量。 |
+| 8 | {'' \| "" \| '\t' \| "\t" \| ' ' \| " " \| NULL } | -- | 空值字面量。可以用于任意类型。|
+
:::note
-SQL 语句中的数值类型将依据是否存在小数点,或使用科学计数法表示,来判断数值类型是否为整型或者浮点型,因此在使用时要注意相应类型越界的情况。例如,9999999999999999999 会认为超过长整型的上边界而溢出,而 9999999999999999999.0 会被认为是有效的浮点数。
+- TDengine依据是否存在小数点,或使用科学计数法表示,来判断数值类型是否为整型或者浮点型,因此在使用时要注意相应类型越界的情况。例如,9999999999999999999会认为超过长整型的上边界而溢出,而9999999999999999999.0会被认为是有效的浮点数。
:::
diff --git a/docs-cn/12-taos-sql/03-table.md b/docs-cn/12-taos-sql/03-table.md
index 675c157b3def0d670f771f55b767f3ca4f2a28af..d7235f312933ec46ed427d5da7e2c5a229fa2926 100644
--- a/docs-cn/12-taos-sql/03-table.md
+++ b/docs-cn/12-taos-sql/03-table.md
@@ -12,7 +12,7 @@ CREATE TABLE [IF NOT EXISTS] tb_name (timestamp_field_name TIMESTAMP, field1_nam
1. 表的第一个字段必须是 TIMESTAMP,并且系统自动将其设为主键;
2. 表名最大长度为 192;
-3. 表的每行长度不能超过 16k 个字符;(注意:每个 BINARY/NCHAR 类型的列还会额外占用 2 个字节的存储位置)
+3. 表的每行长度不能超过 48KB;(注意:每个 BINARY/NCHAR 类型的列还会额外占用 2 个字节的存储位置)
4. 子表名只能由字母、数字和下划线组成,且不能以数字开头,不区分大小写
5. 使用数据类型 binary 或 nchar,需指定其最长的字节数,如 binary(20),表示 20 字节;
6. 为了兼容支持更多形式的表名,TDengine 引入新的转义符 "\`",可以让表名与关键词不冲突,同时不受限于上述表名称合法性约束检查。但是同样具有长度限制要求。使用转义字符以后,不再对转义字符中的内容进行大小写统一。
diff --git a/docs-cn/12-taos-sql/04-stable.md b/docs-cn/12-taos-sql/04-stable.md
index a3c227317c85917b64b2477994d335710610ec70..3901427736e80bc8dd0dd87b454947af6e586561 100644
--- a/docs-cn/12-taos-sql/04-stable.md
+++ b/docs-cn/12-taos-sql/04-stable.md
@@ -86,7 +86,7 @@ ALTER STABLE stb_name MODIFY COLUMN field_name data_type(length);
ALTER STABLE stb_name ADD TAG new_tag_name tag_type;
```
-为 STable 增加一个新的标签,并指定新标签的类型。标签总数不能超过 128 个,总长度不超过 16k 个字符。
+为 STable 增加一个新的标签,并指定新标签的类型。标签总数不能超过 128 个,总长度不超过 16KB 。
### 删除标签
diff --git a/docs-cn/12-taos-sql/07-function.md b/docs-cn/12-taos-sql/07-function.md
index 87929e884e7ce735fd9841d520afe7e897cb860b..b924aad042a7dd8d3a81c01030ee587f485e8da4 100644
--- a/docs-cn/12-taos-sql/07-function.md
+++ b/docs-cn/12-taos-sql/07-function.md
@@ -261,6 +261,92 @@ taos> select hyperloglog(dbig) from shll;
Query OK, 1 row(s) in set (0.008388s)
```
+### HISTOGRAM
+
+```
+SELECT HISTOGRAM(field_name,bin_type, bin_description, normalized) FROM tb_name [WHERE clause];
+```
+
+**功能说明**:统计数据按照用户指定区间的分布。
+
+**返回结果类型**:如归一化参数 normalized 设置为 1,返回结果为双精度浮点类型 DOUBLE,否则为长整形 INT64。
+
+**应用字段**:数值型字段。
+
+**支持的版本**:2.6.0.0 及以后的版本。
+
+**适用于**: 表和超级表。
+
+**说明**:
+1. bin_type 用户指定的分桶类型, 有效输入类型为"user_input“, ”linear_bin", "log_bin"。
+2. bin_description 描述如何生成分桶区间,针对三种桶类型,分别为以下描述格式(均为 JSON 格式字符串):
+ - "user_input": "[1, 3, 5, 7]"
+ 用户指定 bin 的具体数值。
+
+ - "linear_bin": "{"start": 0.0, "width": 5.0, "count": 5, "infinity": true}"
+ "start" 表示数据起始点,"width" 表示每次 bin 偏移量, "count" 为 bin 的总数,"infinity" 表示是否添加(-inf, inf)作为区间起点跟终点,
+ 生成区间为[-inf, 0.0, 5.0, 10.0, 15.0, 20.0, +inf]。
+
+ - "log_bin": "{"start":1.0, "factor": 2.0, "count": 5, "infinity": true}"
+ "start" 表示数据起始点,"factor" 表示按指数递增的因子,"count" 为 bin 的总数,"infinity" 表示是否添加(-inf, inf)作为区间起点跟终点,
+ 生成区间为[-inf, 1.0, 2.0, 4.0, 8.0, 16.0, +inf]。
+3. normalized 是否将返回结果归一化到 0~1 之间 。有效输入为 0 和 1。
+
+**示例**:
+
+```mysql
+taos> SELECT HISTOGRAM(voltage, "user_input", "[1,3,5,7]", 1) FROM meters;
+ histogram(voltage, "user_input", "[1,3,5,7]", 1) |
+ =======================================================
+ {"lower_bin":1, "upper_bin":3, "count":0.333333} |
+ {"lower_bin":3, "upper_bin":5, "count":0.333333} |
+ {"lower_bin":5, "upper_bin":7, "count":0.333333} |
+ Query OK, 3 row(s) in set (0.004273s)
+
+taos> SELECT HISTOGRAM(voltage, 'linear_bin', '{"start": 1, "width": 3, "count": 3, "infinity": false}', 0) FROM meters;
+ histogram(voltage, 'linear_bin', '{"start": 1, "width": 3, " |
+ ===================================================================
+ {"lower_bin":1, "upper_bin":4, "count":3} |
+ {"lower_bin":4, "upper_bin":7, "count":3} |
+ {"lower_bin":7, "upper_bin":10, "count":3} |
+ Query OK, 3 row(s) in set (0.004887s)
+
+taos> SELECT HISTOGRAM(voltage, 'log_bin', '{"start": 1, "factor": 3, "count": 3, "infinity": true}', 0) FROM meters;
+ histogram(voltage, 'log_bin', '{"start": 1, "factor": 3, "count" |
+ ===================================================================
+ {"lower_bin":-inf, "upper_bin":1, "count":3} |
+ {"lower_bin":1, "upper_bin":3, "count":2} |
+ {"lower_bin":3, "upper_bin":9, "count":6} |
+ {"lower_bin":9, "upper_bin":27, "count":3} |
+ {"lower_bin":27, "upper_bin":inf, "count":1} |
+```
+
+### ELAPSED
+
+```mysql
+SELECT ELAPSED(field_name[, time_unit]) FROM { tb_name | stb_name } [WHERE clause] [INTERVAL(interval [, offset]) [SLIDING sliding]];
+```
+
+**功能说明**:elapsed函数表达了统计周期内连续的时间长度,和twa函数配合使用可以计算统计曲线下的面积。在通过INTERVAL子句指定窗口的情况下,统计在给定时间范围内的每个窗口内有数据覆盖的时间范围;如果没有INTERVAL子句,则返回整个给定时间范围内的有数据覆盖的时间范围。注意,ELAPSED返回的并不是时间范围的绝对值,而是绝对值除以time_unit所得到的单位个数。
+
+**返回结果类型**:Double
+
+**应用字段**:Timestamp类型
+
+**支持的版本**:2.6.0.0 及以后的版本。
+
+**适用于**: 表,超级表,嵌套查询的外层查询
+
+**说明**:
+- field_name参数只能是表的第一列,即timestamp主键列。
+- 按time_unit参数指定的时间单位返回,最小是数据库的时间分辨率。time_unit参数未指定时,以数据库的时间分辨率为时间单位。
+- 可以和interval组合使用,返回每个时间窗口的时间戳差值。需要特别注意的是,除第一个时间窗口和最后一个时间窗口外,中间窗口的时间戳差值均为窗口长度。
+- order by asc/desc不影响差值的计算结果。
+- 对于超级表,需要和group by tbname子句组合使用,不可以直接使用。
+- 对于普通表,不支持和group by子句组合使用。
+- 对于嵌套查询,仅当内层查询会输出隐式时间戳列时有效。例如select elapsed(ts) from (select diff(value) from sub1)语句,diff函数会让内层查询输出隐式时间戳列,此为主键列,可以用于elapsed函数的第一个参数。相反,例如select elapsed(ts) from (select * from sub1) 语句,ts列输出到外层时已经没有了主键列的含义,无法使用elapsed函数。此外,elapsed函数作为一个与时间线强依赖的函数,形如select elapsed(ts) from (select diff(value) from st group by tbname)尽管会返回一条计算结果,但并无实际意义,这种用法后续也将被限制。
+- 不支持与leastsquares、diff、derivative、top、bottom、last_row、interp等函数混合使用。
+
## 选择函数
在使用所有的选择函数的时候,可以同时指定输出 ts 列或标签列(包括 tbname),这样就可以方便地知道被选出的值是源于哪个数据行的。
@@ -698,7 +784,7 @@ SELECT INTERP(field_name) FROM { tb_name | stb_name } WHERE ts='timestamp' [FILL
SELECT TAIL(field_name, k, offset_val) FROM {tb_name | stb_name} [WHERE clause];
```
-**功能说明**:返回跳过最后 offset_value 个,然后取连续 k 个记录,不忽略 NULL 值。offset_val 可以不输入。此时返回最后的 k 个记录。当有 offset_val 输入的情况下,该函数功能等效于 `order by ts desc LIMIT k OFFSET offset_val`。
+**功能说明**:返回跳过最后 offset_val 个,然后取连续 k 个记录,不忽略 NULL 值。offset_val 可以不输入。此时返回最后的 k 个记录。当有 offset_val 输入的情况下,该函数功能等效于 `order by ts desc LIMIT k OFFSET offset_val`。
**参数范围**:k: [1,100] offset_val: [0,100]。
@@ -1378,35 +1464,6 @@ SELECT ROUND(field_name) FROM { tb_name | stb_name } [WHERE clause];
- 该函数适用于内层查询和外层查询。
- 版本2.6.0.x后支持
-### 四则运算
-
-```
-SELECT field_name [+|-|*|/|%][Value|field_name] FROM { tb_name | stb_name } [WHERE clause];
-```
-
-**功能说明**:统计表/超级表中某列或多列间的值加、减、乘、除、取余计算结果。
-
-**返回数据类型**:双精度浮点数。
-
-**应用字段**:不能应用在 timestamp、binary、nchar、bool 类型字段。
-
-**适用于**:表、超级表。
-
-**使用说明**:
-
-- 支持两列或多列之间进行计算,可使用括号控制计算优先级;
-- NULL 字段不参与计算,如果参与计算的某行中包含 NULL,该行的计算结果为 NULL。
-
-```
-taos> SELECT current + voltage * phase FROM d1001;
-(current+(voltage*phase)) |
-============================
- 78.190000713 |
- 84.540003240 |
- 80.810000718 |
-Query OK, 3 row(s) in set (0.001046s)
-```
-
### STATECOUNT
```
diff --git a/docs-cn/12-taos-sql/09-limit.md b/docs-cn/12-taos-sql/09-limit.md
index 3c86a3862174377e6a00d046fb69627c773fe76e..7673e24a83cc1ba5335b11f29803cf9f3eae26e5 100644
--- a/docs-cn/12-taos-sql/09-limit.md
+++ b/docs-cn/12-taos-sql/09-limit.md
@@ -7,9 +7,9 @@ title: 边界限制
- 数据库名最大长度为 32。
- 表名最大长度为 192,不包括数据库名前缀和分隔符
-- 每行数据最大长度 16k 个字符, 从 2.1.7.0 版本开始,每行数据最大长度 48k 个字符(注意:数据行内每个 BINARY/NCHAR 类型的列还会额外占用 2 个字节的存储位置)。
+- 每行数据最大长度 48KB (注意:数据行内每个 BINARY/NCHAR 类型的列还会额外占用 2 个字节的存储位置)。
- 列名最大长度为 64,最多允许 4096 列,最少需要 2 列,第一列必须是时间戳。注:从 2.1.7.0 版本(不含)以前最多允许 4096 列
-- 标签名最大长度为 64,最多允许 128 个,至少要有 1 个标签,一个表中标签值的总长度不超过 16k 个字符。
+- 标签名最大长度为 64,最多允许 128 个,至少要有 1 个标签,一个表中标签值的总长度不超过 16KB 。
- SQL 语句最大长度 1048576 个字符,也可通过客户端配置参数 maxSQLLength 修改,取值范围 65480 ~ 1048576。
- SELECT 语句的查询结果,最多允许返回 4096 列(语句中的函数调用可能也会占用一些列空间),超限时需要显式指定较少的返回数据列,以避免语句执行报错。注: 2.1.7.0 版本(不含)之前为最多允许 1024 列
- 库的数目,超级表的数目、表的数目,系统不做限制,仅受系统资源限制。
diff --git a/docs-cn/12-taos-sql/12-keywords/index.md b/docs-cn/12-taos-sql/12-keywords.md
similarity index 71%
rename from docs-cn/12-taos-sql/12-keywords/index.md
rename to docs-cn/12-taos-sql/12-keywords.md
index 608d4e080967cfd97072706cf0963ae669960be6..0e8e1edfee4a4aa3f05ef7bfd99ca156e44afd2e 100644
--- a/docs-cn/12-taos-sql/12-keywords/index.md
+++ b/docs-cn/12-taos-sql/12-keywords.md
@@ -23,17 +23,17 @@ title: TDengine 参数限制与保留关键字
去掉了 `` ‘“`\ `` (单双引号、撇号、反斜杠、空格)
- 数据库名:不能包含“.”以及特殊字符,不能超过 32 个字符
-- 表名:不能包含“.”以及特殊字符,与所属数据库名一起,不能超过 192 个字符,每行数据最大长度 16k 个字符
-- 表的列名:不能包含特殊字符,不能超过 64 个字符
+- 表名:不能包含“.”以及特殊字符,与所属数据库名一起,不能超过 192 个字节 ,每行数据最大长度 48KB
+- 表的列名:不能包含特殊字符,不能超过 64 个字节
- 数据库名、表名、列名,都不能以数字开头,合法的可用字符集是“英文字符、数字和下划线”
- 表的列数:不能超过 1024 列,最少需要 2 列,第一列必须是时间戳(从 2.1.7.0 版本开始,改为最多支持 4096 列)
-- 记录的最大长度:包括时间戳 8 byte,不能超过 16KB(每个 BINARY/NCHAR 类型的列还会额外占用 2 个 byte 的存储位置)
-- 单条 SQL 语句默认最大字符串长度:1048576 byte,但可通过系统配置参数 maxSQLLength 修改,取值范围 65480 ~ 1048576 byte
+- 记录的最大长度:包括时间戳 8 字节,不能超过 48KB(每个 BINARY/NCHAR 类型的列还会额外占用 2 个 字节 的存储位置)
+- 单条 SQL 语句默认最大字符串长度:1048576 字节,但可通过系统配置参数 maxSQLLength 修改,取值范围 65480 ~ 1048576 字节
- 数据库副本数:不能超过 3
-- 用户名:不能超过 23 个 byte
-- 用户密码:不能超过 15 个 byte
+- 用户名:不能超过 23 个 字节
+- 用户密码:不能超过 15 个 字节
- 标签(Tags)数量:不能超过 128 个,可以 0 个
-- 标签的总长度:不能超过 16K byte
+- 标签的总长度:不能超过 16KB
- 记录条数:仅受存储空间限制
- 表的个数:仅受节点个数限制
- 库的个数:仅受节点个数限制
@@ -85,3 +85,44 @@ title: TDengine 参数限制与保留关键字
| CONNECTIONS | HAVING | NOT | SOFFSET | VNODES |
| CONNS | ID | NOTNULL | STABLE | WAL |
| COPY | IF | NOW | STABLES | WHERE |
+| _C0 | _QSTART | _QSTOP | _QDURATION | _WSTART |
+| _WSTOP | _WDURATION | _ROWTS |
+
+## 特殊说明
+### TBNAME
+`TBNAME` 可以视为超级表中一个特殊的标签,代表子表的表名。
+
+获取一个超级表所有的子表名及相关的标签信息:
+```mysql
+SELECT TBNAME, location FROM meters;
+
+统计超级表下辖子表数量:
+```mysql
+SELECT COUNT(TBNAME) FROM meters;
+```
+
+以上两个查询均只支持在WHERE条件子句中添加针对标签(TAGS)的过滤条件。例如:
+```mysql
+taos> SELECT TBNAME, location FROM meters;
+ tbname | location |
+==================================================================
+ d1004 | California.SanFrancisco |
+ d1003 | California.SanFrancisco |
+ d1002 | California.LosAngeles |
+ d1001 | California.LosAngeles |
+Query OK, 4 row(s) in set (0.000881s)
+
+taos> SELECT COUNT(tbname) FROM meters WHERE groupId > 2;
+ count(tbname) |
+========================
+ 2 |
+Query OK, 1 row(s) in set (0.001091s)
+```
+### _QSTART/_QSTOP/_QDURATION
+表示查询过滤窗口的起始,结束以及持续时间。
+
+### _WSTART/_WSTOP/_WDURATION
+窗口切分聚合查询(例如 interval/session window/state window)中表示每个切分窗口的起始,结束以及持续时间。
+
+### _c0/_ROWTS
+_c0 _ROWTS 等价,表示表或超级表的第一列
diff --git a/docs-cn/12-taos-sql/12-keywords/_category_.yml b/docs-cn/12-taos-sql/12-keywords/_category_.yml
deleted file mode 100644
index 67738650a4564477f017542aea81767b3de72922..0000000000000000000000000000000000000000
--- a/docs-cn/12-taos-sql/12-keywords/_category_.yml
+++ /dev/null
@@ -1 +0,0 @@
-label: 参数限制与保留关键字
\ No newline at end of file
diff --git a/docs-cn/12-taos-sql/13-operators.md b/docs-cn/12-taos-sql/13-operators.md
new file mode 100644
index 0000000000000000000000000000000000000000..44809882864ff318ec785189a1c086e4b0eb32f1
--- /dev/null
+++ b/docs-cn/12-taos-sql/13-operators.md
@@ -0,0 +1,71 @@
+---
+sidebar_label: 运算符
+title: 运算符
+---
+
+## 算术运算符
+
+| # | **运算符** | **支持的类型** | **说明** |
+| --- | :--------: | -------------- | -------------------------- |
+| 1 | +, - | 数值类型 | 表达正数和负数,一元运算符 |
+| 2 | +, - | 数值类型 | 表示加法和减法,二元运算符 |
+| 3 | \*, / | 数值类型 | 表示乘法和除法,二元运算符 |
+| 4 | % | 数值类型 | 表示取余运算,二元运算符 |
+
+## 位运算符
+
+| # | **运算符** | **支持的类型** | **说明** |
+| --- | :--------: | -------------- | ------------------ |
+| 1 | & | 数值类型 | 按位与,二元运算符 |
+| 2 | \| | 数值类型 | 按位或,二元运算符 |
+
+## JSON 运算符
+
+`->` 运算符可以对 JSON 类型的列按键取值。->左侧是列标识符,右侧是键的字符串常量,如 col->'name',返回键'name'的值。
+
+## 集合运算符
+
+集合运算符将两个查询的结果合并为一个结果。包含集合运算符的查询称之为复合查询。复合查询中每条查询的选择列表中的相应表达式在数量上必须匹配,并且必须位于同一数据类型组中(如数值类型或字符串类型)。
+
+- 对于字符串类型数据,返回值的数据类型按如下方式确定:
+ - 如果具有相同的类型(都为 BINARY 或都为 NCHAR),则返回此类型,并以较大的长度作为返回值长度。
+ - 如果具有不同的类型,则返回 BINARY 类型,并以较大的长度(NCHAR 类型长度按四倍计算)作为返回值长度。
+- 对于数值类型数据,返回值的数据类型是数字表达范围较大的那个。
+
+TDengine 支持 `UNION ALL` 操作符。UNION ALL 将查询返回的结果集合并返回,并不去重。在同一个 SQL 语句中,UNION ALL 最多支持 100 个。
+
+## 比较运算符
+
+| # | **运算符** | **支持的类型** | **说明** |
+| --- | :---------------: | -------------------------------------------------------------------- | -------------------- |
+| 1 | = | 除 BLOB、MEDIUMBLOB 和 JSON 外的所有类型 | 相等 |
+| 2 | <\>, != | 除 BLOB、MEDIUMBLOB 和 JSON 外的所有类型,且不可以为表的时间戳主键列 | 不相等 |
+| 3 | \>, \< | 除 BLOB、MEDIUMBLOB 和 JSON 外的所有类型 | 大于,小于 |
+| 4 | \>=, \<= | 除 BLOB、MEDIUMBLOB 和 JSON 外的所有类型 | 大于等于,小于等于 |
+| 5 | IS [NOT] NULL | 所有类型 | 是否为空值 |
+| 6 | [NOT] BETWEEN AND | 除 BOOL、BLOB、MEDIUMBLOB 和 JSON 外的所有类型 | 闭区间比较 |
+| 7 | IN | 除 BLOB、MEDIUMBLOB 和 JSON 外的所有类型,且不可以为表的时间戳主键列 | 与列表内的任意值相等 |
+| 8 | LIKE | BINARY、NCHAR 和 VARCHAR | 通配符匹配 |
+| 9 | MATCH, NMATCH | BINARY、NCHAR 和 VARCHAR | 正则表达式匹配 |
+| 10 | CONTAINS | JSON | JSON 中是否存在某键 |
+
+LIKE 条件使用通配符字符串进行匹配检查,规则如下:
+
+- '%'(百分号)匹配 0 到任意个字符;'\_'(下划线)匹配单个任意 ASCII 字符。
+- 如果希望匹配字符串中原本就带有的 \_(下划线)字符,那么可以在通配符字符串中写作 \_,即加一个反斜线来进行转义。
+- 通配符字符串最长不能超过 100 字节。不建议使用太长的通配符字符串,否则将有可能严重影响 LIKE 操作的执行性能。
+
+MATCH 条件和 NMATCH 条件使用正则表达式进行匹配,规则如下:
+
+- 支持符合 POSIX 规范的正则表达式,具体规范内容可参见 Regular Expressions。
+- 只能针对子表名(即 tbname)、字符串类型的标签值进行正则表达式过滤,不支持普通列的过滤。
+- 正则匹配字符串长度不能超过 128 字节。可以通过参数 maxRegexStringLen 设置和调整最大允许的正则匹配字符串,该参数是客户端配置参数,需要重启客户端才能生效
+
+## 逻辑运算符
+
+| # | **运算符** | **支持的类型** | **说明** |
+| --- | :--------: | -------------- | --------------------------------------------------------------------------- |
+| 1 | AND | BOOL | 逻辑与,如果两个条件均为 TRUE, 则返回 TRUE。如果任一为 FALSE,则返回 FALSE |
+| 2 | OR | BOOL | 逻辑或,如果任一条件为 TRUE, 则返回 TRUE。如果两者都是 FALSE,则返回 FALSE |
+
+TDengine 在计算逻辑条件时,会进行短路径优化,即对于 AND,第一个条件为 FALSE,则不再计算第二个条件,直接返回 FALSE;对于 OR,第一个条件为 TRUE,则不再计算第二个条件,直接返回 TRUE。
diff --git a/docs-cn/14-reference/03-connector/node.mdx b/docs-cn/14-reference/03-connector/node.mdx
index 12345fa9fe995c41828df07703f0efb61a2e029d..9f2bed9e97cb33aeabfce3d69dc3774931b426c0 100644
--- a/docs-cn/14-reference/03-connector/node.mdx
+++ b/docs-cn/14-reference/03-connector/node.mdx
@@ -14,7 +14,6 @@ import NodeInfluxLine from "../../07-develop/03-insert-data/_js_line.mdx";
import NodeOpenTSDBTelnet from "../../07-develop/03-insert-data/_js_opts_telnet.mdx";
import NodeOpenTSDBJson from "../../07-develop/03-insert-data/_js_opts_json.mdx";
import NodeQuery from "../../07-develop/04-query-data/_js.mdx";
-import NodeAsyncQuery from "../../07-develop/04-query-data/_js_async.mdx";
`td2.0-connector` 和 `td2.0-rest-connector` 是 TDengine 的官方 Node.js 语言连接器。Node.js 开发人员可以通过它开发可以存取 TDengine 集群数据的应用软件。
@@ -189,14 +188,8 @@ let cursor = conn.cursor();
### 查询数据
-#### 同步查询
-
-#### 异步查询
-
-
-
## 更多示例程序
| 示例程序 | 示例程序描述 |
diff --git a/docs-cn/14-reference/06-taosdump.md b/docs-cn/14-reference/06-taosdump.md
index 7131493ec9439225d8047288ed86026c887f0aac..3a9f2e9acd215be102991a1d91fba285ef6315bb 100644
--- a/docs-cn/14-reference/06-taosdump.md
+++ b/docs-cn/14-reference/06-taosdump.md
@@ -38,7 +38,7 @@ taosdump 有两种安装方式:
:::tip
- taosdump 1.4.1 之后的版本提供 `-I` 参数,用于解析 avro 文件 schema 和数据,如果指定 `-s` 参数将只解析 schema。
-- taosdump 1.4.2 之后的备份使用 `-B` 参数指定的批次数,默认值为 16384,如果在某些环境下由于网络速度或磁盘性能不足导致 "Error actual dump .. batch .." 可以通过 `-B` 参数挑战为更小的值进行尝试。
+- taosdump 1.4.2 之后的备份使用 `-B` 参数指定的批次数,默认值为 16384,如果在某些环境下由于网络速度或磁盘性能不足导致 "Error actual dump .. batch .." 可以通过 `-B` 参数调整为更小的值进行尝试。
:::
diff --git a/docs-cn/14-reference/13-schemaless/13-schemaless.md b/docs-cn/14-reference/13-schemaless/13-schemaless.md
index 4de310c248d7763690acef80cdca1c50f609d63b..f2712f2814593bddd65401cb129c8c58ee55a316 100644
--- a/docs-cn/14-reference/13-schemaless/13-schemaless.md
+++ b/docs-cn/14-reference/13-schemaless/13-schemaless.md
@@ -82,7 +82,7 @@ st,t1=3,t2=4,t3=t3 c1=3i64,c3="passit",c2=false,c4=4f64 1626006833639000000
:::tip
无模式所有的处理逻辑,仍会遵循 TDengine 对数据结构的底层限制,例如每行数据的总长度不能超过
-16k 字节。这方面的具体限制约束请参见 [TAOS SQL 边界限制](/taos-sql/limit)
+48KB。这方面的具体限制约束请参见 [TAOS SQL 边界限制](/taos-sql/limit)
:::
diff --git a/docs-cn/20-third-party/11-kafka.md b/docs-cn/20-third-party/11-kafka.md
index 0de5b43a396fa3bb4aba558308f95cb0d6f96bc5..8369806adcfe1b195348e7d60160609cde9150e8 100644
--- a/docs-cn/20-third-party/11-kafka.md
+++ b/docs-cn/20-third-party/11-kafka.md
@@ -7,7 +7,7 @@ TDengine Kafka Connector 包含两个插件: TDengine Source Connector 和 TDeng
## 什么是 Kafka Connect?
-Kafka Connect 是 Apache Kafka 的一个组件,用于使其它系统,比如数据库、云服务、文件系统等能方便地连接到 Kafka。数据既可以通过 Kafka Connect 从其它系统流向 Kafka, 也可以通过 Kafka Connect 从 Kafka 流向其它系统。从其它系统读数据的插件称为 Source Connector, 写数据到其它系统的插件称为 Sink Connector。Source Connector 和 Sink Connector 都不会直接连接 Kafka Broker,Source Connector 把数据转交给 Kafka Connect。Sink Connector 从 Kafka Connect 接收数据。
+Kafka Connect 是 [Apache Kafka](https://kafka.apache.org/) 的一个组件,用于使其它系统,比如数据库、云服务、文件系统等能方便地连接到 Kafka。数据既可以通过 Kafka Connect 从其它系统流向 Kafka, 也可以通过 Kafka Connect 从 Kafka 流向其它系统。从其它系统读数据的插件称为 Source Connector, 写数据到其它系统的插件称为 Sink Connector。Source Connector 和 Sink Connector 都不会直接连接 Kafka Broker,Source Connector 把数据转交给 Kafka Connect。Sink Connector 从 Kafka Connect 接收数据。

@@ -17,7 +17,7 @@ TDengine Source Connector 用于把数据实时地从 TDengine 读出来发送
## 什么是 Confluent?
-Confluent 在 Kafka 的基础上增加很多扩展功能。包括:
+[Confluent](https://www.confluent.io/) 在 Kafka 的基础上增加很多扩展功能。包括:
1. Schema Registry
2. REST 代理
@@ -81,10 +81,10 @@ Development: false
git clone https://github.com:taosdata/kafka-connect-tdengine.git
cd kafka-connect-tdengine
mvn clean package
-unzip -d $CONFLUENT_HOME/share/confluent-hub-components/ target/components/packages/taosdata-kafka-connect-tdengine-0.1.0.zip
+unzip -d $CONFLUENT_HOME/share/java/ target/components/packages/taosdata-kafka-connect-tdengine-*.zip
```
-以上脚本先 clone 项目源码,然后用 Maven 编译打包。打包完成后在 `target/components/packages/` 目录生成了插件的 zip 包。把这个 zip 包解压到安装插件的路径即可。安装插件的路径在配置文件 `$CONFLUENT_HOME/etc/kafka/connect-standalone.properties` 中。默认的路径为 `$CONFLUENT_HOME/share/confluent-hub-components/`。
+以上脚本先 clone 项目源码,然后用 Maven 编译打包。打包完成后在 `target/components/packages/` 目录生成了插件的 zip 包。把这个 zip 包解压到安装插件的路径即可。上面的示例中使用了内置的插件安装路径: `$CONFLUENT_HOME/share/java/`。
### 用 confluent-hub 安装
@@ -98,7 +98,7 @@ confluent local services start
```
:::note
-一定要先安装插件再启动 Confluent, 否则会出现找不到类的错误。Kafka Connect 的日志(默认路径: /tmp/confluent.xxxx/connect/logs/connect.log)中会输出成功安装的插件,据此可判断插件是否安装成功。
+一定要先安装插件再启动 Confluent, 否则加载插件会失败。
:::
:::tip
@@ -125,6 +125,61 @@ Control Center is [UP]
清空数据可执行 `rm -rf /tmp/confluent.106668`。
:::
+### 验证各个组件是否启动成功
+
+输入命令:
+
+```
+confluent local services status
+```
+
+如果各组件都启动成功,会得到如下输出:
+
+```
+Connect is [UP]
+Control Center is [UP]
+Kafka is [UP]
+Kafka REST is [UP]
+ksqlDB Server is [UP]
+Schema Registry is [UP]
+ZooKeeper is [UP]
+```
+
+### 验证插件是否安装成功
+
+在 Kafka Connect 组件完全启动后,可用以下命令列出成功加载的插件:
+
+```
+confluent local services connect plugin list
+```
+
+如果成功安装,会输出如下:
+
+```txt {4,9}
+Available Connect Plugins:
+[
+ {
+ "class": "com.taosdata.kafka.connect.sink.TDengineSinkConnector",
+ "type": "sink",
+ "version": "1.0.0"
+ },
+ {
+ "class": "com.taosdata.kafka.connect.source.TDengineSourceConnector",
+ "type": "source",
+ "version": "1.0.0"
+ },
+......
+```
+
+如果插件安装失败,请检查 Kafka Connect 的启动日志是否有异常信息,用以下命令输出日志路径:
+```
+echo `cat /tmp/confluent.current`/connect/connect.stdout
+```
+该命令的输出类似: `/tmp/confluent.104086/connect/connect.stdout`。
+
+与日志文件 `connect.stdout` 同一目录,还有一个文件名为: `connect.properties`。在这个文件的末尾,可以看到最终生效的 `plugin.path`, 它是一系列用逗号分割的路径。如果插件安装失败,很可能是因为实际的安装路径不包含在 `plugin.path` 中。
+
+
## TDengine Sink Connector 的使用
TDengine Sink Connector 的作用是同步指定 topic 的数据到 TDengine。用户无需提前创建数据库和超级表。可手动指定目标数据库的名字(见配置参数 connection.database), 也可按一定规则生成(见配置参数 connection.database.prefix)。
@@ -144,7 +199,7 @@ vi sink-demo.properties
sink-demo.properties 内容如下:
```ini title="sink-demo.properties"
-name=tdengine-sink-demo
+name=TDengineSinkConnector
connector.class=com.taosdata.kafka.connect.sink.TDengineSinkConnector
tasks.max=1
topics=meters
@@ -153,6 +208,7 @@ connection.user=root
connection.password=taosdata
connection.database=power
db.schemaless=line
+data.precision=ns
key.converter=org.apache.kafka.connect.storage.StringConverter
value.converter=org.apache.kafka.connect.storage.StringConverter
```
@@ -179,6 +235,7 @@ confluent local services connect connector load TDengineSinkConnector --config .
"connection.url": "jdbc:TAOS://127.0.0.1:6030",
"connection.user": "root",
"connector.class": "com.taosdata.kafka.connect.sink.TDengineSinkConnector",
+ "data.precision": "ns",
"db.schemaless": "line",
"key.converter": "org.apache.kafka.connect.storage.StringConverter",
"tasks.max": "1",
@@ -223,10 +280,10 @@ Database changed.
taos> select * from meters;
ts | current | voltage | phase | groupid | location |
===============================================================================================================================================================
- 2022-03-28 09:56:51.249000000 | 11.800000000 | 221.000000000 | 0.280000000 | 2 | California.LosAngeles |
- 2022-03-28 09:56:51.250000000 | 13.400000000 | 223.000000000 | 0.290000000 | 2 | California.LosAngeles |
- 2022-03-28 09:56:51.249000000 | 10.800000000 | 223.000000000 | 0.290000000 | 3 | California.LosAngeles |
- 2022-03-28 09:56:51.250000000 | 11.300000000 | 221.000000000 | 0.350000000 | 3 | California.LosAngeles |
+ 2022-03-28 09:56:51.249000000 | 11.800000000 | 221.000000000 | 0.280000000 | 2 | California.LosAngeles |
+ 2022-03-28 09:56:51.250000000 | 13.400000000 | 223.000000000 | 0.290000000 | 2 | California.LosAngeles |
+ 2022-03-28 09:56:51.249000000 | 10.800000000 | 223.000000000 | 0.290000000 | 3 | California.LosAngeles |
+ 2022-03-28 09:56:51.250000000 | 11.300000000 | 221.000000000 | 0.350000000 | 3 | California.LosAngeles |
Query OK, 4 row(s) in set (0.004208s)
```
@@ -356,21 +413,33 @@ confluent local services connect connector unload TDengineSourceConnector
2. `connection.database.prefix`: 当 connection.database 为 null 时, 目标数据库的前缀。可以包含占位符 '${topic}'。 比如 kafka_${topic}, 对于主题 'orders' 将写入数据库 'kafka_orders'。 默认 null。当为 null 时,目标数据库的名字和主题的名字是一致的。
3. `batch.size`: 分批写入每批记录数。当 Sink Connector 一次接收到的数据大于这个值时将分批写入。
4. `max.retries`: 发生错误时的最大重试次数。默认为 1。
-5. `retry.backoff.ms`: 发送错误时重试的时间间隔。单位毫秒,默认 3000。
-6. `db.schemaless`: 数据格式,必须指定为: line、json、telnet 中的一个。分别代表 InfluxDB 行协议格式、 OpenTSDB JSON 格式、 OpenTSDB Telnet 行协议格式。
+5. `retry.backoff.ms`: 发送错误时重试的时间间隔。单位毫秒,默认为 3000。
+6. `db.schemaless`: 数据格式,可选值为:
+ 1. line :代表 InfluxDB 行协议格式
+ 2. json : 代表 OpenTSDB JSON 格式
+ 3. telnet :代表 OpenTSDB Telnet 行协议格式
+7. `data.precision`: 使用 InfluxDB 行协议格式时,时间戳的精度。可选值为:
+ 1. ms : 表示毫秒
+ 2. us : 表示微秒
+ 3. ns : 表示纳秒。默认为纳秒。
### TDengine Source Connector 特有的配置
1. `connection.database`: 源数据库名称,无缺省值。
2. `topic.prefix`: 数据导入 kafka 后 topic 名称前缀。 使用 `topic.prefix` + `connection.database` 名称作为完整 topic 名。默认为空字符串 ""。
-3. `timestamp.initial`: 数据同步起始时间。格式为'yyyy-MM-dd HH:mm:ss'。默认 "1970-01-01 00:00:00"。
-4. `poll.interval.ms`: 拉取数据间隔,单位为 ms。默认 1000。
+3. `timestamp.initial`: 数据同步起始时间。格式为'yyyy-MM-dd HH:mm:ss'。默认为 "1970-01-01 00:00:00"。
+4. `poll.interval.ms`: 拉取数据间隔,单位为 ms。默认为 1000。
5. `fetch.max.rows` : 检索数据库时最大检索条数。 默认为 100。
-6. `out.format`: 数据格式。取值 line 或 json。line 表示 InfluxDB Line 协议格式, json 表示 OpenTSDB JSON 格式。默认 line。
+6. `out.format`: 数据格式。取值 line 或 json。line 表示 InfluxDB Line 协议格式, json 表示 OpenTSDB JSON 格式。默认为 line。
+
+## 其他说明
+
+1. 插件的安装位置可以自定义,请参考官方文档:https://docs.confluent.io/home/connect/self-managed/install.html#install-connector-manually。
+2. 本教程的示例程序使用了 Confluent 平台,但是 TDengine Kafka Connector 本身同样适用于独立安装的 Kafka, 且配置方法相同。关于如何在独立安装的 Kafka 环境使用 Kafka Connect 插件, 请参考官方文档: https://kafka.apache.org/documentation/#connect。
## 问题反馈
-https://github.com/taosdata/kafka-connect-tdengine/issues
+无论遇到任何问题,都欢迎在本项目的 Github 仓库反馈: https://github.com/taosdata/kafka-connect-tdengine/issues。
## 参考
diff --git a/docs-cn/27-train-faq/01-faq.md b/docs-cn/27-train-faq/01-faq.md
index b16e24d4343c146471ccf1df8ebf3111c92cd3ba..f298d7e14dec682b58a76ce1d7f1c10970ab2738 100644
--- a/docs-cn/27-train-faq/01-faq.md
+++ b/docs-cn/27-train-faq/01-faq.md
@@ -222,21 +222,9 @@ TDengine 中时间戳的时区总是由客户端进行处理,而与服务端
### 23. TDengine 2.0 都会用到哪些网络端口?
-在 TDengine 2.0 版本中,会用到以下这些网络端口(以默认端口 6030 为前提进行说明,如果修改了配置文件中的设置,那么这里列举的端口都会随之出现变化),管理员可以参考这里的信息调整防火墙设置:
-
-| 协议 | 默认端口 | 用途说明 | 修改方法 |
-| :--- | :-------- | :---------------------------------- | :------------------------------- |
-| TCP | 6030 | 客户端与服务端之间通讯。 | 由配置文件设置 serverPort 决定。 |
-| TCP | 6035 | 多节点集群的节点间通讯。 | 随 serverPort 端口变化。 |
-| TCP | 6040 | 多节点集群的节点间数据同步。 | 随 serverPort 端口变化。 |
-| TCP | 6041 | 客户端与服务端之间的 RESTful 通讯。 | 随 serverPort 端口变化。2.4.0.0 及以上版本由 taosAdapter 配置。 |
-| TCP | 6042 | Arbitrator 的服务端口。 | 随 Arbitrator 启动参数设置变化。 |
-| TCP | 6043 | TaosKeeper 监控服务端口。 | 随 TaosKeeper 启动参数设置变化。 |
-| TCP | 6044 | 支持 StatsD 的数据接入端口。 | 随 taosAdapter 启动参数设置变化( 2.4.0.0 及以上版本)。 |
-| UDP | 6045 | 支持 collectd 数据接入端口。 | 随 taosAdapter 启动参数设置变化( 2.4.0.0 及以上版本)。 |
-| TCP | 6060 | 企业版内 Monitor 服务的网络端口。 | |
-| UDP | 6030-6034 | 客户端与服务端之间通讯。 | 随 serverPort 端口变化。 |
-| UDP | 6035-6039 | 多节点集群的节点间通讯。 | 随 serverPort 端口变化。 |
+使用到的网络端口请看文档:[serverport](/reference/config/#serverport)
+
+需要注意,文档上列举的端口号都是以默认端口 6030 为前提进行说明,如果修改了配置文件中的设置,那么列举的端口都会随之出现变化,管理员可以参考上述的信息调整防火墙设置。
### 24. 为什么 RESTful 接口无响应、Grafana 无法添加 TDengine 为数据源、TDengineGUI 选了 6041 端口还是无法连接成功??
diff --git a/docs-en/05-get-started/_pkg_install.mdx b/docs-en/05-get-started/_pkg_install.mdx
index af04d2b70bda7575e57cc49a5aa60f19689113e6..cf10497c96ba1d777e45340b0312d97c127b6fcb 100644
--- a/docs-en/05-get-started/_pkg_install.mdx
+++ b/docs-en/05-get-started/_pkg_install.mdx
@@ -12,6 +12,6 @@ Between two major release versions, some beta versions may be delivered for user
For the details please refer to [Install and Uninstall](/operation/pkg-install)。
-To see the details of versions, please refer to [Download List](https://www.taosdata.com/all-downloads) and [Release Notes](https://github.com/taosdata/TDengine/releases).
+To see the details of versions, please refer to [Download List](https://tdengine.com/all-downloads) and [Release Notes](https://github.com/taosdata/TDengine/releases).
diff --git a/docs-en/07-develop/03-insert-data/01-sql-writing.mdx b/docs-en/07-develop/03-insert-data/01-sql-writing.mdx
index 498bcc8c423d64ee2847d2748c6f14d2d4c07e74..397b1a14fd76c1372c79eb88575f2bf21cb62050 100644
--- a/docs-en/07-develop/03-insert-data/01-sql-writing.mdx
+++ b/docs-en/07-develop/03-insert-data/01-sql-writing.mdx
@@ -52,7 +52,7 @@ For more details about `INSERT` please refer to [INSERT](/taos-sql/insert).
:::info
-- Inserting in batches can improve performance. Normally, the higher the batch size, the better the performance. Please note that a single row can't exceed 16K bytes and each SQL statement can't exceed 1MB.
+- Inserting in batches can improve performance. Normally, the higher the batch size, the better the performance. Please note that a single row can't exceed 48K bytes and each SQL statement can't exceed 1MB.
- Inserting with multiple threads can also improve performance. However, depending on the system resources on the application side and the server side, when the number of inserting threads grows beyond a specific point the performance may drop instead of improving. The proper number of threads needs to be tested in a specific environment to find the best number.
:::
diff --git a/docs-en/12-taos-sql/01-data-type.md b/docs-en/12-taos-sql/01-data-type.md
index 3f5a49e3135771c6c1e62bcf158a99ee30f1ed9d..d038219c8ac66db52416001f7a79c71018e2ca33 100644
--- a/docs-en/12-taos-sql/01-data-type.md
+++ b/docs-en/12-taos-sql/01-data-type.md
@@ -3,6 +3,8 @@ title: Data Types
description: "TDengine supports a variety of data types including timestamp, float, JSON and many others."
---
+## TIMESTAMP
+
When using TDengine to store and query data, the most important part of the data is timestamp. Timestamp must be specified when creating and inserting data rows. Timestamp must follow the rules below:
- The format must be `YYYY-MM-DD HH:mm:ss.MS`, the default time precision is millisecond (ms), for example `2017-08-12 18:25:58.128`
@@ -17,33 +19,51 @@ Time precision in TDengine can be set by the `PRECISION` parameter when executin
CREATE DATABASE db_name PRECISION 'ns';
```
+## Data Types
+
In TDengine, the data types below can be used when specifying a column or tag.
| # | **type** | **Bytes** | **Description** |
| --- | :-------: | --------- | ------------------------- |
| 1 | TIMESTAMP | 8 | Default precision is millisecond, microsecond and nanosecond are also supported |
-| 2 | INT | 4 | Integer, the value range is [-2^31+1, 2^31-1], while -2^31 is treated as NULL |
-| 3 | BIGINT | 8 | Long integer, the value range is [-2^63+1, 2^63-1], while -2^63 is treated as NULL |
-| 4 | FLOAT | 4 | Floating point number, the effective number of digits is 6-7, the value range is [-3.4E38, 3.4E38] |
-| 5 | DOUBLE | 8 | Double precision floating point number, the effective number of digits is 15-16, the value range is [-1.7E308, 1.7E308] |
-| 6 | BINARY | User Defined | Single-byte string for ASCII visible characters. Length must be specified when defining a column or tag of binary type. The string length can be up to 16374 bytes. The string value must be quoted with single quotes. The literal single quote inside the string must be preceded with back slash like `\'` |
-| 7 | SMALLINT | 2 | Short integer, the value range is [-32767, 32767], while -32768 is treated as NULL |
-| 8 | TINYINT | 1 | Single-byte integer, the value range is [-127, 127], while -128 is treated as NULL |
-| 9 | BOOL | 1 | Bool, the value range is {true, false} |
-| 10 | NCHAR | User Defined| Multi-Byte string that can include multi byte characters like Chinese characters. Each character of NCHAR type consumes 4 bytes storage. The string value should be quoted with single quotes. Literal single quote inside the string must be preceded with backslash, like `\’`. The length must be specified when defining a column or tag of NCHAR type, for example nchar(10) means it can store at most 10 characters of nchar type and will consume fixed storage of 40 bytes. An error will be reported if the string value exceeds the length defined. |
-| 11 | JSON | | JSON type can only be used on tags. A tag of json type is excluded with any other tags of any other type |
-
-:::tip
-TDengine is case insensitive and treats any characters in the sql command as lower case by default, case sensitive strings must be quoted with single quotes.
-
-:::
+| 2 | INT | 4 | Integer, the value range is [-2^31, 2^31-1] |
+| 3 |INT UNSIGNED|4 | Unsigned integer, the value range is [0, 2^31-1] |
+| 4 | BIGINT | 8 | Long integer, the value range is [-2^63, 2^63-1] |
+| 5 | BIGINT UNSIGNED | 8 | Unsigned long integer, the value range is [0, 2^63-1] |
+| 6 | FLOAT | 4 | Floating point number, the effective number of digits is 6-7, the value range is [-3.4E38, 3.4E38] |
+| 7 | DOUBLE | 8 | Double precision floating point number, the effective number of digits is 15-16, the value range is [-1.7E308, 1.7E308] |
+| 8 | BINARY | User Defined | Single-byte string for ASCII visible characters. Length must be specified when defining a column or tag of binary type. The string length can be up to 16374 bytes. The string value must be quoted with single quotes. The literal single quote inside the string must be preceded with back slash like `\'` |
+| 9 | SMALLINT | 2 | Short integer, the value range is [-32768, 32767] |
+| 10 | SMALLINT UNSIGNED | 2 | Unsigned short integer, the value range is [0, 32767] |
+| 11 | TINYINT | 1 | Single-byte integer, the value range is [-128, 127] |
+| 12 | TINYINT UNSIGNED | 1 | Unsigned single-byte integer, the value range is [0, 127] |
+| 13 | BOOL | 1 | Bool, the value range is {true, false} |
+| 14 | NCHAR | User Defined| Multi-Byte string that can include multi byte characters like Chinese characters. Each character of NCHAR type consumes 4 bytes storage. The string value should be quoted with single quotes. Literal single quote inside the string must be preceded with backslash, like `\’`. The length must be specified when defining a column or tag of NCHAR type, for example nchar(10) means it can store at most 10 characters of nchar type and will consume fixed storage of 40 bytes. An error will be reported if the string value exceeds the length defined. |
+| 15 | JSON | | JSON type can only be used on tags. A tag of json type is excluded with any other tags of any other type |
+| 16 | VARCHAR | User Defined| Alias of BINARY type |
:::note
-Only ASCII visible characters are suggested to be used in a column or tag of BINARY type. Multi-byte characters must be stored in NCHAR type.
+- TDengine is case insensitive and treats any characters in the sql command as lower case by default, case sensitive strings must be quoted with single quotes.
+- Only ASCII visible characters are suggested to be used in a column or tag of BINARY type. Multi-byte characters must be stored in NCHAR type.
+- Numeric values in SQL statements will be determined as integer or float type according to whether there is decimal point or whether scientific notation is used, so attention must be paid to avoid overflow. For example, 9999999999999999999 will be considered as overflow because it exceeds the upper limit of long integer, but 9999999999999999999.0 will be considered as a legal float number.
:::
+## Constants
+TDengine supports constants of multiple data type.
+
+| # | **Syntax** | **Type** | **Description** |
+| --- | :-------: | --------- | -------------------------------------- |
+| 1 | [{+ \| -}]123 | BIGINT | Numeric constants are treated as BIGINT type. The value will be truncated if it exceeds the range of BIGINT type. |
+| 2 | 123.45 | DOUBLE | Floating number constants are treated as DOUBLE type. TDengine determines whether it's a floating number based on if decimal point or scientific notation is used. |
+| 3 | 1.2E3 | DOUBLE | Constants in scientific notation are treated ad DOUBLE type. |
+| 4 | 'abc' | BINARY | String constants enclosed by single quotes are treated as BINARY type. Its size is determined as the acutal length. Single quote itself can be included by preceding backslash, i.e. `\'`, in a string constant. |
+| 5 | "abc" | BINARY | String constants enclosed by double quotes are treated as BINARY type. Its size is determined as the acutal length. Double quote itself can be included by preceding backslash, i.e. `\"`, in a string constant. |
+| 6 | TIMESTAMP {'literal' \| "literal"} | TIMESTAMP | A string constant following `TIMESTAMP` keyword is treated as TIMESTAMP type. The string should be in the format of "YYYY-MM-DD HH:mm:ss.MS". Its time precision is same as that of the current database being used. |
+| 7 | {TRUE \| FALSE} | BOOL | BOOL type contant. |
+| 8 | {'' \| "" \| '\t' \| "\t" \| ' ' \| " " \| NULL } | -- | NULL constant, it can be used for any type.|
+
:::note
-Numeric values in SQL statements will be determined as integer or float type according to whether there is decimal point or whether scientific notation is used, so attention must be paid to avoid overflow. For example, 9999999999999999999 will be considered as overflow because it exceeds the upper limit of long integer, but 9999999999999999999.0 will be considered as a legal float number.
+- TDengine determines whether it's a floating number based on if decimal point or scientific notation is used. So whether the value is determined as overflow depends on both the value and the determined type. For example, 9999999999999999999 is determined as overflow because it exceeds the upper limit of BIGINT type, while 9999999999999999999.0 is considered as a valid floating number because it is within the range of DOUBLE type.
:::
diff --git a/docs-en/12-taos-sql/03-table.md b/docs-en/12-taos-sql/03-table.md
index 0505787ff8cc597eafd8299292ebac3e0fd3d4ad..f065a8e2396583bb7a512446b513ed60056ad55e 100644
--- a/docs-en/12-taos-sql/03-table.md
+++ b/docs-en/12-taos-sql/03-table.md
@@ -14,7 +14,7 @@ CREATE TABLE [IF NOT EXISTS] tb_name (timestamp_field_name TIMESTAMP, field1_nam
1. The first column of a table MUST be of type TIMESTAMP. It is automatically set as the primary key.
2. The maximum length of the table name is 192 bytes.
-3. The maximum length of each row is 16k bytes, please note that the extra 2 bytes used by each BINARY/NCHAR column are also counted.
+3. The maximum length of each row is 48k bytes, please note that the extra 2 bytes used by each BINARY/NCHAR column are also counted.
4. The name of the subtable can only consist of characters from the English alphabet, digits and underscore. Table names can't start with a digit. Table names are case insensitive.
5. The maximum length in bytes must be specified when using BINARY or NCHAR types.
6. Escape character "\`" can be used to avoid the conflict between table names and reserved keywords, above rules will be bypassed when using escape character on table names, but the upper limit for the name length is still valid. The table names specified using escape character are case sensitive. Only ASCII visible characters can be used with escape character.
diff --git a/docs-en/12-taos-sql/07-function.md b/docs-en/12-taos-sql/07-function.md
index 825aeea354fb684e47ceed7afb2bc66d97b23c09..3589efe9cdd618110203a8439ba03eaaf315f48c 100644
--- a/docs-en/12-taos-sql/07-function.md
+++ b/docs-en/12-taos-sql/07-function.md
@@ -259,6 +259,100 @@ taos> select hyperloglog(dbig) from shll;
Query OK, 1 row(s) in set (0.008388s)
```
+### HISTOGRAM
+
+```
+SELECT HISTOGRAM(field_name,bin_type, bin_description, normalized) FROM tb_name [WHERE clause];
+```
+
+**Description**:Returns count of data points in user-specified ranges.
+
+**Return value type**:Double or INT64, depends on normalized parameter settings.
+
+**Applicable column type**:Numerical types.
+
+**Applicable versions**:Since version 2.6.0.0.
+
+**Applicable table types**: table, STable
+
+**Explanations**:
+
+1. bin_type: parameter to indicate the bucket type, valid inputs are: "user_input", "linear_bin", "log_bin"。
+2. bin_description: parameter to describe how to generate buckets,can be in the following JSON formats for each bin_type respectively:
+
+ - "user_input": "[1, 3, 5, 7]": User specified bin values.
+
+ - "linear_bin": "{"start": 0.0, "width": 5.0, "count": 5, "infinity": true}"
+ "start" - bin starting point.
+ "width" - bin offset.
+ "count" - number of bins generated.
+ "infinity" - whether to add(-inf, inf)as start/end point in generated set of bins.
+ The above "linear_bin" descriptor generates a set of bins: [-inf, 0.0, 5.0, 10.0, 15.0, 20.0, +inf].
+
+ - "log_bin": "{"start":1.0, "factor": 2.0, "count": 5, "infinity": true}"
+ "start" - bin starting point.
+ "factor" - exponential factor of bin offset.
+ "count" - number of bins generated.
+ "infinity" - whether to add(-inf, inf)as start/end point in generated range of bins.
+ The above "log_bin" descriptor generates a set of bins:[-inf, 1.0, 2.0, 4.0, 8.0, 16.0, +inf].
+
+3. normalized: setting to 1/0 to turn on/off result normalization.
+
+**Example**:
+
+```mysql
+taos> SELECT HISTOGRAM(voltage, "user_input", "[1,3,5,7]", 1) FROM meters;
+ histogram(voltage, "user_input", "[1,3,5,7]", 1) |
+ =======================================================
+ {"lower_bin":1, "upper_bin":3, "count":0.333333} |
+ {"lower_bin":3, "upper_bin":5, "count":0.333333} |
+ {"lower_bin":5, "upper_bin":7, "count":0.333333} |
+ Query OK, 3 row(s) in set (0.004273s)
+
+taos> SELECT HISTOGRAM(voltage, 'linear_bin', '{"start": 1, "width": 3, "count": 3, "infinity": false}', 0) FROM meters;
+ histogram(voltage, 'linear_bin', '{"start": 1, "width": 3, " |
+ ===================================================================
+ {"lower_bin":1, "upper_bin":4, "count":3} |
+ {"lower_bin":4, "upper_bin":7, "count":3} |
+ {"lower_bin":7, "upper_bin":10, "count":3} |
+ Query OK, 3 row(s) in set (0.004887s)
+
+taos> SELECT HISTOGRAM(voltage, 'log_bin', '{"start": 1, "factor": 3, "count": 3, "infinity": true}', 0) FROM meters;
+ histogram(voltage, 'log_bin', '{"start": 1, "factor": 3, "count" |
+ ===================================================================
+ {"lower_bin":-inf, "upper_bin":1, "count":3} |
+ {"lower_bin":1, "upper_bin":3, "count":2} |
+ {"lower_bin":3, "upper_bin":9, "count":6} |
+ {"lower_bin":9, "upper_bin":27, "count":3} |
+ {"lower_bin":27, "upper_bin":inf, "count":1} |
+```
+
+### ELAPSED
+
+```mysql
+SELECT ELAPSED(field_name[, time_unit]) FROM { tb_name | stb_name } [WHERE clause] [INTERVAL(interval [, offset]) [SLIDING sliding]];
+```
+
+**Description**:`elapsed` function can be used to calculate the continuous time length in which there is valid data. If it's used with `INTERVAL` clause, the returned result is the calcualted time length within each time window. If it's used without `INTERVAL` caluse, the returned result is the calculated time length within the specified time range. Please be noted that the return value of `elapsed` is the number of `time_unit` in the calculated time length.
+
+**Return value type**:Double
+
+**Applicable Column type**:Timestamp
+
+**Applicable versions**:Sicne version 2.6.0.0
+
+**Applicable tables**: table, STable, outter in nested query
+
+**Explanations**:
+- `field_name` parameter can only be the first column of a table, i.e. timestamp primary key.
+- The minimum value of `time_unit` is the time precision of the database. If `time_unit` is not specified, the time precision of the database is used as the default ime unit.
+- It can be used with `INTERVAL` to get the time valid time length of each time window. Please be noted that the return value is same as the time window for all time windows except for the first and the last time window.
+- `order by asc/desc` has no effect on the result.
+- `group by tbname` must be used together when `elapsed` is used against a STable.
+- `group by` must NOT be used together when `elapsed` is used against a table or sub table.
+- When used in nested query, it's only applicable when the inner query outputs an implicit timestamp column as the primary key. For example, `select elapsed(ts) from (select diff(value) from sub1)` is legal usage while `select elapsed(ts) from (select * from sub1)` is not.
+- It can't be used with `leastsquares`, `diff`, `derivative`, `top`, `bottom`, `last_row`, `interp`.
+
## Selection Functions
When any select function is used, timestamp column or tag columns including `tbname` can be specified to show that the selected value are from which rows.
diff --git a/docs-en/12-taos-sql/12-keywords.md b/docs-en/12-taos-sql/12-keywords.md
index fa750300b71251e1172dba13f91d05822f9ac1f4..8f045f48019e419d21d3bd22f432a024551c585c 100644
--- a/docs-en/12-taos-sql/12-keywords.md
+++ b/docs-en/12-taos-sql/12-keywords.md
@@ -46,3 +46,44 @@ There are about 200 keywords reserved by TDengine, they can't be used as the nam
| CONNECTIONS | HAVING | NOT | SOFFSET | VNODES |
| CONNS | ID | NOTNULL | STable | WAL |
| COPY | IF | NOW | STableS | WHERE |
+| _C0 | _QSTART | _QSTOP | _QDURATION | _WSTART |
+| _WSTOP | _WDURATION | _ROWTS |
+
+## Explanations
+### TBNAME
+`TBNAME` can be considered as a special tag, which represents the name of the subtable, in a STable.
+
+Get the table name and tag values of all subtables in a STable.
+```mysql
+SELECT TBNAME, location FROM meters;
+
+Count the number of subtables in a STable.
+```mysql
+SELECT COUNT(TBNAME) FROM meters;
+```
+
+Only filter on TAGS can be used in WHERE clause in the above two query statements.
+```mysql
+taos> SELECT TBNAME, location FROM meters;
+ tbname | location |
+==================================================================
+ d1004 | California.SanFrancisco |
+ d1003 | California.SanFrancisco |
+ d1002 | California.LosAngeles |
+ d1001 | California.LosAngeles |
+Query OK, 4 row(s) in set (0.000881s)
+
+taos> SELECT COUNT(tbname) FROM meters WHERE groupId > 2;
+ count(tbname) |
+========================
+ 2 |
+Query OK, 1 row(s) in set (0.001091s)
+```
+### _QSTART/_QSTOP/_QDURATION
+The start, stop and duration of a query time window.
+
+### _WSTART/_WSTOP/_WDURATION
+The start, stop and duration of aggegate query by time window, like interval, session window, state window.
+
+### _c0/_ROWTS
+_c0 is equal to _ROWTS, it means the first column of a table or STable.
diff --git a/docs-en/14-reference/03-connector/cpp.mdx b/docs-en/14-reference/03-connector/cpp.mdx
index 4b388d32a9050645e268bb267d16e9a5b8aa4bda..d13a74384ccc99b4200f89cdba98e5ba902e41f8 100644
--- a/docs-en/14-reference/03-connector/cpp.mdx
+++ b/docs-en/14-reference/03-connector/cpp.mdx
@@ -4,7 +4,7 @@ sidebar_label: C/C++
title: C/C++ Connector
---
-C/C++ developers can use TDengine's client driver and the C/C++ connector, to develop their applications to connect to TDengine clusters for data writing, querying, and other functions. To use it, you need to include the TDengine header file _taos.h_, which lists the function prototypes of the provided APIs; the application also needs to link to the corresponding dynamic libraries on the platform where it is located.
+C/C++ developers can use TDengine's client driver and the C/C++ connector, to develop their applications to connect to TDengine clusters for data writing, querying, and other functions. To use the C/C++ connector you must include the TDengine header file _taos.h_, which lists the function prototypes of the provided APIs. The application also needs to link to the corresponding dynamic libraries on the platform where it is located.
```c
#include
@@ -26,7 +26,7 @@ Please refer to [list of supported platforms](/reference/connector#supported-pla
## Supported versions
-The version number of the TDengine client driver and the version number of the TDengine server require one-to-one correspondence and recommend using the same version of client driver as what the TDengine server version is. Although a lower version of the client driver is compatible to work with a higher version of the server, if the first three version numbers are the same (i.e., only the fourth version number is different), but it is not recommended. It is strongly discouraged to use a higher version of the client driver to access a lower version of the TDengine server.
+The version number of the TDengine client driver and the version number of the TDengine server should be the same. A lower version of the client driver is compatible with a higher version of the server, if the first three version numbers are the same (i.e., only the fourth version number is different). For e.g. if the client version is x.y.z.1 and the server version is x.y.z.2 the client and server are compatible. But in general we do not recommend using a lower client version with a newer server version. It is also strongly discouraged to use a higher version of the client driver to access a lower version of the TDengine server.
## Installation steps
@@ -55,7 +55,7 @@ In the above example code, `taos_connect()` establishes a connection to port 603
:::note
-- If not specified, when the return value of the API is an integer, _0_ means success, the others are error codes representing the reason for failure, and when the return value is a pointer, _NULL_ means failure.
+- If not specified, when the return value of the API is an integer, _0_ means success. All others are error codes representing the reason for failure. When the return value is a pointer, _NULL_ means failure.
- All error codes and their corresponding causes are described in the `taoserror.h` file.
:::
@@ -140,13 +140,12 @@ The base API is used to do things like create database connections and provide a
- `void taos_cleanup()`
- Clean up the runtime environment and should be called before the application exits.
+ Cleans up the runtime environment and should be called before the application exits.
- ` int taos_options(TSDB_OPTION option, const void * arg, ...) `
Set client options, currently supports region setting (`TSDB_OPTION_LOCALE`), character set
-(`TSDB_OPTION_CHARSET`), time zone
-(`TSDB_OPTION_TIMEZONE`), configuration file path (`TSDB_OPTION_CONFIGDIR`) . The region setting, character set, and time zone default to the current settings of the operating system.
+(`TSDB_OPTION_CHARSET`), time zone (`TSDB_OPTION_TIMEZONE`), configuration file path (`TSDB_OPTION_CONFIGDIR`). The region setting, character set, and time zone default to the current settings of the operating system.
- `char *taos_get_client_info()`
@@ -159,7 +158,7 @@ The base API is used to do things like create database connections and provide a
- host: FQDN of any node in the TDengine cluster
- user: user name
- pass: password
- - db: database name, if the user does not provide, it can also be connected correctly, the user can create a new database through this connection, if the user provides the database name, it means that the database user has already created, the default use of the database
+ - db: the database name. Even if the user does not provide this, the connection will still work correctly. The user can create a new database through this connection. If the user provides the database name, it means that the database has already been created and the connection can be used for regular operations on the database.
- port: the port the taosd program is listening on
NULL indicates a failure. The application needs to save the returned parameters for subsequent use.
@@ -187,7 +186,7 @@ The APIs described in this subsection are all synchronous interfaces. After bein
- `TAOS_RES* taos_query(TAOS *taos, const char *sql)`
- Executes an SQL command, either a DQL, DML, or DDL statement. The `taos` parameter is a handle obtained with `taos_connect()`. You can't tell if the result failed by whether the return value is `NULL`, but by parsing the error code in the result set with the `taos_errno()` function.
+ Executes an SQL command, either a DQL, DML, or DDL statement. The `taos` parameter is a handle obtained with `taos_connect()`. If the return value is `NULL` this does not necessarily indicate a failure. You can get the error code, if any, by parsing the error code in the result set with the `taos_errno()` function.
- `int taos_result_precision(TAOS_RES *res)`
@@ -231,7 +230,7 @@ typedef struct taosField {
- ` void taos_free_result(TAOS_RES *res)`
- Frees the query result set and the associated resources. Be sure to call this API to free the resources after the query is completed. Otherwise, it may lead to a memory leak in the application. However, note that the application will crash if you call a function like `taos_consume()` to get the query results after freeing the resources.
+ Frees the query result set and the associated resources. Be sure to call this API to free the resources after the query is completed. Failing to call this, may lead to a memory leak in the application. However, note that the application will crash if you call a function like `taos_consume()` to get the query results after freeing the resources.
- `char *taos_errstr(TAOS_RES *res)`
@@ -242,7 +241,7 @@ typedef struct taosField {
Get the reason for the last API call failure. The return value is the error code.
:::note
-TDengine version 2.0 and above recommends that each thread of a database application create a separate connection or a connection pool based on threads. It is not recommended to pass the connection (TAOS\*) structure to different threads for shared use in the application. Queries, writes, etc., issued based on TAOS structures are multi-thread safe, but state quantities such as "USE statement" may interfere between threads. In addition, the C connector can dynamically create new database-oriented connections on demand (this procedure is not visible to the user), and it is recommended that `taos_close()` be called only at the final exit of the program to close the connection.
+TDengine version 2.0 and above recommends that each thread of a database application create a separate connection or a connection pool based on threads. It is not recommended to pass the connection (TAOS\*) structure to different threads for shared use in the application. Queries, writes, and other operations issued that are based on TAOS structures are multi-thread safe, but state quantities such as the "USE statement" may interfere between threads. In addition, the C connector can dynamically create new database-oriented connections on demand (this procedure is not visible to the user), and it is recommended that `taos_close()` be called only at the final exit of the program to close the connection.
:::
@@ -274,12 +273,12 @@ All TDengine's asynchronous APIs use a non-blocking call pattern. Applications c
### Parameter Binding API
-In addition to direct calls to `taos_query()` to perform queries, TDengine also provides a set of `bind` APIs that supports parameter binding, similar in style to MySQL, and currently only supports using a question mark `? ` to represent the parameter to be bound.
+In addition to direct calls to `taos_query()` to perform queries, TDengine also provides a set of `bind` APIs that supports parameter binding, similar in style to MySQL. TDengine currently only supports using a question mark `? ` to represent the parameter to be bound.
-Starting with versions 2.1.1.0 and 2.1.2.0, TDengine has significantly improved the bind APIs to support for data writing (INSERT) scenarios. This avoids the resource consumption of SQL syntax parsing when writing data through the parameter binding interface, thus significantly improving write performance in most cases. A typical operation, in this case, is as follows.
+Starting with versions 2.1.1.0 and 2.1.2.0, TDengine has significantly improved the bind APIs to support data writing (INSERT) scenarios. This avoids the resource consumption of SQL syntax parsing when writing data through the parameter binding interface, thus significantly improving write performance in most cases. A typical operation, in this case, is as follows.
1. call `taos_stmt_init()` to create the parameter binding object.
-2. call `taos_stmt_prepare()` to parse the INSERT statement. 3.
+2. call `taos_stmt_prepare()` to parse the INSERT statement.
3. call `taos_stmt_set_tbname()` to set the table name if it is reserved in the INSERT statement but not the TAGS.
4. call `taos_stmt_set_tbname_tags()` to set the table name and TAGS values if the table name and TAGS are reserved in the INSERT statement (for example, if the INSERT statement takes an automatic table build).
5. call `taos_stmt_bind_param_batch()` to set the value of VALUES in multiple columns, or call `taos_stmt_bind_param()` to set the value of VALUES in a single row.
@@ -383,7 +382,7 @@ In addition to writing data using the SQL method or the parameter binding API, w
**return value**
TAOS_RES structure, application can get error message by using `taos_errstr()` and also error code by using `taos_errno()`.
In some cases, the returned TAOS_RES is `NULL`, and it is still possible to call `taos_errno()` to safely get the error code information.
- The returned TAOS_RES needs to be freed by the caller. Otherwise, a memory leak will occur.
+ The returned TAOS_RES needs to be freed by the caller in order to avoid memory leaks.
**Description**
The protocol type is enumerated and contains the following three formats.
@@ -416,13 +415,13 @@ The Subscription API currently supports subscribing to one or more tables and co
This function is responsible for starting the subscription service, returning the subscription object on success and `NULL` on failure, with the following parameters.
- - taos: the database connection that has been established
- - restart: if the subscription already exists, whether to restart or continue the previous subscription
- - topic: the topic of the subscription (i.e., the name). This parameter is the unique identifier of the subscription
- - sql: the query statement of the subscription, this statement can only be _select_ statement, only the original data should be queried, only the data can be queried in time order
- - fp: the callback function when the query result is received (the function prototype will be introduced later), only used when called asynchronously. This parameter should be passed `NULL` when called synchronously
- - param: additional parameter when calling the callback function, the system API will pass it to the callback function as it is, without any processing
- - interval: polling period in milliseconds. The callback function will be called periodically according to this parameter when called asynchronously. not recommended to set this parameter too small To avoid impact on system performance when called synchronously. If the interval between two calls to `taos_consume()` is less than this period, the API will block until the interval exceeds this period.
+ - taos: the database connection that has been established.
+ - restart: if the subscription already exists, whether to restart or continue the previous subscription.
+ - topic: the topic of the subscription (i.e., the name). This parameter is the unique identifier of the subscription.
+ - sql: the query statement of the subscription which can only be a _select_ statement. Only the original data should be queried, and data can only be queried in temporal order.
+ - fp: the callback function when the query result is received only used when called asynchronously. This parameter should be passed `NULL` when called synchronously. The function prototype is described below.
+ - param: additional parameter when calling the callback function. The system API will pass it to the callback function as is, without any processing.
+ - interval: polling period in milliseconds. The callback function will be called periodically according to this parameter when called asynchronously. The interval should not be too small to avoid impact on system performance when called synchronously. If the interval between two calls to `taos_consume()` is less than this period, the API will block until the interval exceeds this period.
- ` typedef void (*TAOS_SUBSCRIBE_CALLBACK)(TAOS_SUB* tsub, TAOS_RES *res, void* param, int code)`
diff --git a/docs-en/14-reference/03-connector/csharp.mdx b/docs-en/14-reference/03-connector/csharp.mdx
index 2969392a0594ff0705e88bede5be90fb9dfd646d..5eb322cf9125fe036349de22ceea5988de46e404 100644
--- a/docs-en/14-reference/03-connector/csharp.mdx
+++ b/docs-en/14-reference/03-connector/csharp.mdx
@@ -179,9 +179,9 @@ namespace TDengineExample
1. "Unable to establish connection", "Unable to resolve FQDN"
- Usually, it cause by the FQDN configuration is incorrect, you can refer to [How to understand TDengine's FQDN (Chinese)](https://www.taosdata.com/blog/2021/07/29/2741.html) to solve it. 2.
+ Usually, it's caused by an incorrect FQDN configuration. Please refer to this section in the [FAQ](https://docs.tdengine.com/2.4/train-faq/faq/#2-how-to-handle-unable-to-establish-connection) to troubleshoot.
-Unhandled exception. System.DllNotFoundException: Unable to load DLL 'taos' or one of its dependencies: The specified module cannot be found.
+2. Unhandled exception. System.DllNotFoundException: Unable to load DLL 'taos' or one of its dependencies: The specified module cannot be found.
This is usually because the program did not find the dependent client driver. The solution is to copy `C:\TDengine\driver\taos.dll` to the `C:\Windows\System32\` directory on Windows, and create the following soft link on Linux `ln -s /usr/local/taos/driver/libtaos.so.x.x .x.x /usr/lib/libtaos.so` will work.
diff --git a/docs-en/14-reference/03-connector/go.mdx b/docs-en/14-reference/03-connector/go.mdx
index fd5930f07ff7184bd8dd5ff19cd3860f9718eaf9..c1e85ae4eb1d1d7ccfb70b2b4f38cebaf6cbf06c 100644
--- a/docs-en/14-reference/03-connector/go.mdx
+++ b/docs-en/14-reference/03-connector/go.mdx
@@ -15,9 +15,9 @@ import GoOpenTSDBTelnet from "../../07-develop/03-insert-data/_go_opts_telnet.md
import GoOpenTSDBJson from "../../07-develop/03-insert-data/_go_opts_json.mdx"
import GoQuery from "../../07-develop/04-query-data/_go.mdx"
-`driver-go` is the official Go language connector for TDengine, which implements the interface to the Go language [database/sql](https://golang.org/pkg/database/sql/) package. Go developers can use it to develop applications that access TDengine cluster data.
+`driver-go` is the official Go language connector for TDengine. It implements the [database/sql](https://golang.org/pkg/database/sql/) package, the generic Go language interface to SQL databases. Go developers can use it to develop applications that access TDengine cluster data.
-`driver-go` provides two ways to establish connections. One is **native connection**, which connects to TDengine instances natively through the TDengine client driver (taosc), supporting data writing, querying, subscriptions, schemaless writing, and bind interface. The other is the **REST connection**, which connects to TDengine instances via the REST interface provided by taosAdapter. The set of features implemented by the REST connection differs slightly from the native connection.
+`driver-go` provides two ways to establish connections. One is **native connection**, which connects to TDengine instances natively through the TDengine client driver (taosc), supporting data writing, querying, subscriptions, schemaless writing, and bind interface. The other is the **REST connection**, which connects to TDengine instances via the REST interface provided by taosAdapter. The set of features implemented by the REST connection differs slightly from those implemented by the native connection.
This article describes how to install `driver-go` and connect to TDengine clusters and perform basic operations such as data query and data writing through `driver-go`.
@@ -213,7 +213,7 @@ func main() {
Since the REST interface is stateless, the `use db` syntax will not work. You need to put the db name into the SQL command, e.g. `create table if not exists tb1 (ts timestamp, a int)` to `create table if not exists test.tb1 (ts timestamp, a int)` otherwise it will report the error `[0x217] Database not specified or available`.
-You can also put the db name in the DSN by changing `root:taosdata@http(localhost:6041)/` to `root:taosdata@http(localhost:6041)/test`. This method is supported by taosAdapter in TDengine 2.4.0.5. is supported since TDengine 2.4.0.5. Executing the `create database` statement when the specified db does not exist will not report an error while executing other queries or writing against that db will report an error.
+You can also put the db name in the DSN by changing `root:taosdata@http(localhost:6041)/` to `root:taosdata@http(localhost:6041)/test`. This method is supported by taosAdapter since TDengine 2.4.0.5. Executing the `create database` statement when the specified db does not exist will not report an error while executing other queries or writing against that db will report an error.
The complete example is as follows.
@@ -289,7 +289,7 @@ func main() {
6. `readBufferSize` parameter has no significant effect after being increased
- If you increase `readBufferSize` will reduce the number of `syscall` calls when fetching results. If the query result is smaller, modifying this parameter will not improve significantly. If you increase the parameter value too much, the bottleneck will be parsing JSON data. If you need to optimize the query speed, you must adjust the value according to the actual situation to achieve the best query result.
+ Increasing `readBufferSize` will reduce the number of `syscall` calls when fetching results. If the query result is smaller, modifying this parameter will not improve performance significantly. If you increase the parameter value too much, the bottleneck will be parsing JSON data. If you need to optimize the query speed, you must adjust the value based on the actual situation to achieve the best query performance.
7. `disableCompression` parameter is set to `false` when the query efficiency is reduced
diff --git a/docs-en/14-reference/03-connector/java.mdx b/docs-en/14-reference/03-connector/java.mdx
index 1c84c0b1cacb454ca4e35266a1d362a2d2a038fb..33d715c2e218fd6db4f61882f2a7a92baa80f5a2 100644
--- a/docs-en/14-reference/03-connector/java.mdx
+++ b/docs-en/14-reference/03-connector/java.mdx
@@ -9,19 +9,19 @@ description: TDengine Java based on JDBC API and provide both native and REST co
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-'taos-jdbcdriver' is TDengine's official Java language connector, which allows Java developers to develop applications that access the TDengine database. 'taos-jdbcdriver' implements the interface of the JDBC driver standard and provides two forms of connectors. One is to connect to a TDengine instance natively through the TDengine client driver (taosc), which supports functions including data writing, querying, subscription, schemaless writing, and bind interface. And the other is to connect to a TDengine instance through the REST interface provided by taosAdapter (2.4.0.0 and later). REST connections implement has a slight differences to compare the set of features implemented and native connections.
+'taos-jdbcdriver' is TDengine's official Java language connector, which allows Java developers to develop applications that access the TDengine database. 'taos-jdbcdriver' implements the interface of the JDBC driver standard and provides two forms of connectors. One is to connect to a TDengine instance natively through the TDengine client driver (taosc), which supports functions including data writing, querying, subscription, schemaless writing, and bind interface. And the other is to connect to a TDengine instance through the REST interface provided by taosAdapter (2.4.0.0 and later). The implementation of the REST connection and those of the native connections have slight differences in features.

The preceding diagram shows two ways for a Java app to access TDengine via connector:
- JDBC native connection: Java applications use TSDBDriver on physical node 1 (pnode1) to call client-driven directly (`libtaos.so` or `taos.dll`) APIs to send writing and query requests to taosd instances located on physical node 2 (pnode2).
-- JDBC REST connection: The Java application encapsulates the SQL as a REST request via RestfulDriver, sends it to the REST server of physical node 2 (taosAdapter), requests TDengine server through the REST server, and returns the result.
+- JDBC REST connection: The Java application encapsulates the SQL as a REST request via RestfulDriver, sends it to the REST server (taosAdapter) on physical node 2. taosAdapter forwards the request to TDengine server and returns the result.
-Using REST connection, which does not rely on TDengine client drivers.It can be cross-platform more convenient and flexible but introduce about 30% lower performance than native connection.
+The REST connection, which does not rely on TDengine client drivers, is more convenient and flexible, in addition to being cross-platform. However the performance is about 30% lower than that of the native connection.
:::info
-TDengine's JDBC driver implementation is as consistent as possible with the relational database driver. Still, there are differences in the use scenarios and technical characteristics of TDengine and relational object databases, so 'taos-jdbcdriver' also has some differences from traditional JDBC drivers. You need to pay attention to the following points when using:
+TDengine's JDBC driver implementation is as consistent as possible with the relational database driver. Still, there are differences in the use scenarios and technical characteristics of TDengine and relational object databases. So 'taos-jdbcdriver' also has some differences from traditional JDBC drivers. It is important to keep the following points in mind:
- TDengine does not currently support delete operations for individual data records.
- Transactional operations are not currently supported.
@@ -88,7 +88,7 @@ Add following dependency in the `pom.xml` file of your Maven project:
-You can build Java connector from source code after clone TDengine project:
+You can build Java connector from source code after cloning the TDengine project:
```shell
git clone https://github.com/taosdata/TDengine.git
@@ -96,7 +96,7 @@ cd TDengine/src/connector/jdbc
mvn clean install -Dmaven.test.skip=true
```
-After compilation, a jar package of taos-jdbcdriver-2.0.XX-dist .jar is generated in the target directory, and the compiled jar file is automatically placed in the local Maven repository.
+After compilation, a jar package named taos-jdbcdriver-2.0.XX-dist.jar is generated in the target directory, and the compiled jar file is automatically placed in the local Maven repository.
@@ -186,7 +186,7 @@ Connection conn = DriverManager.getConnection(jdbcUrl);
In the above example, a RestfulDriver with a JDBC REST connection is used to establish a connection to a database named `test` with hostname `taosdemo.com` on port `6041`. The URL specifies the user name as `root` and the password as `taosdata`.
-There is no dependency on the client driver when Using a JDBC REST connection. Compared to a JDBC native connection, only the following are required: 1.
+There is no dependency on the client driver when Using a JDBC REST connection. Compared to a JDBC native connection, only the following are required:
1. driverClass specified as "com.taosdata.jdbc.rs.RestfulDriver".
2. jdbcUrl starting with "jdbc:TAOS-RS://".
@@ -209,7 +209,7 @@ The configuration parameters in the URL are as follows.
INSERT INTO test.t1 USING test.weather (ts, temperature) TAGS('California.SanFrancisco') VALUES(now, 24.6);
```
-- Starting from taos-jdbcdriver-2.0.36 and TDengine 2.2.0.0, if dbname is specified in the URL, JDBC REST connections will use `/rest/sql/dbname` as the URL for REST requests by default, and there is no need to specify dbname in SQL. For example, if the URL is `jdbc:TAOS-RS://127.0.0.1:6041/test`, then the SQL can be executed: insert into t1 using weather(ts, temperature) tags('California.SanFrancisco') values(now, 24.6);
+- Starting from taos-jdbcdriver-2.0.36 and TDengine 2.2.0.0, if dbname is specified in the URL, JDBC REST connections will use `/rest/sql/dbname` as the URL for REST requests by default, and there is no need to specify dbname in SQL. For example, if the URL is `jdbc:TAOS-RS://127.0.0.1:6041/test`, then the SQL can be executed: insert into test using weather(ts, temperature) tags('California.SanFrancisco') values(now, 24.6);
:::
@@ -271,7 +271,7 @@ If the configuration parameters are duplicated in the URL, Properties, or client
2. Properties connProps
3. the configuration file taos.cfg of the TDengine client driver when using a native connection
-For example, if you specify the password as `taosdata` in the URL and specify the password as `taosdemo` in the Properties simultaneously. In this case, JDBC will use the password in the URL to establish the connection.
+For example, if you specify the password as `taosdata` in the URL and specify the password as `taosdemo` in the Properties simultaneously, JDBC will use the password in the URL to establish the connection.
## Usage examples
@@ -323,7 +323,7 @@ while(resultSet.next()){
}
```
-> The query is consistent with operating a relational database. When using subscripts to get the contents of the returned fields, starting from 1, it is recommended to use the field names to get them.
+> The query is consistent with operating a relational database. When using subscripts to get the contents of the returned fields, you have to start from 1. However, we recommend using the field names to get the values of the fields in the result set.
### Handling exceptions
@@ -623,7 +623,7 @@ public void setNString(int columnIndex, ArrayList list, int size) throws
### Schemaless Writing
-Starting with version 2.2.0.0, TDengine has added the ability to schemaless writing. It is compatible with InfluxDB's Line Protocol, OpenTSDB's telnet line protocol, and OpenTSDB's JSON format protocol. See [schemaless writing](/reference/schemaless/) for details.
+Starting with version 2.2.0.0, TDengine has added the ability to perform schemaless writing. It is compatible with InfluxDB's Line Protocol, OpenTSDB's telnet line protocol, and OpenTSDB's JSON format protocol. See [schemaless writing](/reference/schemaless/) for details.
**Note**.
@@ -666,16 +666,16 @@ The TDengine Java Connector supports subscription functionality with the followi
#### Create subscriptions
```java
-TSDBSubscribe sub = ((TSDBConnection)conn).subscribe("topic", "select * from meters", false);
+TSDBSubscribe sub = ((TSDBConnection)conn).subscribe("topicname", "select * from meters", false);
```
The three parameters of the `subscribe()` method have the following meanings.
-- topic: the subscribed topic (i.e., name). This parameter is the unique identifier of the subscription
-- sql: the query statement of the subscription, this statement can only be `select` statement, only the original data should be queried, and you can query only the data in the positive time order
+- topicname: the name of the subscribed topic. This parameter is the unique identifier of the subscription.
+- sql: the query statement of the subscription. This statement can only be a `select` statement. Only original data can be queried, and you can query the data only temporal order.
- restart: if the subscription already exists, whether to restart or continue the previous subscription
-The above example will use the SQL command `select * from meters` to create a subscription named `topic`. If the subscription exists, it will continue the progress of the previous query instead of consuming all the data from the beginning.
+The above example will use the SQL command `select * from meters` to create a subscription named `topicname`. If the subscription exists, it will continue the progress of the previous query instead of consuming all the data from the beginning.
#### Subscribe to consume data
diff --git a/docs-en/14-reference/03-connector/node.mdx b/docs-en/14-reference/03-connector/node.mdx
index 3d30148e8ed9d8f98d135fa0fa72809f1115231a..8f586acde4848af71efcb23358be1f8486cedb8e 100644
--- a/docs-en/14-reference/03-connector/node.mdx
+++ b/docs-en/14-reference/03-connector/node.mdx
@@ -14,7 +14,6 @@ import NodeInfluxLine from "../../07-develop/03-insert-data/_js_line.mdx";
import NodeOpenTSDBTelnet from "../../07-develop/03-insert-data/_js_opts_telnet.mdx";
import NodeOpenTSDBJson from "../../07-develop/03-insert-data/_js_opts_json.mdx";
import NodeQuery from "../../07-develop/04-query-data/_js.mdx";
-import NodeAsyncQuery from "../../07-develop/04-query-data/_js_async.mdx";
`td2.0-connector` and `td2.0-rest-connector` are the official Node.js language connectors for TDengine. Node.js developers can develop applications to access TDengine instance data.
@@ -189,14 +188,8 @@ let cursor = conn.cursor();
### Query data
-#### Synchronous queries
-
-#### asynchronous query
-
-
-
## More Sample Programs
| Sample Programs | Sample Program Description |
@@ -232,7 +225,7 @@ See [video tutorial](https://www.taosdata.com/blog/2020/11/11/1957.html) for the
2. "Unable to establish connection", "Unable to resolve FQDN"
- Usually, root cause is the FQDN is not configured correctly. You can refer to [How to understand TDengine's FQDN (In Chinese)](https://www.taosdata.com/blog/2021/07/29/2741.html).
+ Usually, the root cause is an incorrect FQDN configuration. You can refer to this section in the [FAQ](https://docs.tdengine.com/2.4/train-faq/faq/#2-how-to-handle-unable-to-establish-connection) to troubleshoot.
## Important Updates
diff --git a/docs-en/14-reference/03-connector/python.mdx b/docs-en/14-reference/03-connector/python.mdx
index c52b4f18825c083e4bdfebe26b2e68ef2025ef8a..69eec2388d460754493d2b775f14ab4bbf129799 100644
--- a/docs-en/14-reference/03-connector/python.mdx
+++ b/docs-en/14-reference/03-connector/python.mdx
@@ -11,18 +11,18 @@ import TabItem from "@theme/TabItem";
`taospy` is the official Python connector for TDengine. `taospy` provides a rich set of APIs that makes it easy for Python applications to access TDengine. `taospy` wraps both the [native interface](/reference/connector/cpp) and [REST interface](/reference/rest-api) of TDengine, which correspond to the `taos` and `taosrest` modules of the `taospy` package, respectively.
In addition to wrapping the native and REST interfaces, `taospy` also provides a set of programming interfaces that conforms to the [Python Data Access Specification (PEP 249)](https://peps.python.org/pep-0249/). It is easy to integrate `taospy` with many third-party tools, such as [SQLAlchemy](https://www.sqlalchemy.org/) and [pandas](https://pandas.pydata.org/).
-The connection to the server directly using the native interface provided by the client driver is referred to hereinafter as a "native connection"; the connection to the server using the REST interface provided by taosAdapter is referred to hereinafter as a "REST connection".
+The direct connection to the server using the native interface provided by the client driver is referred to hereinafter as a "native connection"; the connection to the server using the REST interface provided by taosAdapter is referred to hereinafter as a "REST connection".
The source code for the Python connector is hosted on [GitHub](https://github.com/taosdata/taos-connector-python).
## Supported Platforms
-- The native connection [supported platforms](/reference/connector/#supported-platforms) is the same as the one supported by the TDengine client.
+- The [supported platforms](/reference/connector/#supported-platforms) for the native connection are the same as the ones supported by the TDengine client.
- REST connections are supported on all platforms that can run Python.
## Version selection
-We recommend using the latest version of `taospy`, regardless what the version of TDengine is.
+We recommend using the latest version of `taospy`, regardless of the version of TDengine.
## Supported features
@@ -139,7 +139,7 @@ The FQDN above can be the FQDN of any dnode in the cluster, and the PORT is the
-For REST connections and making sure the cluster is up, make sure the taosAdapter component is up. This can be tested using the following `curl ` command.
+For REST connections, make sure the cluster and taosAdapter component, are running. This can be tested using the following `curl ` command.
```
curl -u root:taosdata http://:/rest/sql -d "select server_version()"
@@ -312,7 +312,7 @@ For a more detailed description of the `sql()` method, please refer to [RestClie
### Exception handling
-All database operations will be thrown directly if an exception occurs. The application is responsible for exception handling. For example:
+All errors from database operations are thrown directly as exceptions and the error message from the database is passed up the exception stack. The application is responsible for exception handling. For example:
```python
{{#include docs-examples/python/handle_exception.py}}
diff --git a/docs-en/14-reference/03-connector/rust.mdx b/docs-en/14-reference/03-connector/rust.mdx
index 2c8fe68c1ca8b091b8d685d8e20942a02ab2c5e8..cd54f35982ec13fc3c9160145fa002fb6f1d094b 100644
--- a/docs-en/14-reference/03-connector/rust.mdx
+++ b/docs-en/14-reference/03-connector/rust.mdx
@@ -30,7 +30,7 @@ REST connections are supported on all platforms that can run Rust.
Please refer to [version support list](/reference/connector#version-support).
-The Rust Connector is still under rapid development and is not guaranteed to be backward compatible before 1.0. Recommend to use TDengine version 2.4 or higher to avoid known issues.
+The Rust Connector is still under rapid development and is not guaranteed to be backward compatible before 1.0. We recommend using TDengine version 2.4 or higher to avoid known issues.
## Installation
@@ -206,7 +206,7 @@ let conn: Taos = cfg.connect();
### Connection pooling
-In complex applications, recommand to enable connection pool. Connection pool for [libtaos] is implemented using [r2d2].
+In complex applications, we recommend enabling connection pools. Connection pool for [libtaos] is implemented using [r2d2].
As follows, a connection pool with default parameters can be generated.
@@ -269,7 +269,7 @@ The [Taos] structure is the connection manager in [libtaos] and provides two mai
Note that Rust asynchronous functions and an asynchronous runtime are required.
-[Taos] provides partial Rust methodization of SQL to reduce the frequency of `format!` code blocks.
+[Taos] provides a few Rust methods that encapsulate SQL to reduce the frequency of `format!` code blocks.
- `.describe(table: &str)`: Executes `DESCRIBE` and returns a Rust data structure.
- `.create_database(database: &str)`: Executes the `CREATE DATABASE` statement.
@@ -279,7 +279,7 @@ In addition, this structure is also the entry point for [Parameter Binding](#Par
### Bind Interface
-Similar to the C interface, Rust provides the bind interface's wraping. First, create a bind object [Stmt] for a SQL command from the [Taos] object.
+Similar to the C interface, Rust provides the bind interface's wrapping. First, create a bind object [Stmt] for a SQL command from the [Taos] object.
```rust
let mut stmt: Stmt = taos.stmt("insert into ? values(? ,?)") ? ;
diff --git a/docs-en/14-reference/04-taosadapter.md b/docs-en/14-reference/04-taosadapter.md
index 55d964c14a091109d82d67f0060e846d7e513c0c..3264124655e7040e1d94b43500a0b582d95cb5a1 100644
--- a/docs-en/14-reference/04-taosadapter.md
+++ b/docs-en/14-reference/04-taosadapter.md
@@ -30,7 +30,7 @@ taosAdapter provides the following features.
### Install taosAdapter
-taosAdapter has been part of TDengine server software since TDengine v2.4.0.0. If you use the TDengine server, you don't need additional steps to install taosAdapter. You can download taosAdapter from [TDengine official website](https://tdengine.com/all-downloads/) to download the TDengine server installation package (taosAdapter is included in v2.4.0.0 and later version). If you need to deploy taosAdapter separately on another server other than the TDengine server, you should install the full TDengine on that server to install taosAdapter. If you need to build taosAdapter from source code, you can refer to the [Building taosAdapter]( https://github.com/taosdata/taosadapter/blob/develop/BUILD.md) documentation.
+taosAdapter has been part of TDengine server software since TDengine v2.4.0.0. If you use the TDengine server, you don't need additional steps to install taosAdapter. You can download taosAdapter from [TDengine official website](https://tdengine.com/all-downloads/) to download the TDengine server installation package (taosAdapter is included in v2.4.0.0 and later version). If you need to deploy taosAdapter separately on another server other than the TDengine server, you should install the full TDengine server package on that server to install taosAdapter. If you need to build taosAdapter from source code, you can refer to the [Building taosAdapter]( https://github.com/taosdata/taosadapter/blob/develop/BUILD.md) documentation.
### Start/Stop taosAdapter
@@ -38,7 +38,7 @@ On Linux systems, the taosAdapter service is managed by `systemd` by default. Yo
### Remove taosAdapter
-Use the command `rmtaos` to remove the TDengine server software if you use tar.gz package or use package management command like rpm or apt to remove the TDengine server, including taosAdapter.
+Use the command `rmtaos` to remove the TDengine server software if you use tar.gz package. If you installed using a .deb or .rpm package, use the corresponding command, for your package manager, like apt or rpm to remove the TDengine server, including taosAdapter.
### Upgrade taosAdapter
@@ -240,7 +240,7 @@ node_export is an exporter of hardware and OS metrics exposed by the \*NIX kerne
## Memory usage optimization methods
-taosAdapter will monitor its memory usage during operation and adjust it with two thresholds. Valid values range from -1 to 100 integers in percent of the system's physical memory.
+taosAdapter will monitor its memory usage during operation and adjust it with two thresholds. Valid values are integers between 1 to 100, and represent a percentage of the system's physical memory.
- pauseQueryMemoryThreshold
- pauseAllMemoryThreshold
@@ -276,7 +276,7 @@ Corresponding configuration parameter
monitor.pauseQueryMemoryThreshold memory threshold for no more queries Environment variable `TAOS_MONITOR_PAUSE_QUERY_MEMORY_THRESHOLD` (default 70)
```
-You can adjust it according to the specific application scenario and operation strategy, and it is recommended to use operation monitoring software to monitor system memory status timely. The load balancer can also check the taosAdapter running status through this interface.
+You should adjust this parameter based on your specific application scenario and operation strategy. We recommend using monitoring software to monitor system memory status. The load balancer can also check the taosAdapter running status through this interface.
## taosAdapter Monitoring Metrics
@@ -325,7 +325,7 @@ You can also adjust the level of the taosAdapter log output by setting the `--lo
## How to migrate from older TDengine versions to taosAdapter
-In TDengine server 2.2.x.x or earlier, the TDengine server process (taosd) contains an embedded HTTP service. As mentioned earlier, taosAdapter is a standalone software managed using `systemd` and has its process ID. And there are some configuration parameters and behaviors that are different between the two. See the following table for details.
+In TDengine server 2.2.x.x or earlier, the TDengine server process (taosd) contains an embedded HTTP service. As mentioned earlier, taosAdapter is a standalone software managed using `systemd` and has its own process ID. There are some configuration parameters and behaviors that are different between the two. See the following table for details.
| **#** | **embedded httpd** | **taosAdapter** | **comment** |
| ----- | ------------------- | ------------------------------------ | ------------------------------------------------------------------ ------------------------------------------------------------------------ |
diff --git a/docs-en/14-reference/05-taosbenchmark.md b/docs-en/14-reference/05-taosbenchmark.md
index 1e2b0b99f652bca0d775bebe28378600470f8661..b029f3d3eea0b010354dac1eb3ffecbc872e597f 100644
--- a/docs-en/14-reference/05-taosbenchmark.md
+++ b/docs-en/14-reference/05-taosbenchmark.md
@@ -7,7 +7,7 @@ description: "taosBenchmark (once called taosdemo ) is a tool for testing the pe
## Introduction
-taosBenchmark (formerly taosdemo ) is a tool for testing the performance of TDengine products. taosBenchmark can test the performance of TDengine's insert, query, and subscription functions and simulate large amounts of data generated by many devices. taosBenchmark can flexibly control the number and type of databases, supertables, tag columns, number and type of data columns, and sub-tables, and types of databases, super tables, the number and types of data columns, the number of sub-tables, the amount of data per sub-table, the time interval for inserting data, the number of working threads, whether and how to insert disordered data, and so on. The installer provides taosdemo as a soft link to taosBenchmark for compatibility with past users.
+taosBenchmark (formerly taosdemo ) is a tool for testing the performance of TDengine products. taosBenchmark can test the performance of TDengine's insert, query, and subscription functions and simulate large amounts of data generated by many devices. taosBenchmark can flexibly control the number and type of databases, supertables, tag columns, number and type of data columns, and sub-tables, and types of databases, super tables, the number and types of data columns, the number of sub-tables, the amount of data per sub-table, the time interval for inserting data, the number of working threads, whether and how to insert disordered data, and so on. The installer provides taosdemo as a soft link to taosBenchmark for compatibility and for the convenience of past users.
## Installation
@@ -21,7 +21,7 @@ There are two ways to install taosBenchmark:
### Configuration and running methods
-taosBenchmark supports two configuration methods: [Command-line arguments](#Command-line arguments in detailed) and [JSON configuration file](#Configuration file arguments in detailed). These two methods are mutually exclusive, and with only one command-line parameter, users can use `-f ` to specify a configuration file when using a configuration file. When running taosBenchmark with command-line arguments and controlling its behavior, users should use other parameters for configuration rather than `-f` parameter. In addition, taosBenchmark offers a special way of running without parameters.
+taosBenchmark supports two configuration methods: [Command-line arguments](#Command-line arguments in detailed) and [JSON configuration file](#Configuration file arguments in detailed). These two methods are mutually exclusive. Users can use `-f ` to specify a configuration file. When running taosBenchmark with command-line arguments to control its behavior, users should use other parameters for configuration, but not the `-f` parameter. In addition, taosBenchmark offers a special way of running without parameters.
taosBenchmark supports complete performance testing of TDengine. taosBenchmark supports the TDengine functions in three categories: write, query, and subscribe. These three functions are mutually exclusive, and users can select only one of them each time taosBenchmark runs. It is important to note that the type of functionality to be tested is not configurable when using the command-line configuration method, which can only test writing performance. To test the query and subscription performance of the TDengine, you must use the configuration file method and specify the function type to test via the parameter `filetype` in the configuration file.
@@ -35,7 +35,7 @@ Execute the following commands to quickly experience taosBenchmark's default con
taosBenchmark
```
-When run without parameters, taosBenchmark connects to the TDengine cluster specified in `/etc/taos` by default and creates a database named test in TDengine, a super table named `meters` under the test database, and 10,000 tables under the super table with 10,000 records written to each table. Note that if there is already a test database, this table is not used. Note that if there is already a test database, this command will delete it first and create a new test database.
+When run without parameters, taosBenchmark connects to the TDengine cluster specified in `/etc/taos` by default and creates a database named `test`, a super table named `meters` under the test database, and 10,000 tables under the super table with 10,000 records written to each table. Note that if there is already a database named "test" this command will delete it first and create a new database.
### Run with command-line configuration parameters
@@ -45,7 +45,7 @@ The `-f ` argument cannot be used when running taosBenchmark with com
taosBenchmark -I stmt -n 200 -t 100
```
-The above command, `taosBenchmark` will create a database named `test`, create a super table `meters` in it, create 100 sub-tables in the super table and insert 200 records for each sub-table using parameter binding.
+Using the above command, `taosBenchmark` will create a database named `test`, create a super table `meters` in it, create 100 sub-tables in the super table and insert 200 records for each sub-table using parameter binding.
### Run with the configuration file
@@ -95,10 +95,10 @@ taosBenchmark -f
## Command-line argument in detailed
- **-f/--file ** :
- specify the configuration file to use. This file includes All parameters. And users should not use this parameter with other parameters on the command-line. There is no default value.
+ specify the configuration file to use. This file includes All parameters. Users should not use this parameter with other parameters on the command-line. There is no default value.
- **-c/--config-dir ** :
- specify the directory where the TDengine cluster configuration file. the default path is `/etc/taos`.
+ specify the directory where the TDengine cluster configuration file. The default path is `/etc/taos`.
- **-h/--host ** :
Specify the FQDN of the TDengine server to connect to. The default value is localhost.
@@ -272,13 +272,13 @@ The parameters for creating super tables are configured in `super_tables` in the
- **child_table_prefix** : The prefix of the child table name, mandatory configuration item, no default value.
-- **escape_character**: specify the super table and child table names containing escape characters. By default is "no". The value can be "yes" or "no".
+- **escape_character**: specify the super table and child table names containing escape characters. The value can be "yes" or "no". The default is "no".
- **auto_create_table**: only when insert_mode is taosc, rest, stmt, and childtable_exists is "no". "yes" means taosBenchmark will automatically create non-existent tables when inserting data; "no" means that taosBenchmark will create all tables before inserting.
-- **batch_create_tbl_num** : the number of tables per batch when creating sub-tables, default is 10. Note: the actual number of batches may not be the same as this value when the executed SQL statement is larger than the maximum length supported, it will be automatically truncated and re-executed to continue creating.
+- **batch_create_tbl_num** : the number of tables per batch when creating sub-tables, default is 10. Note: the actual number of batches may not be the same as this value. If the executed SQL statement is larger than the maximum length supported, it will be automatically truncated and re-executed to continue creating.
-- **data_source**: specify the source of data-generating. Default is taosBenchmark randomly generated. Users can configure it as "rand" and "sample". When "sample" is used, taosBenchmark will use the data in the file specified by the `sample_file` parameter.
+- **data_source**: specify the source of data-generation. Default is taosBenchmark randomly generated. Users can configure it as "rand" and "sample". When "sample" is used, taosBenchmark will use the data in the file specified by the `sample_file` parameter.
- **insert_mode**: insertion mode with options taosc, rest, stmt, sml, sml-rest, corresponding to normal write, restful interface write, parameter binding interface write, schemaless interface write, restful schemaless interface write (provided by taosAdapter). The default value is taosc.
@@ -300,15 +300,15 @@ The parameters for creating super tables are configured in `super_tables` in the
- **partial_col_num**: If this value is a positive number n, only the first n columns are written to, only if insert_mode is taosc and rest, or all columns if n is 0.
-- **disorder_ratio** : Specifies the percentage probability of disordered data in the value range [0,50]. The default is 0, which means there is no disorder data.
+- **disorder_ratio** : Specifies the percentage probability of disordered (i.e. out-of-order) data in the value range [0,50]. The default is 0, which means there is no disorder data.
-- **disorder_range** : Specifies the timestamp fallback range for the disordered data. The generated disorder timestamp is the timestamp that should be used in the non-disorder case minus a random value in this range. Valid only if the percentage of disordered data specified by `-O/--disorder` is greater than 0.
+- **disorder_range** : Specifies the timestamp fallback range for the disordered data. The disordered timestamp is generated by subtracting a random value in this range, from the timestamp that would be used in the non-disorder case. Valid only if the percentage of disordered data specified by `-O/--disorder` is greater than 0.
-- **timestamp_step**: The timestamp step for inserting data in each child table, in units consistent with the `precision` of the database, the default value is 1.
+- **timestamp_step**: The timestamp step for inserting data in each child table, in units consistent with the `precision` of the database. For e.g. if the `precision` is milliseconds, the timestamp step will be in milliseconds. The default value is 1.
- **start_timestamp** : The timestamp start value of each sub-table, the default value is now.
-- **sample_format**: The type of the sample data file, now only "csv" is supported.
+- **sample_format**: The type of the sample data file; for now only "csv" is supported.
- **sample_file**: Specify a CSV format file as the data source. It only works when data_source is a sample. If the number of rows in the CSV file is less than or equal to prepared_rand, then taosBenchmark will read the CSV file data cyclically until it is the same as prepared_rand; otherwise, taosBenchmark will read only the rows with the number of prepared_rand. The final number of rows of data generated is the smaller of the two.
@@ -341,7 +341,7 @@ The configuration parameters for specifying super table tag columns and data col
- **create_table_thread_count** : The number of threads to build the table, default is 8.
-- **connection_pool_size** : The number of pre-established connections to the TDengine server. If not configured, it is the same number of threads specified.
+- **connection_pool_size** : The number of pre-established connections to the TDengine server. If not configured, it is the same as number of threads specified.
- **result_file** : The path to the result output file, the default value is . /output.txt.
diff --git a/docs-en/14-reference/06-taosdump.md b/docs-en/14-reference/06-taosdump.md
index a7e216398a183a096678d8d70c429606d4e5f809..5403e40925f633ce62795cc6037fc8c8f7aad07a 100644
--- a/docs-en/14-reference/06-taosdump.md
+++ b/docs-en/14-reference/06-taosdump.md
@@ -1,16 +1,17 @@
---
title: taosdump
-description: "taosdump is a tool application that supports backing up data from a running TDengine cluster and restoring the backed up data to the same or another running TDengine cluster."
+description: "taosdump is a tool that supports backing up data from a running TDengine cluster and restoring the backed up data to the same, or another running TDengine cluster."
---
## Introduction
-taosdump is a tool application that supports backing up data from a running TDengine cluster and restoring the backed up data to the same or another running TDengine cluster.
+taosdump is a tool that supports backing up data from a running TDengine cluster and restoring the backed up data to the same, or another running TDengine cluster.
taosdump can back up a database, a super table, or a normal table as a logical data unit or backup data records in the database, super tables, and normal tables. When using taosdump, you can specify the directory path for data backup. If you do not specify a directory, taosdump will back up the data to the current directory by default.
-Suppose the specified location already has data files. In that case, taosdump will prompt the user and exit immediately to avoid data overwriting which means that the same path can only be used for one backup.
-Please be careful if you see a prompt for this.
+If the specified location already has data files, taosdump will prompt the user and exit immediately to avoid data overwriting. This means that the same path can only be used for one backup.
+
+Please be careful if you see a prompt for this and please ensure that you follow best practices and relevant SOPs for data integrity, backup and data security.
Users should not use taosdump to back up raw data, environment settings, hardware information, server configuration, or cluster topology. taosdump uses [Apache AVRO](https://avro.apache.org/) as the data file format to store backup data.
@@ -30,7 +31,7 @@ There are two ways to install taosdump:
2. backup multiple specified databases: use `-D db1,db2,... ` parameters;
3. back up some super or normal tables in the specified database: use `-dbname stbname1 stbname2 tbname1 tbname2 ... ` parameters. Note that the first parameter of this input sequence is the database name, and only one database is supported. The second and subsequent parameters are the names of super or normal tables in that database, separated by spaces.
4. back up the system log database: TDengine clusters usually contain a system database named `log`. The data in this database is the data that TDengine runs itself, and the taosdump will not back up the log database by default. If users need to back up the log database, users can use the `-a` or `-allow-sys` command-line parameter.
-5. Loose mode backup: taosdump version 1.4.1 onwards provides `-n` and `-L` parameters for backing up data without using escape characters and "loose" mode, which can reduce the number of backups if table names, column names, tag names do not use This can reduce the backup data time and backup data footprint if table names, column names, and tag names do not use `escape character`. If you are unsure about using `-n` and `-L` conditions, please use the default parameters for "strict" mode backup. See the [official documentation](/taos-sql/escape) for a description of escaped characters.
+5. Loose mode backup: taosdump version 1.4.1 onwards provides `-n` and `-L` parameters for backing up data without using escape characters and "loose" mode, which can reduce the number of backups if table names, column names, tag names do not use escape characters. This can also reduce the backup data time and backup data footprint. If you are unsure about using `-n` and `-L` conditions, please use the default parameters for "strict" mode backup. See the [official documentation](/taos-sql/escape) for a description of escaped characters.
:::tip
- taosdump versions after 1.4.1 provide the `-I` argument for parsing Avro file schema and data. If users specify `-s` then only taosdump will parse schema.
@@ -58,7 +59,7 @@ Usage: taosdump [OPTION...] dbname [tbname ...]
or: taosdump [OPTION...] -i inpath
or: taosdump [OPTION...] -o outpath
- -h, --host=HOST Server host dumping data from. Default is
+ -h, --host=HOST Server host from which to dump data. Default is
localhost.
-p, --password User password to connect to server. Default is
taosdata.
@@ -71,10 +72,10 @@ Usage: taosdump [OPTION...] dbname [tbname ...]
-r, --resultFile=RESULTFILE DumpOut/In Result file path and name.
-a, --allow-sys Allow to dump system database
-A, --all-databases Dump all databases.
- -D, --databases=DATABASES Dump inputted databases. Use comma to separate
- databases' name.
+ -D, --databases=DATABASES Dump listed databases. Use comma to separate
+ database names.
-N, --without-property Dump database without its properties.
- -s, --schemaonly Only dump tables' schema.
+ -s, --schemaonly Only dump table schemas.
-y, --answer-yes Input yes for prompt. It will skip data file
checking!
-d, --avro-codec=snappy Choose an avro codec among null, deflate, snappy,
@@ -97,7 +98,7 @@ Usage: taosdump [OPTION...] dbname [tbname ...]
and try. The workable value is related to the
length of the row and type of table schema.
-I, --inspect inspect avro file content and print on screen
- -L, --loose-mode Using loose mode if the table name and column name
+ -L, --loose-mode Use loose mode if the table name and column name
use letter and number only. Default is NOT.
-n, --no-escape No escape char '`'. Default is using it.
-T, --thread-num=THREAD_NUM Number of thread for dump in file. Default is
diff --git a/docs-en/14-reference/07-tdinsight/index.md b/docs-en/14-reference/07-tdinsight/index.md
index 16bae615c04ab92e4934418d6c0a3aaf1e1ccde8..cebfafa225e6e8de75ff84bb51fa664784177910 100644
--- a/docs-en/14-reference/07-tdinsight/index.md
+++ b/docs-en/14-reference/07-tdinsight/index.md
@@ -5,11 +5,11 @@ sidebar_label: TDinsight
TDinsight is a solution for monitoring TDengine using the builtin native monitoring database and [Grafana].
-After TDengine starts, it will automatically create a monitoring database `log`. TDengine will automatically write many metrics in specific intervals into the `log` database. The metrics may include the server's CPU, memory, hard disk space, network bandwidth, number of requests, disk read/write speed, slow queries, other information like important system operations (user login, database creation, database deletion, etc.), and error alarms. With [Grafana] and [TDengine Data Source Plugin](https://github.com/taosdata/grafanaplugin/releases), TDinsight can visualize cluster status, node information, insertion and query requests, resource usage, etc., and also vnode, dnode, and mnode status, and exception alerts. Developers monitoring TDengine cluster operation status in real-time can be very convinient. This article will guide users to install the Grafana server, automatically install the TDengine data source plug-in, and deploy the TDinsight visualization panel through `TDinsight.sh` installation script.
+After TDengine starts, it will automatically create a monitoring database `log`. TDengine will automatically write many metrics in specific intervals into the `log` database. The metrics may include the server's CPU, memory, hard disk space, network bandwidth, number of requests, disk read/write speed, slow queries, other information like important system operations (user login, database creation, database deletion, etc.), and error alarms. With [Grafana] and [TDengine Data Source Plugin](https://github.com/taosdata/grafanaplugin/releases), TDinsight can visualize cluster status, node information, insertion and query requests, resource usage, vnode, dnode, and mnode status, exception alerts and many other metrics. This is very convenient for developers who want to monitor TDengine cluster status in real-time. This article will guide users to install the Grafana server, automatically install the TDengine data source plug-in, and deploy the TDinsight visualization panel using the `TDinsight.sh` installation script.
## System Requirements
-To deploy TDinsight, a single-node TDengine server or a multi-nodes TDengine cluster and a [Grafana] server are required. This dashboard requires TDengine 2.3.3.0 and above, with the `log` database enabled (`monitor = 1`).
+To deploy TDinsight, a single-node TDengine server or a multi-node TDengine cluster and a [Grafana] server are required. This dashboard requires TDengine 2.3.3.0 and above, with the `log` database enabled (`monitor = 1`).
## Installing Grafana
@@ -17,7 +17,7 @@ We recommend using the latest [Grafana] version 7 or 8 here. You can install Gra
### Installing Grafana on Debian or Ubuntu
-For Debian or Ubuntu operating systems, we recommend the Grafana image repository and Use the following command to install from scratch.
+For Debian or Ubuntu operating systems, we recommend the Grafana image repository and using the following command to install from scratch.
```bash
sudo apt-get install -y apt-transport-https
@@ -71,7 +71,7 @@ chmod +x TDinsight.sh
./TDinsight.sh
```
-This script will automatically download the latest [Grafana TDengine data source plugin](https://github.com/taosdata/grafanaplugin/releases/latest) and [TDinsight dashboard](https://grafana.com/grafana/dashboards/15167) with configurable parameters from the command-line options to the [Grafana Provisioning](https://grafana.com/docs/grafana/latest/administration/provisioning/) configuration file to automate deployment and updates, etc. With the alert setting options provided by this script, you can also get built-in support for AliCloud SMS alert notifications.
+This script will automatically download the latest [Grafana TDengine data source plugin](https://github.com/taosdata/grafanaplugin/releases/latest) and [TDinsight dashboard](https://grafana.com/grafana/dashboards/15167) with configurable parameters for command-line options to the [Grafana Provisioning](https://grafana.com/docs/grafana/latest/administration/provisioning/) configuration file to automate deployment and updates, etc. With the alert setting options provided by this script, you can also get built-in support for AliCloud SMS alert notifications.
Assume you use TDengine and Grafana's default services on the same host. Run `. /TDinsight.sh` and open the Grafana browser window to see the TDinsight dashboard.
diff --git a/docs-en/14-reference/11-docker/index.md b/docs-en/14-reference/11-docker/index.md
index f532a263d88def21bd8b0fe9c59adaf982ee2404..b7e60ab3e7f04a6078950977a563382a3524ebaa 100644
--- a/docs-en/14-reference/11-docker/index.md
+++ b/docs-en/14-reference/11-docker/index.md
@@ -13,7 +13,7 @@ The TDengine image starts with the HTTP service activated by default, using the
docker run -d --name tdengine -p 6041:6041 tdengine/tdengine
```
-The above command starts a container named "tdengine" and maps the HTTP service end 6041 to the host port 6041. You can verify that the HTTP service provided in this container is available using the following command.
+The above command starts a container named "tdengine" and maps the HTTP service port 6041 to the host port 6041. You can verify that the HTTP service provided in this container is available using the following command.
```shell
curl -u root:taosdata -d "show databases" localhost:6041/rest/sql
@@ -34,7 +34,7 @@ taos> show databases;
Query OK, 1 row(s) in set (0.002843s)
```
-The TDengine server running in the container uses the container's hostname to establish a connection. Using TDengine CLI or various connectors (such as JDBC-JNI) to access the TDengine inside the container from outside the container is more complicated. So the above is the simplest way to access the TDengine service in the container and is suitable for some simple scenarios. Please refer to the next section if you want to access the TDengine service in the container from containerized using TDengine CLI or various connectors in some complex scenarios.
+The TDengine server running in the container uses the container's hostname to establish a connection. Using TDengine CLI or various connectors (such as JDBC-JNI) to access the TDengine inside the container from outside the container is more complicated. So the above is the simplest way to access the TDengine service in the container and is suitable for some simple scenarios. Please refer to the next section if you want to access the TDengine service in the container from outside the container using TDengine CLI or various connectors for complex scenarios.
## Start TDengine on the host network
@@ -42,7 +42,7 @@ The TDengine server running in the container uses the container's hostname to es
docker run -d --name tdengine --network host tdengine/tdengine
```
-The above command starts TDengine on the host network and uses the host's FQDN to establish a connection instead of the container's hostname. It works too, like using `systemctl` to start TDengine on the host. If the TDengine client is already installed on the host, you can access it directly with the following command.
+The above command starts TDengine on the host network and uses the host's FQDN to establish a connection instead of the container's hostname. It is the equivalent of using `systemctl` to start TDengine on the host. If the TDengine client is already installed on the host, you can access it directly with the following command.
```shell
$ taos
@@ -382,7 +382,7 @@ password: taosdata
Suppose you want to deploy multiple taosAdapters to improve throughput and provide high availability. In that case, the recommended configuration method uses a reverse proxy such as Nginx to offer a unified access entry. For specific configuration methods, please refer to the official documentation of Nginx. Here is an example:
```docker
- ersion: "3"
+ version: "3"
networks:
inter:
diff --git a/docs-en/14-reference/12-config/index.md b/docs-en/14-reference/12-config/index.md
index 10e23bbdb85c1aa65ffa021d3d7a7fdaf7b77b09..8ad9a474a02c5cc52559ccdc5910ad9d7b6264ae 100644
--- a/docs-en/14-reference/12-config/index.md
+++ b/docs-en/14-reference/12-config/index.md
@@ -78,7 +78,7 @@ taos --dump-config
| Note | REST service is provided by `taosd` before 2.4.0.0 but by `taosAdapter` after 2.4.0.0, the default port of REST service is 6041 |
:::note
-TDengine uses continuous 13 ports, both TCP and UDP, from the port specified by `serverPort`. These ports need to be kept open if firewall is enabled. Below table describes the ports used by TDengine in details.
+TDengine uses 13 continuous ports, both TCP and UDP, starting with the port specified by `serverPort`. You should ensure, in your firewall rules, that these ports are kept open. Below table describes the ports used by TDengine in details.
:::
@@ -197,7 +197,7 @@ TDengine uses continuous 13 ports, both TCP and UDP, from the port specified by
| Default Value | TimeZone configured in the host |
:::info
-To handle the data insertion and data query from multiple timezones, Unix Timestamp is used and stored TDengine. The timestamp generated from any timezones at same time is same in Unix timestamp. To make sure the time on client side can be converted to Unix timestamp correctly, the timezone must be set properly.
+To handle the data insertion and data query from multiple timezones, Unix Timestamp is used and stored in TDengine. The timestamp generated from any timezones at same time is same in Unix timestamp. To make sure the time on client side can be converted to Unix timestamp correctly, the timezone must be set properly.
On Linux system, TDengine clients automatically obtain timezone from the host. Alternatively, the timezone can be configured explicitly in configuration file `taos.cfg` like below.
@@ -209,7 +209,7 @@ timezone Asia/Shanghai
The above examples are all proper configuration for the timezone of UTC+8. On Windows system, however, `timezone Asia/Shanghai` is not supported, it must be set as `timezone UTC-8`.
-The setting for timezone impacts the strings not in Unix timestamp, keywords or functions related to date/time, for example
+The setting for timezone impacts strings that are not in Unix timestamp format and keywords or functions related to date/time. For example:
```sql
SELECT count(*) FROM table_name WHERE TS<'2019-04-11 12:01:08';
@@ -227,7 +227,7 @@ If the timezone is UTC, it's equal to
SELECT count(*) FROM table_name WHERE TS<1554984068000;
```
-To avoid the problems of using time strings, Unix timestamp can be used directly. Furthermore, time strings with timezone can be used in SQL statement, for example "2013-04-12T15:52:01.123+08:00" in RFC3339 format or "2013-04-12T15:52:01.123+0800" in ISO-8601 format, they are not influenced by timezone setting when converted to Unix timestamp.
+To avoid the problems of using time strings, Unix timestamp can be used directly. Furthermore, time strings with timezone can be used in SQL statements. For example "2013-04-12T15:52:01.123+08:00" in RFC3339 format or "2013-04-12T15:52:01.123+0800" in ISO-8601 format are not influenced by timezone setting when converted to Unix timestamp.
:::
@@ -244,7 +244,7 @@ A specific type "nchar" is provided in TDengine to store non-ASCII characters su
The characters input on the client side are encoded using the default system encoding, which is UTF-8 on Linux, or GB18030 or GBK on some systems in Chinese, POSIX in docker, CP936 on Windows in Chinese. The encoding of the operating system in use must be set correctly so that the characters in nchar type can be converted to UCS4-LE.
-The locale definition standard on Linux is: \_., for example, in "zh_CN.UTF-8", "zh" means Chinese, "CN" means China mainland, "UTF-8" means charset. On Linux andMac OSX, the charset can be set by locale in the system. On Windows system another configuration parameter `charset` must be used to configure charset because the locale used on Windows is not POSIX standard. Of course, `charset` can also be used on Linux to specify the charset.
+The locale definition standard on Linux is: \_., for example, in "zh_CN.UTF-8", "zh" means Chinese, "CN" means China mainland, "UTF-8" means charset. On Linux and Mac OSX, the charset can be set by locale in the system. On Windows system another configuration parameter `charset` must be used to configure charset because the locale used on Windows is not POSIX standard. Of course, `charset` can also be used on Linux to specify the charset.
:::
@@ -263,7 +263,7 @@ On Linux, if `charset` is not set in `taos.cfg`, when `taos` is started, the cha
locale zh_CN.UTF-8
```
-Besides, on Linux system, if the charset contained in `locale` is not consistent with that set by `charset`, the one who comes later in the configuration file is used.
+On a Linux system, if the charset contained in `locale` is not consistent with that set by `charset`, the later setting in the configuration file takes precedence.
```title="Effective charset is GBK"
locale zh_CN.UTF-8
@@ -778,7 +778,7 @@ To prevent system resource from being exhausted by multiple concurrent streams,
## HTTP Parameters
:::note
-HTTP server had been provided by `taosd` prior to version 2.4.0.0, now is provided by `taosAdapter` after version 2.4.0.0.
+HTTP service was provided by `taosd` prior to version 2.4.0.0 and is provided by `taosAdapter` after version 2.4.0.0.
The parameters described in this section are only application in versions prior to 2.4.0.0. If you are using any version from 2.4.0.0, please refer to [taosAdapter](/reference/taosadapter/).
:::
diff --git a/docs-en/14-reference/13-schemaless/13-schemaless.md b/docs-en/14-reference/13-schemaless/13-schemaless.md
index ff0b2c51bd433788c593b6e20d4c341a9af7e921..acbbb1cd3c5a7c50e226644f2de9e0e77274c6dd 100644
--- a/docs-en/14-reference/13-schemaless/13-schemaless.md
+++ b/docs-en/14-reference/13-schemaless/13-schemaless.md
@@ -1,11 +1,11 @@
---
title: Schemaless Writing
-description: "The Schemaless write method eliminates the need to create super tables/sub tables in advance and automatically creates the storage structure corresponding to the data as it is written to the interface."
+description: "The Schemaless write method eliminates the need to create super tables/sub tables in advance and automatically creates the storage structure corresponding to the data, as it is written to the interface."
---
-In IoT applications, many data items are often collected for intelligent control, business analysis, device monitoring, etc. Due to the version upgrades of the application logic, or the hardware adjustment of the devices themselves, the data collection items may change frequently. To facilitate the data logging work in such cases, TDengine starting from version 2.2.0.0 provides a series of interfaces to the schemaless writing method, which eliminate the need to create super tables and subtables in advance by automatically creating the storage structure corresponding to the data as the data is written to the interface. And when necessary, schemaless writing will automatically add the required columns to ensure that the data written by the user is stored correctly.
+In IoT applications, data is collected for many purposes such as intelligent control, business analysis, device monitoring and so on. Due to changes in business or functional requirements or changes in device hardware, the application logic and even the data collected may change. To provide the flexibility needed in such cases and in a rapidly changing IoT landscape, TDengine starting from version 2.2.0.0, provides a series of interfaces for the schemaless writing method. These interfaces eliminate the need to create super tables and subtables in advance by automatically creating the storage structure corresponding to the data as the data is written to the interface. When necessary, schemaless writing will automatically add the required columns to ensure that the data written by the user is stored correctly.
-The schemaless writing method creates super tables and their corresponding subtables completely indistinguishable from the super tables and subtables created directly via SQL. You can write data directly to them via SQL statements. Note that the names of tables created by schemaless writing are based on fixed mapping rules for tag values, so they are not explicitly ideographic and lack readability.
+The schemaless writing method creates super tables and their corresponding subtables. These are completely indistinguishable from the super tables and subtables created directly via SQL. You can write data directly to them via SQL statements. Note that the names of tables created by schemaless writing are based on fixed mapping rules for tag values, so they are not explicitly ideographic and they lack readability.
## Schemaless Writing Line Protocol
@@ -76,8 +76,7 @@ If the subtable obtained by the parse line protocol does not exist, Schemaless c
8. Errors encountered throughout the processing will interrupt the writing process and return an error code.
:::tip
-All processing logic of schemaless will still follow TDengine's underlying restrictions on data structures, such as the total length of each row of data cannot exceed
-16k bytes. See [TAOS SQL Boundary Limits](/taos-sql/limit) for specific constraints in this area.
+All processing logic of schemaless will still follow TDengine's underlying restrictions on data structures, such as the total length of each row of data cannot exceed 48k bytes. See [TAOS SQL Boundary Limits](/taos-sql/limit) for specific constraints in this area.
:::
## Time resolution recognition
@@ -87,7 +86,7 @@ Three specified modes are supported in the schemaless writing process, as follow
| **Serial** | **Value** | **Description** |
| -------- | ------------------- | ------------------------------- |
| 1 | SML_LINE_PROTOCOL | InfluxDB Line Protocol |
-| 2 | SML_TELNET_PROTOCOL | OpenTSDB Text Line Protocol | | 2 | SML_TELNET_PROTOCOL | OpenTSDB Text Line Protocol
+| 2 | SML_TELNET_PROTOCOL | OpenTSDB Text Line Protocol |
| 3 | SML_JSON_PROTOCOL | JSON protocol format |
In the SML_LINE_PROTOCOL parsing mode, the user is required to specify the time resolution of the input timestamp. The available time resolutions are shown in the following table.
@@ -106,8 +105,11 @@ In SML_TELNET_PROTOCOL and SML_JSON_PROTOCOL modes, the time precision is determ
## Data schema mapping rules
-This section describes how data for line protocols are mapped to data with a schema. The data measurement in each line protocol is mapped to
-The tag name in tag_set is the name of the tag in the data schema, and the name in field_set is the column's name. The following data is used as an example to illustrate the mapping rules.
+This section describes how data for line protocols are mapped to data with a schema. The data measurement in each line protocol is mapped as follows:
+- The tag name in tag_set is the name of the tag in the data schema
+- The name in field_set is the column's name.
+
+The following data is used as an example to illustrate the mapping rules.
```json
st,t1=3,t2=4,t3=t3 c1=3i64,c3="passit",c2=false,c4=4f64 1626006833639000000
@@ -139,7 +141,7 @@ st,t1=3,t2=4,t3=t3 c1=3i64,c5="pass" 1626006833639000000
st,t1=3,t2=4,t3=t3 c1=3i64,c5="passit" 1626006833640000000
```
-The first line of the line protocol parsing will declare column c5 is a BINARY(4) field, the second line data write will extract column c5 is still a BINARY column. Still, its width is 6, then you need to increase the width of the BINARY field to be able to accommodate the new string.
+The first line of the line protocol parsing will declare column c5 is a BINARY(4) field. The second line data write will parse column c5 as a BINARY column. But in the second line, c5's width is 6 so you need to increase the width of the BINARY field to be able to accommodate the new string.
```json
st,t1=3,t2=4,t3=t3 c1=3i64 1626006833639000000
diff --git a/docs-en/14-reference/_collectd.mdx b/docs-en/14-reference/_collectd.mdx
index 1f57d883eec9feadc3cc460bf968b0dd43fedfe8..ce88328098a181de48dcaa080ef45f228b20bf1c 100644
--- a/docs-en/14-reference/_collectd.mdx
+++ b/docs-en/14-reference/_collectd.mdx
@@ -25,7 +25,7 @@ The default database name written by taosAdapter is `collectd`. You can also mod
#collectd
collectd uses a plugin mechanism to write the collected monitoring data to different data storage software in various forms. tdengine supports both direct collection plugins and write_tsdb plugins.
-#### is configured to receive data from the direct collection plugin
+#### Configure the direct collection plugin
Modify the relevant configuration items in the collectd configuration file (default location /etc/collectd/collectd.conf).
@@ -62,7 +62,7 @@ LoadPlugin write_tsdb
```
-Where fills in the server's domain name or IP address running taosAdapter. Fill in the data that taosAdapter uses to receive the collectd write_tsdb plugin (default is 6047).
+Where is the domain name or IP address of the server running taosAdapter. Fill in the data that taosAdapter uses to receive the collectd write_tsdb plugin (default is 6047).
```text
LoadPlugin write_tsdb
diff --git a/docs-en/14-reference/_tcollector.mdx b/docs-en/14-reference/_tcollector.mdx
index 85794d54007b70acf205b1bbc897cec1d0c4f824..42b021410e3862c4fa328d8dae40dcac1456e929 100644
--- a/docs-en/14-reference/_tcollector.mdx
+++ b/docs-en/14-reference/_tcollector.mdx
@@ -17,7 +17,7 @@ password = "taosdata"
...
```
-The taosAdapter writes to the database with the default name `tcollector`. You can also modify the taosAdapter configuration file dbs entry to specify a different name. user and password fill in the actual TDengine configuration values. After changing the configuration file, you need to restart the taosAdapter.
+The taosAdapter writes to the database with the default name `tcollector`. You can also modify the taosAdapter configuration file dbs entry to specify a different name. Fill in the actual user and password for TDengine. After changing the configuration file, you need to restart the taosAdapter.
- You can also enable taosAdapter to receive tcollector data by using the taosAdapter command-line parameters or setting environment variables.
@@ -25,7 +25,7 @@ The taosAdapter writes to the database with the default name `tcollector`. You c
To use TCollector, you need to download its [source code](https://github.com/OpenTSDB/tcollector). Its configuration items are in its source code. Note: TCollector differs significantly from version to version, so here is an example of the latest code for the current master branch (git commit: 37ae920).
-Modify the contents of the `collectors/etc/config.py` and `tcollector.py` files. Change the address of the OpenTSDB host to the domain name or IP address of the server where taosAdapter is deployed, and change the port to the port that taosAdapter supports TCollector on (default is 6049).
+Modify the contents of the `collectors/etc/config.py` and `tcollector.py` files. Change the address of the OpenTSDB host to the domain name or IP address of the server where taosAdapter is deployed, and change the port to the port on which taosAdapter supports TCollector (default is 6049).
Example of git diff output of source code changes.
diff --git a/docs-en/20-third-party/01-grafana.mdx b/docs-en/20-third-party/01-grafana.mdx
index dc2033ae6f789908d4d9f9ecd96c9396748c4400..b3cab6271001feb56714f808906cb78ba1098593 100644
--- a/docs-en/20-third-party/01-grafana.mdx
+++ b/docs-en/20-third-party/01-grafana.mdx
@@ -3,13 +3,13 @@ sidebar_label: Grafana
title: Grafana
---
-TDengine can be quickly integrated with the open-source data visualization system [Grafana](https://www.grafana.com/) to build a data monitoring and alerting system. The whole process does not require any code development. And you can visualize the contents of the data tables in TDengine on a DashBoard.
+TDengine can be quickly integrated with the open-source data visualization system [Grafana](https://www.grafana.com/) to build a data monitoring and alerting system. The whole process does not require any code development. And you can visualize the contents of the data tables in TDengine on a dashboard.
You can learn more about using the TDengine plugin on [GitHub](https://github.com/taosdata/grafanaplugin/blob/master/README.md).
## Prerequisites
-In order for Grafana to add the TDengine data source successfully, the following preparations are required:
+In order for Grafana to add the TDengine data source successfully, the following preparation is required:
1. The TDengine cluster is deployed and functioning properly
2. taosAdapter is installed and running properly. Please refer to the taosAdapter manual for details.
@@ -36,7 +36,7 @@ GF_VERSION=3.1.4
wget https://github.com/taosdata/grafanaplugin/releases/download/v$GF_VERSION/tdengine-datasource-$GF_VERSION.zip
```
-Take CentOS 7.2 for example, extract the plugin package to /var/lib/grafana/plugins directory, and restart grafana.
+In CentOS 7.2 for example, extract the plugin package to /var/lib/grafana/plugins directory, and restart grafana.
```bash
sudo unzip tdengine-datasource-$GF_VERSION.zip -d /var/lib/grafana/plugins/
@@ -76,13 +76,13 @@ Enter the datasource configuration page, and follow the default prompts to modif
- User: TDengine user name.
- Password: TDengine user password.
-Click `Save & Test` to test. Follows are a success.
+Click `Save & Test` to test. You should see a success message if the test worked.

### Create Dashboard
-Go back to the main interface to create the Dashboard, click Add Query to enter the panel query page:
+Go back to the main interface to create a dashboard and click Add Query to enter the panel query page:

diff --git a/docs-en/20-third-party/03-telegraf.md b/docs-en/20-third-party/03-telegraf.md
index 0d563c9ff36268ac27e18e21fefed789789dc1a7..6a7aac322f9def880f58d7ed0adcc4a8f3687ed1 100644
--- a/docs-en/20-third-party/03-telegraf.md
+++ b/docs-en/20-third-party/03-telegraf.md
@@ -5,7 +5,7 @@ title: Telegraf writing
import Telegraf from "../14-reference/_telegraf.mdx"
-Telegraf is a viral metrics collection open-source software. Telegraf can collect the operation information of various components without writing any scripts to collect regularly, reducing the difficulty of data acquisition.
+Telegraf is a viral, open-source, metrics collection software. Telegraf can collect the operation information of various components without having to write any scripts to collect regularly, reducing the difficulty of data acquisition.
Telegraf's data can be written to TDengine by simply adding the output configuration of Telegraf to the URL corresponding to taosAdapter and modifying several configuration items. The presence of Telegraf data in TDengine can take advantage of TDengine's efficient storage query performance and clustering capabilities for time-series data.
diff --git a/docs-en/20-third-party/05-collectd.md b/docs-en/20-third-party/05-collectd.md
index 609e55842ab35cdc2d394663f5450f908e49f7f7..db62f2ecd1afb4936466ca0243a7e14ff294f8b6 100644
--- a/docs-en/20-third-party/05-collectd.md
+++ b/docs-en/20-third-party/05-collectd.md
@@ -6,7 +6,7 @@ title: collectd writing
import CollectD from "../14-reference/_collectd.mdx"
-collectd is a daemon used to collect system performance metric data. collectd provides various storage mechanisms to store different values. It periodically counts system performance statistics number while the system is running and storing information. You can use this information to help identify current system performance bottlenecks and predict future system load.
+collectd is a daemon used to collect system performance metric data. collectd provides various storage mechanisms to store different values. It periodically counts system performance statistics while the system is running and storing information. You can use this information to help identify current system performance bottlenecks and predict future system load.
You can write the data collected by collectd to TDengine by simply modifying the configuration of collectd to the domain name (or IP address) and corresponding port of the server running taosAdapter. It can take full advantage of TDengine's efficient storage query performance and clustering capability for time-series data.
diff --git a/docs-en/20-third-party/06-statsd.md b/docs-en/20-third-party/06-statsd.md
index bf4b6c7ab5dac4114cad0d650b2aeb026a67581c..40e927b9fd1d2eca9d454a987ac51d533eb75005 100644
--- a/docs-en/20-third-party/06-statsd.md
+++ b/docs-en/20-third-party/06-statsd.md
@@ -7,7 +7,7 @@ import StatsD from "../14-reference/_statsd.mdx"
StatsD is a simple daemon for aggregating application metrics, which has evolved rapidly in recent years into a unified protocol for collecting application performance metrics.
-You can write StatsD data to TDengine by simply modifying in the configuration file of StatsD with the domain name (or IP address) of the server running taosAdapter and the corresponding port. It can take full advantage of TDengine's efficient storage query performance and clustering capabilities for time-series data.
+You can write StatsD data to TDengine by simply modifying the configuration file of StatsD with the domain name (or IP address) of the server running taosAdapter and the corresponding port. It can take full advantage of TDengine's efficient storage query performance and clustering capabilities for time-series data.
## Prerequisites
diff --git a/docs-en/20-third-party/07-icinga2.md b/docs-en/20-third-party/07-icinga2.md
index ba9cde8cea7504ac9df871d5f6aa42cc5c94d895..b27196dfe313b468eeb73ff4b114d9d955618c3e 100644
--- a/docs-en/20-third-party/07-icinga2.md
+++ b/docs-en/20-third-party/07-icinga2.md
@@ -5,7 +5,7 @@ title: icinga2 writing
import Icinga2 from "../14-reference/_icinga2.mdx"
-icinga2 is an open-source software monitoring host and network initially developed from the Nagios network monitoring application. Currently, icinga2 is distributed under the GNU GPL v2 license.
+icinga2 is an open-source, host and network monitoring software initially developed from the Nagios network monitoring application. Currently, icinga2 is distributed under the GNU GPL v2 license.
You can write the data collected by icinga2 to TDengine by simply modifying the icinga2 configuration to point to the taosAdapter server and the corresponding port, taking advantage of TDengine's efficient storage and query performance and clustering capabilities for time-series data.
diff --git a/docs-en/20-third-party/09-emq-broker.md b/docs-en/20-third-party/09-emq-broker.md
index 738372cabd736c0be47b4080cc2c984e5110236c..d3eafebc14e8ddc29b03abf8785a6c0a013ef014 100644
--- a/docs-en/20-third-party/09-emq-broker.md
+++ b/docs-en/20-third-party/09-emq-broker.md
@@ -3,7 +3,7 @@ sidebar_label: EMQX Broker
title: EMQX Broker writing
---
-MQTT is a popular IoT data transfer protocol, [EMQX](https://github.com/emqx/emqx) is an open-source MQTT Broker software, you can write MQTT data directly to TDengine without any code, you only need to use "rules" in EMQX Dashboard to create a simple configuration. EMQX supports saving data to TDengine by sending it to web services and provides a native TDengine driver for direct saving in the Enterprise Edition. Please refer to the [EMQX official documentation](https://www.emqx.io/docs/en/v4.4/rule/rule-engine.html) for details on how to use it.).
+MQTT is a popular IoT data transfer protocol. [EMQX](https://github.com/emqx/emqx) is an open-source MQTT Broker software. You can write MQTT data directly to TDengine without any code. You only need to setup "rules" in EMQX Dashboard to create a simple configuration. EMQX supports saving data to TDengine by sending data to a web service and provides a native TDengine driver for direct saving in the Enterprise Edition. Please refer to the [EMQX official documentation](https://www.emqx.io/docs/en/v4.4/rule/rule-engine.html) for details on how to use it.).
## Prerequisites
diff --git a/docs-en/20-third-party/11-kafka.md b/docs-en/20-third-party/11-kafka.md
index 9c78a6645a0578d3b8d494d1fa60831eb88b3c81..6720af8bf81ea2f4fce415a54847453f578ababf 100644
--- a/docs-en/20-third-party/11-kafka.md
+++ b/docs-en/20-third-party/11-kafka.md
@@ -7,7 +7,7 @@ TDengine Kafka Connector contains two plugins: TDengine Source Connector and TDe
## What is Kafka Connect?
-Kafka Connect is a component of Apache Kafka that enables other systems, such as databases, cloud services, file systems, etc., to connect to Kafka easily. Data can flow from other software to Kafka via Kafka Connect and Kafka to other systems via Kafka Connect. Plugins that read data from other software are called Source Connectors, and plugins that write data to other software are called Sink Connectors. Neither Source Connector nor Sink Connector will directly connect to Kafka Broker, and Source Connector transfers data to Kafka Connect. Sink Connector receives data from Kafka Connect.
+Kafka Connect is a component of [Apache Kafka](https://kafka.apache.org/) that enables other systems, such as databases, cloud services, file systems, etc., to connect to Kafka easily. Data can flow from other software to Kafka via Kafka Connect and Kafka to other systems via Kafka Connect. Plugins that read data from other software are called Source Connectors, and plugins that write data to other software are called Sink Connectors. Neither Source Connector nor Sink Connector will directly connect to Kafka Broker, and Source Connector transfers data to Kafka Connect. Sink Connector receives data from Kafka Connect.

@@ -17,7 +17,7 @@ TDengine Source Connector is used to read data from TDengine in real-time and se
## What is Confluent?
-Confluent adds many extensions to Kafka. include:
+[Confluent](https://www.confluent.io/) adds many extensions to Kafka. include:
1. Schema Registry
2. REST Proxy
@@ -79,10 +79,10 @@ Development: false
git clone https://github.com:taosdata/kafka-connect-tdengine.git
cd kafka-connect-tdengine
mvn clean package
-unzip -d $CONFLUENT_HOME/share/confluent-hub-components/ target/components/packages/taosdata-kafka-connect-tdengine-0.1.0.zip
+unzip -d $CONFLUENT_HOME/share/java/ target/components/packages/taosdata-kafka-connect-tdengine-*.zip
```
-The above script first clones the project source code and then compiles and packages it with Maven. After the package is complete, the zip package of the plugin is generated in the `target/components/packages/` directory. Unzip this zip package to the path where the plugin is installed. The path to install the plugin is in the configuration file `$CONFLUENT_HOME/etc/kafka/connect-standalone.properties`. The default path is `$CONFLUENT_HOME/share/confluent-hub-components/`.
+The above script first clones the project source code and then compiles and packages it with Maven. After the package is complete, the zip package of the plugin is generated in the `target/components/packages/` directory. Unzip this zip package to plugin path. We used `$CONFLUENT_HOME/share/java/` above because it's a build in plugin path.
### Install with confluent-hub
@@ -96,7 +96,7 @@ confluent local services start
```
:::note
-Be sure to install the plugin before starting Confluent. Otherwise, there will be a class not found error. The log of Kafka Connect (default path: /tmp/confluent.xxxx/connect/logs/connect.log) will output the successfully installed plugin, which users can use to determine whether the plugin is installed successfully.
+Be sure to install the plugin before starting Confluent. Otherwise, Kafka Connect will fail to discover the plugins.
:::
:::tip
@@ -123,6 +123,59 @@ Control Center is [UP]
To clear data, execute `rm -rf /tmp/confluent.106668`.
:::
+### Check Confluent Services Status
+
+Use command bellow to check the status of all service:
+
+```
+confluent local services status
+```
+
+The expected output is:
+```
+Connect is [UP]
+Control Center is [UP]
+Kafka is [UP]
+Kafka REST is [UP]
+ksqlDB Server is [UP]
+Schema Registry is [UP]
+ZooKeeper is [UP]
+```
+
+### Check Successfully Loaded Plugin
+
+After Kafka Connect was completely started, you can use bellow command to check if our plugins are installed successfully:
+```
+confluent local services connect plugin list
+```
+
+The output should contains `TDengineSinkConnector` and `TDengineSourceConnector` as bellow:
+
+```
+Available Connect Plugins:
+[
+ {
+ "class": "com.taosdata.kafka.connect.sink.TDengineSinkConnector",
+ "type": "sink",
+ "version": "1.0.0"
+ },
+ {
+ "class": "com.taosdata.kafka.connect.source.TDengineSourceConnector",
+ "type": "source",
+ "version": "1.0.0"
+ },
+......
+```
+
+If not, please check the log file of Kafka Connect. To view the log file path, please execute:
+
+```
+echo `cat /tmp/confluent.current`/connect/connect.stdout
+```
+It should produce a path like:`/tmp/confluent.104086/connect/connect.stdout`
+
+Besides log file `connect.stdout` there is a file named `connect.properties`. At the end of this file you can see the effective `plugin.path` which is a series of paths joined by comma. If Kafka Connect not found our plugins, it's probably because the installed path is not included in `plugin.path`.
+
## The use of TDengine Sink Connector
The role of the TDengine Sink Connector is to synchronize the data of the specified topic to TDengine. Users do not need to create databases and super tables in advance. The name of the target database can be specified manually (see the configuration parameter connection.database), or it can be generated according to specific rules (see the configuration parameter connection.database.prefix).
@@ -142,7 +195,7 @@ vi sink-demo.properties
sink-demo.properties' content is following:
```ini title="sink-demo.properties"
-name=tdengine-sink-demo
+name=TDengineSinkConnector
connector.class=com.taosdata.kafka.connect.sink.TDengineSinkConnector
tasks.max=1
topics=meters
@@ -151,6 +204,7 @@ connection.user=root
connection.password=taosdata
connection.database=power
db.schemaless=line
+data.precision=ns
key.converter=org.apache.kafka.connect.storage.StringConverter
value.converter=org.apache.kafka.connect.storage.StringConverter
```
@@ -177,6 +231,7 @@ If the above command is executed successfully, the output is as follows:
"connection.url": "jdbc:TAOS://127.0.0.1:6030",
"connection.user": "root",
"connector.class": "com.taosdata.kafka.connect.sink.TDengineSinkConnector",
+ "data.precision": "ns",
"db.schemaless": "line",
"key.converter": "org.apache.kafka.connect.storage.StringConverter",
"tasks.max": "1",
@@ -221,10 +276,10 @@ Database changed.
taos> select * from meters;
ts | current | voltage | phase | groupid | location |
===============================================================================================================================================================
- 2022-03-28 09:56:51.249000000 | 11.800000000 | 221.000000000 | 0.280000000 | 2 | California.LoSangeles |
- 2022-03-28 09:56:51.250000000 | 13.400000000 | 223.000000000 | 0.290000000 | 2 | California.LoSangeles |
- 2022-03-28 09:56:51.249000000 | 10.800000000 | 223.000000000 | 0.290000000 | 3 | California.LoSangeles |
- 2022-03-28 09:56:51.250000000 | 11.300000000 | 221.000000000 | 0.350000000 | 3 | California.LoSangeles |
+ 2022-03-28 09:56:51.249000000 | 11.800000000 | 221.000000000 | 0.280000000 | 2 | California.LosAngeles |
+ 2022-03-28 09:56:51.250000000 | 13.400000000 | 223.000000000 | 0.290000000 | 2 | California.LosAngeles |
+ 2022-03-28 09:56:51.249000000 | 10.800000000 | 223.000000000 | 0.290000000 | 3 | California.LosAngeles |
+ 2022-03-28 09:56:51.250000000 | 11.300000000 | 221.000000000 | 0.350000000 | 3 | California.LosAngeles |
Query OK, 4 row(s) in set (0.004208s)
```
@@ -356,6 +411,7 @@ The following configuration items apply to TDengine Sink Connector and TDengine
4. `max.retries`: The maximum number of retries when an error occurs. Defaults to 1.
5. `retry.backoff.ms`: The time interval for retry when sending an error. The unit is milliseconds. The default is 3000.
6. `db.schemaless`: Data format, could be one of `line`, `json`, and `telnet`. Represent InfluxDB line protocol format, OpenTSDB JSON format, and OpenTSDB Telnet line protocol format.
+7. `data.precision`: The time precision when use InfluxDB line protocol format data, could be one of `ms`, `us` and `ns`. The default is `ns`.
### TDengine Source Connector specific configuration
@@ -366,7 +422,13 @@ The following configuration items apply to TDengine Sink Connector and TDengine
5. `fetch.max.rows`: The maximum number of rows retrieved when retrieving the database. Default is 100.
6. `out.format`: The data format. The value could be line or json. The line represents the InfluxDB Line protocol format, and json represents the OpenTSDB JSON format. Default is `line`.
-## feedback
+
+## Other notes
+
+1. To install plugin to a customized location, refer to https://docs.confluent.io/home/connect/self-managed/install.html#install-connector-manually.
+2. To use Kafka Connect without confluent, refer to https://kafka.apache.org/documentation/#connect.
+
+## Feedback
https://github.com/taosdata/kafka-connect-tdengine/issues
diff --git a/docs-en/21-tdinternal/01-arch.md b/docs-en/21-tdinternal/01-arch.md
index 16d4b7afe26107e251a542ee24b644c1d372def0..4d8bed4d2d6b3a0404e10213aeab599767325cc2 100644
--- a/docs-en/21-tdinternal/01-arch.md
+++ b/docs-en/21-tdinternal/01-arch.md
@@ -5,11 +5,11 @@ title: Architecture
## Cluster and Primary Logic Unit
-The design of TDengine is based on the assumption that any hardware or software system is not 100% reliable and that no single node can provide sufficient computing and storage resources to process massive data. Therefore, TDengine has been designed in a distributed and high-reliability architecture since day one of the development, so that hardware failure or software failure of any single even multiple servers will not affect the availability and reliability of the system. At the same time, through node virtualization and automatic load-balancing technology, TDengine can make the most efficient use of computing and storage resources in heterogeneous clusters to reduce hardware resources significantly.
+The design of TDengine is based on the assumption that any hardware or software system is not 100% reliable and that no single node can provide sufficient computing and storage resources to process massive data. Therefore, since day one, TDengine has been designed as a natively distributed system, with high-reliability architecture. Hardware failure or software failure of a single, or even multiple servers will not affect the availability and reliability of the system. At the same time, through node virtualization and automatic load-balancing technology, TDengine can make the most efficient use of computing and storage resources in heterogeneous clusters to reduce hardware resource needs, significantly.
### Primary Logic Unit
-Logical structure diagram of TDengine distributed architecture as following:
+Logical structure diagram of TDengine's distributed architecture is as follows:

Figure 1: TDengine architecture diagram
@@ -18,25 +18,25 @@ A complete TDengine system runs on one or more physical nodes. Logically, it inc
**Physical node (pnode)**: A pnode is a computer that runs independently and has its own computing, storage and network capabilities. It can be a physical machine, virtual machine, or Docker container installed with OS. The physical node is identified by its configured FQDN (Fully Qualified Domain Name). TDengine relies entirely on FQDN for network communication. If you don't know about FQDN, please check [wikipedia](https://en.wikipedia.org/wiki/Fully_qualified_domain_name).
-**Data node (dnode):** A dnode is a running instance of the TDengine server-side execution code taosd on a physical node. A working system must have at least one data node. A dnode contains zero to multiple logical virtual nodes (VNODE), zero or at most one logical management node (mnode). The unique identification of a dnode in the system is determined by the instance's End Point (EP). EP is a combination of FQDN (Fully Qualified Domain Name) of the physical node where the dnode is located and the network port number (Port) configured by the system. By configuring different ports, a physical node (a physical machine, virtual machine or container) can run multiple instances or have multiple data nodes.
+**Data node (dnode):** A dnode is a running instance of the TDengine server-side execution code taosd on a physical node (pnode). A working system must have at least one data node. A dnode contains zero to multiple logical virtual nodes (VNODE) and zero or at most one logical management node (mnode). The unique identification of a dnode in the system is determined by the instance's End Point (EP). EP is a combination of FQDN (Fully Qualified Domain Name) of the physical node where the dnode is located and the network port number (Port) configured by the system. By configuring different ports, a physical node (a physical machine, virtual machine or container) can run multiple instances or have multiple data nodes.
-**Virtual node (vnode)**: To better support data sharding, load balancing and prevent data from overheating or skewing, data nodes are virtualized into multiple virtual nodes (vnode, V2, V3, V4, etc. in the figure). Each vnode is a relatively independent work unit, which is the basic unit of time-series data storage and has independent running threads, memory space and persistent storage path. A vnode contains a certain number of tables (data collection points). When a new table is created, the system checks whether a new vnode needs to be created. The number of vnodes that can be created on a data node depends on the hardware capacities of the physical node where the data node is located. A vnode belongs to only one DB, but a DB can have multiple vnodes. In addition to the stored time-series data, a vnode also stores the schema and tag values of the included tables. A virtual node is uniquely identified in the system by the EP of the data node and the VGroup ID to which it belongs and is created and managed by the management node.
+**Virtual node (vnode)**: To better support data sharding, load balancing and prevent data from overheating or skewing, data nodes are virtualized into multiple virtual nodes (vnode, V2, V3, V4, etc. in the figure). Each vnode is a relatively independent work unit, which is the basic unit of time-series data storage and has independent running threads, memory space and persistent storage path. A vnode contains a certain number of tables (data collection points). When a new table is created, the system checks whether a new vnode needs to be created. The number of vnodes that can be created on a data node depends on the capacity of the hardware of the physical node where the data node is located. A vnode belongs to only one DB, but a DB can have multiple vnodes. In addition to the stored time-series data, a vnode also stores the schema and tag values of the included tables. A virtual node is uniquely identified in the system by the EP of the data node and the VGroup ID to which it belongs and is created and managed by the management node.
-**Management node (mnode)**: A virtual logical unit responsible for monitoring and maintaining the running status of all data nodes and load balancing among nodes (M in the figure). At the same time, the management node is also responsible for the storage and management of metadata (including users, databases, tables, static tags, etc.), so it is also called Meta Node. Multiple (up to 5) mnodes can be configured in a TDengine cluster, and they are automatically constructed into a virtual management node group (M0, M1, M2 in the figure). The master/slave mechanism is adopted for the mnode group and the data synchronization is carried out in a strongly consistent way. Any data update operation can only be executed on the master. The creation of mnode cluster is completed automatically by the system without manual intervention. There is at most one mnode on each dnode, which is uniquely identified by the EP of the data node to which it belongs. Each dnode automatically obtains the EP of the dnode where all mnodes in the whole cluster are located through internal messaging interaction.
+**Management node (mnode)**: A virtual logical unit responsible for monitoring and maintaining the running status of all data nodes and load balancing among nodes (M in the figure). At the same time, the management node is also responsible for the storage and management of metadata (including users, databases, tables, static tags, etc.), so it is also called Meta Node. Multiple (up to 5) mnodes can be configured in a TDengine cluster, and they are automatically constructed into a virtual management node group (M0, M1, M2 in the figure). The master/slave mechanism is adopted for the mnode group and the data synchronization is carried out in a strongly consistent way. Any data update operation can only be executed on the master. The creation of mnode cluster is completed automatically by the system without manual intervention. There is at most one mnode on each dnode, which is uniquely identified by the EP of the data node to which it belongs. Each dnode automatically obtains the EP of the dnode where all mnodes in the whole cluster are located, through internal messaging interaction.
-**Virtual node group (VGroup)**: Vnodes on different data nodes can form a virtual node group to ensure the high availability of the system. The virtual node group is managed in a master/slave mechanism. Write operations can only be performed on the master vnode, and then replicated to slave vnodes, thus ensuring that one single replica of data is copied on multiple physical nodes. The number of virtual nodes in a vgroup equals the number of data replicas. If the number of replicas of a DB is N, the system must have at least N data nodes. The number of replicas can be specified by the parameter `“replica”` when creating DB, and the default is 1. Using the multi-replication feature of TDengine, the same high data reliability can be achieved without the need for expensive storage devices such as disk arrays. Virtual node group is created and managed by the management node, and the management node assigns a system unique ID, aka VGroup ID. If two virtual nodes have the same vnode group ID, means that they belong to the same group and the data is backed up to each other. The number of virtual nodes in a virtual node group can be dynamically changed, allowing only one, that is, no data replication. VGroup ID is never changed. Even if a virtual node group is deleted, its ID will not be reused.
+**Virtual node group (VGroup)**: Vnodes on different data nodes can form a virtual node group to ensure the high availability of the system. The virtual node group is managed in a master/slave mechanism. Write operations can only be performed on the master vnode, and then replicated to slave vnodes, thus ensuring that one single replica of data is copied on multiple physical nodes. The number of virtual nodes in a vgroup equals the number of data replicas. If the number of replicas of a DB is N, the system must have at least N data nodes. The number of replicas can be specified by the parameter `“replica”` when creating a DB, and the default is 1. Using the multi-replication feature of TDengine, the same high data reliability can be achieved without the need for expensive storage devices such as disk arrays. Virtual node groups are created and managed by the management node, and the management node assigns a system unique ID, aka VGroup ID. If two virtual nodes have the same vnode group ID, it means that they belong to the same group and the data is backed up to each other. The number of virtual nodes in a virtual node group can be dynamically changed, allowing only one, that is, no data replication. VGroup ID is never changed. Even if a virtual node group is deleted, its ID will not be reused.
-**TAOSC**: TAOSC is the driver provided by TDengine to applications, which is responsible for dealing with the interaction between application and cluster, and provides the native interface of C/C++ language, which is embedded in JDBC, C #, Python, Go, Node.js language connection libraries. Applications interact with the whole cluster through TAOSC instead of directly connecting to data nodes in the cluster. This module is responsible for obtaining and caching metadata; forwarding requests for insertion, query, etc. to the correct data node; when returning the results to the application, TAOSC also needs to be responsible for the final level of aggregation, sorting, filtering and other operations. For JDBC, C/C++/C #/Python/Go/Node.js interfaces, this module runs on the physical node where the application is located. At the same time, in order to support the fully distributed RESTful interface, TAOSC has a running instance on each dnode of TDengine cluster.
+**TAOSC**: TAOSC is the driver provided by TDengine to applications. It is responsible for dealing with the interaction between application and cluster, and provides the native interface for the C/C++ language. It is also embedded in the JDBC, C #, Python, Go, Node.js language connection libraries. Applications interact with the whole cluster through TAOSC instead of directly connecting to data nodes in the cluster. This module is responsible for obtaining and caching metadata; forwarding requests for insertion, query, etc. to the correct data node; when returning the results to the application, TAOSC also needs to be responsible for the final level of aggregation, sorting, filtering and other operations. For JDBC, C/C++/C#/Python/Go/Node.js interfaces, this module runs on the physical node where the application is located. At the same time, in order to support the fully distributed RESTful interface, TAOSC has a running instance on each dnode of TDengine cluster.
### Node Communication
-**Communication mode**: The communication among each data node of TDengine system, and among the client driver and each data node is carried out through TCP/UDP. Considering an IoT scenario, the data writing packets are generally not large, so TDengine uses UDP in addition to TCP for transmission, because UDP is more efficient and is not limited by the number of connections. TDengine implements its own timeout, retransmission, confirmation and other mechanisms to ensure reliable transmission of UDP. For packets with a data volume of less than 15K, UDP is adopted for transmission, and TCP is automatically adopted for transmission of packets with a data volume of more than 15K or query operations. At the same time, TDengine will automatically compress/decompress the data, digital sign/authenticate the data according to the configuration and data packet. For data replication among data nodes, only TCP is used for data transportation.
+**Communication mode**: The communication among each data node of TDengine system, and among the client driver and each data node is carried out through TCP/UDP. Considering an IoT scenario, the data writing packets are generally not large, so TDengine uses UDP in addition to TCP for transmission, because UDP is more efficient and is not limited by the number of connections. TDengine implements its own timeout, retransmission, confirmation and other mechanisms to ensure reliable transmission of UDP. For packets with a data volume of less than 15K, UDP is adopted for transmission, and TCP is automatically adopted for transmission of packets with a data volume of more than 15K or query operations. At the same time, TDengine will automatically compress/decompress the data, digitally sign/authenticate the data according to the configuration and data packet. For data replication among data nodes, only TCP is used for data transportation.
**FQDN configuration:** A data node has one or more FQDNs, which can be specified in the system configuration file taos.cfg with the parameter “fqdn”. If it is not specified, the system will automatically use the hostname of the computer as its FQDN. If the node is not configured with FQDN, you can directly set the configuration parameter “fqdn” of the node to its IP address. However, IP is not recommended because IP address may be changed, and once it changes, the cluster will not work properly. The EP (End Point) of a data node consists of FQDN + Port. With FQDN, it is necessary to ensure the DNS service is running, or hosts files on nodes are configured properly.
**Port configuration**: The external port of a data node is determined by the system configuration parameter “serverPort” in TDengine, and the port for internal communication of cluster is serverPort+5. The data replication operation among data nodes in the cluster also occupies a TCP port, which is serverPort+10. In order to support multithreading and efficient processing of UDP data, each internal and external UDP connection needs to occupy 5 consecutive ports. Therefore, the total port range of a data node will be serverPort to serverPort + 10, for a total of 11 TCP/UDP ports. To run the system, make sure that the firewall keeps these ports open. Each data node can be configured with a different serverPort.
-**Cluster external connection**: TDengine cluster can accommodate one single, multiple or even thousands of data nodes. The application only needs to initiate a connection to any data node in the cluster. The network parameter required for connection is the End Point (FQDN plus configured port number) of a data node. When starting the application taos through CLI, the FQDN of the data node can be specified through the option `-h`, and the configured port number can be specified through `-p`. If the port is not configured, the system configuration parameter “serverPort” of TDengine will be adopted.
+**Cluster external connection**: TDengine cluster can accommodate a single, multiple or even thousands of data nodes. The application only needs to initiate a connection to any data node in the cluster. The network parameter required for connection is the End Point (FQDN plus configured port number) of a data node. When starting the application taos through CLI, the FQDN of the data node can be specified through the option `-h`, and the configured port number can be specified through `-p`. If the port is not configured, the system configuration parameter “serverPort” of TDengine will be adopted.
**Inter-cluster communication**: Data nodes connect with each other through TCP/UDP. When a data node starts, it will obtain the EP information of the dnode where the mnode is located, and then establish a connection with the mnode in the system to exchange information. There are three steps to obtain EP information of the mnode:
@@ -44,11 +44,13 @@ A complete TDengine system runs on one or more physical nodes. Logically, it inc
2. Check the system configuration file taos.cfg to obtain node configuration parameters “firstEp” and “secondEp” (the node specified by these two parameters can be a normal node without mnode, in this case, the node will try to redirect to the mnode node when connected). If these two configuration parameters do not exist or do not exist in taos.cfg, or are invalid, skip to the third step;
3. Set your own EP as a mnode EP and run it independently. After obtaining the mnode EP list, the data node initiates the connection. It will successfully join the working cluster after connection. If not successful, it will try the next item in the mnode EP list. If all attempts are made, but the connection still fails, sleep for a few seconds before trying again.
-**The choice of MNODE**: TDengine logically has a management node, but there is no separated execution code. The server-side only has a set of execution code taosd. So which data node will be the management node? This is determined automatically by the system without any manual intervention. The principle is as follows: when a data node starts, it will check its End Point and compare it with the obtained mnode EP List. If its EP exists in it, the data node shall start the mnode module and become a mnode. If your own EP is not in the mnode EP List, the mnode module will not start. During the system operation, due to load balancing, downtime and other reasons, mnode may migrate to the new dnode, while totally transparent without manual intervention. The modification of configuration parameters is the decision made by mnode itself according to resources usage.
+**The choice of MNODE**: TDengine logically has a management node, but there is no separate execution code. The server-side only has one set of execution code, taosd. So which data node will be the management node? This is determined automatically by the system without any manual intervention. The principle is as follows: when a data node starts, it will check its End Point and compare it with the obtained mnode EP List. If its EP exists in it, the data node shall start the mnode module and become a mnode. If your own EP is not in the mnode EP List, the mnode module will not start. During the system operation, due to load balancing, downtime and other reasons, mnode may migrate to the new dnode, totally transparently and without manual intervention. The modification of configuration parameters is the decision made by mnode itself according to resources usage.
-**Add new data nodes:** After the system has a data node, it has become a working system. There are two steps to add a new node into the cluster. Step1: Connect to the existing working data node using TDengine CLI, and then add the End Point of the new data node with the command "create dnode"; Step 2: In the system configuration parameter file taos.cfg of the new data node, set the “firstEp” and “secondEp” parameters to the EP of any two data nodes in the existing cluster. Please refer to the detailed user tutorial for detailed steps. In this way, the cluster will be established step by step.
+**Add new data nodes:** After the system has a data node, it has become a working system. There are two steps to add a new node into the cluster.
+- Step1: Connect to the existing working data node using TDengine CLI, and then add the End Point of the new data node with the command "create dnode"
+- Step 2: In the system configuration parameter file taos.cfg of the new data node, set the “firstEp” and “secondEp” parameters to the EP of any two data nodes in the existing cluster. Please refer to the user tutorial for detailed steps. In this way, the cluster will be established step by step.
-**Redirection**: No matter about dnode or TAOSC, the connection to the mnode shall be initiated first, but the mnode is automatically created and maintained by the system, so the user does not know which dnode is running the mnode. TDengine only requires a connection to any working dnode in the system. Because any running dnode maintains the currently running mnode EP List, when receiving a connecting request from the newly started dnode or TAOSC, if it’s not a mnode by self, it will reply to the mnode EP List back. After receiving this list, TAOSC or the newly started dnode will try to establish the connection again. When the mnode EP List changes, each data node quickly obtains the latest list and notifies TAOSC through messaging interaction among nodes.
+**Redirection**: Regardless of dnode or TAOSC, the connection to the mnode is initiated first. The mnode is automatically created and maintained by the system, so the user does not know which dnode is running the mnode. TDengine only requires a connection to any working dnode in the system. Because any running dnode maintains the currently running mnode EP List, when receiving a connecting request from the newly started dnode or TAOSC, if it’s not an mnode itself, it will reply to the mnode with the EP List. After receiving this list, TAOSC or the newly started dnode will try to establish the connection again. When the mnode EP List changes, each data node quickly obtains the latest list and notifies TAOSC through messaging interaction among nodes.
### A Typical Data Writing Process
@@ -58,17 +60,17 @@ To explain the relationship between vnode, mnode, TAOSC and application and thei
Figure 2: Typical process of TDengine
1. Application initiates a request to insert data through JDBC, ODBC, or other APIs.
-2. TAOSC checks if meta data existing for the table in the cache. If so, go straight to Step 4. If not, TAOSC sends a get meta-data request to mnode.
+2. TAOSC checks the cache to see if meta data exists for the table. If it does, it goes straight to Step 4. If not, TAOSC sends a get meta-data request to mnode.
3. Mnode returns the meta-data of the table to TAOSC. Meta-data contains the schema of the table, and also the vgroup information to which the table belongs (the vnode ID and the End Point of the dnode where the table belongs. If the number of replicas is N, there will be N groups of End Points). If TAOSC does not receive a response from the mnode for a long time, and there are multiple mnodes, TAOSC will send a request to the next mnode.
4. TAOSC initiates an insert request to master vnode.
5. After vnode inserts the data, it gives a reply to TAOSC, indicating that the insertion is successful. If TAOSC doesn't get a response from vnode for a long time, TAOSC will treat this node as offline. In this case, if there are multiple replicas of the inserted database, TAOSC will issue an insert request to the next vnode in vgroup.
6. TAOSC notifies APP that writing is successful.
-For Step 2 and 3, when TAOSC starts, it does not know the End Point of mnode, so it will directly initiate a request to the configured serving End Point of the cluster. If the dnode that receives the request does not have a mnode configured, it will inform the mnode EP list in a reply message, so that TAOSC will re-issue a request to obtain meta-data to the EP of another new mnode.
+For Step 2 and 3, when TAOSC starts, it does not know the End Point of mnode, so it will directly initiate a request to the configured serving End Point of the cluster. If the dnode that receives the request does not have a mnode configured, it will reply with the mnode EP list, so that TAOSC will re-issue a request to obtain meta-data to the EP of another mnode.
-For Step 4 and 5, without caching, TAOSC can't recognize the master in the virtual node group, so assumes that the first vnode is the master and sends a request to it. If this vnode is not the master, it will reply to the actual master as a new target where TAOSC shall send a request to. Once the reply of successful insertion is obtained, TAOSC will cache the information of master node.
+For Step 4 and 5, without caching, TAOSC can't recognize the master in the virtual node group, so assumes that the first vnode is the master and sends a request to it. If this vnode is not the master, it will reply to the actual master as a new target to which TAOSC shall send a request. Once a response of successful insertion is obtained, TAOSC will cache the information of master node.
-The above is the process of inserting data, and the processes of querying and computing are the same. TAOSC encapsulates and hides all these complicated processes, and it is transparent to applications.
+The above describes the process of inserting data. The processes of querying and computing are the same. TAOSC encapsulates and hides all these complicated processes, and it is transparent to applications.
Through TAOSC caching mechanism, mnode needs to be accessed only when a table is accessed for the first time, so mnode will not become a system bottleneck. However, because schema and vgroup may change (such as load balancing), TAOSC will interact with mnode regularly to automatically update the cache.
@@ -76,24 +78,24 @@ Through TAOSC caching mechanism, mnode needs to be accessed only when a table is
### Storage Model
-The data stored by TDengine include collected time-series data, metadata related to database and tables, tag data, etc. These data are specifically divided into three parts:
+The data stored by TDengine includes collected time-series data, metadata related to database and tables, tag data, etc. All of the data is specifically divided into three parts:
-- Time-series data: stored in vnode and composed of data, head and last files. The amount of data is large and query amount depends on the application scenario. Out-of-order writing is allowed, but delete operation is not supported for the time being, and update operation is only allowed when database “update” parameter is set to 1. By adopting the model with **one table for each data collection point**, the data of a given time period is continuously stored, and the writing against one single table is a simple appending operation. Multiple records can be read at one time, thus ensuring the insert and query operation of a single data collection point with the best performance.
-- Tag data: meta files stored in vnode. Four standard operations of create, read, update and delete are supported. The amount of data is not large. If there are N tables, there are N records, so all can be stored in memory. To make tag filtering efficient, TDengine supports multi-core and multi-threaded concurrent queries. As long as the computing resources are sufficient, even in face of millions of tables, the tag filtering results will return in milliseconds.
-- Metadata: stored in mnode, including system node, user, DB, Table Schema and other information. Four standard operations of create, delete, update and read are supported. The amount of these data are not large and can be stored in memory, moreover, the query amount is not large because of the client cache. Therefore, TDengine uses centralized storage management, however, there will be no performance bottleneck.
+- Time-series data: stored in vnode and composed of data, head and last files. The amount of data is large and query amount depends on the application scenario. Out-of-order writing is allowed, but delete operation is not supported for the time being, and update operation is only allowed when database “update” parameter is set to 1. By adopting the model with **one table for each data collection point**, the data of a given time period is continuously stored, and the writing against one single table is a simple appending operation. Multiple records can be read at one time, thus ensuring the best performance for both insert and query operations of a single data collection point.
+- Tag data: meta files stored in vnode. Four standard operations of create, read, update and delete are supported. The amount of data is not large. If there are N tables, there are N records, so all can be stored in memory. To make tag filtering efficient, TDengine supports multi-core and multi-threaded concurrent queries. As long as the computing resources are sufficient, even with millions of tables, the tag filtering results will return in milliseconds.
+- Metadata: stored in mnode and includes system node, user, DB, table schema and other information. Four standard operations of create, delete, update and read are supported. The amount of this data is not large and can be stored in memory. Moreover, the number of queries is not large because of client cache. Even though TDengine uses centralized storage management, because of the architecture, there is no performance bottleneck.
-Compared with the typical NoSQL storage model, TDengine stores tag data and time-series data completely separately, which has two major advantages:
+Compared with the typical NoSQL storage model, TDengine stores tag data and time-series data completely separately. This has two major advantages:
-- Reduce the redundancy of tag data storage significantly: general NoSQL database or time-series database adopts K-V storage, in which Key includes a timestamp, a device ID and various tags. Each record carries these duplicated tags, so storage space is wasted. Moreover, if the application needs to add, modify or delete tags on historical data, it has to traverse the data and rewrite them again, which is extremely expensive to operate.
-- Aggregate data efficiently between multiple tables: when aggregating data between multiple tables, it first finds out the tables which satisfy the filtering conditions, and then find out the corresponding data blocks of these tables to greatly reduce the data sets to be scanned, thus greatly improving the aggregation efficiency. Moreover, tag data is managed and maintained in a full-memory structure, and tag data queries in tens of millions can return in milliseconds.
+- Reduces the redundancy of tag data storage significantly. General NoSQL database or time-series database adopts K-V (key-value) storage, in which the key includes a timestamp, a device ID and various tags. Each record carries these duplicated tags, so storage space is wasted. Moreover, if the application needs to add, modify or delete tags on historical data, it has to traverse the data and rewrite them again, which is an extremely expensive operation.
+- Aggregate data efficiently between multiple tables: when aggregating data between multiple tables, it first finds the tables which satisfy the filtering conditions, and then finds the corresponding data blocks of these tables. This greatly reduces the data sets to be scanned which in turn improves the aggregation efficiency. Moreover, tag data is managed and maintained in a full-memory structure, and tag data queries in tens of millions can return in milliseconds.
### Data Sharding
-For large-scale data management, to achieve scale-out, it is generally necessary to adopt the Partitioning or Sharding strategy. TDengine implements data sharding via vnode, and time-series data partitioning via one data file for a time range.
+For large-scale data management, to achieve scale-out, it is generally necessary to adopt a Partitioning or Sharding strategy. TDengine implements data sharding via vnode, and time-series data partitioning via one data file for a time range.
VNode (Virtual Data Node) is responsible for providing writing, query and computing functions for collected time-series data. To facilitate load balancing, data recovery and support heterogeneous environments, TDengine splits a data node into multiple vnodes according to its computing and storage resources. The management of these vnodes is done automatically by TDengine and is completely transparent to the application.
-For a single data collection point, regardless of the amount of data, a vnode (or vnode group, if the number of replicas is greater than 1) has enough computing resource and storage resource to process (if a 16-byte record is generated per second, the original data generated in one year will be less than 0.5 G), so TDengine stores all the data of a table (a data collection point) in one vnode instead of distributing the data to two or more dnodes. Moreover, a vnode can store data from multiple data collection points (tables), and the upper limit of the tables’ quantity for a vnode is one million. By design, all tables in a vnode belong to the same DB. On a data node, unless specially configured, the number of vnodes owned by a DB will not exceed the number of system cores.
+For a single data collection point, regardless of the amount of data, a vnode (or vnode group, if the number of replicas is greater than 1) has enough computing resource and storage resource to process (if a 16-byte record is generated per second, the original data generated in one year will be less than 0.5 G). So TDengine stores all the data of a table (a data collection point) in one vnode instead of distributing the data to two or more dnodes. Moreover, a vnode can store data from multiple data collection points (tables), and the upper limit of the tables’ quantity for a vnode is one million. By design, all tables in a vnode belong to the same DB. On a data node, unless specially configured, the number of vnodes owned by a DB will not exceed the number of system cores.
When creating a DB, the system does not allocate resources immediately. However, when creating a table, the system will check if there is an allocated vnode with free tablespace. If so, the table will be created in the vacant vnode immediately. If not, the system will create a new vnode on a dnode from the cluster according to the current workload, and then a table. If there are multiple replicas of a DB, the system does not create only one vnode, but a vgroup (virtual data node group). The system has no limit on the number of vnodes, which is just limited by the computing and storage resources of physical nodes.
@@ -101,23 +103,23 @@ The meta data of each table (including schema, tags, etc.) is also stored in vno
### Data Partitioning
-In addition to vnode sharding, TDengine partitions the time-series data by time range. Each data file contains only one time range of time-series data, and the length of the time range is determined by DB's configuration parameter `“days”`. This method of partitioning by time rang is also convenient to efficiently implement the data retention policy. As long as the data file exceeds the specified number of days (system configuration parameter `“keep”`), it will be automatically deleted. Moreover, different time ranges can be stored in different paths and storage media, so as to facilitate the tiered-storage. Cold/hot data can be stored in different storage media to reduce the storage cost.
+In addition to vnode sharding, TDengine partitions the time-series data by time range. Each data file contains only one time range of time-series data, and the length of the time range is determined by the database configuration parameter `“days”`. This method of partitioning by time range is also convenient to efficiently implement data retention policies. As long as the data file exceeds the specified number of days (system configuration parameter `“keep”`), it will be automatically deleted. Moreover, different time ranges can be stored in different paths and storage media, so as to facilitate tiered-storage. Cold/hot data can be stored in different storage media to significantly reduce storage costs.
In general, **TDengine splits big data by vnode and time range in two dimensions** to manage the data efficiently with horizontal scalability.
### Load Balancing
-Each dnode regularly reports its status (including hard disk space, memory size, CPU, network, number of virtual nodes, etc.) to the mnode (virtual management node), so mnode knows the status of the entire cluster. Based on the overall status, when the mnode finds a dnode is overloaded, it will migrate one or more vnodes to other dnodes. During the process, TDengine services keep running and the data insertion, query and computing operations are not affected.
+Each dnode regularly reports its status (including hard disk space, memory size, CPU, network, number of virtual nodes, etc.) to the mnode (virtual management node) so that the mnode knows the status of the entire cluster. Based on the overall status, when the mnode finds a dnode is overloaded, it will migrate one or more vnodes to other dnodes. During the process, TDengine services keep running and the data insertion, query and computing operations are not affected.
-If the mnode has not received the dnode status for a period of time, the dnode will be treated as offline. When offline lasts a certain period of time (configured by parameter `“offlineThreshold”`), the dnode will be forcibly removed from the cluster by mnode. If the number of replicas of vnodes on this dnode is greater than one, the system will automatically create new replicas on other dnodes to ensure the replica number. If there are other mnodes on this dnode and the number of mnodes replicas is greater than one, the system will automatically create new mnodes on other dnodes to ensure the replica number.
+If the mnode has not received the dnode status for a period of time, the dnode will be treated as offline. If the dnode stays offline beyond the time configured by parameter `“offlineThreshold”`, the dnode will be forcibly removed from the cluster by mnode. If the number of replicas of vnodes on this dnode is greater than one, the system will automatically create new replicas on other dnodes to ensure the replica number. If there are other mnodes on this dnode and the number of mnodes replicas is greater than one, the system will automatically create new mnodes on other dnodes to ensure the replica number.
-When new data nodes are added to the cluster, with new computing and storage resources are added, the system will automatically start the load balancing process.
+When new data nodes are added to the cluster, with new computing and storage resources, the system will automatically start the load balancing process.
The load balancing process does not require any manual intervention, and it is transparent to the application. **Note: load balancing is controlled by parameter “balance”, which determines to turn on/off automatic load balancing.**
## Data Writing and Replication Process
-If a database has N replicas, thus a virtual node group has N virtual nodes, but only one as Master and all others are slaves. When the application writes a new record to system, only the Master vnode can accept the writing request. If a slave vnode receives a writing request, the system will notifies TAOSC to redirect.
+If a database has N replicas, a virtual node group has N virtual nodes. But only one is the Master and all others are slaves. When the application writes a new record to system, only the Master vnode can accept the writing request. If a slave vnode receives a writing request, the system will notifies TAOSC to redirect.
### Master vnode Writing Process
@@ -130,7 +132,7 @@ Master Vnode uses a writing process as follows:
2. If the system configuration parameter `“walLevel”` is greater than 0, vnode will write the original request packet into database log file WAL. If walLevel is set to 2 and fsync is set to 0, TDengine will make WAL data written immediately to ensure that even system goes down, all data can be recovered from database log file;
3. If there are multiple replicas, vnode will forward data packet to slave vnodes in the same virtual node group, and the forwarded packet has a version number with data;
4. Write into memory and add the record to “skip list”;
-5. Master vnode returns a confirmation message to the application, indicating a successful writing.
+5. Master vnode returns a confirmation message to the application, indicating a successful write.
6. If any of Step 2, 3 or 4 fails, the error will directly return to the application.
### Slave vnode Writing Process
@@ -146,19 +148,19 @@ For a slave vnode, the write process as follows:
Compared with Master vnode, slave vnode has no forwarding or reply confirmation step, means two steps less. But writing into memory and WAL is exactly the same.
-### Remote Disaster Recovery and IDC Migration
+### Remote Disaster Recovery and IDC (Internet Data Center) Migration
-As above Master and Slave processes discussed, TDengine adopts asynchronous replication for data synchronization. This method can greatly improve the writing performance, with no obvious impact from network delay. By configuring IDC and rack number for each physical node, it can be ensured that for a virtual node group, virtual nodes are composed of physical nodes from different IDC and different racks, thus implementing remote disaster recovery without other tools.
+As discussed above, TDengine writes using Master and Slave processes. TDengine adopts asynchronous replication for data synchronization. This method can greatly improve write performance, with no obvious impact from network delay. By configuring IDC and rack number for each physical node, it can be ensured that for a virtual node group, virtual nodes are composed of physical nodes from different IDC and different racks, thus implementing remote disaster recovery without other tools.
-On the other hand, TDengine supports dynamic modification of the replicas number. Once the number of replicas increases, the newly added virtual nodes will immediately enter the data synchronization process. After synchronization completed, added virtual nodes can provide services. In the synchronization process, master and other synchronized virtual nodes keep serving. With this feature, TDengine can provide IDC migration without service interruption. It is only necessary to add new physical nodes to the existing IDC cluster, and then remove old physical nodes after the data synchronization is completed.
+On the other hand, TDengine supports dynamic modification of the replica number. Once the number of replicas increases, the newly added virtual nodes will immediately enter the data synchronization process. After synchronization is complete, added virtual nodes can provide services. In the synchronization process, master and other synchronized virtual nodes keep serving. With this feature, TDengine can provide IDC migration without service interruption. It is only necessary to add new physical nodes to the existing IDC cluster, and then remove old physical nodes after the data synchronization is completed.
-However, the asynchronous replication has a tiny time window where data can be lost. The specific scenario is as follows:
+However, the asynchronous replication has a very low probability scenario where data may be lost. The specific scenario is as follows:
-1. Master vnode has finished its 5-step operations, confirmed the success of writing to APP, and then went down;
+1. Master vnode has finished its 5-step operations, confirmed the success of writing to APP, and then goes down;
2. Slave vnode receives the write request, then processing fails before writing to the log in Step 2;
3. Slave vnode will become the new master, thus losing one record.
-In theory, for asynchronous replication, there is no guarantee to prevent data loss. However, this window is extremely small, only if mater and slave fail at the same time, and just confirm the successful write to the application before.
+In theory, for asynchronous replication, there is no guarantee to prevent data loss. However, this is an extremely low probability scenario as described above.
Note: Remote disaster recovery and no-downtime IDC migration are only supported by Enterprise Edition. **Hint: This function is not available yet**
@@ -171,43 +173,43 @@ When a vnode starts, the roles (master, slave) are uncertain, and the data is in
1. If there’s only one replica, it’s always master
2. When all replicas are online, the one with latest version is master
3. Over half of online nodes are virtual nodes, and some virtual node is slave, it will automatically become master
-4. For 2 and 3, if multiple virtual nodes meet the requirement, the first vnode in virtual node group list will be selected as master
+4. For 2 and 3, if multiple virtual nodes meet the requirement, the first vnode in virtual node group list will be selected as master.
### Synchronous Replication
For scenarios with strong data consistency requirements, asynchronous data replication is not applicable, because there is a small probability of data loss. So, TDengine provides a synchronous replication mechanism for users. When creating a database, in addition to specifying the number of replicas, user also needs to specify a new parameter “quorum”. If quorum is greater than one, it means that every time the Master forwards a message to the replica, it needs to wait for “quorum-1” reply confirms before informing the application that data has been successfully written in slave. If “quorum-1” reply confirms are not received within a certain period of time, the master vnode will return an error to the application.
-With synchronous replication, performance of system will decrease and latency will increase. Because metadata needs strong consistent, the default for data synchronization between mnodes is synchronous replication.
+With synchronous replication, performance of system will decrease and latency will increase. Because metadata needs strong consistency, the default for data synchronization between mnodes is synchronous replication.
## Caching and Persistence
### Caching
-TDengine adopts a time-driven cache management strategy (First-In-First-Out, FIFO), also known as a Write-driven Cache Management Mechanism. This strategy is different from the read-driven data caching mode (Least-Recent-Used, LRU), which directly put the most recently written data in the system buffer. When the buffer reaches a threshold, the earliest data are written to disk in batches. Generally speaking, for the use of IoT data, users are most concerned about the newly generated data, that is, the current status. TDengine takes full advantage of this feature to put the most recently arrived (current state) data in the buffer.
+TDengine adopts a time-driven cache management strategy (First-In-First-Out, FIFO), also known as a Write-driven Cache Management Mechanism. This strategy is different from the read-driven data caching mode (Least-Recent-Used, LRU), which directly puts the most recently written data in the system buffer. When the buffer reaches a threshold, the earliest data are written to disk in batches. Generally speaking, for the use of IoT data, users are most concerned about the most recently generated data, that is, the current status. TDengine takes full advantage of this feature to put the most recently arrived (current state) data in the buffer.
-TDengine provides millisecond-level data collecting capability to users through query functions. Putting the recently arrived data directly in the buffer can respond to users' analysis query for the latest piece or batch of data more quickly, and provide faster database query response capability as a whole. In this sense, **TDengine can be used as a data cache by setting appropriate configuration parameters without deploying Redis or other additional cache systems**, which can effectively simplify the system architecture and reduce the operation costs. It should be noted that after the TDengine is restarted, the buffer of the system will be emptied, the previously cached data will be written to disk in batches, and the previously cached data will not be reloaded into the buffer as so in a proprietary key-value cache system.
+TDengine provides millisecond-level data collecting capability to users through query functions. Putting the recently arrived data directly in the buffer can respond to users' analysis query for the latest piece or batch of data more quickly, and provide faster database query response capability as a whole. In this sense, **TDengine can be used as a data cache by setting appropriate configuration parameters without deploying Redis or other additional cache systems**. This can effectively simplify the system architecture and reduce operational costs. It should be noted that after TDengine is restarted, the buffer of the system will be emptied, the previously cached data will be written to disk in batches, and the previously cached data will not be reloaded into the buffer. In this sense, TDengine's cache differs from proprietary key-value cache systems.
Each vnode has its own independent memory, and it is composed of multiple memory blocks of fixed size, and different vnodes are completely isolated. When writing data, similar to the writing of logs, data is sequentially added to memory, but each vnode maintains its own skip list for quick search. When more than one third of the memory block are used, the disk writing operation will start, and the subsequent writing operation is carried out in a new memory block. By this design, one third of the memory blocks in a vnode keep the latest data, so as to achieve the purpose of caching and quick search. The number of memory blocks of a vnode is determined by the configuration parameter “blocks”, and the size of memory blocks is determined by the configuration parameter “cache”.
### Persistent Storage
-TDengine uses a data-driven method to write the data from buffer into hard disk for persistent storage. When the cached data in vnode reaches a certain volume, TDengine will also pull up the disk-writing thread to write the cached data into persistent storage in order not to block subsequent data writing. TDengine will open a new database log file when the data is written, and delete the old database log file after written successfully to avoid unlimited log growth.
+TDengine uses a data-driven method to write the data from buffer into hard disk for persistent storage. When the cached data in vnode reaches a certain volume, TDengine will pull up the disk-writing thread to write the cached data into persistent storage so that subsequent data writing is not blocked. TDengine will open a new database log file when the data is written, and delete the old database log file after successfull persistence, to avoid unlimited log growth.
-To make full use of the characteristics of time-series data, TDengine splits the data stored in persistent storage by a vnode into multiple files, each file only saves data for a fixed number of days, which is determined by the system configuration parameter `“days”`. By so, for the given start and end date of a query, you can locate the data files to open immediately without any index, thus greatly speeding up reading operations.
+To make full use of the characteristics of time-series data, TDengine splits the data stored in persistent storage by a vnode into multiple files, each file only saves data for a fixed number of days, which is determined by the system configuration parameter `“days”`. Thus for given start and end dates of a query, you can locate the data files to open immediately without any index. This greatly speeds up read operations.
For time-series data, there is generally a retention policy, which is determined by the system configuration parameter `“keep”`. Data files exceeding this set number of days will be automatically deleted by the system to free up storage space.
Given “days” and “keep” parameters, the total number of data files in a vnode is: keep/days. The total number of data files should not be too large or too small. 10 to 100 is appropriate. Based on this principle, reasonable days can be set. In the current version, parameter “keep” can be modified, but parameter “days” cannot be modified once it is set.
-In each data file, the data of a table is stored by blocks. A table can have one or more data file blocks. In a file block, data is stored in columns, occupying a continuous storage space, thus greatly improving the reading speed. The size of file block is determined by the system parameter `“maxRows”` (the maximum number of records per block), and the default value is 4096. This value should not be too large or too small. If it is too large, the data locating in search will cost longer; if too small, the index of data block is too large, and the compression efficiency will be low with slower reading speed.
+In each data file, the data of a table is stored in blocks. A table can have one or more data file blocks. In a file block, data is stored in columns, occupying a continuous storage space, thus greatly improving the reading speed. The size of file block is determined by the system parameter `“maxRows”` (the maximum number of records per block), and the default value is 4096. This value should not be too large or too small. If it is too large, data location for queries will take a longer tim. If it is too small, the index of data block is too large, and the compression efficiency will be low with slower reading speed.
-Each data file (with a .data postfix) has a corresponding index file (with a .head postfix). The index file has summary information of a data block for each table, recording the offset of each data block in the data file, start and end time of data and other information, so as to lead system quickly locate the data to be found. Each data file also has a corresponding last file (with a .last postfix), which is designed to prevent data block fragmentation when written in disk. If the number of written records from a table does not reach the system configuration parameter `“minRows”` (minimum number of records per block), it will be stored in the last file first. When write to disk next time, the newly written records will be merged with the records in last file and then written into data file.
+Each data file (with a .data postfix) has a corresponding index file (with a .head postfix). The index file has summary information of a data block for each table, recording the offset of each data block in the data file, start and end time of data and other information which allows the system to locate the data to be found very quickly. Each data file also has a corresponding last file (with a .last postfix), which is designed to prevent data block fragmentation when written in disk. If the number of written records from a table does not reach the system configuration parameter `“minRows”` (minimum number of records per block), it will be stored in the last file first. At the next write operation to the disk, the newly written records will be merged with the records in last file and then written into data file.
-When data is written to disk, it is decided whether to compress the data according to system configuration parameter `“comp”`. TDengine provides three compression options: no compression, one-stage compression and two-stage compression, corresponding to comp values of 0, 1 and 2 respectively. One-stage compression is carried out according to the type of data. Compression algorithms include delta-delta coding, simple 8B method, zig-zag coding, LZ4 and other algorithms. Two-stage compression is based on one-stage compression and compressed by general compression algorithm, which has higher compression ratio.
+When data is written to disk, the system decideswhether to compress the data based on the system configuration parameter `“comp”`. TDengine provides three compression options: no compression, one-stage compression and two-stage compression, corresponding to comp values of 0, 1 and 2 respectively. One-stage compression is carried out according to the type of data. Compression algorithms include delta-delta coding, simple 8B method, zig-zag coding, LZ4 and other algorithms. Two-stage compression is based on one-stage compression and compressed by general compression algorithm, which has higher compression ratio.
### Tiered Storage
-By default, TDengine saves all data in /var/lib/taos directory, and the data files of each vnode are saved in a different directory under this directory. In order to expand the storage space, minimize the bottleneck of file reading and improve the data throughput rate, TDengine can configure the system parameter “dataDir” to allow multiple mounted hard disks to be used by system at the same time. In addition, TDengine also provides the function of tiered data storage, i.e. storage on different storage media according to the time stamps of data files. For example, the latest data is stored on SSD, the data for more than one week is stored on local hard disk, and the data for more than four weeks is stored on network storage device, thus reducing the storage cost and ensuring efficient data access. The movement of data on different storage media is automatically done by the system and completely transparent to applications. Tiered storage of data is also configured through the system parameter “dataDir”.
+By default, TDengine saves all data in /var/lib/taos directory, and the data files of each vnode are saved in a different directory under this directory. In order to expand the storage space, minimize the bottleneck of file reading and improve the data throughput rate, TDengine can configure the system parameter “dataDir” to allow multiple mounted hard disks to be used by system at the same time. In addition, TDengine also provides the function of tiered data storage, i.e. storage on different storage media according to the time stamps of data files. For example, the latest data is stored on SSD, the data older than a week is stored on local hard disk, and data older than four weeks is stored on network storage device. This reduces storage costs and ensures efficient data access. The movement of data on different storage media is automatically done by the system and is completely transparent to applications. Tiered storage of data is also configured through the system parameter “dataDir”.
dataDir format is as follows:
```
@@ -216,7 +218,7 @@ dataDir data_path [tier_level]
Where data_path is the folder path of mount point and tier_level is the media storage-tier. The higher the media storage-tier, means the older the data file. Multiple hard disks can be mounted at the same storage-tier, and data files on the same storage-tier are distributed on all hard disks within the tier. TDengine supports up to 3 tiers of storage, so tier_level values are 0, 1, and 2. When configuring dataDir, there must be only one mount path without specifying tier_level, which is called special mount disk (path). The mount path defaults to level 0 storage media and contains special file links, which cannot be removed, otherwise it will have a devastating impact on the written data.
-Suppose a physical node with six mountable hard disks/mnt/disk1,/mnt/disk2, …,/mnt/disk6, where disk1 and disk2 need to be designated as level 0 storage media, disk3 and disk4 are level 1 storage media, and disk5 and disk6 are level 2 storage media. Disk1 is a special mount disk, you can configure it in/etc/taos/taos.cfg as follows:
+Suppose there is a physical node with six mountable hard disks/mnt/disk1,/mnt/disk2, …,/mnt/disk6, where disk1 and disk2 need to be designated as level 0 storage media, disk3 and disk4 are level 1 storage media, and disk5 and disk6 are level 2 storage media. Disk1 is a special mount disk, you can configure it in/etc/taos/taos.cfg as follows:
```
dataDir /mnt/disk1/taos
@@ -233,11 +235,11 @@ Note: Tiered Storage is only supported in Enterprise Edition
## Data Query
-TDengine provides a variety of query processing functions for tables and STables. In addition to common aggregation queries, TDengine also provides window queries and statistical aggregation functions for time-series data. The query processing of TDengine needs the collaboration of client, vnode and mnode.
+TDengine provides a variety of query processing functions for tables and STables. In addition to common aggregation queries, TDengine also provides window queries and statistical aggregation functions for time-series data. Query processing in TDengine needs the collaboration of client, vnode and mnode.
### Single Table Query
-The parsing and verification of SQL statements are completed on the client side. SQL statements are parsed and generate an Abstract Syntax Tree (AST), which is then checksummed. Then request metadata information (table metadata) for the table specified in the query from management node (mnode).
+The parsing and verification of SQL statements are completed on the client side. SQL statements are parsed and generate an Abstract Syntax Tree (AST), which is then checksummed. Then metadata information (table metadata) for the table specified is requested in the query from management node (mnode).
According to the End Point information in metadata information, the query request is serialized and sent to the data node (dnode) where the table is located. After receiving the query, the dnode identifies the virtual node (vnode) pointed to and forwards the message to the query execution queue of the vnode. The query execution thread of vnode establishes the basic query execution environment, immediately returns the query request and starts executing the query at the same time.
@@ -245,9 +247,9 @@ When client obtains query result, the worker thread in query execution queue of
### Aggregation by Time Axis, Downsampling, Interpolation
-The remarkable feature that time-series data is different from ordinary data is that each record has a timestamp, so aggregating data with timestamps on the time axis is an important and distinct feature from common databases. From this point of view, it is similar to the window query of stream computing engine.
+Time-series data is different from ordinary data in that each record has a timestamp. So aggregating data by timestamps on the time axis is an important and distinct feature of time-series databases which is different from that of common databases. It is similar to the window query of stream computing engines.
-The keyword `interval` is introduced into TDengine to split fixed length time windows on time axis, and the data are aggregated based on time windows, and the data within window range are aggregated as needed. For example:
+The keyword `interval` is introduced into TDengine to split fixed length time windows on the time axis. The data is aggregated based on time windows, and the data within time window ranges is aggregated as needed. For example:
```mysql
select count(*) from d1001 interval(1h);
@@ -265,7 +267,7 @@ For the data collected by device D1001, the number of records per hour is counte
### Multi-table Aggregation Query
-TDengine creates a separate table for each data collection point, but in practical applications, it is often necessary to aggregate data from different data collection points. In order to perform aggregation operations efficiently, TDengine introduces the concept of STable. STable is used to represent a specific type of data collection point. It is a table set containing multiple tables. The schema of each table in the set is the same, but each table has its own static tag. The tags can be multiple and be added, deleted and modified at any time. Applications can aggregate or statistically operate all or a subset of tables under a STABLE by specifying tag filters, thus greatly simplifying the development of applications. The process is shown in the following figure:
+TDengine creates a separate table for each data collection point, but in practical applications, it is often necessary to aggregate data from different data collection points. In order to perform aggregation operations efficiently, TDengine introduces the concept of STable (super table). STable is used to represent a specific type of data collection point. It is a table set containing multiple tables. The schema of each table in the set is the same, but each table has its own static tag. There can be multiple tags which can be added, deleted and modified at any time. Applications can aggregate or statistically operate on all or a subset of tables under a STABLE by specifying tag filters. This greatly simplifies the development of applications. The process is shown in the following figure:

Figure 5: Diagram of multi-table aggregation query
@@ -274,12 +276,12 @@ TDengine creates a separate table for each data collection point, but in practic
2. TAOSC sends the STable name to Meta Node(management node);
3. Management node sends the vnode list owned by the STable back to TAOSC;
4. TAOSC sends the computing request together with tag filters to multiple data nodes corresponding to these vnodes;
-5. Each vnode first finds out the set of tables within its own node that meet the tag filters from memory, then scans the stored time-series data, completes corresponding aggregation calculations, and returns result to TAOSC;
+5. Each vnode first finds the set of tables within its own node that meet the tag filters from memory, then scans the stored time-series data, completes corresponding aggregation calculations, and returns result to TAOSC;
6. TAOSC finally aggregates the results returned by multiple data nodes and send them back to application.
-Since TDengine stores tag data and time-series data separately in vnode, by filtering tag data in memory, the set of tables that need to participate in aggregation operation is first found, which greatly reduces the volume of data scanned and improves aggregation speed. At the same time, because the data is distributed in multiple vnodes/dnodes, the aggregation operation is carried out concurrently in multiple vnodes, which further improves the aggregation speed. Aggregation functions for ordinary tables and most operations are applicable to STables. The syntax is exactly the same. Please see TAOS SQL for details.
+Since TDengine stores tag data and time-series data separately in vnode, by filtering tag data in memory, the set of tables that need to participate in aggregation operation is first found, which reduces the volume of data to be scanned and improves aggregation speed. At the same time, because the data is distributed in multiple vnodes/dnodes, the aggregation operation is carried out concurrently in multiple vnodes, which further improves the aggregation speed. Aggregation functions for ordinary tables and most operations are applicable to STables. The syntax is exactly the same. Please see TAOS SQL for details.
### Precomputation
-In order to effectively improve the performance of query processing, based-on the unchangeable feature of IoT data, statistical information of data stored in data block is recorded in the head of data block, including max value, min value, and sum. We call it a precomputing unit. If the query processing involves all the data of a whole data block, the pre-calculated results are directly used, and no need to read the data block contents at all. Since the amount of pre-calculated data is much smaller than the actual size of data block stored on disk, for query processing with disk IO as bottleneck, the use of pre-calculated results can greatly reduce the pressure of reading IO and accelerate the query process. The precomputation mechanism is similar to the index BRIN (Block Range Index) of PostgreSQL.
+In order to effectively improve the performance of query processing, based-on the unchangeable feature of IoT data, statistical information of data stored in data block is recorded in the head of data block, including max value, min value, and sum. We call it a precomputing unit. If the query processing involves all the data of a whole data block, the pre-calculated results are directly used, and no need to read the data block contents at all. Since the amount of pre-calculated data is much smaller than the actual size of data block stored on disk, for query processing with disk IO as bottleneck, the use of pre-calculated results can greatly reduce the pressure of reading IO and accelerate the query process. The precomputation mechanism is similar to the BRIN (Block Range Index) of PostgreSQL.
diff --git a/docs-en/25-application/01-telegraf.md b/docs-en/25-application/01-telegraf.md
index 6a57145cd3d82ca5ec1ab828bfc7b6270bbe9d47..d30a23fe1b942e1411e8b5f1320e1c54ae2b407f 100644
--- a/docs-en/25-application/01-telegraf.md
+++ b/docs-en/25-application/01-telegraf.md
@@ -5,16 +5,16 @@ title: Quickly Build IT DevOps Visualization System with TDengine + Telegraf + G
## Background
-TDengine is a big data platform designed and optimized for IoT (Internet of Things), Vehicle Telematics, Industrial Internet, IT DevOps, etc. by TAOSData. Since it opened its source code in July 2019, it has won the favor of a large number of time-series data developers with its innovative data modeling design, convenient installation, easy-to-use programming interface, and powerful data writing and query performance.
+TDengine is a big data platform designed and optimized for IoT (Internet of Things), Vehicle Telemetry, Industrial Internet, IT DevOps and other applications. Since it was open-sourced in July 2019, it has won the favor of a large number of time-series data developers with its innovative data modeling design, convenient installation, easy-to-use programming interface, and powerful data writing and query performance.
IT DevOps metric data usually are time sensitive, for example:
- System resource metrics: CPU, memory, IO, bandwidth, etc.
- Software system metrics: health status, number of connections, number of requests, number of timeouts, number of errors, response time, service type, and other business-related metrics.
-Current mainstream IT DevOps system usually include a data collection module, a data persistent module, and a visualization module; Telegraf and Grafana are one of the most popular data collection modules and visualization modules, respectively. The data persistent module is available in a wide range of options, with OpenTSDB or InfluxDB being the most popular. TDengine, as an emerging time-series big data platform, has the advantages of high performance, high reliability, easy management and easy maintenance.
+Current mainstream IT DevOps system usually include a data collection module, a data persistent module, and a visualization module; Telegraf and Grafana are one of the most popular data collection modules and visualization modules, respectively. The data persistence module is available in a wide range of options, with OpenTSDB or InfluxDB being the most popular. TDengine, as an emerging time-series big data platform, has the advantages of high performance, high reliability, easy management and easy maintenance.
-This article introduces how to quickly build a TDengine + Telegraf + Grafana based IT DevOps visualization system without writing even a single line of code and by simply modifying a few lines of configuration files. The architecture is as follows.
+This article introduces how to quickly build a TDengine + Telegraf + Grafana based IT DevOps visualization system without writing even a single line of code and by simply modifying a few lines in configuration files. The architecture is as follows.

@@ -79,5 +79,5 @@ Click on the plus icon on the left and select `Import` to get the data from `htt
## Wrap-up
-The above demonstrates how to quickly build a IT DevOps visualization system. Thanks to the new schemaless protocol parsing feature in TDengine version 2.4.0.0 and the powerful ecological software adaptation capability, users can build an efficient and easy-to-use IT DevOps visualization system in just a few minutes.
+The above demonstrates how to quickly build a IT DevOps visualization system. Thanks to the new schemaless protocol parsing feature in TDengine version 2.4.0.0 and ability to integrate easily with a large software ecosystem, users can build an efficient and easy-to-use IT DevOps visualization system in just a few minutes.
Please refer to the official documentation and product implementation cases for other features.
diff --git a/docs-en/25-application/02-collectd.md b/docs-en/25-application/02-collectd.md
index 963881eafa6e5085eab951c1b1ab54faeba1fa7b..1733ed1b1af8c9375c3773d1ca86831396499a78 100644
--- a/docs-en/25-application/02-collectd.md
+++ b/docs-en/25-application/02-collectd.md
@@ -5,17 +5,17 @@ title: Quickly build an IT DevOps visualization system using TDengine + collectd
## Background
-TDengine is a big data platform designed and optimized for IoT (Internet of Things), Vehicle Telematics, Industrial Internet, IT DevOps, etc. by TAOSData. Since it opened its source code in July 2019, it has won the favor of a large number of time-series data developers with its innovative data modeling design, convenient installation, easy-to-use programming interface, and powerful data writing and query performance.
+TDengine is a big data platform designed and optimized for IoT (Internet of Things), Vehicle Telemetry, Industrial Internet, IT DevOps and other applications. Since it was open-sourced in July 2019, it has won the favor of a large number of time-series data developers with its innovative data modeling design, convenient installation, easy-to-use programming interface, and powerful data writing and query performance.
IT DevOps metric data usually are time sensitive, for example:
- System resource metrics: CPU, memory, IO, bandwidth, etc.
- Software system metrics: health status, number of connections, number of requests, number of timeouts, number of errors, response time, service type, and other business-related metrics.
-The current mainstream IT DevOps visualization system usually contains a data collection module, a data persistent module, and a visual display module. collectd/StatsD, as an old-fashion open source data collection tool, has a wide user base. However, collectd/StatsD has limited functionality, and often needs to be combined with Telegraf, Grafana, and a time-series database to build a complete monitoring system.
+The current mainstream IT DevOps visualization system usually contains a data collection module, a data persistence module, and a visual display module. collectd/StatsD, as an old-fashion open source data collection tool, has a wide user base. However, collectd/StatsD has limited functionality, and often needs to be combined with Telegraf, Grafana, and a time-series database to build a complete monitoring system.
The new version of TDengine supports multiple data protocols and can accept data from collectd and StatsD directly, and provides Grafana dashboard for graphical display.
-This article introduces how to quickly build an IT DevOps visualization system based on TDengine + collectd / StatsD + Grafana without writing even a single line of code but by simply modifying a few lines of configuration files. The architecture is shown in the following figure.
+This article introduces how to quickly build an IT DevOps visualization system based on TDengine + collectd / StatsD + Grafana without writing even a single line of code but by simply modifying a few lines in configuration files. The architecture is shown in the following figure.

@@ -99,6 +99,6 @@ Download the dashboard json from `https://github.com/taosdata/grafanaplugin/blob
## Wrap-up
-TDengine, as an emerging time-series big data platform, has the advantages of high performance, high reliability, easy management and easy maintenance. Thanks to the new schemaless protocol parsing function in TDengine version 2.4.0.0 and the powerful ecological software adaptation capability, users can build an efficient and easy-to-use IT DevOps visualization system or adapt to an existing system in just a few minutes.
+TDengine, as an emerging time-series big data platform, has the advantages of high performance, high reliability, easy management and easy maintenance. Thanks to the new schemaless protocol parsing feature in TDengine version 2.4.0.0 and ability to integrate easily with a large software ecosystem, users can build an efficient and easy-to-use IT DevOps visualization system, or adapt an existing system, in just a few minutes.
For TDengine's powerful data writing and querying performance and other features, please refer to the official documentation and successful product implementation cases.
diff --git a/docs-en/25-application/03-immigrate.md b/docs-en/25-application/03-immigrate.md
index 69166bf78b66a23af35af726f2e5c477195a3595..4d47aec1d76014ba63f6be91004abcc3934769f7 100644
--- a/docs-en/25-application/03-immigrate.md
+++ b/docs-en/25-application/03-immigrate.md
@@ -3,10 +3,9 @@ sidebar_label: OpenTSDB Migration to TDengine
title: Best Practices for Migrating OpenTSDB Applications to TDengine
---
-As a distributed, scalable, HBase-based distributed time-series database software, thanks to its first-mover advantage, OpenTSDB has been introduced and widely used in DevOps by people. However, using new technologies like cloud computing, microservices, and containerization technology with rapid development. Enterprise-level services are becoming more and more diverse. The architecture is becoming more complex.
+As a distributed, scalable, distributed time-series database platform based on HBase, and thanks to its first-mover advantage, OpenTSDB is widely used for monitoring in DevOps. However, as new technologies like cloud computing, microservices, and containerization technology has developed rapidly, Enterprise-level services are becoming more and more diverse and the architecture is becoming more complex.
-From this situation, it increasingly plagues to use of OpenTSDB as a DevOps backend storage for monitoring by performance issues and delayed feature upgrades. The resulting increase in application deployment costs and reduced operational efficiency.
-These problems are becoming increasingly severe as the system scales up.
+As a result, as a DevOps backend for monitoring, OpenTSDB is plagued by performance issues and delayed feature upgrades. This has resulted in increased application deployment costs and reduced operational efficiency. These problems become increasingly severe as the system tries to scale up.
To meet the fast-growing IoT big data market and technical needs, TAOSData developed an innovative big-data processing product, **TDengine**.
@@ -14,14 +13,14 @@ After learning the advantages of many traditional relational databases and NoSQL
Compared with OpenTSDB, TDengine has the following distinctive features.
-- Performance of data writing and querying far exceeds that of OpenTSDB.
-- Efficient compression mechanism for time-series data, which compresses less than 1/5 of the storage space on disk.
-- The installation and deployment are straightforward. A single installation package can complete the installation and deployment and does not rely on other third-party software. The entire installation and deployment process in a few seconds;
-- The built-in functions cover all of OpenTSDB's query functions. And support more time-series data query functions, scalar functions, and aggregation functions. And support advanced query functions such as multiple time-window aggregations, join query, expression operation, multiple group aggregation, user-defined sorting, and user-defined functions. Adopting SQL-like syntax rules is more straightforward and has no learning cost.
+- Data writing and querying performance far exceeds that of OpenTSDB.
+- Efficient compression mechanism for time-series data, which compresses to less than 1/5 of the storage space, on disk.
+- The installation and deployment are straightforward. A single installation package can complete the installation and deployment and does not rely on other third-party software. The entire installation and deployment process takes a few seconds.
+- The built-in functions cover all of OpenTSDB's query functions and TDengine supports more time-series data query functions, scalar functions, and aggregation functions. TDengine also supports advanced query functions such as multiple time-window aggregations, join query, expression operation, multiple group aggregation, user-defined sorting, and user-defined functions. With a SQL-like query language, querying is more straightforward and has no learning cost.
- Supports up to 128 tags, with a total tag length of 16 KB.
- In addition to the REST interface, it also provides interfaces to Java, Python, C, Rust, Go, C# and other languages. Its supports a variety of enterprise-class standard connector protocols such as JDBC.
-If we migrate the applications originally running on OpenTSDB to TDengine, we will effectively reduce the compute and storage resource consumption and the number of deployed servers. And will also significantly reduce the operation and maintenance costs, making operation and maintenance management more straightforward and more accessible, and considerably reducing the total cost of ownership. Like OpenTSDB, TDengine has also been open-sourced, including the stand-alone version and the cluster version source code. So there is no need to be concerned about the vendor-lock problem.
+Migrating applications originally running on OpenTSDB to TDengine, effectively reduces compute and storage resource consumption and the number of deployed servers. It also significantly reduces operation and maintenance costs, makes operation and maintenance management more straightforward and more accessible, and considerably reduces the total cost of ownership. Like OpenTSDB, TDengine has also been open-sourced. Both the stand-alone version and the cluster version are open-sourced and there is no need to be concerned about the vendor-lock problem.
We will explain how to migrate OpenTSDB applications to TDengine quickly, securely, and reliably without coding, using the most typical DevOps scenarios. Subsequent chapters will go into more depth to facilitate migration for non-DevOps systems.
@@ -34,7 +33,7 @@ The following figure (Figure 1) shows the system's overall architecture for a ty
**Figure 1. Typical architecture in a DevOps scenario**

-In this application scenario, there are Agent tools deployed in the application environment to collect machine metrics, network metrics, and application metrics. Data collectors to aggregate information collected by agents, systems for persistent data storage and management, and tools for monitoring data visualization (e.g., Grafana, etc.).
+In this application scenario, there are Agent tools deployed in the application environment to collect machine metrics, network metrics, and application metrics. There are also data collectors to aggregate information collected by agents, systems for persistent data storage and management, and tools for data visualization (e.g., Grafana, etc.).
The agents deployed in the application nodes are responsible for providing operational metrics from different sources to collectd/Statsd. And collectd/StatsD is accountable for pushing the aggregated data to the OpenTSDB cluster system and then visualizing the data using the visualization kanban board software, Grafana.
@@ -44,15 +43,15 @@ The agents deployed in the application nodes are responsible for providing opera
First of all, please install TDengine. Download the latest stable version of TDengine from the official website and install it. For help with using various installation packages, please refer to the blog ["Installation and Uninstallation of TDengine Multiple Installation Packages"](https://www.taosdata.com/blog/2019/08/09/566.html).
-Note that once the installation is complete, do not start the `taosd` service immediately, but after properly configuring the parameters.
+Note that once the installation is complete, do not start the `taosd` service before properly configuring the parameters.
- **Adjusting the data collector configuration**
TDengine version 2.4 and later version includes `taosAdapter`. taosAdapter is a stateless, rapidly elastic, and scalable component. taosAdapter supports Influxdb's Line Protocol and OpenTSDB's telnet/JSON writing protocol specification, providing rich data access capabilities, effectively saving user migration costs and reducing the difficulty of user migration.
-Users can flexibly deploy taosAdapter instances according to their requirements to rapidly improve the throughput of data writes in conjunction with the needs of scenarios and provide guarantees for data writes in different application scenarios.
+Users can flexibly deploy taosAdapter instances, based on their requirements, to improve data writing throughput and provide guarantees for data writes in different application scenarios.
-Through taosAdapter, users can directly push the data collected by `collectd` or `StatsD` to TDengine to achieve seamless migration of application scenarios, which is very easy and convenient. taosAdapter also supports Telegraf, Icinga, TCollector, and node_exporter data. For more details, please refer to [taosAdapter](/reference/taosadapter/).
+Through taosAdapter, users can directly write the data collected by `collectd` or `StatsD` to TDengine to achieve easy, convenient and seamless migration in application scenarios. taosAdapter also supports Telegraf, Icinga, TCollector, and node_exporter data. For more details, please refer to [taosAdapter](/reference/taosadapter/).
If using collectd, modify the configuration file in its default location `/etc/collectd/collectd.conf` to point to the IP address and port of the node where to deploy taosAdapter. For example, assuming the taosAdapter IP address is 192.168.1.130 and port 6046, configure it as follows.
@@ -66,56 +65,55 @@ LoadPlugin write_tsdb
```
-You can use collectd and push the data to taosAdapter utilizing the push to OpenTSDB plugin. taosAdapter will call the API to write the data to TDengine, thus completing the writing of the data. If you are using StatsD, adjust the profile information accordingly.
+You can use collectd and push the data to taosAdapter utilizing the write_tsdb plugin. taosAdapter will call the API to write the data to TDengine. If you are using StatsD, adjust the profile information accordingly.
- **Tuning the Dashboard system**
-After writing the data to TDengine properly, you can adapt Grafana to visualize the data written to TDengine. To obtain and use the Grafana plugin provided by TDengine, please refer to [Links to other tools](/third-party/grafana).
+After writing the data to TDengine, you can configure Grafana to visualize the data written to TDengine. To obtain and use the Grafana plugin provided by TDengine, please refer to [Links to other tools](/third-party/grafana).
TDengine provides two sets of Dashboard templates by default, and users only need to import the templates from the Grafana directory into Grafana to activate their use.
**Importing Grafana Templates** Figure 2.

-After the above steps, you completed the migration to replace OpenTSDB with TDengine. You can see that the whole process is straightforward, there is no need to write any code, and only some configuration files need to be adjusted to meet the migration work.
+With the above steps completed, you have finished replacing OpenTSDB with TDengine. You can see that the whole process is straightforward, there is no need to write any code, and only some configuration files need to be changed.
### 3. Post-migration architecture
-After completing the migration, the figure below (Figure 3) shows the system's overall architecture. The whole process of the acquisition side, the data writing, and the monitoring and presentation side are all kept stable, except for a few configuration adjustments, which do not involve any critical changes or alterations. OpenTSDB to TDengine migration action, using TDengine more powerful processing power and query performance.
+After completing the migration, the figure below (Figure 3) shows the system's overall architecture. The whole process of the acquisition side, the data writing, and the monitoring and presentation side are all kept stable. There are a few configuration adjustments, which do not involve any critical changes or alterations. Migrating to TDengine from OpenTSDB leads to powerful processing power and query performance.
-In most DevOps scenarios, if you have a small OpenTSDB cluster (3 or fewer nodes) for providing the storage layer of DevOps and rely on OpenTSDB to give a data persistence layer and query capabilities, you can safely replace OpenTSDB with TDengine. TDengine will save more compute and storage resources. With the same compute resource allocation, a single TDengine can meet the service capacity provided by 3 to 5 OpenTSDB nodes. If the scale is more prominent, then TDengine clustering is required.
-
-Suppose your application is particularly complex, or the application domain is not a DevOps scenario. You can continue reading subsequent chapters for a more comprehensive and in-depth look at the advanced topics of migrating an OpenTSDB application to TDengine.
+In most DevOps scenarios, if you have a small OpenTSDB cluster (3 or fewer nodes) which provides storage and data persistence layer in addition to query capability, you can safely replace OpenTSDB with TDengine. TDengine will save compute and storage resources. With the same compute resource allocation, a single TDengine can meet the service capacity provided by 3 to 5 OpenTSDB nodes. TDengine clustering may be required depending on the scale of the application.
**Figure 3. System architecture after migration**

+The following chapters provide a more comprehensive and in-depth look at the advanced topics of migrating an OpenTSDB application to TDengine. This will be useful if your application is particularly complex and is not a DevOps application.
+
## Migration evaluation and strategy for other scenarios
### 1. Differences between TDengine and OpenTSDB
This chapter describes the differences between OpenTSDB and TDengine at the system functionality level. After reading this chapter, you can fully evaluate whether you can migrate some complex OpenTSDB-based applications to TDengine, and what you should pay attention to after migration.
-TDengine currently only supports Grafana for visual kanban rendering, so if your application uses front-end kanban boards other than Grafana (e.g., [TSDash](https://github.com/facebook/tsdash), [Status Wolf](https://github.com/box/StatusWolf), etc.). You cannot directly migrate those front-end kanbans to TDengine, and the front-end kanban will need to be ported to Grafana to work correctly.
+TDengine currently only supports Grafana for visual kanban rendering, so if your application uses front-end kanban boards other than Grafana (e.g., [TSDash](https://github.com/facebook/tsdash), [Status Wolf](https://github.com/box/StatusWolf), etc.) you cannot directly migrate those front-end kanbans to TDengine. The front-end kanban will need to be ported to Grafana to work correctly.
-TDengine version 2.3.0.x only supports collectd and StatsD as data collection aggregation software but will provide more data collection aggregation software in the future. If you use other data aggregators on the collection side, your application needs to be ported to these two data aggregation systems to write data correctly.
+TDengine version 2.3.0.x only supports collectd and StatsD as data collection and aggregation software but future versions will provide support for more data collection and aggregation software in the future. If you use other data aggregators on the collection side, your application needs to be ported to these two data aggregation systems to write data correctly.
In addition to the two data aggregator software protocols mentioned above, TDengine also supports writing data directly via InfluxDB's line protocol and OpenTSDB's data writing protocol, JSON format. You can rewrite the logic on the data push side to write data using the line protocols supported by TDengine.
-In addition, if your application uses the following features of OpenTSDB, you need to understand the following considerations before migrating your application to TDengine.
+In addition, if your application uses the following features of OpenTSDB, you need to take into account the following considerations before migrating your application to TDengine.
1. `/api/stats`: If your application uses this feature to monitor the service status of OpenTSDB, and you have built the relevant logic to link the processing in your application, then this part of the status reading and fetching logic needs to be re-adapted to TDengine. TDengine provides a new mechanism for handling cluster state monitoring to meet the monitoring and maintenance needs of your application.
-2. `/api/tree`: If you rely on this feature of OpenTSDB for the hierarchical organization and maintenance of timelines, you cannot migrate it directly to TDengine, which uses a database -> super table -> sub-table hierarchy to organize and maintain timelines, with all timelines belonging to the same super table in the same system hierarchy, but it is possible to simulate a logical multi-level structure of the application through the unique construction of different tag values.
-3. `Rollup And PreAggregates`: The use of Rollup and PreAggregates requires the application to decide where to access the Rollup results and, in some scenarios, to access the actual results. The opacity of this structure makes the application processing logic extraordinarily complex and not portable at all. We think this strategy is a compromise when the time-series database does not.
-TDengine does not support automatic downsampling of multiple timelines and preaggregation (for a range of periods) for the time being. Still, thanks to its high-performance query processing logic can provide very high-performance query responses without relying on Rollup and preaggregation (for a range of periods), making your application query processing logic much more straightforward.
-The logic is much simpler.
-4. `Rate`: TDengine provides two functions to calculate the rate of change of values, namely `Derivative` (the result is consistent with the Derivative behavior of InfluxDB) and `IRate` (the result is compatible with the IRate function in Prometheus). However, the results of these two functions are slightly different from Rate, but the functions are more powerful overall. In addition, TDengine supports all the calculation functions provided by OpenTSDB, and TDengine's query functions are much more potent than those supported by OpenTSDB, which can significantly simplify the processing logic of your application.
+2. `/api/tree`: If you rely on this feature of OpenTSDB for the hierarchical organization and maintenance of timelines, you cannot migrate it directly to TDengine, which uses a database -> super table -> sub-table hierarchy to organize and maintain timelines, with all timelines belonging to the same super table in the same system hierarchy. But it is possible to simulate a logical multi-level structure of the application through the unique construction of different tag values.
+3. `Rollup And PreAggregates`: The use of Rollup and PreAggregates requires the application to decide where to access the Rollup results and, in some scenarios, to access the actual results. The opacity of this structure makes the application processing logic extraordinarily complex and not portable at all.
+While TDengine does not currently support automatic downsampling of multiple timelines and preaggregation (for a range of periods), thanks to its high-performance query processing logic, it can provide very high-performance query responses without relying on Rollup and preaggregation (for a range of periods). This makes your application query processing logic straightforward and simple.
+4. `Rate`: TDengine provides two functions to calculate the rate of change of values, namely `Derivative` (the result is consistent with the Derivative behavior of InfluxDB) and `IRate` (the result is compatible with the IRate function in Prometheus). However, the results of these two functions are slightly different from that of Rate. But the TDengine functions are more powerful. In addition, TDengine supports all the calculation functions provided by OpenTSDB. TDengine's query functions are much more powerful than those supported by OpenTSDB, which can significantly simplify the processing logic of your application.
-Through the above introduction, I believe you should be able to understand the changes brought about by the migration of OpenTSDB to TDengine. And this information will also help you correctly determine whether you would migrate your application to TDengine to experience the powerful and convenient time-series data processing capability provided by TDengine.
+With the above introduction, we believe you should be able to understand the changes brought about by the migration of OpenTSDB to TDengine. And this information will also help you correctly determine whether you should migrate your application to TDengine to experience the powerful and convenient time-series data processing capability provided by TDengine.
### 2. Migration strategy suggestion
-First, the OpenTSDB-based system migration involves data schema design, system scale estimation, and data write end transformation, data streaming, and application adaptation; after that, the two systems will run in parallel for a while and then migrate the historical data to TDengine. Of course, if your application has some functions that strongly depend on the above OpenTSDB features and you do not want to stop using them, you can migrate the historical data to TDengine.
-You can consider keeping the original OpenTSDB system running while starting TDengine to provide the primary services.
+OpenTSDB-based system migration involves data schema design, system scale estimation, data write transformation, data streaming, and application changes. The two systems should run in parallel for a while and then the historical data should be migrated to TDengine if your application has some functions that strongly depend on the above OpenTSDB features and you do not want to stop using them.
+You can also consider keeping the original OpenTSDB system running while using TDengine to provide the primary services.
## Data model design
@@ -129,16 +127,19 @@ Let us now assume a DevOps scenario where we use collectd to collect the underly
| 2 | swap | value | double | host | swap_type | swap_type_instance | source | n/a |
| 3 | disk | value | double | host | disk_point | disk_instance | disk_type | source |
-TDengine requires the data stored to have a data schema, i.e., you need to create a super table and specify the schema of the super table before writing the data. For data schema creation, you have two ways to do this: 1) Take advantage of TDengine's native data writing support for OpenTSDB by calling the TDengine API to write (text line or JSON format)
-and automate the creation of single-value models. This approach does not require significant adjustments to the data writing application, nor does it require converting the written data format.
+TDengine requires the data stored to have a data schema, i.e., you need to create a super table and specify the schema of the super table before writing the data. For data schema creation, you have two ways to do this:
+1) Take advantage of TDengine's native data writing support for OpenTSDB by calling the TDengine API to write (text line or JSON format) and automate the creation of single-value models. This approach does not require significant adjustments to the data writing application, nor does it require converting the written data format.
At the C level, TDengine provides the `taos_schemaless_insert()` function to write data in OpenTSDB format directly (in early version this function was named `taos_insert_lines()`). Please refer to the sample code `schemaless.c` in the installation package directory as reference.
-(2) based on a complete understanding of TDengine's data model, to establish the mapping relationship between OpenTSDB and TDengine's data model adjustment manually. Considering that OpenTSDB is a single-value mapping model, recommended using the single-value model in TDengine. TDengine can support both multi-value and single-value models.
+(2) Based on a thorough understanding of TDengine's data model, establish a mapping between OpenTSDB and TDengine's data model. Considering that OpenTSDB is a single-value mapping model, we recommended using the single-value model in TDengine for simplicity. But keep in mind that TDengine supports both multi-value and single-value models.
- **Single-valued model**.
-The steps are as follows: use the name of the metrics as the name of the TDengine super table, which build with two basic data columns - timestamp and value, and the label of the super table is equivalent to the label information of the metrics, and the number of labels is equal to the number of labels of the metrics. The names of sub-tables are named with fixed rules: `metric + '_' + tags1_value + '_' + tag2_value + '_' + tag3_value ...` as the sub-table name.
+The steps are as follows:
+- Use the name of the metrics as the name of the TDengine super table
+- Build with two basic data columns - timestamp and value. The label of the super table is equivalent to the label information of the metrics, and the number of labels is equal to the number of labels of the metrics.
+- The names of sub-tables are named with fixed rules: `metric + '_' + tags1_value + '_' + tag2_value + '_' + tag3_value ...` as the sub-table name.
Create 3 super tables in TDengine.
@@ -158,13 +159,13 @@ The final system will have about 340 sub-tables and three super-tables. Note tha
- **Multi-value model**
-Suppose you want to take advantage of TDengine's multi-value modeling capabilities. In that case, you need first to meet the requirements that different collection quantities have the same collection frequency and can reach the **data write side simultaneously via a message queue**, thus ensuring writing multiple metrics at once using SQL statements. The metric's name is used as the name of the super table to create a multi-column model of data that has the same collection frequency and can arrive simultaneously. The names of the sub-tables are named using a fixed rule. Each of the above metrics contains only one measurement value, so converting it into a multi-value model is impossible.
+Ideally you should take advantage of TDengine's multi-value modeling capabilities. In that case, you first need to meet the requirement that different collection quantities have the same collection frequency and can reach the **data write side simultaneously via a message queue**, thus ensuring writing multiple metrics at once, using SQL statements. The metric's name is used as the name of the super table to create a multi-column model of data that has the same collection frequency and can arrive simultaneously. The sub-tables are named using a fixed rule. Each of the above metrics contains only one measurement value, so converting it into a multi-value model is impossible.
## Data triage and application adaptation
-Subscribe data from the message queue and start the adapted writer to write the data.
+Subscribe to the message queue and start writing data to TDengine.
-After writing the data starts for a while, you can use SQL statements to check whether the amount of data written meets the expected writing requirements. Use the following SQL statement to count the amount of data.
+After data has been written for a while, you can use SQL statements to check whether the amount of data written meets the expected writing requirements. Use the following SQL statement to count the amount of data.
```sql
select count(*) from memory
@@ -184,7 +185,7 @@ To facilitate historical data migration, we provide a plug-in for the data synch
For the specific usage of DataX and how to use DataX to write data to TDengine, please refer to [DataX-based TDengine Data Migration Tool](https://www.taosdata.com/blog/2021/10/26/3156.html).
-After migrating via DataX, we found that we can significantly improve the efficiency of migrating historical data by starting multiple processes and migrating numerous metrics simultaneously. The following are some records of the migration process. I wish to use these for application migration as a reference.
+After migrating via DataX, we found that we can significantly improve the efficiency of migrating historical data by starting multiple processes and migrating numerous metrics simultaneously. The following are some records of the migration process. We provide these as a reference for application migration.
| Number of datax instances (number of concurrent processes) | Migration record speed (pieces/second) |
| ----------------------------- | ------------------- -- |
@@ -202,13 +203,13 @@ Suppose you need to use the multi-value model for data writing. In that case, yo
Manual migration of data requires attention to the following two issues:
-1) When storing the exported data on the disk, the disk needs to have enough storage space to accommodate the exported data files fully. Adopting the partial import mode to avoid the shortage of disk file storage after the total amount of data is exported. Preferentially export the timelines belonging to the same super table. Then the exported data files are imported into the TDengine system.
+1) When storing the exported data on the disk, the disk needs to have enough storage space to accommodate the exported data files fully. To avoid running out of disk space, you can adopt a partial import mode in which you preferentially export the timelines belonging to the same super table and then only those files are imported into TDengine.
-2) Under the full load of the system, if there are enough remaining computing and IO resources, establish a multi-threaded importing to maximize the efficiency of data migration. Considering the vast load that data parsing brings to the CPU, it is necessary to control the maximum number of parallel tasks to avoid the overall overload of the system triggered by importing historical data.
+2) Under the full load of the system, if there are enough remaining computing and IO resources, establish a multi-threaded import to maximize the efficiency of data migration. Considering the vast load that data parsing brings to the CPU, it is necessary to control the maximum number of parallel tasks to avoid overloading the system when importing historical data.
Due to the ease of operation of TDengine itself, there is no need to perform index maintenance and data format change processing in the entire process. The whole process only needs to be executed sequentially.
-When wholly importing the historical data into TDengine, the two systems run simultaneously and then switch the query request to TDengine to achieve seamless application switching.
+While importing historical data into TDengine, the two systems should run simultaneously. Once all the data is migrated, switch the query request to TDengine to achieve seamless application switching.
## Appendix 1: OpenTSDB query function correspondence table
@@ -222,12 +223,12 @@ Example:
SELECT avg(val) FROM (SELECT first(val) FROM super_table WHERE ts >= startTime and ts <= endTime INTERVAL(20s) Fill(linear)) INTERVAL(20s)
```
-Remark:
+Remarks:
1. The value in Interval needs to be the same as the interval value in the outer query.
-2. The interpolation processing in TDengine needs to use subqueries to assist in the completion. As shown above, it is enough to specify the interpolation type in the inner query. Since the interpolation of the values in OpenTSDB uses linear interpolation, use fill( in the interpolation clause. linear) to declare the interpolation type. The following functions with the exact interpolation calculation requirements are processed by this method.
-3. The parameter 20s in Interval indicates that the inner query will generate results according to a time window of 20 seconds. In an actual query, it needs to adjust to the time interval between different records. It ensures that producing interpolation results equivalent to the original data.
-4. Due to the particular interpolation strategy and mechanism of OpenTSDB, the method of the first interpolation and then calculation in the aggregate query (Aggregate) makes the calculation results impossible to be utterly consistent with TDengine. But in the case of downsampling (Downsample), TDengine and OpenTSDB can obtain consistent results (since OpenTSDB performs aggregation and downsampling queries).
+2. Interpolation processing in TDengine uses subqueries to assist in completion. As shown above, it is enough to specify the interpolation type in the inner query. Since OpenTSDB uses linear interpolation, use `fill(linear)` to declare the interpolation type in TDengine. Some of the functions mentioned below have exactly the same interpolation calculation requirements.
+3. The parameter 20s in Interval indicates that the inner query will generate results according to a time window of 20 seconds. In an actual query, it needs to adjust to the time interval between different records. It ensures that interpolation results are equivalent to the original data.
+4. Due to the particular interpolation strategy and mechanism of OpenTSDB i.e. interpolation followed by aggregate calculation, it is impossible for the results to be completely consistent with those of TDengine. But in the case of downsampling (Downsample), TDengine and OpenTSDB can obtain consistent results (since OpenTSDB performs aggregation and downsampling queries).
### Count
@@ -261,7 +262,7 @@ Select apercentile(col1, 50, “t-digest”) from table_name
Remark:
-1. During the approximate query processing, OpenTSDB uses the t-digest algorithm by default, so in order to obtain the same calculation result, the algorithm used needs to be specified in the `apercentile()` function. TDengine can support two different approximation processing algorithms, declared by "default" and "t-digest" respectively.
+1. When calculating estimate percentiles, OpenTSDB uses the t-digest algorithm by default. In order to obtain the same calculation results in TDengine, the algorithm used needs to be specified in the `apercentile()` function. TDengine can support two different percentile calculation algorithms named "default" and "t-digest" respectively.
### First
@@ -379,35 +380,34 @@ We still use the hypothetical environment from Chapter 4. There are three measur
### Storage resource estimation
Assuming that the number of sensor devices that generate data and need to be stored is `n`, the frequency of data generation is `t` per second, and the length of each record is `L` bytes, the scale of data generated per day is `n * t * L` bytes. Assuming the compression ratio is `C`, the daily data size is `(n * t * L)/C` bytes. The storage resources are estimated to accommodate the data scale for 1.5 years. In the production environment, the compression ratio C of TDengine is generally between 5 and 7.
-With additional 20% redundancy, you can calculate the required storage resources:
+With additional 20% redundancy, you can calculate the required storage resources:
```matlab
(n * t * L) * (365 * 1.5) * (1+20%)/C
````
-
-Combined with the above calculation formula, bring the parameters into the formula, and the raw data scale generated every year is 11.8TB without considering the label information. Note that since tag information is associated with each timeline in TDengine, not every record. The scale of the amount of data to be recorded is somewhat reduced relative to the generated data, and this part of label data can be ignored as a whole. Assuming a compression ratio of 5, the size of the retained data ends up being 2.56 TB.
+Substituting in the above formula, the raw data generated every year is 11.8TB without considering the label information. Note that tag information is associated with each timeline in TDengine, not every record. The amount of data to be recorded is somewhat reduced relative to the generated data, and label data can be ignored as a whole. Assuming a compression ratio of 5, the size of the retained data ends up being 2.56 TB.
### Storage Device Selection Considerations
-The hard disk should be capable of better random read performance. Considering using an SSD as much as possible is a better choice. A disk with better random read performance is a great help to improve the system's query performance and improve the query response performance as a whole system. To obtain better query performance, the performance index of the single-threaded random read IOPS of the hard disk device should not be lower than 1000, and it is better to reach 5000 IOPS or more. Recommend to use `fio` utility software to evaluate the running performance (please refer to Appendix 1 for specific usage) for the random IO read of the current device to confirm whether it can meet the requirements of random read of large files.
+A disk with better random read performance, such as an SSD, improves the system's query performance and improves the query response performance of the whole system. To obtain better query performance, the performance index of the single-threaded random read IOPS of the hard disk device should not be lower than 1000, and it is better to reach 5000 IOPS or more. We recommend using `fio` utility software to evaluate the running performance (please refer to Appendix 1 for specific usage) for the random IO read of the current device to confirm whether it can meet the requirements of random read of large files.
Hard disk writing performance has little effect on TDengine. The TDengine writing process adopts the append write mode, so as long as it has good sequential write performance, both SAS hard disks and SSDs in the general sense can well meet TDengine's requirements for disk write performance.
### Computational resource estimates
-Due to the particularity of IoT data, after the frequency of data generation is consistent, the writing process of TDengine maintains a relatively fixed amount of resource consumption (computing and storage). According to the [TDengine Operation and Maintenance Guide](/operation/) description, the system consumes less than 1 CPU core at 22,000 writes per second.
+Due to the characteristics of IoT data, when the frequency of data generation is consistent, the writing process of TDengine maintains a relatively fixed amount of resource consumption (computing and storage). According to the [TDengine Operation and Maintenance Guide](/operation/) description, the system consumes less than 1 CPU core at 22,000 writes per second.
-In estimating the CPU resources consumed by the query, assuming that the application requires the database to provide 10,000 QPS, the CPU time consumed by each query is about 1 ms. The query provided by each core per second is 1,000 QPS, which satisfies 10,000 QPS. The query request requires at least 10 cores. For the system as a whole system to have less than 50% CPU load, the entire cluster needs twice as many as 10 cores or 20 cores.
+In estimating the CPU resources consumed by the query, assuming that the application requires the database to provide 10,000 QPS, the CPU time consumed by each query is about 1 ms. The query provided by each core per second is 1,000 QPS, which satisfies 10,000 QPS. The query request requires at least 10 cores. For the system as a whole system to have less than 50% CPU load, the entire cluster needs twice as many cores i.e. 20 cores.
### Memory resource estimation
-The database allocates 16MB\*3 buffer memory for each Vnode by default. If the cluster system includes 22 CPU cores, TDengine will create 22 Vnodes (virtual nodes) by default. Each Vnode contains 1000 tables, which can accommodate all the tables. Then it takes about 1.5 hours to write a block, which triggers the drop, and no adjustment is required. A total of 22 Vnodes require about 1GB of memory cache. Considering the memory needed for the query, assuming that the memory overhead of each query is about 50MB, the memory required for 500 queries concurrently is about 25GB.
+The database allocates 16MB\*3 buffer memory for each Vnode by default. If the cluster system includes 22 CPU cores, TDengine will create 22 Vnodes (virtual nodes) by default. Each Vnode contains 1000 tables, which is more than enough to accommodate all the tables in our hypothetical scenario. Then it takes about 1.5 hours to write a block, which triggers persistence to disk without requiring any adjustment. A total of 22 Vnodes require about 1GB of memory cache. Considering the memory needed for the query, assuming that the memory overhead of each query is about 50MB, the memory required for 500 queries concurrently is about 25GB.
In summary, using a single 16-core 32GB machine or a cluster of 2 8-core 16GB machines is enough.
## Appendix 3: Cluster Deployment and Startup
-TDengine provides a wealth of help documents to explain many aspects of cluster installation and deployment. Here is the list of corresponding document for your reference.
+TDengine provides a wealth of help documents to explain many aspects of cluster installation and deployment. Here is the list of documents for your reference.
### Cluster Deployment
@@ -421,7 +421,7 @@ To ensure that the system can obtain the necessary information for regular opera
FQDN, firstEp, secondEP, dataDir, logDir, tmpDir, serverPort. For the specific meaning and setting requirements of each parameter, please refer to the document "[TDengine Cluster Installation and Management](/cluster/)"
-Follow the same steps to set parameters on the nodes that need running, start the taosd service, and then add Dnodes to the cluster.
+Follow the same steps to set parameters on the other nodes, start the taosd service, and then add Dnodes to the cluster.
Finally, start `taos` and execute the `show dnodes` command. If you can see all the nodes that have joined the cluster, the cluster building process was successfully completed. For specific operation procedures and precautions, please refer to the document "[TDengine Cluster Installation and Management](/cluster/)".
diff --git a/docs-en/27-train-faq/01-faq.md b/docs-en/27-train-faq/01-faq.md
index 439775170937ef11fc964914232b2739d688b26f..e182e25b9e98bad11b9c90146400e3720605489e 100644
--- a/docs-en/27-train-faq/01-faq.md
+++ b/docs-en/27-train-faq/01-faq.md
@@ -5,38 +5,38 @@ title: Frequently Asked Questions
## Submit an Issue
-If the tips in FAQ don't help much, please submit an issue on [GitHub](https://github.com/taosdata/TDengine) to describe your problem description, including TDengine version, hardware and OS information, the steps to reproduce the problem, etc. It would be very helpful if you package the contents in `/var/log/taos` and `/etc/taos` and upload. These two are the default directories used by TDengine, if they have been changed in your configuration, please use according to the actual configuration. It's recommended to firstly set `debugFlag` to 135 in `taos.cfg`, restart `taosd`, then reproduce the problem and collect logs. If you don't want to restart, an alternative way of setting `debugFlag` is executing `alter dnode debugFlag 135` command in TDengine CLI `taos`. During normal running, however, please make sure `debugFlag` is set to 131.
+If the tips in FAQ don't help much, please submit an issue on [GitHub](https://github.com/taosdata/TDengine) to describe your problem. In your description please include the TDengine version, hardware and OS information, the steps to reproduce the problem and any other relevant information. It would be very helpful if you can package the contents in `/var/log/taos` and `/etc/taos` and upload. These two are the default directories used by TDengine. If you have changed the default directories in your configuration, please package the files in your configured directories. We recommended setting `debugFlag` to 135 in `taos.cfg`, restarting `taosd`, then reproducing the problem and collecting the logs. If you don't want to restart, an alternative way of setting `debugFlag` is executing `alter dnode debugFlag 135` command in TDengine CLI `taos`. During normal running, however, please make sure `debugFlag` is set to 131.
## Frequently Asked Questions
### 1. How to upgrade to TDengine 2.0 from older version?
-version 2.x is not compatible with version 1.x regarding configuration file and data file, please do following before upgrading:
+version 2.x is not compatible with version 1.x. With regard to the configuration and data files, please perform the following steps before upgrading. Please follow data integrity, security, backup and other relevant SOPs, best practices before removing/deleting any data.
-1. Delete configuration files: `sudo rm -rf /etc/taos/taos.cfg`
+1. Delete configuration files: `sudo rm -rf /etc/taos/taos.cfg`
2. Delete log files: `sudo rm -rf /var/log/taos/`
3. Delete data files if the data doesn't need to be kept: `sudo rm -rf /var/lib/taos/`
-4. Install latests 2.x version
-5. If the data needs to be kept and migrated to newer version, please contact professional service of TDengine for assistance
+4. Install latest 2.x version
+5. If the data needs to be kept and migrated to newer version, please contact professional service at TDengine for assistance.
### 2. How to handle "Unable to establish connection"?
-When the client is unable to connect to the server, you can try following ways to find out why.
+When the client is unable to connect to the server, you can try the following ways to troubleshoot and resolve the problem.
1. Check the network
- - Check if the hosts where the client and server are running can be accessible to each other, for example by `ping` command.
- - Check if the TCP/UDP on port 6030-6042 are open for access if firewall is enabled. It's better to firstly disable firewall for diagnostics.
- - Check if the FQDN and serverPort are configured correctly in `taos.cfg` used by the server side
- - Check if the `firstEp` is set properly in the `taos.cfg` used by the client side
+ - Check if the hosts where the client and server are running are accessible to each other, for example by `ping` command.
+ - Check if the TCP/UDP on port 6030-6042 are open for access if firewall is enabled. If possible, disable the firewall for diagnostics, but please ensure that you are following security and other relevant protocols.
+ - Check if the FQDN and serverPort are configured correctly in `taos.cfg` used by the server side.
+ - Check if the `firstEp` is set properly in the `taos.cfg` used by the client side.
2. Make sure the client version and server version are same.
3. On server side, check the running status of `taosd` by executing `systemctl status taosd` . If your server is started using another way instead of `systemctl`, use the proper method to check whether the server process is running normally.
-4. If using connector of Python, Java, Go, Rust, C#, node.JS on Linux to connect toe the server, please make sure `libtaos.so` is in directory `/usr/local/taos/driver` and `/usr/local/taos/driver` is in system lib search environment variable `LD_LIBRARY_PATH`.
+4. If using connector of Python, Java, Go, Rust, C#, node.JS on Linux to connect to the server, please make sure `libtaos.so` is in directory `/usr/local/taos/driver` and `/usr/local/taos/driver` is in system lib search environment variable `LD_LIBRARY_PATH`.
-5. If using connector on Windows, please make sure `C:\TDengine\driver\taos.dll` is in your system lib search path, it's suggested to put `taos.dll` under `C:\Windows\System32`.
+5. If using connector on Windows, please make sure `C:\TDengine\driver\taos.dll` is in your system lib search path. We recommend putting `taos.dll` under `C:\Windows\System32`.
6. Some advanced network diagnostics tools
@@ -45,7 +45,7 @@ When the client is unable to connect to the server, you can try following ways t
Check whether a TCP port on server side is open: `nc -l {port}`
Check whether a TCP port on client side is open: `nc {hostIP} {port}`
- - On Windows system `Net-TestConnection -ComputerName {fqdn} -Port {port}` on PowerShell can be used to check whether the port on serer side is open for access.
+ - On Windows system `Net-TestConnection -ComputerName {fqdn} -Port {port}` on PowerShell can be used to check whether the port on server side is open for access.
7. TDengine CLI `taos` can also be used to check network, please refer to [TDengine CLI](/reference/taos-shell).
diff --git a/docs-en/27-train-faq/03-docker.md b/docs-en/27-train-faq/03-docker.md
index 8f27c35d7945043d39ad83626ceccee941ad135e..afee13c1377b0b4331d6f7ec20251d1aa2db81a1 100644
--- a/docs-en/27-train-faq/03-docker.md
+++ b/docs-en/27-train-faq/03-docker.md
@@ -3,15 +3,15 @@ sidebar_label: TDengine in Docker
title: Deploy TDengine in Docker
---
-Even though it's not recommended to deploy TDengine using docker in production system, docker is still very useful in development environment, especially when your host is not Linux. From version 2.0.14.0, the official image of TDengine can support X86-64, X86, arm64, and rm32 .
+We do not recommend deploying TDengine using Docker in a production system. However, Docker is still very useful in a development environment, especially when your host is not Linux. From version 2.0.14.0, the official image of TDengine can support X86-64, X86, arm64, and rm32 .
-In this chapter a simple step by step guide of using TDengine in docker is introduced.
+In this chapter we introduce a simple step by step guide to use TDengine in Docker.
## Install Docker
-The installation of docker please refer to [Get Docker](https://docs.docker.com/get-docker/).
+To install Docker please refer to [Get Docker](https://docs.docker.com/get-docker/).
-After docker is installed, you can check whether Docker is installed properly by displaying Docker version.
+After Docker is installed, you can check whether Docker is installed properly by displaying Docker version.
```bash
$ docker -v
@@ -27,7 +27,7 @@ $ docker run -d -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdeng
526aa188da767ae94b244226a2b2eec2b5f17dd8eff592893d9ec0cd0f3a1ccd
```
-In the above command, a docker container is started to run TDengine server, the port range 6030-6049 of the container is mapped to host port range 6030-6049. If port range 6030-6049 has been occupied on the host, please change to an available host port range. Regarding the requirements about ports on the host, please refer to [Port Configuration](/reference/config/#serverport).
+In the above command, a docker container is started to run TDengine server, the port range 6030-6049 of the container is mapped to host port range 6030-6049. If port range 6030-6049 has been occupied on the host, please change to an available host port range. For port requirements on the host, please refer to [Port Configuration](/reference/config/#serverport).
- **docker run**: Launch a docker container
- **-d**: the container will run in background mode
@@ -95,7 +95,7 @@ In TDengine CLI, SQL commands can be executed to create/drop databases, tables,
### Access TDengine from host
-If `-p` used to map ports properly between host and container, it's also able to access TDengine in container from the host as long as `firstEp` is configured correctly for the client on host.
+If option `-p` used to map ports properly between host and container, it's also able to access TDengine in container from the host as long as `firstEp` is configured correctly for the client on host.
```
$ taos
@@ -271,7 +271,7 @@ Below is an example output:
### Access TDengine from 3rd party tools
-A lot of 3rd party tools can be used to write data into TDengine through `taosAdapter` , for details please refer to [3rd party tools](/third-party/).
+A lot of 3rd party tools can be used to write data into TDengine through `taosAdapter`, for details please refer to [3rd party tools](/third-party/).
There is nothing different from the 3rd party side to access TDengine server inside a container, as long as the end point is specified correctly, the end point should be the FQDN and the mapped port of the host.
diff --git a/include/common/tmsg.h b/include/common/tmsg.h
index faf4addb4b5cc242c6cd1014fb64d7f004aabe43..12d1c8587944b1e6d506abe1d8c4eb125b1276d5 100644
--- a/include/common/tmsg.h
+++ b/include/common/tmsg.h
@@ -1439,8 +1439,10 @@ typedef struct {
int32_t code;
} STaskDropRsp;
-#define STREAM_TRIGGER_AT_ONCE 1
-#define STREAM_TRIGGER_WINDOW_CLOSE 2
+#define STREAM_TRIGGER_AT_ONCE_SMA 0
+#define STREAM_TRIGGER_AT_ONCE 1
+#define STREAM_TRIGGER_WINDOW_CLOSE 2
+#define STREAM_TRIGGER_WINDOW_CLOSE_SMA 3
typedef struct {
char name[TSDB_TABLE_FNAME_LEN];
diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h
index 2fc524eeac39eefba6ce87c39d7bf4746fd83de1..a7a534533e506df2ee253f3366281a7662156158 100644
--- a/include/common/ttokendef.h
+++ b/include/common/ttokendef.h
@@ -127,42 +127,42 @@
#define TK_BLOB 109
#define TK_VARBINARY 110
#define TK_DECIMAL 111
-#define TK_DELAY 112
-#define TK_FILE_FACTOR 113
-#define TK_NK_FLOAT 114
-#define TK_ROLLUP 115
-#define TK_TTL 116
-#define TK_SMA 117
-#define TK_SHOW 118
-#define TK_DATABASES 119
-#define TK_TABLES 120
-#define TK_STABLES 121
-#define TK_MNODES 122
-#define TK_MODULES 123
-#define TK_QNODES 124
-#define TK_FUNCTIONS 125
-#define TK_INDEXES 126
-#define TK_ACCOUNTS 127
-#define TK_APPS 128
-#define TK_CONNECTIONS 129
-#define TK_LICENCE 130
-#define TK_GRANTS 131
-#define TK_QUERIES 132
-#define TK_SCORES 133
-#define TK_TOPICS 134
-#define TK_VARIABLES 135
-#define TK_BNODES 136
-#define TK_SNODES 137
-#define TK_CLUSTER 138
-#define TK_TRANSACTIONS 139
-#define TK_LIKE 140
-#define TK_INDEX 141
-#define TK_FULLTEXT 142
-#define TK_FUNCTION 143
-#define TK_INTERVAL 144
-#define TK_TOPIC 145
-#define TK_AS 146
-#define TK_CGROUP 147
+#define TK_FILE_FACTOR 112
+#define TK_NK_FLOAT 113
+#define TK_ROLLUP 114
+#define TK_TTL 115
+#define TK_SMA 116
+#define TK_SHOW 117
+#define TK_DATABASES 118
+#define TK_TABLES 119
+#define TK_STABLES 120
+#define TK_MNODES 121
+#define TK_MODULES 122
+#define TK_QNODES 123
+#define TK_FUNCTIONS 124
+#define TK_INDEXES 125
+#define TK_ACCOUNTS 126
+#define TK_APPS 127
+#define TK_CONNECTIONS 128
+#define TK_LICENCE 129
+#define TK_GRANTS 130
+#define TK_QUERIES 131
+#define TK_SCORES 132
+#define TK_TOPICS 133
+#define TK_VARIABLES 134
+#define TK_BNODES 135
+#define TK_SNODES 136
+#define TK_CLUSTER 137
+#define TK_TRANSACTIONS 138
+#define TK_LIKE 139
+#define TK_INDEX 140
+#define TK_FULLTEXT 141
+#define TK_FUNCTION 142
+#define TK_INTERVAL 143
+#define TK_TOPIC 144
+#define TK_AS 145
+#define TK_CONSUMER 146
+#define TK_GROUP 147
#define TK_WITH 148
#define TK_SCHEMA 149
#define TK_DESC 150
@@ -239,22 +239,21 @@
#define TK_PREV 221
#define TK_LINEAR 222
#define TK_NEXT 223
-#define TK_GROUP 224
-#define TK_HAVING 225
-#define TK_ORDER 226
-#define TK_SLIMIT 227
-#define TK_SOFFSET 228
-#define TK_LIMIT 229
-#define TK_OFFSET 230
-#define TK_ASC 231
-#define TK_NULLS 232
-#define TK_ID 233
-#define TK_NK_BITNOT 234
-#define TK_INSERT 235
-#define TK_VALUES 236
-#define TK_IMPORT 237
-#define TK_NK_SEMI 238
-#define TK_FILE 239
+#define TK_HAVING 224
+#define TK_ORDER 225
+#define TK_SLIMIT 226
+#define TK_SOFFSET 227
+#define TK_LIMIT 228
+#define TK_OFFSET 229
+#define TK_ASC 230
+#define TK_NULLS 231
+#define TK_ID 232
+#define TK_NK_BITNOT 233
+#define TK_INSERT 234
+#define TK_VALUES 235
+#define TK_IMPORT 236
+#define TK_NK_SEMI 237
+#define TK_FILE 238
#define TK_NK_SPACE 300
#define TK_NK_COMMENT 301
diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h
index 7bd3a40c7199f204bd14e5af3231e59d5b7383be..b437ad60b875d7d151dd7b555c7b8279b8bbb3fd 100644
--- a/include/libs/nodes/cmdnodes.h
+++ b/include/libs/nodes/cmdnodes.h
@@ -80,8 +80,7 @@ typedef struct SAlterDatabaseStmt {
typedef struct STableOptions {
ENodeType type;
char comment[TSDB_TB_COMMENT_LEN];
- int32_t delay;
- float filesFactor;
+ double filesFactor;
SNodeList* pRollupFuncs;
int32_t ttl;
SNodeList* pSma;
diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h
index 2648a468dd3fa82fe91825d60b739387d9255bd7..44e7295b6939ff65b7dfc0310eddd486c21917a7 100644
--- a/include/libs/nodes/plannodes.h
+++ b/include/libs/nodes/plannodes.h
@@ -59,6 +59,7 @@ typedef struct SScanLogicNode {
int8_t triggerType;
int64_t watermark;
int16_t tsColId;
+ double filesFactor;
} SScanLogicNode;
typedef struct SJoinLogicNode {
@@ -113,6 +114,7 @@ typedef struct SWindowLogicNode {
SNode* pStateExpr;
int8_t triggerType;
int64_t watermark;
+ double filesFactor;
} SWindowLogicNode;
typedef struct SFillLogicNode {
@@ -222,6 +224,7 @@ typedef struct STableScanPhysiNode {
int8_t triggerType;
int64_t watermark;
int16_t tsColId;
+ double filesFactor;
} STableScanPhysiNode;
typedef STableScanPhysiNode STableSeqScanPhysiNode;
@@ -272,6 +275,7 @@ typedef struct SWinodwPhysiNode {
SNode* pTspk; // timestamp primary key
int8_t triggerType;
int64_t watermark;
+ double filesFactor;
} SWinodwPhysiNode;
typedef struct SIntervalPhysiNode {
diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h
index 1466bb7400950b9f80b998063ebf67a7163589bc..06272b81514cec2a294da513ec2a57447ad74ef1 100644
--- a/include/libs/parser/parser.h
+++ b/include/libs/parser/parser.h
@@ -55,9 +55,9 @@ int32_t qParseSql(SParseContext* pCxt, SQuery** pQuery);
bool qIsInsertSql(const char* pStr, size_t length);
// for async mode
-int32_t qSyntaxParseSql(SParseContext* pCxt, SQuery** pQuery, struct SCatalogReq* pCatalogReq);
-int32_t qSemanticAnalysisSql(SParseContext* pCxt, const struct SCatalogReq* pCatalogReq,
- const struct SMetaData* pMetaData, SQuery* pQuery);
+int32_t qParseSqlSyntax(SParseContext* pCxt, SQuery** pQuery, struct SCatalogReq* pCatalogReq);
+int32_t qAnalyseSqlSemantic(SParseContext* pCxt, const struct SCatalogReq* pCatalogReq,
+ const struct SMetaData* pMetaData, SQuery* pQuery);
void qDestroyQuery(SQuery* pQueryNode);
diff --git a/include/libs/planner/planner.h b/include/libs/planner/planner.h
index c4f71e57a8174c62cf331e4afec35604786282a0..6e14445ac7abc12eb4ccca7a9f08f3e7ff43ddb8 100644
--- a/include/libs/planner/planner.h
+++ b/include/libs/planner/planner.h
@@ -36,6 +36,7 @@ typedef struct SPlanContext {
int64_t watermark;
char* pMsg;
int32_t msgLen;
+ double filesFactor;
} SPlanContext;
// Create the physical plan for the query, according to the AST.
diff --git a/include/util/tdef.h b/include/util/tdef.h
index 709e2b8a7fe3eebb0c92777d349baf333a38b314..839fd0b26318a9cf6db6b4fd5178a51a7ec6d0ed 100644
--- a/include/util/tdef.h
+++ b/include/util/tdef.h
@@ -345,9 +345,6 @@ typedef enum ELogicConditionType {
#define TSDB_MIN_ROLLUP_FILE_FACTOR 0
#define TSDB_MAX_ROLLUP_FILE_FACTOR 1
#define TSDB_DEFAULT_ROLLUP_FILE_FACTOR 0.1
-#define TSDB_MIN_ROLLUP_DELAY 1
-#define TSDB_MAX_ROLLUP_DELAY 10
-#define TSDB_DEFAULT_ROLLUP_DELAY 2
#define TSDB_MIN_TABLE_TTL 0
#define TSDB_DEFAULT_TABLE_TTL 0
@@ -369,7 +366,11 @@ typedef enum ELogicConditionType {
#define PRIMARYKEY_TIMESTAMP_COL_ID 1
#define COL_REACH_END(colId, maxColId) ((colId) > (maxColId))
+#ifdef WINDOWS
+#define TSDB_MAX_RPC_THREADS 4 // windows pipe only support 4 connections.
+#else
#define TSDB_MAX_RPC_THREADS 5
+#endif
#define TSDB_QUERY_TYPE_NON_TYPE 0x00u // none type
#define TSDB_QUERY_TYPE_FREE_RESOURCE 0x01u // free qhandle at vnode
diff --git a/packaging/docker/Dockerfile b/packaging/docker/Dockerfile
index 26349e257676d99d0ea81e03509c8b09c20a2248..35bea0e65ccc5070fe9d4e82adadc7132ae7cc81 100644
--- a/packaging/docker/Dockerfile
+++ b/packaging/docker/Dockerfile
@@ -1,32 +1,25 @@
-FROM ubuntu:18.04
-
-WORKDIR /root
-
-ARG pkgFile
-ARG dirName
-ARG cpuType
-RUN echo ${pkgFile} && echo ${dirName}
-
-COPY ${pkgFile} /root/
-RUN tar -zxf ${pkgFile}
-WORKDIR /root/
-RUN cd /root/${dirName}/ && /bin/bash install.sh -e no && cd /root
-RUN rm /root/${pkgFile}
-RUN rm -rf /root/${dirName}
-
-ENV DEBIAN_FRONTEND=noninteractive
-RUN apt-get clean && apt-get update && apt-get install -y locales tzdata netcat && locale-gen en_US.UTF-8
-ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib" \
- LC_CTYPE=en_US.UTF-8 \
- LANG=en_US.UTF-8 \
- LC_ALL=en_US.UTF-8
-
-COPY ./bin/* /usr/bin/
-
-ENV TINI_VERSION v0.19.0
-RUN bash -c 'echo -e "Downloading tini-${cpuType} ..."'
-ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${cpuType} /tini
-RUN chmod +x /tini
-ENTRYPOINT ["/tini", "--", "/usr/bin/entrypoint.sh"]
-CMD ["taosd"]
-VOLUME [ "/var/lib/taos", "/var/log/taos", "/corefile" ]
+FROM ubuntu:18.04
+
+WORKDIR /root
+
+ARG pkgFile
+ARG dirName
+ARG cpuType
+RUN echo ${pkgFile} && echo ${dirName}
+
+COPY ${pkgFile} /root/
+ENV TINI_VERSION v0.19.0
+ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${cpuType} /tini
+ENV DEBIAN_FRONTEND=noninteractive
+WORKDIR /root/
+RUN tar -zxf ${pkgFile} && cd /root/${dirName}/ && /bin/bash install.sh -e no && cd /root && rm /root/${pkgFile} && rm -rf /root/${dirName} && apt-get update && apt-get install -y locales tzdata netcat && locale-gen en_US.UTF-8 && apt-get clean && rm -rf /var/lib/apt/lists/ && chmod +x /tini
+
+ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib" \
+ LC_CTYPE=en_US.UTF-8 \
+ LANG=en_US.UTF-8 \
+ LC_ALL=en_US.UTF-8
+COPY ./bin/* /usr/bin/
+
+ENTRYPOINT ["/tini", "--", "/usr/bin/entrypoint.sh"]
+CMD ["taosd"]
+VOLUME [ "/var/lib/taos", "/var/log/taos", "/corefile" ]
diff --git a/packaging/docker/bin/entrypoint.sh b/packaging/docker/bin/entrypoint.sh
index 5fb441004d8b454de1039eb3f4b23eb51f32be64..f4be349c0de0ea0df382fc6fee033120c5c48007 100644
--- a/packaging/docker/bin/entrypoint.sh
+++ b/packaging/docker/bin/entrypoint.sh
@@ -11,39 +11,22 @@ DISABLE_ADAPTER=${TAOS_DISABLE_ADAPTER:-0}
unset TAOS_DISABLE_ADAPTER
# to get mnodeEpSet from data dir
-DATA_DIR=${TAOS_DATA_DIR:-/var/lib/taos}
+DATA_DIR=$(taosd -C|grep -E 'dataDir.*(\S+)' -o |head -n1|sed 's/dataDir *//')
+DATA_DIR=${DATA_DIR:-/var/lib/taos}
-# append env to custom taos.cfg
-CFG_DIR=/tmp/taos
-CFG_FILE=$CFG_DIR/taos.cfg
-
-mkdir -p $CFG_DIR >/dev/null 2>&1
-
-[ -f /etc/taos/taos.cfg ] && cat /etc/taos/taos.cfg | grep -E -v "^#|^\s*$" >$CFG_FILE
-env-to-cfg >>$CFG_FILE
-
-FQDN=$(cat $CFG_FILE | grep -E -v "^#|^$" | grep fqdn | tail -n1 | sed -E 's/.*fqdn\s+//')
+FQDN=$(taosd -C|grep -E 'fqdn.*(\S+)' -o |head -n1|sed 's/fqdn *//')
# ensure the fqdn is resolved as localhost
grep "$FQDN" /etc/hosts >/dev/null || echo "127.0.0.1 $FQDN" >>/etc/hosts
-
+FIRSET_EP=$(taosd -C|grep -E 'firstEp.*(\S+)' -o |head -n1|sed 's/firstEp *//')
# parse first ep host and port
-FIRST_EP_HOST=${TAOS_FIRST_EP%:*}
-FIRST_EP_PORT=${TAOS_FIRST_EP#*:}
+FIRST_EP_HOST=${FIRSET_EP%:*}
+FIRST_EP_PORT=${FIRSET_EP#*:}
# in case of custom server port
-SERVER_PORT=$(cat $CFG_FILE | grep -E -v "^#|^$" | grep serverPort | tail -n1 | sed -E 's/.*serverPort\s+//')
+SERVER_PORT=$(taosd -C|grep -E 'serverPort.*(\S+)' -o |head -n1|sed 's/serverPort *//')
SERVER_PORT=${SERVER_PORT:-6030}
-# for other binaries like interpreters
-if echo $1 | grep -E "taosd$" - >/dev/null; then
- true # will run taosd
-else
- cp -f $CFG_FILE /etc/taos/taos.cfg || true
- $@
- exit $?
-fi
-
set +e
ulimit -c unlimited
# set core files pattern, maybe failed
@@ -62,22 +45,23 @@ fi
# if has mnode ep set or the host is first ep or not for cluster, just start.
if [ -f "$DATA_DIR/dnode/mnodeEpSet.json" ] ||
[ "$TAOS_FQDN" = "$FIRST_EP_HOST" ]; then
- $@ -c $CFG_DIR
+ $@
# others will first wait the first ep ready.
else
if [ "$TAOS_FIRST_EP" = "" ]; then
echo "run TDengine with single node."
- $@ -c $CFG_DIR
+ $@
exit $?
fi
while true; do
- es=0
- taos -h $FIRST_EP_HOST -P $FIRST_EP_PORT -n startup >/dev/null || es=$?
- if [ "$es" -eq 0 ]; then
+ es=$(taos -h $FIRST_EP_HOST -P $FIRST_EP_PORT --check)
+ echo ${es}
+ if [ "${es%%:*}" -eq 2 ]; then
+ echo "execute create dnode"
taos -h $FIRST_EP_HOST -P $FIRST_EP_PORT -s "create dnode \"$FQDN:$SERVER_PORT\";"
break
fi
sleep 1s
done
- $@ -c $CFG_DIR
+ $@
fi
diff --git a/packaging/docker/bin/taos-check b/packaging/docker/bin/taos-check
new file mode 100644
index 0000000000000000000000000000000000000000..5dc06b6018b93b627610b446ca6363773fd0fd72
--- /dev/null
+++ b/packaging/docker/bin/taos-check
@@ -0,0 +1,8 @@
+#!/bin/sh
+es=$(taos --check)
+code=${es%%:*}
+if [ "$code" -ne "0" ] && [ "$code" -ne "4" ]; then
+ exit 0
+fi
+echo $es
+exit 1
diff --git a/source/common/src/trow.c b/source/common/src/trow.c
index cc18240325ffa95aba75b4c7123d4d5749694035..c8a28d7f28f747b65fae3802bc392ac6163e5e1e 100644
--- a/source/common/src/trow.c
+++ b/source/common/src/trow.c
@@ -605,6 +605,10 @@ static int32_t tdAppendKvRowToDataCol(STSRow *pRow, STSchema *pSchema, SDataCols
* @param pCols
*/
int32_t tdAppendSTSRowToDataCol(STSRow *pRow, STSchema *pSchema, SDataCols *pCols, bool isMerge) {
+#ifdef TD_DEBUG_PRINT_TSDB_LOAD_DCOLS
+ printf("%s:%d ts: %" PRIi64 " sver:%d maxCols:%" PRIi16 " nCols:%" PRIi16 ", nRows:%d\n", __func__, __LINE__,
+ TD_ROW_KEY(pRow), TD_ROW_SVER(pRow), pCols->maxCols, pCols->numOfCols, pCols->numOfRows);
+#endif
if (TD_IS_TP_ROW(pRow)) {
return tdAppendTpRowToDataCol(pRow, pSchema, pCols, isMerge);
} else if (TD_IS_KV_ROW(pRow)) {
diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h
index 6b9014aad09ff57fa12ffc0e7c962594cf0d5feb..d1fd98137d09b1361bacf79d79706002d5db207d 100644
--- a/source/dnode/mnode/impl/inc/mndDef.h
+++ b/source/dnode/mnode/impl/inc/mndDef.h
@@ -418,7 +418,7 @@ typedef struct {
char* ast;
char* physicalPlan;
SSchemaWrapper schema;
- int32_t refConsumerCnt;
+ // int32_t refConsumerCnt;
} SMqTopicObj;
typedef struct {
diff --git a/source/dnode/mnode/impl/inc/mndScheduler.h b/source/dnode/mnode/impl/inc/mndScheduler.h
index 9f4e377dd17dffc94ab04366e2c1ba61e170b92f..05aea3f68c4023ceb68e16ad875f59c666f63171 100644
--- a/source/dnode/mnode/impl/inc/mndScheduler.h
+++ b/source/dnode/mnode/impl/inc/mndScheduler.h
@@ -30,7 +30,7 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib
int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream);
int32_t mndConvertRSmaTask(const char* ast, int64_t uid, int8_t triggerType, int64_t watermark, char** pStr,
- int32_t* pLen);
+ int32_t* pLen, double filesFactor);
#ifdef __cplusplus
}
diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c
index dcc807e07f920a43bcde2da884c52bc35c8d67de..470b7ac1bfe1230f216428836f6a92cb566cc368 100644
--- a/source/dnode/mnode/impl/src/mndConsumer.c
+++ b/source/dnode/mnode/impl/src/mndConsumer.c
@@ -414,6 +414,7 @@ static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
goto SUBSCRIBE_OVER;
}
+#if 0
// ref topic to prevent drop
// TODO make topic complete
SMqTopicObj topicObj = {0};
@@ -422,6 +423,7 @@ static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
mInfo("subscribe topic %s by consumer %ld cgroup %s, refcnt %d", pTopic->name, consumerId, cgroup,
topicObj.refConsumerCnt);
if (mndSetTopicCommitLogs(pMnode, pTrans, &topicObj) != 0) goto SUBSCRIBE_OVER;
+#endif
mndReleaseTopic(pMnode, pTopic);
}
diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c
index 61bd3a48a577e38e25bbf65a0fb514168bb4be0e..5d79708109fc6da808dbb686e9342caa312b11ea 100644
--- a/source/dnode/mnode/impl/src/mndDb.c
+++ b/source/dnode/mnode/impl/src/mndDb.c
@@ -1044,9 +1044,9 @@ static int32_t mndDropDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb) {
if (mndSetDropDbRedoLogs(pMnode, pTrans, pDb) != 0) goto _OVER;
if (mndSetDropDbCommitLogs(pMnode, pTrans, pDb) != 0) goto _OVER;
- /*if (mndDropOffsetByDB(pMnode, pTrans, pDb) != 0) goto _OVER;*/
- /*if (mndDropSubByDB(pMnode, pTrans, pDb) != 0) goto _OVER;*/
- /*if (mndDropTopicByDB(pMnode, pTrans, pDb) != 0) goto _OVER;*/
+ if (mndDropOffsetByDB(pMnode, pTrans, pDb) != 0) goto _OVER;
+ if (mndDropSubByDB(pMnode, pTrans, pDb) != 0) goto _OVER;
+ if (mndDropTopicByDB(pMnode, pTrans, pDb) != 0) goto _OVER;
if (mndSetDropDbRedoActions(pMnode, pTrans, pDb) != 0) goto _OVER;
SUserObj *pUser = mndAcquireUser(pMnode, pDb->createUser);
diff --git a/source/dnode/mnode/impl/src/mndOffset.c b/source/dnode/mnode/impl/src/mndOffset.c
index d22da4f76cb80dc1e541d5a6d29acff47c3ba3ed..8dfcbfbf3c9280ce3f7517534d51fc46dabc9b42 100644
--- a/source/dnode/mnode/impl/src/mndOffset.c
+++ b/source/dnode/mnode/impl/src/mndOffset.c
@@ -21,6 +21,7 @@
#include "mndMnode.h"
#include "mndShow.h"
#include "mndStb.h"
+#include "mndTopic.h"
#include "mndTrans.h"
#include "mndUser.h"
#include "mndVgroup.h"
@@ -188,7 +189,15 @@ static int32_t mndProcessCommitOffsetReq(SRpcMsg *pMsg) {
bool create = false;
SMqOffsetObj *pOffsetObj = mndAcquireOffset(pMnode, key);
if (pOffsetObj == NULL) {
+ SMqTopicObj *pTopic = mndAcquireTopic(pMnode, pOffset->topicName);
+ if (pTopic == NULL) {
+ terrno = TSDB_CODE_MND_TOPIC_NOT_EXIST;
+ mError("submit offset to topic %s failed since %s", pOffset->topicName, terrstr());
+ continue;
+ }
pOffsetObj = taosMemoryMalloc(sizeof(SMqOffsetObj));
+ pOffsetObj->dbUid = pTopic->dbUid;
+ mndReleaseTopic(pMnode, pTopic);
memcpy(pOffsetObj->key, key, TSDB_PARTITION_KEY_LEN);
create = true;
}
diff --git a/source/dnode/mnode/impl/src/mndScheduler.c b/source/dnode/mnode/impl/src/mndScheduler.c
index 58b51e4c548106a393b65ab3142064cd0c249481..eb8d2f0752574e8e161badde551107dc08a32487 100644
--- a/source/dnode/mnode/impl/src/mndScheduler.c
+++ b/source/dnode/mnode/impl/src/mndScheduler.c
@@ -36,7 +36,7 @@
extern bool tsStreamSchedV;
int32_t mndConvertRSmaTask(const char* ast, int64_t uid, int8_t triggerType, int64_t watermark, char** pStr,
- int32_t* pLen) {
+ int32_t* pLen, double filesFactor) {
SNode* pAst = NULL;
SQueryPlan* pPlan = NULL;
terrno = TSDB_CODE_SUCCESS;
@@ -58,6 +58,7 @@ int32_t mndConvertRSmaTask(const char* ast, int64_t uid, int8_t triggerType, int
.rSmaQuery = true,
.triggerType = triggerType,
.watermark = watermark,
+ .filesFactor = filesFactor,
};
if (qCreateQueryPlan(&cxt, &pPlan, NULL) < 0) {
terrno = TSDB_CODE_QRY_INVALID_INPUT;
@@ -286,7 +287,7 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
pStream->tasks = taosArrayInit(totLevel, sizeof(void*));
bool hasExtraSink = false;
- if (totLevel == 2) {
+ if (totLevel == 2 || strcmp(pStream->sourceDb, pStream->targetDb) != 0) {
SArray* taskOneLevel = taosArrayInit(0, sizeof(void*));
taosArrayPush(pStream->tasks, &taskOneLevel);
// add extra sink
@@ -407,7 +408,7 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
/*pTask->dispatchMsgType = TDMT_VND_TASK_WRITE_EXEC;*/
pTask->dispatchMsgType = TDMT_VND_TASK_DISPATCH;
- SDbObj* pDb = mndAcquireDb(pMnode, pStream->sourceDb);
+ SDbObj* pDb = mndAcquireDb(pMnode, pStream->targetDb);
ASSERT(pDb);
if (mndExtractDbInfo(pMnode, pDb, &pTask->shuffleDispatcher.dbInfo, NULL) < 0) {
sdbRelease(pSdb, pDb);
diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c
index 838265ef413f543947fd364af5c95d5105b8620f..9a8cabad92bc590f15db2f74d52d49cee84aad26 100644
--- a/source/dnode/mnode/impl/src/mndStb.c
+++ b/source/dnode/mnode/impl/src/mndStb.c
@@ -397,13 +397,13 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt
req.pRSmaParam.xFilesFactor = pStb->xFilesFactor;
req.pRSmaParam.delay = pStb->delay;
if (pStb->ast1Len > 0) {
- if (mndConvertRSmaTask(pStb->pAst1, pStb->uid, 0, 0, &req.pRSmaParam.qmsg1, &req.pRSmaParam.qmsg1Len) !=
+ if (mndConvertRSmaTask(pStb->pAst1, pStb->uid, 0, 0, &req.pRSmaParam.qmsg1, &req.pRSmaParam.qmsg1Len, req.pRSmaParam.xFilesFactor) !=
TSDB_CODE_SUCCESS) {
return NULL;
}
}
if (pStb->ast2Len > 0) {
- if (mndConvertRSmaTask(pStb->pAst2, pStb->uid, 0, 0, &req.pRSmaParam.qmsg2, &req.pRSmaParam.qmsg2Len) !=
+ if (mndConvertRSmaTask(pStb->pAst2, pStb->uid, 0, 0, &req.pRSmaParam.qmsg2, &req.pRSmaParam.qmsg2Len, req.pRSmaParam.xFilesFactor) !=
TSDB_CODE_SUCCESS) {
return NULL;
}
diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c
index 30ef2b5210aeb9a4b23c0c9e1b6e343157202f27..246d5dc951ec04e73d39a5e930f78a7c23f91657 100644
--- a/source/dnode/mnode/impl/src/mndStream.c
+++ b/source/dnode/mnode/impl/src/mndStream.c
@@ -393,6 +393,15 @@ static int32_t mndCreateStream(SMnode *pMnode, SRpcMsg *pReq, SCMCreateStreamReq
streamObj.trigger = pCreate->triggerType;
streamObj.waterMark = pCreate->watermark;
+ if (streamObj.targetSTbName[0]) {
+ pDb = mndAcquireDbByStb(pMnode, streamObj.targetSTbName);
+ if (pDb == NULL) {
+ terrno = TSDB_CODE_MND_DB_NOT_SELECTED;
+ return -1;
+ }
+ tstrncpy(streamObj.targetDb, pDb->name, TSDB_DB_FNAME_LEN);
+ }
+
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_GLOBAL, pReq);
if (pTrans == NULL) {
mError("stream:%s, failed to create since %s", pCreate->name, terrstr());
diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c
index 683301f5c6f2d23cc2c4fbbbc335b7e89cb1cf20..7f422e2919c5bccb28fc825d038e82f542ba7b7b 100644
--- a/source/dnode/mnode/impl/src/mndSubscribe.c
+++ b/source/dnode/mnode/impl/src/mndSubscribe.c
@@ -157,6 +157,7 @@ static int32_t mndPersistSubChangeVgReq(SMnode *pMnode, STrans *pTrans, const SM
int32_t vgId = pRebVg->pVgEp->vgId;
SVgObj *pVgObj = mndAcquireVgroup(pMnode, vgId);
if (pVgObj == NULL) {
+ ASSERT(0);
taosMemoryFree(buf);
return -1;
}
@@ -451,6 +452,7 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOu
taosArrayPush(pConsumerNew->rebNewTopics, &topic);
mndReleaseConsumer(pMnode, pConsumerOld);
if (mndSetConsumerCommitLogs(pMnode, pTrans, pConsumerNew) != 0) {
+ ASSERT(0);
goto REB_FAIL;
}
}
@@ -469,9 +471,11 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOu
taosArrayPush(pConsumerNew->rebRemovedTopics, &topic);
mndReleaseConsumer(pMnode, pConsumerOld);
if (mndSetConsumerCommitLogs(pMnode, pTrans, pConsumerNew) != 0) {
+ ASSERT(0);
goto REB_FAIL;
}
}
+#if 0
if (consumerNum) {
char topic[TSDB_TOPIC_FNAME_LEN];
char cgroup[TSDB_CGROUP_LEN];
@@ -486,9 +490,13 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOu
pTopic->refConsumerCnt = topicObj.refConsumerCnt;
mInfo("subscribe topic %s unref %d consumer cgroup %s, refcnt %d", pTopic->name, consumerNum, cgroup,
topicObj.refConsumerCnt);
- if (mndSetTopicCommitLogs(pMnode, pTrans, &topicObj) != 0) goto REB_FAIL;
+ if (mndSetTopicCommitLogs(pMnode, pTrans, &topicObj) != 0) {
+ ASSERT(0);
+ goto REB_FAIL;
+ }
}
}
+#endif
// 4. TODO commit log: modification log
@@ -496,7 +504,10 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOu
mndTransSetCb(pTrans, TRANS_START_FUNC_MQ_REB, TRANS_STOP_FUNC_MQ_REB, NULL, 0);
// 6. execution
- if (mndTransPrepare(pMnode, pTrans) != 0) goto REB_FAIL;
+ if (mndTransPrepare(pMnode, pTrans) != 0) {
+ ASSERT(0);
+ goto REB_FAIL;
+ }
mndTransDrop(pTrans);
return 0;
diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c
index e22d0daf5bac8ca0b26812a6d77687a86cbebf44..28f7ae260754d2ebc8b955995ce50dee56a00a13 100644
--- a/source/dnode/mnode/impl/src/mndTopic.c
+++ b/source/dnode/mnode/impl/src/mndTopic.c
@@ -15,6 +15,7 @@
#include "mndTopic.h"
#include "mndAuth.h"
+#include "mndConsumer.h"
#include "mndDb.h"
#include "mndDnode.h"
#include "mndMnode.h"
@@ -121,7 +122,7 @@ SSdbRaw *mndTopicActionEncode(SMqTopicObj *pTopic) {
SDB_SET_BINARY(pRaw, dataPos, swBuf, schemaLen, TOPIC_ENCODE_OVER);
}
- SDB_SET_INT32(pRaw, dataPos, pTopic->refConsumerCnt, TOPIC_ENCODE_OVER);
+ /*SDB_SET_INT32(pRaw, dataPos, pTopic->refConsumerCnt, TOPIC_ENCODE_OVER);*/
SDB_SET_RESERVE(pRaw, dataPos, MND_TOPIC_RESERVE_SIZE, TOPIC_ENCODE_OVER);
SDB_SET_DATALEN(pRaw, dataPos, TOPIC_ENCODE_OVER);
@@ -221,7 +222,7 @@ SSdbRow *mndTopicActionDecode(SSdbRaw *pRaw) {
pTopic->schema.pSchema = NULL;
}
- SDB_GET_INT32(pRaw, dataPos, &pTopic->refConsumerCnt, TOPIC_DECODE_OVER);
+ /*SDB_GET_INT32(pRaw, dataPos, &pTopic->refConsumerCnt, TOPIC_DECODE_OVER);*/
SDB_GET_RESERVE(pRaw, dataPos, MND_TOPIC_RESERVE_SIZE, TOPIC_DECODE_OVER);
@@ -253,7 +254,7 @@ static int32_t mndTopicActionUpdate(SSdb *pSdb, SMqTopicObj *pOldTopic, SMqTopic
atomic_exchange_64(&pOldTopic->updateTime, pNewTopic->updateTime);
atomic_exchange_32(&pOldTopic->version, pNewTopic->version);
- atomic_store_32(&pOldTopic->refConsumerCnt, pNewTopic->refConsumerCnt);
+ /*atomic_store_32(&pOldTopic->refConsumerCnt, pNewTopic->refConsumerCnt);*/
/*taosWLockLatch(&pOldTopic->lock);*/
@@ -327,7 +328,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *
topicObj.version = 1;
topicObj.sql = strdup(pCreate->sql);
topicObj.sqlLen = strlen(pCreate->sql) + 1;
- topicObj.refConsumerCnt = 0;
+ /*topicObj.refConsumerCnt = 0;*/
if (pCreate->ast && pCreate->ast[0]) {
topicObj.ast = strdup(pCreate->ast);
@@ -492,8 +493,8 @@ static int32_t mndDropTopic(SMnode *pMnode, STrans *pTrans, SRpcMsg *pReq, SMqTo
}
static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) {
- SMnode *pMnode = pReq->info.node;
- /*SSdb *pSdb = pMnode->pSdb;*/
+ SMnode *pMnode = pReq->info.node;
+ SSdb *pSdb = pMnode->pSdb;
SMDropTopicReq dropReq = {0};
if (tDeserializeSMDropTopicReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
@@ -513,12 +514,36 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) {
}
}
+ void *pIter = NULL;
+ SMqConsumerObj *pConsumer;
+ while (1) {
+ pIter = sdbFetch(pSdb, SDB_CONSUMER, pIter, (void **)&pConsumer);
+ if (pIter == NULL) break;
+
+ if (pConsumer->status == MQ_CONSUMER_STATUS__LOST_REBD) continue;
+ int32_t sz = taosArrayGetSize(pConsumer->assignedTopics);
+ for (int32_t i = 0; i < sz; i++) {
+ char *name = taosArrayGetP(pConsumer->assignedTopics, i);
+ if (strcmp(name, pTopic->name) == 0) {
+ mndReleaseConsumer(pMnode, pConsumer);
+ mndReleaseTopic(pMnode, pTopic);
+ terrno = TSDB_CODE_MND_TOPIC_SUBSCRIBED;
+ mError("topic:%s, failed to drop since subscribed by consumer %ld from cgroup %s", dropReq.name,
+ pConsumer->consumerId, pConsumer->cgroup);
+ return -1;
+ }
+ }
+ sdbRelease(pSdb, pConsumer);
+ }
+
+#if 0
if (pTopic->refConsumerCnt != 0) {
mndReleaseTopic(pMnode, pTopic);
terrno = TSDB_CODE_MND_TOPIC_SUBSCRIBED;
mError("topic:%s, failed to drop since %s", dropReq.name, terrstr());
return -1;
}
+#endif
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_GLOBAL, pReq);
if (pTrans == NULL) {
diff --git a/source/dnode/mnode/impl/test/db/CMakeLists.txt b/source/dnode/mnode/impl/test/db/CMakeLists.txt
index 3f6a80835ffa7b2a0a6fcdcff21e1cfd39a02c5f..e28cdd4f61824c04f62513868a9010113140fd31 100644
--- a/source/dnode/mnode/impl/test/db/CMakeLists.txt
+++ b/source/dnode/mnode/impl/test/db/CMakeLists.txt
@@ -5,7 +5,9 @@ target_link_libraries(
PUBLIC sut
)
-add_test(
- NAME dbTest
- COMMAND dbTest
-)
+if(NOT TD_WINDOWS)
+ add_test(
+ NAME dbTest
+ COMMAND dbTest
+ )
+endif(NOT TD_WINDOWS)
diff --git a/source/dnode/mnode/impl/test/sma/CMakeLists.txt b/source/dnode/mnode/impl/test/sma/CMakeLists.txt
index 3f9ec123a80e88371a98fa54c99342726831372d..fd596c5021674bb9d4ec185924129b0fd3bbade8 100644
--- a/source/dnode/mnode/impl/test/sma/CMakeLists.txt
+++ b/source/dnode/mnode/impl/test/sma/CMakeLists.txt
@@ -5,7 +5,9 @@ target_link_libraries(
PUBLIC sut
)
-add_test(
- NAME smaTest
- COMMAND smaTest
-)
+if(NOT TD_WINDOWS)
+ add_test(
+ NAME smaTest
+ COMMAND smaTest
+ )
+endif(NOT TD_WINDOWS)
diff --git a/source/dnode/mnode/impl/test/stb/CMakeLists.txt b/source/dnode/mnode/impl/test/stb/CMakeLists.txt
index d2fe3879979f4f52a215a3d44e25e912be3abb90..857c404c1c299767685fa1572a7f5a0b6463c939 100644
--- a/source/dnode/mnode/impl/test/stb/CMakeLists.txt
+++ b/source/dnode/mnode/impl/test/stb/CMakeLists.txt
@@ -5,7 +5,9 @@ target_link_libraries(
PUBLIC sut
)
-add_test(
- NAME stbTest
- COMMAND stbTest
-)
+if(NOT TD_WINDOWS)
+ add_test(
+ NAME stbTest
+ COMMAND stbTest
+ )
+endif(NOT TD_WINDOWS)
\ No newline at end of file
diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h
index 6d3d23cc208092d779c0067348de8279db337f75..2e4ff6a4abd8315afa06e9a881955947af9144c6 100644
--- a/source/dnode/vnode/src/inc/tsdb.h
+++ b/source/dnode/vnode/src/inc/tsdb.h
@@ -79,13 +79,14 @@ struct STsdb {
struct STable {
uint64_t tid;
uint64_t uid;
- STSchema *pSchema;
+ STSchema *pSchema; // latest schema
+ STSchema *pCacheSchema; // cached cache
};
#define TABLE_TID(t) (t)->tid
#define TABLE_UID(t) (t)->uid
-int tsdbPrepareCommit(STsdb *pTsdb);
+int tsdbPrepareCommit(STsdb *pTsdb);
typedef enum {
TSDB_FILE_HEAD = 0, // .head
TSDB_FILE_DATA, // .data
@@ -181,13 +182,15 @@ int tsdbUnlockRepo(STsdb *pTsdb);
static FORCE_INLINE STSchema *tsdbGetTableSchemaImpl(STsdb *pTsdb, STable *pTable, bool lock, bool copy,
int32_t version) {
-
- if ((version != -1) && (schemaVersion(pTable->pSchema) != version)) {
- taosMemoryFreeClear(pTable->pSchema);
- pTable->pSchema = metaGetTbTSchema(REPO_META(pTsdb), pTable->uid, version);
+ if ((version < 0) || (schemaVersion(pTable->pSchema) == version)) {
+ return pTable->pSchema;
}
- return pTable->pSchema;
+ if (!pTable->pCacheSchema || (schemaVersion(pTable->pCacheSchema) != version)) {
+ taosMemoryFreeClear(pTable->pCacheSchema);
+ pTable->pCacheSchema = metaGetTbTSchema(REPO_META(pTsdb), pTable->uid, version);
+ }
+ return pTable->pCacheSchema;
}
// tsdbMemTable.h
diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h
index 0e67d9e426f1b708e927d986f7c9d797acc8759d..e3a0c94ccc8d210a04a60ded6dd8bbd79d203767 100644
--- a/source/dnode/vnode/src/inc/vnodeInt.h
+++ b/source/dnode/vnode/src/inc/vnodeInt.h
@@ -149,7 +149,7 @@ int32_t tdUpdateExpireWindow(SSma* pSma, SSubmitReq* pMsg, int64_t version);
int32_t tdProcessTSmaCreate(SSma* pSma, int64_t version, const char* msg);
int32_t tdProcessTSmaInsert(SSma* pSma, int64_t indexUid, const char* msg);
-int32_t tdProcessRSmaCreate(SSma* pSma, SMeta* pMeta, SVCreateStbReq* pReq, SMsgCb* pMsgCb);
+int32_t tdProcessRSmaCreate(SVnode *pVnode, SVCreateStbReq* pReq);
int32_t tdProcessRSmaSubmit(SSma* pSma, void* pMsg, int32_t inputType);
int32_t tdFetchTbUidList(SSma* pSma, STbUidStore** ppStore, tb_uid_t suid, tb_uid_t uid);
int32_t tdUpdateTbUidList(SSma* pSma, STbUidStore* pUidStore);
diff --git a/source/dnode/vnode/src/meta/metaQuery.c b/source/dnode/vnode/src/meta/metaQuery.c
index 605e8049331839816b6d072388c088f581a8ffb5..921c8a90a83dbd594cf6c2b0666b3bc87a9022f6 100644
--- a/source/dnode/vnode/src/meta/metaQuery.c
+++ b/source/dnode/vnode/src/meta/metaQuery.c
@@ -178,6 +178,7 @@ SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, boo
if (me.type == TSDB_SUPER_TABLE) {
pSchema = tCloneSSchemaWrapper(&me.stbEntry.schemaRow);
} else if (me.type == TSDB_NORMAL_TABLE) {
+ pSchema = tCloneSSchemaWrapper(&me.ntbEntry.schemaRow);
} else {
ASSERT(0);
}
@@ -299,7 +300,7 @@ STSchema *metaGetTbTSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver) {
pSW = metaGetTableSchema(pMeta, quid, sver, 0);
if (!pSW) return NULL;
- tdInitTSchemaBuilder(&sb, sver);
+ tdInitTSchemaBuilder(&sb, pSW->version);
for (int i = 0; i < pSW->nCols; i++) {
pSchema = pSW->pSchema + i;
tdAddColToSchema(&sb, pSchema->type, pSchema->flags, pSchema->colId, pSchema->bytes);
diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c
index 731ef2e36061494ec2440cda9f4818edbc0291cd..a1e397f11d8454b1f0a61afcfde2eeac65c361ea 100644
--- a/source/dnode/vnode/src/sma/smaRollup.c
+++ b/source/dnode/vnode/src/sma/smaRollup.c
@@ -165,7 +165,10 @@ int32_t tdFetchTbUidList(SSma *pSma, STbUidStore **ppStore, tb_uid_t suid, tb_ui
* @param pReq
* @return int32_t
*/
-int32_t tdProcessRSmaCreate(SSma *pSma, SMeta *pMeta, SVCreateStbReq *pReq, SMsgCb *pMsgCb) {
+int32_t tdProcessRSmaCreate(SVnode *pVnode, SVCreateStbReq *pReq) {
+ SSma *pSma = pVnode->pSma;
+ SMeta *pMeta = pVnode->pMeta;
+ SMsgCb *pMsgCb = &pVnode->msgCb;
if (!pReq->rollup) {
smaTrace("vgId:%d return directly since no rollup for stable %s %" PRIi64, SMA_VID(pSma), pReq->name, pReq->suid);
return TSDB_CODE_SUCCESS;
@@ -210,6 +213,7 @@ int32_t tdProcessRSmaCreate(SSma *pSma, SMeta *pMeta, SVCreateStbReq *pReq, SMsg
.reader = pReadHandle,
.meta = pMeta,
.pMsgCb = pMsgCb,
+ .vnode = pVnode,
};
if (param->qmsg1) {
@@ -441,7 +445,7 @@ static int32_t tdExecuteRSma(SSma *pSma, const void *pMsg, int32_t inputType, tb
if (inputType == STREAM_DATA_TYPE_SUBMIT_BLOCK) {
// TODO: use the proper schema instead of 0, and cache STSchema in cache
- STSchema *pTSchema = metaGetTbTSchema(SMA_META(pSma), suid, 1);
+ STSchema *pTSchema = metaGetTbTSchema(SMA_META(pSma), suid, -1);
if (!pTSchema) {
terrno = TSDB_CODE_TDB_IVD_TB_SCHEMA_VERSION;
return TSDB_CODE_FAILED;
diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c
index d462b7e046c0ace1f869ab5e0d0788ab43b9a915..88d8ee9f9250f0139c19f3f9e2b0f8a553dc0520 100644
--- a/source/dnode/vnode/src/tsdb/tsdbCommit.c
+++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c
@@ -84,8 +84,8 @@ static int tsdbMergeBlockData(SCommitH *pCommith, SCommitIter *pIter, SDataCols
static void tsdbResetCommitTable(SCommitH *pCommith);
static void tsdbCloseCommitFile(SCommitH *pCommith, bool hasError);
static bool tsdbCanAddSubBlock(SCommitH *pCommith, SBlock *pBlock, SMergeInfo *pInfo);
-static void tsdbLoadAndMergeFromCache(STsdb *pTsdb, SDataCols *pDataCols, int *iter, SCommitIter *pCommitIter, SDataCols *pTarget,
- TSKEY maxKey, int maxRows, int8_t update);
+static void tsdbLoadAndMergeFromCache(STsdb *pTsdb, SDataCols *pDataCols, int *iter, SCommitIter *pCommitIter,
+ SDataCols *pTarget, TSKEY maxKey, int maxRows, int8_t update);
int tsdbWriteBlockIdx(SDFile *pHeadf, SArray *pIdxA, void **ppBuf);
int tsdbApplyRtnOnFSet(STsdb *pRepo, SDFileSet *pSet, SRtn *pRtn) {
@@ -466,7 +466,7 @@ static int tsdbCreateCommitIters(SCommitH *pCommith) {
pTbData = (STbData *)pNode->pData;
pCommitIter = pCommith->iters + i;
- pTSchema = metaGetTbTSchema(REPO_META(pRepo), pTbData->uid, 1); // TODO: schema version
+ pTSchema = metaGetTbTSchema(REPO_META(pRepo), pTbData->uid, -1);
if (pTSchema) {
pCommitIter->pIter = tSkipListCreateIter(pTbData->pData);
@@ -475,7 +475,8 @@ static int tsdbCreateCommitIters(SCommitH *pCommith) {
pCommitIter->pTable = (STable *)taosMemoryMalloc(sizeof(STable));
pCommitIter->pTable->uid = pTbData->uid;
pCommitIter->pTable->tid = pTbData->uid;
- pCommitIter->pTable->pSchema = pTSchema; // metaGetTbTSchema(REPO_META(pRepo), pTbData->uid, 0);
+ pCommitIter->pTable->pSchema = pTSchema;
+ pCommitIter->pTable->pCacheSchema = NULL;
}
}
tSkipListDestroyIter(pSlIter);
@@ -490,6 +491,7 @@ static void tsdbDestroyCommitIters(SCommitH *pCommith) {
tSkipListDestroyIter(pCommith->iters[i].pIter);
if (pCommith->iters[i].pTable) {
tdFreeSchema(pCommith->iters[i].pTable->pSchema);
+ tdFreeSchema(pCommith->iters[i].pTable->pCacheSchema);
taosMemoryFreeClear(pCommith->iters[i].pTable);
}
}
@@ -914,7 +916,7 @@ static int tsdbMoveBlkIdx(SCommitH *pCommith, SBlockIdx *pIdx) {
while (bidx < nBlocks) {
if (!pTSchema && !tsdbCommitIsSameFile(pCommith, bidx)) {
// Set commit table
- pTSchema = metaGetTbTSchema(REPO_META(pTsdb), pIdx->uid, 1); // TODO: schema version
+ pTSchema = metaGetTbTSchema(REPO_META(pTsdb), pIdx->uid, -1); // TODO: schema version
if (!pTSchema) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1;
@@ -948,7 +950,7 @@ static int tsdbMoveBlkIdx(SCommitH *pCommith, SBlockIdx *pIdx) {
}
static int tsdbSetCommitTable(SCommitH *pCommith, STable *pTable) {
- STSchema *pSchema = tsdbGetTableSchemaImpl(TSDB_COMMIT_REPO(pCommith),pTable, false, false, -1);
+ STSchema *pSchema = tsdbGetTableSchemaImpl(TSDB_COMMIT_REPO(pCommith), pTable, false, false, -1);
pCommith->pTable = pTable;
@@ -1422,8 +1424,8 @@ static int tsdbMergeBlockData(SCommitH *pCommith, SCommitIter *pIter, SDataCols
int biter = 0;
while (true) {
- tsdbLoadAndMergeFromCache(TSDB_COMMIT_REPO(pCommith), pCommith->readh.pDCols[0], &biter, pIter, pCommith->pDataCols, keyLimit, defaultRows,
- pCfg->update);
+ tsdbLoadAndMergeFromCache(TSDB_COMMIT_REPO(pCommith), pCommith->readh.pDCols[0], &biter, pIter, pCommith->pDataCols,
+ keyLimit, defaultRows, pCfg->update);
if (pCommith->pDataCols->numOfRows == 0) break;
@@ -1447,8 +1449,8 @@ static int tsdbMergeBlockData(SCommitH *pCommith, SCommitIter *pIter, SDataCols
return 0;
}
-static void tsdbLoadAndMergeFromCache(STsdb *pTsdb, SDataCols *pDataCols, int *iter, SCommitIter *pCommitIter, SDataCols *pTarget,
- TSKEY maxKey, int maxRows, int8_t update) {
+static void tsdbLoadAndMergeFromCache(STsdb *pTsdb, SDataCols *pDataCols, int *iter, SCommitIter *pCommitIter,
+ SDataCols *pTarget, TSKEY maxKey, int maxRows, int8_t update) {
TSKEY key1 = INT64_MAX;
TSKEY key2 = INT64_MAX;
TSKEY lastKey = TSKEY_INITIAL_VAL;
diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c
index fbfa70c1176a163ef3a3995ab48fe6010762dc77..62125b6dc7a5dadcbe534c4dab64b07e9964c3f2 100644
--- a/source/dnode/vnode/src/tsdb/tsdbRead.c
+++ b/source/dnode/vnode/src/tsdb/tsdbRead.c
@@ -1395,7 +1395,7 @@ static int32_t handleDataMergeIfNeeded(STsdbReadHandle* pTsdbReadHandle, SBlock*
}
if (pTsdbReadHandle->outputCapacity >= binfo.rows) {
- ASSERT(cur->blockCompleted);
+ ASSERT(cur->blockCompleted || cur->mixBlock);
}
if (cur->rows == binfo.rows) {
diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c
index 74b6982008da95f55448b699e5896b86fefeb1b1..4b237bc7031ac39220e2a9464cf874222af9a79c 100644
--- a/source/dnode/vnode/src/vnd/vnodeSvr.c
+++ b/source/dnode/vnode/src/vnd/vnodeSvr.c
@@ -360,7 +360,7 @@ static int vnodeProcessCreateStbReq(SVnode *pVnode, int64_t version, void *pReq,
goto _err;
}
- tdProcessRSmaCreate(pVnode->pSma, pVnode->pMeta, &req, &pVnode->msgCb);
+ tdProcessRSmaCreate(pVnode, &req);
tDecoderClear(&coder);
return 0;
diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h
index 88f4bdbd3db6aef21f8df64744128a9e89743466..8139e71f63dfa2a58be128fbc2ced05ab81466df 100644
--- a/source/libs/executor/inc/executorimpl.h
+++ b/source/libs/executor/inc/executorimpl.h
@@ -160,7 +160,7 @@ struct SOperatorInfo;
//struct SOptrBasicInfo;
typedef int32_t (*__optr_encode_fn_t)(struct SOperatorInfo* pOperator, char** result, int32_t* length);
-typedef int32_t (*__optr_decode_fn_t)(struct SOperatorInfo* pOperator, char* result, int32_t length);
+typedef int32_t (*__optr_decode_fn_t)(struct SOperatorInfo* pOperator, char* result);
typedef int32_t (*__optr_open_fn_t)(struct SOperatorInfo* pOptr);
typedef SSDataBlock* (*__optr_fn_t)(struct SOperatorInfo* pOptr);
@@ -440,6 +440,7 @@ typedef struct STimeWindowSupp {
int64_t waterMark;
TSKEY maxTs;
SColumnInfoData timeWindowData; // query time window info for scalar function execution.
+ SHashObj *winMap;
} STimeWindowAggSupp;
typedef struct SIntervalAggOperatorInfo {
@@ -758,7 +759,7 @@ SOperatorInfo* createDataBlockInfoScanOperator(void* dataReader, SExecTaskInfo*
SOperatorInfo* createStreamScanOperatorInfo(void* pDataReader, SReadHandle* pHandle,
SArray* pTableIdList, STableScanPhysiNode* pTableScanNode, SExecTaskInfo* pTaskInfo,
- STimeWindowAggSupp* pTwSup, int16_t tsColId);
+ STimeWindowAggSupp* pTwSup);
SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExpr, int32_t numOfCols,
@@ -821,7 +822,7 @@ int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SRead
int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SExplainExecInfo** pRes, int32_t* capacity,
int32_t* resNum);
-int32_t aggDecodeResultRow(SOperatorInfo* pOperator, char* result, int32_t length);
+int32_t aggDecodeResultRow(SOperatorInfo* pOperator, char* result);
int32_t aggEncodeResultRow(SOperatorInfo* pOperator, char** result, int32_t* length);
STimeWindow getActiveTimeWindow(SDiskbasedBuf* pBuf, SResultRowInfo* pResultRowInfo, int64_t ts,
@@ -837,6 +838,8 @@ SResultWindowInfo* getSessionTimeWindow(SArray* pWinInfos, TSKEY ts, int64_t gap
int32_t updateSessionWindowInfo(SResultWindowInfo* pWinInfo, TSKEY* pTs, int32_t rows,
int32_t start, int64_t gap, SHashObj* pStDeleted);
bool functionNeedToExecute(SqlFunctionCtx* pCtx);
+int64_t getSmaWaterMark(int64_t interval, double filesFactor);
+bool isSmaStream(int8_t triggerType);
int32_t compareTimeWindow(const void* p1, const void* p2, const void* param);
#ifdef __cplusplus
diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c
index ce46573830e8b1a25a1893191710166e78a6a89d..7786ae009aa601c258ba65315fb21b5961bba56f 100644
--- a/source/libs/executor/src/executorimpl.c
+++ b/source/libs/executor/src/executorimpl.c
@@ -2767,7 +2767,7 @@ static SSDataBlock* concurrentlyLoadRemoteDataImpl(SOperatorInfo* pOperator, SEx
code = setSDataBlockFromFetchRsp(pExchangeInfo->pResult, pLoadInfo, pTableRsp->numOfRows, pTableRsp->data,
pTableRsp->compLen, pTableRsp->numOfCols, startTs, &pDataInfo->totalRows, NULL);
if (code != 0) {
- taosMemoryFreeClear(pDataInfo->pRsp);
+ taosMemoryFreeClear(pDataInfo->pRsp);
goto _error;
}
@@ -2788,7 +2788,7 @@ static SSDataBlock* concurrentlyLoadRemoteDataImpl(SOperatorInfo* pOperator, SEx
pDataInfo->status = EX_SOURCE_DATA_NOT_READY;
code = doSendFetchDataRequest(pExchangeInfo, pTaskInfo, i);
if (code != TSDB_CODE_SUCCESS) {
- taosMemoryFreeClear(pDataInfo->pRsp);
+ taosMemoryFreeClear(pDataInfo->pRsp);
goto _error;
}
}
@@ -2895,7 +2895,7 @@ static SSDataBlock* seqLoadRemoteData(SOperatorInfo* pOperator) {
pDataInfo->totalRows, pLoadInfo->totalRows);
pDataInfo->status = EX_SOURCE_DATA_EXHAUSTED;
- pExchangeInfo->current += 1;
+ pExchangeInfo->current += 1;
taosMemoryFreeClear(pDataInfo->pRsp);
continue;
}
@@ -2922,7 +2922,7 @@ static SSDataBlock* seqLoadRemoteData(SOperatorInfo* pOperator) {
}
pOperator->resultInfo.totalRows += pRes->info.rows;
- taosMemoryFreeClear(pDataInfo->pRsp);
+ taosMemoryFreeClear(pDataInfo->pRsp);
return pExchangeInfo->pResult;
}
}
@@ -3384,7 +3384,7 @@ int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scan
// todo add more information about exchange operation
int32_t type = pOperator->operatorType;
if (type == QUERY_NODE_PHYSICAL_PLAN_EXCHANGE || type == QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN ||
- type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
+ type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN || type == QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN) {
*order = TSDB_ORDER_ASC;
*scanFlag = MAIN_SCAN;
return TSDB_CODE_SUCCESS;
@@ -3448,14 +3448,14 @@ static int32_t doOpenAggregateOptr(SOperatorInfo* pOperator) {
}
#if 0 // test for encode/decode result info
- if(pOperator->encodeResultRow){
+ if(pOperator->fpSet.encodeResultRow){
char *result = NULL;
int32_t length = 0;
- SAggSupporter *pSup = &pAggInfo->aggSup;
- pOperator->encodeResultRow(pOperator, pSup, pInfo, &result, &length);
+ pOperator->fpSet.encodeResultRow(pOperator, &result, &length);
+ SAggSupporter* pSup = &pAggInfo->aggSup;
taosHashClear(pSup->pResultRowHashTable);
pInfo->resultRowInfo.size = 0;
- pOperator->decodeResultRow(pOperator, pSup, pInfo, result, length);
+ pOperator->fpSet.decodeResultRow(pOperator, result);
if(result){
taosMemoryFree(result);
}
@@ -3499,14 +3499,15 @@ static SSDataBlock* getAggregateResult(SOperatorInfo* pOperator) {
}
int32_t aggEncodeResultRow(SOperatorInfo* pOperator, char** result, int32_t* length) {
- if(result == NULL || length == NULL){
+ if (result == NULL || length == NULL) {
return TSDB_CODE_TSC_INVALID_INPUT;
}
SOptrBasicInfo* pInfo = (SOptrBasicInfo*)(pOperator->info);
- SAggSupporter* pSup = (SAggSupporter*)POINTER_SHIFT(pOperator->info, sizeof(SOptrBasicInfo));
- int32_t size = taosHashGetSize(pSup->pResultRowHashTable);
- size_t keyLen = sizeof(uint64_t) * 2; // estimate the key length
- int32_t totalSize = sizeof(int32_t) + sizeof(int32_t) + size * (sizeof(int32_t) + keyLen + sizeof(int32_t) + pSup->resultRowSize);
+ SAggSupporter* pSup = (SAggSupporter*)POINTER_SHIFT(pOperator->info, sizeof(SOptrBasicInfo));
+ int32_t size = taosHashGetSize(pSup->pResultRowHashTable);
+ size_t keyLen = sizeof(uint64_t) * 2; // estimate the key length
+ int32_t totalSize =
+ sizeof(int32_t) + sizeof(int32_t) + size * (sizeof(int32_t) + keyLen + sizeof(int32_t) + pSup->resultRowSize);
*result = (char*)taosMemoryCalloc(1, totalSize);
if (*result == NULL) {
@@ -3567,17 +3568,20 @@ int32_t aggEncodeResultRow(SOperatorInfo* pOperator, char** result, int32_t* len
return TDB_CODE_SUCCESS;
}
-int32_t aggDecodeResultRow(SOperatorInfo* pOperator, char* result, int32_t length) {
- if(result == NULL || length <= 0){
+int32_t aggDecodeResultRow(SOperatorInfo* pOperator, char* result) {
+ if (result == NULL) {
return TSDB_CODE_TSC_INVALID_INPUT;
}
SOptrBasicInfo* pInfo = (SOptrBasicInfo*)(pOperator->info);
- SAggSupporter* pSup = (SAggSupporter*)POINTER_SHIFT(pOperator->info, sizeof(SOptrBasicInfo));
+ SAggSupporter* pSup = (SAggSupporter*)POINTER_SHIFT(pOperator->info, sizeof(SOptrBasicInfo));
// int32_t size = taosHashGetSize(pSup->pResultRowHashTable);
- int32_t count = *(int32_t*)(result);
-
+ int32_t length = *(int32_t*)(result);
int32_t offset = sizeof(int32_t);
+
+ int32_t count = *(int32_t*)(result + offset);
+ offset += sizeof(int32_t);
+
while (count-- > 0 && length > offset) {
int32_t keyLen = *(int32_t*)(result + offset);
offset += sizeof(int32_t);
@@ -4509,8 +4513,8 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
} else if (QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN == type) {
SScanPhysiNode* pScanPhyNode = (SScanPhysiNode*)pPhyNode; // simple child table.
STableScanPhysiNode* pTableScanNode = (STableScanPhysiNode*)pPhyNode;
- STimeWindowAggSupp twSup = {.waterMark = pTableScanNode->watermark,
- .calTrigger = pTableScanNode->triggerType, .maxTs = INT64_MIN};
+ STimeWindowAggSupp twSup = {
+ .waterMark = pTableScanNode->watermark, .calTrigger = pTableScanNode->triggerType, .maxTs = INT64_MIN};
tsdbReaderT pDataReader = NULL;
if (pHandle->vnode) {
pDataReader = doCreateDataReader(pTableScanNode, pHandle, pTableListInfo, (uint64_t)queryId, taskId, pTagCond);
@@ -4524,9 +4528,9 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
} else {
qDebug("%s pDataReader is not NULL", GET_TASKID(pTaskInfo));
}
- SArray* tableIdList = extractTableIdList(pTableListInfo);
+ SArray* tableIdList = extractTableIdList(pTableListInfo);
SOperatorInfo* pOperator = createStreamScanOperatorInfo(pDataReader, pHandle,
- tableIdList, pTableScanNode, pTaskInfo, &twSup, pTableScanNode->tsColId);
+ tableIdList, pTableScanNode, pTaskInfo, &twSup);
taosArrayDestroy(tableIdList);
return pOperator;
@@ -4627,7 +4631,19 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
STimeWindowAggSupp as = {.waterMark = pIntervalPhyNode->window.watermark,
.calTrigger = pIntervalPhyNode->window.triggerType,
- .maxTs = INT64_MIN};
+ .maxTs = INT64_MIN,
+ .winMap = NULL,};
+ if (isSmaStream(pIntervalPhyNode->window.triggerType)) {
+ if (FLT_LESS(pIntervalPhyNode->window.filesFactor, 1.000000)) {
+ as.calTrigger = STREAM_TRIGGER_AT_ONCE_SMA;
+ } else {
+ _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_TIMESTAMP);
+ as.winMap = taosHashInit(64, hashFn, true, HASH_NO_LOCK);
+ as.waterMark = getSmaWaterMark(interval.interval,
+ pIntervalPhyNode->window.filesFactor);
+ as.calTrigger = STREAM_TRIGGER_WINDOW_CLOSE_SMA;
+ }
+ }
int32_t tsSlotId = ((SColumnNode*)pIntervalPhyNode->window.pTspk)->slotId;
pOptr = createIntervalOperatorInfo(ops[0], pExprInfo, num, pResBlock, &interval, tsSlotId, &as, pTaskInfo);
@@ -4993,25 +5009,25 @@ _error:
return NULL;
}
-int32_t encodeOperator(SOperatorInfo* ops, char** result, int32_t *length){
+int32_t encodeOperator(SOperatorInfo* ops, char** result, int32_t* length) {
int32_t code = TDB_CODE_SUCCESS;
- char *pCurrent = NULL;
+ char* pCurrent = NULL;
int32_t currLength = 0;
- if(ops->fpSet.encodeResultRow){
- if(result == NULL || length == NULL){
+ if (ops->fpSet.encodeResultRow) {
+ if (result == NULL || length == NULL) {
return TSDB_CODE_TSC_INVALID_INPUT;
}
code = ops->fpSet.encodeResultRow(ops, &pCurrent, &currLength);
- if(code != TDB_CODE_SUCCESS){
- if(*result != NULL){
+ if (code != TDB_CODE_SUCCESS) {
+ if (*result != NULL) {
taosMemoryFree(*result);
*result = NULL;
}
return code;
}
- if(*result == NULL){
+ if (*result == NULL) {
*result = (char*)taosMemoryCalloc(1, currLength + sizeof(int32_t));
if (*result == NULL) {
taosMemoryFree(pCurrent);
@@ -5019,9 +5035,9 @@ int32_t encodeOperator(SOperatorInfo* ops, char** result, int32_t *length){
}
memcpy(*result + sizeof(int32_t), pCurrent, currLength);
*(int32_t*)(*result) = currLength + sizeof(int32_t);
- }else{
+ } else {
int32_t sizePre = *(int32_t*)(*result);
- char* tmp = (char*)taosMemoryRealloc(*result, sizePre + currLength);
+ char* tmp = (char*)taosMemoryRealloc(*result, sizePre + currLength);
if (tmp == NULL) {
taosMemoryFree(pCurrent);
taosMemoryFree(*result);
@@ -5038,31 +5054,33 @@ int32_t encodeOperator(SOperatorInfo* ops, char** result, int32_t *length){
for (int32_t i = 0; i < ops->numOfDownstream; ++i) {
code = encodeOperator(ops->pDownstream[i], result, length);
- if(code != TDB_CODE_SUCCESS){
+ if (code != TDB_CODE_SUCCESS) {
return code;
}
}
return TDB_CODE_SUCCESS;
}
-int32_t decodeOperator(SOperatorInfo* ops, char* result, int32_t length){
+int32_t decodeOperator(SOperatorInfo* ops, char* result, int32_t length) {
int32_t code = TDB_CODE_SUCCESS;
- if(ops->fpSet.decodeResultRow){
- if(result == NULL || length <= 0){
+ if (ops->fpSet.decodeResultRow) {
+ if (result == NULL) {
return TSDB_CODE_TSC_INVALID_INPUT;
}
- char* data = result + 2 * sizeof(int32_t);
- int32_t dataLength = *(int32_t*)(result + sizeof(int32_t));
- code = ops->fpSet.decodeResultRow(ops, data, dataLength - sizeof(int32_t));
- if(code != TDB_CODE_SUCCESS){
+ ASSERT(length == *(int32_t*)result);
+ char* data = result + sizeof(int32_t);
+ code = ops->fpSet.decodeResultRow(ops, data);
+ if (code != TDB_CODE_SUCCESS) {
return code;
}
int32_t totalLength = *(int32_t*)result;
- if(totalLength == dataLength + sizeof(int32_t)) { // the last data
+ int32_t dataLength = *(int32_t*)data;
+
+ if (totalLength == dataLength + sizeof(int32_t)) { // the last data
result = NULL;
length = 0;
- }else{
+ } else {
result += dataLength;
*(int32_t*)(result) = totalLength - dataLength;
length = totalLength - dataLength;
@@ -5071,7 +5089,7 @@ int32_t decodeOperator(SOperatorInfo* ops, char* result, int32_t length){
for (int32_t i = 0; i < ops->numOfDownstream; ++i) {
code = decodeOperator(ops->pDownstream[i], result, length);
- if(code != TDB_CODE_SUCCESS){
+ if (code != TDB_CODE_SUCCESS) {
return code;
}
}
@@ -5294,3 +5312,18 @@ int32_t initStreamAggSupporter(SStreamAggSupporter* pSup, const char* pKey) {
}
return createDiskbasedBuf(&pSup->pResultBuf, pageSize, bufSize, pKey, TD_TMP_DIR_PATH);
}
+
+int64_t getSmaWaterMark(int64_t interval, double filesFactor) {
+ int64_t waterMark = 0;
+ ASSERT(FLT_GREATEREQUAL(filesFactor,0.000000));
+ waterMark = -1 * filesFactor;
+ return waterMark;
+}
+
+bool isSmaStream(int8_t triggerType) {
+ if (triggerType == STREAM_TRIGGER_AT_ONCE ||
+ triggerType == STREAM_TRIGGER_WINDOW_CLOSE) {
+ return false;
+ }
+ return true;
+}
diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c
index ef770e8afc2b5f657187682cc9adf33235dedf48..d388b802f3ae22c7c0cf135c9eb70111be1d79a4 100644
--- a/source/libs/executor/src/groupoperator.c
+++ b/source/libs/executor/src/groupoperator.c
@@ -318,7 +318,20 @@ static SSDataBlock* hashGroupbyAggregate(SOperatorInfo* pOperator) {
// updateNumOfRowsInResultRows(pInfo->binfo.pCtx, pOperator->numOfExprs, &pInfo->binfo.resultRowInfo,
// pInfo->binfo.rowCellInfoOffset);
// }
-
+#if 0
+ if(pOperator->fpSet.encodeResultRow){
+ char *result = NULL;
+ int32_t length = 0;
+ pOperator->fpSet.encodeResultRow(pOperator, &result, &length);
+ SAggSupporter* pSup = &pInfo->aggSup;
+ taosHashClear(pSup->pResultRowHashTable);
+ pInfo->binfo.resultRowInfo.size = 0;
+ pOperator->fpSet.decodeResultRow(pOperator, result);
+ if(result){
+ taosMemoryFree(result);
+ }
+ }
+#endif
blockDataEnsureCapacity(pRes, pOperator->resultInfo.capacity);
initGroupedResultInfo(&pInfo->groupResInfo, pInfo->aggSup.pResultRowHashTable, 0);
diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c
index b954eb3a221a187bc4fe96a3088125e149304ece..3e14589faae90de9fd03396ba525fd4b4a7154d9 100644
--- a/source/libs/executor/src/scanoperator.c
+++ b/source/libs/executor/src/scanoperator.c
@@ -875,7 +875,7 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
if (rows == 0) {
pOperator->status = OP_EXEC_DONE;
} else if (pInfo->pUpdateInfo) {
- SSDataBlock* upRes = getUpdateDataBlock(pInfo, true); // TODO(liuyao) get invertible from plan
+ SSDataBlock* upRes = getUpdateDataBlock(pInfo, true);
if (upRes) {
pInfo->pUpdateRes = upRes;
if (upRes->info.type == STREAM_REPROCESS) {
@@ -894,7 +894,7 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
SOperatorInfo* createStreamScanOperatorInfo(void* pDataReader, SReadHandle* pHandle,
SArray* pTableIdList, STableScanPhysiNode* pTableScanNode, SExecTaskInfo* pTaskInfo,
- STimeWindowAggSupp* pTwSup, int16_t tsColId) {
+ STimeWindowAggSupp* pTwSup) {
SStreamBlockScanInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamBlockScanInfo));
SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
if (pInfo == NULL || pOperator == NULL) {
@@ -939,8 +939,12 @@ SOperatorInfo* createStreamScanOperatorInfo(void* pDataReader, SReadHandle* pHan
goto _error;
}
- pInfo->primaryTsIndex = tsColId;
- if (pSTInfo->interval.interval > 0) {
+ if (isSmaStream(pTableScanNode->triggerType)) {
+ pTwSup->waterMark = getSmaWaterMark(pSTInfo->interval.interval,
+ pTableScanNode->filesFactor);
+ }
+ pInfo->primaryTsIndex = 0; // pTableScanNode->tsColId;
+ if (pSTInfo->interval.interval > 0 && pDataReader) {
pInfo->pUpdateInfo = updateInfoInitP(&pSTInfo->interval, pTwSup->waterMark);
} else {
pInfo->pUpdateInfo = NULL;
diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c
index 829968d37f9a8a97cf1f256b493035ad0129f71a..14344daf8150799683bb8d5fac605347d611819e 100644
--- a/source/libs/executor/src/timewindowoperator.c
+++ b/source/libs/executor/src/timewindowoperator.c
@@ -748,10 +748,14 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
longjmp(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
}
- if (pInfo->execModel == OPTR_EXEC_MODEL_STREAM &&
- (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE ||
- pInfo->twAggSup.calTrigger == 0) ) {
- saveResult(pResult, tableGroupId, pUpdated);
+ if (pInfo->execModel == OPTR_EXEC_MODEL_STREAM) {
+ if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE ||
+ pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE_SMA) {
+ saveResult(pResult, tableGroupId, pUpdated);
+ }
+ if (pInfo->twAggSup.winMap) {
+ taosHashRemove(pInfo->twAggSup.winMap, &win.skey, sizeof(TSKEY));
+ }
}
int32_t forwardStep = 0;
@@ -824,10 +828,14 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
longjmp(pTaskInfo->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
}
- if (pInfo->execModel == OPTR_EXEC_MODEL_STREAM &&
- (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE ||
- pInfo->twAggSup.calTrigger == 0) ) {
- saveResult(pResult, tableGroupId, pUpdated);
+ if (pInfo->execModel == OPTR_EXEC_MODEL_STREAM) {
+ if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE ||
+ pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE_SMA) {
+ saveResult(pResult, tableGroupId, pUpdated);
+ }
+ if (pInfo->twAggSup.winMap) {
+ taosHashRemove(pInfo->twAggSup.winMap, &win.skey, sizeof(TSKEY));
+ }
}
ekey = ascScan? nextWin.ekey:nextWin.skey;
@@ -880,14 +888,14 @@ static int32_t doOpenIntervalAgg(SOperatorInfo* pOperator) {
hashIntervalAgg(pOperator, &pInfo->binfo.resultRowInfo, pBlock, pBlock->info.groupId, NULL);
#if 0 // test for encode/decode result info
- if(pOperator->encodeResultRow){
+ if(pOperator->fpSet.encodeResultRow){
char *result = NULL;
int32_t length = 0;
SAggSupporter *pSup = &pInfo->aggSup;
- pOperator->encodeResultRow(pOperator, pSup, &pInfo->binfo, &result, &length);
+ pOperator->fpSet.encodeResultRow(pOperator, &result, &length);
taosHashClear(pSup->pResultRowHashTable);
pInfo->binfo.resultRowInfo.size = 0;
- pOperator->decodeResultRow(pOperator, pSup, &pInfo->binfo, result, length);
+ pOperator->fpSet.decodeResultRow(pOperator, result);
if(result){
taosMemoryFree(result);
}
@@ -1172,15 +1180,23 @@ static int32_t closeIntervalWindow(SHashObj *pHashMap, STimeWindowAggSupp *pSup,
void* key = taosHashGetKey(pIte, &keyLen);
uint64_t groupId = *(uint64_t*) key;
ASSERT(keyLen == GET_RES_WINDOW_KEY_LEN(sizeof(TSKEY)));
- TSKEY ts = *(uint64_t*) ((char*)key + sizeof(uint64_t));
+ TSKEY ts = *(int64_t*) ((char*)key + sizeof(uint64_t));
SResultRowInfo dumyInfo;
dumyInfo.cur.pageId = -1;
STimeWindow win = getActiveTimeWindow(NULL, &dumyInfo, ts, pInterval,
pInterval->precision, NULL);
if (win.ekey < pSup->maxTs - pSup->waterMark) {
+ if (pSup->calTrigger == STREAM_TRIGGER_WINDOW_CLOSE_SMA) {
+ if (taosHashGet(pSup->winMap, &win.skey, sizeof(TSKEY))) {
+ continue;
+ }
+ }
char keyBuf[GET_RES_WINDOW_KEY_LEN(sizeof(TSKEY))];
SET_RES_WINDOW_KEY(keyBuf, &ts, sizeof(TSKEY), groupId);
- taosHashRemove(pHashMap, keyBuf, keyLen);
+ if (pSup->calTrigger != STREAM_TRIGGER_AT_ONCE_SMA &&
+ pSup->calTrigger != STREAM_TRIGGER_WINDOW_CLOSE_SMA) {
+ taosHashRemove(pHashMap, keyBuf, keyLen);
+ }
SResKeyPos* pos = taosMemoryMalloc(sizeof(SResKeyPos) + sizeof(uint64_t));
if (pos == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
@@ -1192,6 +1208,7 @@ static int32_t closeIntervalWindow(SHashObj *pHashMap, STimeWindowAggSupp *pSup,
taosMemoryFree(pos);
return TSDB_CODE_OUT_OF_MEMORY;
}
+ taosHashPut(pSup->winMap, &win.skey, sizeof(TSKEY), NULL, 0);
}
}
return TSDB_CODE_SUCCESS;
@@ -1248,7 +1265,8 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
&pInfo->interval, pClosed);
finalizeUpdatedResult(pOperator->numOfExprs, pInfo->aggSup.pResultBuf, pClosed,
pInfo->binfo.rowCellInfoOffset);
- if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER__WINDOW_CLOSE) {
+ if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE ||
+ pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE_SMA) {
taosArrayAddAll(pUpdated, pClosed);
}
taosArrayDestroy(pClosed);
@@ -2412,7 +2430,7 @@ int32_t closeSessionWindow(SArray *pWins, STimeWindowAggSupp *pTwSup, SArray *pC
return TSDB_CODE_OUT_OF_MEMORY;
}
pSeWin->isClosed = true;
- if (calTrigger == STREAM_TRIGGER__WINDOW_CLOSE) {
+ if (calTrigger == STREAM_TRIGGER_WINDOW_CLOSE) {
pSeWin->isOutput = true;
}
}
@@ -2486,7 +2504,7 @@ static SSDataBlock* doStreamSessionWindowAgg(SOperatorInfo* pOperator) {
SArray* pUpdated = taosArrayInit(16, POINTER_BYTES);
copyUpdateResult(pStUpdated, pUpdated, pBInfo->pRes->info.groupId);
taosHashCleanup(pStUpdated);
- if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER__WINDOW_CLOSE) {
+ if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_WINDOW_CLOSE) {
taosArrayAddAll(pUpdated, pClosed);
}
diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c
index 24a781855ac2337863a381e7d01d22159ee78937..4725f117150ec3211bb402a042d68bdd667a8003 100644
--- a/source/libs/function/src/builtins.c
+++ b/source/libs/function/src/builtins.c
@@ -445,6 +445,11 @@ static int32_t translateStateCount(SFunctionNode* pFunc, char* pErrBuf, int32_t
}
// param0
+ SNode* pParaNode0 = nodesListGetNode(pFunc->pParameterList, 0);
+ if (QUERY_NODE_COLUMN != nodeType(pParaNode0)) {
+ return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR,
+ "The input parameter of STATECOUNT function can only be column");
+ }
uint8_t colType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type;
if (!IS_NUMERIC_TYPE(colType)) {
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
@@ -480,6 +485,11 @@ static int32_t translateStateDuration(SFunctionNode* pFunc, char* pErrBuf, int32
}
// param0
+ SNode* pParaNode0 = nodesListGetNode(pFunc->pParameterList, 0);
+ if (QUERY_NODE_COLUMN != nodeType(pParaNode0)) {
+ return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR,
+ "The input parameter of STATEDURATION function can only be column");
+ }
uint8_t colType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType.type;
if (!IS_NUMERIC_TYPE(colType)) {
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
@@ -693,7 +703,7 @@ static int32_t translateFirstLast(SFunctionNode* pFunc, char* pErrBuf, int32_t l
static int32_t translateUnique(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
if (1 != LIST_LENGTH(pFunc->pParameterList)) {
- return TSDB_CODE_SUCCESS;
+ return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName);
}
SNode* pPara = nodesListGetNode(pFunc->pParameterList, 0);
@@ -1181,7 +1191,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.finalizeFunc = functionFinalize
},
{
- .name = "state_count",
+ .name = "statecount",
.type = FUNCTION_TYPE_STATE_COUNT,
.classification = FUNC_MGT_INDEFINITE_ROWS_FUNC,
.translateFunc = translateStateCount,
@@ -1191,7 +1201,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.finalizeFunc = NULL
},
{
- .name = "state_duration",
+ .name = "stateduration",
.type = FUNCTION_TYPE_STATE_DURATION,
.classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_TIMELINE_FUNC,
.translateFunc = translateStateDuration,
diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c
index 068d06fc31a9e73c05e84308a0b137386c69b060..8707946253e0fcaf634ff99a16ca26dba4626abc 100644
--- a/source/libs/function/src/builtinsimpl.c
+++ b/source/libs/function/src/builtinsimpl.c
@@ -3776,6 +3776,7 @@ static void tailAssignResult(STailItem* pItem, char *data, int32_t colBytes, TSK
if (isNull) {
pItem->isNull = true;
} else {
+ pItem->isNull = false;
memcpy(pItem->data, data, colBytes);
}
}
diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c
index 68d3741b482105d02d4751847f01f3fbdc32986f..cb4a4f104c1d72fcd367ef268060e1e10e486d0b 100644
--- a/source/libs/nodes/src/nodesCloneFuncs.c
+++ b/source/libs/nodes/src/nodesCloneFuncs.c
@@ -305,6 +305,7 @@ static SNode* logicNodeCopy(const SLogicNode* pSrc, SLogicNode* pDst) {
CLONE_NODE_FIELD(pConditions);
CLONE_NODE_LIST_FIELD(pChildren);
COPY_SCALAR_FIELD(optimizedFlag);
+ COPY_SCALAR_FIELD(precision);
return (SNode*)pDst;
}
@@ -328,6 +329,10 @@ static SNode* logicScanCopy(const SScanLogicNode* pSrc, SScanLogicNode* pDst) {
COPY_SCALAR_FIELD(intervalUnit);
COPY_SCALAR_FIELD(slidingUnit);
CLONE_NODE_FIELD(pTagCond);
+ COPY_SCALAR_FIELD(triggerType);
+ COPY_SCALAR_FIELD(watermark);
+ COPY_SCALAR_FIELD(tsColId);
+ COPY_SCALAR_FIELD(filesFactor);
return (SNode*)pDst;
}
@@ -384,6 +389,7 @@ static SNode* logicWindowCopy(const SWindowLogicNode* pSrc, SWindowLogicNode* pD
CLONE_NODE_FIELD(pStateExpr);
COPY_SCALAR_FIELD(triggerType);
COPY_SCALAR_FIELD(watermark);
+ COPY_SCALAR_FIELD(filesFactor);
return (SNode*)pDst;
}
diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c
index 78710569cbe6718c6fa899448a1cab11edebaab3..4b62963ac6722963104ddad7c242afc487b247ff 100644
--- a/source/libs/nodes/src/nodesCodeFuncs.c
+++ b/source/libs/nodes/src/nodesCodeFuncs.c
@@ -1133,6 +1133,7 @@ static const char* jkTableScanPhysiPlanSlidingUnit = "slidingUnit";
static const char* jkTableScanPhysiPlanTriggerType = "triggerType";
static const char* jkTableScanPhysiPlanWatermark = "watermark";
static const char* jkTableScanPhysiPlanTsColId = "tsColId";
+static const char* jkTableScanPhysiPlanFilesFactor = "FilesFactor";
static int32_t physiTableScanNodeToJson(const void* pObj, SJson* pJson) {
const STableScanPhysiNode* pNode = (const STableScanPhysiNode*)pObj;
@@ -1183,6 +1184,9 @@ static int32_t physiTableScanNodeToJson(const void* pObj, SJson* pJson) {
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkTableScanPhysiPlanTsColId, pNode->tsColId);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddDoubleToObject(pJson, jkTableScanPhysiPlanFilesFactor, pNode->filesFactor);
+ }
return code;
}
@@ -1242,7 +1246,9 @@ static int32_t jsonToPhysiTableScanNode(const SJson* pJson, void* pObj) {
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkTableScanPhysiPlanTsColId, pNode->tsColId, code);
}
-
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetDoubleValue(pJson, jkTableScanPhysiPlanFilesFactor, &pNode->filesFactor);
+ }
return code;
}
@@ -1496,6 +1502,7 @@ static const char* jkWindowPhysiPlanFuncs = "Funcs";
static const char* jkWindowPhysiPlanTsPk = "TsPk";
static const char* jkWindowPhysiPlanTriggerType = "TriggerType";
static const char* jkWindowPhysiPlanWatermark = "Watermark";
+static const char* jkWindowPhysiPlanFilesFactor = "FilesFactor";
static int32_t physiWindowNodeToJson(const void* pObj, SJson* pJson) {
const SWinodwPhysiNode* pNode = (const SWinodwPhysiNode*)pObj;
@@ -1516,6 +1523,9 @@ static int32_t physiWindowNodeToJson(const void* pObj, SJson* pJson) {
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkWindowPhysiPlanWatermark, pNode->watermark);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddDoubleToObject(pJson, jkWindowPhysiPlanFilesFactor, pNode->filesFactor);
+ }
return code;
}
@@ -1541,6 +1551,9 @@ static int32_t jsonToPhysiWindowNode(const SJson* pJson, void* pObj) {
tjsonGetNumberValue(pJson, jkWindowPhysiPlanWatermark, pNode->watermark, code);
;
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetDoubleValue(pJson, jkWindowPhysiPlanFilesFactor, &pNode->filesFactor);
+ }
return code;
}
diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h
index a1c304118bfcdc5078bf0a19b73a8bde17e3c0cf..9c9aa5ccb974daa77b05abcfaf831a48def1cb24 100644
--- a/source/libs/parser/inc/parAst.h
+++ b/source/libs/parser/inc/parAst.h
@@ -59,7 +59,6 @@ typedef enum EDatabaseOptionType {
typedef enum ETableOptionType {
TABLE_OPTION_COMMENT = 1,
- TABLE_OPTION_DELAY,
TABLE_OPTION_FILE_FACTOR,
TABLE_OPTION_ROLLUP,
TABLE_OPTION_TTL,
diff --git a/source/libs/parser/inc/parInt.h b/source/libs/parser/inc/parInt.h
index 184ed7d8b243ed2ec97e4c38b1f1e31de9e3f2c2..3efe6700d2339b2234d33f868c0b42fa993d1b64 100644
--- a/source/libs/parser/inc/parInt.h
+++ b/source/libs/parser/inc/parInt.h
@@ -24,6 +24,7 @@ extern "C" {
#include "parUtil.h"
#include "parser.h"
+int32_t parseInsertSyntax(SParseContext* pContext, SQuery** pQuery);
int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery);
int32_t parse(SParseContext* pParseCxt, SQuery** pQuery);
int32_t collectMetaKey(SParseContext* pParseCxt, SQuery* pQuery);
diff --git a/source/libs/parser/inc/parUtil.h b/source/libs/parser/inc/parUtil.h
index 80288dbc448a0cd35212da5e672b6b59bc021313..2468f7d75bd16acb21c2bb45dd74ae46c1b669d7 100644
--- a/source/libs/parser/inc/parUtil.h
+++ b/source/libs/parser/inc/parUtil.h
@@ -65,12 +65,15 @@ int32_t trimString(const char* src, int32_t len, char* dst, int32_t dlen);
int32_t buildCatalogReq(const SParseMetaCache* pMetaCache, SCatalogReq* pCatalogReq);
int32_t putMetaDataToCache(const SCatalogReq* pCatalogReq, const SMetaData* pMetaData, SParseMetaCache* pMetaCache);
int32_t reserveTableMetaInCache(int32_t acctId, const char* pDb, const char* pTable, SParseMetaCache* pMetaCache);
+int32_t reserveTableMetaInCacheExt(const SName* pName, SParseMetaCache* pMetaCache);
int32_t reserveDbVgInfoInCache(int32_t acctId, const char* pDb, SParseMetaCache* pMetaCache);
int32_t reserveTableVgroupInCache(int32_t acctId, const char* pDb, const char* pTable, SParseMetaCache* pMetaCache);
+int32_t reserveTableVgroupInCacheExt(const SName* pName, SParseMetaCache* pMetaCache);
int32_t reserveDbVgVersionInCache(int32_t acctId, const char* pDb, SParseMetaCache* pMetaCache);
int32_t reserveDbCfgInCache(int32_t acctId, const char* pDb, SParseMetaCache* pMetaCache);
int32_t reserveUserAuthInCache(int32_t acctId, const char* pUser, const char* pDb, AUTH_TYPE type,
SParseMetaCache* pMetaCache);
+int32_t reserveUserAuthInCacheExt(const char* pUser, const SName* pName, AUTH_TYPE type, SParseMetaCache* pMetaCache);
int32_t reserveUdfInCache(const char* pFunc, SParseMetaCache* pMetaCache);
int32_t getTableMetaFromCache(SParseMetaCache* pMetaCache, const SName* pName, STableMeta** pMeta);
int32_t getDbVgInfoFromCache(SParseMetaCache* pMetaCache, const char* pDbFName, SArray** pVgInfo);
@@ -78,7 +81,7 @@ int32_t getTableVgroupFromCache(SParseMetaCache* pMetaCache, const SName* pName,
int32_t getDbVgVersionFromCache(SParseMetaCache* pMetaCache, const char* pDbFName, int32_t* pVersion, int64_t* pDbId,
int32_t* pTableNum);
int32_t getDbCfgFromCache(SParseMetaCache* pMetaCache, const char* pDbFName, SDbCfgInfo* pInfo);
-int32_t getUserAuthFromCache(SParseMetaCache* pMetaCache, const char* pUser, const char* pDb, AUTH_TYPE type,
+int32_t getUserAuthFromCache(SParseMetaCache* pMetaCache, const char* pUser, const char* pDbFName, AUTH_TYPE type,
bool* pPass);
int32_t getUdfInfoFromCache(SParseMetaCache* pMetaCache, const char* pFunc, SFuncInfo* pInfo);
diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y
index 1fb60f83a5a822e627f8cbdf54b3a1e42c4daa5d..ec5a9c26d4f8741fb8de56e84f2eaea59a094aa4 100644
--- a/source/libs/parser/inc/sql.y
+++ b/source/libs/parser/inc/sql.y
@@ -313,7 +313,6 @@ tags_def(A) ::= TAGS NK_LP column_def_list(B) NK_RP.
table_options(A) ::= . { A = createDefaultTableOptions(pCxt); }
table_options(A) ::= table_options(B) COMMENT NK_STRING(C). { A = setTableOption(pCxt, B, TABLE_OPTION_COMMENT, &C); }
-table_options(A) ::= table_options(B) DELAY NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_DELAY, &C); }
table_options(A) ::= table_options(B) FILE_FACTOR NK_FLOAT(C). { A = setTableOption(pCxt, B, TABLE_OPTION_FILE_FACTOR, &C); }
table_options(A) ::= table_options(B) ROLLUP NK_LP func_name_list(C) NK_RP. { A = setTableOption(pCxt, B, TABLE_OPTION_ROLLUP, C); }
table_options(A) ::= table_options(B) TTL NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_TTL, &C); }
@@ -408,7 +407,7 @@ cmd ::= CREATE TOPIC not_exists_opt(A)
cmd ::= CREATE TOPIC not_exists_opt(A)
topic_name(B) topic_options(D) AS db_name(C). { pCxt->pRootNode = createCreateTopicStmt(pCxt, A, &B, NULL, &C, D); }
cmd ::= DROP TOPIC exists_opt(A) topic_name(B). { pCxt->pRootNode = createDropTopicStmt(pCxt, A, &B); }
-cmd ::= DROP CGROUP exists_opt(A) cgroup_name(B) ON topic_name(C). { pCxt->pRootNode = createDropCGroupStmt(pCxt, A, &B, &C); }
+cmd ::= DROP CONSUMER GROUP exists_opt(A) cgroup_name(B) ON topic_name(C). { pCxt->pRootNode = createDropCGroupStmt(pCxt, A, &B, &C); }
topic_options(A) ::= . { A = createTopicOptions(pCxt); }
topic_options(A) ::= topic_options(B) WITH TABLE. { ((STopicOptions*)B)->withTable = true; A = B; }
diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c
index 836a0cb520684e264cecb3cd6425ae3c7688de68..eb51830d616cb5ebdf462e96e090373ddc448d99 100644
--- a/source/libs/parser/src/parAstCreater.c
+++ b/source/libs/parser/src/parAstCreater.c
@@ -857,7 +857,6 @@ SNode* createDefaultTableOptions(SAstCreateContext* pCxt) {
CHECK_PARSER_STATUS(pCxt);
STableOptions* pOptions = nodesMakeNode(QUERY_NODE_TABLE_OPTIONS);
CHECK_OUT_OF_MEM(pOptions);
- pOptions->delay = TSDB_DEFAULT_ROLLUP_DELAY;
pOptions->filesFactor = TSDB_DEFAULT_ROLLUP_FILE_FACTOR;
pOptions->ttl = TSDB_DEFAULT_TABLE_TTL;
return (SNode*)pOptions;
@@ -867,7 +866,6 @@ SNode* createAlterTableOptions(SAstCreateContext* pCxt) {
CHECK_PARSER_STATUS(pCxt);
STableOptions* pOptions = nodesMakeNode(QUERY_NODE_TABLE_OPTIONS);
CHECK_OUT_OF_MEM(pOptions);
- pOptions->delay = -1;
pOptions->filesFactor = -1;
pOptions->ttl = -1;
return (SNode*)pOptions;
@@ -882,11 +880,8 @@ SNode* setTableOption(SAstCreateContext* pCxt, SNode* pOptions, ETableOptionType
sizeof(((STableOptions*)pOptions)->comment));
}
break;
- case TABLE_OPTION_DELAY:
- ((STableOptions*)pOptions)->delay = taosStr2Int32(((SToken*)pVal)->z, NULL, 10);
- break;
case TABLE_OPTION_FILE_FACTOR:
- ((STableOptions*)pOptions)->filesFactor = taosStr2Float(((SToken*)pVal)->z, NULL);
+ ((STableOptions*)pOptions)->filesFactor = taosStr2Double(((SToken*)pVal)->z, NULL);
break;
case TABLE_OPTION_ROLLUP:
((STableOptions*)pOptions)->pRollupFuncs = pVal;
diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c
index 5d65a0b80bebc98a02e21458ae558661c4e5439b..68c9684c97ac8eba986a339b7618e51bc02d7d79 100644
--- a/source/libs/parser/src/parAstParser.c
+++ b/source/libs/parser/src/parAstParser.c
@@ -333,68 +333,22 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
return collectMetaKeyFromSetOperator(pCxt, (SSetOperator*)pStmt);
case QUERY_NODE_SELECT_STMT:
return collectMetaKeyFromSelect(pCxt, (SSelectStmt*)pStmt);
- case QUERY_NODE_VNODE_MODIF_STMT:
- case QUERY_NODE_CREATE_DATABASE_STMT:
- case QUERY_NODE_DROP_DATABASE_STMT:
- case QUERY_NODE_ALTER_DATABASE_STMT:
- break;
case QUERY_NODE_CREATE_TABLE_STMT:
return collectMetaKeyFromCreateTable(pCxt, (SCreateTableStmt*)pStmt);
- case QUERY_NODE_CREATE_SUBTABLE_CLAUSE:
- break;
case QUERY_NODE_CREATE_MULTI_TABLE_STMT:
return collectMetaKeyFromCreateMultiTable(pCxt, (SCreateMultiTableStmt*)pStmt);
- case QUERY_NODE_DROP_TABLE_CLAUSE:
- case QUERY_NODE_DROP_TABLE_STMT:
- case QUERY_NODE_DROP_SUPER_TABLE_STMT:
- break;
case QUERY_NODE_ALTER_TABLE_STMT:
return collectMetaKeyFromAlterTable(pCxt, (SAlterTableStmt*)pStmt);
- case QUERY_NODE_CREATE_USER_STMT:
- case QUERY_NODE_ALTER_USER_STMT:
- case QUERY_NODE_DROP_USER_STMT:
- break;
case QUERY_NODE_USE_DATABASE_STMT:
return collectMetaKeyFromUseDatabase(pCxt, (SUseDatabaseStmt*)pStmt);
- case QUERY_NODE_CREATE_DNODE_STMT:
- case QUERY_NODE_DROP_DNODE_STMT:
- case QUERY_NODE_ALTER_DNODE_STMT:
- break;
case QUERY_NODE_CREATE_INDEX_STMT:
return collectMetaKeyFromCreateIndex(pCxt, (SCreateIndexStmt*)pStmt);
- case QUERY_NODE_DROP_INDEX_STMT:
- case QUERY_NODE_CREATE_QNODE_STMT:
- case QUERY_NODE_DROP_QNODE_STMT:
- case QUERY_NODE_CREATE_BNODE_STMT:
- case QUERY_NODE_DROP_BNODE_STMT:
- case QUERY_NODE_CREATE_SNODE_STMT:
- case QUERY_NODE_DROP_SNODE_STMT:
- case QUERY_NODE_CREATE_MNODE_STMT:
- case QUERY_NODE_DROP_MNODE_STMT:
- break;
case QUERY_NODE_CREATE_TOPIC_STMT:
return collectMetaKeyFromCreateTopic(pCxt, (SCreateTopicStmt*)pStmt);
- case QUERY_NODE_DROP_TOPIC_STMT:
- case QUERY_NODE_DROP_CGROUP_STMT:
- case QUERY_NODE_ALTER_LOCAL_STMT:
- break;
case QUERY_NODE_EXPLAIN_STMT:
return collectMetaKeyFromExplain(pCxt, (SExplainStmt*)pStmt);
- case QUERY_NODE_DESCRIBE_STMT:
- case QUERY_NODE_RESET_QUERY_CACHE_STMT:
- case QUERY_NODE_COMPACT_STMT:
- case QUERY_NODE_CREATE_FUNCTION_STMT:
- case QUERY_NODE_DROP_FUNCTION_STMT:
- break;
case QUERY_NODE_CREATE_STREAM_STMT:
return collectMetaKeyFromCreateStream(pCxt, (SCreateStreamStmt*)pStmt);
- case QUERY_NODE_DROP_STREAM_STMT:
- case QUERY_NODE_MERGE_VGROUP_STMT:
- case QUERY_NODE_REDISTRIBUTE_VGROUP_STMT:
- case QUERY_NODE_SPLIT_VGROUP_STMT:
- case QUERY_NODE_SYNCDB_STMT:
- case QUERY_NODE_GRANT_STMT:
- case QUERY_NODE_REVOKE_STMT:
case QUERY_NODE_SHOW_DNODES_STMT:
return collectMetaKeyFromShowDnodes(pCxt, (SShowStmt*)pStmt);
case QUERY_NODE_SHOW_MNODES_STMT:
@@ -407,8 +361,6 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
return collectMetaKeyFromShowSnodes(pCxt, (SShowStmt*)pStmt);
case QUERY_NODE_SHOW_BNODES_STMT:
return collectMetaKeyFromShowBnodes(pCxt, (SShowStmt*)pStmt);
- case QUERY_NODE_SHOW_CLUSTER_STMT:
- break;
case QUERY_NODE_SHOW_DATABASES_STMT:
return collectMetaKeyFromShowDatabases(pCxt, (SShowStmt*)pStmt);
case QUERY_NODE_SHOW_FUNCTIONS_STMT:
@@ -429,25 +381,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
return collectMetaKeyFromShowVgroups(pCxt, (SShowStmt*)pStmt);
case QUERY_NODE_SHOW_TOPICS_STMT:
return collectMetaKeyFromShowTopics(pCxt, (SShowStmt*)pStmt);
- case QUERY_NODE_SHOW_CONSUMERS_STMT:
- case QUERY_NODE_SHOW_SUBSCRIBES_STMT:
- case QUERY_NODE_SHOW_SMAS_STMT:
- case QUERY_NODE_SHOW_CONFIGS_STMT:
- case QUERY_NODE_SHOW_CONNECTIONS_STMT:
- case QUERY_NODE_SHOW_QUERIES_STMT:
- case QUERY_NODE_SHOW_VNODES_STMT:
- case QUERY_NODE_SHOW_APPS_STMT:
- case QUERY_NODE_SHOW_SCORES_STMT:
- case QUERY_NODE_SHOW_VARIABLE_STMT:
- case QUERY_NODE_SHOW_CREATE_DATABASE_STMT:
- case QUERY_NODE_SHOW_CREATE_TABLE_STMT:
- case QUERY_NODE_SHOW_CREATE_STABLE_STMT:
- break;
case QUERY_NODE_SHOW_TRANSACTIONS_STMT:
return collectMetaKeyFromShowTransactions(pCxt, (SShowStmt*)pStmt);
- case QUERY_NODE_KILL_CONNECTION_STMT:
- case QUERY_NODE_KILL_QUERY_STMT:
- case QUERY_NODE_KILL_TRANSACTION_STMT:
default:
break;
}
diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c
index 58a6d1483f097e0db75a59c84d8e469d9deec4c1..047c2d15045f667d41319b6d7c14c475cd6273a1 100644
--- a/source/libs/parser/src/parInsert.c
+++ b/source/libs/parser/src/parInsert.c
@@ -64,6 +64,7 @@ typedef struct SInsertParseContext {
int32_t totalNum;
SVnodeModifOpStmt* pOutput;
SStmtCallback* pStmtCb;
+ SParseMetaCache* pMetaCache;
} SInsertParseContext;
typedef int32_t (*_row_append_fn_t)(SMsgBuf* pMsgBuf, const void* value, int32_t len, void* param);
@@ -92,15 +93,15 @@ typedef struct SMemParam {
} \
} while (0)
-static int32_t skipInsertInto(SInsertParseContext* pCxt) {
+static int32_t skipInsertInto(char** pSql, SMsgBuf* pMsg) {
SToken sToken;
- NEXT_TOKEN(pCxt->pSql, sToken);
+ NEXT_TOKEN(*pSql, sToken);
if (TK_INSERT != sToken.type) {
- return buildSyntaxErrMsg(&pCxt->msg, "keyword INSERT is expected", sToken.z);
+ return buildSyntaxErrMsg(pMsg, "keyword INSERT is expected", sToken.z);
}
- NEXT_TOKEN(pCxt->pSql, sToken);
+ NEXT_TOKEN(*pSql, sToken);
if (TK_INTO != sToken.type) {
- return buildSyntaxErrMsg(&pCxt->msg, "keyword INTO is expected", sToken.z);
+ return buildSyntaxErrMsg(pMsg, "keyword INTO is expected", sToken.z);
}
return TSDB_CODE_SUCCESS;
}
@@ -212,7 +213,7 @@ static int32_t createSName(SName* pName, SToken* pTableName, int32_t acctId, con
return buildInvalidOperationMsg(pMsgBuf, msg4);
}
- char tbname[TSDB_TABLE_FNAME_LEN] = {0};
+ char tbname[TSDB_TABLE_FNAME_LEN] = {0};
strncpy(tbname, p + 1, tbLen);
/*tbLen = */ strdequote(tbname);
@@ -250,25 +251,46 @@ static int32_t createSName(SName* pName, SToken* pTableName, int32_t acctId, con
return code;
}
-static int32_t getTableMetaImpl(SInsertParseContext* pCxt, SName* name, char* dbFname, bool isStb) {
+static int32_t checkAuth(SInsertParseContext* pCxt, char* pDbFname, bool* pPass) {
+ SParseContext* pBasicCtx = pCxt->pComCxt;
+ if (NULL != pCxt->pMetaCache) {
+ return getUserAuthFromCache(pCxt->pMetaCache, pBasicCtx->pUser, pDbFname, AUTH_TYPE_WRITE, pPass);
+ }
+ return catalogChkAuth(pBasicCtx->pCatalog, pBasicCtx->pTransporter, &pBasicCtx->mgmtEpSet, pBasicCtx->pUser, pDbFname,
+ AUTH_TYPE_WRITE, pPass);
+}
+
+static int32_t getTableSchema(SInsertParseContext* pCxt, SName* pTbName, bool isStb, STableMeta** pTableMeta) {
+ SParseContext* pBasicCtx = pCxt->pComCxt;
+ if (NULL != pCxt->pMetaCache) {
+ return getTableMetaFromCache(pCxt->pMetaCache, pTbName, pTableMeta);
+ }
+ if (isStb) {
+ return catalogGetSTableMeta(pBasicCtx->pCatalog, pBasicCtx->pTransporter, &pBasicCtx->mgmtEpSet, pTbName,
+ pTableMeta);
+ }
+ return catalogGetTableMeta(pBasicCtx->pCatalog, pBasicCtx->pTransporter, &pBasicCtx->mgmtEpSet, pTbName, pTableMeta);
+}
+
+static int32_t getTableVgroup(SInsertParseContext* pCxt, SName* pTbName, SVgroupInfo* pVg) {
SParseContext* pBasicCtx = pCxt->pComCxt;
+ if (NULL != pCxt->pMetaCache) {
+ return getTableVgroupFromCache(pCxt->pMetaCache, pTbName, pVg);
+ }
+ return catalogGetTableHashVgroup(pBasicCtx->pCatalog, pBasicCtx->pTransporter, &pBasicCtx->mgmtEpSet, pTbName, pVg);
+}
+static int32_t getTableMetaImpl(SInsertParseContext* pCxt, SName* name, char* dbFname, bool isStb) {
bool pass = false;
- CHECK_CODE(catalogChkAuth(pBasicCtx->pCatalog, pBasicCtx->pTransporter, &pBasicCtx->mgmtEpSet, pBasicCtx->pUser,
- dbFname, AUTH_TYPE_WRITE, &pass));
+ CHECK_CODE(checkAuth(pCxt, dbFname, &pass));
if (!pass) {
return TSDB_CODE_PAR_PERMISSION_DENIED;
}
- if (isStb) {
- CHECK_CODE(catalogGetSTableMeta(pBasicCtx->pCatalog, pBasicCtx->pTransporter, &pBasicCtx->mgmtEpSet, name,
- &pCxt->pTableMeta));
- } else {
- CHECK_CODE(catalogGetTableMeta(pBasicCtx->pCatalog, pBasicCtx->pTransporter, &pBasicCtx->mgmtEpSet, name,
- &pCxt->pTableMeta));
- ASSERT(pCxt->pTableMeta->tableInfo.rowSize > 0);
+
+ CHECK_CODE(getTableSchema(pCxt, name, isStb, &pCxt->pTableMeta));
+ if (!isStb) {
SVgroupInfo vg;
- CHECK_CODE(
- catalogGetTableHashVgroup(pBasicCtx->pCatalog, pBasicCtx->pTransporter, &pBasicCtx->mgmtEpSet, name, &vg));
+ CHECK_CODE(getTableVgroup(pCxt, name, &vg));
CHECK_CODE(taosHashPut(pCxt->pVgroupsHashObj, (const char*)&vg.vgId, sizeof(vg.vgId), (char*)&vg, sizeof(vg)));
}
return TSDB_CODE_SUCCESS;
@@ -777,7 +799,7 @@ static int32_t KvRowAppend(SMsgBuf* pMsgBuf, const void* value, int32_t len, voi
if (errno == E2BIG) {
return generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_VALUE_TOO_LONG, pa->schema->name);
}
-
+
char buf[512] = {0};
snprintf(buf, tListLen(buf), " taosMbsToUcs4 error:%s", strerror(errno));
return buildSyntaxErrMsg(pMsgBuf, buf, value);
@@ -857,10 +879,8 @@ static int32_t cloneTableMeta(STableMeta* pSrc, STableMeta** pDst) {
static int32_t storeTableMeta(SInsertParseContext* pCxt, SHashObj* pHash, SName* pTableName, const char* pName,
int32_t len, STableMeta* pMeta) {
- SVgroupInfo vg;
- SParseContext* pBasicCtx = pCxt->pComCxt;
- CHECK_CODE(
- catalogGetTableHashVgroup(pBasicCtx->pCatalog, pBasicCtx->pTransporter, &pBasicCtx->mgmtEpSet, pTableName, &vg));
+ SVgroupInfo vg;
+ CHECK_CODE(getTableVgroup(pCxt, pTableName, &vg));
CHECK_CODE(taosHashPut(pCxt->pVgroupsHashObj, (const char*)&vg.vgId, sizeof(vg.vgId), (char*)&vg, sizeof(vg)));
pMeta->uid = 0;
@@ -1082,9 +1102,9 @@ static void destroyInsertParseContext(SInsertParseContext* pCxt) {
// VALUES (field1_value, ...) [(field1_value2, ...) ...] | FILE csv_file_path
// [...];
static int32_t parseInsertBody(SInsertParseContext* pCxt) {
- int32_t tbNum = 0;
- char tbFName[TSDB_TABLE_FNAME_LEN];
- bool autoCreateTbl = false;
+ int32_t tbNum = 0;
+ char tbFName[TSDB_TABLE_FNAME_LEN];
+ bool autoCreateTbl = false;
// for each table
while (1) {
@@ -1186,8 +1206,8 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
return TSDB_CODE_TSC_OUT_OF_MEMORY;
}
memcpy(tags, &pCxt->tags, sizeof(pCxt->tags));
- (*pCxt->pStmtCb->setInfoFn)(pCxt->pStmtCb->pStmt, pCxt->pTableMeta, tags, tbFName, autoCreateTbl, pCxt->pVgroupsHashObj,
- pCxt->pTableBlockHashObj);
+ (*pCxt->pStmtCb->setInfoFn)(pCxt->pStmtCb->pStmt, pCxt->pTableMeta, tags, tbFName, autoCreateTbl,
+ pCxt->pVgroupsHashObj, pCxt->pTableBlockHashObj);
memset(&pCxt->tags, 0, sizeof(pCxt->tags));
pCxt->pVgroupsHashObj = NULL;
@@ -1245,12 +1265,11 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery) {
if (NULL == *pQuery) {
return TSDB_CODE_OUT_OF_MEMORY;
}
-
- (*pQuery)->execMode = QUERY_EXEC_MODE_SCHEDULE;
- (*pQuery)->haveResultSet = false;
- (*pQuery)->msgType = TDMT_VND_SUBMIT;
- (*pQuery)->pRoot = (SNode*)context.pOutput;
}
+ (*pQuery)->execMode = QUERY_EXEC_MODE_SCHEDULE;
+ (*pQuery)->haveResultSet = false;
+ (*pQuery)->msgType = TDMT_VND_SUBMIT;
+ (*pQuery)->pRoot = (SNode*)context.pOutput;
if (NULL == (*pQuery)->pTableList) {
(*pQuery)->pTableList = taosArrayInit(taosHashGetSize(context.pTableNameHashObj), sizeof(SName));
@@ -1261,7 +1280,7 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery) {
context.pOutput->payloadType = PAYLOAD_TYPE_KV;
- int32_t code = skipInsertInto(&context);
+ int32_t code = skipInsertInto(&context.pSql, &context.msg);
if (TSDB_CODE_SUCCESS == code) {
code = parseInsertBody(&context);
}
@@ -1276,6 +1295,171 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery) {
return code;
}
+typedef struct SInsertParseSyntaxCxt {
+ SParseContext* pComCxt;
+ char* pSql;
+ SMsgBuf msg;
+ SParseMetaCache* pMetaCache;
+} SInsertParseSyntaxCxt;
+
+static int32_t skipParentheses(SInsertParseSyntaxCxt* pCxt) {
+ SToken sToken;
+ while (1) {
+ NEXT_TOKEN(pCxt->pSql, sToken);
+ if (TK_NK_RP == sToken.type) {
+ break;
+ }
+ if (0 == sToken.n) {
+ return buildSyntaxErrMsg(&pCxt->msg, ") expected", NULL);
+ }
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t skipBoundColumns(SInsertParseSyntaxCxt* pCxt) { return skipParentheses(pCxt); }
+
+// pSql -> (field1_value, ...) [(field1_value2, ...) ...]
+static int32_t skipValuesClause(SInsertParseSyntaxCxt* pCxt) {
+ int32_t numOfRows = 0;
+ SToken sToken;
+ while (1) {
+ int32_t index = 0;
+ NEXT_TOKEN_KEEP_SQL(pCxt->pSql, sToken, index);
+ if (TK_NK_LP != sToken.type) {
+ break;
+ }
+ pCxt->pSql += index;
+
+ CHECK_CODE(skipParentheses(pCxt));
+ ++numOfRows;
+ }
+ if (0 == numOfRows) {
+ return buildSyntaxErrMsg(&pCxt->msg, "no any data points", NULL);
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t skipTagsClause(SInsertParseSyntaxCxt* pCxt) { return skipParentheses(pCxt); }
+
+// pSql -> [(tag1_name, ...)] TAGS (tag1_value, ...)
+static int32_t skipUsingClause(SInsertParseSyntaxCxt* pCxt) {
+ SToken sToken;
+ NEXT_TOKEN(pCxt->pSql, sToken);
+ if (TK_NK_LP == sToken.type) {
+ CHECK_CODE(skipBoundColumns(pCxt));
+ NEXT_TOKEN(pCxt->pSql, sToken);
+ }
+
+ if (TK_TAGS != sToken.type) {
+ return buildSyntaxErrMsg(&pCxt->msg, "TAGS is expected", sToken.z);
+ }
+ // pSql -> (tag1_value, ...)
+ NEXT_TOKEN(pCxt->pSql, sToken);
+ if (TK_NK_LP != sToken.type) {
+ return buildSyntaxErrMsg(&pCxt->msg, "( is expected", sToken.z);
+ }
+ CHECK_CODE(skipTagsClause(pCxt));
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t collectTableMetaKey(SInsertParseSyntaxCxt* pCxt, SToken* pTbToken) {
+ SName name;
+ CHECK_CODE(createSName(&name, pTbToken, pCxt->pComCxt->acctId, pCxt->pComCxt->db, &pCxt->msg));
+ CHECK_CODE(reserveUserAuthInCacheExt(pCxt->pComCxt->pUser, &name, AUTH_TYPE_WRITE, pCxt->pMetaCache));
+ CHECK_CODE(reserveTableMetaInCacheExt(&name, pCxt->pMetaCache));
+ CHECK_CODE(reserveTableVgroupInCacheExt(&name, pCxt->pMetaCache));
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t parseInsertBodySyntax(SInsertParseSyntaxCxt* pCxt) {
+ bool hasData = false;
+ // for each table
+ while (1) {
+ SToken sToken;
+
+ // pSql -> tb_name ...
+ NEXT_TOKEN(pCxt->pSql, sToken);
+
+ // no data in the sql string anymore.
+ if (sToken.n == 0) {
+ if (sToken.type && pCxt->pSql[0]) {
+ return buildSyntaxErrMsg(&pCxt->msg, "invalid charactor in SQL", sToken.z);
+ }
+
+ if (!hasData) {
+ return buildInvalidOperationMsg(&pCxt->msg, "no data in sql");
+ }
+ break;
+ }
+
+ hasData = false;
+
+ SToken tbnameToken = sToken;
+ NEXT_TOKEN(pCxt->pSql, sToken);
+
+ // USING clause
+ if (TK_USING == sToken.type) {
+ NEXT_TOKEN(pCxt->pSql, sToken);
+ CHECK_CODE(collectTableMetaKey(pCxt, &sToken));
+ CHECK_CODE(skipUsingClause(pCxt));
+ NEXT_TOKEN(pCxt->pSql, sToken);
+ } else {
+ CHECK_CODE(collectTableMetaKey(pCxt, &tbnameToken));
+ }
+
+ if (TK_NK_LP == sToken.type) {
+ // pSql -> field1_name, ...)
+ CHECK_CODE(skipBoundColumns(pCxt));
+ NEXT_TOKEN(pCxt->pSql, sToken);
+ }
+
+ if (TK_VALUES == sToken.type) {
+ // pSql -> (field1_value, ...) [(field1_value2, ...) ...]
+ CHECK_CODE(skipValuesClause(pCxt));
+ hasData = true;
+ continue;
+ }
+
+ // FILE csv_file_path
+ if (TK_FILE == sToken.type) {
+ // pSql -> csv_file_path
+ NEXT_TOKEN(pCxt->pSql, sToken);
+ if (0 == sToken.n || (TK_NK_STRING != sToken.type && TK_NK_ID != sToken.type)) {
+ return buildSyntaxErrMsg(&pCxt->msg, "file path is required following keyword FILE", sToken.z);
+ }
+ hasData = true;
+ continue;
+ }
+
+ return buildSyntaxErrMsg(&pCxt->msg, "keyword VALUES or FILE is expected", sToken.z);
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+int32_t parseInsertSyntax(SParseContext* pContext, SQuery** pQuery) {
+ SInsertParseSyntaxCxt context = {.pComCxt = pContext,
+ .pSql = (char*)pContext->pSql,
+ .msg = {.buf = pContext->pMsg, .len = pContext->msgLen},
+ .pMetaCache = taosMemoryCalloc(1, sizeof(SParseMetaCache))};
+ if (NULL == context.pMetaCache) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ int32_t code = skipInsertInto(&context.pSql, &context.msg);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = parseInsertBodySyntax(&context);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ *pQuery = taosMemoryCalloc(1, sizeof(SQuery));
+ if (NULL == *pQuery) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ TSWAP((*pQuery)->pMetaCache, context.pMetaCache);
+ }
+ return code;
+}
+
int32_t qCreateSName(SName* pName, const char* pTableName, int32_t acctId, char* dbName, char* msgBuf,
int32_t msgBufLen) {
SMsgBuf msg = {.buf = msgBuf, .len = msgBufLen};
diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c
index 540de2d639be9e69e798316e04bb4a46ff9dd58e..5f478532b97d639cd53a15ed7d3b706822ad957c 100644
--- a/source/libs/parser/src/parTokenizer.c
+++ b/source/libs/parser/src/parTokenizer.c
@@ -53,7 +53,6 @@ static SKeyword keywordTable[] = {
{"CACHE", TK_CACHE},
{"CACHELAST", TK_CACHELAST},
{"CAST", TK_CAST},
- {"CGROUP", TK_CGROUP},
{"CLUSTER", TK_CLUSTER},
{"COLUMN", TK_COLUMN},
{"COMMENT", TK_COMMENT},
@@ -62,13 +61,13 @@ static SKeyword keywordTable[] = {
{"CONNS", TK_CONNS},
{"CONNECTION", TK_CONNECTION},
{"CONNECTIONS", TK_CONNECTIONS},
+ {"CONSUMER", TK_CONSUMER},
{"COUNT", TK_COUNT},
{"CREATE", TK_CREATE},
{"DATABASE", TK_DATABASE},
{"DATABASES", TK_DATABASES},
{"DAYS", TK_DAYS},
{"DBS", TK_DBS},
- {"DELAY", TK_DELAY},
{"DESC", TK_DESC},
{"DESCRIBE", TK_DESCRIBE},
{"DISTINCT", TK_DISTINCT},
diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c
index d84b005f7f0cd8bd91a3f9bbd17e9a8e7fa81a78..0dda71023fa1f4da35da1d0a53283dd1861a2119 100644
--- a/source/libs/parser/src/parTranslater.c
+++ b/source/libs/parser/src/parTranslater.c
@@ -465,20 +465,22 @@ static bool isPrimaryKey(STempTableNode* pTable, SNode* pExpr) {
return isPrimaryKeyImpl(pTable, pExpr);
}
-static bool findAndSetColumn(SColumnNode** pColRef, const STableNode* pTable) {
+static int32_t findAndSetColumn(STranslateContext* pCxt, SColumnNode** pColRef, const STableNode* pTable,
+ bool* pFound) {
SColumnNode* pCol = *pColRef;
- bool found = false;
+ *pFound = false;
if (QUERY_NODE_REAL_TABLE == nodeType(pTable)) {
const STableMeta* pMeta = ((SRealTableNode*)pTable)->pMeta;
if (isInternalPrimaryKey(pCol)) {
setColumnInfoBySchema((SRealTableNode*)pTable, pMeta->schema, false, pCol);
- return true;
+ *pFound = true;
+ return TSDB_CODE_SUCCESS;
}
int32_t nums = pMeta->tableInfo.numOfTags + pMeta->tableInfo.numOfColumns;
for (int32_t i = 0; i < nums; ++i) {
if (0 == strcmp(pCol->colName, pMeta->schema[i].name)) {
setColumnInfoBySchema((SRealTableNode*)pTable, pMeta->schema + i, (i >= pMeta->tableInfo.numOfColumns), pCol);
- found = true;
+ *pFound = true;
break;
}
}
@@ -489,13 +491,15 @@ static bool findAndSetColumn(SColumnNode** pColRef, const STableNode* pTable) {
SExprNode* pExpr = (SExprNode*)pNode;
if (0 == strcmp(pCol->colName, pExpr->aliasName) ||
(isPrimaryKey((STempTableNode*)pTable, pNode) && isInternalPrimaryKey(pCol))) {
+ if (*pFound) {
+ return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_AMBIGUOUS_COLUMN, pCol->colName);
+ }
setColumnInfoByExpr(pTable, pExpr, pColRef);
- found = true;
- break;
+ *pFound = true;
}
}
}
- return found;
+ return TSDB_CODE_SUCCESS;
}
static EDealRes translateColumnWithPrefix(STranslateContext* pCxt, SColumnNode** pCol) {
@@ -506,7 +510,12 @@ static EDealRes translateColumnWithPrefix(STranslateContext* pCxt, SColumnNode**
STableNode* pTable = taosArrayGetP(pTables, i);
if (belongTable(pCxt->pParseCxt->db, (*pCol), pTable)) {
foundTable = true;
- if (findAndSetColumn(pCol, pTable)) {
+ bool foundCol = false;
+ pCxt->errCode = findAndSetColumn(pCxt, pCol, pTable, &foundCol);
+ if (TSDB_CODE_SUCCESS != pCxt->errCode) {
+ return DEAL_RES_ERROR;
+ }
+ if (foundCol) {
break;
}
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_COLUMN, (*pCol)->colName);
@@ -525,14 +534,19 @@ static EDealRes translateColumnWithoutPrefix(STranslateContext* pCxt, SColumnNod
bool isInternalPk = isInternalPrimaryKey(*pCol);
for (size_t i = 0; i < nums; ++i) {
STableNode* pTable = taosArrayGetP(pTables, i);
- if (findAndSetColumn(pCol, pTable)) {
+ bool foundCol = false;
+ pCxt->errCode = findAndSetColumn(pCxt, pCol, pTable, &foundCol);
+ if (TSDB_CODE_SUCCESS != pCxt->errCode) {
+ return DEAL_RES_ERROR;
+ }
+ if (foundCol) {
if (found) {
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_AMBIGUOUS_COLUMN, (*pCol)->colName);
}
found = true;
- if (isInternalPk) {
- break;
- }
+ }
+ if (isInternalPk) {
+ break;
}
}
if (!found) {
@@ -752,18 +766,30 @@ static bool isMultiResFunc(SNode* pNode) {
return (QUERY_NODE_COLUMN == nodeType(pParam) ? 0 == strcmp(((SColumnNode*)pParam)->colName, "*") : false);
}
-static EDealRes translateUnaryOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
+static int32_t rewriteNegativeOperator(SNode** pOp) {
+ SNode* pRes = NULL;
+ int32_t code = scalarCalculateConstants(*pOp, &pRes);
+ if (TSDB_CODE_SUCCESS == code) {
+ *pOp = pRes;
+ }
+ return code;
+}
+
+static EDealRes translateUnaryOperator(STranslateContext* pCxt, SOperatorNode** pOpRef) {
+ SOperatorNode* pOp = *pOpRef;
if (OP_TYPE_MINUS == pOp->opType) {
if (!IS_MATHABLE_TYPE(((SExprNode*)(pOp->pLeft))->resType.type)) {
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)(pOp->pLeft))->aliasName);
}
pOp->node.resType.type = TSDB_DATA_TYPE_DOUBLE;
pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes;
+
+ pCxt->errCode = rewriteNegativeOperator((SNode**)pOpRef);
} else {
pOp->node.resType.type = TSDB_DATA_TYPE_BOOL;
pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes;
}
- return DEAL_RES_CONTINUE;
+ return TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_CONTINUE : DEAL_RES_ERROR;
}
static EDealRes translateArithmeticOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
@@ -824,7 +850,9 @@ static EDealRes translateJsonOperator(STranslateContext* pCxt, SOperatorNode* pO
return DEAL_RES_CONTINUE;
}
-static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
+static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode** pOpRef) {
+ SOperatorNode* pOp = *pOpRef;
+
if (isMultiResFunc(pOp->pLeft)) {
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)(pOp->pLeft))->aliasName);
}
@@ -833,7 +861,7 @@ static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
}
if (nodesIsUnaryOp(pOp)) {
- return translateUnaryOperator(pCxt, pOp);
+ return translateUnaryOperator(pCxt, pOpRef);
} else if (nodesIsArithmeticOp(pOp)) {
return translateArithmeticOperator(pCxt, pOp);
} else if (nodesIsComparisonOp(pOp)) {
@@ -992,7 +1020,7 @@ static EDealRes doTranslateExpr(SNode** pNode, void* pContext) {
case QUERY_NODE_VALUE:
return translateValue(pCxt, (SValueNode*)*pNode);
case QUERY_NODE_OPERATOR:
- return translateOperator(pCxt, (SOperatorNode*)*pNode);
+ return translateOperator(pCxt, (SOperatorNode**)pNode);
case QUERY_NODE_FUNCTION:
return translateFunction(pCxt, (SFunctionNode*)*pNode);
case QUERY_NODE_LOGIC_CONDITION:
@@ -1891,9 +1919,9 @@ static int32_t translatePartitionBy(STranslateContext* pCxt, SNodeList* pPartiti
return translateExprList(pCxt, pPartitionByList);
}
-static int32_t translateWhere(STranslateContext* pCxt, SNode* pWhere) {
+static int32_t translateWhere(STranslateContext* pCxt, SNode** pWhere) {
pCxt->currClause = SQL_CLAUSE_WHERE;
- return translateExpr(pCxt, &pWhere);
+ return translateExpr(pCxt, pWhere);
}
static int32_t translateFrom(STranslateContext* pCxt, SSelectStmt* pSelect) {
@@ -1925,7 +1953,9 @@ static int32_t createPrimaryKeyColByTable(STranslateContext* pCxt, STableNode* p
}
pCol->colId = PRIMARYKEY_TIMESTAMP_COL_ID;
strcpy(pCol->colName, PK_TS_COL_INTERNAL_NAME);
- if (!findAndSetColumn(&pCol, pTable)) {
+ bool found = false;
+ int32_t code = findAndSetColumn(pCxt, &pCol, pTable, &found);
+ if (TSDB_CODE_SUCCESS != code || !found) {
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TIMELINE_FUNC);
}
*pPrimaryKey = (SNode*)pCol;
@@ -1964,7 +1994,7 @@ static int32_t translateSelect(STranslateContext* pCxt, SSelectStmt* pSelect) {
pCxt->pCurrStmt = pSelect;
int32_t code = translateFrom(pCxt, pSelect);
if (TSDB_CODE_SUCCESS == code) {
- code = translateWhere(pCxt, pSelect->pWhere);
+ code = translateWhere(pCxt, &pSelect->pWhere);
}
if (TSDB_CODE_SUCCESS == code) {
code = translatePartitionBy(pCxt, pSelect->pPartitionByList);
@@ -2603,10 +2633,7 @@ static int32_t checkTableSchema(STranslateContext* pCxt, SCreateTableStmt* pStmt
}
static int32_t checkCreateTable(STranslateContext* pCxt, SCreateTableStmt* pStmt) {
- int32_t code = checkRangeOption(pCxt, "delay", pStmt->pOptions->delay, TSDB_MIN_ROLLUP_DELAY, TSDB_MAX_ROLLUP_DELAY);
- if (TSDB_CODE_SUCCESS == code) {
- code = checTableFactorOption(pCxt, pStmt->pOptions->filesFactor);
- }
+ int32_t code = checTableFactorOption(pCxt, pStmt->pOptions->filesFactor);
if (TSDB_CODE_SUCCESS == code) {
code = checkTableRollupOption(pCxt, pStmt->pOptions->pRollupFuncs);
}
@@ -2847,7 +2874,6 @@ static int32_t buildRollupAst(STranslateContext* pCxt, SCreateTableStmt* pStmt,
static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStmt, SMCreateStbReq* pReq) {
pReq->igExists = pStmt->ignoreExists;
pReq->xFilesFactor = pStmt->pOptions->filesFactor;
- pReq->delay = pStmt->pOptions->delay;
pReq->ttl = pStmt->pOptions->ttl;
columnDefNodeToField(pStmt->pCols, &pReq->pColumns);
columnDefNodeToField(pStmt->pTags, &pReq->pTags);
diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c
index 34b01991545cdfdea46203b6edc73098e273fd39..9882440bbb632e2d989da9f8a5f2be880bb37eab 100644
--- a/source/libs/parser/src/parUtil.c
+++ b/source/libs/parser/src/parUtil.c
@@ -671,22 +671,32 @@ int32_t putMetaDataToCache(const SCatalogReq* pCatalogReq, const SMetaData* pMet
return code;
}
-static int32_t reserveTableReqInCache(int32_t acctId, const char* pDb, const char* pTable, SHashObj** pTables) {
+static int32_t reserveTableReqInCacheImpl(const char* pTbFName, int32_t len, SHashObj** pTables) {
if (NULL == *pTables) {
*pTables = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
if (NULL == *pTables) {
return TSDB_CODE_OUT_OF_MEMORY;
}
}
+ return taosHashPut(*pTables, pTbFName, len, &pTables, POINTER_BYTES);
+}
+
+static int32_t reserveTableReqInCache(int32_t acctId, const char* pDb, const char* pTable, SHashObj** pTables) {
char fullName[TSDB_TABLE_FNAME_LEN];
int32_t len = snprintf(fullName, sizeof(fullName), "%d.%s.%s", acctId, pDb, pTable);
- return taosHashPut(*pTables, fullName, len, &pTables, POINTER_BYTES);
+ return reserveTableReqInCacheImpl(fullName, len, pTables);
}
int32_t reserveTableMetaInCache(int32_t acctId, const char* pDb, const char* pTable, SParseMetaCache* pMetaCache) {
return reserveTableReqInCache(acctId, pDb, pTable, &pMetaCache->pTableMeta);
}
+int32_t reserveTableMetaInCacheExt(const SName* pName, SParseMetaCache* pMetaCache) {
+ char fullName[TSDB_TABLE_FNAME_LEN];
+ tNameExtractFullName(pName, fullName);
+ return reserveTableReqInCacheImpl(fullName, strlen(fullName), &pMetaCache->pTableMeta);
+}
+
int32_t getTableMetaFromCache(SParseMetaCache* pMetaCache, const SName* pName, STableMeta** pMeta) {
char fullName[TSDB_TABLE_FNAME_LEN];
tNameExtractFullName(pName, fullName);
@@ -736,6 +746,12 @@ int32_t reserveTableVgroupInCache(int32_t acctId, const char* pDb, const char* p
return reserveTableReqInCache(acctId, pDb, pTable, &pMetaCache->pTableVgroup);
}
+int32_t reserveTableVgroupInCacheExt(const SName* pName, SParseMetaCache* pMetaCache) {
+ char fullName[TSDB_TABLE_FNAME_LEN];
+ tNameExtractFullName(pName, fullName);
+ return reserveTableReqInCacheImpl(fullName, strlen(fullName), &pMetaCache->pTableVgroup);
+}
+
int32_t getTableVgroupFromCache(SParseMetaCache* pMetaCache, const SName* pName, SVgroupInfo* pVgroup) {
char fullName[TSDB_TABLE_FNAME_LEN];
tNameExtractFullName(pName, fullName);
@@ -776,18 +792,30 @@ int32_t getDbCfgFromCache(SParseMetaCache* pMetaCache, const char* pDbFName, SDb
return TSDB_CODE_SUCCESS;
}
-int32_t reserveUserAuthInCache(int32_t acctId, const char* pUser, const char* pDb, AUTH_TYPE type,
- SParseMetaCache* pMetaCache) {
+static int32_t reserveUserAuthInCacheImpl(const char* pKey, int32_t len, SParseMetaCache* pMetaCache) {
if (NULL == pMetaCache->pUserAuth) {
pMetaCache->pUserAuth = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
if (NULL == pMetaCache->pUserAuth) {
return TSDB_CODE_OUT_OF_MEMORY;
}
}
+ bool pass = false;
+ return taosHashPut(pMetaCache->pUserAuth, pKey, len, &pass, sizeof(pass));
+}
+
+int32_t reserveUserAuthInCache(int32_t acctId, const char* pUser, const char* pDb, AUTH_TYPE type,
+ SParseMetaCache* pMetaCache) {
char key[USER_AUTH_KEY_MAX_LEN] = {0};
int32_t len = userAuthToString(acctId, pUser, pDb, type, key);
- bool pass = false;
- return taosHashPut(pMetaCache->pUserAuth, key, len, &pass, sizeof(pass));
+ return reserveUserAuthInCacheImpl(key, len, pMetaCache);
+}
+
+int32_t reserveUserAuthInCacheExt(const char* pUser, const SName* pName, AUTH_TYPE type, SParseMetaCache* pMetaCache) {
+ char dbFName[TSDB_DB_FNAME_LEN] = {0};
+ tNameGetFullDbName(pName, dbFName);
+ char key[USER_AUTH_KEY_MAX_LEN] = {0};
+ int32_t len = userAuthToStringExt(pUser, dbFName, type, key);
+ return reserveUserAuthInCacheImpl(key, len, pMetaCache);
}
int32_t getUserAuthFromCache(SParseMetaCache* pMetaCache, const char* pUser, const char* pDbFName, AUTH_TYPE type,
diff --git a/source/libs/parser/src/parser.c b/source/libs/parser/src/parser.c
index 54aa9c642cfb9cf4c580addf374f3a91907dd56a..bb70458f983832533fe8fa18ab58b58ca38558a6 100644
--- a/source/libs/parser/src/parser.c
+++ b/source/libs/parser/src/parser.c
@@ -34,7 +34,7 @@ bool qIsInsertSql(const char* pStr, size_t length) {
} while (1);
}
-static int32_t semanticAnalysis(SParseContext* pCxt, SQuery* pQuery) {
+static int32_t analyseSemantic(SParseContext* pCxt, SQuery* pQuery) {
int32_t code = authenticate(pCxt, pQuery);
if (TSDB_CODE_SUCCESS == code && pQuery->placeholderNum > 0) {
@@ -54,12 +54,12 @@ static int32_t semanticAnalysis(SParseContext* pCxt, SQuery* pQuery) {
static int32_t parseSqlIntoAst(SParseContext* pCxt, SQuery** pQuery) {
int32_t code = parse(pCxt, pQuery);
if (TSDB_CODE_SUCCESS == code) {
- code = semanticAnalysis(pCxt, *pQuery);
+ code = analyseSemantic(pCxt, *pQuery);
}
return code;
}
-static int32_t syntaxParseSql(SParseContext* pCxt, SQuery** pQuery) {
+static int32_t parseSqlSyntax(SParseContext* pCxt, SQuery** pQuery) {
int32_t code = parse(pCxt, pQuery);
if (TSDB_CODE_SUCCESS == code) {
code = collectMetaKey(pCxt, *pQuery);
@@ -192,12 +192,12 @@ int32_t qParseSql(SParseContext* pCxt, SQuery** pQuery) {
return code;
}
-int32_t qSyntaxParseSql(SParseContext* pCxt, SQuery** pQuery, struct SCatalogReq* pCatalogReq) {
+int32_t qParseSqlSyntax(SParseContext* pCxt, SQuery** pQuery, struct SCatalogReq* pCatalogReq) {
int32_t code = TSDB_CODE_SUCCESS;
if (qIsInsertSql(pCxt->pSql, pCxt->sqlLen)) {
- // todo insert sql
+ code = parseInsertSyntax(pCxt, pQuery);
} else {
- code = syntaxParseSql(pCxt, pQuery);
+ code = parseSqlSyntax(pCxt, pQuery);
}
if (TSDB_CODE_SUCCESS == code) {
code = buildCatalogReq((*pQuery)->pMetaCache, pCatalogReq);
@@ -206,13 +206,13 @@ int32_t qSyntaxParseSql(SParseContext* pCxt, SQuery** pQuery, struct SCatalogReq
return code;
}
-int32_t qSemanticAnalysisSql(SParseContext* pCxt, const struct SCatalogReq* pCatalogReq,
- const struct SMetaData* pMetaData, SQuery* pQuery) {
+int32_t qAnalyseSqlSemantic(SParseContext* pCxt, const struct SCatalogReq* pCatalogReq,
+ const struct SMetaData* pMetaData, SQuery* pQuery) {
int32_t code = putMetaDataToCache(pCatalogReq, pMetaData, pQuery->pMetaCache);
if (NULL == pQuery->pRoot) {
- // todo insert sql
+ return parseInsertSql(pCxt, &pQuery);
}
- return semanticAnalysis(pCxt, pQuery);
+ return analyseSemantic(pCxt, pQuery);
}
void qDestroyQuery(SQuery* pQueryNode) { nodesDestroyNode(pQueryNode); }
diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c
index 262abac54bbd1c1ea9847c05507bb13fdedb0462..775702a5c672455058fbfe436df3f6bcf739c1c4 100644
--- a/source/libs/parser/src/sql.c
+++ b/source/libs/parser/src/sql.c
@@ -100,25 +100,25 @@
#endif
/************* Begin control #defines *****************************************/
#define YYCODETYPE unsigned short int
-#define YYNOCODE 361
+#define YYNOCODE 360
#define YYACTIONTYPE unsigned short int
#define ParseTOKENTYPE SToken
typedef union {
int yyinit;
ParseTOKENTYPE yy0;
- EFillMode yy18;
- SAlterOption yy25;
- SToken yy53;
- EOperatorType yy136;
- int32_t yy158;
- ENullOrder yy185;
- SNodeList* yy236;
- EJoinType yy342;
- EOrder yy430;
- int64_t yy435;
- SDataType yy450;
- bool yy603;
- SNode* yy636;
+ EFillMode yy54;
+ int32_t yy100;
+ bool yy137;
+ int64_t yy189;
+ SToken yy209;
+ ENullOrder yy217;
+ SDataType yy304;
+ EOperatorType yy380;
+ SNodeList* yy424;
+ EOrder yy578;
+ SAlterOption yy605;
+ EJoinType yy612;
+ SNode* yy632;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
@@ -135,16 +135,16 @@ typedef union {
#define ParseCTX_STORE
#define YYFALLBACK 1
#define YYNSTATE 611
-#define YYNRULE 455
-#define YYNTOKEN 240
+#define YYNRULE 454
+#define YYNTOKEN 239
#define YY_MAX_SHIFT 610
-#define YY_MIN_SHIFTREDUCE 901
-#define YY_MAX_SHIFTREDUCE 1355
-#define YY_ERROR_ACTION 1356
-#define YY_ACCEPT_ACTION 1357
-#define YY_NO_ACTION 1358
-#define YY_MIN_REDUCE 1359
-#define YY_MAX_REDUCE 1813
+#define YY_MIN_SHIFTREDUCE 900
+#define YY_MAX_SHIFTREDUCE 1353
+#define YY_ERROR_ACTION 1354
+#define YY_ACCEPT_ACTION 1355
+#define YY_NO_ACTION 1356
+#define YY_MIN_REDUCE 1357
+#define YY_MAX_REDUCE 1810
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
@@ -211,604 +211,622 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
-#define YY_ACTTAB_COUNT (2153)
+#define YY_ACTTAB_COUNT (2213)
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 386, 1647, 387, 1391, 295, 394, 524, 387, 1391, 28,
- /* 10 */ 226, 931, 35, 33, 130, 1676, 1371, 1660, 104, 1791,
- /* 20 */ 304, 1644, 1169, 477, 523, 424, 36, 34, 32, 31,
- /* 30 */ 30, 385, 1790, 62, 389, 1490, 1788, 1640, 1646, 36,
- /* 40 */ 34, 32, 31, 30, 1535, 1676, 108, 1167, 527, 935,
- /* 50 */ 936, 294, 1000, 508, 524, 1485, 1533, 154, 14, 476,
- /* 60 */ 35, 33, 1296, 507, 1175, 24, 350, 1630, 304, 1002,
- /* 70 */ 1169, 1418, 277, 488, 523, 36, 34, 32, 31, 30,
- /* 80 */ 56, 1, 60, 1490, 1689, 59, 524, 80, 1661, 510,
- /* 90 */ 1663, 1664, 506, 1359, 527, 1167, 1207, 1729, 104, 603,
- /* 100 */ 602, 276, 1725, 607, 1258, 429, 14, 36, 34, 32,
- /* 110 */ 31, 30, 1175, 1791, 1168, 1490, 140, 103, 102, 101,
- /* 120 */ 100, 99, 98, 97, 96, 95, 147, 376, 1529, 2,
- /* 130 */ 1788, 583, 582, 581, 319, 39, 580, 579, 578, 114,
- /* 140 */ 573, 572, 571, 570, 569, 568, 567, 566, 121, 562,
- /* 150 */ 511, 607, 1568, 307, 1259, 55, 1580, 55, 1170, 156,
- /* 160 */ 94, 1791, 1168, 93, 92, 91, 90, 89, 88, 87,
- /* 170 */ 86, 85, 158, 157, 146, 352, 1264, 1352, 1788, 393,
- /* 180 */ 1173, 1174, 389, 1220, 1221, 1223, 1224, 1225, 1226, 1227,
- /* 190 */ 503, 525, 1235, 1236, 1237, 1238, 1239, 1240, 1468, 36,
- /* 200 */ 34, 32, 31, 30, 64, 292, 1170, 131, 191, 274,
- /* 210 */ 148, 1447, 27, 302, 1253, 1254, 1255, 1256, 1257, 1261,
- /* 220 */ 1262, 1263, 1421, 36, 34, 32, 31, 30, 1173, 1174,
- /* 230 */ 484, 1220, 1221, 1223, 1224, 1225, 1226, 1227, 503, 525,
- /* 240 */ 1235, 1236, 1237, 1238, 1239, 1240, 35, 33, 1467, 948,
- /* 250 */ 70, 947, 438, 437, 304, 403, 1169, 436, 1351, 112,
- /* 260 */ 109, 433, 308, 1791, 432, 431, 430, 35, 33, 1310,
- /* 270 */ 128, 1483, 1660, 403, 523, 304, 1789, 1169, 949, 1492,
- /* 280 */ 1788, 1167, 438, 437, 148, 1193, 148, 436, 62, 972,
- /* 290 */ 109, 433, 14, 1207, 432, 431, 430, 110, 1175, 1360,
- /* 300 */ 1676, 1303, 1167, 1382, 1660, 524, 973, 1193, 508, 524,
- /* 310 */ 1486, 486, 142, 1736, 1737, 2, 1741, 351, 507, 1175,
- /* 320 */ 94, 361, 1630, 93, 92, 91, 90, 89, 88, 87,
- /* 330 */ 86, 85, 1676, 1381, 1490, 38, 8, 607, 1490, 1689,
- /* 340 */ 487, 559, 82, 1661, 510, 1663, 1664, 506, 1168, 527,
- /* 350 */ 507, 1191, 1729, 1630, 1630, 1535, 1728, 1725, 607, 128,
- /* 360 */ 558, 557, 309, 556, 555, 554, 1380, 1533, 1493, 1168,
- /* 370 */ 565, 1689, 1462, 1535, 81, 1661, 510, 1663, 1664, 506,
- /* 380 */ 315, 527, 524, 1630, 1729, 1533, 1743, 26, 297, 1725,
- /* 390 */ 141, 478, 1170, 54, 362, 435, 434, 36, 34, 32,
- /* 400 */ 31, 30, 218, 36, 34, 32, 31, 30, 466, 1756,
- /* 410 */ 1740, 1490, 55, 1170, 1173, 1174, 1630, 1220, 1221, 1223,
- /* 420 */ 1224, 1225, 1226, 1227, 503, 525, 1235, 1236, 1237, 1238,
- /* 430 */ 1239, 1240, 460, 577, 575, 1173, 1174, 1379, 1220, 1221,
- /* 440 */ 1223, 1224, 1225, 1226, 1227, 503, 525, 1235, 1236, 1237,
- /* 450 */ 1238, 1239, 1240, 35, 33, 1241, 1378, 443, 1195, 610,
- /* 460 */ 316, 304, 1377, 1169, 148, 148, 249, 1571, 1573, 1520,
- /* 470 */ 1246, 1222, 451, 243, 35, 33, 1193, 1481, 1376, 1660,
- /* 480 */ 1647, 461, 304, 312, 1169, 105, 190, 1630, 1167, 524,
- /* 490 */ 473, 599, 595, 591, 587, 242, 391, 1644, 446, 1357,
- /* 500 */ 1644, 402, 1191, 440, 561, 1175, 1630, 1676, 189, 1167,
- /* 510 */ 337, 484, 1630, 1640, 1646, 508, 1640, 1646, 1490, 484,
- /* 520 */ 78, 1791, 9, 237, 527, 507, 1175, 527, 1630, 1630,
- /* 530 */ 339, 335, 564, 51, 145, 488, 50, 127, 1788, 511,
- /* 540 */ 112, 148, 576, 9, 607, 1581, 1689, 1194, 112, 80,
- /* 550 */ 1661, 510, 1663, 1664, 506, 1168, 527, 520, 320, 1729,
- /* 560 */ 1375, 479, 474, 276, 1725, 607, 36, 34, 32, 31,
- /* 570 */ 30, 1648, 1130, 314, 1479, 1791, 1168, 428, 110, 553,
- /* 580 */ 1132, 128, 465, 340, 217, 198, 110, 1465, 145, 55,
- /* 590 */ 1492, 1644, 1788, 143, 1736, 1737, 77, 1741, 1791, 1170,
- /* 600 */ 427, 144, 1736, 1737, 1146, 1741, 193, 1640, 1646, 113,
- /* 610 */ 1630, 145, 277, 1572, 1573, 1788, 490, 1482, 527, 1295,
- /* 620 */ 1170, 1173, 1174, 1374, 1220, 1221, 1223, 1224, 1225, 1226,
- /* 630 */ 1227, 503, 525, 1235, 1236, 1237, 1238, 1239, 1240, 286,
- /* 640 */ 1222, 1131, 1173, 1174, 1258, 1220, 1221, 1223, 1224, 1225,
- /* 650 */ 1226, 1227, 503, 525, 1235, 1236, 1237, 1238, 1239, 1240,
- /* 660 */ 35, 33, 273, 559, 1191, 345, 1320, 344, 304, 524,
- /* 670 */ 1169, 369, 524, 1630, 381, 32, 31, 30, 1748, 1291,
- /* 680 */ 559, 1487, 558, 557, 1610, 556, 555, 554, 287, 7,
- /* 690 */ 285, 284, 382, 426, 1259, 1167, 947, 428, 1490, 558,
- /* 700 */ 557, 1490, 556, 555, 554, 470, 1318, 1319, 1321, 1322,
- /* 710 */ 1535, 317, 1175, 11, 10, 1373, 1264, 1743, 148, 128,
- /* 720 */ 427, 422, 1534, 935, 936, 1743, 1154, 1155, 1492, 2,
- /* 730 */ 1038, 550, 549, 548, 1042, 547, 1044, 1045, 546, 1047,
- /* 740 */ 543, 1739, 1053, 540, 1055, 1056, 537, 534, 346, 1738,
- /* 750 */ 1370, 607, 27, 302, 1253, 1254, 1255, 1256, 1257, 1261,
- /* 760 */ 1262, 1263, 1168, 380, 1466, 1630, 375, 374, 373, 372,
- /* 770 */ 371, 368, 367, 366, 365, 364, 360, 359, 358, 357,
- /* 780 */ 356, 355, 354, 353, 524, 524, 129, 524, 1791, 1196,
- /* 790 */ 492, 255, 1192, 1193, 1272, 1260, 521, 522, 1475, 239,
- /* 800 */ 1630, 145, 1369, 253, 53, 1788, 1170, 52, 1368, 1367,
- /* 810 */ 1366, 452, 1365, 1490, 1490, 1364, 1490, 1265, 524, 1363,
- /* 820 */ 1660, 561, 1362, 47, 159, 275, 1294, 1477, 1173, 1174,
- /* 830 */ 318, 1220, 1221, 1223, 1224, 1225, 1226, 1227, 503, 525,
- /* 840 */ 1235, 1236, 1237, 1238, 1239, 1240, 495, 1490, 1676, 55,
- /* 850 */ 1473, 1791, 1630, 25, 1619, 194, 487, 1408, 1630, 1630,
- /* 860 */ 1630, 1291, 1630, 1403, 145, 1630, 507, 1401, 1788, 1630,
- /* 870 */ 1630, 182, 1630, 184, 180, 186, 183, 188, 185, 439,
- /* 880 */ 187, 1660, 500, 450, 502, 441, 79, 1689, 76, 444,
- /* 890 */ 81, 1661, 510, 1663, 1664, 506, 448, 527, 72, 327,
- /* 900 */ 1729, 11, 10, 552, 297, 1725, 141, 1372, 459, 1676,
- /* 910 */ 1354, 1355, 1650, 1448, 1660, 202, 1178, 508, 58, 57,
- /* 920 */ 349, 118, 46, 153, 471, 1757, 1177, 507, 343, 205,
- /* 930 */ 221, 1630, 37, 37, 37, 453, 212, 1677, 1392, 228,
- /* 940 */ 272, 421, 1676, 333, 1530, 329, 325, 150, 1689, 1652,
- /* 950 */ 508, 81, 1661, 510, 1663, 1664, 506, 1222, 527, 1759,
- /* 960 */ 507, 1729, 462, 1317, 1630, 297, 1725, 1804, 1191, 116,
- /* 970 */ 207, 117, 485, 1266, 1228, 1124, 1763, 493, 148, 1660,
- /* 980 */ 230, 1689, 220, 1181, 81, 1661, 510, 1663, 1664, 506,
- /* 990 */ 223, 527, 118, 1180, 1729, 1660, 46, 532, 297, 1725,
- /* 1000 */ 1804, 322, 117, 225, 1250, 3, 118, 1676, 326, 1786,
- /* 1010 */ 516, 282, 236, 1000, 283, 508, 119, 117, 244, 155,
- /* 1020 */ 1138, 363, 370, 1676, 1570, 507, 378, 1660, 377, 1630,
- /* 1030 */ 379, 508, 383, 1031, 1197, 496, 384, 248, 1059, 392,
- /* 1040 */ 1200, 507, 395, 1063, 162, 1630, 1689, 1070, 396, 82,
- /* 1050 */ 1661, 510, 1663, 1664, 506, 1676, 527, 1068, 120, 1729,
- /* 1060 */ 1199, 164, 1689, 508, 1726, 81, 1661, 510, 1663, 1664,
- /* 1070 */ 506, 1201, 527, 507, 397, 1729, 398, 1630, 1660, 297,
- /* 1080 */ 1725, 1804, 167, 488, 399, 169, 1198, 400, 401, 172,
- /* 1090 */ 1747, 61, 404, 1660, 1689, 175, 423, 262, 1661, 510,
- /* 1100 */ 1663, 1664, 506, 425, 527, 84, 1676, 1175, 1480, 179,
- /* 1110 */ 1476, 291, 181, 1614, 508, 122, 123, 1478, 1474, 124,
- /* 1120 */ 125, 1676, 245, 1791, 507, 192, 455, 195, 1630, 508,
- /* 1130 */ 246, 197, 454, 464, 488, 463, 147, 200, 1196, 507,
- /* 1140 */ 1788, 458, 472, 1630, 1660, 1689, 1770, 203, 262, 1661,
- /* 1150 */ 510, 1663, 1664, 506, 514, 527, 6, 1750, 469, 1769,
- /* 1160 */ 1689, 211, 481, 82, 1661, 510, 1663, 1664, 506, 206,
- /* 1170 */ 527, 1760, 1676, 1729, 1791, 296, 475, 499, 1725, 1195,
- /* 1180 */ 505, 468, 5, 1291, 111, 40, 497, 145, 1744, 1807,
- /* 1190 */ 507, 1788, 298, 18, 1630, 512, 1660, 513, 494, 306,
- /* 1200 */ 311, 310, 1579, 135, 1578, 1660, 214, 517, 518, 519,
- /* 1210 */ 1183, 1689, 213, 1787, 270, 1661, 510, 1663, 1664, 506,
- /* 1220 */ 504, 527, 501, 1701, 1676, 219, 232, 71, 491, 1710,
- /* 1230 */ 234, 247, 508, 1676, 69, 1176, 250, 1491, 241, 222,
- /* 1240 */ 606, 508, 507, 1463, 498, 48, 1630, 530, 224, 256,
- /* 1250 */ 134, 507, 1175, 1660, 263, 1630, 257, 293, 467, 252,
- /* 1260 */ 254, 1624, 1623, 1689, 321, 1620, 132, 1661, 510, 1663,
- /* 1270 */ 1664, 506, 1689, 527, 323, 271, 1661, 510, 1663, 1664,
- /* 1280 */ 506, 1676, 527, 324, 1163, 1660, 1164, 151, 1618, 508,
- /* 1290 */ 328, 528, 330, 331, 1617, 332, 334, 1616, 336, 507,
- /* 1300 */ 1615, 338, 1179, 1630, 1600, 152, 341, 1141, 342, 1140,
- /* 1310 */ 489, 1805, 1594, 1676, 1593, 347, 348, 1660, 1592, 1591,
- /* 1320 */ 1689, 508, 1107, 266, 1661, 510, 1663, 1664, 506, 1563,
- /* 1330 */ 527, 507, 1562, 1561, 1560, 1630, 1559, 1558, 1557, 1556,
- /* 1340 */ 1555, 1554, 1553, 1552, 1551, 1676, 1184, 1550, 1549, 1548,
- /* 1350 */ 1547, 1546, 1689, 508, 1545, 132, 1661, 510, 1663, 1664,
- /* 1360 */ 506, 480, 527, 507, 115, 1660, 1544, 1630, 1187, 1543,
- /* 1370 */ 301, 1542, 1541, 1540, 1109, 1539, 1538, 1537, 1660, 525,
- /* 1380 */ 1235, 1236, 1536, 1420, 1689, 1388, 160, 271, 1661, 510,
- /* 1390 */ 1663, 1664, 506, 1676, 527, 938, 106, 138, 937, 388,
- /* 1400 */ 1806, 505, 1387, 161, 390, 107, 1676, 1608, 1602, 1586,
- /* 1410 */ 1585, 507, 1576, 1469, 508, 1630, 166, 171, 1660, 1419,
- /* 1420 */ 966, 1417, 1415, 407, 507, 405, 1413, 411, 1630, 415,
- /* 1430 */ 1411, 303, 1689, 419, 406, 270, 1661, 510, 1663, 1664,
- /* 1440 */ 506, 409, 527, 410, 1702, 1689, 1676, 413, 271, 1661,
- /* 1450 */ 510, 1663, 1664, 506, 508, 527, 414, 1400, 177, 1399,
- /* 1460 */ 418, 417, 1386, 1471, 507, 1074, 1660, 1470, 1630, 1073,
- /* 1470 */ 139, 305, 574, 576, 999, 1169, 420, 416, 412, 408,
- /* 1480 */ 176, 45, 998, 178, 997, 1689, 996, 993, 271, 1661,
- /* 1490 */ 510, 1663, 1664, 506, 1676, 527, 992, 991, 1409, 288,
- /* 1500 */ 1167, 1404, 508, 289, 442, 63, 1402, 290, 174, 1385,
- /* 1510 */ 447, 445, 507, 1384, 449, 83, 1630, 1175, 1607, 1148,
- /* 1520 */ 49, 1601, 456, 1660, 1584, 126, 1583, 1575, 199, 65,
- /* 1530 */ 196, 4, 133, 1689, 201, 37, 258, 1661, 510, 1663,
- /* 1540 */ 1664, 506, 204, 527, 15, 457, 43, 1316, 1309, 208,
- /* 1550 */ 22, 1676, 209, 23, 210, 66, 607, 1288, 1650, 508,
- /* 1560 */ 1287, 216, 1345, 42, 136, 41, 173, 1168, 165, 507,
- /* 1570 */ 170, 1660, 168, 1630, 17, 1340, 1339, 16, 13, 1334,
- /* 1580 */ 10, 299, 1344, 1343, 300, 1251, 19, 137, 149, 1230,
- /* 1590 */ 1689, 163, 1215, 265, 1661, 510, 1663, 1664, 506, 1676,
- /* 1600 */ 527, 1660, 509, 1574, 29, 515, 12, 508, 1649, 233,
- /* 1610 */ 72, 1170, 1229, 20, 235, 1185, 531, 507, 238, 21,
- /* 1620 */ 229, 1630, 227, 529, 1314, 964, 313, 231, 67, 1676,
- /* 1630 */ 68, 1660, 1692, 1173, 1174, 1232, 526, 508, 1689, 44,
- /* 1640 */ 533, 267, 1661, 510, 1663, 1664, 506, 507, 527, 1060,
- /* 1650 */ 1057, 1630, 535, 538, 536, 541, 544, 1054, 539, 1676,
- /* 1660 */ 1037, 1052, 1048, 542, 1069, 1046, 545, 508, 1689, 551,
- /* 1670 */ 1051, 259, 1661, 510, 1663, 1664, 506, 507, 527, 1660,
- /* 1680 */ 73, 1630, 74, 75, 1066, 1065, 1050, 560, 1660, 1049,
- /* 1690 */ 988, 1006, 563, 240, 986, 985, 984, 983, 1689, 981,
- /* 1700 */ 1067, 268, 1661, 510, 1663, 1664, 506, 1676, 527, 982,
- /* 1710 */ 1003, 980, 979, 1001, 976, 508, 1676, 975, 974, 971,
- /* 1720 */ 970, 969, 1416, 584, 508, 507, 585, 586, 1414, 1630,
- /* 1730 */ 588, 589, 590, 1412, 507, 592, 1660, 593, 1630, 594,
- /* 1740 */ 1410, 596, 597, 598, 1398, 600, 1689, 601, 1397, 260,
- /* 1750 */ 1661, 510, 1663, 1664, 506, 1689, 527, 1383, 269, 1661,
- /* 1760 */ 510, 1663, 1664, 506, 1676, 527, 609, 604, 605, 1358,
- /* 1770 */ 1358, 1171, 508, 251, 608, 1358, 1358, 1358, 1358, 1358,
- /* 1780 */ 1358, 1358, 507, 1358, 1660, 1358, 1630, 1358, 1358, 1358,
- /* 1790 */ 1358, 1358, 1358, 1358, 1358, 1660, 1358, 1358, 1358, 1358,
- /* 1800 */ 1358, 1358, 1358, 1689, 1358, 1358, 261, 1661, 510, 1663,
- /* 1810 */ 1664, 506, 1676, 527, 1660, 1358, 1358, 1358, 1358, 1358,
- /* 1820 */ 508, 1358, 1358, 1676, 1358, 1358, 1358, 1358, 1358, 1358,
- /* 1830 */ 507, 508, 1358, 1358, 1630, 1358, 1358, 1358, 1358, 1358,
- /* 1840 */ 1358, 507, 1676, 1358, 1358, 1630, 1358, 1358, 1358, 1358,
- /* 1850 */ 508, 1689, 1358, 1358, 1672, 1661, 510, 1663, 1664, 506,
- /* 1860 */ 507, 527, 1689, 1358, 1630, 1671, 1661, 510, 1663, 1664,
- /* 1870 */ 506, 1358, 527, 1660, 1358, 1358, 1358, 1358, 1358, 1358,
- /* 1880 */ 1358, 1689, 1660, 1358, 1670, 1661, 510, 1663, 1664, 506,
- /* 1890 */ 1358, 527, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358,
- /* 1900 */ 1358, 1676, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 508,
- /* 1910 */ 1676, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 508, 507,
- /* 1920 */ 1358, 1358, 1358, 1630, 1358, 1358, 1358, 1358, 507, 1358,
- /* 1930 */ 1358, 1358, 1630, 1358, 1358, 1358, 1358, 1358, 1358, 1358,
- /* 1940 */ 1689, 1358, 1660, 280, 1661, 510, 1663, 1664, 506, 1689,
- /* 1950 */ 527, 1660, 279, 1661, 510, 1663, 1664, 506, 1358, 527,
- /* 1960 */ 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358,
- /* 1970 */ 1676, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 508, 1676,
- /* 1980 */ 1358, 1358, 1358, 1358, 1358, 1358, 1358, 508, 507, 1358,
- /* 1990 */ 1358, 1358, 1630, 1358, 1358, 1358, 1358, 507, 1358, 1660,
- /* 2000 */ 1358, 1630, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1689,
- /* 2010 */ 484, 1358, 281, 1661, 510, 1663, 1664, 506, 1689, 527,
- /* 2020 */ 1358, 278, 1661, 510, 1663, 1664, 506, 1676, 527, 1358,
- /* 2030 */ 1358, 1358, 1358, 1358, 1358, 508, 1358, 1358, 1358, 112,
- /* 2040 */ 1358, 1358, 1358, 1358, 1358, 507, 484, 1358, 1358, 1630,
- /* 2050 */ 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 488,
- /* 2060 */ 1358, 1358, 1358, 1358, 1358, 1358, 1689, 1358, 1358, 264,
- /* 2070 */ 1661, 510, 1663, 1664, 506, 112, 527, 110, 1358, 1358,
- /* 2080 */ 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358,
- /* 2090 */ 1358, 1358, 215, 1736, 483, 488, 482, 1358, 1358, 1791,
- /* 2100 */ 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358,
- /* 2110 */ 1358, 1358, 147, 110, 1358, 1358, 1788, 1358, 1358, 1358,
- /* 2120 */ 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 215, 1736,
- /* 2130 */ 483, 1358, 482, 1358, 1358, 1791, 1358, 1358, 1358, 1358,
- /* 2140 */ 1358, 1358, 1358, 1358, 1358, 1358, 1358, 1358, 145, 1358,
- /* 2150 */ 1358, 1358, 1788,
+ /* 0 */ 386, 1644, 387, 1389, 295, 394, 525, 387, 1389, 1740,
+ /* 10 */ 62, 930, 35, 33, 28, 226, 1477, 1657, 104, 1479,
+ /* 20 */ 304, 1641, 1167, 108, 1532, 425, 36, 34, 32, 31,
+ /* 30 */ 30, 294, 1483, 1737, 1355, 1488, 1530, 1637, 1643, 1641,
+ /* 40 */ 36, 34, 32, 31, 30, 1673, 524, 1165, 528, 934,
+ /* 50 */ 935, 524, 77, 509, 485, 1637, 1643, 947, 14, 946,
+ /* 60 */ 35, 33, 1294, 508, 1173, 113, 528, 1627, 304, 524,
+ /* 70 */ 1167, 352, 277, 1480, 36, 34, 32, 31, 30, 512,
+ /* 80 */ 404, 1, 307, 112, 1686, 1577, 948, 82, 1658, 511,
+ /* 90 */ 1660, 1661, 507, 320, 528, 1165, 1205, 1726, 1657, 1380,
+ /* 100 */ 1191, 1725, 1722, 607, 1256, 274, 14, 39, 35, 33,
+ /* 110 */ 603, 602, 1173, 1166, 385, 1788, 304, 389, 1167, 1644,
+ /* 120 */ 277, 110, 312, 1673, 55, 999, 1673, 1645, 1787, 2,
+ /* 130 */ 38, 478, 1785, 1788, 509, 487, 142, 1733, 1734, 1641,
+ /* 140 */ 1738, 55, 1001, 1165, 508, 56, 145, 1641, 1627, 1627,
+ /* 150 */ 1785, 607, 1256, 1257, 14, 1637, 1643, 62, 1168, 1465,
+ /* 160 */ 1173, 1166, 479, 1637, 1643, 1686, 528, 477, 256, 1658,
+ /* 170 */ 511, 1660, 1661, 507, 528, 528, 1262, 2, 1350, 1484,
+ /* 180 */ 1171, 1172, 376, 1218, 1219, 1221, 1222, 1223, 1224, 1225,
+ /* 190 */ 504, 526, 1233, 1234, 1235, 1236, 1237, 1238, 1192, 607,
+ /* 200 */ 345, 1257, 344, 64, 292, 1379, 1168, 191, 429, 1166,
+ /* 210 */ 148, 1189, 27, 302, 1251, 1252, 1253, 1254, 1255, 1259,
+ /* 220 */ 1260, 1261, 55, 130, 1262, 1369, 158, 157, 1171, 1172,
+ /* 230 */ 428, 1218, 1219, 1221, 1222, 1223, 1224, 1225, 504, 526,
+ /* 240 */ 1233, 1234, 1235, 1236, 1237, 1238, 1416, 36, 34, 32,
+ /* 250 */ 31, 30, 559, 148, 1168, 1627, 1406, 1318, 1349, 148,
+ /* 260 */ 27, 302, 1251, 1252, 1253, 1254, 1255, 1259, 1260, 1261,
+ /* 270 */ 148, 558, 55, 557, 556, 555, 1171, 1172, 440, 1218,
+ /* 280 */ 1219, 1221, 1222, 1223, 1224, 1225, 504, 526, 1233, 1234,
+ /* 290 */ 1235, 1236, 1237, 1238, 35, 33, 471, 1316, 1317, 1319,
+ /* 300 */ 1320, 131, 304, 154, 1167, 1445, 583, 582, 581, 319,
+ /* 310 */ 561, 580, 579, 578, 114, 573, 572, 571, 570, 569,
+ /* 320 */ 568, 567, 566, 121, 562, 1193, 559, 1466, 60, 1165,
+ /* 330 */ 94, 59, 1657, 93, 92, 91, 90, 89, 88, 87,
+ /* 340 */ 86, 85, 35, 33, 1239, 558, 1173, 557, 556, 555,
+ /* 350 */ 304, 148, 1167, 439, 438, 32, 31, 30, 437, 554,
+ /* 360 */ 1673, 109, 434, 8, 1301, 433, 432, 431, 509, 140,
+ /* 370 */ 1191, 36, 34, 32, 31, 30, 1788, 1165, 508, 1788,
+ /* 380 */ 127, 1526, 1627, 393, 404, 607, 389, 1190, 474, 146,
+ /* 390 */ 35, 33, 1786, 1785, 1173, 1166, 1785, 451, 304, 1686,
+ /* 400 */ 1167, 148, 132, 1658, 511, 1660, 1661, 507, 1740, 528,
+ /* 410 */ 449, 9, 436, 435, 1037, 551, 550, 549, 1041, 548,
+ /* 420 */ 1043, 1044, 547, 1046, 544, 1165, 1052, 541, 1054, 1055,
+ /* 430 */ 538, 535, 1736, 607, 1419, 36, 34, 32, 31, 30,
+ /* 440 */ 1168, 1308, 1173, 1166, 24, 316, 490, 1802, 249, 461,
+ /* 450 */ 217, 1518, 1568, 1570, 36, 34, 32, 31, 30, 9,
+ /* 460 */ 480, 475, 1171, 1172, 485, 1218, 1219, 1221, 1222, 1223,
+ /* 470 */ 1224, 1225, 504, 526, 1233, 1234, 1235, 1236, 1237, 1238,
+ /* 480 */ 1378, 607, 36, 34, 32, 31, 30, 1473, 1168, 1532,
+ /* 490 */ 1565, 1166, 148, 112, 439, 438, 309, 156, 462, 437,
+ /* 500 */ 346, 1530, 109, 434, 1463, 1205, 433, 432, 431, 1194,
+ /* 510 */ 1171, 1172, 485, 1218, 1219, 1221, 1222, 1223, 1224, 1225,
+ /* 520 */ 504, 526, 1233, 1234, 1235, 1236, 1237, 1238, 11, 10,
+ /* 530 */ 1627, 110, 1532, 1258, 1220, 946, 1168, 308, 1788, 315,
+ /* 540 */ 1788, 112, 577, 575, 1530, 128, 143, 1733, 1734, 1377,
+ /* 550 */ 1738, 145, 286, 145, 1490, 1785, 1263, 1785, 1171, 1172,
+ /* 560 */ 423, 1218, 1219, 1221, 1222, 1223, 1224, 1225, 504, 526,
+ /* 570 */ 1233, 1234, 1235, 1236, 1237, 1238, 35, 33, 273, 110,
+ /* 580 */ 1189, 1128, 1569, 1570, 304, 1657, 1167, 369, 525, 1130,
+ /* 590 */ 381, 1740, 25, 525, 144, 1733, 1734, 559, 1738, 1627,
+ /* 600 */ 104, 287, 7, 285, 284, 350, 427, 430, 382, 1270,
+ /* 610 */ 429, 1165, 1358, 1673, 1376, 1735, 558, 1488, 557, 556,
+ /* 620 */ 555, 509, 1488, 1244, 512, 1375, 337, 1475, 1173, 1191,
+ /* 630 */ 1578, 508, 428, 94, 202, 1627, 93, 92, 91, 90,
+ /* 640 */ 89, 88, 87, 86, 85, 2, 339, 335, 391, 1464,
+ /* 650 */ 1129, 70, 1686, 1191, 1189, 81, 1658, 511, 1660, 1661,
+ /* 660 */ 507, 453, 528, 564, 1627, 1726, 565, 607, 1460, 297,
+ /* 670 */ 1722, 1801, 1481, 1374, 1471, 1627, 54, 1166, 380, 493,
+ /* 680 */ 1760, 375, 374, 373, 372, 371, 368, 367, 366, 365,
+ /* 690 */ 364, 360, 359, 358, 357, 356, 355, 354, 353, 26,
+ /* 700 */ 1167, 1788, 576, 610, 525, 501, 561, 314, 1532, 36,
+ /* 710 */ 34, 32, 31, 30, 145, 128, 351, 243, 1785, 1373,
+ /* 720 */ 1531, 128, 1168, 1627, 1490, 1165, 1372, 1293, 1371, 105,
+ /* 730 */ 1491, 194, 1368, 1488, 1657, 599, 595, 591, 587, 242,
+ /* 740 */ 934, 935, 1173, 340, 1171, 1172, 503, 1218, 1219, 1221,
+ /* 750 */ 1222, 1223, 1224, 1225, 504, 526, 1233, 1234, 1235, 1236,
+ /* 760 */ 1237, 1238, 1673, 525, 78, 525, 496, 237, 1616, 1627,
+ /* 770 */ 509, 317, 1370, 525, 1289, 361, 1627, 362, 1627, 128,
+ /* 780 */ 508, 607, 1627, 1367, 1627, 403, 485, 525, 1490, 1366,
+ /* 790 */ 489, 1166, 1488, 1220, 1488, 1365, 1745, 1289, 460, 522,
+ /* 800 */ 521, 1686, 1488, 118, 80, 1658, 511, 1660, 1661, 507,
+ /* 810 */ 1657, 528, 525, 327, 1726, 112, 1488, 1220, 276, 1722,
+ /* 820 */ 525, 76, 525, 1364, 1485, 466, 182, 1248, 198, 180,
+ /* 830 */ 1788, 72, 1607, 1627, 523, 489, 1168, 184, 1673, 1627,
+ /* 840 */ 183, 1488, 1401, 147, 463, 1627, 509, 1785, 1144, 1488,
+ /* 850 */ 193, 1488, 1363, 110, 186, 553, 508, 185, 1171, 1172,
+ /* 860 */ 1627, 1362, 1361, 1360, 442, 494, 489, 525, 215, 1733,
+ /* 870 */ 484, 1657, 483, 1627, 444, 1788, 1446, 1686, 221, 239,
+ /* 880 */ 80, 1658, 511, 1660, 1661, 507, 1399, 528, 147, 452,
+ /* 890 */ 1726, 472, 1785, 525, 276, 1722, 1488, 188, 491, 1673,
+ /* 900 */ 187, 47, 1627, 190, 275, 318, 1788, 488, 445, 129,
+ /* 910 */ 454, 1627, 1627, 1627, 255, 447, 971, 508, 212, 145,
+ /* 920 */ 441, 1627, 1488, 1785, 46, 189, 253, 53, 1152, 1153,
+ /* 930 */ 52, 1390, 1657, 972, 1292, 1176, 205, 1674, 1686, 1352,
+ /* 940 */ 1353, 81, 1658, 511, 1660, 1661, 507, 159, 528, 422,
+ /* 950 */ 51, 1726, 1527, 50, 497, 297, 1722, 141, 11, 10,
+ /* 960 */ 1673, 1357, 1175, 1756, 486, 1315, 220, 223, 488, 218,
+ /* 970 */ 37, 3, 55, 1189, 37, 467, 1753, 207, 508, 225,
+ /* 980 */ 322, 37, 1627, 1647, 228, 103, 102, 101, 100, 99,
+ /* 990 */ 98, 97, 96, 95, 326, 116, 282, 117, 999, 1686,
+ /* 1000 */ 485, 1179, 81, 1658, 511, 1660, 1661, 507, 79, 528,
+ /* 1010 */ 283, 1264, 1726, 244, 1136, 1226, 297, 1722, 141, 118,
+ /* 1020 */ 1649, 363, 1122, 46, 533, 230, 1567, 155, 1178, 112,
+ /* 1030 */ 117, 370, 118, 119, 117, 378, 517, 1754, 236, 377,
+ /* 1040 */ 383, 58, 57, 349, 1657, 379, 153, 1195, 384, 489,
+ /* 1050 */ 392, 343, 1198, 395, 162, 396, 1197, 164, 1199, 397,
+ /* 1060 */ 1030, 167, 400, 272, 248, 1058, 333, 110, 329, 325,
+ /* 1070 */ 150, 1062, 1673, 1068, 1066, 120, 169, 398, 1196, 401,
+ /* 1080 */ 509, 402, 215, 1733, 484, 172, 483, 61, 405, 1788,
+ /* 1090 */ 508, 175, 424, 426, 1627, 1478, 179, 1474, 181, 1657,
+ /* 1100 */ 122, 148, 145, 84, 123, 1476, 1785, 291, 1472, 1173,
+ /* 1110 */ 124, 1686, 1611, 125, 81, 1658, 511, 1660, 1661, 507,
+ /* 1120 */ 245, 528, 456, 192, 1726, 455, 195, 1673, 297, 1722,
+ /* 1130 */ 1801, 197, 459, 464, 465, 509, 200, 246, 1194, 1783,
+ /* 1140 */ 1757, 473, 1767, 515, 203, 508, 1766, 482, 470, 1627,
+ /* 1150 */ 1657, 6, 206, 296, 476, 1747, 135, 211, 469, 5,
+ /* 1160 */ 111, 1289, 1657, 1193, 40, 213, 1686, 495, 219, 81,
+ /* 1170 */ 1658, 511, 1660, 1661, 507, 1741, 528, 298, 1673, 1726,
+ /* 1180 */ 1804, 214, 18, 297, 1722, 1801, 509, 498, 518, 222,
+ /* 1190 */ 1673, 1707, 1576, 513, 1744, 514, 508, 1575, 509, 224,
+ /* 1200 */ 1627, 1784, 306, 492, 499, 520, 489, 519, 508, 232,
+ /* 1210 */ 234, 71, 1627, 1489, 247, 1657, 69, 1686, 489, 250,
+ /* 1220 */ 260, 1658, 511, 1660, 1661, 507, 241, 528, 1461, 1686,
+ /* 1230 */ 606, 48, 260, 1658, 511, 1660, 1661, 507, 254, 528,
+ /* 1240 */ 531, 134, 1621, 1673, 261, 271, 1788, 293, 1657, 262,
+ /* 1250 */ 252, 509, 1620, 321, 1617, 323, 324, 1161, 1788, 147,
+ /* 1260 */ 1162, 508, 151, 1785, 328, 1627, 1615, 330, 331, 332,
+ /* 1270 */ 1614, 145, 334, 1613, 336, 1785, 1673, 1612, 338, 1597,
+ /* 1280 */ 152, 341, 1686, 342, 506, 82, 1658, 511, 1660, 1661,
+ /* 1290 */ 507, 1139, 528, 1138, 508, 1726, 1591, 1590, 1627, 500,
+ /* 1300 */ 1722, 347, 348, 1589, 1588, 1105, 1657, 1560, 1559, 1558,
+ /* 1310 */ 1557, 1556, 1555, 1554, 1553, 1686, 115, 1542, 269, 1658,
+ /* 1320 */ 511, 1660, 1661, 507, 505, 528, 502, 1698, 1552, 1551,
+ /* 1330 */ 1550, 1549, 1548, 1547, 1673, 1546, 1545, 1544, 1543, 1541,
+ /* 1340 */ 1540, 1539, 509, 1538, 1537, 1107, 1536, 1535, 1534, 1533,
+ /* 1350 */ 1418, 1386, 508, 1385, 1657, 160, 1627, 106, 1605, 138,
+ /* 1360 */ 161, 107, 1599, 388, 1583, 390, 937, 1657, 1582, 936,
+ /* 1370 */ 168, 166, 1573, 1686, 1467, 1417, 82, 1658, 511, 1660,
+ /* 1380 */ 1661, 507, 1673, 528, 965, 1415, 1726, 1413, 1411, 406,
+ /* 1390 */ 509, 1723, 410, 171, 408, 1673, 412, 1409, 1398, 407,
+ /* 1400 */ 508, 1397, 1384, 509, 1627, 411, 416, 468, 414, 1469,
+ /* 1410 */ 415, 419, 1071, 508, 418, 1657, 45, 1627, 420, 1468,
+ /* 1420 */ 1072, 1686, 1407, 998, 270, 1658, 511, 1660, 1661, 507,
+ /* 1430 */ 997, 528, 574, 996, 1686, 576, 995, 265, 1658, 511,
+ /* 1440 */ 1660, 1661, 507, 1673, 528, 288, 992, 991, 1402, 289,
+ /* 1450 */ 990, 509, 443, 1400, 446, 290, 1383, 448, 178, 1382,
+ /* 1460 */ 450, 508, 83, 1604, 1146, 1627, 1657, 1598, 126, 457,
+ /* 1470 */ 1581, 1580, 49, 1572, 65, 481, 199, 1657, 4, 15,
+ /* 1480 */ 210, 37, 1686, 16, 43, 132, 1658, 511, 1660, 1661,
+ /* 1490 */ 507, 133, 528, 204, 1673, 1314, 208, 22, 209, 1647,
+ /* 1500 */ 1307, 66, 509, 23, 216, 1673, 1286, 1285, 458, 41,
+ /* 1510 */ 42, 201, 508, 506, 13, 1338, 1627, 17, 136, 301,
+ /* 1520 */ 196, 10, 1337, 508, 299, 1657, 1343, 1627, 1332, 1342,
+ /* 1530 */ 1803, 1341, 300, 1686, 19, 29, 270, 1658, 511, 1660,
+ /* 1540 */ 1661, 507, 137, 528, 1686, 149, 1228, 269, 1658, 511,
+ /* 1550 */ 1660, 1661, 507, 1673, 528, 1213, 1699, 1249, 1657, 1571,
+ /* 1560 */ 1227, 509, 12, 233, 510, 1646, 238, 20, 21, 516,
+ /* 1570 */ 227, 508, 1312, 229, 235, 1627, 231, 67, 303, 1230,
+ /* 1580 */ 68, 1689, 72, 527, 1183, 44, 1673, 1059, 532, 313,
+ /* 1590 */ 1056, 534, 1686, 536, 509, 270, 1658, 511, 1660, 1661,
+ /* 1600 */ 507, 530, 528, 539, 508, 537, 1036, 1053, 1627, 540,
+ /* 1610 */ 542, 305, 1047, 543, 545, 1067, 1045, 546, 73, 1051,
+ /* 1620 */ 1050, 1657, 1049, 1048, 552, 1686, 177, 560, 270, 1658,
+ /* 1630 */ 511, 1660, 1661, 507, 1657, 528, 74, 1064, 139, 75,
+ /* 1640 */ 1065, 963, 987, 1005, 421, 417, 413, 409, 176, 1673,
+ /* 1650 */ 563, 240, 980, 985, 984, 983, 982, 509, 981, 979,
+ /* 1660 */ 978, 1002, 1673, 1000, 975, 974, 973, 508, 970, 969,
+ /* 1670 */ 509, 1627, 968, 63, 1657, 1414, 174, 585, 584, 586,
+ /* 1680 */ 508, 1412, 588, 589, 1627, 590, 1410, 592, 1686, 593,
+ /* 1690 */ 594, 264, 1658, 511, 1660, 1661, 507, 1408, 528, 596,
+ /* 1700 */ 597, 1686, 1673, 598, 266, 1658, 511, 1660, 1661, 507,
+ /* 1710 */ 509, 528, 1396, 1395, 600, 601, 1381, 604, 1169, 605,
+ /* 1720 */ 508, 251, 608, 609, 1627, 1657, 1356, 1356, 1356, 1356,
+ /* 1730 */ 1356, 1356, 1356, 173, 1356, 165, 1356, 170, 1356, 399,
+ /* 1740 */ 1356, 1686, 1356, 1356, 257, 1658, 511, 1660, 1661, 507,
+ /* 1750 */ 1356, 528, 1356, 1673, 1356, 1657, 1356, 1356, 1356, 163,
+ /* 1760 */ 1356, 509, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
+ /* 1770 */ 1356, 508, 1356, 1356, 1356, 1627, 1356, 1356, 1356, 1356,
+ /* 1780 */ 1356, 1356, 1356, 1673, 1356, 1356, 1356, 1657, 1356, 1356,
+ /* 1790 */ 1356, 509, 1686, 1356, 1356, 267, 1658, 511, 1660, 1661,
+ /* 1800 */ 507, 508, 528, 1356, 1356, 1627, 1356, 1356, 1356, 1356,
+ /* 1810 */ 1356, 1356, 1356, 1356, 1356, 1673, 1356, 1356, 1356, 1356,
+ /* 1820 */ 1356, 1356, 1686, 509, 1356, 258, 1658, 511, 1660, 1661,
+ /* 1830 */ 507, 1356, 528, 508, 1356, 1356, 1356, 1627, 1657, 1356,
+ /* 1840 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1657, 1356, 1356,
+ /* 1850 */ 1356, 1356, 1356, 1356, 1686, 1356, 1356, 268, 1658, 511,
+ /* 1860 */ 1660, 1661, 507, 1356, 528, 1356, 1673, 1356, 1356, 1356,
+ /* 1870 */ 1356, 1356, 1356, 1356, 509, 1673, 1356, 1356, 1356, 1356,
+ /* 1880 */ 1356, 1356, 1356, 509, 508, 1356, 1356, 1356, 1627, 1356,
+ /* 1890 */ 1356, 1356, 1356, 508, 1356, 1356, 1356, 1627, 1356, 1356,
+ /* 1900 */ 1657, 1356, 1356, 1356, 1356, 1686, 1356, 1356, 259, 1658,
+ /* 1910 */ 511, 1660, 1661, 507, 1686, 528, 1657, 1669, 1658, 511,
+ /* 1920 */ 1660, 1661, 507, 1356, 528, 1356, 1356, 1356, 1673, 1356,
+ /* 1930 */ 1356, 1356, 1356, 1356, 1356, 1356, 509, 1356, 1356, 1356,
+ /* 1940 */ 1356, 1356, 1356, 1356, 1673, 1356, 508, 1356, 1657, 1356,
+ /* 1950 */ 1627, 1356, 509, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
+ /* 1960 */ 1356, 1356, 508, 1356, 1356, 1356, 1627, 1686, 1356, 1356,
+ /* 1970 */ 1668, 1658, 511, 1660, 1661, 507, 1673, 528, 1657, 1356,
+ /* 1980 */ 1356, 1356, 1356, 1686, 509, 1356, 1667, 1658, 511, 1660,
+ /* 1990 */ 1661, 507, 1356, 528, 508, 1356, 1356, 1356, 1627, 1356,
+ /* 2000 */ 1356, 1356, 1356, 1356, 1356, 1356, 1673, 1356, 1356, 1356,
+ /* 2010 */ 1356, 1356, 1356, 1356, 509, 1686, 1356, 1356, 280, 1658,
+ /* 2020 */ 511, 1660, 1661, 507, 508, 528, 1657, 1356, 1627, 1356,
+ /* 2030 */ 1356, 311, 310, 1356, 1356, 1657, 1356, 1356, 1356, 1356,
+ /* 2040 */ 1356, 1181, 1356, 1356, 1356, 1686, 1356, 1356, 279, 1658,
+ /* 2050 */ 511, 1660, 1661, 507, 1673, 528, 1356, 1356, 1356, 1356,
+ /* 2060 */ 1356, 1356, 509, 1673, 1356, 1356, 1174, 1356, 1356, 1356,
+ /* 2070 */ 1356, 509, 508, 1356, 1356, 1356, 1627, 1356, 1356, 1356,
+ /* 2080 */ 1356, 508, 1356, 1173, 1356, 1627, 1356, 1356, 1356, 1356,
+ /* 2090 */ 1657, 1356, 1356, 1686, 1356, 1356, 281, 1658, 511, 1660,
+ /* 2100 */ 1661, 507, 1686, 528, 1356, 278, 1658, 511, 1660, 1661,
+ /* 2110 */ 507, 1356, 528, 1356, 1356, 1356, 1356, 1356, 1673, 1356,
+ /* 2120 */ 1356, 1356, 529, 1356, 1356, 1356, 509, 1356, 1356, 1356,
+ /* 2130 */ 1356, 1356, 1177, 1356, 1356, 1356, 508, 1356, 1356, 1356,
+ /* 2140 */ 1627, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
+ /* 2150 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1686, 1356, 1356,
+ /* 2160 */ 263, 1658, 511, 1660, 1661, 507, 1356, 528, 1356, 1356,
+ /* 2170 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1182, 1356, 1356,
+ /* 2180 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
+ /* 2190 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1185,
+ /* 2200 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
+ /* 2210 */ 526, 1233, 1234,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 246, 273, 248, 249, 276, 246, 250, 248, 249, 324,
- /* 10 */ 325, 4, 12, 13, 242, 271, 244, 243, 262, 339,
- /* 20 */ 20, 293, 22, 279, 20, 269, 12, 13, 14, 15,
- /* 30 */ 16, 247, 352, 255, 250, 279, 356, 309, 310, 12,
- /* 40 */ 13, 14, 15, 16, 271, 271, 268, 47, 320, 42,
- /* 50 */ 43, 278, 47, 279, 250, 277, 283, 55, 58, 315,
- /* 60 */ 12, 13, 14, 289, 64, 2, 262, 293, 20, 64,
- /* 70 */ 22, 0, 58, 299, 20, 12, 13, 14, 15, 16,
- /* 80 */ 4, 81, 80, 279, 310, 83, 250, 313, 314, 315,
- /* 90 */ 316, 317, 318, 0, 320, 47, 82, 323, 262, 251,
- /* 100 */ 252, 327, 328, 103, 90, 269, 58, 12, 13, 14,
- /* 110 */ 15, 16, 64, 339, 114, 279, 270, 24, 25, 26,
- /* 120 */ 27, 28, 29, 30, 31, 32, 352, 75, 282, 81,
- /* 130 */ 356, 60, 61, 62, 63, 81, 65, 66, 67, 68,
- /* 140 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
- /* 150 */ 289, 103, 279, 292, 140, 81, 295, 81, 158, 286,
- /* 160 */ 21, 339, 114, 24, 25, 26, 27, 28, 29, 30,
- /* 170 */ 31, 32, 120, 121, 352, 250, 162, 150, 356, 247,
- /* 180 */ 180, 181, 250, 183, 184, 185, 186, 187, 188, 189,
- /* 190 */ 190, 191, 192, 193, 194, 195, 196, 197, 0, 12,
- /* 200 */ 13, 14, 15, 16, 167, 168, 158, 256, 171, 284,
- /* 210 */ 210, 260, 198, 199, 200, 201, 202, 203, 204, 205,
- /* 220 */ 206, 207, 0, 12, 13, 14, 15, 16, 180, 181,
- /* 230 */ 250, 183, 184, 185, 186, 187, 188, 189, 190, 191,
- /* 240 */ 192, 193, 194, 195, 196, 197, 12, 13, 0, 20,
- /* 250 */ 253, 22, 60, 61, 20, 57, 22, 65, 231, 279,
- /* 260 */ 68, 69, 263, 339, 72, 73, 74, 12, 13, 82,
- /* 270 */ 271, 274, 243, 57, 20, 20, 352, 22, 49, 280,
- /* 280 */ 356, 47, 60, 61, 210, 20, 210, 65, 255, 47,
- /* 290 */ 68, 69, 58, 82, 72, 73, 74, 317, 64, 0,
- /* 300 */ 271, 14, 47, 243, 243, 250, 64, 20, 279, 250,
- /* 310 */ 277, 331, 332, 333, 334, 81, 336, 262, 289, 64,
- /* 320 */ 21, 262, 293, 24, 25, 26, 27, 28, 29, 30,
- /* 330 */ 31, 32, 271, 243, 279, 81, 81, 103, 279, 310,
- /* 340 */ 279, 93, 313, 314, 315, 316, 317, 318, 114, 320,
- /* 350 */ 289, 20, 323, 293, 293, 271, 327, 328, 103, 271,
- /* 360 */ 112, 113, 278, 115, 116, 117, 243, 283, 280, 114,
- /* 370 */ 259, 310, 261, 271, 313, 314, 315, 316, 317, 318,
- /* 380 */ 278, 320, 250, 293, 323, 283, 311, 2, 327, 328,
- /* 390 */ 329, 20, 158, 3, 262, 257, 258, 12, 13, 14,
- /* 400 */ 15, 16, 341, 12, 13, 14, 15, 16, 347, 348,
- /* 410 */ 335, 279, 81, 158, 180, 181, 293, 183, 184, 185,
- /* 420 */ 186, 187, 188, 189, 190, 191, 192, 193, 194, 195,
- /* 430 */ 196, 197, 250, 257, 258, 180, 181, 243, 183, 184,
- /* 440 */ 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
- /* 450 */ 195, 196, 197, 12, 13, 14, 243, 4, 20, 19,
- /* 460 */ 281, 20, 243, 22, 210, 210, 264, 288, 289, 267,
- /* 470 */ 14, 184, 19, 33, 12, 13, 20, 273, 243, 243,
- /* 480 */ 273, 299, 20, 276, 22, 45, 33, 293, 47, 250,
- /* 490 */ 144, 51, 52, 53, 54, 55, 14, 293, 45, 240,
- /* 500 */ 293, 262, 20, 50, 57, 64, 293, 271, 55, 47,
- /* 510 */ 153, 250, 293, 309, 310, 279, 309, 310, 279, 250,
- /* 520 */ 80, 339, 81, 83, 320, 289, 64, 320, 293, 293,
- /* 530 */ 173, 174, 64, 80, 352, 299, 83, 146, 356, 289,
- /* 540 */ 279, 210, 41, 81, 103, 295, 310, 20, 279, 313,
- /* 550 */ 314, 315, 316, 317, 318, 114, 320, 117, 299, 323,
- /* 560 */ 243, 215, 216, 327, 328, 103, 12, 13, 14, 15,
- /* 570 */ 16, 273, 80, 263, 272, 339, 114, 93, 317, 92,
- /* 580 */ 88, 271, 142, 82, 146, 145, 317, 0, 352, 81,
- /* 590 */ 280, 293, 356, 332, 333, 334, 253, 336, 339, 158,
- /* 600 */ 116, 332, 333, 334, 164, 336, 166, 309, 310, 266,
- /* 610 */ 293, 352, 58, 288, 289, 356, 226, 274, 320, 4,
- /* 620 */ 158, 180, 181, 243, 183, 184, 185, 186, 187, 188,
- /* 630 */ 189, 190, 191, 192, 193, 194, 195, 196, 197, 35,
- /* 640 */ 184, 149, 180, 181, 90, 183, 184, 185, 186, 187,
- /* 650 */ 188, 189, 190, 191, 192, 193, 194, 195, 196, 197,
- /* 660 */ 12, 13, 18, 93, 20, 157, 180, 159, 20, 250,
- /* 670 */ 22, 27, 250, 293, 30, 14, 15, 16, 208, 209,
- /* 680 */ 93, 262, 112, 113, 262, 115, 116, 117, 84, 37,
- /* 690 */ 86, 87, 48, 89, 140, 47, 22, 93, 279, 112,
- /* 700 */ 113, 279, 115, 116, 117, 219, 220, 221, 222, 223,
- /* 710 */ 271, 263, 64, 1, 2, 243, 162, 311, 210, 271,
- /* 720 */ 116, 47, 283, 42, 43, 311, 169, 170, 280, 81,
- /* 730 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
- /* 740 */ 104, 335, 106, 107, 108, 109, 110, 111, 299, 335,
- /* 750 */ 243, 103, 198, 199, 200, 201, 202, 203, 204, 205,
- /* 760 */ 206, 207, 114, 119, 0, 293, 122, 123, 124, 125,
- /* 770 */ 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
- /* 780 */ 136, 137, 138, 139, 250, 250, 18, 250, 339, 20,
- /* 790 */ 41, 23, 20, 20, 82, 140, 262, 262, 272, 262,
- /* 800 */ 293, 352, 243, 35, 36, 356, 158, 39, 243, 243,
- /* 810 */ 243, 299, 243, 279, 279, 243, 279, 162, 250, 243,
- /* 820 */ 243, 57, 243, 146, 56, 148, 211, 272, 180, 181,
- /* 830 */ 262, 183, 184, 185, 186, 187, 188, 189, 190, 191,
- /* 840 */ 192, 193, 194, 195, 196, 197, 41, 279, 271, 81,
- /* 850 */ 272, 339, 293, 198, 0, 272, 279, 0, 293, 293,
- /* 860 */ 293, 209, 293, 0, 352, 293, 289, 0, 356, 293,
- /* 870 */ 293, 85, 293, 85, 88, 85, 88, 85, 88, 22,
- /* 880 */ 88, 243, 58, 21, 272, 22, 118, 310, 81, 22,
- /* 890 */ 313, 314, 315, 316, 317, 318, 34, 320, 91, 45,
- /* 900 */ 323, 1, 2, 272, 327, 328, 329, 244, 303, 271,
- /* 910 */ 195, 196, 44, 260, 243, 146, 47, 279, 150, 151,
- /* 920 */ 152, 41, 41, 155, 350, 348, 47, 289, 160, 41,
- /* 930 */ 359, 293, 41, 41, 41, 307, 344, 271, 249, 41,
- /* 940 */ 172, 251, 271, 175, 282, 177, 178, 179, 310, 81,
- /* 950 */ 279, 313, 314, 315, 316, 317, 318, 184, 320, 312,
- /* 960 */ 289, 323, 82, 82, 293, 327, 328, 329, 20, 41,
- /* 970 */ 82, 41, 337, 82, 82, 82, 338, 228, 210, 243,
- /* 980 */ 82, 310, 353, 114, 313, 314, 315, 316, 317, 318,
- /* 990 */ 353, 320, 41, 114, 323, 243, 41, 41, 327, 328,
- /* 1000 */ 329, 250, 41, 353, 180, 340, 41, 271, 45, 338,
- /* 1010 */ 82, 308, 82, 47, 257, 279, 41, 41, 301, 40,
- /* 1020 */ 156, 250, 287, 271, 250, 289, 140, 243, 285, 293,
- /* 1030 */ 285, 279, 250, 82, 20, 230, 245, 82, 82, 245,
- /* 1040 */ 20, 289, 305, 82, 255, 293, 310, 82, 289, 313,
- /* 1050 */ 314, 315, 316, 317, 318, 271, 320, 82, 82, 323,
- /* 1060 */ 20, 255, 310, 279, 328, 313, 314, 315, 316, 317,
- /* 1070 */ 318, 20, 320, 289, 297, 323, 300, 293, 243, 327,
- /* 1080 */ 328, 329, 255, 299, 297, 255, 20, 279, 290, 255,
- /* 1090 */ 338, 255, 250, 243, 310, 255, 245, 313, 314, 315,
- /* 1100 */ 316, 317, 318, 271, 320, 250, 271, 64, 271, 271,
- /* 1110 */ 271, 245, 271, 293, 279, 271, 271, 271, 271, 271,
- /* 1120 */ 271, 271, 305, 339, 289, 253, 304, 253, 293, 279,
- /* 1130 */ 297, 253, 165, 290, 299, 279, 352, 253, 20, 289,
- /* 1140 */ 356, 289, 218, 293, 243, 310, 349, 294, 313, 314,
- /* 1150 */ 315, 316, 317, 318, 217, 320, 225, 346, 293, 349,
- /* 1160 */ 310, 345, 224, 313, 314, 315, 316, 317, 318, 294,
- /* 1170 */ 320, 312, 271, 323, 339, 293, 293, 327, 328, 20,
- /* 1180 */ 279, 213, 212, 209, 279, 40, 229, 352, 311, 360,
- /* 1190 */ 289, 356, 232, 81, 293, 293, 243, 293, 227, 293,
- /* 1200 */ 12, 13, 294, 343, 294, 243, 330, 143, 291, 290,
- /* 1210 */ 22, 310, 342, 355, 313, 314, 315, 316, 317, 318,
- /* 1220 */ 319, 320, 321, 322, 271, 354, 279, 81, 355, 326,
- /* 1230 */ 253, 267, 279, 271, 253, 47, 250, 279, 253, 354,
- /* 1240 */ 245, 279, 289, 261, 355, 302, 293, 275, 354, 265,
- /* 1250 */ 306, 289, 64, 243, 265, 293, 265, 298, 296, 254,
- /* 1260 */ 241, 0, 0, 310, 72, 0, 313, 314, 315, 316,
- /* 1270 */ 317, 318, 310, 320, 47, 313, 314, 315, 316, 317,
- /* 1280 */ 318, 271, 320, 176, 47, 243, 47, 47, 0, 279,
- /* 1290 */ 176, 103, 47, 47, 0, 176, 47, 0, 47, 289,
- /* 1300 */ 0, 47, 114, 293, 0, 81, 162, 114, 161, 158,
- /* 1310 */ 357, 358, 0, 271, 0, 154, 153, 243, 0, 0,
- /* 1320 */ 310, 279, 44, 313, 314, 315, 316, 317, 318, 0,
- /* 1330 */ 320, 289, 0, 0, 0, 293, 0, 0, 0, 0,
- /* 1340 */ 0, 0, 0, 0, 0, 271, 158, 0, 0, 0,
- /* 1350 */ 0, 0, 310, 279, 0, 313, 314, 315, 316, 317,
- /* 1360 */ 318, 351, 320, 289, 40, 243, 0, 293, 180, 0,
- /* 1370 */ 296, 0, 0, 0, 22, 0, 0, 0, 243, 191,
- /* 1380 */ 192, 193, 0, 0, 310, 0, 40, 313, 314, 315,
- /* 1390 */ 316, 317, 318, 271, 320, 14, 37, 41, 14, 44,
- /* 1400 */ 358, 279, 0, 38, 44, 37, 271, 0, 0, 0,
- /* 1410 */ 0, 289, 0, 0, 279, 293, 37, 37, 243, 0,
- /* 1420 */ 59, 0, 0, 37, 289, 47, 0, 37, 293, 37,
- /* 1430 */ 0, 296, 310, 37, 45, 313, 314, 315, 316, 317,
- /* 1440 */ 318, 47, 320, 45, 322, 310, 271, 47, 313, 314,
- /* 1450 */ 315, 316, 317, 318, 279, 320, 45, 0, 33, 0,
- /* 1460 */ 45, 47, 0, 0, 289, 47, 243, 0, 293, 22,
- /* 1470 */ 45, 296, 41, 41, 47, 22, 51, 52, 53, 54,
- /* 1480 */ 55, 90, 47, 88, 47, 310, 47, 47, 313, 314,
- /* 1490 */ 315, 316, 317, 318, 271, 320, 47, 47, 0, 22,
- /* 1500 */ 47, 0, 279, 22, 48, 80, 0, 22, 83, 0,
- /* 1510 */ 22, 47, 289, 0, 22, 20, 293, 64, 0, 47,
- /* 1520 */ 146, 0, 22, 243, 0, 163, 0, 0, 37, 81,
- /* 1530 */ 143, 41, 81, 310, 141, 41, 313, 314, 315, 316,
- /* 1540 */ 317, 318, 82, 320, 214, 146, 41, 82, 82, 81,
- /* 1550 */ 81, 271, 41, 41, 44, 81, 103, 82, 44, 279,
- /* 1560 */ 82, 44, 82, 41, 44, 208, 141, 114, 143, 289,
- /* 1570 */ 145, 243, 147, 293, 41, 47, 47, 214, 214, 82,
- /* 1580 */ 2, 47, 47, 47, 47, 180, 41, 44, 44, 82,
- /* 1590 */ 310, 166, 22, 313, 314, 315, 316, 317, 318, 271,
- /* 1600 */ 320, 243, 182, 0, 81, 144, 81, 279, 44, 37,
- /* 1610 */ 91, 158, 82, 81, 141, 22, 47, 289, 44, 81,
- /* 1620 */ 81, 293, 82, 92, 82, 59, 47, 81, 81, 271,
- /* 1630 */ 81, 243, 81, 180, 181, 82, 81, 279, 310, 81,
- /* 1640 */ 81, 313, 314, 315, 316, 317, 318, 289, 320, 82,
- /* 1650 */ 82, 293, 47, 47, 81, 47, 47, 82, 81, 271,
- /* 1660 */ 22, 105, 82, 81, 47, 82, 81, 279, 310, 93,
- /* 1670 */ 105, 313, 314, 315, 316, 317, 318, 289, 320, 243,
- /* 1680 */ 81, 293, 81, 81, 47, 22, 105, 58, 243, 105,
- /* 1690 */ 47, 64, 79, 41, 47, 47, 47, 47, 310, 22,
- /* 1700 */ 114, 313, 314, 315, 316, 317, 318, 271, 320, 47,
- /* 1710 */ 64, 47, 47, 47, 47, 279, 271, 47, 47, 47,
- /* 1720 */ 47, 47, 0, 47, 279, 289, 45, 37, 0, 293,
- /* 1730 */ 47, 45, 37, 0, 289, 47, 243, 45, 293, 37,
- /* 1740 */ 0, 47, 45, 37, 0, 47, 310, 46, 0, 313,
- /* 1750 */ 314, 315, 316, 317, 318, 310, 320, 0, 313, 314,
- /* 1760 */ 315, 316, 317, 318, 271, 320, 20, 22, 21, 361,
- /* 1770 */ 361, 22, 279, 22, 21, 361, 361, 361, 361, 361,
- /* 1780 */ 361, 361, 289, 361, 243, 361, 293, 361, 361, 361,
- /* 1790 */ 361, 361, 361, 361, 361, 243, 361, 361, 361, 361,
- /* 1800 */ 361, 361, 361, 310, 361, 361, 313, 314, 315, 316,
- /* 1810 */ 317, 318, 271, 320, 243, 361, 361, 361, 361, 361,
- /* 1820 */ 279, 361, 361, 271, 361, 361, 361, 361, 361, 361,
- /* 1830 */ 289, 279, 361, 361, 293, 361, 361, 361, 361, 361,
- /* 1840 */ 361, 289, 271, 361, 361, 293, 361, 361, 361, 361,
- /* 1850 */ 279, 310, 361, 361, 313, 314, 315, 316, 317, 318,
- /* 1860 */ 289, 320, 310, 361, 293, 313, 314, 315, 316, 317,
- /* 1870 */ 318, 361, 320, 243, 361, 361, 361, 361, 361, 361,
- /* 1880 */ 361, 310, 243, 361, 313, 314, 315, 316, 317, 318,
- /* 1890 */ 361, 320, 361, 361, 361, 361, 361, 361, 361, 361,
- /* 1900 */ 361, 271, 361, 361, 361, 361, 361, 361, 361, 279,
- /* 1910 */ 271, 361, 361, 361, 361, 361, 361, 361, 279, 289,
- /* 1920 */ 361, 361, 361, 293, 361, 361, 361, 361, 289, 361,
- /* 1930 */ 361, 361, 293, 361, 361, 361, 361, 361, 361, 361,
- /* 1940 */ 310, 361, 243, 313, 314, 315, 316, 317, 318, 310,
- /* 1950 */ 320, 243, 313, 314, 315, 316, 317, 318, 361, 320,
- /* 1960 */ 361, 361, 361, 361, 361, 361, 361, 361, 361, 361,
- /* 1970 */ 271, 361, 361, 361, 361, 361, 361, 361, 279, 271,
- /* 1980 */ 361, 361, 361, 361, 361, 361, 361, 279, 289, 361,
- /* 1990 */ 361, 361, 293, 361, 361, 361, 361, 289, 361, 243,
- /* 2000 */ 361, 293, 361, 361, 361, 361, 361, 361, 361, 310,
- /* 2010 */ 250, 361, 313, 314, 315, 316, 317, 318, 310, 320,
- /* 2020 */ 361, 313, 314, 315, 316, 317, 318, 271, 320, 361,
- /* 2030 */ 361, 361, 361, 361, 361, 279, 361, 361, 361, 279,
- /* 2040 */ 361, 361, 361, 361, 361, 289, 250, 361, 361, 293,
- /* 2050 */ 361, 361, 361, 361, 361, 361, 361, 361, 361, 299,
- /* 2060 */ 361, 361, 361, 361, 361, 361, 310, 361, 361, 313,
- /* 2070 */ 314, 315, 316, 317, 318, 279, 320, 317, 361, 361,
- /* 2080 */ 361, 361, 361, 361, 361, 361, 361, 361, 361, 361,
- /* 2090 */ 361, 361, 332, 333, 334, 299, 336, 361, 361, 339,
- /* 2100 */ 361, 361, 361, 361, 361, 361, 361, 361, 361, 361,
- /* 2110 */ 361, 361, 352, 317, 361, 361, 356, 361, 361, 361,
- /* 2120 */ 361, 361, 361, 361, 361, 361, 361, 361, 332, 333,
- /* 2130 */ 334, 361, 336, 361, 361, 339, 361, 361, 361, 361,
- /* 2140 */ 361, 361, 361, 361, 361, 361, 361, 361, 352, 361,
- /* 2150 */ 361, 361, 356,
+ /* 0 */ 245, 272, 247, 248, 275, 245, 249, 247, 248, 310,
+ /* 10 */ 254, 4, 12, 13, 323, 324, 271, 242, 261, 272,
+ /* 20 */ 20, 292, 22, 267, 270, 268, 12, 13, 14, 15,
+ /* 30 */ 16, 277, 276, 334, 239, 278, 282, 308, 309, 292,
+ /* 40 */ 12, 13, 14, 15, 16, 270, 20, 47, 319, 42,
+ /* 50 */ 43, 20, 252, 278, 249, 308, 309, 20, 58, 22,
+ /* 60 */ 12, 13, 14, 288, 64, 265, 319, 292, 20, 20,
+ /* 70 */ 22, 249, 58, 273, 12, 13, 14, 15, 16, 288,
+ /* 80 */ 57, 81, 291, 278, 309, 294, 49, 312, 313, 314,
+ /* 90 */ 315, 316, 317, 298, 319, 47, 82, 322, 242, 242,
+ /* 100 */ 20, 326, 327, 103, 90, 283, 58, 81, 12, 13,
+ /* 110 */ 250, 251, 64, 113, 246, 338, 20, 249, 22, 272,
+ /* 120 */ 58, 316, 275, 270, 81, 47, 270, 272, 351, 81,
+ /* 130 */ 81, 278, 355, 338, 278, 330, 331, 332, 333, 292,
+ /* 140 */ 335, 81, 64, 47, 288, 4, 351, 292, 292, 292,
+ /* 150 */ 355, 103, 90, 139, 58, 308, 309, 254, 158, 0,
+ /* 160 */ 64, 113, 20, 308, 309, 309, 319, 314, 312, 313,
+ /* 170 */ 314, 315, 316, 317, 319, 319, 162, 81, 150, 276,
+ /* 180 */ 180, 181, 75, 183, 184, 185, 186, 187, 188, 189,
+ /* 190 */ 190, 191, 192, 193, 194, 195, 196, 197, 20, 103,
+ /* 200 */ 157, 139, 159, 167, 168, 242, 158, 171, 93, 113,
+ /* 210 */ 210, 20, 198, 199, 200, 201, 202, 203, 204, 205,
+ /* 220 */ 206, 207, 81, 241, 162, 243, 119, 120, 180, 181,
+ /* 230 */ 115, 183, 184, 185, 186, 187, 188, 189, 190, 191,
+ /* 240 */ 192, 193, 194, 195, 196, 197, 0, 12, 13, 14,
+ /* 250 */ 15, 16, 93, 210, 158, 292, 0, 180, 230, 210,
+ /* 260 */ 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
+ /* 270 */ 210, 112, 81, 114, 115, 116, 180, 181, 22, 183,
+ /* 280 */ 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
+ /* 290 */ 194, 195, 196, 197, 12, 13, 219, 220, 221, 222,
+ /* 300 */ 223, 255, 20, 55, 22, 259, 60, 61, 62, 63,
+ /* 310 */ 57, 65, 66, 67, 68, 69, 70, 71, 72, 73,
+ /* 320 */ 74, 75, 76, 77, 78, 20, 93, 0, 80, 47,
+ /* 330 */ 21, 83, 242, 24, 25, 26, 27, 28, 29, 30,
+ /* 340 */ 31, 32, 12, 13, 14, 112, 64, 114, 115, 116,
+ /* 350 */ 20, 210, 22, 60, 61, 14, 15, 16, 65, 92,
+ /* 360 */ 270, 68, 69, 81, 14, 72, 73, 74, 278, 269,
+ /* 370 */ 20, 12, 13, 14, 15, 16, 338, 47, 288, 338,
+ /* 380 */ 145, 281, 292, 246, 57, 103, 249, 20, 143, 351,
+ /* 390 */ 12, 13, 351, 355, 64, 113, 355, 21, 20, 309,
+ /* 400 */ 22, 210, 312, 313, 314, 315, 316, 317, 310, 319,
+ /* 410 */ 34, 81, 256, 257, 94, 95, 96, 97, 98, 99,
+ /* 420 */ 100, 101, 102, 103, 104, 47, 106, 107, 108, 109,
+ /* 430 */ 110, 111, 334, 103, 0, 12, 13, 14, 15, 16,
+ /* 440 */ 158, 82, 64, 113, 2, 280, 356, 357, 263, 249,
+ /* 450 */ 145, 266, 287, 288, 12, 13, 14, 15, 16, 81,
+ /* 460 */ 215, 216, 180, 181, 249, 183, 184, 185, 186, 187,
+ /* 470 */ 188, 189, 190, 191, 192, 193, 194, 195, 196, 197,
+ /* 480 */ 242, 103, 12, 13, 14, 15, 16, 271, 158, 270,
+ /* 490 */ 278, 113, 210, 278, 60, 61, 277, 285, 298, 65,
+ /* 500 */ 298, 282, 68, 69, 0, 82, 72, 73, 74, 20,
+ /* 510 */ 180, 181, 249, 183, 184, 185, 186, 187, 188, 189,
+ /* 520 */ 190, 191, 192, 193, 194, 195, 196, 197, 1, 2,
+ /* 530 */ 292, 316, 270, 139, 184, 22, 158, 262, 338, 277,
+ /* 540 */ 338, 278, 256, 257, 282, 270, 331, 332, 333, 242,
+ /* 550 */ 335, 351, 35, 351, 279, 355, 162, 355, 180, 181,
+ /* 560 */ 47, 183, 184, 185, 186, 187, 188, 189, 190, 191,
+ /* 570 */ 192, 193, 194, 195, 196, 197, 12, 13, 18, 316,
+ /* 580 */ 20, 80, 287, 288, 20, 242, 22, 27, 249, 88,
+ /* 590 */ 30, 310, 198, 249, 331, 332, 333, 93, 335, 292,
+ /* 600 */ 261, 84, 37, 86, 87, 261, 89, 268, 48, 82,
+ /* 610 */ 93, 47, 0, 270, 242, 334, 112, 278, 114, 115,
+ /* 620 */ 116, 278, 278, 14, 288, 242, 153, 271, 64, 20,
+ /* 630 */ 294, 288, 115, 21, 145, 292, 24, 25, 26, 27,
+ /* 640 */ 28, 29, 30, 31, 32, 81, 173, 174, 14, 0,
+ /* 650 */ 149, 252, 309, 20, 20, 312, 313, 314, 315, 316,
+ /* 660 */ 317, 298, 319, 64, 292, 322, 258, 103, 260, 326,
+ /* 670 */ 327, 328, 273, 242, 271, 292, 3, 113, 118, 41,
+ /* 680 */ 337, 121, 122, 123, 124, 125, 126, 127, 128, 129,
+ /* 690 */ 130, 131, 132, 133, 134, 135, 136, 137, 138, 2,
+ /* 700 */ 22, 338, 41, 19, 249, 58, 57, 262, 270, 12,
+ /* 710 */ 13, 14, 15, 16, 351, 270, 261, 33, 355, 242,
+ /* 720 */ 282, 270, 158, 292, 279, 47, 242, 4, 242, 45,
+ /* 730 */ 279, 271, 242, 278, 242, 51, 52, 53, 54, 55,
+ /* 740 */ 42, 43, 64, 82, 180, 181, 271, 183, 184, 185,
+ /* 750 */ 186, 187, 188, 189, 190, 191, 192, 193, 194, 195,
+ /* 760 */ 196, 197, 270, 249, 80, 249, 41, 83, 0, 292,
+ /* 770 */ 278, 262, 243, 249, 209, 261, 292, 261, 292, 270,
+ /* 780 */ 288, 103, 292, 242, 292, 261, 249, 249, 279, 242,
+ /* 790 */ 298, 113, 278, 184, 278, 242, 208, 209, 302, 261,
+ /* 800 */ 116, 309, 278, 41, 312, 313, 314, 315, 316, 317,
+ /* 810 */ 242, 319, 249, 45, 322, 278, 278, 184, 326, 327,
+ /* 820 */ 249, 81, 249, 242, 261, 141, 85, 180, 144, 88,
+ /* 830 */ 338, 91, 261, 292, 261, 298, 158, 85, 270, 292,
+ /* 840 */ 88, 278, 0, 351, 82, 292, 278, 355, 164, 278,
+ /* 850 */ 166, 278, 242, 316, 85, 271, 288, 88, 180, 181,
+ /* 860 */ 292, 242, 242, 242, 22, 227, 298, 249, 331, 332,
+ /* 870 */ 333, 242, 335, 292, 4, 338, 259, 309, 358, 261,
+ /* 880 */ 312, 313, 314, 315, 316, 317, 0, 319, 351, 19,
+ /* 890 */ 322, 349, 355, 249, 326, 327, 278, 85, 225, 270,
+ /* 900 */ 88, 145, 292, 33, 148, 261, 338, 278, 22, 18,
+ /* 910 */ 306, 292, 292, 292, 23, 45, 47, 288, 343, 351,
+ /* 920 */ 50, 292, 278, 355, 41, 55, 35, 36, 169, 170,
+ /* 930 */ 39, 248, 242, 64, 211, 47, 41, 270, 309, 195,
+ /* 940 */ 196, 312, 313, 314, 315, 316, 317, 56, 319, 250,
+ /* 950 */ 80, 322, 281, 83, 229, 326, 327, 328, 1, 2,
+ /* 960 */ 270, 0, 47, 311, 336, 82, 352, 352, 278, 340,
+ /* 970 */ 41, 339, 81, 20, 41, 346, 347, 82, 288, 352,
+ /* 980 */ 249, 41, 292, 44, 41, 24, 25, 26, 27, 28,
+ /* 990 */ 29, 30, 31, 32, 45, 41, 307, 41, 47, 309,
+ /* 1000 */ 249, 113, 312, 313, 314, 315, 316, 317, 117, 319,
+ /* 1010 */ 256, 82, 322, 300, 156, 82, 326, 327, 328, 41,
+ /* 1020 */ 81, 249, 82, 41, 41, 82, 249, 40, 113, 278,
+ /* 1030 */ 41, 286, 41, 41, 41, 139, 82, 347, 82, 284,
+ /* 1040 */ 249, 150, 151, 152, 242, 284, 155, 20, 244, 298,
+ /* 1050 */ 244, 160, 20, 304, 254, 288, 20, 254, 20, 296,
+ /* 1060 */ 82, 254, 296, 172, 82, 82, 175, 316, 177, 178,
+ /* 1070 */ 179, 82, 270, 82, 82, 82, 254, 299, 20, 278,
+ /* 1080 */ 278, 289, 331, 332, 333, 254, 335, 254, 249, 338,
+ /* 1090 */ 288, 254, 244, 270, 292, 270, 270, 270, 270, 242,
+ /* 1100 */ 270, 210, 351, 249, 270, 270, 355, 244, 270, 64,
+ /* 1110 */ 270, 309, 292, 270, 312, 313, 314, 315, 316, 317,
+ /* 1120 */ 304, 319, 303, 252, 322, 165, 252, 270, 326, 327,
+ /* 1130 */ 328, 252, 288, 278, 289, 278, 252, 296, 20, 337,
+ /* 1140 */ 311, 218, 348, 217, 293, 288, 348, 147, 292, 292,
+ /* 1150 */ 242, 224, 293, 292, 292, 345, 342, 344, 213, 212,
+ /* 1160 */ 278, 209, 242, 20, 40, 341, 309, 226, 353, 312,
+ /* 1170 */ 313, 314, 315, 316, 317, 310, 319, 231, 270, 322,
+ /* 1180 */ 359, 329, 81, 326, 327, 328, 278, 228, 142, 353,
+ /* 1190 */ 270, 325, 293, 292, 337, 292, 288, 293, 278, 353,
+ /* 1200 */ 292, 354, 292, 354, 354, 289, 298, 290, 288, 278,
+ /* 1210 */ 252, 81, 292, 278, 266, 242, 252, 309, 298, 249,
+ /* 1220 */ 312, 313, 314, 315, 316, 317, 252, 319, 260, 309,
+ /* 1230 */ 244, 301, 312, 313, 314, 315, 316, 317, 240, 319,
+ /* 1240 */ 274, 305, 0, 270, 264, 264, 338, 297, 242, 264,
+ /* 1250 */ 253, 278, 0, 72, 0, 47, 176, 47, 338, 351,
+ /* 1260 */ 47, 288, 47, 355, 176, 292, 0, 47, 47, 176,
+ /* 1270 */ 0, 351, 47, 0, 47, 355, 270, 0, 47, 0,
+ /* 1280 */ 81, 162, 309, 161, 278, 312, 313, 314, 315, 316,
+ /* 1290 */ 317, 113, 319, 158, 288, 322, 0, 0, 292, 326,
+ /* 1300 */ 327, 154, 153, 0, 0, 44, 242, 0, 0, 0,
+ /* 1310 */ 0, 0, 0, 0, 0, 309, 40, 0, 312, 313,
+ /* 1320 */ 314, 315, 316, 317, 318, 319, 320, 321, 0, 0,
+ /* 1330 */ 0, 0, 0, 0, 270, 0, 0, 0, 0, 0,
+ /* 1340 */ 0, 0, 278, 0, 0, 22, 0, 0, 0, 0,
+ /* 1350 */ 0, 0, 288, 0, 242, 40, 292, 37, 0, 41,
+ /* 1360 */ 38, 37, 0, 44, 0, 44, 14, 242, 0, 14,
+ /* 1370 */ 147, 37, 0, 309, 0, 0, 312, 313, 314, 315,
+ /* 1380 */ 316, 317, 270, 319, 59, 0, 322, 0, 0, 47,
+ /* 1390 */ 278, 327, 47, 37, 37, 270, 37, 0, 0, 45,
+ /* 1400 */ 288, 0, 0, 278, 292, 45, 37, 295, 47, 0,
+ /* 1410 */ 45, 45, 22, 288, 47, 242, 90, 292, 37, 0,
+ /* 1420 */ 47, 309, 0, 47, 312, 313, 314, 315, 316, 317,
+ /* 1430 */ 47, 319, 41, 47, 309, 41, 47, 312, 313, 314,
+ /* 1440 */ 315, 316, 317, 270, 319, 22, 47, 47, 0, 22,
+ /* 1450 */ 47, 278, 48, 0, 47, 22, 0, 22, 88, 0,
+ /* 1460 */ 22, 288, 20, 0, 47, 292, 242, 0, 163, 22,
+ /* 1470 */ 0, 0, 145, 0, 81, 350, 37, 242, 41, 214,
+ /* 1480 */ 44, 41, 309, 214, 41, 312, 313, 314, 315, 316,
+ /* 1490 */ 317, 81, 319, 82, 270, 82, 81, 81, 41, 44,
+ /* 1500 */ 82, 81, 278, 41, 44, 270, 82, 82, 145, 208,
+ /* 1510 */ 41, 140, 288, 278, 214, 47, 292, 41, 44, 295,
+ /* 1520 */ 142, 2, 47, 288, 47, 242, 82, 292, 82, 47,
+ /* 1530 */ 357, 47, 47, 309, 41, 81, 312, 313, 314, 315,
+ /* 1540 */ 316, 317, 44, 319, 309, 44, 82, 312, 313, 314,
+ /* 1550 */ 315, 316, 317, 270, 319, 22, 321, 180, 242, 0,
+ /* 1560 */ 82, 278, 81, 37, 182, 44, 44, 81, 81, 143,
+ /* 1570 */ 82, 288, 82, 81, 140, 292, 81, 81, 295, 82,
+ /* 1580 */ 81, 81, 91, 81, 22, 81, 270, 82, 47, 47,
+ /* 1590 */ 82, 81, 309, 47, 278, 312, 313, 314, 315, 316,
+ /* 1600 */ 317, 92, 319, 47, 288, 81, 22, 82, 292, 81,
+ /* 1610 */ 47, 295, 82, 81, 47, 47, 82, 81, 81, 105,
+ /* 1620 */ 105, 242, 105, 105, 93, 309, 33, 58, 312, 313,
+ /* 1630 */ 314, 315, 316, 317, 242, 319, 81, 22, 45, 81,
+ /* 1640 */ 113, 59, 47, 64, 51, 52, 53, 54, 55, 270,
+ /* 1650 */ 79, 41, 22, 47, 47, 47, 47, 278, 47, 47,
+ /* 1660 */ 47, 64, 270, 47, 47, 47, 47, 288, 47, 47,
+ /* 1670 */ 278, 292, 47, 80, 242, 0, 83, 45, 47, 37,
+ /* 1680 */ 288, 0, 47, 45, 292, 37, 0, 47, 309, 45,
+ /* 1690 */ 37, 312, 313, 314, 315, 316, 317, 0, 319, 47,
+ /* 1700 */ 45, 309, 270, 37, 312, 313, 314, 315, 316, 317,
+ /* 1710 */ 278, 319, 0, 0, 47, 46, 0, 22, 22, 21,
+ /* 1720 */ 288, 22, 21, 20, 292, 242, 360, 360, 360, 360,
+ /* 1730 */ 360, 360, 360, 140, 360, 142, 360, 144, 360, 146,
+ /* 1740 */ 360, 309, 360, 360, 312, 313, 314, 315, 316, 317,
+ /* 1750 */ 360, 319, 360, 270, 360, 242, 360, 360, 360, 166,
+ /* 1760 */ 360, 278, 360, 360, 360, 360, 360, 360, 360, 360,
+ /* 1770 */ 360, 288, 360, 360, 360, 292, 360, 360, 360, 360,
+ /* 1780 */ 360, 360, 360, 270, 360, 360, 360, 242, 360, 360,
+ /* 1790 */ 360, 278, 309, 360, 360, 312, 313, 314, 315, 316,
+ /* 1800 */ 317, 288, 319, 360, 360, 292, 360, 360, 360, 360,
+ /* 1810 */ 360, 360, 360, 360, 360, 270, 360, 360, 360, 360,
+ /* 1820 */ 360, 360, 309, 278, 360, 312, 313, 314, 315, 316,
+ /* 1830 */ 317, 360, 319, 288, 360, 360, 360, 292, 242, 360,
+ /* 1840 */ 360, 360, 360, 360, 360, 360, 360, 242, 360, 360,
+ /* 1850 */ 360, 360, 360, 360, 309, 360, 360, 312, 313, 314,
+ /* 1860 */ 315, 316, 317, 360, 319, 360, 270, 360, 360, 360,
+ /* 1870 */ 360, 360, 360, 360, 278, 270, 360, 360, 360, 360,
+ /* 1880 */ 360, 360, 360, 278, 288, 360, 360, 360, 292, 360,
+ /* 1890 */ 360, 360, 360, 288, 360, 360, 360, 292, 360, 360,
+ /* 1900 */ 242, 360, 360, 360, 360, 309, 360, 360, 312, 313,
+ /* 1910 */ 314, 315, 316, 317, 309, 319, 242, 312, 313, 314,
+ /* 1920 */ 315, 316, 317, 360, 319, 360, 360, 360, 270, 360,
+ /* 1930 */ 360, 360, 360, 360, 360, 360, 278, 360, 360, 360,
+ /* 1940 */ 360, 360, 360, 360, 270, 360, 288, 360, 242, 360,
+ /* 1950 */ 292, 360, 278, 360, 360, 360, 360, 360, 360, 360,
+ /* 1960 */ 360, 360, 288, 360, 360, 360, 292, 309, 360, 360,
+ /* 1970 */ 312, 313, 314, 315, 316, 317, 270, 319, 242, 360,
+ /* 1980 */ 360, 360, 360, 309, 278, 360, 312, 313, 314, 315,
+ /* 1990 */ 316, 317, 360, 319, 288, 360, 360, 360, 292, 360,
+ /* 2000 */ 360, 360, 360, 360, 360, 360, 270, 360, 360, 360,
+ /* 2010 */ 360, 360, 360, 360, 278, 309, 360, 360, 312, 313,
+ /* 2020 */ 314, 315, 316, 317, 288, 319, 242, 360, 292, 360,
+ /* 2030 */ 360, 12, 13, 360, 360, 242, 360, 360, 360, 360,
+ /* 2040 */ 360, 22, 360, 360, 360, 309, 360, 360, 312, 313,
+ /* 2050 */ 314, 315, 316, 317, 270, 319, 360, 360, 360, 360,
+ /* 2060 */ 360, 360, 278, 270, 360, 360, 47, 360, 360, 360,
+ /* 2070 */ 360, 278, 288, 360, 360, 360, 292, 360, 360, 360,
+ /* 2080 */ 360, 288, 360, 64, 360, 292, 360, 360, 360, 360,
+ /* 2090 */ 242, 360, 360, 309, 360, 360, 312, 313, 314, 315,
+ /* 2100 */ 316, 317, 309, 319, 360, 312, 313, 314, 315, 316,
+ /* 2110 */ 317, 360, 319, 360, 360, 360, 360, 360, 270, 360,
+ /* 2120 */ 360, 360, 103, 360, 360, 360, 278, 360, 360, 360,
+ /* 2130 */ 360, 360, 113, 360, 360, 360, 288, 360, 360, 360,
+ /* 2140 */ 292, 360, 360, 360, 360, 360, 360, 360, 360, 360,
+ /* 2150 */ 360, 360, 360, 360, 360, 360, 360, 309, 360, 360,
+ /* 2160 */ 312, 313, 314, 315, 316, 317, 360, 319, 360, 360,
+ /* 2170 */ 360, 360, 360, 360, 360, 360, 360, 158, 360, 360,
+ /* 2180 */ 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
+ /* 2190 */ 360, 360, 360, 360, 360, 360, 360, 360, 360, 180,
+ /* 2200 */ 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
+ /* 2210 */ 191, 192, 193, 360, 360, 360, 360, 360, 360, 360,
+ /* 2220 */ 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
+ /* 2230 */ 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
+ /* 2240 */ 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
+ /* 2250 */ 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
+ /* 2260 */ 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
+ /* 2270 */ 360,
};
#define YY_SHIFT_COUNT (610)
#define YY_SHIFT_MIN (0)
-#define YY_SHIFT_MAX (1757)
+#define YY_SHIFT_MAX (2019)
static const unsigned short int yy_shift_ofst[] = {
- /* 0 */ 768, 0, 0, 48, 234, 234, 234, 234, 255, 255,
- /* 10 */ 234, 234, 441, 462, 648, 462, 462, 462, 462, 462,
- /* 20 */ 462, 462, 462, 462, 462, 462, 462, 462, 462, 462,
- /* 30 */ 462, 462, 462, 462, 462, 462, 462, 462, 254, 254,
- /* 40 */ 54, 54, 54, 1188, 1188, 1188, 1188, 331, 508, 74,
- /* 50 */ 4, 4, 7, 7, 76, 74, 74, 4, 4, 4,
- /* 60 */ 4, 4, 4, 216, 4, 265, 371, 527, 265, 4,
- /* 70 */ 4, 265, 4, 265, 265, 527, 265, 4, 447, 644,
- /* 80 */ 14, 554, 554, 139, 192, 1453, 1453, 1453, 1453, 1453,
- /* 90 */ 1453, 1453, 1453, 1453, 1453, 1453, 1453, 1453, 1453, 1453,
- /* 100 */ 1453, 1453, 1453, 1453, 604, 229, 482, 482, 198, 5,
- /* 110 */ 438, 438, 438, 764, 5, 772, 527, 265, 265, 527,
- /* 120 */ 487, 468, 636, 636, 636, 636, 636, 636, 636, 440,
- /* 130 */ 299, 222, 27, 486, 37, 346, 287, 456, 681, 674,
- /* 140 */ 484, 769, 470, 652, 470, 390, 390, 390, 615, 773,
- /* 150 */ 948, 963, 966, 864, 948, 948, 979, 886, 886, 948,
- /* 160 */ 1014, 1014, 1020, 216, 527, 216, 1040, 1051, 216, 1040,
- /* 170 */ 216, 772, 1066, 216, 216, 948, 216, 1014, 265, 265,
- /* 180 */ 265, 265, 265, 265, 265, 265, 265, 265, 265, 948,
- /* 190 */ 1014, 1043, 1020, 447, 967, 527, 447, 1040, 447, 772,
- /* 200 */ 1066, 447, 1118, 924, 937, 1043, 924, 937, 1043, 1043,
- /* 210 */ 265, 931, 938, 968, 970, 974, 772, 1159, 1145, 957,
- /* 220 */ 971, 960, 957, 971, 957, 971, 1112, 937, 1043, 1043,
- /* 230 */ 937, 1043, 1064, 772, 1066, 447, 487, 447, 772, 1146,
- /* 240 */ 468, 948, 447, 1014, 2153, 2153, 2153, 2153, 2153, 2153,
- /* 250 */ 2153, 2153, 71, 1425, 93, 453, 248, 587, 187, 63,
- /* 260 */ 385, 391, 211, 570, 95, 95, 95, 95, 95, 95,
- /* 270 */ 95, 95, 357, 2, 52, 492, 712, 655, 661, 661,
- /* 280 */ 661, 661, 854, 501, 786, 788, 790, 792, 857, 863,
- /* 290 */ 867, 862, 557, 677, 880, 881, 888, 900, 715, 749,
- /* 300 */ 805, 891, 824, 892, 868, 893, 898, 928, 930, 951,
- /* 310 */ 869, 879, 955, 956, 961, 965, 975, 976, 807, 242,
- /* 320 */ 1261, 1262, 1192, 1265, 1227, 1107, 1237, 1239, 1240, 1114,
- /* 330 */ 1288, 1245, 1246, 1119, 1294, 1249, 1297, 1251, 1300, 1254,
- /* 340 */ 1304, 1224, 1144, 1147, 1193, 1151, 1312, 1314, 1161, 1163,
- /* 350 */ 1318, 1319, 1278, 1329, 1332, 1333, 1334, 1336, 1337, 1338,
- /* 360 */ 1339, 1340, 1341, 1342, 1343, 1344, 1347, 1348, 1349, 1350,
- /* 370 */ 1351, 1324, 1354, 1366, 1369, 1371, 1372, 1373, 1352, 1375,
- /* 380 */ 1376, 1377, 1382, 1383, 1385, 1346, 1359, 1356, 1381, 1355,
- /* 390 */ 1384, 1360, 1402, 1365, 1368, 1407, 1408, 1409, 1379, 1410,
- /* 400 */ 1412, 1380, 1413, 1361, 1419, 1421, 1378, 1389, 1386, 1422,
- /* 410 */ 1394, 1398, 1390, 1426, 1400, 1411, 1392, 1430, 1414, 1415,
- /* 420 */ 1396, 1457, 1459, 1462, 1463, 1391, 1395, 1418, 1447, 1467,
- /* 430 */ 1427, 1435, 1437, 1439, 1431, 1432, 1440, 1449, 1450, 1498,
- /* 440 */ 1477, 1501, 1481, 1456, 1506, 1485, 1464, 1509, 1488, 1513,
- /* 450 */ 1492, 1495, 1518, 1374, 1472, 1521, 1362, 1500, 1399, 1387,
- /* 460 */ 1524, 1526, 1527, 1448, 1491, 1393, 1490, 1494, 1330, 1460,
- /* 470 */ 1505, 1465, 1451, 1468, 1469, 1466, 1511, 1510, 1514, 1474,
- /* 480 */ 1512, 1363, 1475, 1478, 1517, 1357, 1522, 1520, 1480, 1533,
- /* 490 */ 1364, 1497, 1528, 1529, 1534, 1535, 1536, 1537, 1497, 1578,
- /* 500 */ 1405, 1545, 1507, 1523, 1530, 1543, 1525, 1532, 1544, 1570,
- /* 510 */ 1420, 1538, 1540, 1542, 1539, 1546, 1461, 1547, 1603, 1572,
- /* 520 */ 1473, 1549, 1519, 1564, 1574, 1551, 1553, 1555, 1593, 1558,
- /* 530 */ 1531, 1567, 1569, 1579, 1559, 1568, 1605, 1573, 1575, 1606,
- /* 540 */ 1577, 1580, 1608, 1582, 1583, 1609, 1585, 1556, 1565, 1581,
- /* 550 */ 1584, 1638, 1576, 1599, 1601, 1617, 1602, 1586, 1637, 1663,
- /* 560 */ 1566, 1629, 1643, 1627, 1613, 1652, 1647, 1648, 1649, 1650,
- /* 570 */ 1662, 1677, 1664, 1665, 1646, 1431, 1666, 1432, 1667, 1670,
- /* 580 */ 1671, 1672, 1673, 1674, 1722, 1676, 1681, 1690, 1728, 1683,
- /* 590 */ 1686, 1695, 1733, 1688, 1692, 1702, 1740, 1694, 1697, 1706,
- /* 600 */ 1744, 1698, 1701, 1748, 1757, 1745, 1747, 1749, 1751, 1753,
- /* 610 */ 1746,
+ /* 0 */ 891, 0, 0, 48, 96, 96, 96, 96, 282, 282,
+ /* 10 */ 96, 96, 330, 378, 564, 378, 378, 378, 378, 378,
+ /* 20 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378,
+ /* 30 */ 378, 378, 378, 378, 378, 378, 378, 378, 49, 49,
+ /* 40 */ 26, 26, 26, 2019, 2019, 2019, 2019, 191, 43, 60,
+ /* 50 */ 31, 31, 7, 7, 141, 60, 60, 31, 31, 31,
+ /* 60 */ 31, 31, 31, 23, 31, 80, 142, 178, 80, 31,
+ /* 70 */ 31, 80, 31, 80, 80, 178, 80, 31, 253, 560,
+ /* 80 */ 14, 62, 62, 309, 293, 678, 678, 678, 678, 678,
+ /* 90 */ 678, 678, 678, 678, 678, 678, 678, 678, 678, 678,
+ /* 100 */ 678, 678, 678, 678, 517, 37, 634, 634, 327, 78,
+ /* 110 */ 305, 305, 305, 649, 78, 367, 178, 80, 80, 178,
+ /* 120 */ 267, 599, 320, 320, 320, 320, 320, 320, 320, 684,
+ /* 130 */ 612, 434, 28, 77, 36, 245, 350, 609, 698, 513,
+ /* 140 */ 115, 489, 588, 565, 588, 673, 673, 673, 723, 633,
+ /* 150 */ 953, 949, 951, 858, 953, 953, 987, 896, 896, 953,
+ /* 160 */ 1027, 1027, 1032, 23, 178, 23, 1036, 1038, 23, 1036,
+ /* 170 */ 23, 367, 1058, 23, 23, 953, 23, 1027, 80, 80,
+ /* 180 */ 80, 80, 80, 80, 80, 80, 80, 80, 80, 953,
+ /* 190 */ 1027, 1045, 1032, 253, 960, 178, 253, 1036, 253, 367,
+ /* 200 */ 1058, 253, 1118, 923, 926, 1045, 923, 926, 1045, 1045,
+ /* 210 */ 80, 927, 1000, 945, 947, 952, 367, 1143, 1124, 959,
+ /* 220 */ 941, 946, 959, 941, 959, 941, 1101, 926, 1045, 1045,
+ /* 230 */ 926, 1045, 1046, 367, 1058, 253, 267, 253, 367, 1130,
+ /* 240 */ 599, 953, 253, 1027, 2213, 2213, 2213, 2213, 2213, 2213,
+ /* 250 */ 2213, 2213, 246, 1593, 961, 870, 359, 442, 697, 235,
+ /* 260 */ 423, 159, 504, 470, 470, 470, 470, 470, 470, 470,
+ /* 270 */ 470, 233, 473, 248, 107, 501, 527, 394, 341, 341,
+ /* 280 */ 341, 341, 768, 661, 741, 752, 769, 812, 256, 842,
+ /* 290 */ 886, 376, 759, 756, 762, 883, 895, 957, 744, 638,
+ /* 300 */ 725, 929, 647, 933, 939, 940, 943, 954, 956, 978,
+ /* 310 */ 888, 915, 982, 983, 989, 991, 992, 993, 740, 869,
+ /* 320 */ 1242, 1252, 1181, 1254, 1208, 1080, 1210, 1213, 1215, 1088,
+ /* 330 */ 1266, 1220, 1221, 1093, 1270, 1225, 1273, 1227, 1277, 1231,
+ /* 340 */ 1279, 1199, 1119, 1122, 1178, 1135, 1296, 1297, 1147, 1149,
+ /* 350 */ 1303, 1304, 1261, 1307, 1308, 1309, 1310, 1311, 1312, 1313,
+ /* 360 */ 1314, 1328, 1329, 1330, 1331, 1332, 1333, 1335, 1336, 1337,
+ /* 370 */ 1338, 1276, 1317, 1339, 1340, 1341, 1343, 1344, 1323, 1346,
+ /* 380 */ 1347, 1348, 1349, 1350, 1351, 1315, 1320, 1318, 1352, 1319,
+ /* 390 */ 1355, 1321, 1353, 1322, 1324, 1358, 1362, 1364, 1334, 1223,
+ /* 400 */ 1368, 1372, 1356, 1374, 1325, 1375, 1385, 1342, 1354, 1357,
+ /* 410 */ 1387, 1345, 1360, 1359, 1388, 1361, 1365, 1369, 1397, 1367,
+ /* 420 */ 1366, 1381, 1398, 1401, 1402, 1409, 1326, 1370, 1373, 1390,
+ /* 430 */ 1419, 1376, 1383, 1386, 1389, 1391, 1394, 1399, 1400, 1403,
+ /* 440 */ 1422, 1423, 1448, 1427, 1404, 1453, 1433, 1407, 1456, 1435,
+ /* 450 */ 1459, 1438, 1442, 1463, 1327, 1417, 1467, 1305, 1447, 1363,
+ /* 460 */ 1378, 1470, 1471, 1473, 1393, 1439, 1371, 1437, 1440, 1265,
+ /* 470 */ 1411, 1443, 1413, 1410, 1415, 1416, 1418, 1457, 1436, 1455,
+ /* 480 */ 1420, 1462, 1269, 1424, 1425, 1460, 1301, 1469, 1474, 1444,
+ /* 490 */ 1476, 1300, 1446, 1468, 1475, 1477, 1482, 1484, 1485, 1446,
+ /* 500 */ 1519, 1377, 1493, 1464, 1454, 1478, 1498, 1481, 1486, 1501,
+ /* 510 */ 1533, 1382, 1487, 1488, 1490, 1492, 1495, 1426, 1496, 1559,
+ /* 520 */ 1526, 1434, 1499, 1491, 1521, 1522, 1500, 1497, 1502, 1562,
+ /* 530 */ 1504, 1509, 1505, 1541, 1542, 1510, 1508, 1546, 1524, 1525,
+ /* 540 */ 1556, 1528, 1530, 1563, 1532, 1534, 1567, 1536, 1514, 1515,
+ /* 550 */ 1517, 1518, 1584, 1531, 1537, 1555, 1568, 1558, 1527, 1615,
+ /* 560 */ 1582, 1569, 1595, 1579, 1571, 1610, 1606, 1607, 1608, 1609,
+ /* 570 */ 1611, 1630, 1612, 1613, 1597, 1391, 1616, 1394, 1617, 1618,
+ /* 580 */ 1619, 1621, 1622, 1625, 1675, 1631, 1632, 1642, 1681, 1635,
+ /* 590 */ 1638, 1648, 1686, 1640, 1644, 1653, 1697, 1652, 1655, 1666,
+ /* 600 */ 1712, 1667, 1669, 1713, 1716, 1695, 1698, 1696, 1699, 1701,
+ /* 610 */ 1703,
};
#define YY_REDUCE_COUNT (251)
-#define YY_REDUCE_MIN (-320)
-#define YY_REDUCE_MAX (1796)
+#define YY_REDUCE_MIN (-309)
+#define YY_REDUCE_MAX (1848)
static const short yy_reduce_ofst[] = {
- /* 0 */ 259, -226, 236, 61, 577, 638, 671, 752, 784, 835,
- /* 10 */ 29, 850, 901, 953, 736, 962, 1010, 1042, 1074, 1122,
- /* 20 */ 1135, 1175, 1223, 1280, 1328, 1358, 1388, 1436, 1445, 1493,
- /* 30 */ 1541, 1552, 1571, 1630, 1639, 1699, 1708, 1756, 1760, 1796,
- /* 40 */ -20, 261, 269, -272, 207, 204, 298, 182, 449, 512,
- /* 50 */ -244, -164, -246, -241, -320, -178, -76, -196, 55, 59,
- /* 60 */ 132, 239, 419, -222, 422, -227, -256, -139, -1, 534,
- /* 70 */ 535, 84, 537, 310, 102, 179, 448, 568, 343, -75,
- /* 80 */ -315, -315, -315, -228, -49, 60, 90, 123, 194, 213,
- /* 90 */ 219, 235, 317, 380, 472, 507, 559, 565, 566, 567,
- /* 100 */ 569, 572, 576, 579, -154, -152, -216, -68, 33, 138,
- /* 110 */ 75, 406, 414, -3, 176, -127, 250, 88, 439, 325,
- /* 120 */ 202, 111, 302, 526, 555, 578, 583, 612, 631, 605,
- /* 130 */ 663, 653, 571, 574, 628, 592, 666, 666, 689, 690,
- /* 140 */ 662, 647, 635, 635, 635, 629, 637, 650, 665, 666,
- /* 150 */ 751, 703, 757, 717, 771, 774, 735, 743, 745, 782,
- /* 160 */ 791, 794, 737, 789, 759, 806, 777, 776, 827, 787,
- /* 170 */ 830, 808, 798, 834, 836, 842, 840, 851, 832, 837,
- /* 180 */ 838, 839, 841, 844, 845, 846, 847, 848, 849, 855,
- /* 190 */ 866, 820, 817, 872, 822, 852, 874, 833, 878, 856,
- /* 200 */ 843, 884, 859, 797, 853, 865, 810, 875, 882, 883,
- /* 210 */ 666, 811, 816, 860, 870, 635, 905, 877, 876, 858,
- /* 220 */ 871, 829, 873, 885, 889, 894, 903, 908, 902, 904,
- /* 230 */ 910, 906, 917, 947, 919, 977, 964, 981, 958, 972,
- /* 240 */ 982, 986, 985, 995, 943, 944, 959, 984, 989, 991,
- /* 250 */ 1005, 1019,
+ /* 0 */ -205, 492, 568, 629, 690, 343, 802, 857, 908, 920,
+ /* 10 */ -225, 973, 1006, 90, 1064, 1112, 1125, 1173, 1224, 1235,
+ /* 20 */ 1283, 1316, -144, 1379, 1392, 1432, 1483, 1513, 1545, 1596,
+ /* 30 */ 1605, 1658, 1674, 1706, 1736, 1784, 1793, 1848, 537, 751,
+ /* 40 */ -195, 215, 263, -271, -153, -253, -145, 200, 202, 363,
+ /* 50 */ -243, 339, -245, -240, -223, 38, 41, 344, 455, 514,
+ /* 60 */ 516, 524, 563, -244, 571, -246, -147, -209, 275, 538,
+ /* 70 */ 573, 219, 618, 445, 262, 165, 509, 644, -200, -178,
+ /* 80 */ -309, -309, -309, -18, 46, -143, -37, 238, 307, 372,
+ /* 90 */ 383, 431, 477, 484, 486, 490, 541, 547, 553, 581,
+ /* 100 */ 610, 619, 620, 621, 100, -140, -132, 137, -97, 156,
+ /* 110 */ -301, 98, 281, 399, 286, 212, 336, 451, 438, 295,
+ /* 120 */ 185, 408, -255, 216, 356, 403, 460, 475, 584, 496,
+ /* 130 */ 529, 617, 520, 542, 604, 575, 667, 667, 683, 699,
+ /* 140 */ 671, 652, 628, 628, 628, 614, 615, 627, 632, 667,
+ /* 150 */ 731, 689, 754, 713, 772, 777, 745, 755, 761, 791,
+ /* 160 */ 804, 806, 749, 800, 767, 803, 763, 778, 807, 766,
+ /* 170 */ 822, 801, 792, 831, 833, 839, 837, 848, 823, 825,
+ /* 180 */ 826, 827, 828, 830, 834, 835, 838, 840, 843, 854,
+ /* 190 */ 863, 820, 816, 871, 819, 844, 874, 841, 879, 855,
+ /* 200 */ 845, 884, 829, 794, 851, 856, 798, 859, 861, 862,
+ /* 210 */ 667, 810, 813, 814, 824, 628, 882, 865, 852, 847,
+ /* 220 */ 815, 821, 849, 836, 850, 846, 866, 899, 901, 903,
+ /* 230 */ 904, 910, 917, 931, 916, 958, 948, 964, 935, 966,
+ /* 240 */ 968, 970, 974, 986, 930, 936, 950, 980, 981, 985,
+ /* 250 */ 997, 998,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 10 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 20 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 30 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 40 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 50 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 60 */ 1356, 1356, 1356, 1425, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 70 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1423, 1564,
- /* 80 */ 1356, 1731, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 90 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 100 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1425, 1356,
- /* 110 */ 1742, 1742, 1742, 1423, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 120 */ 1519, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1603,
- /* 130 */ 1356, 1356, 1808, 1356, 1609, 1766, 1356, 1356, 1356, 1356,
- /* 140 */ 1472, 1758, 1734, 1748, 1735, 1793, 1793, 1793, 1751, 1356,
- /* 150 */ 1356, 1356, 1356, 1595, 1356, 1356, 1569, 1566, 1566, 1356,
- /* 160 */ 1356, 1356, 1356, 1425, 1356, 1425, 1356, 1356, 1425, 1356,
- /* 170 */ 1425, 1356, 1356, 1425, 1425, 1356, 1425, 1356, 1356, 1356,
- /* 180 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 190 */ 1356, 1356, 1356, 1423, 1605, 1356, 1423, 1356, 1423, 1356,
- /* 200 */ 1356, 1423, 1356, 1773, 1771, 1356, 1773, 1771, 1356, 1356,
- /* 210 */ 1356, 1785, 1781, 1764, 1762, 1748, 1356, 1356, 1356, 1799,
- /* 220 */ 1795, 1811, 1799, 1795, 1799, 1795, 1356, 1771, 1356, 1356,
- /* 230 */ 1771, 1356, 1577, 1356, 1356, 1423, 1356, 1423, 1356, 1488,
- /* 240 */ 1356, 1356, 1423, 1356, 1597, 1611, 1587, 1522, 1522, 1522,
- /* 250 */ 1426, 1361, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 260 */ 1356, 1356, 1356, 1484, 1675, 1784, 1783, 1707, 1706, 1705,
- /* 270 */ 1703, 1674, 1356, 1356, 1356, 1356, 1356, 1356, 1668, 1669,
- /* 280 */ 1667, 1666, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 290 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1732, 1356, 1796,
- /* 300 */ 1800, 1356, 1356, 1356, 1651, 1356, 1356, 1356, 1356, 1356,
- /* 310 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 320 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 330 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 340 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 350 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 360 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 370 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 380 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1390, 1356, 1356,
- /* 390 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 400 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 410 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 420 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 430 */ 1356, 1356, 1356, 1356, 1453, 1452, 1356, 1356, 1356, 1356,
- /* 440 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 450 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 460 */ 1356, 1356, 1356, 1356, 1356, 1356, 1755, 1765, 1356, 1356,
- /* 470 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1651, 1356,
- /* 480 */ 1782, 1356, 1741, 1737, 1356, 1356, 1733, 1356, 1356, 1794,
- /* 490 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1727,
- /* 500 */ 1356, 1700, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 510 */ 1662, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 520 */ 1356, 1356, 1356, 1650, 1356, 1691, 1356, 1356, 1356, 1356,
- /* 530 */ 1356, 1356, 1356, 1356, 1516, 1356, 1356, 1356, 1356, 1356,
- /* 540 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1501, 1499, 1498,
- /* 550 */ 1497, 1356, 1494, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 560 */ 1356, 1356, 1356, 1356, 1356, 1445, 1356, 1356, 1356, 1356,
- /* 570 */ 1356, 1356, 1356, 1356, 1356, 1436, 1356, 1435, 1356, 1356,
- /* 580 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 590 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 600 */ 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356,
- /* 610 */ 1356,
+ /* 0 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 10 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 20 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 30 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 40 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 50 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 60 */ 1354, 1354, 1354, 1423, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 70 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1421, 1561,
+ /* 80 */ 1354, 1728, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 90 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 100 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1423, 1354,
+ /* 110 */ 1739, 1739, 1739, 1421, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 120 */ 1517, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1600,
+ /* 130 */ 1354, 1354, 1805, 1354, 1606, 1763, 1354, 1354, 1354, 1354,
+ /* 140 */ 1470, 1755, 1731, 1745, 1732, 1790, 1790, 1790, 1748, 1354,
+ /* 150 */ 1354, 1354, 1354, 1592, 1354, 1354, 1566, 1563, 1563, 1354,
+ /* 160 */ 1354, 1354, 1354, 1423, 1354, 1423, 1354, 1354, 1423, 1354,
+ /* 170 */ 1423, 1354, 1354, 1423, 1423, 1354, 1423, 1354, 1354, 1354,
+ /* 180 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 190 */ 1354, 1354, 1354, 1421, 1602, 1354, 1421, 1354, 1421, 1354,
+ /* 200 */ 1354, 1421, 1354, 1770, 1768, 1354, 1770, 1768, 1354, 1354,
+ /* 210 */ 1354, 1782, 1778, 1761, 1759, 1745, 1354, 1354, 1354, 1796,
+ /* 220 */ 1792, 1808, 1796, 1792, 1796, 1792, 1354, 1768, 1354, 1354,
+ /* 230 */ 1768, 1354, 1574, 1354, 1354, 1421, 1354, 1421, 1354, 1486,
+ /* 240 */ 1354, 1354, 1421, 1354, 1594, 1608, 1584, 1520, 1520, 1520,
+ /* 250 */ 1424, 1359, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 260 */ 1354, 1354, 1354, 1672, 1781, 1780, 1704, 1703, 1702, 1700,
+ /* 270 */ 1671, 1482, 1354, 1354, 1354, 1354, 1354, 1354, 1665, 1666,
+ /* 280 */ 1664, 1663, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 290 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1729, 1354, 1793,
+ /* 300 */ 1797, 1354, 1354, 1354, 1648, 1354, 1354, 1354, 1354, 1354,
+ /* 310 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 320 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 330 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 340 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 350 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 360 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 370 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 380 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1388, 1354, 1354,
+ /* 390 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 400 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 410 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 420 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 430 */ 1354, 1354, 1354, 1354, 1354, 1451, 1450, 1354, 1354, 1354,
+ /* 440 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 450 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 460 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1752, 1762, 1354,
+ /* 470 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1648,
+ /* 480 */ 1354, 1779, 1354, 1738, 1734, 1354, 1354, 1730, 1354, 1354,
+ /* 490 */ 1791, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 500 */ 1724, 1354, 1697, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 510 */ 1354, 1659, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 520 */ 1354, 1354, 1354, 1354, 1647, 1354, 1688, 1354, 1354, 1354,
+ /* 530 */ 1354, 1354, 1354, 1354, 1354, 1514, 1354, 1354, 1354, 1354,
+ /* 540 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1499, 1497,
+ /* 550 */ 1496, 1495, 1354, 1492, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 560 */ 1354, 1354, 1354, 1354, 1354, 1443, 1354, 1354, 1354, 1354,
+ /* 570 */ 1354, 1354, 1354, 1354, 1354, 1434, 1354, 1433, 1354, 1354,
+ /* 580 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 590 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 600 */ 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354,
+ /* 610 */ 1354,
};
/********** End of lemon-generated parsing tables *****************************/
@@ -940,7 +958,6 @@ static const YYCODETYPE yyFallback[] = {
0, /* BLOB => nothing */
0, /* VARBINARY => nothing */
0, /* DECIMAL => nothing */
- 0, /* DELAY => nothing */
0, /* FILE_FACTOR => nothing */
0, /* NK_FLOAT => nothing */
0, /* ROLLUP => nothing */
@@ -975,7 +992,8 @@ static const YYCODETYPE yyFallback[] = {
0, /* INTERVAL => nothing */
0, /* TOPIC => nothing */
0, /* AS => nothing */
- 0, /* CGROUP => nothing */
+ 0, /* CONSUMER => nothing */
+ 0, /* GROUP => nothing */
0, /* WITH => nothing */
0, /* SCHEMA => nothing */
0, /* DESC => nothing */
@@ -1052,7 +1070,6 @@ static const YYCODETYPE yyFallback[] = {
0, /* PREV => nothing */
0, /* LINEAR => nothing */
0, /* NEXT => nothing */
- 0, /* GROUP => nothing */
0, /* HAVING => nothing */
0, /* ORDER => nothing */
0, /* SLIMIT => nothing */
@@ -1062,12 +1079,12 @@ static const YYCODETYPE yyFallback[] = {
0, /* ASC => nothing */
0, /* NULLS => nothing */
0, /* ID => nothing */
- 233, /* NK_BITNOT => ID */
- 233, /* INSERT => ID */
- 233, /* VALUES => ID */
- 233, /* IMPORT => ID */
- 233, /* NK_SEMI => ID */
- 233, /* FILE => ID */
+ 232, /* NK_BITNOT => ID */
+ 232, /* INSERT => ID */
+ 232, /* VALUES => ID */
+ 232, /* IMPORT => ID */
+ 232, /* NK_SEMI => ID */
+ 232, /* FILE => ID */
};
#endif /* YYFALLBACK */
@@ -1267,42 +1284,42 @@ static const char *const yyTokenName[] = {
/* 109 */ "BLOB",
/* 110 */ "VARBINARY",
/* 111 */ "DECIMAL",
- /* 112 */ "DELAY",
- /* 113 */ "FILE_FACTOR",
- /* 114 */ "NK_FLOAT",
- /* 115 */ "ROLLUP",
- /* 116 */ "TTL",
- /* 117 */ "SMA",
- /* 118 */ "SHOW",
- /* 119 */ "DATABASES",
- /* 120 */ "TABLES",
- /* 121 */ "STABLES",
- /* 122 */ "MNODES",
- /* 123 */ "MODULES",
- /* 124 */ "QNODES",
- /* 125 */ "FUNCTIONS",
- /* 126 */ "INDEXES",
- /* 127 */ "ACCOUNTS",
- /* 128 */ "APPS",
- /* 129 */ "CONNECTIONS",
- /* 130 */ "LICENCE",
- /* 131 */ "GRANTS",
- /* 132 */ "QUERIES",
- /* 133 */ "SCORES",
- /* 134 */ "TOPICS",
- /* 135 */ "VARIABLES",
- /* 136 */ "BNODES",
- /* 137 */ "SNODES",
- /* 138 */ "CLUSTER",
- /* 139 */ "TRANSACTIONS",
- /* 140 */ "LIKE",
- /* 141 */ "INDEX",
- /* 142 */ "FULLTEXT",
- /* 143 */ "FUNCTION",
- /* 144 */ "INTERVAL",
- /* 145 */ "TOPIC",
- /* 146 */ "AS",
- /* 147 */ "CGROUP",
+ /* 112 */ "FILE_FACTOR",
+ /* 113 */ "NK_FLOAT",
+ /* 114 */ "ROLLUP",
+ /* 115 */ "TTL",
+ /* 116 */ "SMA",
+ /* 117 */ "SHOW",
+ /* 118 */ "DATABASES",
+ /* 119 */ "TABLES",
+ /* 120 */ "STABLES",
+ /* 121 */ "MNODES",
+ /* 122 */ "MODULES",
+ /* 123 */ "QNODES",
+ /* 124 */ "FUNCTIONS",
+ /* 125 */ "INDEXES",
+ /* 126 */ "ACCOUNTS",
+ /* 127 */ "APPS",
+ /* 128 */ "CONNECTIONS",
+ /* 129 */ "LICENCE",
+ /* 130 */ "GRANTS",
+ /* 131 */ "QUERIES",
+ /* 132 */ "SCORES",
+ /* 133 */ "TOPICS",
+ /* 134 */ "VARIABLES",
+ /* 135 */ "BNODES",
+ /* 136 */ "SNODES",
+ /* 137 */ "CLUSTER",
+ /* 138 */ "TRANSACTIONS",
+ /* 139 */ "LIKE",
+ /* 140 */ "INDEX",
+ /* 141 */ "FULLTEXT",
+ /* 142 */ "FUNCTION",
+ /* 143 */ "INTERVAL",
+ /* 144 */ "TOPIC",
+ /* 145 */ "AS",
+ /* 146 */ "CONSUMER",
+ /* 147 */ "GROUP",
/* 148 */ "WITH",
/* 149 */ "SCHEMA",
/* 150 */ "DESC",
@@ -1379,143 +1396,142 @@ static const char *const yyTokenName[] = {
/* 221 */ "PREV",
/* 222 */ "LINEAR",
/* 223 */ "NEXT",
- /* 224 */ "GROUP",
- /* 225 */ "HAVING",
- /* 226 */ "ORDER",
- /* 227 */ "SLIMIT",
- /* 228 */ "SOFFSET",
- /* 229 */ "LIMIT",
- /* 230 */ "OFFSET",
- /* 231 */ "ASC",
- /* 232 */ "NULLS",
- /* 233 */ "ID",
- /* 234 */ "NK_BITNOT",
- /* 235 */ "INSERT",
- /* 236 */ "VALUES",
- /* 237 */ "IMPORT",
- /* 238 */ "NK_SEMI",
- /* 239 */ "FILE",
- /* 240 */ "cmd",
- /* 241 */ "account_options",
- /* 242 */ "alter_account_options",
- /* 243 */ "literal",
- /* 244 */ "alter_account_option",
- /* 245 */ "user_name",
- /* 246 */ "privileges",
- /* 247 */ "priv_level",
- /* 248 */ "priv_type_list",
- /* 249 */ "priv_type",
- /* 250 */ "db_name",
- /* 251 */ "dnode_endpoint",
- /* 252 */ "dnode_host_name",
- /* 253 */ "not_exists_opt",
- /* 254 */ "db_options",
- /* 255 */ "exists_opt",
- /* 256 */ "alter_db_options",
- /* 257 */ "integer_list",
- /* 258 */ "variable_list",
- /* 259 */ "retention_list",
- /* 260 */ "alter_db_option",
- /* 261 */ "retention",
- /* 262 */ "full_table_name",
- /* 263 */ "column_def_list",
- /* 264 */ "tags_def_opt",
- /* 265 */ "table_options",
- /* 266 */ "multi_create_clause",
- /* 267 */ "tags_def",
- /* 268 */ "multi_drop_clause",
- /* 269 */ "alter_table_clause",
- /* 270 */ "alter_table_options",
- /* 271 */ "column_name",
- /* 272 */ "type_name",
- /* 273 */ "signed_literal",
- /* 274 */ "create_subtable_clause",
- /* 275 */ "specific_tags_opt",
- /* 276 */ "literal_list",
- /* 277 */ "drop_table_clause",
- /* 278 */ "col_name_list",
- /* 279 */ "table_name",
- /* 280 */ "column_def",
- /* 281 */ "func_name_list",
- /* 282 */ "alter_table_option",
- /* 283 */ "col_name",
- /* 284 */ "db_name_cond_opt",
- /* 285 */ "like_pattern_opt",
- /* 286 */ "table_name_cond",
- /* 287 */ "from_db_opt",
- /* 288 */ "func_name",
- /* 289 */ "function_name",
- /* 290 */ "index_name",
- /* 291 */ "index_options",
- /* 292 */ "func_list",
- /* 293 */ "duration_literal",
- /* 294 */ "sliding_opt",
- /* 295 */ "func",
- /* 296 */ "expression_list",
- /* 297 */ "topic_name",
- /* 298 */ "topic_options",
- /* 299 */ "query_expression",
- /* 300 */ "cgroup_name",
- /* 301 */ "analyze_opt",
- /* 302 */ "explain_options",
- /* 303 */ "agg_func_opt",
- /* 304 */ "bufsize_opt",
- /* 305 */ "stream_name",
- /* 306 */ "stream_options",
- /* 307 */ "into_opt",
- /* 308 */ "dnode_list",
- /* 309 */ "signed",
- /* 310 */ "literal_func",
- /* 311 */ "table_alias",
- /* 312 */ "column_alias",
- /* 313 */ "expression",
- /* 314 */ "pseudo_column",
- /* 315 */ "column_reference",
- /* 316 */ "function_expression",
- /* 317 */ "subquery",
- /* 318 */ "star_func",
- /* 319 */ "star_func_para_list",
- /* 320 */ "noarg_func",
- /* 321 */ "other_para_list",
- /* 322 */ "star_func_para",
- /* 323 */ "predicate",
- /* 324 */ "compare_op",
- /* 325 */ "in_op",
- /* 326 */ "in_predicate_value",
- /* 327 */ "boolean_value_expression",
- /* 328 */ "boolean_primary",
- /* 329 */ "common_expression",
- /* 330 */ "from_clause",
- /* 331 */ "table_reference_list",
- /* 332 */ "table_reference",
- /* 333 */ "table_primary",
- /* 334 */ "joined_table",
- /* 335 */ "alias_opt",
- /* 336 */ "parenthesized_joined_table",
- /* 337 */ "join_type",
- /* 338 */ "search_condition",
- /* 339 */ "query_specification",
- /* 340 */ "set_quantifier_opt",
- /* 341 */ "select_list",
- /* 342 */ "where_clause_opt",
- /* 343 */ "partition_by_clause_opt",
- /* 344 */ "twindow_clause_opt",
- /* 345 */ "group_by_clause_opt",
- /* 346 */ "having_clause_opt",
- /* 347 */ "select_sublist",
- /* 348 */ "select_item",
- /* 349 */ "fill_opt",
- /* 350 */ "fill_mode",
- /* 351 */ "group_by_list",
- /* 352 */ "query_expression_body",
- /* 353 */ "order_by_clause_opt",
- /* 354 */ "slimit_clause_opt",
- /* 355 */ "limit_clause_opt",
- /* 356 */ "query_primary",
- /* 357 */ "sort_specification_list",
- /* 358 */ "sort_specification",
- /* 359 */ "ordering_specification_opt",
- /* 360 */ "null_ordering_opt",
+ /* 224 */ "HAVING",
+ /* 225 */ "ORDER",
+ /* 226 */ "SLIMIT",
+ /* 227 */ "SOFFSET",
+ /* 228 */ "LIMIT",
+ /* 229 */ "OFFSET",
+ /* 230 */ "ASC",
+ /* 231 */ "NULLS",
+ /* 232 */ "ID",
+ /* 233 */ "NK_BITNOT",
+ /* 234 */ "INSERT",
+ /* 235 */ "VALUES",
+ /* 236 */ "IMPORT",
+ /* 237 */ "NK_SEMI",
+ /* 238 */ "FILE",
+ /* 239 */ "cmd",
+ /* 240 */ "account_options",
+ /* 241 */ "alter_account_options",
+ /* 242 */ "literal",
+ /* 243 */ "alter_account_option",
+ /* 244 */ "user_name",
+ /* 245 */ "privileges",
+ /* 246 */ "priv_level",
+ /* 247 */ "priv_type_list",
+ /* 248 */ "priv_type",
+ /* 249 */ "db_name",
+ /* 250 */ "dnode_endpoint",
+ /* 251 */ "dnode_host_name",
+ /* 252 */ "not_exists_opt",
+ /* 253 */ "db_options",
+ /* 254 */ "exists_opt",
+ /* 255 */ "alter_db_options",
+ /* 256 */ "integer_list",
+ /* 257 */ "variable_list",
+ /* 258 */ "retention_list",
+ /* 259 */ "alter_db_option",
+ /* 260 */ "retention",
+ /* 261 */ "full_table_name",
+ /* 262 */ "column_def_list",
+ /* 263 */ "tags_def_opt",
+ /* 264 */ "table_options",
+ /* 265 */ "multi_create_clause",
+ /* 266 */ "tags_def",
+ /* 267 */ "multi_drop_clause",
+ /* 268 */ "alter_table_clause",
+ /* 269 */ "alter_table_options",
+ /* 270 */ "column_name",
+ /* 271 */ "type_name",
+ /* 272 */ "signed_literal",
+ /* 273 */ "create_subtable_clause",
+ /* 274 */ "specific_tags_opt",
+ /* 275 */ "literal_list",
+ /* 276 */ "drop_table_clause",
+ /* 277 */ "col_name_list",
+ /* 278 */ "table_name",
+ /* 279 */ "column_def",
+ /* 280 */ "func_name_list",
+ /* 281 */ "alter_table_option",
+ /* 282 */ "col_name",
+ /* 283 */ "db_name_cond_opt",
+ /* 284 */ "like_pattern_opt",
+ /* 285 */ "table_name_cond",
+ /* 286 */ "from_db_opt",
+ /* 287 */ "func_name",
+ /* 288 */ "function_name",
+ /* 289 */ "index_name",
+ /* 290 */ "index_options",
+ /* 291 */ "func_list",
+ /* 292 */ "duration_literal",
+ /* 293 */ "sliding_opt",
+ /* 294 */ "func",
+ /* 295 */ "expression_list",
+ /* 296 */ "topic_name",
+ /* 297 */ "topic_options",
+ /* 298 */ "query_expression",
+ /* 299 */ "cgroup_name",
+ /* 300 */ "analyze_opt",
+ /* 301 */ "explain_options",
+ /* 302 */ "agg_func_opt",
+ /* 303 */ "bufsize_opt",
+ /* 304 */ "stream_name",
+ /* 305 */ "stream_options",
+ /* 306 */ "into_opt",
+ /* 307 */ "dnode_list",
+ /* 308 */ "signed",
+ /* 309 */ "literal_func",
+ /* 310 */ "table_alias",
+ /* 311 */ "column_alias",
+ /* 312 */ "expression",
+ /* 313 */ "pseudo_column",
+ /* 314 */ "column_reference",
+ /* 315 */ "function_expression",
+ /* 316 */ "subquery",
+ /* 317 */ "star_func",
+ /* 318 */ "star_func_para_list",
+ /* 319 */ "noarg_func",
+ /* 320 */ "other_para_list",
+ /* 321 */ "star_func_para",
+ /* 322 */ "predicate",
+ /* 323 */ "compare_op",
+ /* 324 */ "in_op",
+ /* 325 */ "in_predicate_value",
+ /* 326 */ "boolean_value_expression",
+ /* 327 */ "boolean_primary",
+ /* 328 */ "common_expression",
+ /* 329 */ "from_clause",
+ /* 330 */ "table_reference_list",
+ /* 331 */ "table_reference",
+ /* 332 */ "table_primary",
+ /* 333 */ "joined_table",
+ /* 334 */ "alias_opt",
+ /* 335 */ "parenthesized_joined_table",
+ /* 336 */ "join_type",
+ /* 337 */ "search_condition",
+ /* 338 */ "query_specification",
+ /* 339 */ "set_quantifier_opt",
+ /* 340 */ "select_list",
+ /* 341 */ "where_clause_opt",
+ /* 342 */ "partition_by_clause_opt",
+ /* 343 */ "twindow_clause_opt",
+ /* 344 */ "group_by_clause_opt",
+ /* 345 */ "having_clause_opt",
+ /* 346 */ "select_sublist",
+ /* 347 */ "select_item",
+ /* 348 */ "fill_opt",
+ /* 349 */ "fill_mode",
+ /* 350 */ "group_by_list",
+ /* 351 */ "query_expression_body",
+ /* 352 */ "order_by_clause_opt",
+ /* 353 */ "slimit_clause_opt",
+ /* 354 */ "limit_clause_opt",
+ /* 355 */ "query_primary",
+ /* 356 */ "sort_specification_list",
+ /* 357 */ "sort_specification",
+ /* 358 */ "ordering_specification_opt",
+ /* 359 */ "null_ordering_opt",
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
@@ -1688,296 +1704,295 @@ static const char *const yyRuleName[] = {
/* 162 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP",
/* 163 */ "table_options ::=",
/* 164 */ "table_options ::= table_options COMMENT NK_STRING",
- /* 165 */ "table_options ::= table_options DELAY NK_INTEGER",
- /* 166 */ "table_options ::= table_options FILE_FACTOR NK_FLOAT",
- /* 167 */ "table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP",
- /* 168 */ "table_options ::= table_options TTL NK_INTEGER",
- /* 169 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP",
- /* 170 */ "alter_table_options ::= alter_table_option",
- /* 171 */ "alter_table_options ::= alter_table_options alter_table_option",
- /* 172 */ "alter_table_option ::= COMMENT NK_STRING",
- /* 173 */ "alter_table_option ::= TTL NK_INTEGER",
- /* 174 */ "col_name_list ::= col_name",
- /* 175 */ "col_name_list ::= col_name_list NK_COMMA col_name",
- /* 176 */ "col_name ::= column_name",
- /* 177 */ "cmd ::= SHOW DNODES",
- /* 178 */ "cmd ::= SHOW USERS",
- /* 179 */ "cmd ::= SHOW DATABASES",
- /* 180 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt",
- /* 181 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt",
- /* 182 */ "cmd ::= SHOW db_name_cond_opt VGROUPS",
- /* 183 */ "cmd ::= SHOW MNODES",
- /* 184 */ "cmd ::= SHOW MODULES",
- /* 185 */ "cmd ::= SHOW QNODES",
- /* 186 */ "cmd ::= SHOW FUNCTIONS",
- /* 187 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt",
- /* 188 */ "cmd ::= SHOW STREAMS",
- /* 189 */ "cmd ::= SHOW ACCOUNTS",
- /* 190 */ "cmd ::= SHOW APPS",
- /* 191 */ "cmd ::= SHOW CONNECTIONS",
- /* 192 */ "cmd ::= SHOW LICENCE",
- /* 193 */ "cmd ::= SHOW GRANTS",
- /* 194 */ "cmd ::= SHOW CREATE DATABASE db_name",
- /* 195 */ "cmd ::= SHOW CREATE TABLE full_table_name",
- /* 196 */ "cmd ::= SHOW CREATE STABLE full_table_name",
- /* 197 */ "cmd ::= SHOW QUERIES",
- /* 198 */ "cmd ::= SHOW SCORES",
- /* 199 */ "cmd ::= SHOW TOPICS",
- /* 200 */ "cmd ::= SHOW VARIABLES",
- /* 201 */ "cmd ::= SHOW BNODES",
- /* 202 */ "cmd ::= SHOW SNODES",
- /* 203 */ "cmd ::= SHOW CLUSTER",
- /* 204 */ "cmd ::= SHOW TRANSACTIONS",
- /* 205 */ "db_name_cond_opt ::=",
- /* 206 */ "db_name_cond_opt ::= db_name NK_DOT",
- /* 207 */ "like_pattern_opt ::=",
- /* 208 */ "like_pattern_opt ::= LIKE NK_STRING",
- /* 209 */ "table_name_cond ::= table_name",
- /* 210 */ "from_db_opt ::=",
- /* 211 */ "from_db_opt ::= FROM db_name",
- /* 212 */ "func_name_list ::= func_name",
- /* 213 */ "func_name_list ::= func_name_list NK_COMMA func_name",
- /* 214 */ "func_name ::= function_name",
- /* 215 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options",
- /* 216 */ "cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP",
- /* 217 */ "cmd ::= DROP INDEX exists_opt index_name ON table_name",
- /* 218 */ "index_options ::=",
- /* 219 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt",
- /* 220 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt",
- /* 221 */ "func_list ::= func",
- /* 222 */ "func_list ::= func_list NK_COMMA func",
- /* 223 */ "func ::= function_name NK_LP expression_list NK_RP",
- /* 224 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name topic_options AS query_expression",
- /* 225 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name topic_options AS db_name",
- /* 226 */ "cmd ::= DROP TOPIC exists_opt topic_name",
- /* 227 */ "cmd ::= DROP CGROUP exists_opt cgroup_name ON topic_name",
- /* 228 */ "topic_options ::=",
- /* 229 */ "topic_options ::= topic_options WITH TABLE",
- /* 230 */ "topic_options ::= topic_options WITH SCHEMA",
- /* 231 */ "topic_options ::= topic_options WITH TAG",
- /* 232 */ "cmd ::= DESC full_table_name",
- /* 233 */ "cmd ::= DESCRIBE full_table_name",
- /* 234 */ "cmd ::= RESET QUERY CACHE",
- /* 235 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression",
- /* 236 */ "analyze_opt ::=",
- /* 237 */ "analyze_opt ::= ANALYZE",
- /* 238 */ "explain_options ::=",
- /* 239 */ "explain_options ::= explain_options VERBOSE NK_BOOL",
- /* 240 */ "explain_options ::= explain_options RATIO NK_FLOAT",
- /* 241 */ "cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP",
- /* 242 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt",
- /* 243 */ "cmd ::= DROP FUNCTION exists_opt function_name",
- /* 244 */ "agg_func_opt ::=",
- /* 245 */ "agg_func_opt ::= AGGREGATE",
- /* 246 */ "bufsize_opt ::=",
- /* 247 */ "bufsize_opt ::= BUFSIZE NK_INTEGER",
- /* 248 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression",
- /* 249 */ "cmd ::= DROP STREAM exists_opt stream_name",
- /* 250 */ "into_opt ::=",
- /* 251 */ "into_opt ::= INTO full_table_name",
- /* 252 */ "stream_options ::=",
- /* 253 */ "stream_options ::= stream_options TRIGGER AT_ONCE",
- /* 254 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE",
- /* 255 */ "stream_options ::= stream_options WATERMARK duration_literal",
- /* 256 */ "cmd ::= KILL CONNECTION NK_INTEGER",
- /* 257 */ "cmd ::= KILL QUERY NK_INTEGER",
- /* 258 */ "cmd ::= KILL TRANSACTION NK_INTEGER",
- /* 259 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER",
- /* 260 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list",
- /* 261 */ "cmd ::= SPLIT VGROUP NK_INTEGER",
- /* 262 */ "dnode_list ::= DNODE NK_INTEGER",
- /* 263 */ "dnode_list ::= dnode_list DNODE NK_INTEGER",
- /* 264 */ "cmd ::= SYNCDB db_name REPLICA",
- /* 265 */ "cmd ::= query_expression",
- /* 266 */ "literal ::= NK_INTEGER",
- /* 267 */ "literal ::= NK_FLOAT",
- /* 268 */ "literal ::= NK_STRING",
- /* 269 */ "literal ::= NK_BOOL",
- /* 270 */ "literal ::= TIMESTAMP NK_STRING",
- /* 271 */ "literal ::= duration_literal",
- /* 272 */ "literal ::= NULL",
- /* 273 */ "literal ::= NK_QUESTION",
- /* 274 */ "duration_literal ::= NK_VARIABLE",
- /* 275 */ "signed ::= NK_INTEGER",
- /* 276 */ "signed ::= NK_PLUS NK_INTEGER",
- /* 277 */ "signed ::= NK_MINUS NK_INTEGER",
- /* 278 */ "signed ::= NK_FLOAT",
- /* 279 */ "signed ::= NK_PLUS NK_FLOAT",
- /* 280 */ "signed ::= NK_MINUS NK_FLOAT",
- /* 281 */ "signed_literal ::= signed",
- /* 282 */ "signed_literal ::= NK_STRING",
- /* 283 */ "signed_literal ::= NK_BOOL",
- /* 284 */ "signed_literal ::= TIMESTAMP NK_STRING",
- /* 285 */ "signed_literal ::= duration_literal",
- /* 286 */ "signed_literal ::= NULL",
- /* 287 */ "signed_literal ::= literal_func",
- /* 288 */ "literal_list ::= signed_literal",
- /* 289 */ "literal_list ::= literal_list NK_COMMA signed_literal",
- /* 290 */ "db_name ::= NK_ID",
- /* 291 */ "table_name ::= NK_ID",
- /* 292 */ "column_name ::= NK_ID",
- /* 293 */ "function_name ::= NK_ID",
- /* 294 */ "table_alias ::= NK_ID",
- /* 295 */ "column_alias ::= NK_ID",
- /* 296 */ "user_name ::= NK_ID",
- /* 297 */ "index_name ::= NK_ID",
- /* 298 */ "topic_name ::= NK_ID",
- /* 299 */ "stream_name ::= NK_ID",
- /* 300 */ "cgroup_name ::= NK_ID",
- /* 301 */ "expression ::= literal",
- /* 302 */ "expression ::= pseudo_column",
- /* 303 */ "expression ::= column_reference",
- /* 304 */ "expression ::= function_expression",
- /* 305 */ "expression ::= subquery",
- /* 306 */ "expression ::= NK_LP expression NK_RP",
- /* 307 */ "expression ::= NK_PLUS expression",
- /* 308 */ "expression ::= NK_MINUS expression",
- /* 309 */ "expression ::= expression NK_PLUS expression",
- /* 310 */ "expression ::= expression NK_MINUS expression",
- /* 311 */ "expression ::= expression NK_STAR expression",
- /* 312 */ "expression ::= expression NK_SLASH expression",
- /* 313 */ "expression ::= expression NK_REM expression",
- /* 314 */ "expression ::= column_reference NK_ARROW NK_STRING",
- /* 315 */ "expression_list ::= expression",
- /* 316 */ "expression_list ::= expression_list NK_COMMA expression",
- /* 317 */ "column_reference ::= column_name",
- /* 318 */ "column_reference ::= table_name NK_DOT column_name",
- /* 319 */ "pseudo_column ::= ROWTS",
- /* 320 */ "pseudo_column ::= TBNAME",
- /* 321 */ "pseudo_column ::= table_name NK_DOT TBNAME",
- /* 322 */ "pseudo_column ::= QSTARTTS",
- /* 323 */ "pseudo_column ::= QENDTS",
- /* 324 */ "pseudo_column ::= WSTARTTS",
- /* 325 */ "pseudo_column ::= WENDTS",
- /* 326 */ "pseudo_column ::= WDURATION",
- /* 327 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
- /* 328 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
- /* 329 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP",
- /* 330 */ "function_expression ::= literal_func",
- /* 331 */ "literal_func ::= noarg_func NK_LP NK_RP",
- /* 332 */ "literal_func ::= NOW",
- /* 333 */ "noarg_func ::= NOW",
- /* 334 */ "noarg_func ::= TODAY",
- /* 335 */ "noarg_func ::= TIMEZONE",
- /* 336 */ "star_func ::= COUNT",
- /* 337 */ "star_func ::= FIRST",
- /* 338 */ "star_func ::= LAST",
- /* 339 */ "star_func ::= LAST_ROW",
- /* 340 */ "star_func_para_list ::= NK_STAR",
- /* 341 */ "star_func_para_list ::= other_para_list",
- /* 342 */ "other_para_list ::= star_func_para",
- /* 343 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
- /* 344 */ "star_func_para ::= expression",
- /* 345 */ "star_func_para ::= table_name NK_DOT NK_STAR",
- /* 346 */ "predicate ::= expression compare_op expression",
- /* 347 */ "predicate ::= expression BETWEEN expression AND expression",
- /* 348 */ "predicate ::= expression NOT BETWEEN expression AND expression",
- /* 349 */ "predicate ::= expression IS NULL",
- /* 350 */ "predicate ::= expression IS NOT NULL",
- /* 351 */ "predicate ::= expression in_op in_predicate_value",
- /* 352 */ "compare_op ::= NK_LT",
- /* 353 */ "compare_op ::= NK_GT",
- /* 354 */ "compare_op ::= NK_LE",
- /* 355 */ "compare_op ::= NK_GE",
- /* 356 */ "compare_op ::= NK_NE",
- /* 357 */ "compare_op ::= NK_EQ",
- /* 358 */ "compare_op ::= LIKE",
- /* 359 */ "compare_op ::= NOT LIKE",
- /* 360 */ "compare_op ::= MATCH",
- /* 361 */ "compare_op ::= NMATCH",
- /* 362 */ "compare_op ::= CONTAINS",
- /* 363 */ "in_op ::= IN",
- /* 364 */ "in_op ::= NOT IN",
- /* 365 */ "in_predicate_value ::= NK_LP expression_list NK_RP",
- /* 366 */ "boolean_value_expression ::= boolean_primary",
- /* 367 */ "boolean_value_expression ::= NOT boolean_primary",
- /* 368 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
- /* 369 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
- /* 370 */ "boolean_primary ::= predicate",
- /* 371 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
- /* 372 */ "common_expression ::= expression",
- /* 373 */ "common_expression ::= boolean_value_expression",
- /* 374 */ "from_clause ::= FROM table_reference_list",
- /* 375 */ "table_reference_list ::= table_reference",
- /* 376 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
- /* 377 */ "table_reference ::= table_primary",
- /* 378 */ "table_reference ::= joined_table",
- /* 379 */ "table_primary ::= table_name alias_opt",
- /* 380 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
- /* 381 */ "table_primary ::= subquery alias_opt",
- /* 382 */ "table_primary ::= parenthesized_joined_table",
- /* 383 */ "alias_opt ::=",
- /* 384 */ "alias_opt ::= table_alias",
- /* 385 */ "alias_opt ::= AS table_alias",
- /* 386 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
- /* 387 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
- /* 388 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
- /* 389 */ "join_type ::=",
- /* 390 */ "join_type ::= INNER",
- /* 391 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt",
- /* 392 */ "set_quantifier_opt ::=",
- /* 393 */ "set_quantifier_opt ::= DISTINCT",
- /* 394 */ "set_quantifier_opt ::= ALL",
- /* 395 */ "select_list ::= NK_STAR",
- /* 396 */ "select_list ::= select_sublist",
- /* 397 */ "select_sublist ::= select_item",
- /* 398 */ "select_sublist ::= select_sublist NK_COMMA select_item",
- /* 399 */ "select_item ::= common_expression",
- /* 400 */ "select_item ::= common_expression column_alias",
- /* 401 */ "select_item ::= common_expression AS column_alias",
- /* 402 */ "select_item ::= table_name NK_DOT NK_STAR",
- /* 403 */ "where_clause_opt ::=",
- /* 404 */ "where_clause_opt ::= WHERE search_condition",
- /* 405 */ "partition_by_clause_opt ::=",
- /* 406 */ "partition_by_clause_opt ::= PARTITION BY expression_list",
- /* 407 */ "twindow_clause_opt ::=",
- /* 408 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP",
- /* 409 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP",
- /* 410 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
- /* 411 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
- /* 412 */ "sliding_opt ::=",
- /* 413 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
- /* 414 */ "fill_opt ::=",
- /* 415 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
- /* 416 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
- /* 417 */ "fill_mode ::= NONE",
- /* 418 */ "fill_mode ::= PREV",
- /* 419 */ "fill_mode ::= NULL",
- /* 420 */ "fill_mode ::= LINEAR",
- /* 421 */ "fill_mode ::= NEXT",
- /* 422 */ "group_by_clause_opt ::=",
- /* 423 */ "group_by_clause_opt ::= GROUP BY group_by_list",
- /* 424 */ "group_by_list ::= expression",
- /* 425 */ "group_by_list ::= group_by_list NK_COMMA expression",
- /* 426 */ "having_clause_opt ::=",
- /* 427 */ "having_clause_opt ::= HAVING search_condition",
- /* 428 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt",
- /* 429 */ "query_expression_body ::= query_primary",
- /* 430 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body",
- /* 431 */ "query_expression_body ::= query_expression_body UNION query_expression_body",
- /* 432 */ "query_primary ::= query_specification",
- /* 433 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP",
- /* 434 */ "order_by_clause_opt ::=",
- /* 435 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
- /* 436 */ "slimit_clause_opt ::=",
- /* 437 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
- /* 438 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
- /* 439 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 440 */ "limit_clause_opt ::=",
- /* 441 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
- /* 442 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
- /* 443 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 444 */ "subquery ::= NK_LP query_expression NK_RP",
- /* 445 */ "search_condition ::= common_expression",
- /* 446 */ "sort_specification_list ::= sort_specification",
- /* 447 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
- /* 448 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt",
- /* 449 */ "ordering_specification_opt ::=",
- /* 450 */ "ordering_specification_opt ::= ASC",
- /* 451 */ "ordering_specification_opt ::= DESC",
- /* 452 */ "null_ordering_opt ::=",
- /* 453 */ "null_ordering_opt ::= NULLS FIRST",
- /* 454 */ "null_ordering_opt ::= NULLS LAST",
+ /* 165 */ "table_options ::= table_options FILE_FACTOR NK_FLOAT",
+ /* 166 */ "table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP",
+ /* 167 */ "table_options ::= table_options TTL NK_INTEGER",
+ /* 168 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP",
+ /* 169 */ "alter_table_options ::= alter_table_option",
+ /* 170 */ "alter_table_options ::= alter_table_options alter_table_option",
+ /* 171 */ "alter_table_option ::= COMMENT NK_STRING",
+ /* 172 */ "alter_table_option ::= TTL NK_INTEGER",
+ /* 173 */ "col_name_list ::= col_name",
+ /* 174 */ "col_name_list ::= col_name_list NK_COMMA col_name",
+ /* 175 */ "col_name ::= column_name",
+ /* 176 */ "cmd ::= SHOW DNODES",
+ /* 177 */ "cmd ::= SHOW USERS",
+ /* 178 */ "cmd ::= SHOW DATABASES",
+ /* 179 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt",
+ /* 180 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt",
+ /* 181 */ "cmd ::= SHOW db_name_cond_opt VGROUPS",
+ /* 182 */ "cmd ::= SHOW MNODES",
+ /* 183 */ "cmd ::= SHOW MODULES",
+ /* 184 */ "cmd ::= SHOW QNODES",
+ /* 185 */ "cmd ::= SHOW FUNCTIONS",
+ /* 186 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt",
+ /* 187 */ "cmd ::= SHOW STREAMS",
+ /* 188 */ "cmd ::= SHOW ACCOUNTS",
+ /* 189 */ "cmd ::= SHOW APPS",
+ /* 190 */ "cmd ::= SHOW CONNECTIONS",
+ /* 191 */ "cmd ::= SHOW LICENCE",
+ /* 192 */ "cmd ::= SHOW GRANTS",
+ /* 193 */ "cmd ::= SHOW CREATE DATABASE db_name",
+ /* 194 */ "cmd ::= SHOW CREATE TABLE full_table_name",
+ /* 195 */ "cmd ::= SHOW CREATE STABLE full_table_name",
+ /* 196 */ "cmd ::= SHOW QUERIES",
+ /* 197 */ "cmd ::= SHOW SCORES",
+ /* 198 */ "cmd ::= SHOW TOPICS",
+ /* 199 */ "cmd ::= SHOW VARIABLES",
+ /* 200 */ "cmd ::= SHOW BNODES",
+ /* 201 */ "cmd ::= SHOW SNODES",
+ /* 202 */ "cmd ::= SHOW CLUSTER",
+ /* 203 */ "cmd ::= SHOW TRANSACTIONS",
+ /* 204 */ "db_name_cond_opt ::=",
+ /* 205 */ "db_name_cond_opt ::= db_name NK_DOT",
+ /* 206 */ "like_pattern_opt ::=",
+ /* 207 */ "like_pattern_opt ::= LIKE NK_STRING",
+ /* 208 */ "table_name_cond ::= table_name",
+ /* 209 */ "from_db_opt ::=",
+ /* 210 */ "from_db_opt ::= FROM db_name",
+ /* 211 */ "func_name_list ::= func_name",
+ /* 212 */ "func_name_list ::= func_name_list NK_COMMA func_name",
+ /* 213 */ "func_name ::= function_name",
+ /* 214 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options",
+ /* 215 */ "cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP",
+ /* 216 */ "cmd ::= DROP INDEX exists_opt index_name ON table_name",
+ /* 217 */ "index_options ::=",
+ /* 218 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt",
+ /* 219 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt",
+ /* 220 */ "func_list ::= func",
+ /* 221 */ "func_list ::= func_list NK_COMMA func",
+ /* 222 */ "func ::= function_name NK_LP expression_list NK_RP",
+ /* 223 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name topic_options AS query_expression",
+ /* 224 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name topic_options AS db_name",
+ /* 225 */ "cmd ::= DROP TOPIC exists_opt topic_name",
+ /* 226 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name",
+ /* 227 */ "topic_options ::=",
+ /* 228 */ "topic_options ::= topic_options WITH TABLE",
+ /* 229 */ "topic_options ::= topic_options WITH SCHEMA",
+ /* 230 */ "topic_options ::= topic_options WITH TAG",
+ /* 231 */ "cmd ::= DESC full_table_name",
+ /* 232 */ "cmd ::= DESCRIBE full_table_name",
+ /* 233 */ "cmd ::= RESET QUERY CACHE",
+ /* 234 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression",
+ /* 235 */ "analyze_opt ::=",
+ /* 236 */ "analyze_opt ::= ANALYZE",
+ /* 237 */ "explain_options ::=",
+ /* 238 */ "explain_options ::= explain_options VERBOSE NK_BOOL",
+ /* 239 */ "explain_options ::= explain_options RATIO NK_FLOAT",
+ /* 240 */ "cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP",
+ /* 241 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt",
+ /* 242 */ "cmd ::= DROP FUNCTION exists_opt function_name",
+ /* 243 */ "agg_func_opt ::=",
+ /* 244 */ "agg_func_opt ::= AGGREGATE",
+ /* 245 */ "bufsize_opt ::=",
+ /* 246 */ "bufsize_opt ::= BUFSIZE NK_INTEGER",
+ /* 247 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression",
+ /* 248 */ "cmd ::= DROP STREAM exists_opt stream_name",
+ /* 249 */ "into_opt ::=",
+ /* 250 */ "into_opt ::= INTO full_table_name",
+ /* 251 */ "stream_options ::=",
+ /* 252 */ "stream_options ::= stream_options TRIGGER AT_ONCE",
+ /* 253 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE",
+ /* 254 */ "stream_options ::= stream_options WATERMARK duration_literal",
+ /* 255 */ "cmd ::= KILL CONNECTION NK_INTEGER",
+ /* 256 */ "cmd ::= KILL QUERY NK_INTEGER",
+ /* 257 */ "cmd ::= KILL TRANSACTION NK_INTEGER",
+ /* 258 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER",
+ /* 259 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list",
+ /* 260 */ "cmd ::= SPLIT VGROUP NK_INTEGER",
+ /* 261 */ "dnode_list ::= DNODE NK_INTEGER",
+ /* 262 */ "dnode_list ::= dnode_list DNODE NK_INTEGER",
+ /* 263 */ "cmd ::= SYNCDB db_name REPLICA",
+ /* 264 */ "cmd ::= query_expression",
+ /* 265 */ "literal ::= NK_INTEGER",
+ /* 266 */ "literal ::= NK_FLOAT",
+ /* 267 */ "literal ::= NK_STRING",
+ /* 268 */ "literal ::= NK_BOOL",
+ /* 269 */ "literal ::= TIMESTAMP NK_STRING",
+ /* 270 */ "literal ::= duration_literal",
+ /* 271 */ "literal ::= NULL",
+ /* 272 */ "literal ::= NK_QUESTION",
+ /* 273 */ "duration_literal ::= NK_VARIABLE",
+ /* 274 */ "signed ::= NK_INTEGER",
+ /* 275 */ "signed ::= NK_PLUS NK_INTEGER",
+ /* 276 */ "signed ::= NK_MINUS NK_INTEGER",
+ /* 277 */ "signed ::= NK_FLOAT",
+ /* 278 */ "signed ::= NK_PLUS NK_FLOAT",
+ /* 279 */ "signed ::= NK_MINUS NK_FLOAT",
+ /* 280 */ "signed_literal ::= signed",
+ /* 281 */ "signed_literal ::= NK_STRING",
+ /* 282 */ "signed_literal ::= NK_BOOL",
+ /* 283 */ "signed_literal ::= TIMESTAMP NK_STRING",
+ /* 284 */ "signed_literal ::= duration_literal",
+ /* 285 */ "signed_literal ::= NULL",
+ /* 286 */ "signed_literal ::= literal_func",
+ /* 287 */ "literal_list ::= signed_literal",
+ /* 288 */ "literal_list ::= literal_list NK_COMMA signed_literal",
+ /* 289 */ "db_name ::= NK_ID",
+ /* 290 */ "table_name ::= NK_ID",
+ /* 291 */ "column_name ::= NK_ID",
+ /* 292 */ "function_name ::= NK_ID",
+ /* 293 */ "table_alias ::= NK_ID",
+ /* 294 */ "column_alias ::= NK_ID",
+ /* 295 */ "user_name ::= NK_ID",
+ /* 296 */ "index_name ::= NK_ID",
+ /* 297 */ "topic_name ::= NK_ID",
+ /* 298 */ "stream_name ::= NK_ID",
+ /* 299 */ "cgroup_name ::= NK_ID",
+ /* 300 */ "expression ::= literal",
+ /* 301 */ "expression ::= pseudo_column",
+ /* 302 */ "expression ::= column_reference",
+ /* 303 */ "expression ::= function_expression",
+ /* 304 */ "expression ::= subquery",
+ /* 305 */ "expression ::= NK_LP expression NK_RP",
+ /* 306 */ "expression ::= NK_PLUS expression",
+ /* 307 */ "expression ::= NK_MINUS expression",
+ /* 308 */ "expression ::= expression NK_PLUS expression",
+ /* 309 */ "expression ::= expression NK_MINUS expression",
+ /* 310 */ "expression ::= expression NK_STAR expression",
+ /* 311 */ "expression ::= expression NK_SLASH expression",
+ /* 312 */ "expression ::= expression NK_REM expression",
+ /* 313 */ "expression ::= column_reference NK_ARROW NK_STRING",
+ /* 314 */ "expression_list ::= expression",
+ /* 315 */ "expression_list ::= expression_list NK_COMMA expression",
+ /* 316 */ "column_reference ::= column_name",
+ /* 317 */ "column_reference ::= table_name NK_DOT column_name",
+ /* 318 */ "pseudo_column ::= ROWTS",
+ /* 319 */ "pseudo_column ::= TBNAME",
+ /* 320 */ "pseudo_column ::= table_name NK_DOT TBNAME",
+ /* 321 */ "pseudo_column ::= QSTARTTS",
+ /* 322 */ "pseudo_column ::= QENDTS",
+ /* 323 */ "pseudo_column ::= WSTARTTS",
+ /* 324 */ "pseudo_column ::= WENDTS",
+ /* 325 */ "pseudo_column ::= WDURATION",
+ /* 326 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
+ /* 327 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
+ /* 328 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP",
+ /* 329 */ "function_expression ::= literal_func",
+ /* 330 */ "literal_func ::= noarg_func NK_LP NK_RP",
+ /* 331 */ "literal_func ::= NOW",
+ /* 332 */ "noarg_func ::= NOW",
+ /* 333 */ "noarg_func ::= TODAY",
+ /* 334 */ "noarg_func ::= TIMEZONE",
+ /* 335 */ "star_func ::= COUNT",
+ /* 336 */ "star_func ::= FIRST",
+ /* 337 */ "star_func ::= LAST",
+ /* 338 */ "star_func ::= LAST_ROW",
+ /* 339 */ "star_func_para_list ::= NK_STAR",
+ /* 340 */ "star_func_para_list ::= other_para_list",
+ /* 341 */ "other_para_list ::= star_func_para",
+ /* 342 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
+ /* 343 */ "star_func_para ::= expression",
+ /* 344 */ "star_func_para ::= table_name NK_DOT NK_STAR",
+ /* 345 */ "predicate ::= expression compare_op expression",
+ /* 346 */ "predicate ::= expression BETWEEN expression AND expression",
+ /* 347 */ "predicate ::= expression NOT BETWEEN expression AND expression",
+ /* 348 */ "predicate ::= expression IS NULL",
+ /* 349 */ "predicate ::= expression IS NOT NULL",
+ /* 350 */ "predicate ::= expression in_op in_predicate_value",
+ /* 351 */ "compare_op ::= NK_LT",
+ /* 352 */ "compare_op ::= NK_GT",
+ /* 353 */ "compare_op ::= NK_LE",
+ /* 354 */ "compare_op ::= NK_GE",
+ /* 355 */ "compare_op ::= NK_NE",
+ /* 356 */ "compare_op ::= NK_EQ",
+ /* 357 */ "compare_op ::= LIKE",
+ /* 358 */ "compare_op ::= NOT LIKE",
+ /* 359 */ "compare_op ::= MATCH",
+ /* 360 */ "compare_op ::= NMATCH",
+ /* 361 */ "compare_op ::= CONTAINS",
+ /* 362 */ "in_op ::= IN",
+ /* 363 */ "in_op ::= NOT IN",
+ /* 364 */ "in_predicate_value ::= NK_LP expression_list NK_RP",
+ /* 365 */ "boolean_value_expression ::= boolean_primary",
+ /* 366 */ "boolean_value_expression ::= NOT boolean_primary",
+ /* 367 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
+ /* 368 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
+ /* 369 */ "boolean_primary ::= predicate",
+ /* 370 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
+ /* 371 */ "common_expression ::= expression",
+ /* 372 */ "common_expression ::= boolean_value_expression",
+ /* 373 */ "from_clause ::= FROM table_reference_list",
+ /* 374 */ "table_reference_list ::= table_reference",
+ /* 375 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
+ /* 376 */ "table_reference ::= table_primary",
+ /* 377 */ "table_reference ::= joined_table",
+ /* 378 */ "table_primary ::= table_name alias_opt",
+ /* 379 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
+ /* 380 */ "table_primary ::= subquery alias_opt",
+ /* 381 */ "table_primary ::= parenthesized_joined_table",
+ /* 382 */ "alias_opt ::=",
+ /* 383 */ "alias_opt ::= table_alias",
+ /* 384 */ "alias_opt ::= AS table_alias",
+ /* 385 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
+ /* 386 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
+ /* 387 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition",
+ /* 388 */ "join_type ::=",
+ /* 389 */ "join_type ::= INNER",
+ /* 390 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt",
+ /* 391 */ "set_quantifier_opt ::=",
+ /* 392 */ "set_quantifier_opt ::= DISTINCT",
+ /* 393 */ "set_quantifier_opt ::= ALL",
+ /* 394 */ "select_list ::= NK_STAR",
+ /* 395 */ "select_list ::= select_sublist",
+ /* 396 */ "select_sublist ::= select_item",
+ /* 397 */ "select_sublist ::= select_sublist NK_COMMA select_item",
+ /* 398 */ "select_item ::= common_expression",
+ /* 399 */ "select_item ::= common_expression column_alias",
+ /* 400 */ "select_item ::= common_expression AS column_alias",
+ /* 401 */ "select_item ::= table_name NK_DOT NK_STAR",
+ /* 402 */ "where_clause_opt ::=",
+ /* 403 */ "where_clause_opt ::= WHERE search_condition",
+ /* 404 */ "partition_by_clause_opt ::=",
+ /* 405 */ "partition_by_clause_opt ::= PARTITION BY expression_list",
+ /* 406 */ "twindow_clause_opt ::=",
+ /* 407 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP",
+ /* 408 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP",
+ /* 409 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt",
+ /* 410 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt",
+ /* 411 */ "sliding_opt ::=",
+ /* 412 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP",
+ /* 413 */ "fill_opt ::=",
+ /* 414 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
+ /* 415 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP",
+ /* 416 */ "fill_mode ::= NONE",
+ /* 417 */ "fill_mode ::= PREV",
+ /* 418 */ "fill_mode ::= NULL",
+ /* 419 */ "fill_mode ::= LINEAR",
+ /* 420 */ "fill_mode ::= NEXT",
+ /* 421 */ "group_by_clause_opt ::=",
+ /* 422 */ "group_by_clause_opt ::= GROUP BY group_by_list",
+ /* 423 */ "group_by_list ::= expression",
+ /* 424 */ "group_by_list ::= group_by_list NK_COMMA expression",
+ /* 425 */ "having_clause_opt ::=",
+ /* 426 */ "having_clause_opt ::= HAVING search_condition",
+ /* 427 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt",
+ /* 428 */ "query_expression_body ::= query_primary",
+ /* 429 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body",
+ /* 430 */ "query_expression_body ::= query_expression_body UNION query_expression_body",
+ /* 431 */ "query_primary ::= query_specification",
+ /* 432 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP",
+ /* 433 */ "order_by_clause_opt ::=",
+ /* 434 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
+ /* 435 */ "slimit_clause_opt ::=",
+ /* 436 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
+ /* 437 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
+ /* 438 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 439 */ "limit_clause_opt ::=",
+ /* 440 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
+ /* 441 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
+ /* 442 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 443 */ "subquery ::= NK_LP query_expression NK_RP",
+ /* 444 */ "search_condition ::= common_expression",
+ /* 445 */ "sort_specification_list ::= sort_specification",
+ /* 446 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
+ /* 447 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt",
+ /* 448 */ "ordering_specification_opt ::=",
+ /* 449 */ "ordering_specification_opt ::= ASC",
+ /* 450 */ "ordering_specification_opt ::= DESC",
+ /* 451 */ "null_ordering_opt ::=",
+ /* 452 */ "null_ordering_opt ::= NULLS FIRST",
+ /* 453 */ "null_ordering_opt ::= NULLS LAST",
};
#endif /* NDEBUG */
@@ -2104,175 +2119,175 @@ static void yy_destructor(
*/
/********* Begin destructor definitions ***************************************/
/* Default NON-TERMINAL Destructor */
- case 240: /* cmd */
- case 243: /* literal */
- case 254: /* db_options */
- case 256: /* alter_db_options */
- case 261: /* retention */
- case 262: /* full_table_name */
- case 265: /* table_options */
- case 269: /* alter_table_clause */
- case 270: /* alter_table_options */
- case 273: /* signed_literal */
- case 274: /* create_subtable_clause */
- case 277: /* drop_table_clause */
- case 280: /* column_def */
- case 283: /* col_name */
- case 284: /* db_name_cond_opt */
- case 285: /* like_pattern_opt */
- case 286: /* table_name_cond */
- case 287: /* from_db_opt */
- case 288: /* func_name */
- case 291: /* index_options */
- case 293: /* duration_literal */
- case 294: /* sliding_opt */
- case 295: /* func */
- case 298: /* topic_options */
- case 299: /* query_expression */
- case 302: /* explain_options */
- case 306: /* stream_options */
- case 307: /* into_opt */
- case 309: /* signed */
- case 310: /* literal_func */
- case 313: /* expression */
- case 314: /* pseudo_column */
- case 315: /* column_reference */
- case 316: /* function_expression */
- case 317: /* subquery */
- case 322: /* star_func_para */
- case 323: /* predicate */
- case 326: /* in_predicate_value */
- case 327: /* boolean_value_expression */
- case 328: /* boolean_primary */
- case 329: /* common_expression */
- case 330: /* from_clause */
- case 331: /* table_reference_list */
- case 332: /* table_reference */
- case 333: /* table_primary */
- case 334: /* joined_table */
- case 336: /* parenthesized_joined_table */
- case 338: /* search_condition */
- case 339: /* query_specification */
- case 342: /* where_clause_opt */
- case 344: /* twindow_clause_opt */
- case 346: /* having_clause_opt */
- case 348: /* select_item */
- case 349: /* fill_opt */
- case 352: /* query_expression_body */
- case 354: /* slimit_clause_opt */
- case 355: /* limit_clause_opt */
- case 356: /* query_primary */
- case 358: /* sort_specification */
+ case 239: /* cmd */
+ case 242: /* literal */
+ case 253: /* db_options */
+ case 255: /* alter_db_options */
+ case 260: /* retention */
+ case 261: /* full_table_name */
+ case 264: /* table_options */
+ case 268: /* alter_table_clause */
+ case 269: /* alter_table_options */
+ case 272: /* signed_literal */
+ case 273: /* create_subtable_clause */
+ case 276: /* drop_table_clause */
+ case 279: /* column_def */
+ case 282: /* col_name */
+ case 283: /* db_name_cond_opt */
+ case 284: /* like_pattern_opt */
+ case 285: /* table_name_cond */
+ case 286: /* from_db_opt */
+ case 287: /* func_name */
+ case 290: /* index_options */
+ case 292: /* duration_literal */
+ case 293: /* sliding_opt */
+ case 294: /* func */
+ case 297: /* topic_options */
+ case 298: /* query_expression */
+ case 301: /* explain_options */
+ case 305: /* stream_options */
+ case 306: /* into_opt */
+ case 308: /* signed */
+ case 309: /* literal_func */
+ case 312: /* expression */
+ case 313: /* pseudo_column */
+ case 314: /* column_reference */
+ case 315: /* function_expression */
+ case 316: /* subquery */
+ case 321: /* star_func_para */
+ case 322: /* predicate */
+ case 325: /* in_predicate_value */
+ case 326: /* boolean_value_expression */
+ case 327: /* boolean_primary */
+ case 328: /* common_expression */
+ case 329: /* from_clause */
+ case 330: /* table_reference_list */
+ case 331: /* table_reference */
+ case 332: /* table_primary */
+ case 333: /* joined_table */
+ case 335: /* parenthesized_joined_table */
+ case 337: /* search_condition */
+ case 338: /* query_specification */
+ case 341: /* where_clause_opt */
+ case 343: /* twindow_clause_opt */
+ case 345: /* having_clause_opt */
+ case 347: /* select_item */
+ case 348: /* fill_opt */
+ case 351: /* query_expression_body */
+ case 353: /* slimit_clause_opt */
+ case 354: /* limit_clause_opt */
+ case 355: /* query_primary */
+ case 357: /* sort_specification */
{
- nodesDestroyNode((yypminor->yy636));
+ nodesDestroyNode((yypminor->yy632));
}
break;
- case 241: /* account_options */
- case 242: /* alter_account_options */
- case 244: /* alter_account_option */
- case 304: /* bufsize_opt */
+ case 240: /* account_options */
+ case 241: /* alter_account_options */
+ case 243: /* alter_account_option */
+ case 303: /* bufsize_opt */
{
}
break;
- case 245: /* user_name */
- case 247: /* priv_level */
- case 250: /* db_name */
- case 251: /* dnode_endpoint */
- case 252: /* dnode_host_name */
- case 271: /* column_name */
- case 279: /* table_name */
- case 289: /* function_name */
- case 290: /* index_name */
- case 297: /* topic_name */
- case 300: /* cgroup_name */
- case 305: /* stream_name */
- case 311: /* table_alias */
- case 312: /* column_alias */
- case 318: /* star_func */
- case 320: /* noarg_func */
- case 335: /* alias_opt */
+ case 244: /* user_name */
+ case 246: /* priv_level */
+ case 249: /* db_name */
+ case 250: /* dnode_endpoint */
+ case 251: /* dnode_host_name */
+ case 270: /* column_name */
+ case 278: /* table_name */
+ case 288: /* function_name */
+ case 289: /* index_name */
+ case 296: /* topic_name */
+ case 299: /* cgroup_name */
+ case 304: /* stream_name */
+ case 310: /* table_alias */
+ case 311: /* column_alias */
+ case 317: /* star_func */
+ case 319: /* noarg_func */
+ case 334: /* alias_opt */
{
}
break;
- case 246: /* privileges */
- case 248: /* priv_type_list */
- case 249: /* priv_type */
+ case 245: /* privileges */
+ case 247: /* priv_type_list */
+ case 248: /* priv_type */
{
}
break;
- case 253: /* not_exists_opt */
- case 255: /* exists_opt */
- case 301: /* analyze_opt */
- case 303: /* agg_func_opt */
- case 340: /* set_quantifier_opt */
+ case 252: /* not_exists_opt */
+ case 254: /* exists_opt */
+ case 300: /* analyze_opt */
+ case 302: /* agg_func_opt */
+ case 339: /* set_quantifier_opt */
{
}
break;
- case 257: /* integer_list */
- case 258: /* variable_list */
- case 259: /* retention_list */
- case 263: /* column_def_list */
- case 264: /* tags_def_opt */
- case 266: /* multi_create_clause */
- case 267: /* tags_def */
- case 268: /* multi_drop_clause */
- case 275: /* specific_tags_opt */
- case 276: /* literal_list */
- case 278: /* col_name_list */
- case 281: /* func_name_list */
- case 292: /* func_list */
- case 296: /* expression_list */
- case 308: /* dnode_list */
- case 319: /* star_func_para_list */
- case 321: /* other_para_list */
- case 341: /* select_list */
- case 343: /* partition_by_clause_opt */
- case 345: /* group_by_clause_opt */
- case 347: /* select_sublist */
- case 351: /* group_by_list */
- case 353: /* order_by_clause_opt */
- case 357: /* sort_specification_list */
+ case 256: /* integer_list */
+ case 257: /* variable_list */
+ case 258: /* retention_list */
+ case 262: /* column_def_list */
+ case 263: /* tags_def_opt */
+ case 265: /* multi_create_clause */
+ case 266: /* tags_def */
+ case 267: /* multi_drop_clause */
+ case 274: /* specific_tags_opt */
+ case 275: /* literal_list */
+ case 277: /* col_name_list */
+ case 280: /* func_name_list */
+ case 291: /* func_list */
+ case 295: /* expression_list */
+ case 307: /* dnode_list */
+ case 318: /* star_func_para_list */
+ case 320: /* other_para_list */
+ case 340: /* select_list */
+ case 342: /* partition_by_clause_opt */
+ case 344: /* group_by_clause_opt */
+ case 346: /* select_sublist */
+ case 350: /* group_by_list */
+ case 352: /* order_by_clause_opt */
+ case 356: /* sort_specification_list */
{
- nodesDestroyList((yypminor->yy236));
+ nodesDestroyList((yypminor->yy424));
}
break;
- case 260: /* alter_db_option */
- case 282: /* alter_table_option */
+ case 259: /* alter_db_option */
+ case 281: /* alter_table_option */
{
}
break;
- case 272: /* type_name */
+ case 271: /* type_name */
{
}
break;
- case 324: /* compare_op */
- case 325: /* in_op */
+ case 323: /* compare_op */
+ case 324: /* in_op */
{
}
break;
- case 337: /* join_type */
+ case 336: /* join_type */
{
}
break;
- case 350: /* fill_mode */
+ case 349: /* fill_mode */
{
}
break;
- case 359: /* ordering_specification_opt */
+ case 358: /* ordering_specification_opt */
{
}
break;
- case 360: /* null_ordering_opt */
+ case 359: /* null_ordering_opt */
{
}
@@ -2571,461 +2586,460 @@ static const struct {
YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
signed char nrhs; /* Negative of the number of RHS symbols in the rule */
} yyRuleInfo[] = {
- { 240, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
- { 240, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
- { 241, 0 }, /* (2) account_options ::= */
- { 241, -3 }, /* (3) account_options ::= account_options PPS literal */
- { 241, -3 }, /* (4) account_options ::= account_options TSERIES literal */
- { 241, -3 }, /* (5) account_options ::= account_options STORAGE literal */
- { 241, -3 }, /* (6) account_options ::= account_options STREAMS literal */
- { 241, -3 }, /* (7) account_options ::= account_options QTIME literal */
- { 241, -3 }, /* (8) account_options ::= account_options DBS literal */
- { 241, -3 }, /* (9) account_options ::= account_options USERS literal */
- { 241, -3 }, /* (10) account_options ::= account_options CONNS literal */
- { 241, -3 }, /* (11) account_options ::= account_options STATE literal */
- { 242, -1 }, /* (12) alter_account_options ::= alter_account_option */
- { 242, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */
- { 244, -2 }, /* (14) alter_account_option ::= PASS literal */
- { 244, -2 }, /* (15) alter_account_option ::= PPS literal */
- { 244, -2 }, /* (16) alter_account_option ::= TSERIES literal */
- { 244, -2 }, /* (17) alter_account_option ::= STORAGE literal */
- { 244, -2 }, /* (18) alter_account_option ::= STREAMS literal */
- { 244, -2 }, /* (19) alter_account_option ::= QTIME literal */
- { 244, -2 }, /* (20) alter_account_option ::= DBS literal */
- { 244, -2 }, /* (21) alter_account_option ::= USERS literal */
- { 244, -2 }, /* (22) alter_account_option ::= CONNS literal */
- { 244, -2 }, /* (23) alter_account_option ::= STATE literal */
- { 240, -5 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING */
- { 240, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */
- { 240, -5 }, /* (26) cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */
- { 240, -3 }, /* (27) cmd ::= DROP USER user_name */
- { 240, -6 }, /* (28) cmd ::= GRANT privileges ON priv_level TO user_name */
- { 240, -6 }, /* (29) cmd ::= REVOKE privileges ON priv_level FROM user_name */
- { 246, -1 }, /* (30) privileges ::= ALL */
- { 246, -1 }, /* (31) privileges ::= priv_type_list */
- { 248, -1 }, /* (32) priv_type_list ::= priv_type */
- { 248, -3 }, /* (33) priv_type_list ::= priv_type_list NK_COMMA priv_type */
- { 249, -1 }, /* (34) priv_type ::= READ */
- { 249, -1 }, /* (35) priv_type ::= WRITE */
- { 247, -3 }, /* (36) priv_level ::= NK_STAR NK_DOT NK_STAR */
- { 247, -3 }, /* (37) priv_level ::= db_name NK_DOT NK_STAR */
- { 240, -3 }, /* (38) cmd ::= CREATE DNODE dnode_endpoint */
- { 240, -5 }, /* (39) cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */
- { 240, -3 }, /* (40) cmd ::= DROP DNODE NK_INTEGER */
- { 240, -3 }, /* (41) cmd ::= DROP DNODE dnode_endpoint */
- { 240, -4 }, /* (42) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
- { 240, -5 }, /* (43) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
- { 240, -4 }, /* (44) cmd ::= ALTER ALL DNODES NK_STRING */
- { 240, -5 }, /* (45) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
- { 251, -1 }, /* (46) dnode_endpoint ::= NK_STRING */
- { 252, -1 }, /* (47) dnode_host_name ::= NK_ID */
- { 252, -1 }, /* (48) dnode_host_name ::= NK_IPTOKEN */
- { 240, -3 }, /* (49) cmd ::= ALTER LOCAL NK_STRING */
- { 240, -4 }, /* (50) cmd ::= ALTER LOCAL NK_STRING NK_STRING */
- { 240, -5 }, /* (51) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
- { 240, -5 }, /* (52) cmd ::= DROP QNODE ON DNODE NK_INTEGER */
- { 240, -5 }, /* (53) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
- { 240, -5 }, /* (54) cmd ::= DROP BNODE ON DNODE NK_INTEGER */
- { 240, -5 }, /* (55) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
- { 240, -5 }, /* (56) cmd ::= DROP SNODE ON DNODE NK_INTEGER */
- { 240, -5 }, /* (57) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
- { 240, -5 }, /* (58) cmd ::= DROP MNODE ON DNODE NK_INTEGER */
- { 240, -5 }, /* (59) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
- { 240, -4 }, /* (60) cmd ::= DROP DATABASE exists_opt db_name */
- { 240, -2 }, /* (61) cmd ::= USE db_name */
- { 240, -4 }, /* (62) cmd ::= ALTER DATABASE db_name alter_db_options */
- { 253, -3 }, /* (63) not_exists_opt ::= IF NOT EXISTS */
- { 253, 0 }, /* (64) not_exists_opt ::= */
- { 255, -2 }, /* (65) exists_opt ::= IF EXISTS */
- { 255, 0 }, /* (66) exists_opt ::= */
- { 254, 0 }, /* (67) db_options ::= */
- { 254, -3 }, /* (68) db_options ::= db_options BUFFER NK_INTEGER */
- { 254, -3 }, /* (69) db_options ::= db_options CACHELAST NK_INTEGER */
- { 254, -3 }, /* (70) db_options ::= db_options COMP NK_INTEGER */
- { 254, -3 }, /* (71) db_options ::= db_options DAYS NK_INTEGER */
- { 254, -3 }, /* (72) db_options ::= db_options DAYS NK_VARIABLE */
- { 254, -3 }, /* (73) db_options ::= db_options FSYNC NK_INTEGER */
- { 254, -3 }, /* (74) db_options ::= db_options MAXROWS NK_INTEGER */
- { 254, -3 }, /* (75) db_options ::= db_options MINROWS NK_INTEGER */
- { 254, -3 }, /* (76) db_options ::= db_options KEEP integer_list */
- { 254, -3 }, /* (77) db_options ::= db_options KEEP variable_list */
- { 254, -3 }, /* (78) db_options ::= db_options PAGES NK_INTEGER */
- { 254, -3 }, /* (79) db_options ::= db_options PAGESIZE NK_INTEGER */
- { 254, -3 }, /* (80) db_options ::= db_options PRECISION NK_STRING */
- { 254, -3 }, /* (81) db_options ::= db_options REPLICA NK_INTEGER */
- { 254, -3 }, /* (82) db_options ::= db_options STRICT NK_INTEGER */
- { 254, -3 }, /* (83) db_options ::= db_options WAL NK_INTEGER */
- { 254, -3 }, /* (84) db_options ::= db_options VGROUPS NK_INTEGER */
- { 254, -3 }, /* (85) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
- { 254, -3 }, /* (86) db_options ::= db_options RETENTIONS retention_list */
- { 254, -3 }, /* (87) db_options ::= db_options SCHEMALESS NK_INTEGER */
- { 256, -1 }, /* (88) alter_db_options ::= alter_db_option */
- { 256, -2 }, /* (89) alter_db_options ::= alter_db_options alter_db_option */
- { 260, -2 }, /* (90) alter_db_option ::= BUFFER NK_INTEGER */
- { 260, -2 }, /* (91) alter_db_option ::= CACHELAST NK_INTEGER */
- { 260, -2 }, /* (92) alter_db_option ::= FSYNC NK_INTEGER */
- { 260, -2 }, /* (93) alter_db_option ::= KEEP integer_list */
- { 260, -2 }, /* (94) alter_db_option ::= KEEP variable_list */
- { 260, -2 }, /* (95) alter_db_option ::= PAGES NK_INTEGER */
- { 260, -2 }, /* (96) alter_db_option ::= REPLICA NK_INTEGER */
- { 260, -2 }, /* (97) alter_db_option ::= STRICT NK_INTEGER */
- { 260, -2 }, /* (98) alter_db_option ::= WAL NK_INTEGER */
- { 257, -1 }, /* (99) integer_list ::= NK_INTEGER */
- { 257, -3 }, /* (100) integer_list ::= integer_list NK_COMMA NK_INTEGER */
- { 258, -1 }, /* (101) variable_list ::= NK_VARIABLE */
- { 258, -3 }, /* (102) variable_list ::= variable_list NK_COMMA NK_VARIABLE */
- { 259, -1 }, /* (103) retention_list ::= retention */
- { 259, -3 }, /* (104) retention_list ::= retention_list NK_COMMA retention */
- { 261, -3 }, /* (105) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
- { 240, -9 }, /* (106) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
- { 240, -3 }, /* (107) cmd ::= CREATE TABLE multi_create_clause */
- { 240, -9 }, /* (108) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
- { 240, -3 }, /* (109) cmd ::= DROP TABLE multi_drop_clause */
- { 240, -4 }, /* (110) cmd ::= DROP STABLE exists_opt full_table_name */
- { 240, -3 }, /* (111) cmd ::= ALTER TABLE alter_table_clause */
- { 240, -3 }, /* (112) cmd ::= ALTER STABLE alter_table_clause */
- { 269, -2 }, /* (113) alter_table_clause ::= full_table_name alter_table_options */
- { 269, -5 }, /* (114) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
- { 269, -4 }, /* (115) alter_table_clause ::= full_table_name DROP COLUMN column_name */
- { 269, -5 }, /* (116) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
- { 269, -5 }, /* (117) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
- { 269, -5 }, /* (118) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
- { 269, -4 }, /* (119) alter_table_clause ::= full_table_name DROP TAG column_name */
- { 269, -5 }, /* (120) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
- { 269, -5 }, /* (121) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
- { 269, -6 }, /* (122) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
- { 266, -1 }, /* (123) multi_create_clause ::= create_subtable_clause */
- { 266, -2 }, /* (124) multi_create_clause ::= multi_create_clause create_subtable_clause */
- { 274, -10 }, /* (125) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP table_options */
- { 268, -1 }, /* (126) multi_drop_clause ::= drop_table_clause */
- { 268, -2 }, /* (127) multi_drop_clause ::= multi_drop_clause drop_table_clause */
- { 277, -2 }, /* (128) drop_table_clause ::= exists_opt full_table_name */
- { 275, 0 }, /* (129) specific_tags_opt ::= */
- { 275, -3 }, /* (130) specific_tags_opt ::= NK_LP col_name_list NK_RP */
- { 262, -1 }, /* (131) full_table_name ::= table_name */
- { 262, -3 }, /* (132) full_table_name ::= db_name NK_DOT table_name */
- { 263, -1 }, /* (133) column_def_list ::= column_def */
- { 263, -3 }, /* (134) column_def_list ::= column_def_list NK_COMMA column_def */
- { 280, -2 }, /* (135) column_def ::= column_name type_name */
- { 280, -4 }, /* (136) column_def ::= column_name type_name COMMENT NK_STRING */
- { 272, -1 }, /* (137) type_name ::= BOOL */
- { 272, -1 }, /* (138) type_name ::= TINYINT */
- { 272, -1 }, /* (139) type_name ::= SMALLINT */
- { 272, -1 }, /* (140) type_name ::= INT */
- { 272, -1 }, /* (141) type_name ::= INTEGER */
- { 272, -1 }, /* (142) type_name ::= BIGINT */
- { 272, -1 }, /* (143) type_name ::= FLOAT */
- { 272, -1 }, /* (144) type_name ::= DOUBLE */
- { 272, -4 }, /* (145) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
- { 272, -1 }, /* (146) type_name ::= TIMESTAMP */
- { 272, -4 }, /* (147) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
- { 272, -2 }, /* (148) type_name ::= TINYINT UNSIGNED */
- { 272, -2 }, /* (149) type_name ::= SMALLINT UNSIGNED */
- { 272, -2 }, /* (150) type_name ::= INT UNSIGNED */
- { 272, -2 }, /* (151) type_name ::= BIGINT UNSIGNED */
- { 272, -1 }, /* (152) type_name ::= JSON */
- { 272, -4 }, /* (153) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
- { 272, -1 }, /* (154) type_name ::= MEDIUMBLOB */
- { 272, -1 }, /* (155) type_name ::= BLOB */
- { 272, -4 }, /* (156) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
- { 272, -1 }, /* (157) type_name ::= DECIMAL */
- { 272, -4 }, /* (158) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
- { 272, -6 }, /* (159) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
- { 264, 0 }, /* (160) tags_def_opt ::= */
- { 264, -1 }, /* (161) tags_def_opt ::= tags_def */
- { 267, -4 }, /* (162) tags_def ::= TAGS NK_LP column_def_list NK_RP */
- { 265, 0 }, /* (163) table_options ::= */
- { 265, -3 }, /* (164) table_options ::= table_options COMMENT NK_STRING */
- { 265, -3 }, /* (165) table_options ::= table_options DELAY NK_INTEGER */
- { 265, -3 }, /* (166) table_options ::= table_options FILE_FACTOR NK_FLOAT */
- { 265, -5 }, /* (167) table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */
- { 265, -3 }, /* (168) table_options ::= table_options TTL NK_INTEGER */
- { 265, -5 }, /* (169) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
- { 270, -1 }, /* (170) alter_table_options ::= alter_table_option */
- { 270, -2 }, /* (171) alter_table_options ::= alter_table_options alter_table_option */
- { 282, -2 }, /* (172) alter_table_option ::= COMMENT NK_STRING */
- { 282, -2 }, /* (173) alter_table_option ::= TTL NK_INTEGER */
- { 278, -1 }, /* (174) col_name_list ::= col_name */
- { 278, -3 }, /* (175) col_name_list ::= col_name_list NK_COMMA col_name */
- { 283, -1 }, /* (176) col_name ::= column_name */
- { 240, -2 }, /* (177) cmd ::= SHOW DNODES */
- { 240, -2 }, /* (178) cmd ::= SHOW USERS */
- { 240, -2 }, /* (179) cmd ::= SHOW DATABASES */
- { 240, -4 }, /* (180) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
- { 240, -4 }, /* (181) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
- { 240, -3 }, /* (182) cmd ::= SHOW db_name_cond_opt VGROUPS */
- { 240, -2 }, /* (183) cmd ::= SHOW MNODES */
- { 240, -2 }, /* (184) cmd ::= SHOW MODULES */
- { 240, -2 }, /* (185) cmd ::= SHOW QNODES */
- { 240, -2 }, /* (186) cmd ::= SHOW FUNCTIONS */
- { 240, -5 }, /* (187) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
- { 240, -2 }, /* (188) cmd ::= SHOW STREAMS */
- { 240, -2 }, /* (189) cmd ::= SHOW ACCOUNTS */
- { 240, -2 }, /* (190) cmd ::= SHOW APPS */
- { 240, -2 }, /* (191) cmd ::= SHOW CONNECTIONS */
- { 240, -2 }, /* (192) cmd ::= SHOW LICENCE */
- { 240, -2 }, /* (193) cmd ::= SHOW GRANTS */
- { 240, -4 }, /* (194) cmd ::= SHOW CREATE DATABASE db_name */
- { 240, -4 }, /* (195) cmd ::= SHOW CREATE TABLE full_table_name */
- { 240, -4 }, /* (196) cmd ::= SHOW CREATE STABLE full_table_name */
- { 240, -2 }, /* (197) cmd ::= SHOW QUERIES */
- { 240, -2 }, /* (198) cmd ::= SHOW SCORES */
- { 240, -2 }, /* (199) cmd ::= SHOW TOPICS */
- { 240, -2 }, /* (200) cmd ::= SHOW VARIABLES */
- { 240, -2 }, /* (201) cmd ::= SHOW BNODES */
- { 240, -2 }, /* (202) cmd ::= SHOW SNODES */
- { 240, -2 }, /* (203) cmd ::= SHOW CLUSTER */
- { 240, -2 }, /* (204) cmd ::= SHOW TRANSACTIONS */
- { 284, 0 }, /* (205) db_name_cond_opt ::= */
- { 284, -2 }, /* (206) db_name_cond_opt ::= db_name NK_DOT */
- { 285, 0 }, /* (207) like_pattern_opt ::= */
- { 285, -2 }, /* (208) like_pattern_opt ::= LIKE NK_STRING */
- { 286, -1 }, /* (209) table_name_cond ::= table_name */
- { 287, 0 }, /* (210) from_db_opt ::= */
- { 287, -2 }, /* (211) from_db_opt ::= FROM db_name */
- { 281, -1 }, /* (212) func_name_list ::= func_name */
- { 281, -3 }, /* (213) func_name_list ::= func_name_list NK_COMMA func_name */
- { 288, -1 }, /* (214) func_name ::= function_name */
- { 240, -8 }, /* (215) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */
- { 240, -10 }, /* (216) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */
- { 240, -6 }, /* (217) cmd ::= DROP INDEX exists_opt index_name ON table_name */
- { 291, 0 }, /* (218) index_options ::= */
- { 291, -9 }, /* (219) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */
- { 291, -11 }, /* (220) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */
- { 292, -1 }, /* (221) func_list ::= func */
- { 292, -3 }, /* (222) func_list ::= func_list NK_COMMA func */
- { 295, -4 }, /* (223) func ::= function_name NK_LP expression_list NK_RP */
- { 240, -7 }, /* (224) cmd ::= CREATE TOPIC not_exists_opt topic_name topic_options AS query_expression */
- { 240, -7 }, /* (225) cmd ::= CREATE TOPIC not_exists_opt topic_name topic_options AS db_name */
- { 240, -4 }, /* (226) cmd ::= DROP TOPIC exists_opt topic_name */
- { 240, -6 }, /* (227) cmd ::= DROP CGROUP exists_opt cgroup_name ON topic_name */
- { 298, 0 }, /* (228) topic_options ::= */
- { 298, -3 }, /* (229) topic_options ::= topic_options WITH TABLE */
- { 298, -3 }, /* (230) topic_options ::= topic_options WITH SCHEMA */
- { 298, -3 }, /* (231) topic_options ::= topic_options WITH TAG */
- { 240, -2 }, /* (232) cmd ::= DESC full_table_name */
- { 240, -2 }, /* (233) cmd ::= DESCRIBE full_table_name */
- { 240, -3 }, /* (234) cmd ::= RESET QUERY CACHE */
- { 240, -4 }, /* (235) cmd ::= EXPLAIN analyze_opt explain_options query_expression */
- { 301, 0 }, /* (236) analyze_opt ::= */
- { 301, -1 }, /* (237) analyze_opt ::= ANALYZE */
- { 302, 0 }, /* (238) explain_options ::= */
- { 302, -3 }, /* (239) explain_options ::= explain_options VERBOSE NK_BOOL */
- { 302, -3 }, /* (240) explain_options ::= explain_options RATIO NK_FLOAT */
- { 240, -6 }, /* (241) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */
- { 240, -10 }, /* (242) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */
- { 240, -4 }, /* (243) cmd ::= DROP FUNCTION exists_opt function_name */
- { 303, 0 }, /* (244) agg_func_opt ::= */
- { 303, -1 }, /* (245) agg_func_opt ::= AGGREGATE */
- { 304, 0 }, /* (246) bufsize_opt ::= */
- { 304, -2 }, /* (247) bufsize_opt ::= BUFSIZE NK_INTEGER */
- { 240, -8 }, /* (248) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */
- { 240, -4 }, /* (249) cmd ::= DROP STREAM exists_opt stream_name */
- { 307, 0 }, /* (250) into_opt ::= */
- { 307, -2 }, /* (251) into_opt ::= INTO full_table_name */
- { 306, 0 }, /* (252) stream_options ::= */
- { 306, -3 }, /* (253) stream_options ::= stream_options TRIGGER AT_ONCE */
- { 306, -3 }, /* (254) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
- { 306, -3 }, /* (255) stream_options ::= stream_options WATERMARK duration_literal */
- { 240, -3 }, /* (256) cmd ::= KILL CONNECTION NK_INTEGER */
- { 240, -3 }, /* (257) cmd ::= KILL QUERY NK_INTEGER */
- { 240, -3 }, /* (258) cmd ::= KILL TRANSACTION NK_INTEGER */
- { 240, -4 }, /* (259) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
- { 240, -4 }, /* (260) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
- { 240, -3 }, /* (261) cmd ::= SPLIT VGROUP NK_INTEGER */
- { 308, -2 }, /* (262) dnode_list ::= DNODE NK_INTEGER */
- { 308, -3 }, /* (263) dnode_list ::= dnode_list DNODE NK_INTEGER */
- { 240, -3 }, /* (264) cmd ::= SYNCDB db_name REPLICA */
- { 240, -1 }, /* (265) cmd ::= query_expression */
- { 243, -1 }, /* (266) literal ::= NK_INTEGER */
- { 243, -1 }, /* (267) literal ::= NK_FLOAT */
- { 243, -1 }, /* (268) literal ::= NK_STRING */
- { 243, -1 }, /* (269) literal ::= NK_BOOL */
- { 243, -2 }, /* (270) literal ::= TIMESTAMP NK_STRING */
- { 243, -1 }, /* (271) literal ::= duration_literal */
- { 243, -1 }, /* (272) literal ::= NULL */
- { 243, -1 }, /* (273) literal ::= NK_QUESTION */
- { 293, -1 }, /* (274) duration_literal ::= NK_VARIABLE */
- { 309, -1 }, /* (275) signed ::= NK_INTEGER */
- { 309, -2 }, /* (276) signed ::= NK_PLUS NK_INTEGER */
- { 309, -2 }, /* (277) signed ::= NK_MINUS NK_INTEGER */
- { 309, -1 }, /* (278) signed ::= NK_FLOAT */
- { 309, -2 }, /* (279) signed ::= NK_PLUS NK_FLOAT */
- { 309, -2 }, /* (280) signed ::= NK_MINUS NK_FLOAT */
- { 273, -1 }, /* (281) signed_literal ::= signed */
- { 273, -1 }, /* (282) signed_literal ::= NK_STRING */
- { 273, -1 }, /* (283) signed_literal ::= NK_BOOL */
- { 273, -2 }, /* (284) signed_literal ::= TIMESTAMP NK_STRING */
- { 273, -1 }, /* (285) signed_literal ::= duration_literal */
- { 273, -1 }, /* (286) signed_literal ::= NULL */
- { 273, -1 }, /* (287) signed_literal ::= literal_func */
- { 276, -1 }, /* (288) literal_list ::= signed_literal */
- { 276, -3 }, /* (289) literal_list ::= literal_list NK_COMMA signed_literal */
- { 250, -1 }, /* (290) db_name ::= NK_ID */
- { 279, -1 }, /* (291) table_name ::= NK_ID */
- { 271, -1 }, /* (292) column_name ::= NK_ID */
- { 289, -1 }, /* (293) function_name ::= NK_ID */
- { 311, -1 }, /* (294) table_alias ::= NK_ID */
- { 312, -1 }, /* (295) column_alias ::= NK_ID */
- { 245, -1 }, /* (296) user_name ::= NK_ID */
- { 290, -1 }, /* (297) index_name ::= NK_ID */
- { 297, -1 }, /* (298) topic_name ::= NK_ID */
- { 305, -1 }, /* (299) stream_name ::= NK_ID */
- { 300, -1 }, /* (300) cgroup_name ::= NK_ID */
- { 313, -1 }, /* (301) expression ::= literal */
- { 313, -1 }, /* (302) expression ::= pseudo_column */
- { 313, -1 }, /* (303) expression ::= column_reference */
- { 313, -1 }, /* (304) expression ::= function_expression */
- { 313, -1 }, /* (305) expression ::= subquery */
- { 313, -3 }, /* (306) expression ::= NK_LP expression NK_RP */
- { 313, -2 }, /* (307) expression ::= NK_PLUS expression */
- { 313, -2 }, /* (308) expression ::= NK_MINUS expression */
- { 313, -3 }, /* (309) expression ::= expression NK_PLUS expression */
- { 313, -3 }, /* (310) expression ::= expression NK_MINUS expression */
- { 313, -3 }, /* (311) expression ::= expression NK_STAR expression */
- { 313, -3 }, /* (312) expression ::= expression NK_SLASH expression */
- { 313, -3 }, /* (313) expression ::= expression NK_REM expression */
- { 313, -3 }, /* (314) expression ::= column_reference NK_ARROW NK_STRING */
- { 296, -1 }, /* (315) expression_list ::= expression */
- { 296, -3 }, /* (316) expression_list ::= expression_list NK_COMMA expression */
- { 315, -1 }, /* (317) column_reference ::= column_name */
- { 315, -3 }, /* (318) column_reference ::= table_name NK_DOT column_name */
- { 314, -1 }, /* (319) pseudo_column ::= ROWTS */
- { 314, -1 }, /* (320) pseudo_column ::= TBNAME */
- { 314, -3 }, /* (321) pseudo_column ::= table_name NK_DOT TBNAME */
- { 314, -1 }, /* (322) pseudo_column ::= QSTARTTS */
- { 314, -1 }, /* (323) pseudo_column ::= QENDTS */
- { 314, -1 }, /* (324) pseudo_column ::= WSTARTTS */
- { 314, -1 }, /* (325) pseudo_column ::= WENDTS */
- { 314, -1 }, /* (326) pseudo_column ::= WDURATION */
- { 316, -4 }, /* (327) function_expression ::= function_name NK_LP expression_list NK_RP */
- { 316, -4 }, /* (328) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
- { 316, -6 }, /* (329) function_expression ::= CAST NK_LP expression AS type_name NK_RP */
- { 316, -1 }, /* (330) function_expression ::= literal_func */
- { 310, -3 }, /* (331) literal_func ::= noarg_func NK_LP NK_RP */
- { 310, -1 }, /* (332) literal_func ::= NOW */
- { 320, -1 }, /* (333) noarg_func ::= NOW */
- { 320, -1 }, /* (334) noarg_func ::= TODAY */
- { 320, -1 }, /* (335) noarg_func ::= TIMEZONE */
- { 318, -1 }, /* (336) star_func ::= COUNT */
- { 318, -1 }, /* (337) star_func ::= FIRST */
- { 318, -1 }, /* (338) star_func ::= LAST */
- { 318, -1 }, /* (339) star_func ::= LAST_ROW */
- { 319, -1 }, /* (340) star_func_para_list ::= NK_STAR */
- { 319, -1 }, /* (341) star_func_para_list ::= other_para_list */
- { 321, -1 }, /* (342) other_para_list ::= star_func_para */
- { 321, -3 }, /* (343) other_para_list ::= other_para_list NK_COMMA star_func_para */
- { 322, -1 }, /* (344) star_func_para ::= expression */
- { 322, -3 }, /* (345) star_func_para ::= table_name NK_DOT NK_STAR */
- { 323, -3 }, /* (346) predicate ::= expression compare_op expression */
- { 323, -5 }, /* (347) predicate ::= expression BETWEEN expression AND expression */
- { 323, -6 }, /* (348) predicate ::= expression NOT BETWEEN expression AND expression */
- { 323, -3 }, /* (349) predicate ::= expression IS NULL */
- { 323, -4 }, /* (350) predicate ::= expression IS NOT NULL */
- { 323, -3 }, /* (351) predicate ::= expression in_op in_predicate_value */
- { 324, -1 }, /* (352) compare_op ::= NK_LT */
- { 324, -1 }, /* (353) compare_op ::= NK_GT */
- { 324, -1 }, /* (354) compare_op ::= NK_LE */
- { 324, -1 }, /* (355) compare_op ::= NK_GE */
- { 324, -1 }, /* (356) compare_op ::= NK_NE */
- { 324, -1 }, /* (357) compare_op ::= NK_EQ */
- { 324, -1 }, /* (358) compare_op ::= LIKE */
- { 324, -2 }, /* (359) compare_op ::= NOT LIKE */
- { 324, -1 }, /* (360) compare_op ::= MATCH */
- { 324, -1 }, /* (361) compare_op ::= NMATCH */
- { 324, -1 }, /* (362) compare_op ::= CONTAINS */
- { 325, -1 }, /* (363) in_op ::= IN */
- { 325, -2 }, /* (364) in_op ::= NOT IN */
- { 326, -3 }, /* (365) in_predicate_value ::= NK_LP expression_list NK_RP */
- { 327, -1 }, /* (366) boolean_value_expression ::= boolean_primary */
- { 327, -2 }, /* (367) boolean_value_expression ::= NOT boolean_primary */
- { 327, -3 }, /* (368) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
- { 327, -3 }, /* (369) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
- { 328, -1 }, /* (370) boolean_primary ::= predicate */
- { 328, -3 }, /* (371) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
- { 329, -1 }, /* (372) common_expression ::= expression */
- { 329, -1 }, /* (373) common_expression ::= boolean_value_expression */
- { 330, -2 }, /* (374) from_clause ::= FROM table_reference_list */
- { 331, -1 }, /* (375) table_reference_list ::= table_reference */
- { 331, -3 }, /* (376) table_reference_list ::= table_reference_list NK_COMMA table_reference */
- { 332, -1 }, /* (377) table_reference ::= table_primary */
- { 332, -1 }, /* (378) table_reference ::= joined_table */
- { 333, -2 }, /* (379) table_primary ::= table_name alias_opt */
- { 333, -4 }, /* (380) table_primary ::= db_name NK_DOT table_name alias_opt */
- { 333, -2 }, /* (381) table_primary ::= subquery alias_opt */
- { 333, -1 }, /* (382) table_primary ::= parenthesized_joined_table */
- { 335, 0 }, /* (383) alias_opt ::= */
- { 335, -1 }, /* (384) alias_opt ::= table_alias */
- { 335, -2 }, /* (385) alias_opt ::= AS table_alias */
- { 336, -3 }, /* (386) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- { 336, -3 }, /* (387) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
- { 334, -6 }, /* (388) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
- { 337, 0 }, /* (389) join_type ::= */
- { 337, -1 }, /* (390) join_type ::= INNER */
- { 339, -9 }, /* (391) query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
- { 340, 0 }, /* (392) set_quantifier_opt ::= */
- { 340, -1 }, /* (393) set_quantifier_opt ::= DISTINCT */
- { 340, -1 }, /* (394) set_quantifier_opt ::= ALL */
- { 341, -1 }, /* (395) select_list ::= NK_STAR */
- { 341, -1 }, /* (396) select_list ::= select_sublist */
- { 347, -1 }, /* (397) select_sublist ::= select_item */
- { 347, -3 }, /* (398) select_sublist ::= select_sublist NK_COMMA select_item */
- { 348, -1 }, /* (399) select_item ::= common_expression */
- { 348, -2 }, /* (400) select_item ::= common_expression column_alias */
- { 348, -3 }, /* (401) select_item ::= common_expression AS column_alias */
- { 348, -3 }, /* (402) select_item ::= table_name NK_DOT NK_STAR */
- { 342, 0 }, /* (403) where_clause_opt ::= */
- { 342, -2 }, /* (404) where_clause_opt ::= WHERE search_condition */
- { 343, 0 }, /* (405) partition_by_clause_opt ::= */
- { 343, -3 }, /* (406) partition_by_clause_opt ::= PARTITION BY expression_list */
- { 344, 0 }, /* (407) twindow_clause_opt ::= */
- { 344, -6 }, /* (408) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
- { 344, -4 }, /* (409) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */
- { 344, -6 }, /* (410) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
- { 344, -8 }, /* (411) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
- { 294, 0 }, /* (412) sliding_opt ::= */
- { 294, -4 }, /* (413) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
- { 349, 0 }, /* (414) fill_opt ::= */
- { 349, -4 }, /* (415) fill_opt ::= FILL NK_LP fill_mode NK_RP */
- { 349, -6 }, /* (416) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
- { 350, -1 }, /* (417) fill_mode ::= NONE */
- { 350, -1 }, /* (418) fill_mode ::= PREV */
- { 350, -1 }, /* (419) fill_mode ::= NULL */
- { 350, -1 }, /* (420) fill_mode ::= LINEAR */
- { 350, -1 }, /* (421) fill_mode ::= NEXT */
- { 345, 0 }, /* (422) group_by_clause_opt ::= */
- { 345, -3 }, /* (423) group_by_clause_opt ::= GROUP BY group_by_list */
- { 351, -1 }, /* (424) group_by_list ::= expression */
- { 351, -3 }, /* (425) group_by_list ::= group_by_list NK_COMMA expression */
- { 346, 0 }, /* (426) having_clause_opt ::= */
- { 346, -2 }, /* (427) having_clause_opt ::= HAVING search_condition */
- { 299, -4 }, /* (428) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
- { 352, -1 }, /* (429) query_expression_body ::= query_primary */
- { 352, -4 }, /* (430) query_expression_body ::= query_expression_body UNION ALL query_expression_body */
- { 352, -3 }, /* (431) query_expression_body ::= query_expression_body UNION query_expression_body */
- { 356, -1 }, /* (432) query_primary ::= query_specification */
- { 356, -6 }, /* (433) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */
- { 353, 0 }, /* (434) order_by_clause_opt ::= */
- { 353, -3 }, /* (435) order_by_clause_opt ::= ORDER BY sort_specification_list */
- { 354, 0 }, /* (436) slimit_clause_opt ::= */
- { 354, -2 }, /* (437) slimit_clause_opt ::= SLIMIT NK_INTEGER */
- { 354, -4 }, /* (438) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- { 354, -4 }, /* (439) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- { 355, 0 }, /* (440) limit_clause_opt ::= */
- { 355, -2 }, /* (441) limit_clause_opt ::= LIMIT NK_INTEGER */
- { 355, -4 }, /* (442) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
- { 355, -4 }, /* (443) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- { 317, -3 }, /* (444) subquery ::= NK_LP query_expression NK_RP */
- { 338, -1 }, /* (445) search_condition ::= common_expression */
- { 357, -1 }, /* (446) sort_specification_list ::= sort_specification */
- { 357, -3 }, /* (447) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
- { 358, -3 }, /* (448) sort_specification ::= expression ordering_specification_opt null_ordering_opt */
- { 359, 0 }, /* (449) ordering_specification_opt ::= */
- { 359, -1 }, /* (450) ordering_specification_opt ::= ASC */
- { 359, -1 }, /* (451) ordering_specification_opt ::= DESC */
- { 360, 0 }, /* (452) null_ordering_opt ::= */
- { 360, -2 }, /* (453) null_ordering_opt ::= NULLS FIRST */
- { 360, -2 }, /* (454) null_ordering_opt ::= NULLS LAST */
+ { 239, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
+ { 239, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
+ { 240, 0 }, /* (2) account_options ::= */
+ { 240, -3 }, /* (3) account_options ::= account_options PPS literal */
+ { 240, -3 }, /* (4) account_options ::= account_options TSERIES literal */
+ { 240, -3 }, /* (5) account_options ::= account_options STORAGE literal */
+ { 240, -3 }, /* (6) account_options ::= account_options STREAMS literal */
+ { 240, -3 }, /* (7) account_options ::= account_options QTIME literal */
+ { 240, -3 }, /* (8) account_options ::= account_options DBS literal */
+ { 240, -3 }, /* (9) account_options ::= account_options USERS literal */
+ { 240, -3 }, /* (10) account_options ::= account_options CONNS literal */
+ { 240, -3 }, /* (11) account_options ::= account_options STATE literal */
+ { 241, -1 }, /* (12) alter_account_options ::= alter_account_option */
+ { 241, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */
+ { 243, -2 }, /* (14) alter_account_option ::= PASS literal */
+ { 243, -2 }, /* (15) alter_account_option ::= PPS literal */
+ { 243, -2 }, /* (16) alter_account_option ::= TSERIES literal */
+ { 243, -2 }, /* (17) alter_account_option ::= STORAGE literal */
+ { 243, -2 }, /* (18) alter_account_option ::= STREAMS literal */
+ { 243, -2 }, /* (19) alter_account_option ::= QTIME literal */
+ { 243, -2 }, /* (20) alter_account_option ::= DBS literal */
+ { 243, -2 }, /* (21) alter_account_option ::= USERS literal */
+ { 243, -2 }, /* (22) alter_account_option ::= CONNS literal */
+ { 243, -2 }, /* (23) alter_account_option ::= STATE literal */
+ { 239, -5 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING */
+ { 239, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */
+ { 239, -5 }, /* (26) cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */
+ { 239, -3 }, /* (27) cmd ::= DROP USER user_name */
+ { 239, -6 }, /* (28) cmd ::= GRANT privileges ON priv_level TO user_name */
+ { 239, -6 }, /* (29) cmd ::= REVOKE privileges ON priv_level FROM user_name */
+ { 245, -1 }, /* (30) privileges ::= ALL */
+ { 245, -1 }, /* (31) privileges ::= priv_type_list */
+ { 247, -1 }, /* (32) priv_type_list ::= priv_type */
+ { 247, -3 }, /* (33) priv_type_list ::= priv_type_list NK_COMMA priv_type */
+ { 248, -1 }, /* (34) priv_type ::= READ */
+ { 248, -1 }, /* (35) priv_type ::= WRITE */
+ { 246, -3 }, /* (36) priv_level ::= NK_STAR NK_DOT NK_STAR */
+ { 246, -3 }, /* (37) priv_level ::= db_name NK_DOT NK_STAR */
+ { 239, -3 }, /* (38) cmd ::= CREATE DNODE dnode_endpoint */
+ { 239, -5 }, /* (39) cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */
+ { 239, -3 }, /* (40) cmd ::= DROP DNODE NK_INTEGER */
+ { 239, -3 }, /* (41) cmd ::= DROP DNODE dnode_endpoint */
+ { 239, -4 }, /* (42) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
+ { 239, -5 }, /* (43) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
+ { 239, -4 }, /* (44) cmd ::= ALTER ALL DNODES NK_STRING */
+ { 239, -5 }, /* (45) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
+ { 250, -1 }, /* (46) dnode_endpoint ::= NK_STRING */
+ { 251, -1 }, /* (47) dnode_host_name ::= NK_ID */
+ { 251, -1 }, /* (48) dnode_host_name ::= NK_IPTOKEN */
+ { 239, -3 }, /* (49) cmd ::= ALTER LOCAL NK_STRING */
+ { 239, -4 }, /* (50) cmd ::= ALTER LOCAL NK_STRING NK_STRING */
+ { 239, -5 }, /* (51) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
+ { 239, -5 }, /* (52) cmd ::= DROP QNODE ON DNODE NK_INTEGER */
+ { 239, -5 }, /* (53) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
+ { 239, -5 }, /* (54) cmd ::= DROP BNODE ON DNODE NK_INTEGER */
+ { 239, -5 }, /* (55) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
+ { 239, -5 }, /* (56) cmd ::= DROP SNODE ON DNODE NK_INTEGER */
+ { 239, -5 }, /* (57) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
+ { 239, -5 }, /* (58) cmd ::= DROP MNODE ON DNODE NK_INTEGER */
+ { 239, -5 }, /* (59) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
+ { 239, -4 }, /* (60) cmd ::= DROP DATABASE exists_opt db_name */
+ { 239, -2 }, /* (61) cmd ::= USE db_name */
+ { 239, -4 }, /* (62) cmd ::= ALTER DATABASE db_name alter_db_options */
+ { 252, -3 }, /* (63) not_exists_opt ::= IF NOT EXISTS */
+ { 252, 0 }, /* (64) not_exists_opt ::= */
+ { 254, -2 }, /* (65) exists_opt ::= IF EXISTS */
+ { 254, 0 }, /* (66) exists_opt ::= */
+ { 253, 0 }, /* (67) db_options ::= */
+ { 253, -3 }, /* (68) db_options ::= db_options BUFFER NK_INTEGER */
+ { 253, -3 }, /* (69) db_options ::= db_options CACHELAST NK_INTEGER */
+ { 253, -3 }, /* (70) db_options ::= db_options COMP NK_INTEGER */
+ { 253, -3 }, /* (71) db_options ::= db_options DAYS NK_INTEGER */
+ { 253, -3 }, /* (72) db_options ::= db_options DAYS NK_VARIABLE */
+ { 253, -3 }, /* (73) db_options ::= db_options FSYNC NK_INTEGER */
+ { 253, -3 }, /* (74) db_options ::= db_options MAXROWS NK_INTEGER */
+ { 253, -3 }, /* (75) db_options ::= db_options MINROWS NK_INTEGER */
+ { 253, -3 }, /* (76) db_options ::= db_options KEEP integer_list */
+ { 253, -3 }, /* (77) db_options ::= db_options KEEP variable_list */
+ { 253, -3 }, /* (78) db_options ::= db_options PAGES NK_INTEGER */
+ { 253, -3 }, /* (79) db_options ::= db_options PAGESIZE NK_INTEGER */
+ { 253, -3 }, /* (80) db_options ::= db_options PRECISION NK_STRING */
+ { 253, -3 }, /* (81) db_options ::= db_options REPLICA NK_INTEGER */
+ { 253, -3 }, /* (82) db_options ::= db_options STRICT NK_INTEGER */
+ { 253, -3 }, /* (83) db_options ::= db_options WAL NK_INTEGER */
+ { 253, -3 }, /* (84) db_options ::= db_options VGROUPS NK_INTEGER */
+ { 253, -3 }, /* (85) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
+ { 253, -3 }, /* (86) db_options ::= db_options RETENTIONS retention_list */
+ { 253, -3 }, /* (87) db_options ::= db_options SCHEMALESS NK_INTEGER */
+ { 255, -1 }, /* (88) alter_db_options ::= alter_db_option */
+ { 255, -2 }, /* (89) alter_db_options ::= alter_db_options alter_db_option */
+ { 259, -2 }, /* (90) alter_db_option ::= BUFFER NK_INTEGER */
+ { 259, -2 }, /* (91) alter_db_option ::= CACHELAST NK_INTEGER */
+ { 259, -2 }, /* (92) alter_db_option ::= FSYNC NK_INTEGER */
+ { 259, -2 }, /* (93) alter_db_option ::= KEEP integer_list */
+ { 259, -2 }, /* (94) alter_db_option ::= KEEP variable_list */
+ { 259, -2 }, /* (95) alter_db_option ::= PAGES NK_INTEGER */
+ { 259, -2 }, /* (96) alter_db_option ::= REPLICA NK_INTEGER */
+ { 259, -2 }, /* (97) alter_db_option ::= STRICT NK_INTEGER */
+ { 259, -2 }, /* (98) alter_db_option ::= WAL NK_INTEGER */
+ { 256, -1 }, /* (99) integer_list ::= NK_INTEGER */
+ { 256, -3 }, /* (100) integer_list ::= integer_list NK_COMMA NK_INTEGER */
+ { 257, -1 }, /* (101) variable_list ::= NK_VARIABLE */
+ { 257, -3 }, /* (102) variable_list ::= variable_list NK_COMMA NK_VARIABLE */
+ { 258, -1 }, /* (103) retention_list ::= retention */
+ { 258, -3 }, /* (104) retention_list ::= retention_list NK_COMMA retention */
+ { 260, -3 }, /* (105) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
+ { 239, -9 }, /* (106) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
+ { 239, -3 }, /* (107) cmd ::= CREATE TABLE multi_create_clause */
+ { 239, -9 }, /* (108) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
+ { 239, -3 }, /* (109) cmd ::= DROP TABLE multi_drop_clause */
+ { 239, -4 }, /* (110) cmd ::= DROP STABLE exists_opt full_table_name */
+ { 239, -3 }, /* (111) cmd ::= ALTER TABLE alter_table_clause */
+ { 239, -3 }, /* (112) cmd ::= ALTER STABLE alter_table_clause */
+ { 268, -2 }, /* (113) alter_table_clause ::= full_table_name alter_table_options */
+ { 268, -5 }, /* (114) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
+ { 268, -4 }, /* (115) alter_table_clause ::= full_table_name DROP COLUMN column_name */
+ { 268, -5 }, /* (116) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
+ { 268, -5 }, /* (117) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
+ { 268, -5 }, /* (118) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
+ { 268, -4 }, /* (119) alter_table_clause ::= full_table_name DROP TAG column_name */
+ { 268, -5 }, /* (120) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
+ { 268, -5 }, /* (121) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
+ { 268, -6 }, /* (122) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
+ { 265, -1 }, /* (123) multi_create_clause ::= create_subtable_clause */
+ { 265, -2 }, /* (124) multi_create_clause ::= multi_create_clause create_subtable_clause */
+ { 273, -10 }, /* (125) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP table_options */
+ { 267, -1 }, /* (126) multi_drop_clause ::= drop_table_clause */
+ { 267, -2 }, /* (127) multi_drop_clause ::= multi_drop_clause drop_table_clause */
+ { 276, -2 }, /* (128) drop_table_clause ::= exists_opt full_table_name */
+ { 274, 0 }, /* (129) specific_tags_opt ::= */
+ { 274, -3 }, /* (130) specific_tags_opt ::= NK_LP col_name_list NK_RP */
+ { 261, -1 }, /* (131) full_table_name ::= table_name */
+ { 261, -3 }, /* (132) full_table_name ::= db_name NK_DOT table_name */
+ { 262, -1 }, /* (133) column_def_list ::= column_def */
+ { 262, -3 }, /* (134) column_def_list ::= column_def_list NK_COMMA column_def */
+ { 279, -2 }, /* (135) column_def ::= column_name type_name */
+ { 279, -4 }, /* (136) column_def ::= column_name type_name COMMENT NK_STRING */
+ { 271, -1 }, /* (137) type_name ::= BOOL */
+ { 271, -1 }, /* (138) type_name ::= TINYINT */
+ { 271, -1 }, /* (139) type_name ::= SMALLINT */
+ { 271, -1 }, /* (140) type_name ::= INT */
+ { 271, -1 }, /* (141) type_name ::= INTEGER */
+ { 271, -1 }, /* (142) type_name ::= BIGINT */
+ { 271, -1 }, /* (143) type_name ::= FLOAT */
+ { 271, -1 }, /* (144) type_name ::= DOUBLE */
+ { 271, -4 }, /* (145) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
+ { 271, -1 }, /* (146) type_name ::= TIMESTAMP */
+ { 271, -4 }, /* (147) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
+ { 271, -2 }, /* (148) type_name ::= TINYINT UNSIGNED */
+ { 271, -2 }, /* (149) type_name ::= SMALLINT UNSIGNED */
+ { 271, -2 }, /* (150) type_name ::= INT UNSIGNED */
+ { 271, -2 }, /* (151) type_name ::= BIGINT UNSIGNED */
+ { 271, -1 }, /* (152) type_name ::= JSON */
+ { 271, -4 }, /* (153) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
+ { 271, -1 }, /* (154) type_name ::= MEDIUMBLOB */
+ { 271, -1 }, /* (155) type_name ::= BLOB */
+ { 271, -4 }, /* (156) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
+ { 271, -1 }, /* (157) type_name ::= DECIMAL */
+ { 271, -4 }, /* (158) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
+ { 271, -6 }, /* (159) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+ { 263, 0 }, /* (160) tags_def_opt ::= */
+ { 263, -1 }, /* (161) tags_def_opt ::= tags_def */
+ { 266, -4 }, /* (162) tags_def ::= TAGS NK_LP column_def_list NK_RP */
+ { 264, 0 }, /* (163) table_options ::= */
+ { 264, -3 }, /* (164) table_options ::= table_options COMMENT NK_STRING */
+ { 264, -3 }, /* (165) table_options ::= table_options FILE_FACTOR NK_FLOAT */
+ { 264, -5 }, /* (166) table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */
+ { 264, -3 }, /* (167) table_options ::= table_options TTL NK_INTEGER */
+ { 264, -5 }, /* (168) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
+ { 269, -1 }, /* (169) alter_table_options ::= alter_table_option */
+ { 269, -2 }, /* (170) alter_table_options ::= alter_table_options alter_table_option */
+ { 281, -2 }, /* (171) alter_table_option ::= COMMENT NK_STRING */
+ { 281, -2 }, /* (172) alter_table_option ::= TTL NK_INTEGER */
+ { 277, -1 }, /* (173) col_name_list ::= col_name */
+ { 277, -3 }, /* (174) col_name_list ::= col_name_list NK_COMMA col_name */
+ { 282, -1 }, /* (175) col_name ::= column_name */
+ { 239, -2 }, /* (176) cmd ::= SHOW DNODES */
+ { 239, -2 }, /* (177) cmd ::= SHOW USERS */
+ { 239, -2 }, /* (178) cmd ::= SHOW DATABASES */
+ { 239, -4 }, /* (179) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
+ { 239, -4 }, /* (180) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
+ { 239, -3 }, /* (181) cmd ::= SHOW db_name_cond_opt VGROUPS */
+ { 239, -2 }, /* (182) cmd ::= SHOW MNODES */
+ { 239, -2 }, /* (183) cmd ::= SHOW MODULES */
+ { 239, -2 }, /* (184) cmd ::= SHOW QNODES */
+ { 239, -2 }, /* (185) cmd ::= SHOW FUNCTIONS */
+ { 239, -5 }, /* (186) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
+ { 239, -2 }, /* (187) cmd ::= SHOW STREAMS */
+ { 239, -2 }, /* (188) cmd ::= SHOW ACCOUNTS */
+ { 239, -2 }, /* (189) cmd ::= SHOW APPS */
+ { 239, -2 }, /* (190) cmd ::= SHOW CONNECTIONS */
+ { 239, -2 }, /* (191) cmd ::= SHOW LICENCE */
+ { 239, -2 }, /* (192) cmd ::= SHOW GRANTS */
+ { 239, -4 }, /* (193) cmd ::= SHOW CREATE DATABASE db_name */
+ { 239, -4 }, /* (194) cmd ::= SHOW CREATE TABLE full_table_name */
+ { 239, -4 }, /* (195) cmd ::= SHOW CREATE STABLE full_table_name */
+ { 239, -2 }, /* (196) cmd ::= SHOW QUERIES */
+ { 239, -2 }, /* (197) cmd ::= SHOW SCORES */
+ { 239, -2 }, /* (198) cmd ::= SHOW TOPICS */
+ { 239, -2 }, /* (199) cmd ::= SHOW VARIABLES */
+ { 239, -2 }, /* (200) cmd ::= SHOW BNODES */
+ { 239, -2 }, /* (201) cmd ::= SHOW SNODES */
+ { 239, -2 }, /* (202) cmd ::= SHOW CLUSTER */
+ { 239, -2 }, /* (203) cmd ::= SHOW TRANSACTIONS */
+ { 283, 0 }, /* (204) db_name_cond_opt ::= */
+ { 283, -2 }, /* (205) db_name_cond_opt ::= db_name NK_DOT */
+ { 284, 0 }, /* (206) like_pattern_opt ::= */
+ { 284, -2 }, /* (207) like_pattern_opt ::= LIKE NK_STRING */
+ { 285, -1 }, /* (208) table_name_cond ::= table_name */
+ { 286, 0 }, /* (209) from_db_opt ::= */
+ { 286, -2 }, /* (210) from_db_opt ::= FROM db_name */
+ { 280, -1 }, /* (211) func_name_list ::= func_name */
+ { 280, -3 }, /* (212) func_name_list ::= func_name_list NK_COMMA func_name */
+ { 287, -1 }, /* (213) func_name ::= function_name */
+ { 239, -8 }, /* (214) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */
+ { 239, -10 }, /* (215) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */
+ { 239, -6 }, /* (216) cmd ::= DROP INDEX exists_opt index_name ON table_name */
+ { 290, 0 }, /* (217) index_options ::= */
+ { 290, -9 }, /* (218) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */
+ { 290, -11 }, /* (219) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */
+ { 291, -1 }, /* (220) func_list ::= func */
+ { 291, -3 }, /* (221) func_list ::= func_list NK_COMMA func */
+ { 294, -4 }, /* (222) func ::= function_name NK_LP expression_list NK_RP */
+ { 239, -7 }, /* (223) cmd ::= CREATE TOPIC not_exists_opt topic_name topic_options AS query_expression */
+ { 239, -7 }, /* (224) cmd ::= CREATE TOPIC not_exists_opt topic_name topic_options AS db_name */
+ { 239, -4 }, /* (225) cmd ::= DROP TOPIC exists_opt topic_name */
+ { 239, -7 }, /* (226) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
+ { 297, 0 }, /* (227) topic_options ::= */
+ { 297, -3 }, /* (228) topic_options ::= topic_options WITH TABLE */
+ { 297, -3 }, /* (229) topic_options ::= topic_options WITH SCHEMA */
+ { 297, -3 }, /* (230) topic_options ::= topic_options WITH TAG */
+ { 239, -2 }, /* (231) cmd ::= DESC full_table_name */
+ { 239, -2 }, /* (232) cmd ::= DESCRIBE full_table_name */
+ { 239, -3 }, /* (233) cmd ::= RESET QUERY CACHE */
+ { 239, -4 }, /* (234) cmd ::= EXPLAIN analyze_opt explain_options query_expression */
+ { 300, 0 }, /* (235) analyze_opt ::= */
+ { 300, -1 }, /* (236) analyze_opt ::= ANALYZE */
+ { 301, 0 }, /* (237) explain_options ::= */
+ { 301, -3 }, /* (238) explain_options ::= explain_options VERBOSE NK_BOOL */
+ { 301, -3 }, /* (239) explain_options ::= explain_options RATIO NK_FLOAT */
+ { 239, -6 }, /* (240) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */
+ { 239, -10 }, /* (241) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */
+ { 239, -4 }, /* (242) cmd ::= DROP FUNCTION exists_opt function_name */
+ { 302, 0 }, /* (243) agg_func_opt ::= */
+ { 302, -1 }, /* (244) agg_func_opt ::= AGGREGATE */
+ { 303, 0 }, /* (245) bufsize_opt ::= */
+ { 303, -2 }, /* (246) bufsize_opt ::= BUFSIZE NK_INTEGER */
+ { 239, -8 }, /* (247) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */
+ { 239, -4 }, /* (248) cmd ::= DROP STREAM exists_opt stream_name */
+ { 306, 0 }, /* (249) into_opt ::= */
+ { 306, -2 }, /* (250) into_opt ::= INTO full_table_name */
+ { 305, 0 }, /* (251) stream_options ::= */
+ { 305, -3 }, /* (252) stream_options ::= stream_options TRIGGER AT_ONCE */
+ { 305, -3 }, /* (253) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
+ { 305, -3 }, /* (254) stream_options ::= stream_options WATERMARK duration_literal */
+ { 239, -3 }, /* (255) cmd ::= KILL CONNECTION NK_INTEGER */
+ { 239, -3 }, /* (256) cmd ::= KILL QUERY NK_INTEGER */
+ { 239, -3 }, /* (257) cmd ::= KILL TRANSACTION NK_INTEGER */
+ { 239, -4 }, /* (258) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
+ { 239, -4 }, /* (259) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+ { 239, -3 }, /* (260) cmd ::= SPLIT VGROUP NK_INTEGER */
+ { 307, -2 }, /* (261) dnode_list ::= DNODE NK_INTEGER */
+ { 307, -3 }, /* (262) dnode_list ::= dnode_list DNODE NK_INTEGER */
+ { 239, -3 }, /* (263) cmd ::= SYNCDB db_name REPLICA */
+ { 239, -1 }, /* (264) cmd ::= query_expression */
+ { 242, -1 }, /* (265) literal ::= NK_INTEGER */
+ { 242, -1 }, /* (266) literal ::= NK_FLOAT */
+ { 242, -1 }, /* (267) literal ::= NK_STRING */
+ { 242, -1 }, /* (268) literal ::= NK_BOOL */
+ { 242, -2 }, /* (269) literal ::= TIMESTAMP NK_STRING */
+ { 242, -1 }, /* (270) literal ::= duration_literal */
+ { 242, -1 }, /* (271) literal ::= NULL */
+ { 242, -1 }, /* (272) literal ::= NK_QUESTION */
+ { 292, -1 }, /* (273) duration_literal ::= NK_VARIABLE */
+ { 308, -1 }, /* (274) signed ::= NK_INTEGER */
+ { 308, -2 }, /* (275) signed ::= NK_PLUS NK_INTEGER */
+ { 308, -2 }, /* (276) signed ::= NK_MINUS NK_INTEGER */
+ { 308, -1 }, /* (277) signed ::= NK_FLOAT */
+ { 308, -2 }, /* (278) signed ::= NK_PLUS NK_FLOAT */
+ { 308, -2 }, /* (279) signed ::= NK_MINUS NK_FLOAT */
+ { 272, -1 }, /* (280) signed_literal ::= signed */
+ { 272, -1 }, /* (281) signed_literal ::= NK_STRING */
+ { 272, -1 }, /* (282) signed_literal ::= NK_BOOL */
+ { 272, -2 }, /* (283) signed_literal ::= TIMESTAMP NK_STRING */
+ { 272, -1 }, /* (284) signed_literal ::= duration_literal */
+ { 272, -1 }, /* (285) signed_literal ::= NULL */
+ { 272, -1 }, /* (286) signed_literal ::= literal_func */
+ { 275, -1 }, /* (287) literal_list ::= signed_literal */
+ { 275, -3 }, /* (288) literal_list ::= literal_list NK_COMMA signed_literal */
+ { 249, -1 }, /* (289) db_name ::= NK_ID */
+ { 278, -1 }, /* (290) table_name ::= NK_ID */
+ { 270, -1 }, /* (291) column_name ::= NK_ID */
+ { 288, -1 }, /* (292) function_name ::= NK_ID */
+ { 310, -1 }, /* (293) table_alias ::= NK_ID */
+ { 311, -1 }, /* (294) column_alias ::= NK_ID */
+ { 244, -1 }, /* (295) user_name ::= NK_ID */
+ { 289, -1 }, /* (296) index_name ::= NK_ID */
+ { 296, -1 }, /* (297) topic_name ::= NK_ID */
+ { 304, -1 }, /* (298) stream_name ::= NK_ID */
+ { 299, -1 }, /* (299) cgroup_name ::= NK_ID */
+ { 312, -1 }, /* (300) expression ::= literal */
+ { 312, -1 }, /* (301) expression ::= pseudo_column */
+ { 312, -1 }, /* (302) expression ::= column_reference */
+ { 312, -1 }, /* (303) expression ::= function_expression */
+ { 312, -1 }, /* (304) expression ::= subquery */
+ { 312, -3 }, /* (305) expression ::= NK_LP expression NK_RP */
+ { 312, -2 }, /* (306) expression ::= NK_PLUS expression */
+ { 312, -2 }, /* (307) expression ::= NK_MINUS expression */
+ { 312, -3 }, /* (308) expression ::= expression NK_PLUS expression */
+ { 312, -3 }, /* (309) expression ::= expression NK_MINUS expression */
+ { 312, -3 }, /* (310) expression ::= expression NK_STAR expression */
+ { 312, -3 }, /* (311) expression ::= expression NK_SLASH expression */
+ { 312, -3 }, /* (312) expression ::= expression NK_REM expression */
+ { 312, -3 }, /* (313) expression ::= column_reference NK_ARROW NK_STRING */
+ { 295, -1 }, /* (314) expression_list ::= expression */
+ { 295, -3 }, /* (315) expression_list ::= expression_list NK_COMMA expression */
+ { 314, -1 }, /* (316) column_reference ::= column_name */
+ { 314, -3 }, /* (317) column_reference ::= table_name NK_DOT column_name */
+ { 313, -1 }, /* (318) pseudo_column ::= ROWTS */
+ { 313, -1 }, /* (319) pseudo_column ::= TBNAME */
+ { 313, -3 }, /* (320) pseudo_column ::= table_name NK_DOT TBNAME */
+ { 313, -1 }, /* (321) pseudo_column ::= QSTARTTS */
+ { 313, -1 }, /* (322) pseudo_column ::= QENDTS */
+ { 313, -1 }, /* (323) pseudo_column ::= WSTARTTS */
+ { 313, -1 }, /* (324) pseudo_column ::= WENDTS */
+ { 313, -1 }, /* (325) pseudo_column ::= WDURATION */
+ { 315, -4 }, /* (326) function_expression ::= function_name NK_LP expression_list NK_RP */
+ { 315, -4 }, /* (327) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
+ { 315, -6 }, /* (328) function_expression ::= CAST NK_LP expression AS type_name NK_RP */
+ { 315, -1 }, /* (329) function_expression ::= literal_func */
+ { 309, -3 }, /* (330) literal_func ::= noarg_func NK_LP NK_RP */
+ { 309, -1 }, /* (331) literal_func ::= NOW */
+ { 319, -1 }, /* (332) noarg_func ::= NOW */
+ { 319, -1 }, /* (333) noarg_func ::= TODAY */
+ { 319, -1 }, /* (334) noarg_func ::= TIMEZONE */
+ { 317, -1 }, /* (335) star_func ::= COUNT */
+ { 317, -1 }, /* (336) star_func ::= FIRST */
+ { 317, -1 }, /* (337) star_func ::= LAST */
+ { 317, -1 }, /* (338) star_func ::= LAST_ROW */
+ { 318, -1 }, /* (339) star_func_para_list ::= NK_STAR */
+ { 318, -1 }, /* (340) star_func_para_list ::= other_para_list */
+ { 320, -1 }, /* (341) other_para_list ::= star_func_para */
+ { 320, -3 }, /* (342) other_para_list ::= other_para_list NK_COMMA star_func_para */
+ { 321, -1 }, /* (343) star_func_para ::= expression */
+ { 321, -3 }, /* (344) star_func_para ::= table_name NK_DOT NK_STAR */
+ { 322, -3 }, /* (345) predicate ::= expression compare_op expression */
+ { 322, -5 }, /* (346) predicate ::= expression BETWEEN expression AND expression */
+ { 322, -6 }, /* (347) predicate ::= expression NOT BETWEEN expression AND expression */
+ { 322, -3 }, /* (348) predicate ::= expression IS NULL */
+ { 322, -4 }, /* (349) predicate ::= expression IS NOT NULL */
+ { 322, -3 }, /* (350) predicate ::= expression in_op in_predicate_value */
+ { 323, -1 }, /* (351) compare_op ::= NK_LT */
+ { 323, -1 }, /* (352) compare_op ::= NK_GT */
+ { 323, -1 }, /* (353) compare_op ::= NK_LE */
+ { 323, -1 }, /* (354) compare_op ::= NK_GE */
+ { 323, -1 }, /* (355) compare_op ::= NK_NE */
+ { 323, -1 }, /* (356) compare_op ::= NK_EQ */
+ { 323, -1 }, /* (357) compare_op ::= LIKE */
+ { 323, -2 }, /* (358) compare_op ::= NOT LIKE */
+ { 323, -1 }, /* (359) compare_op ::= MATCH */
+ { 323, -1 }, /* (360) compare_op ::= NMATCH */
+ { 323, -1 }, /* (361) compare_op ::= CONTAINS */
+ { 324, -1 }, /* (362) in_op ::= IN */
+ { 324, -2 }, /* (363) in_op ::= NOT IN */
+ { 325, -3 }, /* (364) in_predicate_value ::= NK_LP expression_list NK_RP */
+ { 326, -1 }, /* (365) boolean_value_expression ::= boolean_primary */
+ { 326, -2 }, /* (366) boolean_value_expression ::= NOT boolean_primary */
+ { 326, -3 }, /* (367) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ { 326, -3 }, /* (368) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ { 327, -1 }, /* (369) boolean_primary ::= predicate */
+ { 327, -3 }, /* (370) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
+ { 328, -1 }, /* (371) common_expression ::= expression */
+ { 328, -1 }, /* (372) common_expression ::= boolean_value_expression */
+ { 329, -2 }, /* (373) from_clause ::= FROM table_reference_list */
+ { 330, -1 }, /* (374) table_reference_list ::= table_reference */
+ { 330, -3 }, /* (375) table_reference_list ::= table_reference_list NK_COMMA table_reference */
+ { 331, -1 }, /* (376) table_reference ::= table_primary */
+ { 331, -1 }, /* (377) table_reference ::= joined_table */
+ { 332, -2 }, /* (378) table_primary ::= table_name alias_opt */
+ { 332, -4 }, /* (379) table_primary ::= db_name NK_DOT table_name alias_opt */
+ { 332, -2 }, /* (380) table_primary ::= subquery alias_opt */
+ { 332, -1 }, /* (381) table_primary ::= parenthesized_joined_table */
+ { 334, 0 }, /* (382) alias_opt ::= */
+ { 334, -1 }, /* (383) alias_opt ::= table_alias */
+ { 334, -2 }, /* (384) alias_opt ::= AS table_alias */
+ { 335, -3 }, /* (385) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ { 335, -3 }, /* (386) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
+ { 333, -6 }, /* (387) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
+ { 336, 0 }, /* (388) join_type ::= */
+ { 336, -1 }, /* (389) join_type ::= INNER */
+ { 338, -9 }, /* (390) query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
+ { 339, 0 }, /* (391) set_quantifier_opt ::= */
+ { 339, -1 }, /* (392) set_quantifier_opt ::= DISTINCT */
+ { 339, -1 }, /* (393) set_quantifier_opt ::= ALL */
+ { 340, -1 }, /* (394) select_list ::= NK_STAR */
+ { 340, -1 }, /* (395) select_list ::= select_sublist */
+ { 346, -1 }, /* (396) select_sublist ::= select_item */
+ { 346, -3 }, /* (397) select_sublist ::= select_sublist NK_COMMA select_item */
+ { 347, -1 }, /* (398) select_item ::= common_expression */
+ { 347, -2 }, /* (399) select_item ::= common_expression column_alias */
+ { 347, -3 }, /* (400) select_item ::= common_expression AS column_alias */
+ { 347, -3 }, /* (401) select_item ::= table_name NK_DOT NK_STAR */
+ { 341, 0 }, /* (402) where_clause_opt ::= */
+ { 341, -2 }, /* (403) where_clause_opt ::= WHERE search_condition */
+ { 342, 0 }, /* (404) partition_by_clause_opt ::= */
+ { 342, -3 }, /* (405) partition_by_clause_opt ::= PARTITION BY expression_list */
+ { 343, 0 }, /* (406) twindow_clause_opt ::= */
+ { 343, -6 }, /* (407) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
+ { 343, -4 }, /* (408) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */
+ { 343, -6 }, /* (409) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
+ { 343, -8 }, /* (410) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
+ { 293, 0 }, /* (411) sliding_opt ::= */
+ { 293, -4 }, /* (412) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
+ { 348, 0 }, /* (413) fill_opt ::= */
+ { 348, -4 }, /* (414) fill_opt ::= FILL NK_LP fill_mode NK_RP */
+ { 348, -6 }, /* (415) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
+ { 349, -1 }, /* (416) fill_mode ::= NONE */
+ { 349, -1 }, /* (417) fill_mode ::= PREV */
+ { 349, -1 }, /* (418) fill_mode ::= NULL */
+ { 349, -1 }, /* (419) fill_mode ::= LINEAR */
+ { 349, -1 }, /* (420) fill_mode ::= NEXT */
+ { 344, 0 }, /* (421) group_by_clause_opt ::= */
+ { 344, -3 }, /* (422) group_by_clause_opt ::= GROUP BY group_by_list */
+ { 350, -1 }, /* (423) group_by_list ::= expression */
+ { 350, -3 }, /* (424) group_by_list ::= group_by_list NK_COMMA expression */
+ { 345, 0 }, /* (425) having_clause_opt ::= */
+ { 345, -2 }, /* (426) having_clause_opt ::= HAVING search_condition */
+ { 298, -4 }, /* (427) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ { 351, -1 }, /* (428) query_expression_body ::= query_primary */
+ { 351, -4 }, /* (429) query_expression_body ::= query_expression_body UNION ALL query_expression_body */
+ { 351, -3 }, /* (430) query_expression_body ::= query_expression_body UNION query_expression_body */
+ { 355, -1 }, /* (431) query_primary ::= query_specification */
+ { 355, -6 }, /* (432) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */
+ { 352, 0 }, /* (433) order_by_clause_opt ::= */
+ { 352, -3 }, /* (434) order_by_clause_opt ::= ORDER BY sort_specification_list */
+ { 353, 0 }, /* (435) slimit_clause_opt ::= */
+ { 353, -2 }, /* (436) slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ { 353, -4 }, /* (437) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ { 353, -4 }, /* (438) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ { 354, 0 }, /* (439) limit_clause_opt ::= */
+ { 354, -2 }, /* (440) limit_clause_opt ::= LIMIT NK_INTEGER */
+ { 354, -4 }, /* (441) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
+ { 354, -4 }, /* (442) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ { 316, -3 }, /* (443) subquery ::= NK_LP query_expression NK_RP */
+ { 337, -1 }, /* (444) search_condition ::= common_expression */
+ { 356, -1 }, /* (445) sort_specification_list ::= sort_specification */
+ { 356, -3 }, /* (446) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
+ { 357, -3 }, /* (447) sort_specification ::= expression ordering_specification_opt null_ordering_opt */
+ { 358, 0 }, /* (448) ordering_specification_opt ::= */
+ { 358, -1 }, /* (449) ordering_specification_opt ::= ASC */
+ { 358, -1 }, /* (450) ordering_specification_opt ::= DESC */
+ { 359, 0 }, /* (451) null_ordering_opt ::= */
+ { 359, -2 }, /* (452) null_ordering_opt ::= NULLS FIRST */
+ { 359, -2 }, /* (453) null_ordering_opt ::= NULLS LAST */
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -3114,11 +3128,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,241,&yymsp[0].minor);
+ yy_destructor(yypParser,240,&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,242,&yymsp[0].minor);
+ yy_destructor(yypParser,241,&yymsp[0].minor);
break;
case 2: /* account_options ::= */
{ }
@@ -3132,20 +3146,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,241,&yymsp[-2].minor);
+{ yy_destructor(yypParser,240,&yymsp[-2].minor);
{ }
- yy_destructor(yypParser,243,&yymsp[0].minor);
+ yy_destructor(yypParser,242,&yymsp[0].minor);
}
break;
case 12: /* alter_account_options ::= alter_account_option */
-{ yy_destructor(yypParser,244,&yymsp[0].minor);
+{ yy_destructor(yypParser,243,&yymsp[0].minor);
{ }
}
break;
case 13: /* alter_account_options ::= alter_account_options alter_account_option */
-{ yy_destructor(yypParser,242,&yymsp[-1].minor);
+{ yy_destructor(yypParser,241,&yymsp[-1].minor);
{ }
- yy_destructor(yypParser,244,&yymsp[0].minor);
+ yy_destructor(yypParser,243,&yymsp[0].minor);
}
break;
case 14: /* alter_account_option ::= PASS literal */
@@ -3159,63 +3173,63 @@ 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,243,&yymsp[0].minor);
+ yy_destructor(yypParser,242,&yymsp[0].minor);
break;
case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING */
-{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy53, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0); }
break;
case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy53, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy209, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
break;
case 26: /* cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy53, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy209, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); }
break;
case 27: /* cmd ::= DROP USER user_name */
-{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy53); }
+{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy209); }
break;
case 28: /* cmd ::= GRANT privileges ON priv_level TO user_name */
-{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy435, &yymsp[-2].minor.yy53, &yymsp[0].minor.yy53); }
+{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy189, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209); }
break;
case 29: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */
-{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy435, &yymsp[-2].minor.yy53, &yymsp[0].minor.yy53); }
+{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy189, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209); }
break;
case 30: /* privileges ::= ALL */
-{ yymsp[0].minor.yy435 = PRIVILEGE_TYPE_ALL; }
+{ yymsp[0].minor.yy189 = PRIVILEGE_TYPE_ALL; }
break;
case 31: /* privileges ::= priv_type_list */
case 32: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==32);
-{ yylhsminor.yy435 = yymsp[0].minor.yy435; }
- yymsp[0].minor.yy435 = yylhsminor.yy435;
+{ yylhsminor.yy189 = yymsp[0].minor.yy189; }
+ yymsp[0].minor.yy189 = yylhsminor.yy189;
break;
case 33: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */
-{ yylhsminor.yy435 = yymsp[-2].minor.yy435 | yymsp[0].minor.yy435; }
- yymsp[-2].minor.yy435 = yylhsminor.yy435;
+{ yylhsminor.yy189 = yymsp[-2].minor.yy189 | yymsp[0].minor.yy189; }
+ yymsp[-2].minor.yy189 = yylhsminor.yy189;
break;
case 34: /* priv_type ::= READ */
-{ yymsp[0].minor.yy435 = PRIVILEGE_TYPE_READ; }
+{ yymsp[0].minor.yy189 = PRIVILEGE_TYPE_READ; }
break;
case 35: /* priv_type ::= WRITE */
-{ yymsp[0].minor.yy435 = PRIVILEGE_TYPE_WRITE; }
+{ yymsp[0].minor.yy189 = PRIVILEGE_TYPE_WRITE; }
break;
case 36: /* priv_level ::= NK_STAR NK_DOT NK_STAR */
-{ yylhsminor.yy53 = yymsp[-2].minor.yy0; }
- yymsp[-2].minor.yy53 = yylhsminor.yy53;
+{ yylhsminor.yy209 = yymsp[-2].minor.yy0; }
+ yymsp[-2].minor.yy209 = yylhsminor.yy209;
break;
case 37: /* priv_level ::= db_name NK_DOT NK_STAR */
-{ yylhsminor.yy53 = yymsp[-2].minor.yy53; }
- yymsp[-2].minor.yy53 = yylhsminor.yy53;
+{ yylhsminor.yy209 = yymsp[-2].minor.yy209; }
+ yymsp[-2].minor.yy209 = yylhsminor.yy209;
break;
case 38: /* cmd ::= CREATE DNODE dnode_endpoint */
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy53, NULL); }
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy209, NULL); }
break;
case 39: /* cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy53, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0); }
break;
case 40: /* cmd ::= DROP DNODE NK_INTEGER */
{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy0); }
break;
case 41: /* cmd ::= DROP DNODE dnode_endpoint */
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy53); }
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy209); }
break;
case 42: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); }
@@ -3232,26 +3246,26 @@ static YYACTIONTYPE yy_reduce(
case 46: /* dnode_endpoint ::= NK_STRING */
case 47: /* dnode_host_name ::= NK_ID */ yytestcase(yyruleno==47);
case 48: /* dnode_host_name ::= NK_IPTOKEN */ yytestcase(yyruleno==48);
- case 290: /* db_name ::= NK_ID */ yytestcase(yyruleno==290);
- case 291: /* table_name ::= NK_ID */ yytestcase(yyruleno==291);
- case 292: /* column_name ::= NK_ID */ yytestcase(yyruleno==292);
- case 293: /* function_name ::= NK_ID */ yytestcase(yyruleno==293);
- case 294: /* table_alias ::= NK_ID */ yytestcase(yyruleno==294);
- case 295: /* column_alias ::= NK_ID */ yytestcase(yyruleno==295);
- case 296: /* user_name ::= NK_ID */ yytestcase(yyruleno==296);
- case 297: /* index_name ::= NK_ID */ yytestcase(yyruleno==297);
- case 298: /* topic_name ::= NK_ID */ yytestcase(yyruleno==298);
- case 299: /* stream_name ::= NK_ID */ yytestcase(yyruleno==299);
- case 300: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==300);
- case 333: /* noarg_func ::= NOW */ yytestcase(yyruleno==333);
- case 334: /* noarg_func ::= TODAY */ yytestcase(yyruleno==334);
- case 335: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==335);
- case 336: /* star_func ::= COUNT */ yytestcase(yyruleno==336);
- case 337: /* star_func ::= FIRST */ yytestcase(yyruleno==337);
- case 338: /* star_func ::= LAST */ yytestcase(yyruleno==338);
- case 339: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==339);
-{ yylhsminor.yy53 = yymsp[0].minor.yy0; }
- yymsp[0].minor.yy53 = yylhsminor.yy53;
+ case 289: /* db_name ::= NK_ID */ yytestcase(yyruleno==289);
+ case 290: /* table_name ::= NK_ID */ yytestcase(yyruleno==290);
+ case 291: /* column_name ::= NK_ID */ yytestcase(yyruleno==291);
+ case 292: /* function_name ::= NK_ID */ yytestcase(yyruleno==292);
+ case 293: /* table_alias ::= NK_ID */ yytestcase(yyruleno==293);
+ case 294: /* column_alias ::= NK_ID */ yytestcase(yyruleno==294);
+ case 295: /* user_name ::= NK_ID */ yytestcase(yyruleno==295);
+ case 296: /* index_name ::= NK_ID */ yytestcase(yyruleno==296);
+ case 297: /* topic_name ::= NK_ID */ yytestcase(yyruleno==297);
+ case 298: /* stream_name ::= NK_ID */ yytestcase(yyruleno==298);
+ case 299: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==299);
+ case 332: /* noarg_func ::= NOW */ yytestcase(yyruleno==332);
+ case 333: /* noarg_func ::= TODAY */ yytestcase(yyruleno==333);
+ case 334: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==334);
+ case 335: /* star_func ::= COUNT */ yytestcase(yyruleno==335);
+ case 336: /* star_func ::= FIRST */ yytestcase(yyruleno==336);
+ case 337: /* star_func ::= LAST */ yytestcase(yyruleno==337);
+ case 338: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==338);
+{ yylhsminor.yy209 = yymsp[0].minor.yy0; }
+ yymsp[0].minor.yy209 = yylhsminor.yy209;
break;
case 49: /* cmd ::= ALTER LOCAL NK_STRING */
{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); }
@@ -3284,1161 +3298,1157 @@ static YYACTIONTYPE yy_reduce(
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); }
break;
case 59: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
-{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy603, &yymsp[-1].minor.yy53, yymsp[0].minor.yy636); }
+{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy137, &yymsp[-1].minor.yy209, yymsp[0].minor.yy632); }
break;
case 60: /* cmd ::= DROP DATABASE exists_opt db_name */
-{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy603, &yymsp[0].minor.yy53); }
+{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy137, &yymsp[0].minor.yy209); }
break;
case 61: /* cmd ::= USE db_name */
-{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy53); }
+{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy209); }
break;
case 62: /* cmd ::= ALTER DATABASE db_name alter_db_options */
-{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy53, yymsp[0].minor.yy636); }
+{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy209, yymsp[0].minor.yy632); }
break;
case 63: /* not_exists_opt ::= IF NOT EXISTS */
-{ yymsp[-2].minor.yy603 = true; }
+{ yymsp[-2].minor.yy137 = true; }
break;
case 64: /* not_exists_opt ::= */
case 66: /* exists_opt ::= */ yytestcase(yyruleno==66);
- case 236: /* analyze_opt ::= */ yytestcase(yyruleno==236);
- case 244: /* agg_func_opt ::= */ yytestcase(yyruleno==244);
- case 392: /* set_quantifier_opt ::= */ yytestcase(yyruleno==392);
-{ yymsp[1].minor.yy603 = false; }
+ case 235: /* analyze_opt ::= */ yytestcase(yyruleno==235);
+ case 243: /* agg_func_opt ::= */ yytestcase(yyruleno==243);
+ case 391: /* set_quantifier_opt ::= */ yytestcase(yyruleno==391);
+{ yymsp[1].minor.yy137 = false; }
break;
case 65: /* exists_opt ::= IF EXISTS */
-{ yymsp[-1].minor.yy603 = true; }
+{ yymsp[-1].minor.yy137 = true; }
break;
case 67: /* db_options ::= */
-{ yymsp[1].minor.yy636 = createDefaultDatabaseOptions(pCxt); }
+{ yymsp[1].minor.yy632 = createDefaultDatabaseOptions(pCxt); }
break;
case 68: /* db_options ::= db_options BUFFER NK_INTEGER */
-{ yylhsminor.yy636 = setDatabaseOption(pCxt, yymsp[-2].minor.yy636, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
case 69: /* db_options ::= db_options CACHELAST NK_INTEGER */
-{ yylhsminor.yy636 = setDatabaseOption(pCxt, yymsp[-2].minor.yy636, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
case 70: /* db_options ::= db_options COMP NK_INTEGER */
-{ yylhsminor.yy636 = setDatabaseOption(pCxt, yymsp[-2].minor.yy636, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
case 71: /* db_options ::= db_options DAYS NK_INTEGER */
case 72: /* db_options ::= db_options DAYS NK_VARIABLE */ yytestcase(yyruleno==72);
-{ yylhsminor.yy636 = setDatabaseOption(pCxt, yymsp[-2].minor.yy636, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
case 73: /* db_options ::= db_options FSYNC NK_INTEGER */
-{ yylhsminor.yy636 = setDatabaseOption(pCxt, yymsp[-2].minor.yy636, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
case 74: /* db_options ::= db_options MAXROWS NK_INTEGER */
-{ yylhsminor.yy636 = setDatabaseOption(pCxt, yymsp[-2].minor.yy636, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
case 75: /* db_options ::= db_options MINROWS NK_INTEGER */
-{ yylhsminor.yy636 = setDatabaseOption(pCxt, yymsp[-2].minor.yy636, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
case 76: /* db_options ::= db_options KEEP integer_list */
case 77: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==77);
-{ yylhsminor.yy636 = setDatabaseOption(pCxt, yymsp[-2].minor.yy636, DB_OPTION_KEEP, yymsp[0].minor.yy236); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_KEEP, yymsp[0].minor.yy424); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
case 78: /* db_options ::= db_options PAGES NK_INTEGER */
-{ yylhsminor.yy636 = setDatabaseOption(pCxt, yymsp[-2].minor.yy636, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
case 79: /* db_options ::= db_options PAGESIZE NK_INTEGER */
-{ yylhsminor.yy636 = setDatabaseOption(pCxt, yymsp[-2].minor.yy636, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
case 80: /* db_options ::= db_options PRECISION NK_STRING */
-{ yylhsminor.yy636 = setDatabaseOption(pCxt, yymsp[-2].minor.yy636, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
case 81: /* db_options ::= db_options REPLICA NK_INTEGER */
-{ yylhsminor.yy636 = setDatabaseOption(pCxt, yymsp[-2].minor.yy636, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
case 82: /* db_options ::= db_options STRICT NK_INTEGER */
-{ yylhsminor.yy636 = setDatabaseOption(pCxt, yymsp[-2].minor.yy636, DB_OPTION_STRICT, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_STRICT, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
case 83: /* db_options ::= db_options WAL NK_INTEGER */
-{ yylhsminor.yy636 = setDatabaseOption(pCxt, yymsp[-2].minor.yy636, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
case 84: /* db_options ::= db_options VGROUPS NK_INTEGER */
-{ yylhsminor.yy636 = setDatabaseOption(pCxt, yymsp[-2].minor.yy636, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
case 85: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */
-{ yylhsminor.yy636 = setDatabaseOption(pCxt, yymsp[-2].minor.yy636, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
case 86: /* db_options ::= db_options RETENTIONS retention_list */
-{ yylhsminor.yy636 = setDatabaseOption(pCxt, yymsp[-2].minor.yy636, DB_OPTION_RETENTIONS, yymsp[0].minor.yy236); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_RETENTIONS, yymsp[0].minor.yy424); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
case 87: /* db_options ::= db_options SCHEMALESS NK_INTEGER */
-{ yylhsminor.yy636 = setDatabaseOption(pCxt, yymsp[-2].minor.yy636, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
case 88: /* alter_db_options ::= alter_db_option */
-{ yylhsminor.yy636 = createAlterDatabaseOptions(pCxt); yylhsminor.yy636 = setAlterDatabaseOption(pCxt, yylhsminor.yy636, &yymsp[0].minor.yy25); }
- yymsp[0].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = createAlterDatabaseOptions(pCxt); yylhsminor.yy632 = setAlterDatabaseOption(pCxt, yylhsminor.yy632, &yymsp[0].minor.yy605); }
+ yymsp[0].minor.yy632 = yylhsminor.yy632;
break;
case 89: /* alter_db_options ::= alter_db_options alter_db_option */
-{ yylhsminor.yy636 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy636, &yymsp[0].minor.yy25); }
- yymsp[-1].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy632, &yymsp[0].minor.yy605); }
+ yymsp[-1].minor.yy632 = yylhsminor.yy632;
break;
case 90: /* alter_db_option ::= BUFFER NK_INTEGER */
-{ yymsp[-1].minor.yy25.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy605.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; }
break;
case 91: /* alter_db_option ::= CACHELAST NK_INTEGER */
-{ yymsp[-1].minor.yy25.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy605.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; }
break;
case 92: /* alter_db_option ::= FSYNC NK_INTEGER */
-{ yymsp[-1].minor.yy25.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy605.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; }
break;
case 93: /* alter_db_option ::= KEEP integer_list */
case 94: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==94);
-{ yymsp[-1].minor.yy25.type = DB_OPTION_KEEP; yymsp[-1].minor.yy25.pList = yymsp[0].minor.yy236; }
+{ yymsp[-1].minor.yy605.type = DB_OPTION_KEEP; yymsp[-1].minor.yy605.pList = yymsp[0].minor.yy424; }
break;
case 95: /* alter_db_option ::= PAGES NK_INTEGER */
-{ yymsp[-1].minor.yy25.type = DB_OPTION_PAGES; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy605.type = DB_OPTION_PAGES; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; }
break;
case 96: /* alter_db_option ::= REPLICA NK_INTEGER */
-{ yymsp[-1].minor.yy25.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy605.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; }
break;
case 97: /* alter_db_option ::= STRICT NK_INTEGER */
-{ yymsp[-1].minor.yy25.type = DB_OPTION_STRICT; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy605.type = DB_OPTION_STRICT; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; }
break;
case 98: /* alter_db_option ::= WAL NK_INTEGER */
-{ yymsp[-1].minor.yy25.type = DB_OPTION_WAL; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy605.type = DB_OPTION_WAL; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; }
break;
case 99: /* integer_list ::= NK_INTEGER */
-{ yylhsminor.yy236 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy236 = yylhsminor.yy236;
+{ yylhsminor.yy424 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy424 = yylhsminor.yy424;
break;
case 100: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */
- case 263: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==263);
-{ yylhsminor.yy236 = addNodeToList(pCxt, yymsp[-2].minor.yy236, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy236 = yylhsminor.yy236;
+ case 262: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==262);
+{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy424 = yylhsminor.yy424;
break;
case 101: /* variable_list ::= NK_VARIABLE */
-{ yylhsminor.yy236 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy236 = yylhsminor.yy236;
+{ yylhsminor.yy424 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy424 = yylhsminor.yy424;
break;
case 102: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */
-{ yylhsminor.yy236 = addNodeToList(pCxt, yymsp[-2].minor.yy236, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy236 = yylhsminor.yy236;
+{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy424 = yylhsminor.yy424;
break;
case 103: /* retention_list ::= retention */
case 123: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==123);
case 126: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==126);
case 133: /* column_def_list ::= column_def */ yytestcase(yyruleno==133);
- case 174: /* col_name_list ::= col_name */ yytestcase(yyruleno==174);
- case 212: /* func_name_list ::= func_name */ yytestcase(yyruleno==212);
- case 221: /* func_list ::= func */ yytestcase(yyruleno==221);
- case 288: /* literal_list ::= signed_literal */ yytestcase(yyruleno==288);
- case 342: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==342);
- case 397: /* select_sublist ::= select_item */ yytestcase(yyruleno==397);
- case 446: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==446);
-{ yylhsminor.yy236 = createNodeList(pCxt, yymsp[0].minor.yy636); }
- yymsp[0].minor.yy236 = yylhsminor.yy236;
+ case 173: /* col_name_list ::= col_name */ yytestcase(yyruleno==173);
+ case 211: /* func_name_list ::= func_name */ yytestcase(yyruleno==211);
+ case 220: /* func_list ::= func */ yytestcase(yyruleno==220);
+ case 287: /* literal_list ::= signed_literal */ yytestcase(yyruleno==287);
+ case 341: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==341);
+ case 396: /* select_sublist ::= select_item */ yytestcase(yyruleno==396);
+ case 445: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==445);
+{ yylhsminor.yy424 = createNodeList(pCxt, yymsp[0].minor.yy632); }
+ yymsp[0].minor.yy424 = yylhsminor.yy424;
break;
case 104: /* retention_list ::= retention_list NK_COMMA retention */
case 134: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==134);
- case 175: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==175);
- case 213: /* func_name_list ::= func_name_list NK_COMMA func_name */ yytestcase(yyruleno==213);
- case 222: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==222);
- case 289: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==289);
- case 343: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==343);
- case 398: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==398);
- case 447: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==447);
-{ yylhsminor.yy236 = addNodeToList(pCxt, yymsp[-2].minor.yy236, yymsp[0].minor.yy636); }
- yymsp[-2].minor.yy236 = yylhsminor.yy236;
+ case 174: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==174);
+ case 212: /* func_name_list ::= func_name_list NK_COMMA func_name */ yytestcase(yyruleno==212);
+ case 221: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==221);
+ case 288: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==288);
+ case 342: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==342);
+ case 397: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==397);
+ case 446: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==446);
+{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, yymsp[0].minor.yy632); }
+ yymsp[-2].minor.yy424 = yylhsminor.yy424;
break;
case 105: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
-{ yylhsminor.yy636 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
case 106: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
case 108: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==108);
-{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy603, yymsp[-5].minor.yy636, yymsp[-3].minor.yy236, yymsp[-1].minor.yy236, yymsp[0].minor.yy636); }
+{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy137, yymsp[-5].minor.yy632, yymsp[-3].minor.yy424, yymsp[-1].minor.yy424, yymsp[0].minor.yy632); }
break;
case 107: /* cmd ::= CREATE TABLE multi_create_clause */
-{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy236); }
+{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy424); }
break;
case 109: /* cmd ::= DROP TABLE multi_drop_clause */
-{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy236); }
+{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy424); }
break;
case 110: /* cmd ::= DROP STABLE exists_opt full_table_name */
-{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy603, yymsp[0].minor.yy636); }
+{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy137, yymsp[0].minor.yy632); }
break;
case 111: /* cmd ::= ALTER TABLE alter_table_clause */
case 112: /* cmd ::= ALTER STABLE alter_table_clause */ yytestcase(yyruleno==112);
- case 265: /* cmd ::= query_expression */ yytestcase(yyruleno==265);
-{ pCxt->pRootNode = yymsp[0].minor.yy636; }
+ case 264: /* cmd ::= query_expression */ yytestcase(yyruleno==264);
+{ pCxt->pRootNode = yymsp[0].minor.yy632; }
break;
case 113: /* alter_table_clause ::= full_table_name alter_table_options */
-{ yylhsminor.yy636 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy636, yymsp[0].minor.yy636); }
- yymsp[-1].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy632, yymsp[0].minor.yy632); }
+ yymsp[-1].minor.yy632 = yylhsminor.yy632;
break;
case 114: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */
-{ yylhsminor.yy636 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy636, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy53, yymsp[0].minor.yy450); }
- yymsp[-4].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy632, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy209, yymsp[0].minor.yy304); }
+ yymsp[-4].minor.yy632 = yylhsminor.yy632;
break;
case 115: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */
-{ yylhsminor.yy636 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy636, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy53); }
- yymsp[-3].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy632, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy209); }
+ yymsp[-3].minor.yy632 = yylhsminor.yy632;
break;
case 116: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
-{ yylhsminor.yy636 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy636, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy53, yymsp[0].minor.yy450); }
- yymsp[-4].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy632, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy209, yymsp[0].minor.yy304); }
+ yymsp[-4].minor.yy632 = yylhsminor.yy632;
break;
case 117: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
-{ yylhsminor.yy636 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy636, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy53, &yymsp[0].minor.yy53); }
- yymsp[-4].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy632, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy209, &yymsp[0].minor.yy209); }
+ yymsp[-4].minor.yy632 = yylhsminor.yy632;
break;
case 118: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */
-{ yylhsminor.yy636 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy636, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy53, yymsp[0].minor.yy450); }
- yymsp[-4].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy632, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy209, yymsp[0].minor.yy304); }
+ yymsp[-4].minor.yy632 = yylhsminor.yy632;
break;
case 119: /* alter_table_clause ::= full_table_name DROP TAG column_name */
-{ yylhsminor.yy636 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy636, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy53); }
- yymsp[-3].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy632, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy209); }
+ yymsp[-3].minor.yy632 = yylhsminor.yy632;
break;
case 120: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
-{ yylhsminor.yy636 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy636, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy53, yymsp[0].minor.yy450); }
- yymsp[-4].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy632, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy209, yymsp[0].minor.yy304); }
+ yymsp[-4].minor.yy632 = yylhsminor.yy632;
break;
case 121: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
-{ yylhsminor.yy636 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy636, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy53, &yymsp[0].minor.yy53); }
- yymsp[-4].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy632, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy209, &yymsp[0].minor.yy209); }
+ yymsp[-4].minor.yy632 = yylhsminor.yy632;
break;
case 122: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */
-{ yylhsminor.yy636 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy636, &yymsp[-2].minor.yy53, yymsp[0].minor.yy636); }
- yymsp[-5].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy632, &yymsp[-2].minor.yy209, yymsp[0].minor.yy632); }
+ yymsp[-5].minor.yy632 = yylhsminor.yy632;
break;
case 124: /* multi_create_clause ::= multi_create_clause create_subtable_clause */
case 127: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==127);
-{ yylhsminor.yy236 = addNodeToList(pCxt, yymsp[-1].minor.yy236, yymsp[0].minor.yy636); }
- yymsp[-1].minor.yy236 = yylhsminor.yy236;
+{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-1].minor.yy424, yymsp[0].minor.yy632); }
+ yymsp[-1].minor.yy424 = yylhsminor.yy424;
break;
case 125: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP table_options */
-{ yylhsminor.yy636 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy603, yymsp[-8].minor.yy636, yymsp[-6].minor.yy636, yymsp[-5].minor.yy236, yymsp[-2].minor.yy236, yymsp[0].minor.yy636); }
- yymsp[-9].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy137, yymsp[-8].minor.yy632, yymsp[-6].minor.yy632, yymsp[-5].minor.yy424, yymsp[-2].minor.yy424, yymsp[0].minor.yy632); }
+ yymsp[-9].minor.yy632 = yylhsminor.yy632;
break;
case 128: /* drop_table_clause ::= exists_opt full_table_name */
-{ yylhsminor.yy636 = createDropTableClause(pCxt, yymsp[-1].minor.yy603, yymsp[0].minor.yy636); }
- yymsp[-1].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = createDropTableClause(pCxt, yymsp[-1].minor.yy137, yymsp[0].minor.yy632); }
+ yymsp[-1].minor.yy632 = yylhsminor.yy632;
break;
case 129: /* specific_tags_opt ::= */
case 160: /* tags_def_opt ::= */ yytestcase(yyruleno==160);
- case 405: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==405);
- case 422: /* group_by_clause_opt ::= */ yytestcase(yyruleno==422);
- case 434: /* order_by_clause_opt ::= */ yytestcase(yyruleno==434);
-{ yymsp[1].minor.yy236 = NULL; }
+ case 404: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==404);
+ case 421: /* group_by_clause_opt ::= */ yytestcase(yyruleno==421);
+ case 433: /* order_by_clause_opt ::= */ yytestcase(yyruleno==433);
+{ yymsp[1].minor.yy424 = NULL; }
break;
case 130: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */
-{ yymsp[-2].minor.yy236 = yymsp[-1].minor.yy236; }
+{ yymsp[-2].minor.yy424 = yymsp[-1].minor.yy424; }
break;
case 131: /* full_table_name ::= table_name */
-{ yylhsminor.yy636 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy53, NULL); }
- yymsp[0].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy209, NULL); }
+ yymsp[0].minor.yy632 = yylhsminor.yy632;
break;
case 132: /* full_table_name ::= db_name NK_DOT table_name */
-{ yylhsminor.yy636 = createRealTableNode(pCxt, &yymsp[-2].minor.yy53, &yymsp[0].minor.yy53, NULL); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = createRealTableNode(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209, NULL); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
case 135: /* column_def ::= column_name type_name */
-{ yylhsminor.yy636 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy53, yymsp[0].minor.yy450, NULL); }
- yymsp[-1].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy209, yymsp[0].minor.yy304, NULL); }
+ yymsp[-1].minor.yy632 = yylhsminor.yy632;
break;
case 136: /* column_def ::= column_name type_name COMMENT NK_STRING */
-{ yylhsminor.yy636 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy53, yymsp[-2].minor.yy450, &yymsp[0].minor.yy0); }
- yymsp[-3].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy209, yymsp[-2].minor.yy304, &yymsp[0].minor.yy0); }
+ yymsp[-3].minor.yy632 = yylhsminor.yy632;
break;
case 137: /* type_name ::= BOOL */
-{ yymsp[0].minor.yy450 = createDataType(TSDB_DATA_TYPE_BOOL); }
+{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_BOOL); }
break;
case 138: /* type_name ::= TINYINT */
-{ yymsp[0].minor.yy450 = createDataType(TSDB_DATA_TYPE_TINYINT); }
+{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_TINYINT); }
break;
case 139: /* type_name ::= SMALLINT */
-{ yymsp[0].minor.yy450 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
+{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
break;
case 140: /* type_name ::= INT */
case 141: /* type_name ::= INTEGER */ yytestcase(yyruleno==141);
-{ yymsp[0].minor.yy450 = createDataType(TSDB_DATA_TYPE_INT); }
+{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_INT); }
break;
case 142: /* type_name ::= BIGINT */
-{ yymsp[0].minor.yy450 = createDataType(TSDB_DATA_TYPE_BIGINT); }
+{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_BIGINT); }
break;
case 143: /* type_name ::= FLOAT */
-{ yymsp[0].minor.yy450 = createDataType(TSDB_DATA_TYPE_FLOAT); }
+{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_FLOAT); }
break;
case 144: /* type_name ::= DOUBLE */
-{ yymsp[0].minor.yy450 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
+{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
break;
case 145: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy450 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy304 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
break;
case 146: /* type_name ::= TIMESTAMP */
-{ yymsp[0].minor.yy450 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
+{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
break;
case 147: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy450 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy304 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
break;
case 148: /* type_name ::= TINYINT UNSIGNED */
-{ yymsp[-1].minor.yy450 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
+{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
break;
case 149: /* type_name ::= SMALLINT UNSIGNED */
-{ yymsp[-1].minor.yy450 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
+{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
break;
case 150: /* type_name ::= INT UNSIGNED */
-{ yymsp[-1].minor.yy450 = createDataType(TSDB_DATA_TYPE_UINT); }
+{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_UINT); }
break;
case 151: /* type_name ::= BIGINT UNSIGNED */
-{ yymsp[-1].minor.yy450 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
+{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
break;
case 152: /* type_name ::= JSON */
-{ yymsp[0].minor.yy450 = createDataType(TSDB_DATA_TYPE_JSON); }
+{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_JSON); }
break;
case 153: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy450 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy304 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
break;
case 154: /* type_name ::= MEDIUMBLOB */
-{ yymsp[0].minor.yy450 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
+{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
break;
case 155: /* type_name ::= BLOB */
-{ yymsp[0].minor.yy450 = createDataType(TSDB_DATA_TYPE_BLOB); }
+{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_BLOB); }
break;
case 156: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy450 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
+{ yymsp[-3].minor.yy304 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
break;
case 157: /* type_name ::= DECIMAL */
-{ yymsp[0].minor.yy450 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 158: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy450 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+{ yymsp[-3].minor.yy304 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 159: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
-{ yymsp[-5].minor.yy450 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+{ yymsp[-5].minor.yy304 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
case 161: /* tags_def_opt ::= tags_def */
- case 341: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==341);
- case 396: /* select_list ::= select_sublist */ yytestcase(yyruleno==396);
-{ yylhsminor.yy236 = yymsp[0].minor.yy236; }
- yymsp[0].minor.yy236 = yylhsminor.yy236;
+ case 340: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==340);
+ case 395: /* select_list ::= select_sublist */ yytestcase(yyruleno==395);
+{ yylhsminor.yy424 = yymsp[0].minor.yy424; }
+ yymsp[0].minor.yy424 = yylhsminor.yy424;
break;
case 162: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */
-{ yymsp[-3].minor.yy236 = yymsp[-1].minor.yy236; }
+{ yymsp[-3].minor.yy424 = yymsp[-1].minor.yy424; }
break;
case 163: /* table_options ::= */
-{ yymsp[1].minor.yy636 = createDefaultTableOptions(pCxt); }
+{ yymsp[1].minor.yy632 = createDefaultTableOptions(pCxt); }
break;
case 164: /* table_options ::= table_options COMMENT NK_STRING */
-{ yylhsminor.yy636 = setTableOption(pCxt, yymsp[-2].minor.yy636, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
- break;
- case 165: /* table_options ::= table_options DELAY NK_INTEGER */
-{ yylhsminor.yy636 = setTableOption(pCxt, yymsp[-2].minor.yy636, TABLE_OPTION_DELAY, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+{ yylhsminor.yy632 = setTableOption(pCxt, yymsp[-2].minor.yy632, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 166: /* table_options ::= table_options FILE_FACTOR NK_FLOAT */
-{ yylhsminor.yy636 = setTableOption(pCxt, yymsp[-2].minor.yy636, TABLE_OPTION_FILE_FACTOR, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ case 165: /* table_options ::= table_options FILE_FACTOR NK_FLOAT */
+{ yylhsminor.yy632 = setTableOption(pCxt, yymsp[-2].minor.yy632, TABLE_OPTION_FILE_FACTOR, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 167: /* table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */
-{ yylhsminor.yy636 = setTableOption(pCxt, yymsp[-4].minor.yy636, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy236); }
- yymsp[-4].minor.yy636 = yylhsminor.yy636;
+ case 166: /* table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */
+{ yylhsminor.yy632 = setTableOption(pCxt, yymsp[-4].minor.yy632, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy424); }
+ yymsp[-4].minor.yy632 = yylhsminor.yy632;
break;
- case 168: /* table_options ::= table_options TTL NK_INTEGER */
-{ yylhsminor.yy636 = setTableOption(pCxt, yymsp[-2].minor.yy636, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ case 167: /* table_options ::= table_options TTL NK_INTEGER */
+{ yylhsminor.yy632 = setTableOption(pCxt, yymsp[-2].minor.yy632, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 169: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
-{ yylhsminor.yy636 = setTableOption(pCxt, yymsp[-4].minor.yy636, TABLE_OPTION_SMA, yymsp[-1].minor.yy236); }
- yymsp[-4].minor.yy636 = yylhsminor.yy636;
+ case 168: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
+{ yylhsminor.yy632 = setTableOption(pCxt, yymsp[-4].minor.yy632, TABLE_OPTION_SMA, yymsp[-1].minor.yy424); }
+ yymsp[-4].minor.yy632 = yylhsminor.yy632;
break;
- case 170: /* alter_table_options ::= alter_table_option */
-{ yylhsminor.yy636 = createAlterTableOptions(pCxt); yylhsminor.yy636 = setTableOption(pCxt, yylhsminor.yy636, yymsp[0].minor.yy25.type, &yymsp[0].minor.yy25.val); }
- yymsp[0].minor.yy636 = yylhsminor.yy636;
+ case 169: /* alter_table_options ::= alter_table_option */
+{ yylhsminor.yy632 = createAlterTableOptions(pCxt); yylhsminor.yy632 = setTableOption(pCxt, yylhsminor.yy632, yymsp[0].minor.yy605.type, &yymsp[0].minor.yy605.val); }
+ yymsp[0].minor.yy632 = yylhsminor.yy632;
break;
- case 171: /* alter_table_options ::= alter_table_options alter_table_option */
-{ yylhsminor.yy636 = setTableOption(pCxt, yymsp[-1].minor.yy636, yymsp[0].minor.yy25.type, &yymsp[0].minor.yy25.val); }
- yymsp[-1].minor.yy636 = yylhsminor.yy636;
+ case 170: /* alter_table_options ::= alter_table_options alter_table_option */
+{ yylhsminor.yy632 = setTableOption(pCxt, yymsp[-1].minor.yy632, yymsp[0].minor.yy605.type, &yymsp[0].minor.yy605.val); }
+ yymsp[-1].minor.yy632 = yylhsminor.yy632;
break;
- case 172: /* alter_table_option ::= COMMENT NK_STRING */
-{ yymsp[-1].minor.yy25.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; }
+ case 171: /* alter_table_option ::= COMMENT NK_STRING */
+{ yymsp[-1].minor.yy605.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; }
break;
- case 173: /* alter_table_option ::= TTL NK_INTEGER */
-{ yymsp[-1].minor.yy25.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy25.val = yymsp[0].minor.yy0; }
+ case 172: /* alter_table_option ::= TTL NK_INTEGER */
+{ yymsp[-1].minor.yy605.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; }
break;
- case 176: /* col_name ::= column_name */
-{ yylhsminor.yy636 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy53); }
- yymsp[0].minor.yy636 = yylhsminor.yy636;
+ case 175: /* col_name ::= column_name */
+{ yylhsminor.yy632 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy209); }
+ yymsp[0].minor.yy632 = yylhsminor.yy632;
break;
- case 177: /* cmd ::= SHOW DNODES */
+ case 176: /* cmd ::= SHOW DNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT, NULL, NULL); }
break;
- case 178: /* cmd ::= SHOW USERS */
+ case 177: /* cmd ::= SHOW USERS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT, NULL, NULL); }
break;
- case 179: /* cmd ::= SHOW DATABASES */
+ case 178: /* cmd ::= SHOW DATABASES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT, NULL, NULL); }
break;
- case 180: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
-{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy636, yymsp[0].minor.yy636); }
+ case 179: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */
+{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy632, yymsp[0].minor.yy632); }
break;
- case 181: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
-{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy636, yymsp[0].minor.yy636); }
+ case 180: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
+{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy632, yymsp[0].minor.yy632); }
break;
- case 182: /* cmd ::= SHOW db_name_cond_opt VGROUPS */
-{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy636, NULL); }
+ case 181: /* cmd ::= SHOW db_name_cond_opt VGROUPS */
+{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy632, NULL); }
break;
- case 183: /* cmd ::= SHOW MNODES */
+ case 182: /* cmd ::= SHOW MNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT, NULL, NULL); }
break;
- case 184: /* cmd ::= SHOW MODULES */
+ case 183: /* cmd ::= SHOW MODULES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MODULES_STMT, NULL, NULL); }
break;
- case 185: /* cmd ::= SHOW QNODES */
+ case 184: /* cmd ::= SHOW QNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT, NULL, NULL); }
break;
- case 186: /* cmd ::= SHOW FUNCTIONS */
+ case 185: /* cmd ::= SHOW FUNCTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT, NULL, NULL); }
break;
- case 187: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy636, yymsp[0].minor.yy636); }
+ case 186: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
+{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy632, yymsp[0].minor.yy632); }
break;
- case 188: /* cmd ::= SHOW STREAMS */
+ case 187: /* cmd ::= SHOW STREAMS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT, NULL, NULL); }
break;
- case 189: /* cmd ::= SHOW ACCOUNTS */
+ case 188: /* cmd ::= SHOW ACCOUNTS */
{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
break;
- case 190: /* cmd ::= SHOW APPS */
+ case 189: /* cmd ::= SHOW APPS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT, NULL, NULL); }
break;
- case 191: /* cmd ::= SHOW CONNECTIONS */
+ case 190: /* cmd ::= SHOW CONNECTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT, NULL, NULL); }
break;
- case 192: /* cmd ::= SHOW LICENCE */
- case 193: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==193);
+ case 191: /* cmd ::= SHOW LICENCE */
+ case 192: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==192);
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCE_STMT, NULL, NULL); }
break;
- case 194: /* cmd ::= SHOW CREATE DATABASE db_name */
-{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy53); }
+ case 193: /* cmd ::= SHOW CREATE DATABASE db_name */
+{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy209); }
break;
- case 195: /* cmd ::= SHOW CREATE TABLE full_table_name */
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy636); }
+ case 194: /* cmd ::= SHOW CREATE TABLE full_table_name */
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy632); }
break;
- case 196: /* cmd ::= SHOW CREATE STABLE full_table_name */
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy636); }
+ case 195: /* cmd ::= SHOW CREATE STABLE full_table_name */
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy632); }
break;
- case 197: /* cmd ::= SHOW QUERIES */
+ case 196: /* cmd ::= SHOW QUERIES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT, NULL, NULL); }
break;
- case 198: /* cmd ::= SHOW SCORES */
+ case 197: /* cmd ::= SHOW SCORES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT, NULL, NULL); }
break;
- case 199: /* cmd ::= SHOW TOPICS */
+ case 198: /* cmd ::= SHOW TOPICS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT, NULL, NULL); }
break;
- case 200: /* cmd ::= SHOW VARIABLES */
+ case 199: /* cmd ::= SHOW VARIABLES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLE_STMT, NULL, NULL); }
break;
- case 201: /* cmd ::= SHOW BNODES */
+ case 200: /* cmd ::= SHOW BNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT, NULL, NULL); }
break;
- case 202: /* cmd ::= SHOW SNODES */
+ case 201: /* cmd ::= SHOW SNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT, NULL, NULL); }
break;
- case 203: /* cmd ::= SHOW CLUSTER */
+ case 202: /* cmd ::= SHOW CLUSTER */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT, NULL, NULL); }
break;
- case 204: /* cmd ::= SHOW TRANSACTIONS */
+ case 203: /* cmd ::= SHOW TRANSACTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT, NULL, NULL); }
break;
- case 205: /* db_name_cond_opt ::= */
- case 210: /* from_db_opt ::= */ yytestcase(yyruleno==210);
-{ yymsp[1].minor.yy636 = createDefaultDatabaseCondValue(pCxt); }
+ case 204: /* db_name_cond_opt ::= */
+ case 209: /* from_db_opt ::= */ yytestcase(yyruleno==209);
+{ yymsp[1].minor.yy632 = createDefaultDatabaseCondValue(pCxt); }
break;
- case 206: /* db_name_cond_opt ::= db_name NK_DOT */
-{ yylhsminor.yy636 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy53); }
- yymsp[-1].minor.yy636 = yylhsminor.yy636;
+ case 205: /* db_name_cond_opt ::= db_name NK_DOT */
+{ yylhsminor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy209); }
+ yymsp[-1].minor.yy632 = yylhsminor.yy632;
break;
- case 207: /* like_pattern_opt ::= */
- case 218: /* index_options ::= */ yytestcase(yyruleno==218);
- case 250: /* into_opt ::= */ yytestcase(yyruleno==250);
- case 403: /* where_clause_opt ::= */ yytestcase(yyruleno==403);
- case 407: /* twindow_clause_opt ::= */ yytestcase(yyruleno==407);
- case 412: /* sliding_opt ::= */ yytestcase(yyruleno==412);
- case 414: /* fill_opt ::= */ yytestcase(yyruleno==414);
- case 426: /* having_clause_opt ::= */ yytestcase(yyruleno==426);
- case 436: /* slimit_clause_opt ::= */ yytestcase(yyruleno==436);
- case 440: /* limit_clause_opt ::= */ yytestcase(yyruleno==440);
-{ yymsp[1].minor.yy636 = NULL; }
+ case 206: /* like_pattern_opt ::= */
+ case 217: /* index_options ::= */ yytestcase(yyruleno==217);
+ case 249: /* into_opt ::= */ yytestcase(yyruleno==249);
+ case 402: /* where_clause_opt ::= */ yytestcase(yyruleno==402);
+ case 406: /* twindow_clause_opt ::= */ yytestcase(yyruleno==406);
+ case 411: /* sliding_opt ::= */ yytestcase(yyruleno==411);
+ case 413: /* fill_opt ::= */ yytestcase(yyruleno==413);
+ case 425: /* having_clause_opt ::= */ yytestcase(yyruleno==425);
+ case 435: /* slimit_clause_opt ::= */ yytestcase(yyruleno==435);
+ case 439: /* limit_clause_opt ::= */ yytestcase(yyruleno==439);
+{ yymsp[1].minor.yy632 = NULL; }
break;
- case 208: /* like_pattern_opt ::= LIKE NK_STRING */
-{ yymsp[-1].minor.yy636 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+ case 207: /* like_pattern_opt ::= LIKE NK_STRING */
+{ yymsp[-1].minor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
break;
- case 209: /* table_name_cond ::= table_name */
-{ yylhsminor.yy636 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy53); }
- yymsp[0].minor.yy636 = yylhsminor.yy636;
+ case 208: /* table_name_cond ::= table_name */
+{ yylhsminor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy209); }
+ yymsp[0].minor.yy632 = yylhsminor.yy632;
break;
- case 211: /* from_db_opt ::= FROM db_name */
-{ yymsp[-1].minor.yy636 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy53); }
+ case 210: /* from_db_opt ::= FROM db_name */
+{ yymsp[-1].minor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy209); }
break;
- case 214: /* func_name ::= function_name */
-{ yylhsminor.yy636 = createFunctionNode(pCxt, &yymsp[0].minor.yy53, NULL); }
- yymsp[0].minor.yy636 = yylhsminor.yy636;
+ case 213: /* func_name ::= function_name */
+{ yylhsminor.yy632 = createFunctionNode(pCxt, &yymsp[0].minor.yy209, NULL); }
+ yymsp[0].minor.yy632 = yylhsminor.yy632;
break;
- case 215: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */
-{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy603, &yymsp[-3].minor.yy53, &yymsp[-1].minor.yy53, NULL, yymsp[0].minor.yy636); }
+ case 214: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */
+{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy137, &yymsp[-3].minor.yy209, &yymsp[-1].minor.yy209, NULL, yymsp[0].minor.yy632); }
break;
- case 216: /* cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */
-{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_FULLTEXT, yymsp[-6].minor.yy603, &yymsp[-5].minor.yy53, &yymsp[-3].minor.yy53, yymsp[-1].minor.yy236, NULL); }
+ case 215: /* cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */
+{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_FULLTEXT, yymsp[-6].minor.yy137, &yymsp[-5].minor.yy209, &yymsp[-3].minor.yy209, yymsp[-1].minor.yy424, NULL); }
break;
- case 217: /* cmd ::= DROP INDEX exists_opt index_name ON table_name */
-{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy603, &yymsp[-2].minor.yy53, &yymsp[0].minor.yy53); }
+ case 216: /* cmd ::= DROP INDEX exists_opt index_name ON table_name */
+{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy137, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209); }
break;
- case 219: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */
-{ yymsp[-8].minor.yy636 = createIndexOption(pCxt, yymsp[-6].minor.yy236, releaseRawExprNode(pCxt, yymsp[-2].minor.yy636), NULL, yymsp[0].minor.yy636); }
+ case 218: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */
+{ yymsp[-8].minor.yy632 = createIndexOption(pCxt, yymsp[-6].minor.yy424, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), NULL, yymsp[0].minor.yy632); }
break;
- case 220: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */
-{ yymsp[-10].minor.yy636 = createIndexOption(pCxt, yymsp[-8].minor.yy236, releaseRawExprNode(pCxt, yymsp[-4].minor.yy636), releaseRawExprNode(pCxt, yymsp[-2].minor.yy636), yymsp[0].minor.yy636); }
+ case 219: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */
+{ yymsp[-10].minor.yy632 = createIndexOption(pCxt, yymsp[-8].minor.yy424, releaseRawExprNode(pCxt, yymsp[-4].minor.yy632), releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), yymsp[0].minor.yy632); }
break;
- case 223: /* func ::= function_name NK_LP expression_list NK_RP */
-{ yylhsminor.yy636 = createFunctionNode(pCxt, &yymsp[-3].minor.yy53, yymsp[-1].minor.yy236); }
- yymsp[-3].minor.yy636 = yylhsminor.yy636;
+ case 222: /* func ::= function_name NK_LP expression_list NK_RP */
+{ yylhsminor.yy632 = createFunctionNode(pCxt, &yymsp[-3].minor.yy209, yymsp[-1].minor.yy424); }
+ yymsp[-3].minor.yy632 = yylhsminor.yy632;
break;
- case 224: /* cmd ::= CREATE TOPIC not_exists_opt topic_name topic_options AS query_expression */
-{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-4].minor.yy603, &yymsp[-3].minor.yy53, yymsp[0].minor.yy636, NULL, yymsp[-2].minor.yy636); }
+ case 223: /* cmd ::= CREATE TOPIC not_exists_opt topic_name topic_options AS query_expression */
+{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-4].minor.yy137, &yymsp[-3].minor.yy209, yymsp[0].minor.yy632, NULL, yymsp[-2].minor.yy632); }
break;
- case 225: /* cmd ::= CREATE TOPIC not_exists_opt topic_name topic_options AS db_name */
-{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-4].minor.yy603, &yymsp[-3].minor.yy53, NULL, &yymsp[0].minor.yy53, yymsp[-2].minor.yy636); }
+ case 224: /* cmd ::= CREATE TOPIC not_exists_opt topic_name topic_options AS db_name */
+{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-4].minor.yy137, &yymsp[-3].minor.yy209, NULL, &yymsp[0].minor.yy209, yymsp[-2].minor.yy632); }
break;
- case 226: /* cmd ::= DROP TOPIC exists_opt topic_name */
-{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy603, &yymsp[0].minor.yy53); }
+ case 225: /* cmd ::= DROP TOPIC exists_opt topic_name */
+{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy137, &yymsp[0].minor.yy209); }
break;
- case 227: /* cmd ::= DROP CGROUP exists_opt cgroup_name ON topic_name */
-{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy603, &yymsp[-2].minor.yy53, &yymsp[0].minor.yy53); }
+ case 226: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
+{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy137, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209); }
break;
- case 228: /* topic_options ::= */
-{ yymsp[1].minor.yy636 = createTopicOptions(pCxt); }
+ case 227: /* topic_options ::= */
+{ yymsp[1].minor.yy632 = createTopicOptions(pCxt); }
break;
- case 229: /* topic_options ::= topic_options WITH TABLE */
-{ ((STopicOptions*)yymsp[-2].minor.yy636)->withTable = true; yylhsminor.yy636 = yymsp[-2].minor.yy636; }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ case 228: /* topic_options ::= topic_options WITH TABLE */
+{ ((STopicOptions*)yymsp[-2].minor.yy632)->withTable = true; yylhsminor.yy632 = yymsp[-2].minor.yy632; }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 230: /* topic_options ::= topic_options WITH SCHEMA */
-{ ((STopicOptions*)yymsp[-2].minor.yy636)->withSchema = true; yylhsminor.yy636 = yymsp[-2].minor.yy636; }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ case 229: /* topic_options ::= topic_options WITH SCHEMA */
+{ ((STopicOptions*)yymsp[-2].minor.yy632)->withSchema = true; yylhsminor.yy632 = yymsp[-2].minor.yy632; }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 231: /* topic_options ::= topic_options WITH TAG */
-{ ((STopicOptions*)yymsp[-2].minor.yy636)->withTag = true; yylhsminor.yy636 = yymsp[-2].minor.yy636; }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ case 230: /* topic_options ::= topic_options WITH TAG */
+{ ((STopicOptions*)yymsp[-2].minor.yy632)->withTag = true; yylhsminor.yy632 = yymsp[-2].minor.yy632; }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 232: /* cmd ::= DESC full_table_name */
- case 233: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==233);
-{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy636); }
+ case 231: /* cmd ::= DESC full_table_name */
+ case 232: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==232);
+{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy632); }
break;
- case 234: /* cmd ::= RESET QUERY CACHE */
+ case 233: /* cmd ::= RESET QUERY CACHE */
{ pCxt->pRootNode = createResetQueryCacheStmt(pCxt); }
break;
- case 235: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */
-{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy603, yymsp[-1].minor.yy636, yymsp[0].minor.yy636); }
+ case 234: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */
+{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy137, yymsp[-1].minor.yy632, yymsp[0].minor.yy632); }
break;
- case 237: /* analyze_opt ::= ANALYZE */
- case 245: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==245);
- case 393: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==393);
-{ yymsp[0].minor.yy603 = true; }
+ case 236: /* analyze_opt ::= ANALYZE */
+ case 244: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==244);
+ case 392: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==392);
+{ yymsp[0].minor.yy137 = true; }
break;
- case 238: /* explain_options ::= */
-{ yymsp[1].minor.yy636 = createDefaultExplainOptions(pCxt); }
+ case 237: /* explain_options ::= */
+{ yymsp[1].minor.yy632 = createDefaultExplainOptions(pCxt); }
break;
- case 239: /* explain_options ::= explain_options VERBOSE NK_BOOL */
-{ yylhsminor.yy636 = setExplainVerbose(pCxt, yymsp[-2].minor.yy636, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ case 238: /* explain_options ::= explain_options VERBOSE NK_BOOL */
+{ yylhsminor.yy632 = setExplainVerbose(pCxt, yymsp[-2].minor.yy632, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 240: /* explain_options ::= explain_options RATIO NK_FLOAT */
-{ yylhsminor.yy636 = setExplainRatio(pCxt, yymsp[-2].minor.yy636, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ case 239: /* explain_options ::= explain_options RATIO NK_FLOAT */
+{ yylhsminor.yy632 = setExplainRatio(pCxt, yymsp[-2].minor.yy632, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 241: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */
-{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy236); }
+ case 240: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */
+{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy424); }
break;
- case 242: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */
-{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy603, yymsp[-8].minor.yy603, &yymsp[-5].minor.yy53, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy450, yymsp[0].minor.yy158); }
+ case 241: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */
+{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy137, yymsp[-8].minor.yy137, &yymsp[-5].minor.yy209, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy304, yymsp[0].minor.yy100); }
break;
- case 243: /* cmd ::= DROP FUNCTION exists_opt function_name */
-{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy603, &yymsp[0].minor.yy53); }
+ case 242: /* cmd ::= DROP FUNCTION exists_opt function_name */
+{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy137, &yymsp[0].minor.yy209); }
break;
- case 246: /* bufsize_opt ::= */
-{ yymsp[1].minor.yy158 = 0; }
+ case 245: /* bufsize_opt ::= */
+{ yymsp[1].minor.yy100 = 0; }
break;
- case 247: /* bufsize_opt ::= BUFSIZE NK_INTEGER */
-{ yymsp[-1].minor.yy158 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
+ case 246: /* bufsize_opt ::= BUFSIZE NK_INTEGER */
+{ yymsp[-1].minor.yy100 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
break;
- case 248: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */
-{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy603, &yymsp[-4].minor.yy53, yymsp[-2].minor.yy636, yymsp[-3].minor.yy636, yymsp[0].minor.yy636); }
+ case 247: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */
+{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy137, &yymsp[-4].minor.yy209, yymsp[-2].minor.yy632, yymsp[-3].minor.yy632, yymsp[0].minor.yy632); }
break;
- case 249: /* cmd ::= DROP STREAM exists_opt stream_name */
-{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy603, &yymsp[0].minor.yy53); }
+ case 248: /* cmd ::= DROP STREAM exists_opt stream_name */
+{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy137, &yymsp[0].minor.yy209); }
break;
- case 251: /* into_opt ::= INTO full_table_name */
- case 374: /* from_clause ::= FROM table_reference_list */ yytestcase(yyruleno==374);
- case 404: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==404);
- case 427: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==427);
-{ yymsp[-1].minor.yy636 = yymsp[0].minor.yy636; }
+ case 250: /* into_opt ::= INTO full_table_name */
+ case 373: /* from_clause ::= FROM table_reference_list */ yytestcase(yyruleno==373);
+ case 403: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==403);
+ case 426: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==426);
+{ yymsp[-1].minor.yy632 = yymsp[0].minor.yy632; }
break;
- case 252: /* stream_options ::= */
-{ yymsp[1].minor.yy636 = createStreamOptions(pCxt); }
+ case 251: /* stream_options ::= */
+{ yymsp[1].minor.yy632 = createStreamOptions(pCxt); }
break;
- case 253: /* stream_options ::= stream_options TRIGGER AT_ONCE */
-{ ((SStreamOptions*)yymsp[-2].minor.yy636)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy636 = yymsp[-2].minor.yy636; }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ case 252: /* stream_options ::= stream_options TRIGGER AT_ONCE */
+{ ((SStreamOptions*)yymsp[-2].minor.yy632)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy632 = yymsp[-2].minor.yy632; }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 254: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
-{ ((SStreamOptions*)yymsp[-2].minor.yy636)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy636 = yymsp[-2].minor.yy636; }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ case 253: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
+{ ((SStreamOptions*)yymsp[-2].minor.yy632)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy632 = yymsp[-2].minor.yy632; }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 255: /* stream_options ::= stream_options WATERMARK duration_literal */
-{ ((SStreamOptions*)yymsp[-2].minor.yy636)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy636); yylhsminor.yy636 = yymsp[-2].minor.yy636; }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ case 254: /* stream_options ::= stream_options WATERMARK duration_literal */
+{ ((SStreamOptions*)yymsp[-2].minor.yy632)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy632); yylhsminor.yy632 = yymsp[-2].minor.yy632; }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 256: /* cmd ::= KILL CONNECTION NK_INTEGER */
+ case 255: /* cmd ::= KILL CONNECTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); }
break;
- case 257: /* cmd ::= KILL QUERY NK_INTEGER */
+ case 256: /* cmd ::= KILL QUERY NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_QUERY_STMT, &yymsp[0].minor.yy0); }
break;
- case 258: /* cmd ::= KILL TRANSACTION NK_INTEGER */
+ case 257: /* cmd ::= KILL TRANSACTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); }
break;
- case 259: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
+ case 258: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
{ pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 260: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
-{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy236); }
+ case 259: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy424); }
break;
- case 261: /* cmd ::= SPLIT VGROUP NK_INTEGER */
+ case 260: /* cmd ::= SPLIT VGROUP NK_INTEGER */
{ pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); }
break;
- case 262: /* dnode_list ::= DNODE NK_INTEGER */
-{ yymsp[-1].minor.yy236 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- break;
- case 264: /* cmd ::= SYNCDB db_name REPLICA */
-{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy53); }
- break;
- case 266: /* literal ::= NK_INTEGER */
-{ yylhsminor.yy636 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy636 = yylhsminor.yy636;
- break;
- case 267: /* literal ::= NK_FLOAT */
-{ yylhsminor.yy636 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy636 = yylhsminor.yy636;
- break;
- case 268: /* literal ::= NK_STRING */
-{ yylhsminor.yy636 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy636 = yylhsminor.yy636;
- break;
- case 269: /* literal ::= NK_BOOL */
-{ yylhsminor.yy636 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy636 = yylhsminor.yy636;
- break;
- case 270: /* literal ::= TIMESTAMP NK_STRING */
-{ yylhsminor.yy636 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
- yymsp[-1].minor.yy636 = yylhsminor.yy636;
- break;
- case 271: /* literal ::= duration_literal */
- case 281: /* signed_literal ::= signed */ yytestcase(yyruleno==281);
- case 301: /* expression ::= literal */ yytestcase(yyruleno==301);
- case 302: /* expression ::= pseudo_column */ yytestcase(yyruleno==302);
- case 303: /* expression ::= column_reference */ yytestcase(yyruleno==303);
- case 304: /* expression ::= function_expression */ yytestcase(yyruleno==304);
- case 305: /* expression ::= subquery */ yytestcase(yyruleno==305);
- case 330: /* function_expression ::= literal_func */ yytestcase(yyruleno==330);
- case 366: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==366);
- case 370: /* boolean_primary ::= predicate */ yytestcase(yyruleno==370);
- case 372: /* common_expression ::= expression */ yytestcase(yyruleno==372);
- case 373: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==373);
- case 375: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==375);
- case 377: /* table_reference ::= table_primary */ yytestcase(yyruleno==377);
- case 378: /* table_reference ::= joined_table */ yytestcase(yyruleno==378);
- case 382: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==382);
- case 429: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==429);
- case 432: /* query_primary ::= query_specification */ yytestcase(yyruleno==432);
-{ yylhsminor.yy636 = yymsp[0].minor.yy636; }
- yymsp[0].minor.yy636 = yylhsminor.yy636;
- break;
- case 272: /* literal ::= NULL */
-{ yylhsminor.yy636 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy636 = yylhsminor.yy636;
- break;
- case 273: /* literal ::= NK_QUESTION */
-{ yylhsminor.yy636 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy636 = yylhsminor.yy636;
- break;
- case 274: /* duration_literal ::= NK_VARIABLE */
-{ yylhsminor.yy636 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy636 = yylhsminor.yy636;
- break;
- case 275: /* signed ::= NK_INTEGER */
-{ yylhsminor.yy636 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy636 = yylhsminor.yy636;
- break;
- case 276: /* signed ::= NK_PLUS NK_INTEGER */
-{ yymsp[-1].minor.yy636 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); }
- break;
- case 277: /* signed ::= NK_MINUS NK_INTEGER */
+ case 261: /* dnode_list ::= DNODE NK_INTEGER */
+{ yymsp[-1].minor.yy424 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ break;
+ case 263: /* cmd ::= SYNCDB db_name REPLICA */
+{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy209); }
+ break;
+ case 265: /* literal ::= NK_INTEGER */
+{ yylhsminor.yy632 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy632 = yylhsminor.yy632;
+ break;
+ case 266: /* literal ::= NK_FLOAT */
+{ yylhsminor.yy632 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy632 = yylhsminor.yy632;
+ break;
+ case 267: /* literal ::= NK_STRING */
+{ yylhsminor.yy632 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy632 = yylhsminor.yy632;
+ break;
+ case 268: /* literal ::= NK_BOOL */
+{ yylhsminor.yy632 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy632 = yylhsminor.yy632;
+ break;
+ case 269: /* literal ::= TIMESTAMP NK_STRING */
+{ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
+ yymsp[-1].minor.yy632 = yylhsminor.yy632;
+ break;
+ case 270: /* literal ::= duration_literal */
+ case 280: /* signed_literal ::= signed */ yytestcase(yyruleno==280);
+ case 300: /* expression ::= literal */ yytestcase(yyruleno==300);
+ case 301: /* expression ::= pseudo_column */ yytestcase(yyruleno==301);
+ case 302: /* expression ::= column_reference */ yytestcase(yyruleno==302);
+ case 303: /* expression ::= function_expression */ yytestcase(yyruleno==303);
+ case 304: /* expression ::= subquery */ yytestcase(yyruleno==304);
+ case 329: /* function_expression ::= literal_func */ yytestcase(yyruleno==329);
+ case 365: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==365);
+ case 369: /* boolean_primary ::= predicate */ yytestcase(yyruleno==369);
+ case 371: /* common_expression ::= expression */ yytestcase(yyruleno==371);
+ case 372: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==372);
+ case 374: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==374);
+ case 376: /* table_reference ::= table_primary */ yytestcase(yyruleno==376);
+ case 377: /* table_reference ::= joined_table */ yytestcase(yyruleno==377);
+ case 381: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==381);
+ case 428: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==428);
+ case 431: /* query_primary ::= query_specification */ yytestcase(yyruleno==431);
+{ yylhsminor.yy632 = yymsp[0].minor.yy632; }
+ yymsp[0].minor.yy632 = yylhsminor.yy632;
+ break;
+ case 271: /* literal ::= NULL */
+{ yylhsminor.yy632 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy632 = yylhsminor.yy632;
+ break;
+ case 272: /* literal ::= NK_QUESTION */
+{ yylhsminor.yy632 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy632 = yylhsminor.yy632;
+ break;
+ case 273: /* duration_literal ::= NK_VARIABLE */
+{ yylhsminor.yy632 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy632 = yylhsminor.yy632;
+ break;
+ case 274: /* signed ::= NK_INTEGER */
+{ yylhsminor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy632 = yylhsminor.yy632;
+ break;
+ case 275: /* signed ::= NK_PLUS NK_INTEGER */
+{ yymsp[-1].minor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); }
+ break;
+ case 276: /* 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.yy636 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
+ yylhsminor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
}
- yymsp[-1].minor.yy636 = yylhsminor.yy636;
+ yymsp[-1].minor.yy632 = yylhsminor.yy632;
break;
- case 278: /* signed ::= NK_FLOAT */
-{ yylhsminor.yy636 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy636 = yylhsminor.yy636;
+ case 277: /* signed ::= NK_FLOAT */
+{ yylhsminor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy632 = yylhsminor.yy632;
break;
- case 279: /* signed ::= NK_PLUS NK_FLOAT */
-{ yymsp[-1].minor.yy636 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ case 278: /* signed ::= NK_PLUS NK_FLOAT */
+{ yymsp[-1].minor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
break;
- case 280: /* signed ::= NK_MINUS NK_FLOAT */
+ case 279: /* 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.yy636 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
+ yylhsminor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
}
- yymsp[-1].minor.yy636 = yylhsminor.yy636;
+ yymsp[-1].minor.yy632 = yylhsminor.yy632;
break;
- case 282: /* signed_literal ::= NK_STRING */
-{ yylhsminor.yy636 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy636 = yylhsminor.yy636;
+ case 281: /* signed_literal ::= NK_STRING */
+{ yylhsminor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy632 = yylhsminor.yy632;
break;
- case 283: /* signed_literal ::= NK_BOOL */
-{ yylhsminor.yy636 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy636 = yylhsminor.yy636;
+ case 282: /* signed_literal ::= NK_BOOL */
+{ yylhsminor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy632 = yylhsminor.yy632;
break;
- case 284: /* signed_literal ::= TIMESTAMP NK_STRING */
-{ yymsp[-1].minor.yy636 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
+ case 283: /* signed_literal ::= TIMESTAMP NK_STRING */
+{ yymsp[-1].minor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
break;
- case 285: /* signed_literal ::= duration_literal */
- case 287: /* signed_literal ::= literal_func */ yytestcase(yyruleno==287);
- case 344: /* star_func_para ::= expression */ yytestcase(yyruleno==344);
- case 399: /* select_item ::= common_expression */ yytestcase(yyruleno==399);
- case 445: /* search_condition ::= common_expression */ yytestcase(yyruleno==445);
-{ yylhsminor.yy636 = releaseRawExprNode(pCxt, yymsp[0].minor.yy636); }
- yymsp[0].minor.yy636 = yylhsminor.yy636;
+ case 284: /* signed_literal ::= duration_literal */
+ case 286: /* signed_literal ::= literal_func */ yytestcase(yyruleno==286);
+ case 343: /* star_func_para ::= expression */ yytestcase(yyruleno==343);
+ case 398: /* select_item ::= common_expression */ yytestcase(yyruleno==398);
+ case 444: /* search_condition ::= common_expression */ yytestcase(yyruleno==444);
+{ yylhsminor.yy632 = releaseRawExprNode(pCxt, yymsp[0].minor.yy632); }
+ yymsp[0].minor.yy632 = yylhsminor.yy632;
break;
- case 286: /* signed_literal ::= NULL */
-{ yylhsminor.yy636 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy636 = yylhsminor.yy636;
+ case 285: /* signed_literal ::= NULL */
+{ yylhsminor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy632 = yylhsminor.yy632;
break;
- case 306: /* expression ::= NK_LP expression NK_RP */
- case 371: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==371);
-{ yylhsminor.yy636 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy636)); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ case 305: /* expression ::= NK_LP expression NK_RP */
+ case 370: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==370);
+{ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy632)); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 307: /* expression ::= NK_PLUS expression */
+ case 306: /* expression ::= NK_PLUS expression */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy636);
- yylhsminor.yy636 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy636));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632);
+ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy632));
}
- yymsp[-1].minor.yy636 = yylhsminor.yy636;
+ yymsp[-1].minor.yy632 = yylhsminor.yy632;
break;
- case 308: /* expression ::= NK_MINUS expression */
+ case 307: /* expression ::= NK_MINUS expression */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy636);
- yylhsminor.yy636 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy636), NULL));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632);
+ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy632), NULL));
}
- yymsp[-1].minor.yy636 = yylhsminor.yy636;
+ yymsp[-1].minor.yy632 = yylhsminor.yy632;
break;
- case 309: /* expression ::= expression NK_PLUS expression */
+ case 308: /* expression ::= expression NK_PLUS expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy636);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy636);
- yylhsminor.yy636 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy636), releaseRawExprNode(pCxt, yymsp[0].minor.yy636)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy632);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632);
+ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), releaseRawExprNode(pCxt, yymsp[0].minor.yy632)));
}
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 310: /* expression ::= expression NK_MINUS expression */
+ case 309: /* expression ::= expression NK_MINUS expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy636);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy636);
- yylhsminor.yy636 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy636), releaseRawExprNode(pCxt, yymsp[0].minor.yy636)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy632);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632);
+ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), releaseRawExprNode(pCxt, yymsp[0].minor.yy632)));
}
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 311: /* expression ::= expression NK_STAR expression */
+ case 310: /* expression ::= expression NK_STAR expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy636);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy636);
- yylhsminor.yy636 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy636), releaseRawExprNode(pCxt, yymsp[0].minor.yy636)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy632);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632);
+ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), releaseRawExprNode(pCxt, yymsp[0].minor.yy632)));
}
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 312: /* expression ::= expression NK_SLASH expression */
+ case 311: /* expression ::= expression NK_SLASH expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy636);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy636);
- yylhsminor.yy636 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy636), releaseRawExprNode(pCxt, yymsp[0].minor.yy636)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy632);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632);
+ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), releaseRawExprNode(pCxt, yymsp[0].minor.yy632)));
}
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 313: /* expression ::= expression NK_REM expression */
+ case 312: /* expression ::= expression NK_REM expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy636);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy636);
- yylhsminor.yy636 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy636), releaseRawExprNode(pCxt, yymsp[0].minor.yy636)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy632);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632);
+ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), releaseRawExprNode(pCxt, yymsp[0].minor.yy632)));
}
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 314: /* expression ::= column_reference NK_ARROW NK_STRING */
+ case 313: /* expression ::= column_reference NK_ARROW NK_STRING */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy636);
- yylhsminor.yy636 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy636), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy632);
+ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
}
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
- break;
- case 315: /* expression_list ::= expression */
-{ yylhsminor.yy236 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy636)); }
- yymsp[0].minor.yy236 = yylhsminor.yy236;
- break;
- case 316: /* expression_list ::= expression_list NK_COMMA expression */
-{ yylhsminor.yy236 = addNodeToList(pCxt, yymsp[-2].minor.yy236, releaseRawExprNode(pCxt, yymsp[0].minor.yy636)); }
- yymsp[-2].minor.yy236 = yylhsminor.yy236;
- break;
- case 317: /* column_reference ::= column_name */
-{ yylhsminor.yy636 = createRawExprNode(pCxt, &yymsp[0].minor.yy53, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy53)); }
- yymsp[0].minor.yy636 = yylhsminor.yy636;
- break;
- case 318: /* column_reference ::= table_name NK_DOT column_name */
-{ yylhsminor.yy636 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy53, &yymsp[0].minor.yy53, createColumnNode(pCxt, &yymsp[-2].minor.yy53, &yymsp[0].minor.yy53)); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
- break;
- case 319: /* pseudo_column ::= ROWTS */
- case 320: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==320);
- case 322: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==322);
- case 323: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==323);
- case 324: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==324);
- case 325: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==325);
- case 326: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==326);
- case 332: /* literal_func ::= NOW */ yytestcase(yyruleno==332);
-{ yylhsminor.yy636 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
- yymsp[0].minor.yy636 = yylhsminor.yy636;
- break;
- case 321: /* pseudo_column ::= table_name NK_DOT TBNAME */
-{ yylhsminor.yy636 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy53, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy53)))); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
- break;
- case 327: /* function_expression ::= function_name NK_LP expression_list NK_RP */
- case 328: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==328);
-{ yylhsminor.yy636 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy53, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy53, yymsp[-1].minor.yy236)); }
- yymsp[-3].minor.yy636 = yylhsminor.yy636;
- break;
- case 329: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */
-{ yylhsminor.yy636 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy636), yymsp[-1].minor.yy450)); }
- yymsp[-5].minor.yy636 = yylhsminor.yy636;
- break;
- case 331: /* literal_func ::= noarg_func NK_LP NK_RP */
-{ yylhsminor.yy636 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy53, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy53, NULL)); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
- break;
- case 340: /* star_func_para_list ::= NK_STAR */
-{ yylhsminor.yy236 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy236 = yylhsminor.yy236;
- break;
- case 345: /* star_func_para ::= table_name NK_DOT NK_STAR */
- case 402: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==402);
-{ yylhsminor.yy636 = createColumnNode(pCxt, &yymsp[-2].minor.yy53, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
- break;
- case 346: /* predicate ::= expression compare_op expression */
- case 351: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==351);
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
+ break;
+ case 314: /* expression_list ::= expression */
+{ yylhsminor.yy424 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy632)); }
+ yymsp[0].minor.yy424 = yylhsminor.yy424;
+ break;
+ case 315: /* expression_list ::= expression_list NK_COMMA expression */
+{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, releaseRawExprNode(pCxt, yymsp[0].minor.yy632)); }
+ yymsp[-2].minor.yy424 = yylhsminor.yy424;
+ break;
+ case 316: /* column_reference ::= column_name */
+{ yylhsminor.yy632 = createRawExprNode(pCxt, &yymsp[0].minor.yy209, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy209)); }
+ yymsp[0].minor.yy632 = yylhsminor.yy632;
+ break;
+ case 317: /* column_reference ::= table_name NK_DOT column_name */
+{ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209, createColumnNode(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209)); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
+ break;
+ case 318: /* pseudo_column ::= ROWTS */
+ case 319: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==319);
+ case 321: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==321);
+ case 322: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==322);
+ case 323: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==323);
+ case 324: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==324);
+ case 325: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==325);
+ case 331: /* literal_func ::= NOW */ yytestcase(yyruleno==331);
+{ yylhsminor.yy632 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
+ yymsp[0].minor.yy632 = yylhsminor.yy632;
+ break;
+ case 320: /* pseudo_column ::= table_name NK_DOT TBNAME */
+{ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy209)))); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
+ break;
+ case 326: /* function_expression ::= function_name NK_LP expression_list NK_RP */
+ case 327: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==327);
+{ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy209, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy209, yymsp[-1].minor.yy424)); }
+ yymsp[-3].minor.yy632 = yylhsminor.yy632;
+ break;
+ case 328: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */
+{ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy632), yymsp[-1].minor.yy304)); }
+ yymsp[-5].minor.yy632 = yylhsminor.yy632;
+ break;
+ case 330: /* literal_func ::= noarg_func NK_LP NK_RP */
+{ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy209, NULL)); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
+ break;
+ case 339: /* star_func_para_list ::= NK_STAR */
+{ yylhsminor.yy424 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy424 = yylhsminor.yy424;
+ break;
+ case 344: /* star_func_para ::= table_name NK_DOT NK_STAR */
+ case 401: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==401);
+{ yylhsminor.yy632 = createColumnNode(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
+ break;
+ case 345: /* predicate ::= expression compare_op expression */
+ case 350: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==350);
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy636);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy636);
- yylhsminor.yy636 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy136, releaseRawExprNode(pCxt, yymsp[-2].minor.yy636), releaseRawExprNode(pCxt, yymsp[0].minor.yy636)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy632);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632);
+ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy380, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), releaseRawExprNode(pCxt, yymsp[0].minor.yy632)));
}
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 347: /* predicate ::= expression BETWEEN expression AND expression */
+ case 346: /* predicate ::= expression BETWEEN expression AND expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy636);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy636);
- yylhsminor.yy636 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy636), releaseRawExprNode(pCxt, yymsp[-2].minor.yy636), releaseRawExprNode(pCxt, yymsp[0].minor.yy636)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy632);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632);
+ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy632), releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), releaseRawExprNode(pCxt, yymsp[0].minor.yy632)));
}
- yymsp[-4].minor.yy636 = yylhsminor.yy636;
+ yymsp[-4].minor.yy632 = yylhsminor.yy632;
break;
- case 348: /* predicate ::= expression NOT BETWEEN expression AND expression */
+ case 347: /* predicate ::= expression NOT BETWEEN expression AND expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy636);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy636);
- yylhsminor.yy636 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy636), releaseRawExprNode(pCxt, yymsp[-2].minor.yy636), releaseRawExprNode(pCxt, yymsp[0].minor.yy636)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy632);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632);
+ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy632), releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), releaseRawExprNode(pCxt, yymsp[0].minor.yy632)));
}
- yymsp[-5].minor.yy636 = yylhsminor.yy636;
+ yymsp[-5].minor.yy632 = yylhsminor.yy632;
break;
- case 349: /* predicate ::= expression IS NULL */
+ case 348: /* predicate ::= expression IS NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy636);
- yylhsminor.yy636 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy636), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy632);
+ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), NULL));
}
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 350: /* predicate ::= expression IS NOT NULL */
+ case 349: /* predicate ::= expression IS NOT NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy636);
- yylhsminor.yy636 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy636), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy632);
+ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy632), NULL));
}
- yymsp[-3].minor.yy636 = yylhsminor.yy636;
+ yymsp[-3].minor.yy632 = yylhsminor.yy632;
break;
- case 352: /* compare_op ::= NK_LT */
-{ yymsp[0].minor.yy136 = OP_TYPE_LOWER_THAN; }
+ case 351: /* compare_op ::= NK_LT */
+{ yymsp[0].minor.yy380 = OP_TYPE_LOWER_THAN; }
break;
- case 353: /* compare_op ::= NK_GT */
-{ yymsp[0].minor.yy136 = OP_TYPE_GREATER_THAN; }
+ case 352: /* compare_op ::= NK_GT */
+{ yymsp[0].minor.yy380 = OP_TYPE_GREATER_THAN; }
break;
- case 354: /* compare_op ::= NK_LE */
-{ yymsp[0].minor.yy136 = OP_TYPE_LOWER_EQUAL; }
+ case 353: /* compare_op ::= NK_LE */
+{ yymsp[0].minor.yy380 = OP_TYPE_LOWER_EQUAL; }
break;
- case 355: /* compare_op ::= NK_GE */
-{ yymsp[0].minor.yy136 = OP_TYPE_GREATER_EQUAL; }
+ case 354: /* compare_op ::= NK_GE */
+{ yymsp[0].minor.yy380 = OP_TYPE_GREATER_EQUAL; }
break;
- case 356: /* compare_op ::= NK_NE */
-{ yymsp[0].minor.yy136 = OP_TYPE_NOT_EQUAL; }
+ case 355: /* compare_op ::= NK_NE */
+{ yymsp[0].minor.yy380 = OP_TYPE_NOT_EQUAL; }
break;
- case 357: /* compare_op ::= NK_EQ */
-{ yymsp[0].minor.yy136 = OP_TYPE_EQUAL; }
+ case 356: /* compare_op ::= NK_EQ */
+{ yymsp[0].minor.yy380 = OP_TYPE_EQUAL; }
break;
- case 358: /* compare_op ::= LIKE */
-{ yymsp[0].minor.yy136 = OP_TYPE_LIKE; }
+ case 357: /* compare_op ::= LIKE */
+{ yymsp[0].minor.yy380 = OP_TYPE_LIKE; }
break;
- case 359: /* compare_op ::= NOT LIKE */
-{ yymsp[-1].minor.yy136 = OP_TYPE_NOT_LIKE; }
+ case 358: /* compare_op ::= NOT LIKE */
+{ yymsp[-1].minor.yy380 = OP_TYPE_NOT_LIKE; }
break;
- case 360: /* compare_op ::= MATCH */
-{ yymsp[0].minor.yy136 = OP_TYPE_MATCH; }
+ case 359: /* compare_op ::= MATCH */
+{ yymsp[0].minor.yy380 = OP_TYPE_MATCH; }
break;
- case 361: /* compare_op ::= NMATCH */
-{ yymsp[0].minor.yy136 = OP_TYPE_NMATCH; }
+ case 360: /* compare_op ::= NMATCH */
+{ yymsp[0].minor.yy380 = OP_TYPE_NMATCH; }
break;
- case 362: /* compare_op ::= CONTAINS */
-{ yymsp[0].minor.yy136 = OP_TYPE_JSON_CONTAINS; }
+ case 361: /* compare_op ::= CONTAINS */
+{ yymsp[0].minor.yy380 = OP_TYPE_JSON_CONTAINS; }
break;
- case 363: /* in_op ::= IN */
-{ yymsp[0].minor.yy136 = OP_TYPE_IN; }
+ case 362: /* in_op ::= IN */
+{ yymsp[0].minor.yy380 = OP_TYPE_IN; }
break;
- case 364: /* in_op ::= NOT IN */
-{ yymsp[-1].minor.yy136 = OP_TYPE_NOT_IN; }
+ case 363: /* in_op ::= NOT IN */
+{ yymsp[-1].minor.yy380 = OP_TYPE_NOT_IN; }
break;
- case 365: /* in_predicate_value ::= NK_LP expression_list NK_RP */
-{ yylhsminor.yy636 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy236)); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ case 364: /* in_predicate_value ::= NK_LP expression_list NK_RP */
+{ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy424)); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 367: /* boolean_value_expression ::= NOT boolean_primary */
+ case 366: /* boolean_value_expression ::= NOT boolean_primary */
{
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy636);
- yylhsminor.yy636 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy636), NULL));
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632);
+ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy632), NULL));
}
- yymsp[-1].minor.yy636 = yylhsminor.yy636;
+ yymsp[-1].minor.yy632 = yylhsminor.yy632;
break;
- case 368: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ case 367: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy636);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy636);
- yylhsminor.yy636 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy636), releaseRawExprNode(pCxt, yymsp[0].minor.yy636)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy632);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632);
+ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), releaseRawExprNode(pCxt, yymsp[0].minor.yy632)));
}
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 369: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ case 368: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy636);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy636);
- yylhsminor.yy636 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy636), releaseRawExprNode(pCxt, yymsp[0].minor.yy636)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy632);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632);
+ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), releaseRawExprNode(pCxt, yymsp[0].minor.yy632)));
}
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 376: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
-{ yylhsminor.yy636 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy636, yymsp[0].minor.yy636, NULL); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ case 375: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
+{ yylhsminor.yy632 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy632, yymsp[0].minor.yy632, NULL); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 379: /* table_primary ::= table_name alias_opt */
-{ yylhsminor.yy636 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy53, &yymsp[0].minor.yy53); }
- yymsp[-1].minor.yy636 = yylhsminor.yy636;
+ case 378: /* table_primary ::= table_name alias_opt */
+{ yylhsminor.yy632 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy209, &yymsp[0].minor.yy209); }
+ yymsp[-1].minor.yy632 = yylhsminor.yy632;
break;
- case 380: /* table_primary ::= db_name NK_DOT table_name alias_opt */
-{ yylhsminor.yy636 = createRealTableNode(pCxt, &yymsp[-3].minor.yy53, &yymsp[-1].minor.yy53, &yymsp[0].minor.yy53); }
- yymsp[-3].minor.yy636 = yylhsminor.yy636;
+ case 379: /* table_primary ::= db_name NK_DOT table_name alias_opt */
+{ yylhsminor.yy632 = createRealTableNode(pCxt, &yymsp[-3].minor.yy209, &yymsp[-1].minor.yy209, &yymsp[0].minor.yy209); }
+ yymsp[-3].minor.yy632 = yylhsminor.yy632;
break;
- case 381: /* table_primary ::= subquery alias_opt */
-{ yylhsminor.yy636 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy636), &yymsp[0].minor.yy53); }
- yymsp[-1].minor.yy636 = yylhsminor.yy636;
+ case 380: /* table_primary ::= subquery alias_opt */
+{ yylhsminor.yy632 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy632), &yymsp[0].minor.yy209); }
+ yymsp[-1].minor.yy632 = yylhsminor.yy632;
break;
- case 383: /* alias_opt ::= */
-{ yymsp[1].minor.yy53 = nil_token; }
+ case 382: /* alias_opt ::= */
+{ yymsp[1].minor.yy209 = nil_token; }
break;
- case 384: /* alias_opt ::= table_alias */
-{ yylhsminor.yy53 = yymsp[0].minor.yy53; }
- yymsp[0].minor.yy53 = yylhsminor.yy53;
+ case 383: /* alias_opt ::= table_alias */
+{ yylhsminor.yy209 = yymsp[0].minor.yy209; }
+ yymsp[0].minor.yy209 = yylhsminor.yy209;
break;
- case 385: /* alias_opt ::= AS table_alias */
-{ yymsp[-1].minor.yy53 = yymsp[0].minor.yy53; }
+ case 384: /* alias_opt ::= AS table_alias */
+{ yymsp[-1].minor.yy209 = yymsp[0].minor.yy209; }
break;
- case 386: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- case 387: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==387);
-{ yymsp[-2].minor.yy636 = yymsp[-1].minor.yy636; }
+ case 385: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ case 386: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==386);
+{ yymsp[-2].minor.yy632 = yymsp[-1].minor.yy632; }
break;
- case 388: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
-{ yylhsminor.yy636 = createJoinTableNode(pCxt, yymsp[-4].minor.yy342, yymsp[-5].minor.yy636, yymsp[-2].minor.yy636, yymsp[0].minor.yy636); }
- yymsp[-5].minor.yy636 = yylhsminor.yy636;
+ case 387: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */
+{ yylhsminor.yy632 = createJoinTableNode(pCxt, yymsp[-4].minor.yy612, yymsp[-5].minor.yy632, yymsp[-2].minor.yy632, yymsp[0].minor.yy632); }
+ yymsp[-5].minor.yy632 = yylhsminor.yy632;
break;
- case 389: /* join_type ::= */
-{ yymsp[1].minor.yy342 = JOIN_TYPE_INNER; }
+ case 388: /* join_type ::= */
+{ yymsp[1].minor.yy612 = JOIN_TYPE_INNER; }
break;
- case 390: /* join_type ::= INNER */
-{ yymsp[0].minor.yy342 = JOIN_TYPE_INNER; }
+ case 389: /* join_type ::= INNER */
+{ yymsp[0].minor.yy612 = JOIN_TYPE_INNER; }
break;
- case 391: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
+ case 390: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
{
- yymsp[-8].minor.yy636 = createSelectStmt(pCxt, yymsp[-7].minor.yy603, yymsp[-6].minor.yy236, yymsp[-5].minor.yy636);
- yymsp[-8].minor.yy636 = addWhereClause(pCxt, yymsp[-8].minor.yy636, yymsp[-4].minor.yy636);
- yymsp[-8].minor.yy636 = addPartitionByClause(pCxt, yymsp[-8].minor.yy636, yymsp[-3].minor.yy236);
- yymsp[-8].minor.yy636 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy636, yymsp[-2].minor.yy636);
- yymsp[-8].minor.yy636 = addGroupByClause(pCxt, yymsp[-8].minor.yy636, yymsp[-1].minor.yy236);
- yymsp[-8].minor.yy636 = addHavingClause(pCxt, yymsp[-8].minor.yy636, yymsp[0].minor.yy636);
+ yymsp[-8].minor.yy632 = createSelectStmt(pCxt, yymsp[-7].minor.yy137, yymsp[-6].minor.yy424, yymsp[-5].minor.yy632);
+ yymsp[-8].minor.yy632 = addWhereClause(pCxt, yymsp[-8].minor.yy632, yymsp[-4].minor.yy632);
+ yymsp[-8].minor.yy632 = addPartitionByClause(pCxt, yymsp[-8].minor.yy632, yymsp[-3].minor.yy424);
+ yymsp[-8].minor.yy632 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy632, yymsp[-2].minor.yy632);
+ yymsp[-8].minor.yy632 = addGroupByClause(pCxt, yymsp[-8].minor.yy632, yymsp[-1].minor.yy424);
+ yymsp[-8].minor.yy632 = addHavingClause(pCxt, yymsp[-8].minor.yy632, yymsp[0].minor.yy632);
}
break;
- case 394: /* set_quantifier_opt ::= ALL */
-{ yymsp[0].minor.yy603 = false; }
+ case 393: /* set_quantifier_opt ::= ALL */
+{ yymsp[0].minor.yy137 = false; }
break;
- case 395: /* select_list ::= NK_STAR */
-{ yymsp[0].minor.yy236 = NULL; }
+ case 394: /* select_list ::= NK_STAR */
+{ yymsp[0].minor.yy424 = NULL; }
break;
- case 400: /* select_item ::= common_expression column_alias */
-{ yylhsminor.yy636 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy636), &yymsp[0].minor.yy53); }
- yymsp[-1].minor.yy636 = yylhsminor.yy636;
+ case 399: /* select_item ::= common_expression column_alias */
+{ yylhsminor.yy632 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy632), &yymsp[0].minor.yy209); }
+ yymsp[-1].minor.yy632 = yylhsminor.yy632;
break;
- case 401: /* select_item ::= common_expression AS column_alias */
-{ yylhsminor.yy636 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy636), &yymsp[0].minor.yy53); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ case 400: /* select_item ::= common_expression AS column_alias */
+{ yylhsminor.yy632 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), &yymsp[0].minor.yy209); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 406: /* partition_by_clause_opt ::= PARTITION BY expression_list */
- case 423: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==423);
- case 435: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==435);
-{ yymsp[-2].minor.yy236 = yymsp[0].minor.yy236; }
+ case 405: /* partition_by_clause_opt ::= PARTITION BY expression_list */
+ case 422: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==422);
+ case 434: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==434);
+{ yymsp[-2].minor.yy424 = yymsp[0].minor.yy424; }
break;
- case 408: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
-{ yymsp[-5].minor.yy636 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy636), releaseRawExprNode(pCxt, yymsp[-1].minor.yy636)); }
+ case 407: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
+{ yymsp[-5].minor.yy632 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy632), releaseRawExprNode(pCxt, yymsp[-1].minor.yy632)); }
break;
- case 409: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */
-{ yymsp[-3].minor.yy636 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy636)); }
+ case 408: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */
+{ yymsp[-3].minor.yy632 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy632)); }
break;
- case 410: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
-{ yymsp[-5].minor.yy636 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy636), NULL, yymsp[-1].minor.yy636, yymsp[0].minor.yy636); }
+ case 409: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-5].minor.yy632 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy632), NULL, yymsp[-1].minor.yy632, yymsp[0].minor.yy632); }
break;
- case 411: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
-{ yymsp[-7].minor.yy636 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy636), releaseRawExprNode(pCxt, yymsp[-3].minor.yy636), yymsp[-1].minor.yy636, yymsp[0].minor.yy636); }
+ case 410: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-7].minor.yy632 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy632), releaseRawExprNode(pCxt, yymsp[-3].minor.yy632), yymsp[-1].minor.yy632, yymsp[0].minor.yy632); }
break;
- case 413: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
-{ yymsp[-3].minor.yy636 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy636); }
+ case 412: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */
+{ yymsp[-3].minor.yy632 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy632); }
break;
- case 415: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
-{ yymsp[-3].minor.yy636 = createFillNode(pCxt, yymsp[-1].minor.yy18, NULL); }
+ case 414: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
+{ yymsp[-3].minor.yy632 = createFillNode(pCxt, yymsp[-1].minor.yy54, NULL); }
break;
- case 416: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
-{ yymsp[-5].minor.yy636 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy236)); }
+ case 415: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */
+{ yymsp[-5].minor.yy632 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy424)); }
break;
- case 417: /* fill_mode ::= NONE */
-{ yymsp[0].minor.yy18 = FILL_MODE_NONE; }
+ case 416: /* fill_mode ::= NONE */
+{ yymsp[0].minor.yy54 = FILL_MODE_NONE; }
break;
- case 418: /* fill_mode ::= PREV */
-{ yymsp[0].minor.yy18 = FILL_MODE_PREV; }
+ case 417: /* fill_mode ::= PREV */
+{ yymsp[0].minor.yy54 = FILL_MODE_PREV; }
break;
- case 419: /* fill_mode ::= NULL */
-{ yymsp[0].minor.yy18 = FILL_MODE_NULL; }
+ case 418: /* fill_mode ::= NULL */
+{ yymsp[0].minor.yy54 = FILL_MODE_NULL; }
break;
- case 420: /* fill_mode ::= LINEAR */
-{ yymsp[0].minor.yy18 = FILL_MODE_LINEAR; }
+ case 419: /* fill_mode ::= LINEAR */
+{ yymsp[0].minor.yy54 = FILL_MODE_LINEAR; }
break;
- case 421: /* fill_mode ::= NEXT */
-{ yymsp[0].minor.yy18 = FILL_MODE_NEXT; }
+ case 420: /* fill_mode ::= NEXT */
+{ yymsp[0].minor.yy54 = FILL_MODE_NEXT; }
break;
- case 424: /* group_by_list ::= expression */
-{ yylhsminor.yy236 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy636))); }
- yymsp[0].minor.yy236 = yylhsminor.yy236;
+ case 423: /* group_by_list ::= expression */
+{ yylhsminor.yy424 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy632))); }
+ yymsp[0].minor.yy424 = yylhsminor.yy424;
break;
- case 425: /* group_by_list ::= group_by_list NK_COMMA expression */
-{ yylhsminor.yy236 = addNodeToList(pCxt, yymsp[-2].minor.yy236, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy636))); }
- yymsp[-2].minor.yy236 = yylhsminor.yy236;
+ case 424: /* group_by_list ::= group_by_list NK_COMMA expression */
+{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy632))); }
+ yymsp[-2].minor.yy424 = yylhsminor.yy424;
break;
- case 428: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ case 427: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
{
- yylhsminor.yy636 = addOrderByClause(pCxt, yymsp[-3].minor.yy636, yymsp[-2].minor.yy236);
- yylhsminor.yy636 = addSlimitClause(pCxt, yylhsminor.yy636, yymsp[-1].minor.yy636);
- yylhsminor.yy636 = addLimitClause(pCxt, yylhsminor.yy636, yymsp[0].minor.yy636);
+ yylhsminor.yy632 = addOrderByClause(pCxt, yymsp[-3].minor.yy632, yymsp[-2].minor.yy424);
+ yylhsminor.yy632 = addSlimitClause(pCxt, yylhsminor.yy632, yymsp[-1].minor.yy632);
+ yylhsminor.yy632 = addLimitClause(pCxt, yylhsminor.yy632, yymsp[0].minor.yy632);
}
- yymsp[-3].minor.yy636 = yylhsminor.yy636;
+ yymsp[-3].minor.yy632 = yylhsminor.yy632;
break;
- case 430: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */
-{ yylhsminor.yy636 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy636, yymsp[0].minor.yy636); }
- yymsp[-3].minor.yy636 = yylhsminor.yy636;
+ case 429: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */
+{ yylhsminor.yy632 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy632, yymsp[0].minor.yy632); }
+ yymsp[-3].minor.yy632 = yylhsminor.yy632;
break;
- case 431: /* query_expression_body ::= query_expression_body UNION query_expression_body */
-{ yylhsminor.yy636 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy636, yymsp[0].minor.yy636); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ case 430: /* query_expression_body ::= query_expression_body UNION query_expression_body */
+{ yylhsminor.yy632 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy632, yymsp[0].minor.yy632); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 433: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */
-{ yymsp[-5].minor.yy636 = yymsp[-4].minor.yy636; }
- yy_destructor(yypParser,353,&yymsp[-3].minor);
- yy_destructor(yypParser,354,&yymsp[-2].minor);
- yy_destructor(yypParser,355,&yymsp[-1].minor);
+ case 432: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */
+{ yymsp[-5].minor.yy632 = yymsp[-4].minor.yy632; }
+ yy_destructor(yypParser,352,&yymsp[-3].minor);
+ yy_destructor(yypParser,353,&yymsp[-2].minor);
+ yy_destructor(yypParser,354,&yymsp[-1].minor);
break;
- case 437: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
- case 441: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==441);
-{ yymsp[-1].minor.yy636 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ case 436: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ case 440: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==440);
+{ yymsp[-1].minor.yy632 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
break;
- case 438: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- case 442: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==442);
-{ yymsp[-3].minor.yy636 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
+ case 437: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ case 441: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==441);
+{ yymsp[-3].minor.yy632 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 439: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- case 443: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==443);
-{ yymsp[-3].minor.yy636 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
+ case 438: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ case 442: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==442);
+{ yymsp[-3].minor.yy632 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
break;
- case 444: /* subquery ::= NK_LP query_expression NK_RP */
-{ yylhsminor.yy636 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy636); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ case 443: /* subquery ::= NK_LP query_expression NK_RP */
+{ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy632); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 448: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */
-{ yylhsminor.yy636 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy636), yymsp[-1].minor.yy430, yymsp[0].minor.yy185); }
- yymsp[-2].minor.yy636 = yylhsminor.yy636;
+ case 447: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */
+{ yylhsminor.yy632 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), yymsp[-1].minor.yy578, yymsp[0].minor.yy217); }
+ yymsp[-2].minor.yy632 = yylhsminor.yy632;
break;
- case 449: /* ordering_specification_opt ::= */
-{ yymsp[1].minor.yy430 = ORDER_ASC; }
+ case 448: /* ordering_specification_opt ::= */
+{ yymsp[1].minor.yy578 = ORDER_ASC; }
break;
- case 450: /* ordering_specification_opt ::= ASC */
-{ yymsp[0].minor.yy430 = ORDER_ASC; }
+ case 449: /* ordering_specification_opt ::= ASC */
+{ yymsp[0].minor.yy578 = ORDER_ASC; }
break;
- case 451: /* ordering_specification_opt ::= DESC */
-{ yymsp[0].minor.yy430 = ORDER_DESC; }
+ case 450: /* ordering_specification_opt ::= DESC */
+{ yymsp[0].minor.yy578 = ORDER_DESC; }
break;
- case 452: /* null_ordering_opt ::= */
-{ yymsp[1].minor.yy185 = NULL_ORDER_DEFAULT; }
+ case 451: /* null_ordering_opt ::= */
+{ yymsp[1].minor.yy217 = NULL_ORDER_DEFAULT; }
break;
- case 453: /* null_ordering_opt ::= NULLS FIRST */
-{ yymsp[-1].minor.yy185 = NULL_ORDER_FIRST; }
+ case 452: /* null_ordering_opt ::= NULLS FIRST */
+{ yymsp[-1].minor.yy217 = NULL_ORDER_FIRST; }
break;
- case 454: /* null_ordering_opt ::= NULLS LAST */
-{ yymsp[-1].minor.yy185 = NULL_ORDER_LAST; }
+ case 453: /* null_ordering_opt ::= NULLS LAST */
+{ yymsp[-1].minor.yy217 = NULL_ORDER_LAST; }
break;
default:
break;
diff --git a/source/libs/parser/test/CMakeLists.txt b/source/libs/parser/test/CMakeLists.txt
index c252653e9ee743ca8c9e899f6851e1893fb766be..0e8adb978dd0e9fca5a67e9999ce7c5faa877cc0 100644
--- a/source/libs/parser/test/CMakeLists.txt
+++ b/source/libs/parser/test/CMakeLists.txt
@@ -26,9 +26,7 @@ if(${BUILD_WINGETOPT})
target_link_libraries(parserTest PUBLIC wingetopt)
endif()
-if(NOT TD_WINDOWS)
- add_test(
- NAME parserTest
- COMMAND parserTest
- )
-endif(NOT TD_WINDOWS)
+add_test(
+ NAME parserTest
+ COMMAND parserTest
+)
diff --git a/source/libs/parser/test/mockCatalogService.cpp b/source/libs/parser/test/mockCatalogService.cpp
index aefbb3967ff74d9ee9eb7aa488f44a0d31dae25b..566c4d8b04c0127e04ef9ce0fb0b5eabae7d25da 100644
--- a/source/libs/parser/test/mockCatalogService.cpp
+++ b/source/libs/parser/test/mockCatalogService.cpp
@@ -242,6 +242,8 @@ class MockCatalogServiceImpl {
info->outputType = outputType;
info->outputLen = outputLen;
info->bufSize = bufSize;
+ info->pCode = nullptr;
+ info->pComment = nullptr;
udf_.insert(std::make_pair(func, info));
}
diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp
index e55f36376cbce26f1954211fe7308070a0a192bd..f8072c079223471e5533adda1e670287f567bda0 100644
--- a/source/libs/parser/test/parInitialCTest.cpp
+++ b/source/libs/parser/test/parInitialCTest.cpp
@@ -298,14 +298,12 @@ TEST_F(ParserInitialCTest, createStable) {
auto setCreateStbReqFunc = [&](const char* pTbname, int8_t igExists = 0,
float xFilesFactor = TSDB_DEFAULT_ROLLUP_FILE_FACTOR,
- int32_t delay = TSDB_DEFAULT_ROLLUP_DELAY, int32_t ttl = TSDB_DEFAULT_TABLE_TTL,
- const char* pComment = nullptr) {
+ int32_t ttl = TSDB_DEFAULT_TABLE_TTL, const char* pComment = nullptr) {
memset(&expect, 0, sizeof(SMCreateStbReq));
int32_t len = snprintf(expect.name, sizeof(expect.name), "0.test.%s", pTbname);
expect.name[len] = '\0';
expect.igExists = igExists;
expect.xFilesFactor = xFilesFactor;
- expect.delay = delay;
expect.ttl = ttl;
if (nullptr != pComment) {
expect.comment = strdup(pComment);
@@ -393,7 +391,7 @@ TEST_F(ParserInitialCTest, createStable) {
addFieldToCreateStbReqFunc(false, "id", TSDB_DATA_TYPE_INT);
run("CREATE STABLE t1(ts TIMESTAMP, c1 INT) TAGS(id INT)");
- setCreateStbReqFunc("t1", 1, 0.1, 2, 100, "test create table");
+ setCreateStbReqFunc("t1", 1, 0.1, 100, "test create table");
addFieldToCreateStbReqFunc(true, "ts", TSDB_DATA_TYPE_TIMESTAMP, 0, 0);
addFieldToCreateStbReqFunc(true, "c1", TSDB_DATA_TYPE_INT);
addFieldToCreateStbReqFunc(true, "c2", TSDB_DATA_TYPE_UINT);
@@ -431,7 +429,7 @@ TEST_F(ParserInitialCTest, createStable) {
"TAGS (a1 TIMESTAMP, a2 INT, a3 INT UNSIGNED, a4 BIGINT, a5 BIGINT UNSIGNED, a6 FLOAT, a7 DOUBLE, "
"a8 BINARY(20), a9 SMALLINT, a10 SMALLINT UNSIGNED COMMENT 'test column comment', a11 TINYINT, "
"a12 TINYINT UNSIGNED, a13 BOOL, a14 NCHAR(30), a15 VARCHAR(50)) "
- "TTL 100 COMMENT 'test create table' SMA(c1, c2, c3) ROLLUP (MIN) FILE_FACTOR 0.1 DELAY 2");
+ "TTL 100 COMMENT 'test create table' SMA(c1, c2, c3) ROLLUP (MIN) FILE_FACTOR 0.1");
}
TEST_F(ParserInitialCTest, createStream) {
@@ -464,7 +462,7 @@ TEST_F(ParserInitialCTest, createTable) {
"TAGS (a1 TIMESTAMP, a2 INT, a3 INT UNSIGNED, a4 BIGINT, a5 BIGINT UNSIGNED, a6 FLOAT, a7 DOUBLE, a8 BINARY(20), "
"a9 SMALLINT, a10 SMALLINT UNSIGNED COMMENT 'test column comment', a11 TINYINT, a12 TINYINT UNSIGNED, a13 BOOL, "
"a14 NCHAR(30), a15 VARCHAR(50)) "
- "TTL 100 COMMENT 'test create table' SMA(c1, c2, c3) ROLLUP (MIN) FILE_FACTOR 0.1 DELAY 2");
+ "TTL 100 COMMENT 'test create table' SMA(c1, c2, c3) ROLLUP (MIN) FILE_FACTOR 0.1");
run("CREATE TABLE IF NOT EXISTS t1 USING st1 TAGS(1, 'wxy')");
diff --git a/source/libs/parser/test/parInitialDTest.cpp b/source/libs/parser/test/parInitialDTest.cpp
index 57d349e7eeecd33fd9855f5a0d8df22548c5ceee..5ad427d964ad1dc47a4fed64b51f89257ae53da6 100644
--- a/source/libs/parser/test/parInitialDTest.cpp
+++ b/source/libs/parser/test/parInitialDTest.cpp
@@ -32,7 +32,7 @@ TEST_F(ParserInitialDTest, dropBnode) {
run("DROP BNODE ON DNODE 1");
}
-// DROP CGROUP [ IF EXISTS ] cgroup_name ON topic_name
+// DROP CONSUMER GROUP [ IF EXISTS ] cgroup_name ON topic_name
TEST_F(ParserInitialDTest, dropCGroup) {
useDb("root", "test");
@@ -56,10 +56,10 @@ TEST_F(ParserInitialDTest, dropCGroup) {
});
setDropCgroupReqFunc("tp1", "cg1");
- run("DROP CGROUP cg1 ON tp1");
+ run("DROP CONSUMER GROUP cg1 ON tp1");
setDropCgroupReqFunc("tp1", "cg1", 1);
- run("DROP CGROUP IF EXISTS cg1 ON tp1");
+ run("DROP CONSUMER GROUP IF EXISTS cg1 ON tp1");
}
// todo drop database
diff --git a/source/libs/parser/test/parInsertTest.cpp b/source/libs/parser/test/parInsertTest.cpp
index 7fafec88824111ef8b170ba25f3b092fd7ba1f1a..4d313fca766e8ab8f8d6ba404f7faf2fe833e9e6 100644
--- a/source/libs/parser/test/parInsertTest.cpp
+++ b/source/libs/parser/test/parInsertTest.cpp
@@ -15,6 +15,7 @@
#include
+#include "mockCatalogService.h"
#include "os.h"
#include "parInt.h"
@@ -57,6 +58,38 @@ class InsertTest : public Test {
return code_;
}
+ int32_t runAsync() {
+ code_ = parseInsertSyntax(&cxt_, &res_);
+ if (code_ != TSDB_CODE_SUCCESS) {
+ cout << "parseInsertSyntax code:" << toString(code_) << ", msg:" << errMagBuf_ << endl;
+ return code_;
+ }
+
+ SCatalogReq catalogReq = {0};
+ code_ = buildCatalogReq(res_->pMetaCache, &catalogReq);
+ if (code_ != TSDB_CODE_SUCCESS) {
+ cout << "buildCatalogReq code:" << toString(code_) << ", msg:" << errMagBuf_ << endl;
+ return code_;
+ }
+
+ SMetaData metaData = {0};
+ g_mockCatalogService->catalogGetAllMeta(&catalogReq, &metaData);
+
+ code_ = putMetaDataToCache(&catalogReq, &metaData, res_->pMetaCache);
+ if (code_ != TSDB_CODE_SUCCESS) {
+ cout << "putMetaDataToCache code:" << toString(code_) << ", msg:" << errMagBuf_ << endl;
+ return code_;
+ }
+
+ code_ = parseInsertSql(&cxt_, &res_);
+ if (code_ != TSDB_CODE_SUCCESS) {
+ cout << "parseInsertSql code:" << toString(code_) << ", msg:" << errMagBuf_ << endl;
+ return code_;
+ }
+
+ return code_;
+ }
+
void dumpReslut() {
SVnodeModifOpStmt* pStmt = getVnodeModifStmt(res_);
size_t num = taosArrayGetSize(pStmt->pDataBlocks);
@@ -125,7 +158,7 @@ class InsertTest : public Test {
SQuery* res_;
};
-// INSERT INTO tb_name VALUES (field1_value, ...)
+// INSERT INTO tb_name [(field1_name, ...)] VALUES (field1_value, ...)
TEST_F(InsertTest, singleTableSingleRowTest) {
setDatabase("root", "test");
@@ -133,6 +166,17 @@ TEST_F(InsertTest, singleTableSingleRowTest) {
ASSERT_EQ(run(), TSDB_CODE_SUCCESS);
dumpReslut();
checkReslut(1, 1);
+
+ bind("insert into t1 (ts, c1, c2, c3, c4, c5) values (now, 1, 'beijing', 3, 4, 5)");
+ ASSERT_EQ(run(), TSDB_CODE_SUCCESS);
+
+ bind("insert into t1 values (now, 1, 'beijing', 3, 4, 5)");
+ ASSERT_EQ(runAsync(), TSDB_CODE_SUCCESS);
+ dumpReslut();
+ checkReslut(1, 1);
+
+ bind("insert into t1 (ts, c1, c2, c3, c4, c5) values (now, 1, 'beijing', 3, 4, 5)");
+ ASSERT_EQ(runAsync(), TSDB_CODE_SUCCESS);
}
// INSERT INTO tb_name VALUES (field1_value, ...)(field1_value, ...)
@@ -140,11 +184,16 @@ TEST_F(InsertTest, singleTableMultiRowTest) {
setDatabase("root", "test");
bind(
- "insert into t1 values (now, 1, 'beijing', 3, 4, 5)(now+1s, 2, 'shanghai', 6, 7, 8)(now+2s, 3, 'guangzhou', 9, "
- "10, 11)");
+ "insert into t1 values (now, 1, 'beijing', 3, 4, 5)(now+1s, 2, 'shanghai', 6, 7, 8)"
+ "(now+2s, 3, 'guangzhou', 9, 10, 11)");
ASSERT_EQ(run(), TSDB_CODE_SUCCESS);
dumpReslut();
checkReslut(1, 3);
+
+ bind(
+ "insert into t1 values (now, 1, 'beijing', 3, 4, 5)(now+1s, 2, 'shanghai', 6, 7, 8)"
+ "(now+2s, 3, 'guangzhou', 9, 10, 11)");
+ ASSERT_EQ(runAsync(), TSDB_CODE_SUCCESS);
}
// INSERT INTO tb1_name VALUES (field1_value, ...) tb2_name VALUES (field1_value, ...)
@@ -155,6 +204,9 @@ TEST_F(InsertTest, multiTableSingleRowTest) {
ASSERT_EQ(run(), TSDB_CODE_SUCCESS);
dumpReslut();
checkReslut(2, 1);
+
+ bind("insert into st1s1 values (now, 1, \"beijing\") st1s2 values (now, 10, \"131028\")");
+ ASSERT_EQ(runAsync(), TSDB_CODE_SUCCESS);
}
// INSERT INTO tb1_name VALUES (field1_value, ...) tb2_name VALUES (field1_value, ...)
@@ -167,6 +219,11 @@ TEST_F(InsertTest, multiTableMultiRowTest) {
ASSERT_EQ(run(), TSDB_CODE_SUCCESS);
dumpReslut();
checkReslut(2, 3, 2);
+
+ bind(
+ "insert into st1s1 values (now, 1, \"beijing\")(now+1s, 2, \"shanghai\")(now+2s, 3, \"guangzhou\")"
+ " st1s2 values (now, 10, \"131028\")(now+1s, 20, \"132028\")");
+ ASSERT_EQ(runAsync(), TSDB_CODE_SUCCESS);
}
// INSERT INTO
@@ -181,6 +238,21 @@ TEST_F(InsertTest, autoCreateTableTest) {
ASSERT_EQ(run(), TSDB_CODE_SUCCESS);
dumpReslut();
checkReslut(1, 3);
+
+ bind(
+ "insert into st1s1 using st1 (tag1, tag2) tags(1, 'wxy') values (now, 1, \"beijing\")"
+ "(now+1s, 2, \"shanghai\")(now+2s, 3, \"guangzhou\")");
+ ASSERT_EQ(run(), TSDB_CODE_SUCCESS);
+
+ bind(
+ "insert into st1s1 using st1 tags(1, 'wxy') values (now, 1, \"beijing\")(now+1s, 2, \"shanghai\")(now+2s, 3, "
+ "\"guangzhou\")");
+ ASSERT_EQ(runAsync(), TSDB_CODE_SUCCESS);
+
+ bind(
+ "insert into st1s1 using st1 (tag1, tag2) tags(1, 'wxy') values (now, 1, \"beijing\")"
+ "(now+1s, 2, \"shanghai\")(now+2s, 3, \"guangzhou\")");
+ ASSERT_EQ(runAsync(), TSDB_CODE_SUCCESS);
}
TEST_F(InsertTest, toleranceTest) {
@@ -190,4 +262,9 @@ TEST_F(InsertTest, toleranceTest) {
ASSERT_NE(run(), TSDB_CODE_SUCCESS);
bind("insert into t");
ASSERT_NE(run(), TSDB_CODE_SUCCESS);
+
+ bind("insert into");
+ ASSERT_NE(runAsync(), TSDB_CODE_SUCCESS);
+ bind("insert into t");
+ ASSERT_NE(runAsync(), TSDB_CODE_SUCCESS);
}
diff --git a/source/libs/parser/test/parSelectTest.cpp b/source/libs/parser/test/parSelectTest.cpp
index 2d4fe41d4fed38bb6f97fcb37c6972aa8c7d65fc..a5192595f0be83afa459429748dab3d8e9b65c4e 100644
--- a/source/libs/parser/test/parSelectTest.cpp
+++ b/source/libs/parser/test/parSelectTest.cpp
@@ -44,6 +44,8 @@ TEST_F(ParserSelectTest, constant) {
"timestamp '2022-02-09 17:30:20', true, false, 15s FROM t1");
run("SELECT 123 + 45 FROM t1 WHERE 2 - 1");
+
+ run("SELECT * FROM t1 WHERE -2");
}
TEST_F(ParserSelectTest, expression) {
@@ -76,6 +78,12 @@ TEST_F(ParserSelectTest, pseudoColumnSemanticCheck) {
run("SELECT TBNAME FROM (SELECT * FROM st1s1)", TSDB_CODE_PAR_INVALID_TBNAME, PARSER_STAGE_TRANSLATE);
}
+TEST_F(ParserSelectTest, aggFunc) {
+ useDb("root", "test");
+
+ run("SELECT LEASTSQUARES(c1, -1, 1) FROM t1");
+}
+
TEST_F(ParserSelectTest, multiResFunc) {
useDb("root", "test");
@@ -244,6 +252,8 @@ TEST_F(ParserSelectTest, semanticError) {
// TSDB_CODE_PAR_AMBIGUOUS_COLUMN
run("SELECT c2 FROM t1 tt1, t1 tt2 WHERE tt1.c1 = tt2.c1", TSDB_CODE_PAR_AMBIGUOUS_COLUMN, PARSER_STAGE_TRANSLATE);
+ run("SELECT c2 FROM (SELECT c1 c2, c2 FROM t1)", TSDB_CODE_PAR_AMBIGUOUS_COLUMN, PARSER_STAGE_TRANSLATE);
+
// TSDB_CODE_PAR_WRONG_VALUE_TYPE
run("SELECT timestamp '2010a' FROM t1", TSDB_CODE_PAR_WRONG_VALUE_TYPE, PARSER_STAGE_TRANSLATE);
diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c
index 467b26b7c4af61a8f0cca3d706f34c0133995fe3..eae8799b04bdc03fcb63190a33bfa83838f65ca3 100644
--- a/source/libs/planner/src/planLogicCreater.c
+++ b/source/libs/planner/src/planLogicCreater.c
@@ -124,6 +124,7 @@ static int32_t createChildLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelec
SLogicNode* pNode = NULL;
int32_t code = func(pCxt, pSelect, &pNode);
if (TSDB_CODE_SUCCESS == code && NULL != pNode) {
+ pNode->precision = pSelect->precision;
code = pushLogicNode(pCxt, pRoot, pNode);
}
if (TSDB_CODE_SUCCESS != code) {
@@ -400,6 +401,7 @@ static int32_t createLogicNodeByTable(SLogicPlanContext* pCxt, SSelectStmt* pSel
nodesDestroyNode(pNode);
return TSDB_CODE_OUT_OF_MEMORY;
}
+ pNode->precision = pSelect->precision;
*pLogicNode = pNode;
}
return code;
@@ -485,6 +487,10 @@ static int32_t createWindowLogicNodeFinalize(SLogicPlanContext* pCxt, SSelectStm
pWindow->watermark = pCxt->pPlanCxt->watermark;
}
+ if (pCxt->pPlanCxt->rSmaQuery) {
+ pWindow->filesFactor = pCxt->pPlanCxt->filesFactor;
+ }
+
if (TSDB_CODE_SUCCESS == code) {
code = rewriteExprForSelect(pWindow->pFuncs, pSelect, SQL_CLAUSE_WINDOW);
}
diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c
index adc07fcd0d6b6a0c6f98fdf5032151dab3ae71f3..5f88fc40e54c5e000a6e4506b30a2063acfbc8f1 100644
--- a/source/libs/planner/src/planOptimizer.c
+++ b/source/libs/planner/src/planOptimizer.c
@@ -99,7 +99,8 @@ static bool osdMayBeOptimized(SLogicNode* pNode) {
return false;
}
// todo: release after function splitting
- if (TSDB_SUPER_TABLE == ((SScanLogicNode*)pNode)->pMeta->tableType) {
+ if (TSDB_SUPER_TABLE == ((SScanLogicNode*)pNode)->pMeta->tableType &&
+ SCAN_TYPE_STREAM != ((SScanLogicNode*)pNode)->scanType) {
return false;
}
if (NULL == pNode->pParent || (QUERY_NODE_LOGIC_PLAN_WINDOW != nodeType(pNode->pParent) &&
@@ -226,6 +227,7 @@ static void setScanWindowInfo(SScanLogicNode* pScan) {
pScan->triggerType = ((SWindowLogicNode*)pScan->node.pParent)->triggerType;
pScan->watermark = ((SWindowLogicNode*)pScan->node.pParent)->watermark;
pScan->tsColId = ((SColumnNode*)((SWindowLogicNode*)pScan->node.pParent)->pTspk)->colId;
+ pScan->filesFactor = ((SWindowLogicNode*)pScan->node.pParent)->filesFactor;
}
}
diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c
index a45eabefb9f1f1f7fe9c97a3f8c7cf16385d2fc3..62fde889da7e71bdd65b9799369cacf0de88d132 100644
--- a/source/libs/planner/src/planPhysiCreater.c
+++ b/source/libs/planner/src/planPhysiCreater.c
@@ -506,6 +506,7 @@ static int32_t createTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSubp
pTableScan->triggerType = pScanLogicNode->triggerType;
pTableScan->watermark = pScanLogicNode->watermark;
pTableScan->tsColId = pScanLogicNode->tsColId;
+ pTableScan->filesFactor = pScanLogicNode->filesFactor;
return createScanPhysiNodeFinalize(pCxt, pSubplan, pScanLogicNode, (SScanPhysiNode*)pTableScan, pPhyNode);
}
@@ -917,6 +918,7 @@ static int32_t createWindowPhysiNodeFinalize(SPhysiPlanContext* pCxt, SNodeList*
pWindow->triggerType = pWindowLogicNode->triggerType;
pWindow->watermark = pWindowLogicNode->watermark;
+ pWindow->filesFactor = pWindowLogicNode->filesFactor;
if (TSDB_CODE_SUCCESS == code) {
*pPhyNode = (SPhysiNode*)pWindow;
diff --git a/source/libs/planner/test/planSTableTest.cpp b/source/libs/planner/test/planSTableTest.cpp
index ed75b75e514aede02f41bf29ea044ccf833aef83..d1608cbad1155baf1bda19cf7c06a5121b0d581a 100644
--- a/source/libs/planner/test/planSTableTest.cpp
+++ b/source/libs/planner/test/planSTableTest.cpp
@@ -27,6 +27,14 @@ TEST_F(PlanSuperTableTest, pseudoCol) {
run("SELECT TBNAME, tag1, tag2 FROM st1");
}
+TEST_F(PlanSuperTableTest, pseudoColOnChildTable) {
+ useDb("root", "test");
+
+ run("SELECT TBNAME FROM st1s1");
+
+ run("SELECT TBNAME, tag1, tag2 FROM st1s1");
+}
+
TEST_F(PlanSuperTableTest, orderBy) {
useDb("root", "test");
diff --git a/source/libs/scalar/test/scalar/CMakeLists.txt b/source/libs/scalar/test/scalar/CMakeLists.txt
index 672cb5a3de39bfed51c9d399ac3d0431614f50ab..86b936d93ae950e27069835cffcb0e8a99768ac9 100644
--- a/source/libs/scalar/test/scalar/CMakeLists.txt
+++ b/source/libs/scalar/test/scalar/CMakeLists.txt
@@ -17,9 +17,7 @@ TARGET_INCLUDE_DIRECTORIES(
PUBLIC "${TD_SOURCE_DIR}/source/libs/parser/inc"
PRIVATE "${TD_SOURCE_DIR}/source/libs/scalar/inc"
)
-if(NOT TD_WINDOWS)
- add_test(
- NAME scalarTest
- COMMAND scalarTest
- )
-endif(NOT TD_WINDOWS)
+add_test(
+ NAME scalarTest
+ COMMAND scalarTest
+)
diff --git a/source/libs/scalar/test/scalar/scalarTests.cpp b/source/libs/scalar/test/scalar/scalarTests.cpp
index 3fafc83b18365d490003a792748606c8d4fce804..6a32c6577532c7c7bbb3f07e0f012706dd7163df 100644
--- a/source/libs/scalar/test/scalar/scalarTests.cpp
+++ b/source/libs/scalar/test/scalar/scalarTests.cpp
@@ -2498,7 +2498,7 @@ TEST(ScalarFunctionTest, tanFunction_column) {
code = tanFunction(pInput, 1, pOutput);
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
for (int32_t i = 0; i < rowNum; ++i) {
- ASSERT_EQ(*((double *)colDataGetData(pOutput->columnData, i)), result[i]);
+ ASSERT_NEAR(*((double *)colDataGetData(pOutput->columnData, i)), result[i], 1e-15);
PRINTF("tiny_int after TAN:%f\n", *((double *)colDataGetData(pOutput->columnData, i)));
}
scltDestroyDataBlock(pInput);
@@ -2517,7 +2517,7 @@ TEST(ScalarFunctionTest, tanFunction_column) {
code = tanFunction(pInput, 1, pOutput);
ASSERT_EQ(code, TSDB_CODE_SUCCESS);
for (int32_t i = 0; i < rowNum; ++i) {
- ASSERT_EQ(*((double *)colDataGetData(pOutput->columnData, i)), result[i]);
+ ASSERT_NEAR(*((double *)colDataGetData(pOutput->columnData, i)), result[i], 1e-15);
PRINTF("float after TAN:%f\n", *((double *)colDataGetData(pOutput->columnData, i)));
}
diff --git a/source/libs/stream/src/tstreamUpdate.c b/source/libs/stream/src/tstreamUpdate.c
index 7587fcecc99962b2cd0eda135a121acb281a1a48..ada391b40a76af148e07789375a756a6590648b3 100644
--- a/source/libs/stream/src/tstreamUpdate.c
+++ b/source/libs/stream/src/tstreamUpdate.c
@@ -42,7 +42,7 @@ static void windowSBfAdd(SUpdateInfo *pInfo, uint64_t count) {
}
static void windowSBfDelete(SUpdateInfo *pInfo, uint64_t count) {
- if (count < pInfo->numSBFs - 1) {
+ if (count < pInfo->numSBFs) {
for (uint64_t i = 0; i < count; ++i) {
SScalableBf *pTsSBFs = taosArrayGetP(pInfo->pTsSBFs, 0);
tScalableBfDestroy(pTsSBFs);
@@ -73,8 +73,8 @@ static int64_t adjustInterval(int64_t interval, int32_t precision) {
}
static int64_t adjustWatermark(int64_t adjInterval, int64_t originInt, int64_t watermark) {
- if (watermark <= 0) {
- watermark = TMIN(originInt/adjInterval, 1) * adjInterval;
+ if (watermark <= adjInterval) {
+ watermark = TMAX(originInt/adjInterval, 1) * adjInterval;
} else if (watermark > MAX_NUM_SCALABLE_BF * adjInterval) {
watermark = MAX_NUM_SCALABLE_BF * adjInterval;
}/* else if (watermark < MIN_NUM_SCALABLE_BF * adjInterval) {
diff --git a/source/libs/transport/test/CMakeLists.txt b/source/libs/transport/test/CMakeLists.txt
index 468b70fb711a15a83c97a5a45adb68dee3d1c368..98a252e008d85b27206fa58055f757dd02d64a78 100644
--- a/source/libs/transport/test/CMakeLists.txt
+++ b/source/libs/transport/test/CMakeLists.txt
@@ -111,12 +111,10 @@ target_link_libraries (pushServer
)
-if(NOT TD_WINDOWS)
- add_test(
- NAME transUT
- COMMAND transUT
- )
-endif(NOT TD_WINDOWS)
+add_test(
+ NAME transUT
+ COMMAND transUT
+)
add_test(
NAME transUtilUt
COMMAND transportTest
diff --git a/tests/pytest/util/common.py b/tests/pytest/util/common.py
index 35abc4802f9de2080a6b6a166daf833c9cf04578..8c791efbc644924cfe4c1d85d6422bb671fd1216 100644
--- a/tests/pytest/util/common.py
+++ b/tests/pytest/util/common.py
@@ -14,23 +14,93 @@
import random
import string
from util.sql import tdSql
-
+from util.dnodes import tdDnodes
+import requests
+import time
+import socket
class TDCom:
def init(self, conn, logSql):
tdSql.init(conn.cursor(), logSql)
- def cleanTb(self):
+ def preDefine(self):
+ header = {'Authorization': 'Basic cm9vdDp0YW9zZGF0YQ=='}
+ sql_url = "http://127.0.0.1:6041/rest/sql"
+ sqlt_url = "http://127.0.0.1:6041/rest/sqlt"
+ sqlutc_url = "http://127.0.0.1:6041/rest/sqlutc"
+ influx_url = "http://127.0.0.1:6041/influxdb/v1/write"
+ telnet_url = "http://127.0.0.1:6041/opentsdb/v1/put/telnet"
+ return header, sql_url, sqlt_url, sqlutc_url, influx_url, telnet_url
+
+ def genTcpParam(self):
+ MaxBytes = 1024*1024
+ host ='127.0.0.1'
+ port = 6046
+ return MaxBytes, host, port
+
+ def tcpClient(self, input):
+ MaxBytes = tdCom.genTcpParam()[0]
+ host = tdCom.genTcpParam()[1]
+ port = tdCom.genTcpParam()[2]
+ sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
+ sock.connect((host, port))
+ sock.send(input.encode())
+ sock.close()
+
+ def restApiPost(self, sql):
+ requests.post(self.preDefine()[1], sql.encode("utf-8"), headers = self.preDefine()[0])
+
+ def createDb(self, dbname="test", db_update_tag=0, api_type="taosc"):
+ if api_type == "taosc":
+ if db_update_tag == 0:
+ tdSql.execute(f"drop database if exists {dbname}")
+ tdSql.execute(f"create database if not exists {dbname} precision 'us'")
+ else:
+ tdSql.execute(f"drop database if exists {dbname}")
+ tdSql.execute(f"create database if not exists {dbname} precision 'us' update 1")
+ elif api_type == "restful":
+ if db_update_tag == 0:
+ self.restApiPost(f"drop database if exists {dbname}")
+ self.restApiPost(f"create database if not exists {dbname} precision 'us'")
+ else:
+ self.restApiPost(f"drop database if exists {dbname}")
+ self.restApiPost(f"create database if not exists {dbname} precision 'us' update 1")
+ tdSql.execute(f'use {dbname}')
+
+ def genUrl(self, url_type, dbname, precision):
+ if url_type == "influxdb":
+ if precision is None:
+ url = self.preDefine()[4] + "?" + "db=" + dbname
+ else:
+ url = self.preDefine()[4] + "?" + "db=" + dbname + "&precision=" + precision
+ elif url_type == "telnet":
+ url = self.preDefine()[5] + "/" + dbname
+ else:
+ url = self.preDefine()[1]
+ return url
+
+ def schemalessApiPost(self, sql, url_type="influxdb", dbname="test", precision=None):
+ if url_type == "influxdb":
+ url = self.genUrl(url_type, dbname, precision)
+ elif url_type == "telnet":
+ url = self.genUrl(url_type, dbname, precision)
+ res = requests.post(url, sql.encode("utf-8"), headers = self.preDefine()[0])
+ return res
+
+ def cleanTb(self, type="taosc"):
+ '''
+ type is taosc or restful
+ '''
query_sql = "show stables"
res_row_list = tdSql.query(query_sql, True)
stb_list = map(lambda x: x[0], res_row_list)
for stb in stb_list:
- tdSql.execute(f'drop table if exists {stb}')
+ if type == "taosc":
+ tdSql.execute(f'drop table if exists {stb}')
+ elif type == "restful":
+ self.restApiPost(f"drop table if exists {stb}")
- query_sql = "show tables"
- res_row_list = tdSql.query(query_sql, True)
- tb_list = map(lambda x: x[0], res_row_list)
- for tb in tb_list:
- tdSql.execute(f'drop table if exists {tb}')
+ def dateToTs(self, datetime_input):
+ return int(time.mktime(time.strptime(datetime_input, "%Y-%m-%d %H:%M:%S.%f")))
def getLongName(self, len, mode = "mixed"):
"""
@@ -47,6 +117,52 @@ class TDCom:
chars = ''.join(random.choice(string.ascii_letters.lower() + string.digits) for i in range(len))
return chars
+ def restartTaosd(self, index=1, db_name="db"):
+ tdDnodes.stop(index)
+ tdDnodes.startWithoutSleep(index)
+ tdSql.execute(f"use {db_name}")
+
+ def typeof(self, variate):
+ v_type=None
+ if type(variate) is int:
+ v_type = "int"
+ elif type(variate) is str:
+ v_type = "str"
+ elif type(variate) is float:
+ v_type = "float"
+ elif type(variate) is bool:
+ v_type = "bool"
+ elif type(variate) is list:
+ v_type = "list"
+ elif type(variate) is tuple:
+ v_type = "tuple"
+ elif type(variate) is dict:
+ v_type = "dict"
+ elif type(variate) is set:
+ v_type = "set"
+ return v_type
+
+ def splitNumLetter(self, input_mix_str):
+ nums, letters = "", ""
+ for i in input_mix_str:
+ if i.isdigit():
+ nums += i
+ elif i.isspace():
+ pass
+ else:
+ letters += i
+ return nums, letters
+
+ def smlPass(self, func):
+ smlChildTableName = "no"
+ def wrapper(*args):
+ # if tdSql.getVariable("smlChildTableName")[0].upper() == "ID":
+ if smlChildTableName.upper() == "ID":
+ return func(*args)
+ else:
+ pass
+ return wrapper
+
def close(self):
self.cursor.close()
diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py
index e8d01de3e5a6a5943472778453d3be28f758f18c..2e11b93e5f4f5fc2ec1edd1fdf73f0a4128d6143 100644
--- a/tests/pytest/util/dnodes.py
+++ b/tests/pytest/util/dnodes.py
@@ -169,8 +169,13 @@ class TDDnode:
self.cfgDict.update({option: value})
def remoteExec(self, updateCfgDict, execCmd):
- remote_conn = Connection(self.remoteIP, port=22, user='root', connect_kwargs={'password':'123456'})
- remote_top_dir = '~/test'
+ try:
+ config = eval(self.remoteIP)
+ remote_conn = Connection(host=config["host"], port=config["port"], user=config["user"], connect_kwargs={'password':config["password"]})
+ remote_top_dir = config["path"]
+ except Exception as r:
+ remote_conn = Connection(host=self.remoteIP, port=22, user='root', connect_kwargs={'password':'123456'})
+ remote_top_dir = '~/test'
valgrindStr = ''
if (self.valgrind==1):
valgrindStr = '-g'
@@ -489,6 +494,7 @@ class TDDnodes:
self.simDeployed = False
self.testCluster = False
self.valgrind = 0
+ self.killValgrind = 1
def init(self, path, remoteIP = ""):
psCmd = "ps -ef|grep -w taosd| grep -v grep| grep -v defunct | awk '{print $2}'"
@@ -500,14 +506,15 @@ class TDDnodes:
processID = subprocess.check_output(
psCmd, shell=True).decode("utf-8")
- psCmd = "ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}'"
- processID = subprocess.check_output(psCmd, shell=True).decode("utf-8")
- while(processID):
- killCmd = "kill -9 %s > /dev/null 2>&1" % processID
- os.system(killCmd)
- time.sleep(1)
- processID = subprocess.check_output(
- psCmd, shell=True).decode("utf-8")
+ if self.killValgrind == 1:
+ psCmd = "ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}'"
+ processID = subprocess.check_output(psCmd, shell=True).decode("utf-8")
+ while(processID):
+ killCmd = "kill -9 %s > /dev/null 2>&1" % processID
+ os.system(killCmd)
+ time.sleep(1)
+ processID = subprocess.check_output(
+ psCmd, shell=True).decode("utf-8")
binPath = self.dnodes[0].getPath() + "/../../../"
# tdLog.debug("binPath %s" % (binPath))
@@ -544,6 +551,9 @@ class TDDnodes:
def setValgrind(self, value):
self.valgrind = value
+ def setKillValgrind(self, value):
+ self.killValgrind = value
+
def deploy(self, index, *updatecfgDict):
self.sim.setTestCluster(self.testCluster)
@@ -617,14 +627,15 @@ class TDDnodes:
processID = subprocess.check_output(
psCmd, shell=True).decode("utf-8")
- psCmd = "ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}'"
- processID = subprocess.check_output(psCmd, shell=True).decode("utf-8")
- while(processID):
- killCmd = "kill -TERM %s > /dev/null 2>&1" % processID
- os.system(killCmd)
- time.sleep(1)
- processID = subprocess.check_output(
- psCmd, shell=True).decode("utf-8")
+ if self.killValgrind == 1:
+ psCmd = "ps -ef|grep -w valgrind.bin| grep -v grep | awk '{print $2}'"
+ processID = subprocess.check_output(psCmd, shell=True).decode("utf-8")
+ while(processID):
+ killCmd = "kill -TERM %s > /dev/null 2>&1" % processID
+ os.system(killCmd)
+ time.sleep(1)
+ processID = subprocess.check_output(
+ psCmd, shell=True).decode("utf-8")
# if os.system(cmd) != 0 :
# tdLog.exit(cmd)
diff --git a/tests/pytest/util/types.py b/tests/pytest/util/types.py
new file mode 100644
index 0000000000000000000000000000000000000000..218a4770269328a5ef7161cc56c0e0dc0c420f73
--- /dev/null
+++ b/tests/pytest/util/types.py
@@ -0,0 +1,38 @@
+###################################################################
+# 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 enum import Enum
+
+class TDSmlProtocolType(Enum):
+ '''
+ Schemaless Protocol types
+ 0 - unknown
+ 1 - InfluxDB Line Protocol
+ 2 - OpenTSDB Telnet Protocl
+ 3 - OpenTSDB JSON Protocol
+ '''
+ UNKNOWN = 0
+ LINE = 1
+ TELNET = 2
+ JSON = 3
+
+class TDSmlTimestampType(Enum):
+ NOT_CONFIGURED = 0
+ HOUR = 1
+ MINUTE = 2
+ SECOND = 3
+ MILLI_SECOND = 4
+ MICRO_SECOND = 5
+ NANO_SECOND = 6
+
+
diff --git a/tests/script/general/alter/table.sim b/tests/script/general/alter/table.sim
index cd0397760276c775d170e90831f6674880cb8f81..9ca2f60bdc37f827e0832dc59399bf73732d7748 100644
--- a/tests/script/general/alter/table.sim
+++ b/tests/script/general/alter/table.sim
@@ -252,6 +252,7 @@ endi
print ======== step8
sql alter table tb add column h binary(10)
+sql select * from tb
sql describe tb
if $data00 != ts then
return -1
@@ -304,7 +305,7 @@ endi
if $data80 != h then
return -1
endi
-if $data81 != BINARY then
+if $data81 != VARCHAR then
return -1
endi
if $data82 != 10 then
@@ -371,7 +372,7 @@ endi
if $data80 != h then
return -1
endi
-if $data81 != BINARY then
+if $data81 != VARCHAR then
return -1
endi
if $data82 != 10 then
@@ -447,7 +448,7 @@ endi
if $data70 != h then
return -1
endi
-if $data71 != BINARY then
+if $data71 != VARCHAR then
return -1
endi
if $data72 != 10 then
@@ -496,7 +497,7 @@ endi
if $data60 != h then
return -1
endi
-if $data61 != BINARY then
+if $data61 != VARCHAR then
return -1
endi
if $data62 != 10 then
@@ -539,7 +540,7 @@ endi
if $data50 != h then
return -1
endi
-if $data51 != BINARY then
+if $data51 != VARCHAR then
return -1
endi
if $data52 != 10 then
@@ -576,7 +577,7 @@ endi
if $data40 != h then
return -1
endi
-if $data41 != BINARY then
+if $data41 != VARCHAR then
return -1
endi
if $data42 != 10 then
@@ -607,7 +608,7 @@ endi
if $data30 != h then
return -1
endi
-if $data31 != BINARY then
+if $data31 != VARCHAR then
return -1
endi
if $data32 != 10 then
@@ -632,7 +633,7 @@ endi
if $data20 != h then
return -1
endi
-if $data21 != BINARY then
+if $data21 != VARCHAR then
return -1
endi
if $data22 != 10 then
diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt
index 2f7279e66cca9687634427dfa4ce5f77b803f37e..993789a61e67998ad2d7b4760905220cc984ed2f 100644
--- a/tests/script/jenkins/basic.txt
+++ b/tests/script/jenkins/basic.txt
@@ -103,6 +103,10 @@
./test.sh -f tsim/stable/tag_modify.sim
./test.sh -f tsim/stable/tag_rename.sim
./test.sh -f tsim/stable/alter_comment.sim
+./test.sh -f tsim/stable/alter_count.sim
+./test.sh -f tsim/stable/alter_insert1.sim
+./test.sh -f tsim/stable/alter_insert2.sim
+./test.sh -f tsim/stable/alter_import.sim
# --- for multi process mode
./test.sh -f tsim/user/basic1.sim -m
diff --git a/tests/script/tsim/insert/update0.sim b/tests/script/tsim/insert/update0.sim
index 3cb5e4008e3a57e3178721b7e3f5458ef07be52b..0ba3e98c913e1c37c50c351bed7d7385a1cad0d3 100644
--- a/tests/script/tsim/insert/update0.sim
+++ b/tests/script/tsim/insert/update0.sim
@@ -9,7 +9,7 @@ sql create database d0 keep 365000d,365000d,365000d
sql use d0
print =============== create super table and register rsma
-sql create table if not exists stb (ts timestamp, c1 int) tags (city binary(20),district binary(20)) rollup(min) file_factor 0.1 delay 2;
+sql create table if not exists stb (ts timestamp, c1 int) tags (city binary(20),district binary(20)) rollup(min) file_factor 0.1;
sql show stables
if $rows != 1 then
diff --git a/tests/script/tsim/sma/rsmaCreateInsertQuery.sim b/tests/script/tsim/sma/rsmaCreateInsertQuery.sim
index 5d9425e5064d3fc65038c174dae109cc6283991e..f929dda18cb1b287c3ffe05487464624ff0eebc5 100644
--- a/tests/script/tsim/sma/rsmaCreateInsertQuery.sim
+++ b/tests/script/tsim/sma/rsmaCreateInsertQuery.sim
@@ -9,7 +9,7 @@ sql create database d0 retentions 15s:7d,1m:21d,15m:365d;
sql use d0
print =============== create super table and register rsma
-sql create table if not exists stb (ts timestamp, c1 int) tags (city binary(20),district binary(20)) rollup(min) file_factor 0.1 delay 2;
+sql create table if not exists stb (ts timestamp, c1 int) tags (city binary(20),district binary(20)) rollup(min) file_factor 0.1;
sql show stables
if $rows != 1 then
diff --git a/tests/script/tsim/sma/tsmaCreateInsertData.sim b/tests/script/tsim/sma/tsmaCreateInsertData.sim
index 07c5adef5d8114e65bb82b66e334b30c3b59ad5b..0202c53800260b4974cabe10ff4cbd9f180fd590 100644
--- a/tests/script/tsim/sma/tsmaCreateInsertData.sim
+++ b/tests/script/tsim/sma/tsmaCreateInsertData.sim
@@ -5,7 +5,7 @@ sleep 50
sql connect
print =============== create database
-sql create database d1
+sql create database d1 vgroups 1
sql use d1
print =============== create super table, include column type for count/sum/min/max/first
diff --git a/tests/script/general/alter/import.sim b/tests/script/tsim/stable/alter_import.sim
similarity index 84%
rename from tests/script/general/alter/import.sim
rename to tests/script/tsim/stable/alter_import.sim
index 175e084b7f1aa73a1c8b599752fd0b7de59efda7..cdd7b60e14fc5e8f46f3413e9037a95f534718e1 100644
--- a/tests/script/general/alter/import.sim
+++ b/tests/script/tsim/stable/alter_import.sim
@@ -29,14 +29,14 @@ if $data00 != 3 then
endi
print ========= step3
-sql import into tb values(now-23d, -23, 0)
-sql import into tb values(now-21d, -21, 0)
+sql insert into tb values(now-23d, -23, 0)
+sql insert into tb values(now-21d, -21, 0)
sql select count(b) from tb
if $data00 != 5 then
return -1
endi
-sql import into tb values(now-29d, -29, 0)
+sql insert into tb values(now-29d, -29, 0)
sql select count(b) from tb
if $data00 != 6 then
return -1
diff --git a/tests/script/general/alter/insert1.sim b/tests/script/tsim/stable/alter_insert1.sim
similarity index 100%
rename from tests/script/general/alter/insert1.sim
rename to tests/script/tsim/stable/alter_insert1.sim
diff --git a/tests/script/general/alter/insert2.sim b/tests/script/tsim/stable/alter_insert2.sim
similarity index 100%
rename from tests/script/general/alter/insert2.sim
rename to tests/script/tsim/stable/alter_insert2.sim
diff --git a/tests/script/general/alter/metrics.sim b/tests/script/tsim/stable/alter_metrics.sim
similarity index 97%
rename from tests/script/general/alter/metrics.sim
rename to tests/script/tsim/stable/alter_metrics.sim
index ec8c980c16adcf512975e54fa492d3c22b12c195..f33246dfe2d14c092cb9483ce31c0788da9e5397 100644
--- a/tests/script/general/alter/metrics.sim
+++ b/tests/script/tsim/stable/alter_metrics.sim
@@ -347,7 +347,7 @@ endi
if $data80 != h then
return -1
endi
-if $data81 != BINARY then
+if $data81 != VARCHAR then
return -1
endi
if $data82 != 10 then
@@ -363,9 +363,8 @@ endi
print ======== step9
print ======== step10
system sh/exec.sh -n dnode1 -s stop -x SIGINT
-sleep 3000
system sh/exec.sh -n dnode1 -s start
-sleep 3000
+sql connect
sql use d2
sql describe tb
@@ -420,7 +419,7 @@ endi
if $data80 != h then
return -1
endi
-if $data81 != BINARY then
+if $data81 != VARCHAR then
return -1
endi
if $data82 != 10 then
@@ -502,7 +501,7 @@ endi
if $data70 != h then
return -1
endi
-if $data71 != BINARY then
+if $data71 != VARCHAR then
return -1
endi
if $data72 != 10 then
@@ -557,7 +556,7 @@ endi
if $data60 != h then
return -1
endi
-if $data61 != BINARY then
+if $data61 != VARCHAR then
return -1
endi
if $data62 != 10 then
@@ -606,7 +605,7 @@ endi
if $data50 != h then
return -1
endi
-if $data51 != BINARY then
+if $data51 != VARCHAR then
return -1
endi
if $data52 != 10 then
@@ -649,7 +648,7 @@ endi
if $data40 != h then
return -1
endi
-if $data41 != BINARY then
+if $data41 != VARCHAR then
return -1
endi
if $data42 != 10 then
@@ -686,7 +685,7 @@ endi
if $data30 != h then
return -1
endi
-if $data31 != BINARY then
+if $data31 != VARCHAR then
return -1
endi
if $data32 != 10 then
@@ -717,7 +716,7 @@ endi
if $data20 != h then
return -1
endi
-if $data21 != BINARY then
+if $data21 != VARCHAR then
return -1
endi
if $data22 != 10 then
@@ -758,7 +757,7 @@ endi
print ======= over
sql drop database d2
sql show databases
-if $rows != 0 then
+if $rows != 2 then
return -1
endi
diff --git a/tests/script/tsim/stable/column_modify.sim b/tests/script/tsim/stable/column_modify.sim
index 16e7ff8f67f1d9818947c54f6929728b086f44ab..e2752ccf951cef30587aa1f604f92cbbaa265b85 100644
--- a/tests/script/tsim/stable/column_modify.sim
+++ b/tests/script/tsim/stable/column_modify.sim
@@ -79,28 +79,31 @@ system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
sql connect
-sql select * from db.ctb
+
+sql select * from db.stb
+print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6]
+print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6]
if $rows != 2 then
return -1
endi
-#if $data[0][1] != 1 then
-# return -1
-#endi
-#if $data[0][2] != 1234 then
-# return -1
-#endi
-#if $data[0][3] != 101 then
-# return -1
-#endi
-#if $data[1][1] != 1 then
-# return -1
-#endi
-#if $data[1][2] != 12345 then
-# return -1
-#endi
-#if $data[1][3] != 101 then
-# return -1
-#endi
+if $data[0][1] != 1 then
+ return -1
+endi
+if $data[0][2] != 1234 then
+ return -1
+endi
+if $data[0][3] != 101 then
+ return -1
+endi
+if $data[1][1] != 1 then
+ return -1
+endi
+if $data[1][2] != 12345 then
+ return -1
+endi
+if $data[1][3] != 101 then
+ return -1
+endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
diff --git a/tests/script/tsim/stable/disk.sim b/tests/script/tsim/stable/disk.sim
index eeaa8293a505a7af3b774eb2e0d3b7fab5b6fe49..ff734b4234263ca71253dee97eaa0158fe5221c4 100644
--- a/tests/script/tsim/stable/disk.sim
+++ b/tests/script/tsim/stable/disk.sim
@@ -49,10 +49,9 @@ if $data00 != $totalNum then
return -1
endi
-sleep 1000
system sh/exec.sh -n dnode1 -s stop -x SIGINT
-sleep 1000
system sh/exec.sh -n dnode1 -s start
+sql connect
sql use $db
sql show vgroups
diff --git a/tests/script/tsim/stable/metrics.sim b/tests/script/tsim/stable/metrics.sim
index 26323b4a92539ed62fdd060cc7e73dfafec70101..c652670d7f4e904461adf33af8f1d10fc9e9e319 100644
--- a/tests/script/tsim/stable/metrics.sim
+++ b/tests/script/tsim/stable/metrics.sim
@@ -93,9 +93,6 @@ $i = 2
$tb = $tbPrefix . $i
sql insert into $tb values (now + 1m , 1 )
-print sleep 2000
-sleep 2000
-
print =============== step6
# sql select * from $mt
diff --git a/tests/script/tsim/stream/session0.sim b/tests/script/tsim/stream/session0.sim
index 46b343632abd0347502b86e0978f2afd22c139a8..41a8b3371002848dd6909ab1c681bde0628e6324 100644
--- a/tests/script/tsim/stream/session0.sim
+++ b/tests/script/tsim/stream/session0.sim
@@ -23,7 +23,7 @@ sql insert into t1 values(1648791223001,10,2,3,1.1,2);
sql insert into t1 values(1648791233002,3,2,3,2.1,3);
sql insert into t1 values(1648791243003,NULL,NULL,NULL,NULL,4);
sql insert into t1 values(1648791213002,NULL,NULL,NULL,NULL,5) (1648791233012,NULL,NULL,NULL,NULL,6);
-
+sleep 300
sql select * from streamt order by s desc;
# row 0
@@ -115,7 +115,7 @@ sql insert into t1 values(1648791233002,3,2,3,2.1,9);
sql insert into t1 values(1648791243003,4,2,3,3.1,10);
sql insert into t1 values(1648791213002,4,2,3,4.1,11) ;
sql insert into t1 values(1648791213002,4,2,3,4.1,12) (1648791223009,4,2,3,4.1,13);
-
+sleep 300
sql select * from streamt order by s desc ;
# row 0
diff --git a/tests/script/tsim/stream/session1.sim b/tests/script/tsim/stream/session1.sim
index a44639ba7a5e17e51e6ac8190d991bfd2edf1a9e..fb31818f98138948ca91758e14de85146b9940d5 100644
--- a/tests/script/tsim/stream/session1.sim
+++ b/tests/script/tsim/stream/session1.sim
@@ -22,7 +22,7 @@ sql insert into t1 values(1648791210000,1,1,1,1.1,1);
sql insert into t1 values(1648791220000,2,2,2,2.1,2);
sql insert into t1 values(1648791230000,3,3,3,3.1,3);
sql insert into t1 values(1648791240000,4,4,4,4.1,4);
-
+sleep 300
sql select * from streamt order by s desc;
# row 0
@@ -50,7 +50,7 @@ sql insert into t1 values(1648791250005,5,5,5,5.1,5);
sql insert into t1 values(1648791260006,6,6,6,6.1,6);
sql insert into t1 values(1648791270007,7,7,7,7.1,7);
sql insert into t1 values(1648791240005,5,5,5,5.1,8) (1648791250006,6,6,6,6.1,9);
-
+sleep 300
sql select * from streamt order by s desc;
# row 0
@@ -100,7 +100,7 @@ sql insert into t1 values(1648791260007,7,7,7,7.1,12) (1648791290008,7,7,7,7.1,1
sql insert into t1 values(1648791500000,7,7,7,7.1,15) (1648791520000,8,8,8,8.1,16) (1648791540000,8,8,8,8.1,17);
sql insert into t1 values(1648791530000,8,8,8,8.1,18);
sql insert into t1 values(1648791220000,10,10,10,10.1,19) (1648791290008,2,2,2,2.1,20) (1648791540000,17,17,17,17.1,21) (1648791500001,22,22,22,22.1,22);
-
+sleep 300
sql select * from streamt order by s desc;
# row 0
diff --git a/tests/script/tsim/stream/triggerInterval0.sim b/tests/script/tsim/stream/triggerInterval0.sim
index 6f1d8f4b7bf88913239ccf1cc3a89fb1dbdf6bc9..756f591f3ff8a58586cc77ba5a95acc1f31d46b0 100644
--- a/tests/script/tsim/stream/triggerInterval0.sim
+++ b/tests/script/tsim/stream/triggerInterval0.sim
@@ -94,92 +94,4 @@ if $data11 != 5 then
return -1
endi
-sql create table t2(ts timestamp, a int, b int , c int, d double);
-sql create stream streams2 trigger window_close watermark 20s into streamt2 as select _wstartts, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from t2 interval(10s);
-sql insert into t2 values(1648791213000,1,2,3,1.0);
-sql insert into t2 values(1648791239999,1,2,3,1.0);
-sleep 300
-sql select * from streamt2;
-if $rows != 0 then
- print ======$rows
- return -1
-endi
-
-sql insert into t2 values(1648791240000,1,2,3,1.0);
-sleep 300
-sql select * from streamt2;
-if $rows != 1 then
- print ======$rows
- return -1
-endi
-if $data01 != 1 then
- print ======$data01
- return -1
-endi
-
-sql insert into t2 values(1648791250001,1,2,3,1.0) (1648791250002,1,2,3,1.0) (1648791250003,1,2,3,1.0) (1648791240000,1,2,3,1.0);
-sleep 300
-sql select * from streamt2;
-if $rows != 1 then
- print ======$rows
- return -1
-endi
-if $data01 != 1 then
- print ======$data01
- return -1
-endi
-
-sql insert into t2 values(1648791280000,1,2,3,1.0);
-sleep 300
-sql select * from streamt2;
-if $rows != 4 then
- print ======$rows
- return -1
-endi
-if $data01 != 1 then
- print ======$data01
- return -1
-endi
-if $data11 != 1 then
- print ======$data11
- return -1
-endi
-if $data21 != 1 then
- print ======$data21
- return -1
-endi
-if $data31 != 3 then
- print ======$data31
- return -1
-endi
-
-sql insert into t2 values(1648791250001,1,2,3,1.0) (1648791250002,1,2,3,1.0) (1648791250003,1,2,3,1.0) (1648791280000,1,2,3,1.0) (1648791280001,1,2,3,1.0) (1648791280002,1,2,3,1.0) (1648791310000,1,2,3,1.0) (1648791280001,1,2,3,1.0);
-sleep 300
-sql select * from streamt2;
-
-if $rows != 5 then
- print ======$rows
- return -1
-endi
-if $data01 != 1 then
- print ======$data01
- return -1
-endi
-if $data11 != 1 then
- print ======$data11
- return -1
-endi
-if $data21 != 1 then
- print ======$data21
- return -1
-endi
-if $data31 != 3 then
- print ======$data31
- return -1
-endi
-if $data41 != 3 then
- print ======$data31
- return -1
-endi
-
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
diff --git a/tests/system-test/1-insert/opentsdb_telnet_line_taosc_insert.py b/tests/system-test/1-insert/opentsdb_telnet_line_taosc_insert.py
new file mode 100644
index 0000000000000000000000000000000000000000..4c56511d2717167d243e162776d4ffe75fb056f5
--- /dev/null
+++ b/tests/system-test/1-insert/opentsdb_telnet_line_taosc_insert.py
@@ -0,0 +1,1489 @@
+###################################################################
+# Copyright (c) 2021 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+
+# -*- coding: utf-8 -*-
+
+import traceback
+import random
+from taos.error import SchemalessError
+import time
+import numpy as np
+from util.log import *
+from util.cases import *
+from util.sql import *
+from util.common import tdCom
+from util.types import TDSmlProtocolType, TDSmlTimestampType
+import threading
+
+class TDTestCase:
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor(), logSql)
+ self._conn = conn
+ self.smlChildTableName_value = "id"
+
+ def createDb(self, name="test", db_update_tag=0, protocol=None):
+ if protocol == "telnet-tcp":
+ name = "opentsdb_telnet"
+
+ if db_update_tag == 0:
+ tdSql.execute(f"drop database if exists {name}")
+ tdSql.execute(f"create database if not exists {name} precision 'ms'")
+ else:
+ tdSql.execute(f"drop database if exists {name}")
+ tdSql.execute(f"create database if not exists {name} precision 'ms' update 1")
+ tdSql.execute(f'use {name}')
+
+ def timeTrans(self, time_value, ts_type):
+ if int(time_value) == 0:
+ ts = time.time()
+ else:
+ if ts_type == TDSmlTimestampType.MILLI_SECOND.value or ts_type == None:
+ ts = int(''.join(list(filter(str.isdigit, time_value))))/1000
+ elif ts_type == TDSmlTimestampType.SECOND.value:
+ ts = int(''.join(list(filter(str.isdigit, time_value))))/1
+ ulsec = repr(ts).split('.')[1][:6]
+ if len(ulsec) < 6 and int(ulsec) != 0:
+ ulsec = int(ulsec) * (10 ** (6 - len(ulsec)))
+ elif int(ulsec) == 0:
+ ulsec *= 6
+ # * follow two rows added for tsCheckCase
+ td_ts = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(ts))
+ return td_ts
+ #td_ts = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(ts))
+ td_ts = time.strftime("%Y-%m-%d %H:%M:%S.{}".format(ulsec), time.localtime(ts))
+ return td_ts
+ #return repr(datetime.datetime.strptime(td_ts, "%Y-%m-%d %H:%M:%S.%f"))
+
+ def dateToTs(self, datetime_input):
+ return int(time.mktime(time.strptime(datetime_input, "%Y-%m-%d %H:%M:%S.%f")))
+
+ def getTdTypeValue(self, value, vtype="col"):
+ if vtype == "col":
+ if value.lower().endswith("i8"):
+ td_type = "TINYINT"
+ td_tag_value = ''.join(list(value)[:-2])
+ elif value.lower().endswith("i16"):
+ td_type = "SMALLINT"
+ td_tag_value = ''.join(list(value)[:-3])
+ elif value.lower().endswith("i32"):
+ td_type = "INT"
+ td_tag_value = ''.join(list(value)[:-3])
+ elif value.lower().endswith("i64"):
+ td_type = "BIGINT"
+ td_tag_value = ''.join(list(value)[:-3])
+ elif value.lower().endswith("u64"):
+ td_type = "BIGINT UNSIGNED"
+ td_tag_value = ''.join(list(value)[:-3])
+ elif value.lower().endswith("f32"):
+ td_type = "FLOAT"
+ td_tag_value = ''.join(list(value)[:-3])
+ td_tag_value = '{}'.format(np.float32(td_tag_value))
+ elif value.lower().endswith("f64"):
+ td_type = "DOUBLE"
+ td_tag_value = ''.join(list(value)[:-3])
+ if "e" in value.lower():
+ td_tag_value = str(float(td_tag_value))
+ elif value.lower().startswith('l"'):
+ td_type = "NCHAR"
+ td_tag_value = ''.join(list(value)[2:-1])
+ elif value.startswith('"') and value.endswith('"'):
+ td_type = "BINARY"
+ td_tag_value = ''.join(list(value)[1:-1])
+ elif value.lower() == "t" or value.lower() == "true":
+ td_type = "BOOL"
+ td_tag_value = "True"
+ elif value.lower() == "f" or value.lower() == "false":
+ td_type = "BOOL"
+ td_tag_value = "False"
+ elif value.isdigit():
+ td_type = "DOUBLE"
+ td_tag_value = str(float(value))
+ else:
+ td_type = "DOUBLE"
+ if "e" in value.lower():
+ td_tag_value = str(float(value))
+ else:
+ td_tag_value = value
+ elif vtype == "tag":
+ td_type = "NCHAR"
+ td_tag_value = str(value)
+ return td_type, td_tag_value
+
+ def typeTrans(self, type_list):
+ type_num_list = []
+ for tp in type_list:
+ if tp.upper() == "TIMESTAMP":
+ type_num_list.append(9)
+ elif tp.upper() == "BOOL":
+ type_num_list.append(1)
+ elif tp.upper() == "TINYINT":
+ type_num_list.append(2)
+ elif tp.upper() == "SMALLINT":
+ type_num_list.append(3)
+ elif tp.upper() == "INT":
+ type_num_list.append(4)
+ elif tp.upper() == "BIGINT":
+ type_num_list.append(5)
+ elif tp.upper() == "FLOAT":
+ type_num_list.append(6)
+ elif tp.upper() == "DOUBLE":
+ type_num_list.append(7)
+ elif tp.upper() == "BINARY":
+ type_num_list.append(8)
+ elif tp.upper() == "NCHAR":
+ type_num_list.append(10)
+ elif tp.upper() == "BIGINT UNSIGNED":
+ type_num_list.append(14)
+ return type_num_list
+
+ def inputHandle(self, input_sql, ts_type, protocol=None):
+ input_sql_split_list = input_sql.split(" ")
+ if protocol == "telnet-tcp":
+ input_sql_split_list.pop(0)
+ stb_name = input_sql_split_list[0]
+ stb_tag_list = input_sql_split_list[3:]
+ stb_tag_list[-1] = stb_tag_list[-1].strip()
+ stb_col_value = input_sql_split_list[2]
+ ts_value = self.timeTrans(input_sql_split_list[1], ts_type)
+
+ tag_name_list = []
+ tag_value_list = []
+ td_tag_value_list = []
+ td_tag_type_list = []
+
+ col_name_list = []
+ col_value_list = []
+ td_col_value_list = []
+ td_col_type_list = []
+
+ for elm in stb_tag_list:
+ if self.smlChildTableName_value == "ID":
+ if "id=" in elm.lower():
+ tb_name = elm.split('=')[1]
+ else:
+ tag_name_list.append(elm.split("=")[0].lower())
+ tag_value_list.append(elm.split("=")[1])
+ tb_name = ""
+ td_tag_value_list.append(self.getTdTypeValue(elm.split("=")[1], "tag")[1])
+ td_tag_type_list.append(self.getTdTypeValue(elm.split("=")[1], "tag")[0])
+ else:
+ if "id" == elm.split("=")[0].lower():
+ tag_name_list.insert(0, elm.split("=")[0])
+ tag_value_list.insert(0, elm.split("=")[1])
+ td_tag_value_list.insert(0, self.getTdTypeValue(elm.split("=")[1], "tag")[1])
+ td_tag_type_list.insert(0, self.getTdTypeValue(elm.split("=")[1], "tag")[0])
+ else:
+ tag_name_list.append(elm.split("=")[0])
+ tag_value_list.append(elm.split("=")[1])
+ tb_name = ""
+ td_tag_value_list.append(self.getTdTypeValue(elm.split("=")[1], "tag")[1])
+ td_tag_type_list.append(self.getTdTypeValue(elm.split("=")[1], "tag")[0])
+
+ col_name_list.append('_value')
+ col_value_list.append(stb_col_value)
+
+ td_col_value_list.append(self.getTdTypeValue(stb_col_value)[1])
+ td_col_type_list.append(self.getTdTypeValue(stb_col_value)[0])
+
+ final_field_list = []
+ final_field_list.extend(col_name_list)
+ final_field_list.extend(tag_name_list)
+
+ final_type_list = []
+ final_type_list.append("TIMESTAMP")
+ final_type_list.extend(td_col_type_list)
+ final_type_list.extend(td_tag_type_list)
+ final_type_list = self.typeTrans(final_type_list)
+
+ final_value_list = []
+ final_value_list.append(ts_value)
+ final_value_list.extend(td_col_value_list)
+ final_value_list.extend(td_tag_value_list)
+ return final_value_list, final_field_list, final_type_list, stb_name, tb_name
+
+ def genFullTypeSql(self, stb_name="", tb_name="", value="", t0="", t1="127i8", t2="32767i16", t3="2147483647i32",
+ t4="9223372036854775807i64", t5="11.12345f32", t6="22.123456789f64", t7="\"binaryTagValue\"",
+ t8="L\"ncharTagValue\"", ts="1626006833641",
+ id_noexist_tag=None, id_change_tag=None, id_upper_tag=None, id_mixul_tag=None, id_double_tag=None,
+ t_add_tag=None, t_mul_tag=None, c_multi_tag=None, c_blank_tag=None, t_blank_tag=None,
+ chinese_tag=None, multi_field_tag=None, point_trans_tag=None, protocol=None, tcp_keyword_tag=None):
+ if stb_name == "":
+ stb_name = tdCom.getLongName(len=6, mode="letters")
+ if tb_name == "":
+ tb_name = f'{stb_name}_{random.randint(0, 65535)}_{random.randint(0, 65535)}'
+ if t0 == "":
+ t0 = "t"
+ if value == "":
+ value = random.choice(["f", "F", "false", "False", "t", "T", "true", "True", "TRUE", "FALSE"])
+ if id_upper_tag is not None:
+ id = "ID"
+ else:
+ id = "id"
+ if id_mixul_tag is not None:
+ id = random.choice(["iD", "Id"])
+ else:
+ id = "id"
+ sql_seq = f'{stb_name} {ts} {value} {id}={tb_name} t0={t0} t1={t1} t2={t2} t3={t3} t4={t4} t5={t5} t6={t6} t7={t7} t8={t8}'
+ if id_noexist_tag is not None:
+ sql_seq = f'{stb_name} {ts} {value} t0={t0} t1={t1} t2={t2} t3={t3} t4={t4} t5={t5} t6={t6} t7={t7} t8={t8}'
+ if t_add_tag is not None:
+ sql_seq = f'{stb_name} {ts} {value} t0={t0} t1={t1} t2={t2} t3={t3} t4={t4} t5={t5} t6={t6} t7={t7} t8={t8} t9={t8}'
+ if id_change_tag is not None:
+ sql_seq = f'{stb_name} {ts} {value} t0={t0} {id}={tb_name} t1={t1} t2={t2} t3={t3} t4={t4} t5={t5} t6={t6} t7={t7} t8={t8}'
+ if id_double_tag is not None:
+ sql_seq = f'{stb_name} {ts} {value} {id}=\"{tb_name}_1\" t0={t0} t1={t1} {id}=\"{tb_name}_2\" t2={t2} t3={t3} t4={t4} t5={t5} t6={t6} t7={t7} t8={t8}'
+ if t_add_tag is not None:
+ sql_seq = f'{stb_name} {ts} {value} {id}={tb_name} t0={t0} t1={t1} t2={t2} t3={t3} t4={t4} t5={t5} t6={t6} t7={t7} t8={t8} t11={t1} t10={t8}'
+ if t_mul_tag is not None:
+ sql_seq = f'{stb_name} {ts} {value} {id}={tb_name} t0={t0} t1={t1} t2={t2} t3={t3} t4={t4} t5={t5} t6={t6}'
+ if id_noexist_tag is not None:
+ sql_seq = f'{stb_name} {ts} {value} t0={t0} t1={t1} t2={t2} t3={t3} t4={t4} t5={t5} t6={t6}'
+ if c_multi_tag is not None:
+ sql_seq = f'{stb_name} {ts} {value} {value} {id}={tb_name} t0={t0} t1={t1} t2={t2} t3={t3} t4={t4} t5={t5} t6={t6}'
+ if c_blank_tag is not None:
+ sql_seq = f'{stb_name} {ts} {id}={tb_name} t0={t0} t1={t1} t2={t2} t3={t3} t4={t4} t5={t5} t6={t6} t7={t7} t8={t8}'
+ if t_blank_tag is not None:
+ sql_seq = f'{stb_name} {ts} {value}'
+ if chinese_tag is not None:
+ sql_seq = f'{stb_name} {ts} L"涛思数据" t0={t0} t1=L"涛思数据"'
+ if multi_field_tag is not None:
+ sql_seq = f'{stb_name} {ts} {value} {id}={tb_name} t0={t0} {value}'
+ if point_trans_tag is not None:
+ sql_seq = f'.point.trans.test {ts} {value} t0={t0}'
+ if tcp_keyword_tag is not None:
+ sql_seq = f'put {ts} {value} t0={t0}'
+ if protocol == "telnet-tcp":
+ sql_seq = 'put ' + sql_seq + '\n'
+ return sql_seq, stb_name
+
+ def genMulTagColStr(self, genType, count=1):
+ """
+ genType must be tag/col
+ """
+ tag_str = ""
+ col_str = ""
+ if genType == "tag":
+ for i in range(0, count):
+ if i < (count-1):
+ tag_str += f't{i}=f '
+ else:
+ tag_str += f't{i}=f'
+ return tag_str
+ if genType == "col":
+ col_str = "t"
+ return col_str
+
+ def genLongSql(self, tag_count):
+ stb_name = tdCom.getLongName(7, mode="letters")
+ tag_str = self.genMulTagColStr("tag", tag_count)
+ col_str = self.genMulTagColStr("col")
+ ts = "1626006833641"
+ long_sql = stb_name + ' ' + ts + ' ' + col_str + ' ' + ' ' + tag_str
+ return long_sql, stb_name
+
+ def getNoIdTbName(self, stb_name, protocol=None):
+ query_sql = f"select tbname from {stb_name}"
+ tb_name = self.resHandle(query_sql, True, protocol)[0][0]
+ return tb_name
+
+ def resHandle(self, query_sql, query_tag, protocol=None):
+ tdSql.execute('reset query cache')
+ if protocol == "telnet-tcp":
+ time.sleep(0.5)
+ row_info = tdSql.query(query_sql, query_tag)
+ col_info = tdSql.getColNameList(query_sql, query_tag)
+ res_row_list = []
+ sub_list = []
+ for row_mem in row_info:
+ for i in row_mem:
+ sub_list.append(str(i))
+ res_row_list.append(sub_list)
+ res_field_list_without_ts = col_info[0][1:]
+ res_type_list = col_info[1]
+ return res_row_list, res_field_list_without_ts, res_type_list
+
+ def resCmp(self, input_sql, stb_name, query_sql="select * from", condition="", ts=None, ts_type=None, id=True, none_check_tag=None, precision=None, protocol=None):
+ expect_list = self.inputHandle(input_sql, ts_type, protocol)
+ if protocol == "telnet-tcp":
+ tdCom.tcpClient(input_sql)
+ else:
+ if precision == None:
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, ts_type)
+ else:
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, precision)
+ query_sql = f"{query_sql} {stb_name} {condition}"
+ res_row_list, res_field_list_without_ts, res_type_list = self.resHandle(query_sql, True, protocol)
+ if ts == 0:
+ res_ts = self.dateToTs(res_row_list[0][0])
+ current_time = time.time()
+ if current_time - res_ts < 60:
+ tdSql.checkEqual(res_row_list[0][1:], expect_list[0][1:])
+ else:
+ print("timeout")
+ tdSql.checkEqual(res_row_list[0], expect_list[0])
+ else:
+ if none_check_tag is not None:
+ none_index_list = [i for i,x in enumerate(res_row_list[0]) if x=="None"]
+ none_index_list.reverse()
+ for j in none_index_list:
+ res_row_list[0].pop(j)
+ expect_list[0].pop(j)
+ tdSql.checkEqual(res_row_list[0], expect_list[0])
+ tdSql.checkEqual(res_field_list_without_ts, expect_list[1])
+ for i in range(len(res_type_list)):
+ tdSql.checkEqual(res_type_list[i], expect_list[2][i])
+
+ def initCheckCase(self, protocol=None):
+ """
+ normal tags and cols, one for every elm
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql, stb_name = self.genFullTypeSql(protocol=protocol)
+ self.resCmp(input_sql, stb_name, protocol=protocol)
+
+ def boolTypeCheckCase(self, protocol=None):
+ """
+ check all normal type
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ full_type_list = ["f", "F", "false", "False", "t", "T", "true", "True"]
+ for t_type in full_type_list:
+ input_sql, stb_name = self.genFullTypeSql(t0=t_type, protocol=protocol)
+ self.resCmp(input_sql, stb_name, protocol=protocol)
+
+ def symbolsCheckCase(self, protocol=None):
+ """
+ check symbols = `~!@#$%^&*()_-+={[}]\|:;'\",<.>/?
+ """
+ '''
+ please test :
+ binary_symbols = '\"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"\'\'"\"'
+ '''
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ binary_symbols = '"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"'
+ nchar_symbols = f'L{binary_symbols}'
+ input_sql1, stb_name1 = self.genFullTypeSql(value=binary_symbols, t7=binary_symbols, t8=nchar_symbols, protocol=protocol)
+ input_sql2, stb_name2 = self.genFullTypeSql(value=nchar_symbols, t7=binary_symbols, t8=nchar_symbols, protocol=protocol)
+ self.resCmp(input_sql1, stb_name1, protocol=protocol)
+ self.resCmp(input_sql2, stb_name2, protocol=protocol)
+
+ def tsCheckCase(self):
+ """
+ test ts list --> ["1626006833640ms", "1626006834s", "1626006822639022"]
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql, stb_name = self.genFullTypeSql(ts=1626006833640)
+ self.resCmp(input_sql, stb_name, ts_type=TDSmlTimestampType.MILLI_SECOND.value)
+ input_sql, stb_name = self.genFullTypeSql(ts=1626006833640)
+ self.resCmp(input_sql, stb_name, ts_type=None)
+ input_sql, stb_name = self.genFullTypeSql(ts=1626006834)
+ self.resCmp(input_sql, stb_name, ts_type=TDSmlTimestampType.SECOND.value)
+
+ tdSql.execute(f"drop database if exists test_ts")
+ tdSql.execute(f"create database if not exists test_ts precision 'ms'")
+ tdSql.execute("use test_ts")
+ input_sql = ['test_ms 1626006833640 t t0=t', 'test_ms 1626006833641 f t0=t']
+ self._conn.schemaless_insert(input_sql, TDSmlProtocolType.TELNET.value, None)
+ res = tdSql.query('select * from test_ms', True)
+ tdSql.checkEqual(str(res[0][0]), "2021-07-11 20:33:53.640000")
+ tdSql.checkEqual(str(res[1][0]), "2021-07-11 20:33:53.641000")
+
+ def openTstbTelnetTsCheckCase(self):
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql = f'{tdCom.getLongName(len=10, mode="letters")} 0 127 t0=127 t1=32767I16 t2=2147483647I32 t3=9223372036854775807 t4=11.12345027923584F32 t5=22.123456789F64'
+ stb_name = input_sql.split(" ")[0]
+ self.resCmp(input_sql, stb_name, ts=0)
+ input_sql = f'{tdCom.getLongName(len=10, mode="letters")} 1626006833640 127 t0=127 t1=32767I16 t2=2147483647I32 t3=9223372036854775807 t4=11.12345027923584F32 t5=22.123456789F64'
+ stb_name = input_sql.split(" ")[0]
+ self.resCmp(input_sql, stb_name, ts_type=TDSmlTimestampType.MILLI_SECOND.value)
+ input_sql = f'{tdCom.getLongName(len=10, mode="letters")} 1626006834 127 t0=127 t1=32767I16 t2=2147483647I32 t3=9223372036854775807 t4=11.12345027923584F32 t5=22.123456789F64'
+ stb_name = input_sql.split(" ")[0]
+ self.resCmp(input_sql, stb_name, ts_type=TDSmlTimestampType.SECOND.value)
+ for ts in [1, 12, 123, 1234, 12345, 123456, 1234567, 12345678, 162600683, 16260068341, 162600683412, 16260068336401]:
+ try:
+ input_sql = f'{tdCom.getLongName(len=10, mode="letters")} {ts} 127 t0=127 t1=32767I16 t2=2147483647I32 t3=9223372036854775807 t4=11.12345027923584F32 t5=22.123456789F64'
+ self._conn.schemaless_insert(input_sql, TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+
+ def idSeqCheckCase(self, protocol=None):
+ """
+ check id.index in tags
+ eg: t0=**,id=**,t1=**
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql, stb_name = self.genFullTypeSql(id_change_tag=True, protocol=protocol)
+ self.resCmp(input_sql, stb_name, protocol=protocol)
+
+ def idLetterCheckCase(self, protocol=None):
+ """
+ check id param
+ eg: id and ID
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql, stb_name = self.genFullTypeSql(id_upper_tag=True, protocol=protocol)
+ self.resCmp(input_sql, stb_name, protocol=protocol)
+ input_sql, stb_name = self.genFullTypeSql(id_mixul_tag=True, protocol=protocol)
+ self.resCmp(input_sql, stb_name, protocol=protocol)
+ input_sql, stb_name = self.genFullTypeSql(id_change_tag=True, id_upper_tag=True, protocol=protocol)
+ self.resCmp(input_sql, stb_name, protocol=protocol)
+
+ def noIdCheckCase(self, protocol=None):
+ """
+ id not exist
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql, stb_name = self.genFullTypeSql(id_noexist_tag=True, protocol=protocol)
+ self.resCmp(input_sql, stb_name, protocol=protocol)
+ query_sql = f"select tbname from {stb_name}"
+ res_row_list = self.resHandle(query_sql, True)[0]
+ if len(res_row_list[0][0]) > 0:
+ tdSql.checkColNameList(res_row_list, res_row_list)
+ else:
+ tdSql.checkColNameList(res_row_list, "please check noIdCheckCase")
+
+ def maxColTagCheckCase(self):
+ """
+ max tag count is 128
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ for input_sql in [self.genLongSql(128)[0]]:
+ tdCom.cleanTb()
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ for input_sql in [self.genLongSql(129)[0]]:
+ tdCom.cleanTb()
+ try:
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+
+ def stbTbNameCheckCase(self, protocol=None):
+ """
+ test illegal id name
+ mix "`~!@#$¥%^&*()-+{}|[]、「」【】:;《》<>?"
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ rstr = list("~!@#$¥%^&*()-+{}|[]、「」【】:;《》<>?")
+ for i in rstr:
+ input_sql, stb_name = self.genFullTypeSql(tb_name=f"\"aaa{i}bbb\"", protocol=protocol)
+ self.resCmp(input_sql, f'`{stb_name}`', protocol=protocol)
+ tdSql.execute(f'drop table if exists `{stb_name}`')
+
+ def idStartWithNumCheckCase(self, protocol=None):
+ """
+ id is start with num
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql, stb_name = self.genFullTypeSql(tb_name="1aaabbb", protocol=protocol)
+ self.resCmp(input_sql, stb_name, protocol=protocol)
+
+ def nowTsCheckCase(self):
+ """
+ check now unsupported
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql = self.genFullTypeSql(ts="now")[0]
+ try:
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+
+ def dateFormatTsCheckCase(self):
+ """
+ check date format ts unsupported
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql = self.genFullTypeSql(ts="2021-07-21\ 19:01:46.920")[0]
+ try:
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+
+ def illegalTsCheckCase(self):
+ """
+ check ts format like 16260068336390us19
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql = self.genFullTypeSql(ts="16260068336390us19")[0]
+ try:
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+
+ def tbnameCheckCase(self):
+ """
+ check length 192
+ check upper tbname
+ chech upper tag
+ length of stb_name tb_name <= 192
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ stb_name_192 = tdCom.getLongName(len=192, mode="letters")
+ tb_name_192 = tdCom.getLongName(len=192, mode="letters")
+ tdCom.cleanTb()
+ input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name_192, tb_name=tb_name_192)
+ self.resCmp(input_sql, stb_name)
+ tdSql.query(f'select * from {stb_name}')
+ tdSql.checkRows(1)
+ if self.smlChildTableName_value == "ID":
+ for input_sql in [self.genFullTypeSql(stb_name=tdCom.getLongName(len=193, mode="letters"), tb_name=tdCom.getLongName(len=5, mode="letters"))[0], self.genFullTypeSql(tb_name=tdCom.getLongName(len=193, mode="letters"))[0]]:
+ try:
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+ input_sql = 'Abcdffgg 1626006833640 False T1=127i8 id=Abcddd'
+ else:
+ input_sql = self.genFullTypeSql(stb_name=tdCom.getLongName(len=193, mode="letters"), tb_name=tdCom.getLongName(len=5, mode="letters"))[0]
+ try:
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+ input_sql = 'Abcdffgg 1626006833640 False T1=127i8'
+ stb_name = f'`{input_sql.split(" ")[0]}`'
+ self.resCmp(input_sql, stb_name)
+ tdSql.execute('drop table `Abcdffgg`')
+
+ def tagNameLengthCheckCase(self):
+ """
+ check tag name limit <= 62
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ tag_name = tdCom.getLongName(61, "letters")
+ tag_name = f'T{tag_name}'
+ stb_name = tdCom.getLongName(7, "letters")
+ input_sql = f'{stb_name} 1626006833640 L"bcdaaa" {tag_name}=f'
+ self.resCmp(input_sql, stb_name)
+ input_sql = f'{stb_name} 1626006833640 L"gggcdaaa" {tdCom.getLongName(65, "letters")}=f'
+ try:
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+
+ def tagValueLengthCheckCase(self):
+ """
+ check full type tag value limit
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ # nchar
+ # * legal nchar could not be larger than 16374/4
+ stb_name = tdCom.getLongName(7, "letters")
+ input_sql = f'{stb_name} 1626006833640 t t0=t t1={tdCom.getLongName(4093, "letters")}'
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+
+ input_sql = f'{stb_name} 1626006833640 t t0=t t1={tdCom.getLongName(4094, "letters")}'
+ try:
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+
+ def colValueLengthCheckCase(self):
+ """
+ check full type col value limit
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ # i8
+ for value in ["-128i8", "127i8"]:
+ input_sql, stb_name = self.genFullTypeSql(value=value)
+ self.resCmp(input_sql, stb_name)
+ tdCom.cleanTb()
+ for value in ["-129i8", "128i8"]:
+ input_sql = self.genFullTypeSql(value=value)[0]
+ try:
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+ # i16
+ tdCom.cleanTb()
+ for value in ["-32768i16"]:
+ input_sql, stb_name = self.genFullTypeSql(value=value)
+ self.resCmp(input_sql, stb_name)
+ tdCom.cleanTb()
+ for value in ["-32769i16", "32768i16"]:
+ input_sql = self.genFullTypeSql(value=value)[0]
+ try:
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+
+ # i32
+ tdCom.cleanTb()
+ for value in ["-2147483648i32"]:
+ input_sql, stb_name = self.genFullTypeSql(value=value)
+ self.resCmp(input_sql, stb_name)
+ tdCom.cleanTb()
+ for value in ["-2147483649i32", "2147483648i32"]:
+ input_sql = self.genFullTypeSql(value=value)[0]
+ try:
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+
+ # i64
+ tdCom.cleanTb()
+ for value in ["-9223372036854775808i64"]:
+ input_sql, stb_name = self.genFullTypeSql(value=value)
+ self.resCmp(input_sql, stb_name)
+ tdCom.cleanTb()
+ for value in ["-9223372036854775809i64", "9223372036854775808i64"]:
+ input_sql = self.genFullTypeSql(value=value)[0]
+ try:
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+
+ # f32
+ tdCom.cleanTb()
+ for value in [f"{-3.4028234663852885981170418348451692544*(10**38)}f32", f"{3.4028234663852885981170418348451692544*(10**38)}f32"]:
+ input_sql, stb_name = self.genFullTypeSql(value=value)
+ self.resCmp(input_sql, stb_name)
+ # * limit set to 4028234664*(10**38)
+ tdCom.cleanTb()
+ for value in [f"{-3.4028234664*(10**38)}f32", f"{3.4028234664*(10**38)}f32"]:
+ input_sql = self.genFullTypeSql(value=value)[0]
+ try:
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+
+ # f64
+ tdCom.cleanTb()
+ for value in [f'{-1.79769313486231570814527423731704356798070567525844996598917476803157260780*(10**308)}f64', f'{-1.79769313486231570814527423731704356798070567525844996598917476803157260780*(10**308)}f64']:
+ input_sql, stb_name = self.genFullTypeSql(value=value)
+ self.resCmp(input_sql, stb_name)
+ # # * limit set to 1.797693134862316*(10**308)
+ # tdCom.cleanTb()
+ # for value in [f'{-1.797693134862316*(10**308)}f64', f'{-1.797693134862316*(10**308)}f64']:
+ # input_sql = self.genFullTypeSql(value=value)[0]
+ # try:
+ # self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ # raise Exception("should not reach here")
+ # except SchemalessError as err:
+ # tdSql.checkNotEqual(err.errno, 0)
+
+ # # # binary
+ # tdCom.cleanTb()
+ # stb_name = tdCom.getLongName(7, "letters")
+ # input_sql = f'{stb_name} 1626006833640 "{tdCom.getLongName(16374, "letters")}" t0=t'
+ # self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+
+ # tdCom.cleanTb()
+ # input_sql = f'{stb_name} 1626006833640 "{tdCom.getLongName(16375, "letters")}" t0=t'
+ # try:
+ # self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ # raise Exception("should not reach here")
+ # except SchemalessError as err:
+ # tdSql.checkNotEqual(err.errno, 0)
+
+ # # nchar
+ # # * legal nchar could not be larger than 16374/4
+ # tdCom.cleanTb()
+ # stb_name = tdCom.getLongName(7, "letters")
+ # input_sql = f'{stb_name} 1626006833640 L"{tdCom.getLongName(4093, "letters")}" t0=t'
+ # self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+
+ # tdCom.cleanTb()
+ # input_sql = f'{stb_name} 1626006833640 L"{tdCom.getLongName(4094, "letters")}" t0=t'
+ # try:
+ # self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ # raise Exception("should not reach here")
+ # except SchemalessError as err:
+ # tdSql.checkNotEqual(err.errno, 0)
+
+ def tagColIllegalValueCheckCase(self):
+
+ """
+ test illegal tag col value
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ # bool
+ for i in ["TrUe", "tRue", "trUe", "truE", "FalsE", "fAlse", "faLse", "falSe", "falsE"]:
+ input_sql1, stb_name = self.genFullTypeSql(t0=i)
+ self.resCmp(input_sql1, stb_name)
+ input_sql2, stb_name = self.genFullTypeSql(value=i)
+ self.resCmp(input_sql2, stb_name)
+
+ # i8 i16 i32 i64 f32 f64
+ for input_sql in [
+ self.genFullTypeSql(value="1s2i8")[0],
+ self.genFullTypeSql(value="1s2i16")[0],
+ self.genFullTypeSql(value="1s2i32")[0],
+ self.genFullTypeSql(value="1s2i64")[0],
+ self.genFullTypeSql(value="11.1s45f32")[0],
+ self.genFullTypeSql(value="11.1s45f64")[0],
+ ]:
+ try:
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+
+ # check accepted binary and nchar symbols
+ # # * ~!@#$¥%^&*()-+={}|[]、「」:;
+ for symbol in list('~!@#$¥%^&*()-+={}|[]、「」:;'):
+ input_sql1 = f'{tdCom.getLongName(7, "letters")} 1626006833640 "abc{symbol}aaa" t0=t'
+ input_sql2 = f'{tdCom.getLongName(7, "letters")} 1626006833640 t t0=t t1="abc{symbol}aaa"'
+ self._conn.schemaless_insert([input_sql1], TDSmlProtocolType.TELNET.value, None)
+ # self._conn.schemaless_insert([input_sql2], TDSmlProtocolType.TELNET.value, None)
+
+ def blankCheckCase(self):
+ '''
+ check blank case
+ '''
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ # input_sql_list = [f'{tdCom.getLongName(7, "letters")} 1626006833640 "abc aaa" t0=t',
+ # f'{tdCom.getLongName(7, "letters")} 1626006833640 t t0="abaaa"',
+ # f'{tdCom.getLongName(7, "letters")} 1626006833640 t t0=L"abaaa"',
+ # f'{tdCom.getLongName(7, "letters")} 1626006833640 L"aba aa" t0=L"abcaaa3" ']
+ input_sql_list = [f'{tdCom.getLongName(7, "letters")} 1626006833640 t t0="abaaa"',
+ f'{tdCom.getLongName(7, "letters")} 1626006833640 t t0=L"abaaa"']
+ for input_sql in input_sql_list:
+ stb_name = input_sql.split(" ")[0]
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ tdSql.query(f'select * from {stb_name}')
+ tdSql.checkRows(1)
+
+ def duplicateIdTagColInsertCheckCase(self):
+ """
+ check duplicate Id Tag Col
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql_id = self.genFullTypeSql(id_double_tag=True)[0]
+ try:
+ self._conn.schemaless_insert([input_sql_id], TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+
+ input_sql = self.genFullTypeSql()[0]
+ input_sql_tag = input_sql.replace("t5", "t6")
+ try:
+ self._conn.schemaless_insert([input_sql_tag], TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+
+ ##### stb exist #####
+ @tdCom.smlPass
+ def noIdStbExistCheckCase(self):
+ """
+ case no id when stb exist
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql, stb_name = self.genFullTypeSql(tb_name="sub_table_0123456", t0="f", value="f")
+ self.resCmp(input_sql, stb_name)
+ input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, id_noexist_tag=True, t0="f", value="f")
+ self.resCmp(input_sql, stb_name, condition='where tbname like "t_%"')
+ tdSql.query(f"select * from {stb_name}")
+ tdSql.checkRows(2)
+
+ def duplicateInsertExistCheckCase(self):
+ """
+ check duplicate insert when stb exist
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql, stb_name = self.genFullTypeSql()
+ self.resCmp(input_sql, stb_name)
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ self.resCmp(input_sql, stb_name)
+
+ @tdCom.smlPass
+ def tagColBinaryNcharLengthCheckCase(self):
+ """
+ check length increase
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql, stb_name = self.genFullTypeSql()
+ self.resCmp(input_sql, stb_name)
+ tb_name = tdCom.getLongName(5, "letters")
+ input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name,t7="\"binaryTagValuebinaryTagValue\"", t8="L\"ncharTagValuencharTagValue\"")
+ self.resCmp(input_sql, stb_name, condition=f'where tbname like "{tb_name}"')
+
+ @tdCom.smlPass
+ def tagColAddDupIDCheckCase(self):
+ """
+ check tag count add, stb and tb duplicate
+ * tag: alter table ...
+ * col: when update==0 and ts is same, unchange
+ * so this case tag&&value will be added,
+ * col is added without value when update==0
+ * col is added with value when update==1
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ tb_name = tdCom.getLongName(7, "letters")
+ for db_update_tag in [0, 1]:
+ if db_update_tag == 1 :
+ self.createDb("test_update", db_update_tag=db_update_tag)
+ input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, t0="t", value="t")
+ self.resCmp(input_sql, stb_name)
+ input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t0="t", value="f", t_add_tag=True)
+ if db_update_tag == 1 :
+ self.resCmp(input_sql, stb_name, condition=f'where tbname like "{tb_name}"', none_check_tag=True)
+ tdSql.query(f'select * from {stb_name} where tbname like "{tb_name}"')
+ tdSql.checkData(0, 11, None)
+ tdSql.checkData(0, 12, None)
+ else:
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ tdSql.query(f'select * from {stb_name} where tbname like "{tb_name}"')
+ tdSql.checkData(0, 1, True)
+ tdSql.checkData(0, 11, None)
+ tdSql.checkData(0, 12, None)
+ self.createDb()
+
+ @tdCom.smlPass
+ def tagColAddCheckCase(self):
+ """
+ check tag count add
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ tb_name = tdCom.getLongName(7, "letters")
+ input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, t0="f", value="f")
+ self.resCmp(input_sql, stb_name)
+ tb_name_1 = tdCom.getLongName(7, "letters")
+ input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name_1, t0="f", value="f", t_add_tag=True)
+ self.resCmp(input_sql, stb_name, condition=f'where tbname like "{tb_name_1}"')
+ res_row_list = self.resHandle(f"select t10,t11 from {tb_name}", True)[0]
+ tdSql.checkEqual(res_row_list[0], ['None', 'None'])
+ self.resCmp(input_sql, stb_name, condition=f'where tbname like "{tb_name}"', none_check_tag=True)
+
+ def tagMd5Check(self):
+ """
+ condition: stb not change
+ insert two table, keep tag unchange, change col
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql, stb_name = self.genFullTypeSql(t0="f", value="f", id_noexist_tag=True)
+ self.resCmp(input_sql, stb_name)
+ tb_name1 = self.getNoIdTbName(stb_name)
+ input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, t0="f", value="f", id_noexist_tag=True)
+ self.resCmp(input_sql, stb_name)
+ tb_name2 = self.getNoIdTbName(stb_name)
+ tdSql.query(f"select * from {stb_name}")
+ tdSql.checkRows(1)
+ tdSql.checkEqual(tb_name1, tb_name2)
+ input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, t0="f", value="f", id_noexist_tag=True, t_add_tag=True)
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ tb_name3 = self.getNoIdTbName(stb_name)
+ tdSql.query(f"select * from {stb_name}")
+ tdSql.checkRows(2)
+ tdSql.checkNotEqual(tb_name1, tb_name3)
+
+ # * tag nchar max is 16374/4, col+ts nchar max 49151
+ def tagColNcharMaxLengthCheckCase(self):
+ """
+ check nchar length limit
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ stb_name = tdCom.getLongName(7, "letters")
+ input_sql = f'{stb_name} 1626006833640 f t2={tdCom.getLongName(1, "letters")}'
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+
+ # * legal nchar could not be larger than 16374/4
+ input_sql = f'{stb_name} 1626006833640 f t1={tdCom.getLongName(4093, "letters")} t2={tdCom.getLongName(1, "letters")}'
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ tdSql.query(f"select * from {stb_name}")
+ tdSql.checkRows(2)
+ input_sql = f'{stb_name} 1626006833640 f t1={tdCom.getLongName(4093, "letters")} t2={tdCom.getLongName(2, "letters")}'
+ try:
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+ tdSql.query(f"select * from {stb_name}")
+ tdSql.checkRows(2)
+
+ def batchInsertCheckCase(self):
+ """
+ test batch insert
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ stb_name = tdCom.getLongName(8, "letters")
+ tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)')
+
+ lines = ["st123456 1626006833640 1i64 t1=3i64 t2=4f64 t3=\"t3\"",
+ "st123456 1626006833641 2i64 t1=4i64 t3=\"t4\" t2=5f64 t4=5f64",
+ f'{stb_name} 1626006833642 3i64 t2=5f64 t3=L\"ste\"',
+ "stf567890 1626006833643 4i64 t1=4i64 t3=\"t4\" t2=5f64 t4=5f64",
+ "st123456 1626006833644 5i64 t1=4i64 t2=5f64 t3=\"t4\"",
+ f'{stb_name} 1626006833645 6i64 t2=5f64 t3=L\"ste2\"',
+ f'{stb_name} 1626006833646 7i64 t2=5f64 t3=L\"ste2\"',
+ "st123456 1626006833647 8i64 t1=4i64 t3=\"t4\" t2=5f64 t4=5f64",
+ "st123456 1626006833648 9i64 t1=4i64 t3=\"t4\" t2=5f64 t4=5f64"
+ ]
+ self._conn.schemaless_insert(lines, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.MILLI_SECOND.value)
+ tdSql.query('show stables')
+ tdSql.checkRows(3)
+ tdSql.query('show tables')
+ tdSql.checkRows(6)
+ tdSql.query('select * from st123456')
+ tdSql.checkRows(5)
+
+ def multiInsertCheckCase(self, count):
+ """
+ test multi insert
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ sql_list = []
+ stb_name = tdCom.getLongName(8, "letters")
+ tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 nchar(10))')
+ for i in range(count):
+ input_sql = self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True)[0]
+ sql_list.append(input_sql)
+ self._conn.schemaless_insert(sql_list, TDSmlProtocolType.TELNET.value, TDSmlTimestampType.MILLI_SECOND.value)
+ tdSql.query('show tables')
+ tdSql.checkRows(count)
+
+ def batchErrorInsertCheckCase(self):
+ """
+ test batch error insert
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ stb_name = tdCom.getLongName(8, "letters")
+ lines = ["st123456 1626006833640 3i 64 t1=3i64 t2=4f64 t3=\"t3\"",
+ f"{stb_name} 1626056811823316532ns tRue t2=5f64 t3=L\"ste\""]
+ try:
+ self._conn.schemaless_insert(lines, TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+
+ def multiColsInsertCheckCase(self):
+ """
+ test multi cols insert
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql = self.genFullTypeSql(c_multi_tag=True)[0]
+ try:
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+
+ def blankColInsertCheckCase(self):
+ """
+ test blank col insert
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql = self.genFullTypeSql(c_blank_tag=True)[0]
+ try:
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+
+ def blankTagInsertCheckCase(self):
+ """
+ test blank tag insert
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql = self.genFullTypeSql(t_blank_tag=True)[0]
+ try:
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+
+ def chineseCheckCase(self):
+ """
+ check nchar ---> chinese
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql, stb_name = self.genFullTypeSql(chinese_tag=True)
+ self.resCmp(input_sql, stb_name)
+
+ def multiFieldCheckCase(self):
+ '''
+ multi_field
+ '''
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql = self.genFullTypeSql(multi_field_tag=True)[0]
+ try:
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ raise Exception("should not reach here")
+ except SchemalessError as err:
+ tdSql.checkNotEqual(err.errno, 0)
+
+ def spellCheckCase(self):
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ stb_name = tdCom.getLongName(8, "letters")
+ input_sql_list = [f'{stb_name}_1 1626006833640 127I8 t0=127I8 t1=32767I16 t2=2147483647I32 t3=9223372036854775807I64 t4=11.12345027923584F32 t5=22.123456789F64',
+ f'{stb_name}_2 1626006833640 32767I16 t0=127I8 t1=32767I16 t2=2147483647I32 t3=9223372036854775807I64 t4=11.12345027923584F32 t5=22.123456789F64',
+ f'{stb_name}_3 1626006833640 2147483647I32 t0=127I8 t1=32767I16 t2=2147483647I32 t3=9223372036854775807I64 t4=11.12345027923584F32 t5=22.123456789F64',
+ f'{stb_name}_4 1626006833640 9223372036854775807I64 t0=127I8 t1=32767I16 t2=2147483647I32 t3=9223372036854775807I64 t4=11.12345027923584F32 t5=22.123456789F64',
+ f'{stb_name}_5 1626006833640 11.12345027923584F32 t0=127I8 t1=32767I16 t2=2147483647I32 t3=9223372036854775807I64 t4=11.12345027923584F32 t5=22.123456789F64',
+ f'{stb_name}_6 1626006833640 22.123456789F64 t0=127I8 t1=32767I16 t2=2147483647I32 t3=9223372036854775807I64 t4=11.12345027923584F32 t5=22.123456789F64',
+ f'{stb_name}_7 1626006833640 22.123456789F64 t0=127I8 t1=32767I16 t2=2147483647I32 t3=9223372036854775807I64 t4=11.12345027923584F32 t5=22.123456789F64',
+ f'{stb_name}_8 1626006833640 22.123456789F64 t0=127I8 t1=32767I16 t2=2147483647I32 t3=9223372036854775807I64 t4=11.12345027923584F32 t5=22.123456789F64',
+ f'{stb_name}_9 1626006833640 22.123456789F64 t0=127I8 t1=32767I16 t2=2147483647I32 t3=9223372036854775807I64 t4=11.12345027923584F32 t5=22.123456789F64',
+ f'{stb_name}_10 1626006833640 22.123456789F64 t0=127I8 t1=32767I16 t2=2147483647I32 t3=9223372036854775807I64 t4=11.12345027923584F32 t5=22.123456789F64']
+ for input_sql in input_sql_list:
+ stb_name = input_sql.split(' ')[0]
+ self.resCmp(input_sql, stb_name)
+
+ def pointTransCheckCase(self, protocol=None):
+ """
+ metric value "." trans to "_"
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql = self.genFullTypeSql(point_trans_tag=True, protocol=protocol)[0]
+ if protocol == 'telnet-tcp':
+ stb_name = f'`{input_sql.split(" ")[1]}`'
+ else:
+ stb_name = f'`{input_sql.split(" ")[0]}`'
+ self.resCmp(input_sql, stb_name, protocol=protocol)
+ tdSql.execute("drop table `.point.trans.test`")
+
+ def defaultTypeCheckCase(self):
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ stb_name = tdCom.getLongName(8, "letters")
+ input_sql_list = [f'{stb_name}_1 1626006833640 9223372036854775807 t0=f t1=127 t2=32767i16 t3=2147483647i32 t4=9223372036854775807 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"', \
+ f'{stb_name}_2 1626006833641 22.123456789 t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789 t7="vozamcts" t8=L"ncharTagValue"', \
+ f'{stb_name}_3 1626006833642 10e5F32 t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=10e5F64 t7="vozamcts" t8=L"ncharTagValue"', \
+ f'{stb_name}_4 1626006833643 10.0e5F64 t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=10.0e5F32 t7="vozamcts" t8=L"ncharTagValue"', \
+ f'{stb_name}_5 1626006833644 -10.0e5 t0=f t1=127i8 t2=32767I16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=-10.0e5 t7="vozamcts" t8=L"ncharTagValue"']
+ for input_sql in input_sql_list:
+ stb_name = input_sql.split(" ")[0]
+ self.resCmp(input_sql, stb_name)
+
+ def tbnameTagsColsNameCheckCase(self):
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ if self.smlChildTableName_value == "ID":
+ input_sql = 'rFa$sta 1626006834 9223372036854775807 id=rFas$ta_1 Tt!0=true tT@1=127Ii8 t#2=32767i16 "t$3"=2147483647i32 t%4=9223372036854775807i64 t^5=11.12345f32 t&6=22.123456789f64 t*7=\"ddzhiksj\" t!@#$%^&*()_+[];:<>?,9=L\"ncharTagValue\"'
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ query_sql = 'select * from `rFa$sta`'
+ query_res = tdSql.query(query_sql, True)
+ tdSql.checkEqual(query_res, [(datetime.datetime(2021, 7, 11, 20, 33, 54), 9.223372036854776e+18, 'true', '127Ii8', '32767i16', '2147483647i32', '9223372036854775807i64', '11.12345f32', '22.123456789f64', '"ddzhiksj"', 'L"ncharTagValue"')])
+ col_tag_res = tdSql.getColNameList(query_sql)
+ tdSql.checkEqual(col_tag_res, ['ts', '_value', 'tt!0', 'tt@1', 't#2', '"t$3"', 't%4', 't^5', 't&6', 't*7', 't!@#$%^&*()_+[];:<>?,9'])
+ tdSql.execute('drop table `rFa$sta`')
+ else:
+ input_sql = 'rFa$sta 1626006834 9223372036854775807 Tt!0=true tT@1=127Ii8 t#2=32767i16 "t$3"=2147483647i32 t%4=9223372036854775807i64 t^5=11.12345f32 t&6=22.123456789f64 t*7=\"ddzhiksj\" t!@#$%^&*()_+[];:<>?,9=L\"ncharTagValue\"'
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ query_sql = 'select * from `rFa$sta`'
+ query_res = tdSql.query(query_sql, True)
+ tdSql.checkEqual(query_res, [(datetime.datetime(2021, 7, 11, 20, 33, 54), 9.223372036854776e+18, '2147483647i32', 'L"ncharTagValue"', '32767i16', '9223372036854775807i64', '22.123456789f64', '"ddzhiksj"', '11.12345f32', 'true', '127Ii8')])
+ col_tag_res = tdSql.getColNameList(query_sql)
+ tdSql.checkEqual(col_tag_res, ['_ts', '_value', '"t$3"', 't!@#$%^&*()_+[];:<>?,9', 't#2', 't%4', 't&6', 't*7', 't^5', 'Tt!0', 'tT@1'])
+ tdSql.execute('drop table `rFa$sta`')
+
+ def tcpKeywordsCheckCase(self, protocol="telnet-tcp"):
+ """
+ stb = "put"
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql = self.genFullTypeSql(tcp_keyword_tag=True, protocol=protocol)[0]
+ stb_name = f'`{input_sql.split(" ")[1]}`'
+ self.resCmp(input_sql, stb_name, protocol=protocol)
+
+ def genSqlList(self, count=5, stb_name="", tb_name=""):
+ """
+ stb --> supertable
+ tb --> table
+ ts --> timestamp, same default
+ col --> column, same default
+ tag --> tag, same default
+ d --> different
+ s --> same
+ a --> add
+ m --> minus
+ """
+ d_stb_d_tb_list = list()
+ s_stb_s_tb_list = list()
+ s_stb_s_tb_a_tag_list = list()
+ s_stb_s_tb_m_tag_list = list()
+ s_stb_d_tb_list = list()
+ s_stb_d_tb_m_tag_list = list()
+ s_stb_d_tb_a_tag_list = list()
+ s_stb_s_tb_d_ts_list = list()
+ s_stb_s_tb_d_ts_m_tag_list = list()
+ s_stb_s_tb_d_ts_a_tag_list = list()
+ s_stb_d_tb_d_ts_list = list()
+ s_stb_d_tb_d_ts_m_tag_list = list()
+ s_stb_d_tb_d_ts_a_tag_list = list()
+ for i in range(count):
+ d_stb_d_tb_list.append(self.genFullTypeSql(t0="f", value="f"))
+ s_stb_s_tb_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"'))
+ s_stb_s_tb_a_tag_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', t_add_tag=True))
+ s_stb_s_tb_m_tag_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', t_mul_tag=True))
+ s_stb_d_tb_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True))
+ s_stb_d_tb_m_tag_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True, t_mul_tag=True))
+ s_stb_d_tb_a_tag_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True, t_add_tag=True))
+ s_stb_s_tb_d_ts_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', ts=0))
+ s_stb_s_tb_d_ts_m_tag_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', ts=0, t_mul_tag=True))
+ s_stb_s_tb_d_ts_a_tag_list.append(self.genFullTypeSql(stb_name=stb_name, tb_name=tb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', ts=0, t_add_tag=True))
+ s_stb_d_tb_d_ts_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True, ts=0))
+ s_stb_d_tb_d_ts_m_tag_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True, ts=0, t_mul_tag=True))
+ s_stb_d_tb_d_ts_a_tag_list.append(self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', value=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True, ts=0, t_add_tag=True))
+
+ return d_stb_d_tb_list, s_stb_s_tb_list, s_stb_s_tb_a_tag_list, s_stb_s_tb_m_tag_list, \
+ s_stb_d_tb_list, s_stb_d_tb_m_tag_list, s_stb_d_tb_a_tag_list, s_stb_s_tb_d_ts_list, \
+ s_stb_s_tb_d_ts_m_tag_list, s_stb_s_tb_d_ts_a_tag_list, s_stb_d_tb_d_ts_list, \
+ s_stb_d_tb_d_ts_m_tag_list, s_stb_d_tb_d_ts_a_tag_list
+
+
+ def genMultiThreadSeq(self, sql_list):
+ tlist = list()
+ for insert_sql in sql_list:
+ t = threading.Thread(target=self._conn.schemaless_insert,args=([insert_sql[0]], TDSmlProtocolType.TELNET.value, None))
+ tlist.append(t)
+ return tlist
+
+ def multiThreadRun(self, tlist):
+ for t in tlist:
+ t.start()
+ for t in tlist:
+ t.join()
+
+ def stbInsertMultiThreadCheckCase(self):
+ """
+ thread input different stb
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql = self.genSqlList()[0]
+ print(input_sql)
+ self.multiThreadRun(self.genMultiThreadSeq(input_sql))
+ tdSql.query(f"show tables;")
+ tdSql.checkRows(5)
+
+ def sStbStbDdataInsertMultiThreadCheckCase(self):
+ """
+ thread input same stb tb, different data, result keep first data
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ tb_name = tdCom.getLongName(7, "letters")
+ input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"")
+ self.resCmp(input_sql, stb_name)
+ s_stb_s_tb_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[1]
+ self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_list))
+ tdSql.query(f"show tables;")
+ tdSql.checkRows(1) if self.smlChildTableName_value == "ID" else tdSql.checkRows(6)
+ if self.smlChildTableName_value == "ID":
+ expected_tb_name = self.getNoIdTbName(stb_name)[0]
+ tdSql.checkEqual(tb_name, expected_tb_name)
+ tdSql.query(f"select * from {stb_name};")
+ tdSql.checkRows(1) if self.smlChildTableName_value == "ID" else tdSql.checkRows(6)
+
+ def sStbStbDdataAtInsertMultiThreadCheckCase(self):
+ """
+ thread input same stb tb, different data, add columes and tags, result keep first data
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ tb_name = tdCom.getLongName(7, "letters")
+ input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"")
+ self.resCmp(input_sql, stb_name)
+ s_stb_s_tb_a_tag_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[2]
+ self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_a_tag_list))
+ tdSql.query(f"show tables;")
+ tdSql.checkRows(1) if self.smlChildTableName_value == "ID" else tdSql.checkRows(6)
+ if self.smlChildTableName_value == "ID":
+ expected_tb_name = self.getNoIdTbName(stb_name)[0]
+ tdSql.checkEqual(tb_name, expected_tb_name)
+ tdSql.query(f"select * from {stb_name};")
+ tdSql.checkRows(1) if self.smlChildTableName_value == "ID" else tdSql.checkRows(6)
+
+ def sStbStbDdataMtInsertMultiThreadCheckCase(self):
+ """
+ thread input same stb tb, different data, minus columes and tags, result keep first data
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ tb_name = tdCom.getLongName(7, "letters")
+ input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"")
+ self.resCmp(input_sql, stb_name)
+ s_stb_s_tb_m_tag_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[3]
+ self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_m_tag_list))
+ tdSql.query(f"show tables;")
+ tdSql.checkRows(1) if self.smlChildTableName_value == "ID" else tdSql.checkRows(2)
+ if self.smlChildTableName_value == "ID":
+ expected_tb_name = self.getNoIdTbName(stb_name)[0]
+ tdSql.checkEqual(tb_name, expected_tb_name)
+ tdSql.query(f"select * from {stb_name};")
+ tdSql.checkRows(1) if self.smlChildTableName_value == "ID" else tdSql.checkRows(2)
+
+ def sStbDtbDdataInsertMultiThreadCheckCase(self):
+ """
+ thread input same stb, different tb, different data
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"")
+ self.resCmp(input_sql, stb_name)
+ s_stb_d_tb_list = self.genSqlList(stb_name=stb_name)[4]
+ self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_list))
+ tdSql.query(f"show tables;")
+ tdSql.checkRows(6)
+
+ def sStbDtbDdataMtInsertMultiThreadCheckCase(self):
+ """
+ thread input same stb, different tb, different data, add col, mul tag
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"")
+ self.resCmp(input_sql, stb_name)
+ s_stb_d_tb_m_tag_list = [(f'{stb_name} 1626006833640 "omfdhyom" t0=F t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'yzwswz'), \
+ (f'{stb_name} 1626006833640 "vqowydbc" t0=F t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'yzwswz'), \
+ (f'{stb_name} 1626006833640 "plgkckpv" t0=F t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'yzwswz'), \
+ (f'{stb_name} 1626006833640 "cujyqvlj" t0=F t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'yzwswz'), \
+ (f'{stb_name} 1626006833640 "twjxisat" t0=T t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'yzwswz')]
+ self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_m_tag_list))
+ tdSql.query(f"show tables;")
+ tdSql.checkRows(3)
+
+ def sStbDtbDdataAtInsertMultiThreadCheckCase(self):
+ """
+ thread input same stb, different tb, different data, add tag, mul col
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"")
+ self.resCmp(input_sql, stb_name)
+ s_stb_d_tb_a_tag_list = self.genSqlList(stb_name=stb_name)[6]
+ self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_a_tag_list))
+ tdSql.query(f"show tables;")
+ tdSql.checkRows(6)
+
+ def sStbStbDdataDtsInsertMultiThreadCheckCase(self):
+ """
+ thread input same stb tb, different ts
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ tb_name = tdCom.getLongName(7, "letters")
+ input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"")
+ self.resCmp(input_sql, stb_name)
+ s_stb_s_tb_d_ts_list = [(f'{stb_name} 0 "hkgjiwdj" id={tb_name} t0=f t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"', 'dwpthv'), \
+ (f'{stb_name} 0 "rljjrrul" id={tb_name} t0=False t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="bmcanhbs" t8=L"ncharTagValue"', 'dwpthv'), \
+ (f'{stb_name} 0 "basanglx" id={tb_name} t0=False t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="enqkyvmb" t8=L"ncharTagValue"', 'dwpthv'), \
+ (f'{stb_name} 0 "clsajzpp" id={tb_name} t0=F t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="eivaegjk" t8=L"ncharTagValue"', 'dwpthv'), \
+ (f'{stb_name} 0 "jitwseso" id={tb_name} t0=T t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="yhlwkddq" t8=L"ncharTagValue"', 'dwpthv')]
+ self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_d_ts_list))
+ tdSql.query(f"show tables;")
+ tdSql.checkRows(1) if self.smlChildTableName_value == "ID" else tdSql.checkRows(6)
+ tdSql.query(f"select * from {stb_name}")
+ tdSql.checkRows(6)
+
+ def sStbStbDdataDtsMtInsertMultiThreadCheckCase(self):
+ """
+ thread input same stb tb, different ts, add col, mul tag
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ tb_name = tdCom.getLongName(7, "letters")
+ input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"")
+ self.resCmp(input_sql, stb_name)
+ s_stb_s_tb_d_ts_m_tag_list = self.genSqlList(stb_name=stb_name, tb_name=tb_name)[8]
+ self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_d_ts_m_tag_list))
+ tdSql.query(f"show tables;")
+ tdSql.checkRows(1) if self.smlChildTableName_value == "ID" else tdSql.checkRows(2)
+ tdSql.query(f"select * from {stb_name}")
+ tdSql.checkRows(6)
+ tdSql.query(f"select * from {stb_name} where t8 is not NULL")
+ tdSql.checkRows(6) if self.smlChildTableName_value == "ID" else tdSql.checkRows(1)
+
+ def sStbStbDdataDtsAtInsertMultiThreadCheckCase(self):
+ """
+ thread input same stb tb, different ts, add tag, mul col
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ tb_name = tdCom.getLongName(7, "letters")
+ input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"")
+ self.resCmp(input_sql, stb_name)
+ s_stb_s_tb_d_ts_a_tag_list = [(f'{stb_name} 0 "clummqfy" id={tb_name} t0=False t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="hpxzrdiw" t8=L"ncharTagValue" t11=127i8 t10=L"ncharTagValue"', 'bokaxl'), \
+ (f'{stb_name} 0 "yqeztggb" id={tb_name} t0=F t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="gdtblmrc" t8=L"ncharTagValue" t11=127i8 t10=L"ncharTagValue"', 'bokaxl'), \
+ (f'{stb_name} 0 "gbkinqdk" id={tb_name} t0=f t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="iqniuvco" t8=L"ncharTagValue" t11=127i8 t10=L"ncharTagValue"', 'bokaxl'), \
+ (f'{stb_name} 0 "ldxxejbd" id={tb_name} t0=f t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="vxkipags" t8=L"ncharTagValue" t11=127i8 t10=L"ncharTagValue"', 'bokaxl'), \
+ (f'{stb_name} 0 "tlvzwjes" id={tb_name} t0=true t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64 t7="enwrlrtj" t8=L"ncharTagValue" t11=127i8 t10=L"ncharTagValue"', 'bokaxl')]
+ self.multiThreadRun(self.genMultiThreadSeq(s_stb_s_tb_d_ts_a_tag_list))
+ tdSql.query(f"show tables;")
+ tdSql.checkRows(1) if self.smlChildTableName_value == "ID" else tdSql.checkRows(6)
+ tdSql.query(f"select * from {stb_name}")
+ tdSql.checkRows(6)
+ for t in ["t10", "t11"]:
+ tdSql.query(f"select * from {stb_name} where {t} is not NULL;")
+ tdSql.checkRows(0) if self.smlChildTableName_value == "ID" else tdSql.checkRows(5)
+
+ def sStbDtbDdataDtsInsertMultiThreadCheckCase(self):
+ """
+ thread input same stb, different tb, data, ts
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"")
+ self.resCmp(input_sql, stb_name)
+ s_stb_d_tb_d_ts_list = self.genSqlList(stb_name=stb_name)[10]
+ self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_d_ts_list))
+ tdSql.query(f"show tables;")
+ tdSql.checkRows(6)
+
+ def sStbDtbDdataDtsMtInsertMultiThreadCheckCase(self):
+ """
+ thread input same stb, different tb, data, ts, add col, mul tag
+ """
+ tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
+ tdCom.cleanTb()
+ input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"")
+ self.resCmp(input_sql, stb_name)
+ s_stb_d_tb_d_ts_m_tag_list = [(f'{stb_name} 0 "mnpmtzul" t0=False t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'pcppkg'), \
+ (f'{stb_name} 0 "zbvwckcd" t0=True t1=126i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'pcppkg'), \
+ (f'{stb_name} 0 "vymcjfwc" t0=False t1=125i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'pcppkg'), \
+ (f'{stb_name} 0 "laumkwfn" t0=False t1=124i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'pcppkg'), \
+ (f'{stb_name} 0 "nyultzxr" t0=false t1=123i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64', 'pcppkg')]
+ self.multiThreadRun(self.genMultiThreadSeq(s_stb_d_tb_d_ts_m_tag_list))
+ tdSql.query(f"show tables;")
+ tdSql.checkRows(6)
+
+ def test(self):
+ try:
+ input_sql = f'test_nchar 0 L"涛思数据" t0=f t1=L"涛思数据" t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=11.12345f32 t6=22.123456789f64'
+ self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
+ except SchemalessError as err:
+ print(err.errno)
+
+ def runAll(self):
+ self.initCheckCase()
+ self.boolTypeCheckCase()
+ self.symbolsCheckCase()
+ self.tsCheckCase()
+ self.openTstbTelnetTsCheckCase()
+ self.idSeqCheckCase()
+ self.idLetterCheckCase()
+ self.noIdCheckCase()
+ self.maxColTagCheckCase()
+ self.stbTbNameCheckCase()
+ self.idStartWithNumCheckCase()
+ self.nowTsCheckCase()
+ self.dateFormatTsCheckCase()
+ self.illegalTsCheckCase()
+ self.tbnameCheckCase()
+ self.tagNameLengthCheckCase()
+ # self.tagValueLengthCheckCase()
+ self.colValueLengthCheckCase()
+ self.tagColIllegalValueCheckCase()
+ self.blankCheckCase()
+ self.duplicateIdTagColInsertCheckCase()
+ self.noIdStbExistCheckCase()
+ self.duplicateInsertExistCheckCase()
+ self.tagColBinaryNcharLengthCheckCase()
+ self.tagColAddDupIDCheckCase()
+ self.tagColAddCheckCase()
+ self.tagMd5Check()
+ # self.tagColNcharMaxLengthCheckCase()
+ # self.batchInsertCheckCase()
+ # self.multiInsertCheckCase(10)
+ self.batchErrorInsertCheckCase()
+ self.multiColsInsertCheckCase()
+ self.blankColInsertCheckCase()
+ self.blankTagInsertCheckCase()
+ self.chineseCheckCase()
+ self.multiFieldCheckCase()
+ self.spellCheckCase()
+ self.pointTransCheckCase()
+ self.defaultTypeCheckCase()
+ self.tbnameTagsColsNameCheckCase()
+ # # # MultiThreads
+ # self.stbInsertMultiThreadCheckCase()
+ # self.sStbStbDdataInsertMultiThreadCheckCase()
+ # self.sStbStbDdataAtInsertMultiThreadCheckCase()
+ # self.sStbStbDdataMtInsertMultiThreadCheckCase()
+ # self.sStbDtbDdataInsertMultiThreadCheckCase()
+ # self.sStbDtbDdataMtInsertMultiThreadCheckCase()
+ # self.sStbDtbDdataAtInsertMultiThreadCheckCase()
+ # self.sStbStbDdataDtsInsertMultiThreadCheckCase()
+ # # self.sStbStbDdataDtsMtInsertMultiThreadCheckCase()
+ # self.sStbStbDdataDtsAtInsertMultiThreadCheckCase()
+ # self.sStbDtbDdataDtsInsertMultiThreadCheckCase()
+ # self.sStbDtbDdataDtsMtInsertMultiThreadCheckCase()
+
+ def run(self):
+ print("running {}".format(__file__))
+
+ try:
+ self.createDb()
+ self.runAll()
+ # self.createDb(protocol="telnet-tcp")
+ # self.initCheckCase('telnet-tcp')
+ # self.boolTypeCheckCase('telnet-tcp')
+ # self.symbolsCheckCase('telnet-tcp')
+ # self.idSeqCheckCase('telnet-tcp')
+ # self.idLetterCheckCase('telnet-tcp')
+ # self.noIdCheckCase('telnet-tcp')
+ # self.stbTbNameCheckCase('telnet-tcp')
+ # self.idStartWithNumCheckCase('telnet-tcp')
+ # self.pointTransCheckCase('telnet-tcp')
+ # self.tcpKeywordsCheckCase()
+ except Exception as err:
+ print(''.join(traceback.format_exception(None, err, err.__traceback__)))
+ raise err
+
+ 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/1-insert/performanceInsert.json b/tests/system-test/1-insert/performanceInsert.json
new file mode 100644
index 0000000000000000000000000000000000000000..de410c30f2fa1846d0318def447d1d09aff2cfea
--- /dev/null
+++ b/tests/system-test/1-insert/performanceInsert.json
@@ -0,0 +1,79 @@
+{
+ "filetype": "insert",
+ "cfgdir": "/etc/taos/",
+ "host": "test216",
+ "port": 6030,
+ "user": "root",
+ "password": "taosdata",
+ "thread_count": 8,
+ "thread_count_create_tbl": 8,
+ "result_file": "./insert_res.txt",
+ "confirm_parameter_prompt": "no",
+ "insert_interval": 0,
+ "interlace_rows": 1000,
+ "num_of_records_per_req": 100000,
+ "databases": [
+ {
+ "dbinfo": {
+ "name": "db",
+ "drop": "yes",
+ "vgroups": 24
+ },
+ "super_tables": [
+ {
+ "name": "stb",
+ "child_table_exists": "no",
+ "childtable_count": 100000,
+ "childtable_prefix": "stb_",
+ "auto_create_table": "no",
+ "batch_create_tbl_num": 50000,
+ "data_source": "rand",
+ "insert_mode": "taosc",
+ "insert_rows": 5,
+ "interlace_rows": 100000,
+ "insert_interval": 0,
+ "max_sql_len": 10000000,
+ "disorder_ratio": 0,
+ "disorder_range": 1000,
+ "timestamp_step": 10,
+ "start_timestamp": "2022-05-01 00:00:00.000",
+ "sample_format": "csv",
+ "use_sample_ts": "no",
+ "tags_file": "",
+ "columns": [
+ {
+ "type": "INT"
+ },
+ {
+ "type": "TINYINT",
+ "count": 1
+ },
+ {"type": "DOUBLE"},
+
+ {
+ "type": "BINARY",
+ "len": 40,
+ "count": 1
+ },
+ {
+ "type": "nchar",
+ "len": 20,
+ "count": 1
+ }
+ ],
+ "tags": [
+ {
+ "type": "TINYINT",
+ "count": 1
+ },
+ {
+ "type": "BINARY",
+ "len": 16,
+ "count": 1
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/tests/system-test/1-insert/performanceQuery.json b/tests/system-test/1-insert/performanceQuery.json
new file mode 100644
index 0000000000000000000000000000000000000000..fe2991bd0f5f74401b437e24b6a6f8e4cd5ed721
--- /dev/null
+++ b/tests/system-test/1-insert/performanceQuery.json
@@ -0,0 +1,42 @@
+{
+ "filetype": "query",
+ "cfgdir": "/etc/taos",
+ "host": "test216",
+ "port": 6030,
+ "user": "root",
+ "password": "taosdata",
+ "confirm_parameter_prompt": "no",
+ "databases": "db",
+ "query_times": 100,
+ "query_mode": "taosc",
+ "specified_table_query": {
+ "query_interval": 0,
+ "threads": 8,
+ "sqls": [
+ {
+ "sql": "select count(*) from stb_0 ",
+ "result": "./query_res0.txt"
+ },
+ {
+ "sql": "select last_row(*) from stb_1 ",
+ "result": "./query_res1.txt"
+ },
+ {
+ "sql": "select last(*) from stb_2 ",
+ "result": "./query_res2.txt"
+ },
+ {
+ "sql": "select first(*) from stb_3 ",
+ "result": "./query_res3.txt"
+ },
+ {
+ "sql": "select avg(c0),min(c2),max(c1) from stb_4",
+ "result": "./query_res4.txt"
+ },
+ {
+ "sql": "select avg(c0),min(c2),max(c1) from stb_5 where ts <= '2022-05-01 20:00:00.500' and ts >= '2022-05-01 00:00:00.000' ",
+ "result": "./query_res5.txt"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/tests/system-test/1-insert/test_stmt_insert_query.py b/tests/system-test/1-insert/test_stmt_insert_query_ex.py
similarity index 88%
rename from tests/system-test/1-insert/test_stmt_insert_query.py
rename to tests/system-test/1-insert/test_stmt_insert_query_ex.py
index c6faedd35ee9f08e50310e5570a9be284d16ecc4..376b60d615941323bedcf40d591817e30c8da05a 100644
--- a/tests/system-test/1-insert/test_stmt_insert_query.py
+++ b/tests/system-test/1-insert/test_stmt_insert_query_ex.py
@@ -132,11 +132,11 @@ class TDTestCase:
querystmt.bind_param(queryparam)
querystmt.execute()
result=querystmt.use_result()
- rows=result.fetch_all()
- print( querystmt.use_result())
+ # rows=result.fetch_all()
+ # print( querystmt.use_result())
# result = conn.query("select * from log")
- # rows=result.fetch_all()
+ rows=result.fetch_all()
# rows=result.fetch_all()
print(rows)
assert rows[1][0] == "ts"
@@ -213,7 +213,7 @@ class TDTestCase:
params[11].float([3, None, 1])
params[12].double([3, None, 1.2])
params[13].binary(["abc", "dddafadfadfadfadfa", None])
- params[14].nchar(["涛思数据", None, "a long string with 中文字符"])
+ params[14].nchar(["涛思数据", None, "a? long string with 中文字符"])
params[15].timestamp([None, None, 1626861392591])
stmt.bind_param_batch(params)
@@ -230,9 +230,31 @@ class TDTestCase:
querystmt1.execute()
result1=querystmt1.use_result()
rows1=result1.fetch_all()
- assert str(rows1[0][0]) == "2021-07-21 17:56:32.589111"
- assert rows1[0][10] == 3
- assert rows1[1][10] == 4
+ print("1",rows1)
+
+ querystmt2=conn.statement("select abs(?) from log where bu < ?")
+ queryparam2=new_bind_params(2)
+ print(type(queryparam2))
+ queryparam2[0].int(5)
+ queryparam2[1].int(5)
+ querystmt2.bind_param(queryparam2)
+ querystmt2.execute()
+ result2=querystmt2.use_result()
+ rows2=result2.fetch_all()
+ print("2",rows2)
+
+ querystmt3=conn.statement("select abs(?) from log where nn= 'a? long string with 中文字符' ")
+ queryparam3=new_bind_params(1)
+ print(type(queryparam3))
+ queryparam3[0].int(5)
+ querystmt3.bind_param(queryparam3)
+ querystmt3.execute()
+ result3=querystmt3.use_result()
+ rows3=result3.fetch_all()
+ print("3",rows3)
+ # assert str(rows1[0][0]) == "2021-07-21 17:56:32.589111"
+ # assert rows1[0][10] == 3
+ # assert rows1[1][10] == 4
# conn.execute("drop database if exists %s" % dbname)
conn.close()
@@ -247,7 +269,6 @@ class TDTestCase:
config = buildPath+ "../sim/dnode1/cfg/"
host="localhost"
connectstmt=self.newcon(host,config)
- print(connectstmt)
self.test_stmt_insert_multi(connectstmt)
connectstmt=self.newcon(host,config)
self.test_stmt_set_tbname_tag(connectstmt)
diff --git a/tests/system-test/1-insert/test_stmt_muti_insert_query.py b/tests/system-test/1-insert/test_stmt_muti_insert_query.py
new file mode 100644
index 0000000000000000000000000000000000000000..486bcd806219c73fa344e5422727c46fe03cde5e
--- /dev/null
+++ b/tests/system-test/1-insert/test_stmt_muti_insert_query.py
@@ -0,0 +1,181 @@
+###################################################################
+# Copyright (c) 2016 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+
+# -*- coding: utf-8 -*-
+
+import sys
+import os
+import threading as thd
+import multiprocessing as mp
+from numpy.lib.function_base import insert
+import taos
+from taos import *
+from util.log import *
+from util.cases import *
+from util.sql import *
+import numpy as np
+import datetime as dt
+from datetime import datetime
+from ctypes import *
+import time
+# constant define
+WAITS = 5 # wait seconds
+
+class TDTestCase:
+ #
+ # --------------- main frame -------------------
+ def caseDescription(self):
+ '''
+ limit and offset keyword function test cases;
+ case1: limit offset base function test
+ case2: offset return valid
+ '''
+ return
+
+ def getBuildPath(self):
+ selfPath = os.path.dirname(os.path.realpath(__file__))
+
+ if ("community" in selfPath):
+ projPath = selfPath[:selfPath.find("community")]
+ else:
+ projPath = selfPath[:selfPath.find("tests")]
+
+ for root, dirs, files in os.walk(projPath):
+ if ("taosd" in files):
+ rootRealPath = os.path.dirname(os.path.realpath(root))
+ if ("packaging" not in rootRealPath):
+ buildPath = root[:len(root)-len("/build/bin")]
+ break
+ return buildPath
+
+ # init
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor())
+ # tdSql.prepare()
+ # self.create_tables();
+ self.ts = 1500000000000
+
+ # stop
+ def stop(self):
+ tdSql.close()
+ tdLog.success("%s successfully executed" % __file__)
+
+
+ # --------------- case -------------------
+
+
+ def newcon(self,host,cfg):
+ user = "root"
+ password = "taosdata"
+ port =6030
+ con=taos.connect(host=host, user=user, password=password, config=cfg ,port=port)
+ print(con)
+ return con
+
+ def test_stmt_insert_multi(self,conn):
+ # type: (TaosConnection) -> None
+
+ dbname = "pytest_taos_stmt_multi"
+ try:
+ conn.execute("drop database if exists %s" % dbname)
+ conn.execute("create database if not exists %s" % dbname)
+ conn.select_db(dbname)
+
+ conn.execute(
+ "create table if not exists log(ts timestamp, bo bool, nil tinyint, ti tinyint, si smallint, ii int,\
+ bi bigint, tu tinyint unsigned, su smallint unsigned, iu int unsigned, bu bigint unsigned, \
+ ff float, dd double, bb binary(100), nn nchar(100), tt timestamp)",
+ )
+ # conn.load_table_info("log")
+
+ start = datetime.now()
+ stmt = conn.statement("insert into log values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
+
+ params = new_multi_binds(16)
+ params[0].timestamp((1626861392589, 1626861392590, 1626861392591))
+ params[1].bool((True, None, False))
+ params[2].tinyint([-128, -128, None]) # -128 is tinyint null
+ params[3].tinyint([0, 127, None])
+ params[4].smallint([3, None, 2])
+ params[5].int([3, 4, None])
+ params[6].bigint([3, 4, None])
+ params[7].tinyint_unsigned([3, 4, None])
+ params[8].smallint_unsigned([3, 4, None])
+ params[9].int_unsigned([3, 4, None])
+ params[10].bigint_unsigned([3, 4, None])
+ params[11].float([3, None, 1])
+ params[12].double([3, None, 1.2])
+ params[13].binary(["abc", "dddafadfadfadfadfa", None])
+ params[14].nchar(["涛思数据", None, "a long string with 中文字符"])
+ params[15].timestamp([None, None, 1626861392591])
+ # print(type(stmt))
+ stmt.bind_param_batch(params)
+ stmt.execute()
+ end = datetime.now()
+ print("elapsed time: ", end - start)
+ assert stmt.affected_rows == 3
+
+ #query
+ querystmt=conn.statement("select ?,bu from log")
+ queryparam=new_bind_params(1)
+ print(type(queryparam))
+ queryparam[0].binary("ts")
+ querystmt.bind_param(queryparam)
+ querystmt.execute()
+ result=querystmt.use_result()
+ # rows=result.fetch_all()
+ # print( querystmt.use_result())
+
+ # result = conn.query("select * from log")
+ rows=result.fetch_all()
+ # rows=result.fetch_all()
+ print(rows)
+ assert rows[1][0] == "ts"
+ assert rows[0][1] == 3
+
+ #query
+ querystmt1=conn.statement("select * from log where bu < ?")
+ queryparam1=new_bind_params(1)
+ print(type(queryparam1))
+ queryparam1[0].int(4)
+ querystmt1.bind_param(queryparam1)
+ querystmt1.execute()
+ result1=querystmt1.use_result()
+ rows1=result1.fetch_all()
+ print(rows1)
+ assert str(rows1[0][0]) == "2021-07-21 17:56:32.589000"
+ assert rows1[0][10] == 3
+
+
+ stmt.close()
+
+ # conn.execute("drop database if exists %s" % dbname)
+ conn.close()
+
+ except Exception as err:
+ # conn.execute("drop database if exists %s" % dbname)
+ conn.close()
+ raise err
+
+ def run(self):
+ buildPath = self.getBuildPath()
+ config = buildPath+ "../sim/dnode1/cfg/"
+ host="localhost"
+ connectstmt=self.newcon(host,config)
+ self.test_stmt_insert_multi(connectstmt)
+ return
+
+
+# add case with filename
+#
+tdCases.addWindows(__file__, TDTestCase())
+tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
diff --git a/tests/system-test/1-insert/test_stmt_set_tbname_tag.py b/tests/system-test/1-insert/test_stmt_set_tbname_tag.py
new file mode 100644
index 0000000000000000000000000000000000000000..54d5cfbafb0b3f98d55f310accccb19ef693c08b
--- /dev/null
+++ b/tests/system-test/1-insert/test_stmt_set_tbname_tag.py
@@ -0,0 +1,176 @@
+###################################################################
+# Copyright (c) 2016 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+
+# -*- coding: utf-8 -*-
+
+import sys
+import os
+import threading as thd
+import multiprocessing as mp
+from numpy.lib.function_base import insert
+import taos
+from taos import *
+from util.log import *
+from util.cases import *
+from util.sql import *
+import numpy as np
+import datetime as dt
+from datetime import datetime
+from ctypes import *
+import time
+# constant define
+WAITS = 5 # wait seconds
+
+class TDTestCase:
+ #
+ # --------------- main frame -------------------
+ def caseDescription(self):
+ '''
+ limit and offset keyword function test cases;
+ case1: limit offset base function test
+ case2: offset return valid
+ '''
+ return
+
+ def getBuildPath(self):
+ selfPath = os.path.dirname(os.path.realpath(__file__))
+
+ if ("community" in selfPath):
+ projPath = selfPath[:selfPath.find("community")]
+ else:
+ projPath = selfPath[:selfPath.find("tests")]
+
+ for root, dirs, files in os.walk(projPath):
+ if ("taosd" in files):
+ rootRealPath = os.path.dirname(os.path.realpath(root))
+ if ("packaging" not in rootRealPath):
+ buildPath = root[:len(root)-len("/build/bin")]
+ break
+ return buildPath
+
+ # init
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor())
+ # tdSql.prepare()
+ # self.create_tables();
+ self.ts = 1500000000000
+
+ # stop
+ def stop(self):
+ tdSql.close()
+ tdLog.success("%s successfully executed" % __file__)
+
+
+ # --------------- case -------------------
+
+
+ def newcon(self,host,cfg):
+ user = "root"
+ password = "taosdata"
+ port =6030
+ con=taos.connect(host=host, user=user, password=password, config=cfg ,port=port)
+ print(con)
+ return con
+
+ def test_stmt_set_tbname_tag(self,conn):
+ dbname = "pytest_taos_stmt_set_tbname_tag"
+
+ try:
+ conn.execute("drop database if exists %s" % dbname)
+ conn.execute("create database if not exists %s PRECISION 'us' " % dbname)
+ conn.select_db(dbname)
+ conn.execute("create table if not exists log(ts timestamp, bo bool, nil tinyint, ti tinyint, si smallint, ii int,\
+ bi bigint, tu tinyint unsigned, su smallint unsigned, iu int unsigned, bu bigint unsigned, \
+ ff float, dd double, bb binary(100), nn nchar(100), tt timestamp , vc varchar(100)) tags (t1 timestamp, t2 bool,\
+ t3 tinyint, t4 tinyint, t5 smallint, t6 int, t7 bigint, t8 tinyint unsigned, t9 smallint unsigned, \
+ t10 int unsigned, t11 bigint unsigned, t12 float, t13 double, t14 binary(100), t15 nchar(100), t16 timestamp)")
+
+ stmt = conn.statement("insert into ? using log tags (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) \
+ values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
+ tags = new_bind_params(16)
+ tags[0].timestamp(1626861392589123, PrecisionEnum.Microseconds)
+ tags[1].bool(True)
+ tags[2].null()
+ tags[3].tinyint(2)
+ tags[4].smallint(3)
+ tags[5].int(4)
+ tags[6].bigint(5)
+ tags[7].tinyint_unsigned(6)
+ tags[8].smallint_unsigned(7)
+ tags[9].int_unsigned(8)
+ tags[10].bigint_unsigned(9)
+ tags[11].float(10.1)
+ tags[12].double(10.11)
+ tags[13].binary("hello")
+ tags[14].nchar("stmt")
+ tags[15].timestamp(1626861392589, PrecisionEnum.Milliseconds)
+ stmt.set_tbname_tags("tb1", tags)
+ params = new_multi_binds(16)
+ params[0].timestamp((1626861392589111, 1626861392590111, 1626861392591111))
+ params[1].bool((True, None, False))
+ params[2].tinyint([-128, -128, None]) # -128 is tinyint null
+ params[3].tinyint([0, 127, None])
+ params[4].smallint([3, None, 2])
+ params[5].int([3, 4, None])
+ params[6].bigint([3, 4, None])
+ params[7].tinyint_unsigned([3, 4, None])
+ params[8].smallint_unsigned([3, 4, None])
+ params[9].int_unsigned([3, 4, None])
+ params[10].bigint_unsigned([3, 4, 5])
+ params[11].float([3, None, 1])
+ params[12].double([3, None, 1.2])
+ params[13].binary(["abc", "dddafadfadfadfadfa", None])
+ params[14].nchar(["涛思数据", None, "a long string with 中文字符"])
+ params[15].timestamp([None, None, 1626861392591])
+ params[16].binary(["涛思数据16", None, "a long string with 中文-字符"])
+
+ stmt.bind_param_batch(params)
+ stmt.execute()
+
+ assert stmt.affected_rows == 3
+
+ #query
+ querystmt1=conn.statement("select * from log where bu < ?")
+ queryparam1=new_bind_params(1)
+ print(type(queryparam1))
+ queryparam1[0].int(5)
+ querystmt1.bind_param(queryparam1)
+ querystmt1.execute()
+ result1=querystmt1.use_result()
+ rows1=result1.fetch_all()
+ print(rows1)
+ # assert str(rows1[0][0]) == "2021-07-21 17:56:32.589111"
+ # assert rows1[0][10] == 3
+ # assert rows1[1][10] == 4
+
+ # conn.execute("drop database if exists %s" % dbname)
+ conn.close()
+
+ except Exception as err:
+ # conn.execute("drop database if exists %s" % dbname)
+ conn.close()
+ raise err
+
+ def run(self):
+ buildPath = self.getBuildPath()
+ config = buildPath+ "../sim/dnode1/cfg/"
+ host="localhost"
+ connectstmt=self.newcon(host,config)
+ self.test_stmt_set_tbname_tag(connectstmt)
+
+ return
+
+
+# add case with filename
+#
+tdCases.addWindows(__file__, TDTestCase())
+tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
diff --git a/tests/system-test/2-query/apercentile.py b/tests/system-test/2-query/apercentile.py
new file mode 100644
index 0000000000000000000000000000000000000000..150c4d3f17e30ab5f4d25fb19af2bb80ee202776
--- /dev/null
+++ b/tests/system-test/2-query/apercentile.py
@@ -0,0 +1,107 @@
+###################################################################
+# Copyright (c) 2016 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+
+# -*- coding: utf-8 -*-
+
+from util.log import *
+from util.cases import *
+from util.sql import *
+import numpy as np
+
+
+class TDTestCase:
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor())
+ self.rowNum = 10
+ self.ts = 1537146000000
+
+ def check_apercentile(self,data,expect_data,param,percent,column):
+ if param == "default":
+ if abs((expect_data-data) <= expect_data * 0.2):
+ tdLog.info(f"apercentile function values check success with col{column}, param = {param},percent = {percent}")
+ else:
+ tdLog.notice(f"apercentile function value has not as expected with col{column}, param = {param},percent = {percent}")
+ sys.exit(1)
+ elif param == "t-digest":
+ if abs((expect_data-data) <= expect_data * 0.2):
+ tdLog.info(f"apercentile function values check success with col{column}, param = {param},percent = {percent}")
+ else:
+ tdLog.notice(f"apercentile function value has not as expected with col{column}, param = {param},percent = {percent}")
+ sys.exit(1)
+
+ def run(self):
+ tdSql.prepare()
+
+ intData = []
+ floatData = []
+ percent_list = [0,50,100]
+ param_list = ['default','t-digest']
+ tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
+ col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned)''')
+ for i in range(self.rowNum):
+ tdSql.execute("insert into test values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
+ % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
+ intData.append(i + 1)
+ floatData.append(i + 0.1)
+
+ # percentile verifacation
+
+ tdSql.error("select apercentile(ts ,20) from test")
+ tdSql.error("select apercentile(col7 ,20) from test")
+ tdSql.error("select apercentile(col8 ,20) from test")
+ tdSql.error("select apercentile(col9 ,20) from test")
+
+ column_list = [1,2,3,4,5,6,11,12,13,14]
+
+ for i in column_list:
+ for j in percent_list:
+ for k in param_list:
+ tdSql.query(f"select apercentile(col{i},{j},'{k}') from test")
+ data = tdSql.getData(0, 0)
+ tdSql.query(f"select percentile(col{i},{j}) from test")
+ expect_data = tdSql.getData(0, 0)
+ self.check_apercentile(data,expect_data,k,j,i)
+
+ error_param_list = [-1,101,'"a"']
+ for i in error_param_list:
+ tdSql.error(f'select apercentile(col1,{i}) from test')
+
+ tdSql.execute("create table meters (ts timestamp, voltage int) tags(loc nchar(20))")
+ tdSql.execute("create table t0 using meters tags('beijing')")
+ tdSql.execute("create table t1 using meters tags('shanghai')")
+ for i in range(self.rowNum):
+ tdSql.execute("insert into t0 values(%d, %d)" % (self.ts + i, i + 1))
+ tdSql.execute("insert into t1 values(%d, %d)" % (self.ts + i, i + 1))
+
+ column_list = ['voltage']
+ for i in column_list:
+ for j in percent_list:
+ for k in param_list:
+ tdSql.query(f"select apercentile({i}, {j},'{k}') from t0")
+ data = tdSql.getData(0, 0)
+ tdSql.query(f"select percentile({i},{j}) from t0")
+ expect_data = tdSql.getData(0,0)
+ self.check_apercentile(data,expect_data,k,j,i)
+ tdSql.query(f"select apercentile({i}, {j},'{k}') from meters")
+ tdSql.checkRows(1)
+ table_list = ["meters","t0"]
+ for i in error_param_list:
+ for j in table_list:
+ for k in column_list:
+ tdSql.error(f'select apercentile({k},{i}) from {j}')
+
+ 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/avg.py b/tests/system-test/2-query/avg.py
new file mode 100644
index 0000000000000000000000000000000000000000..20ee6df7fcf94e3b02641b735c6ad7fd1ce862ff
--- /dev/null
+++ b/tests/system-test/2-query/avg.py
@@ -0,0 +1,424 @@
+import taos
+import sys
+import datetime
+import inspect
+
+from util.log import *
+from util.sql import *
+from util.cases import *
+
+class TDTestCase:
+ updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 ,
+ "jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143,
+ "wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"fnDebugFlag":143}
+ def init(self, conn, logSql):
+ tdLog.debug(f"start to excute {__file__}")
+ tdSql.init(conn.cursor(), True)
+
+ def prepare_datas(self):
+ tdSql.execute(
+ '''create table stb1
+ (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp)
+ tags (t1 int)
+ '''
+ )
+
+ tdSql.execute(
+ '''
+ create table t1
+ (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp)
+ '''
+ )
+ for i in range(4):
+ tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )')
+
+ for i in range(9):
+ tdSql.execute(
+ f"insert into ct1 values ( now()-{i*10}s, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )"
+ )
+ tdSql.execute(
+ f"insert into ct4 values ( now()-{i*90}d, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )"
+ )
+ tdSql.execute("insert into ct1 values (now()-45s, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar0', now()+8a )")
+ tdSql.execute("insert into ct1 values (now()+10s, 9, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )")
+ tdSql.execute("insert into ct1 values (now()+15s, 9, -99999, -999, -99, -9.99, NULL, 1, 'binary9', 'nchar9', now()+9a )")
+ tdSql.execute("insert into ct1 values (now()+20s, 9, -99999, -999, NULL, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )")
+
+ tdSql.execute("insert into ct4 values (now()-810d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ")
+ tdSql.execute("insert into ct4 values (now()-400d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ")
+ tdSql.execute("insert into ct4 values (now()+90d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ")
+
+ tdSql.execute(
+ f'''insert into t1 values
+ ( '2020-04-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
+ ( '2020-10-21 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now()+1a )
+ ( '2020-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now()+2a )
+ ( '2021-01-01 01:01:06.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now()+3a )
+ ( '2021-05-07 01:01:10.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now()+4a )
+ ( '2021-07-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
+ ( '2021-09-30 01:01:16.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now()+5a )
+ ( '2022-02-01 01:01:20.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now()+6a )
+ ( '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" )
+ ( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
+ '''
+ )
+
+ def check_avg(self ,origin_query , check_query):
+ avg_result = tdSql.getResult(origin_query)
+ origin_result = tdSql.getResult(check_query)
+
+ check_status = True
+ for row_index , row in enumerate(avg_result):
+ for col_index , elem in enumerate(row):
+ if avg_result[row_index][col_index] != origin_result[row_index][col_index]:
+ check_status = False
+ if not check_status:
+ tdLog.notice("avg function value has not as expected , sql is \"%s\" "%origin_query )
+ sys.exit(1)
+ else:
+ tdLog.info("avg value check pass , it work as expected ,sql is \"%s\" "%check_query )
+
+ def test_errors(self):
+ error_sql_lists = [
+ "select avg from t1",
+ # "select avg(-+--+c1) from t1",
+ # "select +-avg(c1) from t1",
+ # "select ++-avg(c1) from t1",
+ # "select ++--avg(c1) from t1",
+ # "select - -avg(c1)*0 from t1",
+ # "select avg(tbname+1) from t1 ",
+ "select avg(123--123)==1 from t1",
+ "select avg(c1) as 'd1' from t1",
+ "select avg(c1 ,c2 ) from t1",
+ "select avg(c1 ,NULL) from t1",
+ "select avg(,) from t1;",
+ "select avg(avg(c1) ab from t1)",
+ "select avg(c1) as int from t1",
+ "select avg from stb1",
+ # "select avg(-+--+c1) from stb1",
+ # "select +-avg(c1) from stb1",
+ # "select ++-avg(c1) from stb1",
+ # "select ++--avg(c1) from stb1",
+ # "select - -avg(c1)*0 from stb1",
+ # "select avg(tbname+1) from stb1 ",
+ "select avg(123--123)==1 from stb1",
+ "select avg(c1) as 'd1' from stb1",
+ "select avg(c1 ,c2 ) from stb1",
+ "select avg(c1 ,NULL) from stb1",
+ "select avg(,) from stb1;",
+ "select avg(avg(c1) ab from stb1)",
+ "select avg(c1) as int from stb1"
+ ]
+ for error_sql in error_sql_lists:
+ tdSql.error(error_sql)
+
+ def support_types(self):
+ type_error_sql_lists = [
+ "select avg(ts) from t1" ,
+ "select avg(c7) from t1",
+ "select avg(c8) from t1",
+ "select avg(c9) from t1",
+ "select avg(ts) from ct1" ,
+ "select avg(c7) from ct1",
+ "select avg(c8) from ct1",
+ "select avg(c9) from ct1",
+ "select avg(ts) from ct3" ,
+ "select avg(c7) from ct3",
+ "select avg(c8) from ct3",
+ "select avg(c9) from ct3",
+ "select avg(ts) from ct4" ,
+ "select avg(c7) from ct4",
+ "select avg(c8) from ct4",
+ "select avg(c9) from ct4",
+ "select avg(ts) from stb1" ,
+ "select avg(c7) from stb1",
+ "select avg(c8) from stb1",
+ "select avg(c9) from stb1" ,
+
+ "select avg(ts) from stbbb1" ,
+ "select avg(c7) from stbbb1",
+
+ "select avg(ts) from tbname",
+ "select avg(c9) from tbname"
+
+ ]
+
+ for type_sql in type_error_sql_lists:
+ tdSql.error(type_sql)
+
+
+ type_sql_lists = [
+ "select avg(c1) from t1",
+ "select avg(c2) from t1",
+ "select avg(c3) from t1",
+ "select avg(c4) from t1",
+ "select avg(c5) from t1",
+ "select avg(c6) from t1",
+
+ "select avg(c1) from ct1",
+ "select avg(c2) from ct1",
+ "select avg(c3) from ct1",
+ "select avg(c4) from ct1",
+ "select avg(c5) from ct1",
+ "select avg(c6) from ct1",
+
+ "select avg(c1) from ct3",
+ "select avg(c2) from ct3",
+ "select avg(c3) from ct3",
+ "select avg(c4) from ct3",
+ "select avg(c5) from ct3",
+ "select avg(c6) from ct3",
+
+ "select avg(c1) from stb1",
+ "select avg(c2) from stb1",
+ "select avg(c3) from stb1",
+ "select avg(c4) from stb1",
+ "select avg(c5) from stb1",
+ "select avg(c6) from stb1",
+
+ "select avg(c6) as alisb from stb1",
+ "select avg(c6) alisb from stb1",
+ ]
+
+ for type_sql in type_sql_lists:
+ tdSql.query(type_sql)
+
+ def basic_avg_function(self):
+
+ # basic query
+ tdSql.query("select c1 from ct3")
+ tdSql.checkRows(0)
+ tdSql.query("select c1 from t1")
+ tdSql.checkRows(12)
+ tdSql.query("select c1 from stb1")
+ tdSql.checkRows(25)
+
+ # used for empty table , ct3 is empty
+ tdSql.query("select avg(c1) from ct3")
+ tdSql.checkRows(0)
+ tdSql.query("select avg(c2) from ct3")
+ tdSql.checkRows(0)
+ tdSql.query("select avg(c3) from ct3")
+ tdSql.checkRows(0)
+ tdSql.query("select avg(c4) from ct3")
+ tdSql.checkRows(0)
+ tdSql.query("select avg(c5) from ct3")
+ tdSql.checkRows(0)
+ tdSql.query("select avg(c6) from ct3")
+
+ # used for regular table
+ tdSql.query("select avg(c1) from t1")
+ tdSql.checkData(0, 0, 5.000000000)
+
+
+ tdSql.query("select ts,c1, c2, c3 , c4, c5 from t1")
+ tdSql.checkData(1, 5, 1.11000)
+ tdSql.checkData(3, 4, 33)
+ tdSql.checkData(5, 5, None)
+ self.check_avg(" select avg(c1) , avg(c2) , avg(c3) from t1 " , " select sum(c1)/count(c1) , sum(c2)/count(c2) , sum(c3)/count(c3) from t1 ")
+
+ # used for sub table
+ tdSql.query("select avg(c1) from ct1")
+ tdSql.checkData(0, 0, 4.846153846)
+
+ tdSql.query("select avg(c1) from ct3")
+ tdSql.checkRows(0)
+
+ self.check_avg(" select avg(abs(c1)) , avg(abs(c2)) , avg(abs(c3)) from t1 " , " select sum(abs(c1))/count(c1) , sum(abs(c2))/count(c2) , sum(abs(c3))/count(c3) from t1 ")
+ self.check_avg(" select avg(abs(c1)) , avg(abs(c2)) , avg(abs(c3)) from stb1 " , " select sum(abs(c1))/count(c1) , sum(abs(c2))/count(c2) , sum(abs(c3))/count(c3) from stb1 ")
+
+ # used for stable table
+
+ tdSql.query("select avg(c1) from stb1")
+ tdSql.checkRows(1)
+
+ self.check_avg(" select avg(abs(ceil(c1))) , avg(abs(ceil(c2))) , avg(abs(ceil(c3))) from stb1 " , " select sum(abs(ceil(c1)))/count(c1) , sum(abs(ceil(c2)))/count(c2) , sum(abs(ceil(c3)))/count(c3) from stb1 ")
+
+ # used for not exists table
+ tdSql.error("select avg(c1) from stbbb1")
+ tdSql.error("select avg(c1) from tbname")
+ tdSql.error("select avg(c1) from ct5")
+
+ # mix with common col
+ tdSql.error("select c1, avg(c1) from ct1")
+ tdSql.error("select c1, avg(c1) from ct4")
+
+
+ # mix with common functions
+ tdSql.error("select c1, avg(c1),c5, floor(c5) from ct4 ")
+ tdSql.error("select c1, avg(c1),c5, floor(c5) from stb1 ")
+
+ # mix with agg functions , not support
+ tdSql.error("select c1, avg(c1),c5, count(c5) from stb1 ")
+ tdSql.error("select c1, avg(c1),c5, count(c5) from ct1 ")
+ tdSql.error("select c1, count(c5) from ct1 ")
+ tdSql.error("select c1, count(c5) from stb1 ")
+
+ # agg functions mix with agg functions
+
+ tdSql.query(" select max(c5), count(c5) , avg(c5) from stb1 ")
+ tdSql.checkData(0, 0, 8.88000 )
+ tdSql.checkData(0, 1, 22 )
+ tdSql.checkData(0, 2, 2.270454591 )
+
+ tdSql.query(" select max(c5), count(c5) , avg(c5) ,elapsed(ts) , spread(c1) from ct1; ")
+ tdSql.checkData(0, 0, 8.88000 )
+ tdSql.checkData(0, 1, 13 )
+ tdSql.checkData(0, 2, 0.768461603 )
+
+ # bug fix for count
+ tdSql.query("select count(c1) from ct4 ")
+ tdSql.checkData(0,0,9)
+ tdSql.query("select count(*) from ct4 ")
+ tdSql.checkData(0,0,12)
+ tdSql.query("select count(c1) from stb1 ")
+ tdSql.checkData(0,0,22)
+ tdSql.query("select count(*) from stb1 ")
+ tdSql.checkData(0,0,25)
+
+ # bug fix for compute
+ tdSql.error("select c1, avg(c1) -0 ,ceil(c1)-0 from ct4 ")
+ tdSql.error(" select c1, avg(c1) -0 ,avg(ceil(c1-0.1))-0.1 from ct4")
+
+ # mix with nest query
+ self.check_avg("select avg(col) from (select abs(c1) col from stb1)" , "select avg(abs(c1)) from stb1")
+ self.check_avg("select avg(col) from (select ceil(abs(c1)) col from stb1)" , "select avg(abs(c1)) from stb1")
+
+ tdSql.query(" select abs(avg(abs(abs(c1)))) from stb1 ")
+ tdSql.checkData(0, 0, 4.500000000)
+ tdSql.query(" select abs(avg(abs(abs(c1)))) from t1 ")
+ tdSql.checkData(0, 0, 5.000000000)
+
+ tdSql.query(" select abs(avg(abs(abs(c1)))) from stb1 ")
+ tdSql.checkData(0, 0, 4.500000000)
+
+ tdSql.query(" select avg(c1) from stb1 where c1 is null ")
+ tdSql.checkRows(0)
+
+
+ def avg_func_filter(self):
+ tdSql.execute("use db")
+ tdSql.query(" select avg(c1), avg(c1) -0 ,avg(ceil(c1-0.1))-0 ,avg(floor(c1+0.1))-0.1 ,avg(ceil(log(c1,2)-0.5)) from ct4 where c1>5 ")
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,7.000000000)
+ tdSql.checkData(0,1,7.000000000)
+ tdSql.checkData(0,2,7.000000000)
+ tdSql.checkData(0,3,6.900000000)
+ tdSql.checkData(0,4,3.000000000)
+
+ tdSql.query("select avg(c1), avg(c1) -0 ,avg(ceil(c1-0.1))-0 ,avg(floor(c1+0.1))-0.1 ,avg(ceil(log(c1,2)-0.5)) from ct4 where c1=5 ")
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,5.000000000)
+ tdSql.checkData(0,1,5.000000000)
+ tdSql.checkData(0,2,5.000000000)
+ tdSql.checkData(0,3,4.900000000)
+ tdSql.checkData(0,4,2.000000000)
+
+ tdSql.query("select avg(c1) ,avg(c2) , avg(c1) -0 , avg(ceil(c1-0.1))-0 ,avg(floor(c1+0.1))-0.1 ,avg(ceil(log(c1,2))-0.5) from ct4 where c1>log(c1,2) limit 1 ")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, 4.500000000)
+ tdSql.checkData(0, 1, 49999.500000000)
+ tdSql.checkData(0, 5, 1.625000000)
+
+ def avg_Arithmetic(self):
+ pass
+
+ def check_boundary_values(self):
+
+ tdSql.execute("drop database if exists bound_test")
+ tdSql.execute("create database if not exists bound_test")
+ time.sleep(3)
+ tdSql.execute("use bound_test")
+ tdSql.execute(
+ "create table stb_bound (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(32),c9 nchar(32), c10 timestamp) tags (t1 int);"
+ )
+ tdSql.execute(f'create table sub1_bound using stb_bound tags ( 1 )')
+ tdSql.execute(
+ f"insert into sub1_bound values ( now()-1s, 2147483647, 9223372036854775807, 32767, 127, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
+ )
+ tdSql.execute(
+ f"insert into sub1_bound values ( now()-1s, -2147483647, -9223372036854775807, -32767, -127, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
+ )
+ tdSql.execute(
+ f"insert into sub1_bound values ( now(), 2147483646, 9223372036854775806, 32766, 126, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
+ )
+
+ tdSql.execute(
+ f"insert into sub1_bound values ( now(), 2147483645, 9223372036854775805, 32765, 125, 3.40E+37, 1.7e+307, True, 'binary_tb1', 'nchar_tb1', now() )"
+ )
+
+ tdSql.execute(
+ f"insert into sub1_bound values ( now(), 2147483644, 9223372036854775804, 32764, 124, 3.40E+37, 1.7e+307, True, 'binary_tb1', 'nchar_tb1', now() )"
+ )
+
+ tdSql.execute(
+ f"insert into sub1_bound values ( now(), -2147483646, -9223372036854775806, -32766, -126, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
+ )
+ tdSql.execute(
+ f"insert into sub1_bound values ( now(), 2147483646, 9223372036854775806, 32766, 126, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
+ )
+
+
+ tdSql.error(
+ f"insert into sub1_bound values ( now()+1s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
+ )
+ self.check_avg("select avg(c1), avg(c2), avg(c3) , avg(c4), avg(c5) ,avg(c6) from sub1_bound " , " select sum(c1)/count(c1), sum(c2)/count(c2) ,sum(c3)/count(c3), sum(c4)/count(c4), sum(c5)/count(c5) ,sum(c6)/count(c6) from sub1_bound ")
+
+
+ # check basic elem for table per row
+ tdSql.query("select avg(c1) ,avg(c2) , avg(c3) , avg(c4), avg(c5), avg(c6) from sub1_bound ")
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,920350133.571428537)
+ tdSql.checkData(0,1,1.3176245766935393e+18)
+ tdSql.checkData(0,2,14042.142857143)
+ tdSql.checkData(0,3,53.571428571)
+ tdSql.checkData(0,4,5.828571332045761e+37)
+ # tdSql.checkData(0,5,None)
+
+
+ # check + - * / in functions
+ tdSql.query(" select avg(c1+1) ,avg(c2) , avg(c3*1) , avg(c4/2), avg(c5)/2, avg(c6) from sub1_bound ")
+ tdSql.checkData(0,0,920350134.5714285)
+ tdSql.checkData(0,1,1.3176245766935393e+18)
+ tdSql.checkData(0,2,14042.142857143)
+ tdSql.checkData(0,3,26.785714286)
+ tdSql.checkData(0,4,2.9142856660228804e+37)
+ # tdSql.checkData(0,5,None)
+
+
+
+ def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
+ tdSql.prepare()
+
+ tdLog.printNoPrefix("==========step1:create table ==============")
+
+ self.prepare_datas()
+
+ tdLog.printNoPrefix("==========step2:test errors ==============")
+
+ self.test_errors()
+
+ tdLog.printNoPrefix("==========step3:support types ============")
+
+ self.support_types()
+
+ tdLog.printNoPrefix("==========step4: avg basic query ============")
+
+ self.basic_avg_function()
+
+ tdLog.printNoPrefix("==========step5: avg boundary query ============")
+
+ self.check_boundary_values()
+
+ tdLog.printNoPrefix("==========step6: avg filter query ============")
+
+ self.avg_func_filter()
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success(f"{__file__} successfully executed")
+
+tdCases.addLinux(__file__, TDTestCase())
+tdCases.addWindows(__file__, TDTestCase())
diff --git a/tests/system-test/2-query/bottom.py b/tests/system-test/2-query/bottom.py
index 96ae73c6c46fc447692f8e3eec93bfa668f24887..a4390372dfa13ae4d6db6e545fc472b0395aed53 100644
--- a/tests/system-test/2-query/bottom.py
+++ b/tests/system-test/2-query/bottom.py
@@ -80,6 +80,9 @@ class TDTestCase:
tdSql.checkRows(2)
tdSql.checkEqual(tdSql.queryResult,[(2,),(1,)])
+ tdSql.query("select bottom(col13,50) from test")
+ tdSql.checkRows(10)
+
tdSql.query("select bottom(col14, 2) from test")
tdSql.checkRows(2)
tdSql.checkEqual(tdSql.queryResult,[(2,),(1,)])
@@ -91,6 +94,7 @@ class TDTestCase:
tdSql.query('select bottom(col2,1) from test interval(1y) order by col2')
tdSql.checkData(0,0,1)
+
tdSql.error('select * from test where bottom(col2,1)=1')
diff --git a/tests/system-test/2-query/csum.py b/tests/system-test/2-query/csum.py
new file mode 100644
index 0000000000000000000000000000000000000000..a331311fd2e841da5fd4f6da86ccb27834fcbc69
--- /dev/null
+++ b/tests/system-test/2-query/csum.py
@@ -0,0 +1,428 @@
+###################################################################
+# Copyright (c) 2016 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+
+# -*- coding: utf-8 -*-
+
+import sys
+import subprocess
+import random
+import math
+import numpy as np
+import inspect
+import re
+
+from util.log import *
+from util.cases import *
+from util.sql import *
+from util.dnodes import *
+
+
+class TDTestCase:
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor())
+
+ def csum_query_form(self, col="c1", alias="", table_expr="t1", condition=""):
+
+ '''
+ csum function:
+ :param col: string, column name, required parameters;
+ :param alias: string, result column another name,or add other funtion;
+ :param table_expr: string or expression, data source(eg,table/stable name, result set), required parameters;
+ :param condition: expression;
+ :param args: other funtions,like: ', last(col)',or give result column another name, like 'c2'
+ :return: csum query statement,default: select csum(c1) from t1
+ '''
+
+ return f"select csum({col}) {alias} from {table_expr} {condition}"
+
+ def checkcsum(self,col="c1", alias="", table_expr="t1", condition="" ):
+ line = sys._getframe().f_back.f_lineno
+ pre_sql = self.csum_query_form(
+ col=col, table_expr=table_expr, condition=condition
+ ).replace("csum", "count")
+ tdSql.query(pre_sql)
+
+ if tdSql.queryRows == 0:
+ tdSql.query(self.csum_query_form(
+ col=col, alias=alias, table_expr=table_expr, condition=condition
+ ))
+ print(f"case in {line}: ", end='')
+ tdSql.checkRows(0)
+ return
+
+ if "order by tbname" in condition:
+ tdSql.error(self.csum_query_form(
+ col=col, alias=alias, table_expr=table_expr, condition=condition
+ ))
+ return
+
+ if "group" in condition:
+
+ tb_condition = condition.split("group by")[1].split(" ")[1]
+ tdSql.query(f"select distinct {tb_condition} from {table_expr}")
+ query_result = tdSql.queryResult
+ query_rows = tdSql.queryRows
+ clear_condition = re.sub('order by [0-9a-z]*|slimit [0-9]*|soffset [0-9]*', "", condition)
+
+ pre_row = 0
+ for i in range(query_rows):
+ group_name = query_result[i][0]
+ if "where" in clear_condition:
+ pre_condition = re.sub('group by [0-9a-z]*', f"{tb_condition}='{group_name}'", clear_condition)
+ else:
+ pre_condition = "where " + re.sub('group by [0-9a-z]*',f"{tb_condition}='{group_name}'", clear_condition)
+
+ tdSql.query(f"select {col} {alias} from {table_expr} {pre_condition}")
+ pre_data = np.array(tdSql.queryResult)[np.array(tdSql.queryResult) != None]
+ print("data is ", pre_data)
+ pre_csum = np.cumsum(pre_data)
+ tdSql.query(self.csum_query_form(
+ col=col, alias=alias, table_expr=table_expr, condition=condition
+ ))
+ for j in range(len(pre_csum)):
+ print(f"case in {line}:", end='')
+ tdSql.checkData(pre_row+j, 1, pre_csum[j])
+ pre_row += len(pre_csum)
+ return
+ elif "union" in condition:
+ union_sql_0 = self.csum_query_form(
+ col=col, alias=alias, table_expr=table_expr, condition=condition
+ ).split("union all")[0]
+
+ union_sql_1 = self.csum_query_form(
+ col=col, alias=alias, table_expr=table_expr, condition=condition
+ ).split("union all")[1]
+
+ tdSql.query(union_sql_0)
+ union_csum_0 = tdSql.queryResult
+ row_union_0 = tdSql.queryRows
+
+ tdSql.query(union_sql_1)
+ union_csum_1 = tdSql.queryResult
+
+ tdSql.query(self.csum_query_form(
+ col=col, alias=alias, table_expr=table_expr, condition=condition
+ ))
+ for i in range(tdSql.queryRows):
+ print(f"case in {line}: ", end='')
+ if i < row_union_0:
+ tdSql.checkData(i, 0, union_csum_0[i][0])
+ else:
+ tdSql.checkData(i, 0, union_csum_1[i-row_union_0][0])
+ return
+
+ else:
+ tdSql.query(f"select {col} from {table_expr} {re.sub('limit [0-9]*|offset [0-9]*','',condition)}")
+ offset_val = condition.split("offset")[1].split(" ")[1] if "offset" in condition else 0
+ pre_result = np.array(tdSql.queryResult)[np.array(tdSql.queryResult) != None]
+ pre_csum = np.cumsum(pre_result)[offset_val:]
+ tdSql.query(self.csum_query_form(
+ col=col, alias=alias, table_expr=table_expr, condition=condition
+ ))
+
+ for i in range(tdSql.queryRows):
+ print(f"case in {line}: ", end='')
+ if pre_csum[i] >1.7e+308 or pre_csum[i] < -1.7e+308:
+ continue
+ else:
+ tdSql.checkData(i, 0, pre_csum[i])
+
+ pass
+
+ def csum_current_query(self) :
+
+ # table schema :ts timestamp, c1 int, c2 float, c3 timestamp, c4 binary(16), c5 double, c6 bool
+ # c7 bigint, c8 smallint, c9 tinyint, c10 nchar(16)
+
+ # case1~6: numeric col:int/bigint/tinyint/smallint/float/double
+ self.checkcsum()
+ case2 = {"col": "c2"}
+ self.checkcsum(**case2)
+ case3 = {"col": "c5"}
+ self.checkcsum(**case3)
+ case4 = {"col": "c7"}
+ self.checkcsum(**case4)
+ case5 = {"col": "c8"}
+ self.checkcsum(**case5)
+ case6 = {"col": "c9"}
+ self.checkcsum(**case6)
+
+ # case7~8: nested query
+ # case7 = {"table_expr": "(select c1 from stb1)"}
+ # self.checkcsum(**case7)
+ # case8 = {"table_expr": "(select csum(c1) c1 from stb1 group by tbname)"}
+ # self.checkcsum(**case8)
+
+ # case9~10: mix with tbname/ts/tag/col
+ # case9 = {"alias": ", tbname"}
+ # self.checkcsum(**case9)
+ # case10 = {"alias": ", _c0"}
+ # self.checkcsum(**case10)
+ # case11 = {"alias": ", st1"}
+ # self.checkcsum(**case11)
+ # case12 = {"alias": ", c1"}
+ # self.checkcsum(**case12)
+
+ # case13~15: with single condition
+ case13 = {"condition": "where c1 <= 10"}
+ self.checkcsum(**case13)
+ case14 = {"condition": "where c6 in (0, 1)"}
+ self.checkcsum(**case14)
+ case15 = {"condition": "where c1 between 1 and 10"}
+ self.checkcsum(**case15)
+
+ # case16: with multi-condition
+ case16 = {"condition": "where c6=1 or c6 =0"}
+ self.checkcsum(**case16)
+
+ # case17: only support normal table join
+ case17 = {
+ "col": "t1.c1",
+ "table_expr": "t1, t2",
+ "condition": "where t1.ts=t2.ts"
+ }
+ self.checkcsum(**case17)
+ # case18~19: with group by
+ # case18 = {
+ # "table_expr": "t1",
+ # "condition": "group by c6"
+ # }
+ # self.checkcsum(**case18)
+ # case19 = {
+ # "table_expr": "stb1",
+ # "condition": "partition by tbname" # partition by tbname
+ # }
+ # self.checkcsum(**case19)
+
+ # # case20~21: with order by
+ # case20 = {"condition": "order by ts"}
+ # self.checkcsum(**case20)
+
+ # # case22: with union
+ # case22 = {
+ # "condition": "union all select csum(c1) from t2"
+ # }
+ # self.checkcsum(**case22)
+
+ # case23: with limit/slimit
+ case23 = {
+ "condition": "limit 1"
+ }
+ self.checkcsum(**case23)
+ # case24 = {
+ # "table_expr": "stb1",
+ # "condition": "group by tbname slimit 1 soffset 1"
+ # }
+ # self.checkcsum(**case24)
+
+ pass
+
+ def csum_error_query(self) -> None :
+ # unusual test
+ #
+ # table schema :ts timestamp, c1 int, c2 float, c3 timestamp, c4 binary(16), c5 double, c6 bool
+ # c7 bigint, c8 smallint, c9 tinyint, c10 nchar(16)
+ #
+ # form test
+ tdSql.error(self.csum_query_form(col="")) # no col
+ tdSql.error("csum(c1) from stb1") # no select
+ tdSql.error("select csum from t1") # no csum condition
+ tdSql.error("select csum c1 from t1") # no brackets
+ tdSql.error("select csum(c1) t1") # no from
+ tdSql.error("select csum( c1 ) from ") # no table_expr
+ # tdSql.error(self.csum_query_form(col="st1")) # tag col
+ tdSql.error(self.csum_query_form(col=1)) # col is a value
+ tdSql.error(self.csum_query_form(col="'c1'")) # col is a string
+ tdSql.error(self.csum_query_form(col=None)) # col is NULL 1
+ tdSql.error(self.csum_query_form(col="NULL")) # col is NULL 2
+ tdSql.error(self.csum_query_form(col='""')) # col is ""
+ tdSql.error(self.csum_query_form(col='c%')) # col is spercial char 1
+ tdSql.error(self.csum_query_form(col='c_')) # col is spercial char 2
+ tdSql.error(self.csum_query_form(col='c.')) # col is spercial char 3
+ tdSql.error(self.csum_query_form(col='c3')) # timestamp col
+ tdSql.error(self.csum_query_form(col='ts')) # Primary key
+ tdSql.error(self.csum_query_form(col='avg(c1)')) # expr col
+ tdSql.error(self.csum_query_form(col='c6')) # bool col
+ tdSql.error(self.csum_query_form(col='c4')) # binary col
+ tdSql.error(self.csum_query_form(col='c10')) # nachr col
+ tdSql.error(self.csum_query_form(col='c10')) # not table_expr col
+ tdSql.error(self.csum_query_form(col='t1')) # tbname
+ tdSql.error(self.csum_query_form(col='stb1')) # stbname
+ tdSql.error(self.csum_query_form(col='db')) # datbasename
+ tdSql.error(self.csum_query_form(col=True)) # col is BOOL 1
+ tdSql.error(self.csum_query_form(col='True')) # col is BOOL 2
+ tdSql.error(self.csum_query_form(col='*')) # col is all col
+ tdSql.error("select csum[c1] from t1") # sql form error 1
+ tdSql.error("select csum{c1} from t1") # sql form error 2
+ tdSql.error(self.csum_query_form(col="[c1]")) # sql form error 3
+ # tdSql.error(self.csum_query_form(col="c1, c2")) # sql form error 3
+ # tdSql.error(self.csum_query_form(col="c1, 2")) # sql form error 3
+ tdSql.error(self.csum_query_form(alias=", count(c1)")) # mix with aggregate function 1
+ tdSql.error(self.csum_query_form(alias=", avg(c1)")) # mix with aggregate function 2
+ tdSql.error(self.csum_query_form(alias=", min(c1)")) # mix with select function 1
+ tdSql.error(self.csum_query_form(alias=", top(c1, 5)")) # mix with select function 2
+ tdSql.error(self.csum_query_form(alias=", spread(c1)")) # mix with calculation function 1
+ tdSql.error(self.csum_query_form(alias=", diff(c1)")) # mix with calculation function 2
+ # tdSql.error(self.csum_query_form(alias=" + 2")) # mix with arithmetic 1
+ tdSql.error(self.csum_query_form(alias=" + avg(c1)")) # mix with arithmetic 2
+ tdSql.error(self.csum_query_form(alias=", c2")) # mix with other 1
+ # tdSql.error(self.csum_query_form(table_expr="stb1")) # select stb directly
+ stb_join = {
+ "col": "stb1.c1",
+ "table_expr": "stb1, stb2",
+ "condition": "where stb1.ts=stb2.ts and stb1.st1=stb2.st2 order by stb1.ts"
+ }
+ tdSql.error(self.csum_query_form(**stb_join)) # stb join
+ interval_sql = {
+ "condition": "where ts>0 and ts < now interval(1h) fill(next)"
+ }
+ tdSql.error(self.csum_query_form(**interval_sql)) # interval
+ group_normal_col = {
+ "table_expr": "t1",
+ "condition": "group by c6"
+ }
+ tdSql.error(self.csum_query_form(**group_normal_col)) # group by normal col
+ slimit_soffset_sql = {
+ "table_expr": "stb1",
+ "condition": "group by tbname slimit 1 soffset 1"
+ }
+ # tdSql.error(self.csum_query_form(**slimit_soffset_sql))
+ order_by_tbname_sql = {
+ "table_expr": "stb1",
+ "condition": "group by tbname order by tbname"
+ }
+ tdSql.error(self.csum_query_form(**order_by_tbname_sql))
+
+ pass
+
+ def csum_test_data(self, tbnum:int, data_row:int, basetime:int) -> None :
+ for i in range(tbnum):
+ for j in range(data_row):
+ tdSql.execute(
+ f"insert into t{i} values ("
+ f"{basetime + (j+1)*10}, {random.randint(-200, -1)}, {random.uniform(200, -1)}, {basetime + random.randint(-200, -1)}, "
+ f"'binary_{j}', {random.uniform(-200, -1)}, {random.choice([0,1])}, {random.randint(-200,-1)}, "
+ f"{random.randint(-200, -1)}, {random.randint(-127, -1)}, 'nchar_{j}' )"
+ )
+
+ tdSql.execute(
+ f"insert into t{i} values ("
+ f"{basetime - (j+1) * 10}, {random.randint(1, 200)}, {random.uniform(1, 200)}, {basetime - random.randint(1, 200)}, "
+ f"'binary_{j}_1', {random.uniform(1, 200)}, {random.choice([0, 1])}, {random.randint(1,200)}, "
+ f"{random.randint(1,200)}, {random.randint(1,127)}, 'nchar_{j}_1' )"
+ )
+ tdSql.execute(
+ f"insert into tt{i} values ( {basetime-(j+1) * 10}, {random.randint(1, 200)} )"
+ )
+
+ pass
+
+ def csum_test_table(self,tbnum: int) -> None :
+ tdSql.execute("drop database if exists db")
+ tdSql.execute("create database if not exists db keep 3650")
+ tdSql.execute("use db")
+
+ tdSql.execute(
+ "create stable db.stb1 (\
+ ts timestamp, c1 int, c2 float, c3 timestamp, c4 binary(16), c5 double, c6 bool, \
+ c7 bigint, c8 smallint, c9 tinyint, c10 nchar(16)\
+ ) \
+ tags(st1 int)"
+ )
+ tdSql.execute(
+ "create stable db.stb2 (ts timestamp, c1 int) tags(st2 int)"
+ )
+ for i in range(tbnum):
+ tdSql.execute(f"create table t{i} using stb1 tags({i})")
+ tdSql.execute(f"create table tt{i} using stb2 tags({i})")
+
+ pass
+
+ def csum_test_run(self) :
+ tdLog.printNoPrefix("==========TD-10594==========")
+ tbnum = 10
+ nowtime = int(round(time.time() * 1000))
+ per_table_rows = 2
+ self.csum_test_table(tbnum)
+
+ tdLog.printNoPrefix("######## no data test:")
+ self.csum_current_query()
+ self.csum_error_query()
+
+ tdLog.printNoPrefix("######## insert only NULL test:")
+ for i in range(tbnum):
+ tdSql.execute(f"insert into t{i}(ts) values ({nowtime - 5})")
+ tdSql.execute(f"insert into t{i}(ts) values ({nowtime + 5})")
+ self.csum_current_query()
+ self.csum_error_query()
+
+ tdLog.printNoPrefix("######## insert data in the range near the max(bigint/double):")
+ self.csum_test_table(tbnum)
+ tdSql.execute(f"insert into t1(ts, c1,c2,c5,c7) values "
+ f"({nowtime - (per_table_rows + 1) * 10}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})")
+ tdSql.execute(f"insert into t1(ts, c1,c2,c5,c7) values "
+ f"({nowtime - (per_table_rows + 2) * 10}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})")
+ self.csum_current_query()
+ self.csum_error_query()
+
+ tdLog.printNoPrefix("######## insert data in the range near the min(bigint/double):")
+ self.csum_test_table(tbnum)
+ tdSql.execute(f"insert into t1(ts, c1,c2,c5,c7) values "
+ f"({nowtime - (per_table_rows + 1) * 10}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {1-2**63})")
+ tdSql.execute(f"insert into t1(ts, c1,c2,c5,c7) values "
+ f"({nowtime - (per_table_rows + 2) * 10}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {512-2**63})")
+ self.csum_current_query()
+ self.csum_error_query()
+
+ tdLog.printNoPrefix("######## insert data without NULL data test:")
+ self.csum_test_table(tbnum)
+ self.csum_test_data(tbnum, per_table_rows, nowtime)
+ self.csum_current_query()
+ self.csum_error_query()
+
+
+ tdLog.printNoPrefix("######## insert data mix with NULL test:")
+ for i in range(tbnum):
+ tdSql.execute(f"insert into t{i}(ts) values ({nowtime})")
+ tdSql.execute(f"insert into t{i}(ts) values ({nowtime-(per_table_rows+3)*10})")
+ tdSql.execute(f"insert into t{i}(ts) values ({nowtime+(per_table_rows+3)*10})")
+ self.csum_current_query()
+ self.csum_error_query()
+
+
+
+ tdLog.printNoPrefix("######## check after WAL test:")
+ tdSql.query("show dnodes")
+ index = tdSql.getData(0, 0)
+ tdDnodes.stop(index)
+ tdDnodes.start(index)
+ self.csum_current_query()
+ self.csum_error_query()
+
+ def run(self):
+ import traceback
+ try:
+ # run in develop branch
+ self.csum_test_run()
+ pass
+ except Exception as e:
+ traceback.print_exc()
+ raise e
+
+
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success("%s successfully executed" % __file__)
+
+tdCases.addWindows(__file__, TDTestCase())
+tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
diff --git a/tests/system-test/2-query/elapsed.py b/tests/system-test/2-query/elapsed.py
new file mode 100644
index 0000000000000000000000000000000000000000..017090128d40f66eb7f395c75c41cafff2934a47
--- /dev/null
+++ b/tests/system-test/2-query/elapsed.py
@@ -0,0 +1,1604 @@
+###################################################################
+# Copyright (c) 2020 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+
+# -*- coding: utf-8 -*-
+
+import sys
+import os
+
+from util.log import *
+from util.cases import *
+from util.sql import *
+from util.dnodes import *
+
+class TDTestCase:
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor(), logSql)
+
+ self.ts = 1420041600000 # 2015-01-01 00:00:00 this is begin time for first record
+ self.num = 10
+
+ def caseDescription(self):
+
+ '''
+ case1 : [TD-11804] test case for elapsed function :
+
+ this test case is for aggregate function elapsed , elapsed function can only used for the timestamp primary key column (ts) ,
+ it has two input parameters, the first parameter is necessary, basic SQL as follow:
+
+ ===================================================================================================================================
+ SELECT ELAPSED(field_name[, time_unit]) FROM { tb_name | stb_name } [WHERE clause] [INTERVAL(interval [, offset]) [SLIDING sliding]];
+ ===================================================================================================================================
+
+ elapsed function can acting on ordinary tables and super tables , notice that this function is related to the timeline.
+ If it acts on a super table , it must be group by tbname . by the way ,this function support nested query.
+
+ The scenarios covered by the test cases are as follows:
+
+ ====================================================================================================================================
+
+ case: select * from table|stable[group by tbname]|regular_table
+
+ case:select elapsed(ts) from table|stable where clause interval (units) [fill(LINEAR,NEXT,PREV,VALUE,NULL)] [group by tbname] order [by ts desc asc|desc];
+
+ case:select elapsed(ts) , elapsed(ts,unit_time1)*regular_num1 , elapsed(ts,unit_time1)+regular_num2 from table|stable where clause interval (units) [fill(LINEAR,NEXT,PREV,VALUE,NULL)] [group by tbname] order [by ts desc asc|desc];
+
+ //mixup with all functions only once query (it's different with nest query)
+ case:select elapsed(ts), count(*), avg(col), twa(col), irate(col), sum(col), stddev(col), leastsquares(col, 1, 1),min(col), max(col), first(col), last(col), percentile(col, 20), apercentile(col, 30), last_row(col), spread(col)from table|stable where clause interval (units) [fill(LINEAR,NEXT,PREV,VALUE,NULL)] [group by tbname] order [by ts desc asc|desc];
+
+ //mixup with ordinary col
+ case:select ts ,elapsed(ts)*10 ,col+5 from table|stable where clause interval (units) [fill(LINEAR,NEXT,PREV,VALUE,NULL)] [group by tbname] order [by ts desc asc|desc];
+
+ //nest query
+ case:select elapsed(ts) from (select elapsed(ts), count(*), avg(col), twa(col), irate(col), sum(col), stddev(col), leastsquares(col, 1, 1),min(col), max(col), first(col), last(col), percentile(col, 20), apercentile(col, 30), last_row(col), spread(col)from table|stable where clause interval (units) [fill(LINEAR,NEXT,PREV,VALUE,NULL)] [group by tbname] order [by ts desc asc|desc]) where clause interval (units) [fill(LINEAR,NEXT,PREV,VALUE,NULL)] [group by tbname] order [by ts desc asc|desc];
+
+ //clause about filter condition
+ case:select elapsed(ts) from table|stable[group by tbname] where [ts|col|tag >|<|=|>=|<=|=|<>|!= value] | [between ... and ...] |[in] |[is null|not null] interval (unit_time) ;
+ case:select elapsed(ts) from table|stable[group by tbname] where clause1 and clause 2 and clause3 interval (unit_time) ;
+
+ //JOIN query
+ case:select elapsed(ts) from TABLE1 as tb1 , TABLE2 as tb2 where join_condition [TABLE1 and TABLE2 can be stable|table|sub_table|empty_table]
+
+ //UNION ALL query
+ case:select elapsed(ts) from TABLE1 union all select elapsed(ts) from TABLE2 [TABLE1 and TABLE2 can be stable|table|sub_table|empty_table]
+
+ // Window aggregation
+
+ case:select elapsed(ts) from t1 where clause session(ts, time_units) ;
+ case:select elapsed(ts) from t1 where clause state_window(regular_nums);
+
+ // Continuous query
+ case:create table select elapsed(ts) ,avg(col) from (select elapsed(ts) ts_inter ,avg(col) col from stable|table interval (unit_time) [fill(LINEAR,NEXT,PREV,VALUE,NULL)][group by tbname]) interval (unit_time) [fill(LINEAR,NEXT,PREV,VALUE,NULL) sliding(unit_time_windows);
+
+ ========================================================================================================================================
+
+ this test case notice successful execution and correctness of results.
+
+ '''
+ return
+
+ def prepare_data(self):
+
+ tdLog.info (" ====================================== prepare data ==================================================")
+
+ tdSql.execute('drop database if exists testdb ;')
+ tdSql.execute('create database testdb keep 36500;')
+ tdSql.execute('use testdb;')
+
+ tdSql.execute('create stable stable_1(ts timestamp ,tscol timestamp, q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint, q_float float ,\
+ q_double double , bin_chars binary(20)) tags(loc nchar(20) ,ind int,tstag timestamp);')
+ tdSql.execute('create stable stable_2(ts timestamp ,tscol timestamp, q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint, q_float float ,\
+ q_double double, bin_chars binary(20) ) tags(loc nchar(20),ind int,tstag timestamp);')
+ # create empty stables
+ tdSql.execute('create stable stable_empty(ts timestamp ,tscol timestamp, q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint, q_float float ,\
+ q_double double, bin_chars binary(20) ) tags(loc nchar(20),ind int,tstag timestamp);')
+ tdSql.execute('create stable stable_sub_empty(ts timestamp ,tscol timestamp, q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint, q_float float ,\
+ q_double double, bin_chars binary(20) ) tags(loc nchar(20),ind int,tstag timestamp);')
+
+ # create empty sub_talbes and regular tables
+ tdSql.execute('create table sub_empty_1 using stable_sub_empty tags("sub_empty_1",3,"2015-01-01 00:02:00")')
+ tdSql.execute('create table sub_empty_2 using stable_sub_empty tags("sub_empty_2",3,"2015-01-01 00:02:00")')
+ tdSql.execute('create table regular_empty (ts timestamp , tscol timestamp ,q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , bin_chars binary(20)) ;')
+
+ tdSql.execute('create table sub_table1_1 using stable_1 tags("sub1_1",1,"2015-01-01 00:00:00")')
+ tdSql.execute('create table sub_table1_2 using stable_1 tags("sub1_2",2,"2015-01-01 00:01:00")')
+ tdSql.execute('create table sub_table1_3 using stable_1 tags("sub1_3",3,"2015-01-01 00:02:00")')
+
+ tdSql.execute('create table sub_table2_1 using stable_2 tags("sub2_1",1,"2015-01-01 00:00:00")')
+ tdSql.execute('create table sub_table2_2 using stable_2 tags("sub2_2",2,"2015-01-01 00:01:00")')
+ tdSql.execute('create table sub_table2_3 using stable_2 tags("sub2_3",3,"2015-01-01 00:02:00")')
+
+ tdSql.execute('create table regular_table_1 (ts timestamp , tscol timestamp ,q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double, bin_chars binary(20)) ;')
+ tdSql.execute('create table regular_table_2 (ts timestamp , tscol timestamp ,q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , bin_chars binary(20)) ;')
+ tdSql.execute('create table regular_table_3 (ts timestamp , tscol timestamp ,q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , bin_chars binary(20)) ;')
+
+ tablenames = ["sub_table1_1","sub_table1_2","sub_table1_3","sub_table2_1","sub_table2_2","sub_table2_3","regular_table_1","regular_table_2","regular_table_3"]
+
+ tdLog.info("insert into records ")
+
+ for tablename in tablenames:
+
+ for i in range(self.num):
+ sql= 'insert into %s values(%d, %d,%d, %d, %d, %d, %f, %f, "%s")' % (tablename,self.ts + i*10000, self.ts + i*10,2147483647-i, 9223372036854775807-i, 32767-i, 127-i, i, i,("bintest"+str(i)))
+ print(sql)
+ tdSql.execute(sql)
+
+ tdLog.info("=============================================data prepared done!=========================")
+
+ def abnormal_common_test(self):
+
+ tdLog.info (" ====================================== elapsed illeagal params ==================================================")
+
+ tablenames = ["sub_table1_1","sub_table1_2","sub_table1_3","sub_table2_1","sub_table2_2","sub_table2_3","regular_table_1","regular_table_2","regular_table_3"]
+
+ abnormal_list = ["()","(NULL)","(*)","(abc)","( , )","(NULL,*)","( ,NULL)","(%)","(+)","(*,)","(*, /)","(ts,*)" "(ts,tbname*10)","(ts,tagname)",
+ "(ts,2d+3m-2s,NULL)","(ts+1d,10s)","(ts+10d,NULL)" ,"(ts,now -1m%1d)","(ts+10d)","(ts+10d,_c0)","(ts+10d,)","(ts,%)","(ts, , m)","(ts,abc)","(ts,/)","(ts,*)","(ts,1s,100)",
+ "(ts,1s,abc)","(ts,1s,_c0)","(ts,1s,*)","(ts,1s,NULL)","(ts,,_c0)","(ts,tbname,ts)","(ts,0,tbname)","('2021-11-18 00:00:10')","('2021-11-18 00:00:10', 1s)",
+ "('2021-11-18T00:00:10+0800', '1s')","('2021-11-18T00:00:10Z', '1s')","('2021-11-18T00:00:10+0800', 10000000d,)","('ts', ,2021-11-18T00:00:10+0800, )"]
+
+ for tablename in tablenames:
+ for abnormal_param in abnormal_list:
+
+ if tablename.startswith("stable"):
+ basic_sql= "select elapsed" + abnormal_param + " from " + tablename + " group by tbname ,ind order by tbname;" #stables
+ else:
+ basic_sql= "select elapsed" + abnormal_param + " from " + tablename + ";" # regular table
+ tdSql.error(basic_sql)
+
+ def abnormal_use_test(self):
+
+ tdLog.info (" ====================================== elapsed use abnormal ==================================================")
+
+ sqls_list = ["select elapsed(ts) from regular_empty group by tbname,ind order by desc; ",
+ "select elapsed(ts) from regular_empty group by tbname,ind order by desc; ",
+ "select elapsed(ts) from regular_table_1 group by tbname,ind order by desc; ",
+ "select elapsed(ts) from sub_table1_1 group by tbname,ind order by desc; ",
+ "select elapsed(ts) from sub_table1_1 group by tbname,ind order by desc; ",
+ # "select elapsed(ts,10s) from stable_empty group by ts order by ts;",
+ "select elapsed(ts,10s) from stable_1 group by ind order by ts;",
+ "select elapsed(ts,10s) from stable_2 group by tstag order by ts;",
+ "select elapsed(ts,10s) from stable_1 group by tbname,tstag,tscol order by ts;",
+ "select elapsed(ts,10s),ts from stable_1 group by tbname ,ind order by ts;",
+ "select ts,elapsed(ts,10s),tscol*100 from stable_1 group by tbname ,ind order by ts;",
+ "select elapsed(ts) from stable_1 group by tstag order by ts;",
+ "select elapsed(ts) from sub_empty_1 group by tbname,ind ,tscol order by ts desc;",
+ "select tbname, tscol,elapsed(ts) from sub_table1_1 group by tbname ,ind order by ts desc;",
+ "select elapsed(tscol) from sub_table1_1 order by ts desc;",
+ "select elapsed(tstag) from sub_table1_1 order by ts desc;",
+ "select elapsed(ind) from sub_table1_1 order by ts desc;",
+ "select elapsed(tscol) from sub_empty_1 order by ts desc;",
+ "select elapsed(tstag) from sub_empty_1 order by ts desc;",
+ "select elapsed(ind) from sub_table1_1 order by ts desc;",
+ "select elapsed(ind,10s) from sub_table1_1 order by ts desc;",
+ "select elapsed(tscol,10s) from sub_table1_1 order by ts desc;",
+ "select elapsed(tstag,10s) from sub_table1_1 order by ts desc;",
+ "select elapsed(q_int,10s) from sub_table1_1 order by ts desc;",
+ "select elapsed(loc,10s) from sub_table1_1 order by ts desc;",
+ "select elapsed(q_bigint,10s) from sub_table1_1 order by ts desc;",
+ "select elapsed(bin_chars,10s) from sub_table1_1 order by ts desc;"]
+ for sql in sqls_list :
+ tdSql.error(sql)
+
+ def query_filter(self):
+
+ tdLog.info (" ====================================== elapsed query filter ==================================================")
+
+ for i in range(self.num):
+ ts_start_time = self.ts + i*10000
+ ts_col_start_time = self.ts + i*10
+ ts_tag_time = "2015-01-01 00:01:00"
+ ts_end_time = self.ts + (self.num-1-i)*10000
+ ts_col_end_time = self.ts + (self.num-1-i)*10
+
+ filter_sql = "select elapsed(ts,10s) from stable_1 where ts >= %d group by tbname " %(ts_start_time)
+ tdSql.query(filter_sql)
+ tdSql.checkRows(3)
+ tdSql.checkData(0,0,float(self.num -i-1))
+ tdSql.checkData(1,0,float(self.num -i-1))
+ tdSql.checkData(2,0,float(self.num -i-1))
+
+ filter_sql = "select elapsed(ts,10s) from sub_table1_1 where ts >= %d " %(ts_start_time)
+ tdSql.query(filter_sql)
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,float(self.num -i-1))
+
+
+ filter_sql = "select elapsed(ts,10s) from stable_1 where ts >= %d and tscol >= %d and tstag='2015-01-01 00:01:00'group by tbname " %(ts_start_time,ts_col_start_time)
+ tdSql.query(filter_sql)
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,float(self.num -i-1))
+
+ filter_sql = "select elapsed(ts,10s) from sub_table1_1 where ts >= %d and tscol >= %d " %(ts_start_time,ts_col_start_time)
+ tdSql.query(filter_sql)
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,float(self.num -i-1))
+
+ filter_sql = "select elapsed(ts,10s) from stable_1 where ts >= %d and tscol > %d and tstag='2015-01-01 00:01:00' group by tbname" %(ts_start_time,ts_col_start_time)
+ tdSql.query(filter_sql)
+
+ if i == self.num-1:
+ tdSql.checkRows(0)
+ else:
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,float(self.num -i-2))
+
+ filter_sql = "select elapsed(ts,10s) from sub_table1_1 where ts >= %d and tscol > %d " %(ts_start_time,ts_col_start_time)
+ tdSql.query(filter_sql)
+
+ if i == self.num-1:
+ tdSql.checkRows(0)
+ else:
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,float(self.num -i-2))
+
+ filter_sql = "select elapsed(ts,10s) from stable_1 where ts > %d and tscol > %d and tstag < '2015-01-01 00:01:00' group by tbname " %(ts_start_time,ts_col_start_time)
+ tdSql.query(filter_sql)
+
+ if i == self.num-1:
+ tdSql.checkRows(0)
+ else:
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,float(self.num -i-2))
+
+ filter_sql = "select elapsed(ts,10s) from sub_table1_1 where ts > %d and tscol > %d " %(ts_start_time,ts_col_start_time)
+ tdSql.query(filter_sql)
+
+ if i == self.num-1:
+ tdSql.checkRows(0)
+ else:
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,float(self.num -i-2))
+
+ filter_sql = "select elapsed(ts,10s) from stable_1 where ts > %d and tscol <= %d and tstag < '2015-01-01 00:01:00' group by tbname" %(ts_start_time,ts_col_start_time)
+ tdSql.query(filter_sql)
+ tdSql.checkRows(0)
+
+ filter_sql = "select elapsed(ts,10s) from sub_table1_1 where ts > %d and tscol <= %d " %(ts_start_time,ts_col_start_time)
+ tdSql.query(filter_sql)
+ tdSql.checkRows(0)
+
+ filter_sql = "select elapsed(ts,10s) from stable_1 where ts < %d and tscol <= %d and tstag < '2015-01-01 00:01:00' group by tbname" %(ts_end_time,ts_col_end_time)
+ tdSql.query(filter_sql)
+
+ if i == self.num-1:
+ tdSql.checkRows(0)
+ else:
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,float(self.num -i-2))
+
+ filter_sql = "select elapsed(ts,10s) from sub_table1_1 where ts < %d and tscol <= %d " %(ts_end_time,ts_col_end_time)
+ tdSql.query(filter_sql)
+
+ if i == self.num-1:
+ tdSql.checkRows(0)
+ else:
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,float(self.num -i-2))
+
+ filter_sql = "select elapsed(ts,10s) from stable_1 where ts < %d and tscol <= %d group by tbname " %(ts_end_time,ts_col_end_time)
+ tdSql.query(filter_sql)
+
+ if i == self.num-1:
+ tdSql.checkRows(0)
+ else:
+ tdSql.checkRows(3)
+ tdSql.checkData(0,0,float(self.num - i - 2))
+ tdSql.checkData(1,0,float(self.num - i - 2))
+ tdSql.checkData(2,0,float(self.num - i - 2))
+
+ filter_sql = "select elapsed(ts,10s) from sub_table1_1 where ts < %d and tscol <= %d " %(ts_end_time,ts_col_end_time)
+ tdSql.query(filter_sql)
+
+ if i == self.num-1:
+ tdSql.checkRows(0)
+ else:
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,float(self.num - i - 2))
+
+ filter_sql = "select elapsed(ts,10s) from stable_1 where ts = %d and tscol < %d group by tbname " %(ts_end_time,ts_col_end_time)
+ tdSql.query(filter_sql)
+ tdSql.checkRows(0)
+
+ filter_sql = "select elapsed(ts,10s) from sub_table1_1 where ts = %d and tscol < %d " %(ts_end_time,ts_col_end_time)
+ tdSql.query(filter_sql)
+ tdSql.checkRows(0)
+
+ filter_sql = "select elapsed(ts,10s) from stable_1 where q_tinyint != %d and tscol < %d group by tbname " %(i,ts_col_end_time)
+ tdSql.query(filter_sql)
+
+ if i == self.num-1:
+ tdSql.checkRows(0)
+ else:
+ tdSql.checkRows(3)
+ tdSql.checkData(0,0,float(self.num -i-2))
+ tdSql.checkData(1,0,float(self.num -i-2))
+ tdSql.checkData(2,0,float(self.num -i-2))
+
+ filter_sql = "select elapsed(ts,10s) from sub_table1_1 where q_tinyint != %d and tscol < %d " %(i,ts_col_end_time)
+ tdSql.query(filter_sql)
+
+ if i == self.num-1:
+ tdSql.checkRows(0)
+ else:
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,float(self.num -i-2))
+
+ filter_sql = "select elapsed(ts,10s) from stable_1 where q_tinyint != %d and tscol <= %d group by tbname " %(i,ts_col_end_time)
+ tdSql.query(filter_sql)
+
+ if i == self.num:
+ tdSql.checkRows(0)
+ else:
+ tdSql.checkRows(3)
+ tdSql.checkData(0,0,float(self.num - i - 1))
+ tdSql.checkData(1,0,float(self.num - i - 1))
+ tdSql.checkData(2,0,float(self.num - i - 1))
+
+ filter_sql = "select elapsed(ts,10s) from sub_table1_1 where q_tinyint != %d and tscol <= %d " %(i,ts_col_end_time)
+ tdSql.query(filter_sql)
+
+ if i == self.num:
+ tdSql.checkRows(0)
+ else:
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,float(self.num - i - 1))
+
+ filter_sql = "select elapsed(ts,10s) from stable_1 where q_tinyint <> %d and tscol < %d group by tbname " %(i,ts_col_end_time)
+ tdSql.query(filter_sql)
+
+ if i == self.num-1:
+ tdSql.checkRows(0)
+ else:
+ tdSql.checkRows(3)
+ tdSql.checkData(0,0,float(self.num -i-2))
+ tdSql.checkData(1,0,float(self.num -i-2))
+ tdSql.checkData(2,0,float(self.num -i-2))
+
+ filter_sql = "select elapsed(ts,10s) from sub_table1_1 where q_tinyint <> %d and tscol < %d " %(i,ts_col_end_time)
+ tdSql.query(filter_sql)
+
+ if i == self.num-1:
+ tdSql.checkRows(0)
+ else:
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,float(self.num -i-2))
+
+ filter_sql = "select elapsed(ts,10s) from stable_1 where q_tinyint <> %d and tscol <= %d group by tbname " %(i,ts_col_end_time)
+ tdSql.query(filter_sql)
+
+ if i == self.num:
+ tdSql.checkRows(0)
+ else:
+ tdSql.checkRows(3)
+ tdSql.checkData(0,0,float(self.num - i - 1))
+ tdSql.checkData(1,0,float(self.num - i - 1))
+ tdSql.checkData(2,0,float(self.num - i - 1))
+
+ filter_sql = "select elapsed(ts,10s) from sub_table1_1 where q_tinyint <> %d and tscol <= %d " %(i,ts_col_end_time)
+ tdSql.query(filter_sql)
+
+ if i == self.num:
+ tdSql.checkRows(0)
+ else:
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,float(self.num - i - 1))
+
+ # filter between and
+ tdSql.query("select elapsed(ts,10s) from sub_table1_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and q_tinyint between 125 and 127 and tscol <= '2015-01-01 00:01:00.000' ")
+ tdSql.checkData(0,0,2)
+ tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and \
+ q_tinyint between 125 and 127 and tscol <= '2015-01-01 00:01:00.000' group by tbname ")
+ tdSql.checkData(0,0,2)
+ tdSql.checkData(1,0,2)
+ tdSql.checkData(2,0,2)
+
+ # filter in and or
+ tdSql.query("select elapsed(ts,10s) from sub_table1_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and q_tinyint between 125 and 127 and tscol <= '2015-01-01 00:01:00.000' ")
+ tdSql.checkData(0,0,2)
+
+ tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and q_tinyint between 125 and 127 and tscol <= '2015-01-01 00:01:00.000' group by tbname ")
+ tdSql.checkData(0,0,2)
+ tdSql.checkData(1,0,2)
+ tdSql.checkData(2,0,2)
+
+ tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and q_tinyint in (125,126,127) and tscol <= '2015-01-01 00:01:00.000' group by tbname ")
+ tdSql.checkData(0,0,2)
+ tdSql.checkData(1,0,2)
+ tdSql.checkData(2,0,2)
+
+ tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars in ('bintest0','bintest1') and tscol <= '2015-01-01 00:01:00.000' group by tbname ")
+ tdSql.checkData(0,0,1)
+ tdSql.checkData(1,0,1)
+ tdSql.checkData(2,0,1)
+
+ tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars in ('bintest0','bintest1') and tscol <= '2015-01-01 00:01:00.000' group by tbname ")
+ tdSql.checkData(0,0,1)
+ tdSql.checkData(1,0,1)
+ tdSql.checkData(2,0,1)
+
+ tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars like 'bintest_' and tscol <= '2015-01-01 00:01:00.000' group by tbname ")
+ tdSql.checkData(0,0,6)
+ tdSql.checkData(1,0,6)
+ tdSql.checkData(2,0,6)
+
+ tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars like 'bintest_' and tscol <= '2015-01-01 00:01:00.000' group by tbname ")
+ tdSql.checkData(0,0,6)
+ tdSql.checkData(1,0,6)
+ tdSql.checkData(2,0,6)
+
+ tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars is not null and tscol <= '2015-01-01 00:01:00.000' group by tbname; ")
+ tdSql.checkData(0,0,6)
+ tdSql.checkData(1,0,6)
+ tdSql.checkData(2,0,6)
+
+ tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars is null and tscol <= '2015-01-01 00:01:00.000' group by tbname; ")
+ tdSql.checkRows(0)
+
+ tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars match '^b' and tscol <= '2015-01-01 00:01:00.000' group by tbname; ")
+ tdSql.checkRows(3)
+ tdSql.checkData(0,0,6)
+ tdSql.checkData(1,0,6)
+ tdSql.checkData(2,0,6)
+
+ tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars nmatch '^a' and tscol <= '2015-01-01 00:01:00.000' group by tbname; ")
+ tdSql.checkRows(3)
+ tdSql.checkData(0,0,6)
+ tdSql.checkData(1,0,6)
+ tdSql.checkData(2,0,6)
+
+ tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and bin_chars ='bintest1' or bin_chars ='bintest2' and tscol <= '2015-01-01 00:01:00.000' group by tbname; ")
+ tdSql.checkRows(3)
+ tdSql.query("select elapsed(ts,10s) from stable_1 where (ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000') or (ts between '2015-01-01 00:01:00.000' and '2015-01-01 00:02:00.000') group by tbname; ")
+ tdSql.checkRows(3)
+ tdSql.checkData(0,0,9)
+ tdSql.checkData(1,0,9)
+ tdSql.checkData(2,0,9)
+
+ def query_interval(self):
+
+ tdLog.info (" ====================================== elapsed interval sliding fill ==================================================")
+
+ # empty interval
+ tdSql.query("select max(q_int)*10 from stable_empty where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(10s) fill(prev);")
+ tdSql.checkRows(0)
+ tdSql.query("select max(q_int)*10 from sub_empty_2 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(10s) fill(prev);")
+ tdSql.checkRows(0)
+
+ tdSql.query("select elapsed(ts,10s)*10 from stable_empty where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(10s) fill(prev) group by tbname;")
+ tdSql.checkRows(0)
+ tdSql.query("select elapsed(ts,10s)*10 from sub_empty_2 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(10s) fill(prev);")
+ tdSql.checkRows(0)
+
+ for i in range(self.num):
+ ts_start_time = self.ts + i*10000
+ ts_col_start_time = self.ts + i*10
+ ts_tag_time = "2015-01-01 00:01:00"
+ ts_end_time = self.ts + (self.num-1-i)*10000
+ ts_col_end_time = self.ts + (self.num-1-i)*10
+
+
+ # only interval
+ interval_sql = "select elapsed(ts,10s) from stable_1 where ts <=%d interval(10s) group by tbname " %(ts_start_time)
+ tdSql.query(interval_sql)
+ tdSql.checkRows(3*(i+1))
+
+ interval_sql = "select elapsed(ts,10s) from sub_table1_1 where ts <=%d interval(10s) " %(ts_start_time)
+ tdSql.query(interval_sql)
+ tdSql.checkRows(i+1)
+ for x in range(i+1):
+ if x == i:
+ tdSql.checkData(x,1,0)
+ else :
+ tdSql.checkData(x,1,1)
+
+ # interval and fill , fill_type = ["NULL","value,100","prev","next","linear"]
+
+ # interval (10s) and time range is outer records
+
+ tdSql.query("select elapsed(ts,10s)*10 from stable_empty where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(10s) fill(prev) group by tbname;")
+ tdSql.checkRows(0)
+
+ tdSql.query("select elapsed(ts,10s)*10 from sub_empty_2 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(10s) fill(prev);")
+ tdSql.checkRows(0)
+
+ tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(10s) fill(prev) group by tbname;")
+ tdSql.checkRows(180)
+ tdSql.checkData(0,1,10)
+ tdSql.checkData(9,1,0)
+ tdSql.checkData(59,1,0)
+ tdSql.checkData(60,1,10)
+
+ tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(10s) fill(next) group by tbname;")
+ tdSql.checkRows(180)
+ tdSql.checkData(0,1,10)
+ tdSql.checkData(9,1,0)
+ tdSql.checkData(10,1,None)
+ tdSql.checkData(59,1,None)
+ tdSql.checkData(60,1,10)
+ tdSql.checkData(61,1,10)
+
+ tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(10s) fill(linear) group by tbname;")
+ tdSql.checkRows(180)
+ tdSql.checkData(0,1,10)
+ tdSql.checkData(9,1,0)
+ tdSql.checkData(10,1,None)
+ tdSql.checkData(59,1,None)
+ tdSql.checkData(60,1,10)
+ tdSql.checkData(61,1,10)
+
+ tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(10s) fill(NULL) group by tbname;")
+ tdSql.checkRows(180)
+ tdSql.checkData(0,1,10)
+ tdSql.checkData(9,1,0)
+ tdSql.checkData(10,1,None)
+ tdSql.checkData(59,1,None)
+ tdSql.checkData(60,1,10)
+ tdSql.checkData(61,1,10)
+
+ tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(10s) fill(value ,2) group by tbname;")
+ tdSql.checkRows(180)
+ tdSql.checkData(0,1,10)
+ tdSql.checkData(9,1,0)
+ tdSql.checkData(10,1,2)
+ tdSql.checkData(59,1,2)
+ tdSql.checkData(60,1,10)
+ tdSql.checkData(61,1,10)
+
+ # interval (20s) and time range is outer records
+ tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(20s) fill(prev) group by tbname,ind ;")
+ tdSql.checkRows(90)
+ tdSql.checkData(0,1,20)
+ tdSql.checkData(4,1,10)
+ tdSql.checkData(5,1,10)
+ tdSql.checkData(29,1,10)
+ tdSql.checkData(30,1,20)
+ tdSql.checkData(31,1,20)
+
+ tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(20s) fill(next) group by tbname,ind ;")
+ tdSql.checkRows(90)
+ tdSql.checkData(0,1,20)
+ tdSql.checkData(4,1,10)
+ tdSql.checkData(5,1,None)
+ tdSql.checkData(29,1,None)
+ tdSql.checkData(30,1,20)
+ tdSql.checkData(31,1,20)
+
+ tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(20s) fill(linear) group by tbname,ind ;")
+ tdSql.checkRows(90)
+ tdSql.checkData(0,1,20)
+ tdSql.checkData(4,1,10)
+ tdSql.checkData(5,1,None)
+ tdSql.checkData(29,1,None)
+ tdSql.checkData(30,1,20)
+ tdSql.checkData(31,1,20)
+
+ tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(20s) fill(NULL) group by tbname,ind ;")
+ tdSql.checkRows(90)
+ tdSql.checkData(0,1,20)
+ tdSql.checkData(4,1,10)
+ tdSql.checkData(5,1,None)
+ tdSql.checkData(29,1,None)
+ tdSql.checkData(30,1,20)
+ tdSql.checkData(31,1,20)
+
+ tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:10:00.000' interval(20s) fill(value ,2) group by tbname,ind ;")
+ tdSql.checkRows(90)
+ tdSql.checkData(0,1,20)
+ tdSql.checkData(4,1,10)
+ tdSql.checkData(5,1,2)
+ tdSql.checkData(29,1,2)
+ tdSql.checkData(30,1,20)
+ tdSql.checkData(31,1,20)
+
+ # interval (20s) and time range is in records
+
+ tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:01:00.000' interval(20s) fill(prev) group by tbname,ind ;")
+ tdSql.checkRows(9)
+ tdSql.checkData(0,1,20)
+ tdSql.checkData(2,1,10)
+ tdSql.checkData(3,1,20)
+ tdSql.checkData(5,1,10)
+ tdSql.checkData(7,1,20)
+ tdSql.checkData(8,1,10)
+
+ tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:01:00.000' interval(20s) fill(next) group by tbname,ind ;")
+ tdSql.checkRows(9)
+ tdSql.checkData(0,1,20)
+ tdSql.checkData(2,1,10)
+ tdSql.checkData(3,1,20)
+ tdSql.checkData(5,1,10)
+ tdSql.checkData(7,1,20)
+ tdSql.checkData(8,1,10)
+
+ tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:01:00.000' interval(20s) fill(linear) group by tbname,ind ;")
+ tdSql.checkRows(9)
+ tdSql.checkData(0,1,20)
+ tdSql.checkData(2,1,10)
+ tdSql.checkData(3,1,20)
+ tdSql.checkData(5,1,10)
+ tdSql.checkData(7,1,20)
+ tdSql.checkData(8,1,10)
+
+ tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:01:00.000' interval(20s) fill(NULL) group by tbname,ind ;")
+ tdSql.checkRows(9)
+ tdSql.checkData(0,1,20)
+ tdSql.checkData(2,1,10)
+ tdSql.checkData(3,1,20)
+ tdSql.checkData(5,1,10)
+ tdSql.checkData(7,1,20)
+ tdSql.checkData(8,1,10)
+
+ tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:01:00.000' interval(20s) fill(value ,2 ) group by tbname,ind ;")
+ tdSql.checkRows(9)
+ tdSql.checkData(0,1,20)
+ tdSql.checkData(2,1,10)
+ tdSql.checkData(3,1,20)
+ tdSql.checkData(5,1,10)
+ tdSql.checkData(7,1,20)
+ tdSql.checkData(8,1,10)
+
+ tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2015-01-01 00:00:00.000' and ts <'2015-01-01 00:01:00.000' interval(20s) group by tbname,ind ;")
+ tdSql.checkRows(9)
+ tdSql.checkData(0,1,20)
+ tdSql.checkData(2,1,10)
+ tdSql.checkData(3,1,20)
+ tdSql.checkData(5,1,10)
+ tdSql.checkData(7,1,20)
+ tdSql.checkData(8,1,10)
+
+ tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2014-12-31 23:59:00.000' and ts <'2015-01-01 00:01:00.000' interval(20s) fill(NULL) group by tbname,ind ;")
+ tdSql.checkRows(18)
+ tdSql.checkData(0,1,None)
+ tdSql.checkData(2,1,None)
+ tdSql.checkData(3,1,20)
+ tdSql.checkData(5,1,10)
+ tdSql.checkData(7,1,None)
+ tdSql.checkData(8,1,None)
+ tdSql.checkData(9,1,20)
+
+ # interval sliding
+
+ tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2014-12-31 23:59:00.000' and ts <'2015-01-01 00:01:00.000' interval(20s) sliding(20s) fill(NULL) group by tbname,ind ;")
+ tdSql.checkRows(18)
+ tdSql.checkData(0,1,None)
+ tdSql.checkData(2,1,None)
+ tdSql.checkData(3,1,20)
+ tdSql.checkData(5,1,10)
+ tdSql.checkData(7,1,None)
+ tdSql.checkData(8,1,None)
+ tdSql.checkData(9,1,20)
+
+ tdSql.query("select elapsed(ts,10s)*10 from stable_1 where ts >= '2014-12-31 23:59:00.000' and ts <'2015-01-01 00:01:00.000' interval(20s) sliding(10s) fill(NULL) group by tbname,ind ;")
+ tdSql.checkRows(39)
+ tdSql.checkData(0,1,None)
+ tdSql.checkData(2,1,None)
+ tdSql.checkData(6,1,10)
+ tdSql.checkData(7,1,20)
+ tdSql.checkData(12,1,0)
+ tdSql.checkData(13,1,None)
+ tdSql.checkData(15,1,None)
+ tdSql.checkData(19,1,10)
+ tdSql.checkData(20,1,20)
+ tdSql.checkData(25,1,0)
+
+ def query_mix_common(self):
+
+ tdLog.info (" ======================================elapsed mixup with common col, it will not support =======================================")
+
+ tdSql.query("select elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' and ind =1 group by tbname; ")
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,6)
+
+ tdSql.query("select elapsed(ts,10s) from sub_table1_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' ; ")
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,6)
+
+ tdSql.error("select ts,elapsed(ts,10s) from sub_empty_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' ; ")
+ tdSql.error("select ts,elapsed(ts,10s) from stable_empty where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' group by tbname; ")
+
+ tdSql.error("select ts,elapsed(ts,10s) from sub_table1_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' ; ")
+ tdSql.error("select ts,elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' group by tbname; ")
+
+ tdSql.error("select q_int,elapsed(ts,10s) from sub_table1_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' ; ")
+ tdSql.error("select q_int,elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' group by tbname; ")
+
+ tdSql.error("select ts,q_int,elapsed(ts,10s) from sub_table1_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' ; ")
+ tdSql.error("select ts,q_int,elapsed(ts,10s) from stable_1 where ts between '2015-01-01 00:00:00.000' and '2015-01-01 00:01:00.000' group by tbname; ")
+
+ def query_mix_Aggregate(self):
+
+ tdLog.info (" ====================================== elapsed mixup with aggregate ==================================================")
+
+ tdSql.query("select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) from sub_table1_1 ; ")
+
+ data = tdSql.getResult("select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) from sub_table1_1 ; ")
+
+ querys = ["count(*)","avg(q_int)", "sum(q_double)","stddev(q_float)","LEASTSQUARES(q_int,0,1)", "elapsed(ts,10s)"]
+
+ for index , query in enumerate(querys):
+ sql = "select %s from sub_table1_1 " %(query)
+ tdSql.query(sql)
+ tdSql.checkData(0,0,data[0][index])
+
+ tdSql.query("select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) from stable_1 group by tbname; ")
+
+ # Arithmetic with elapsed for common table
+
+ operators = ["+" ,"-" , "*" ,"/" ,"%"]
+ querys_oper = ["count(*)","avg(q_int)", "sum(q_double)","stddev(q_float)", "elapsed(ts,10s)"]
+
+ for operator in operators:
+
+ query_datas=[]
+
+ sql_common= "select "
+
+ for index , query in enumerate(querys_oper):
+
+ query_data = tdSql.getResult("select %s from sub_table1_1;"%query)
+
+ query_datas.append(query_data[0][0])
+ sql_common += " %s %s " %(query,operator)
+ sql_common=sql_common[:-2] + " from sub_table1_1;"
+
+ tdSql.query(sql_common)
+ results= query_datas[0]
+ if operator == "+":
+ for data in query_datas[1:]:
+ results += data
+ tdSql.checkData(0,0,results)
+
+ results= query_datas[0]
+ if operator == "-":
+ for data in query_datas[1:]:
+ results -= data
+ tdSql.checkData(0,0,results)
+
+ results= query_datas[0]
+ if operator == "*":
+ for data in query_datas[1:]:
+ results *= data
+ tdSql.checkData(0,0,results)
+
+ results= query_datas[0]
+ if operator == "/":
+ for data in query_datas[1:]:
+ results /= data
+ tdSql.checkData(0,0,results)
+
+ results= query_datas[0]
+ if operator == "%":
+ for data in query_datas[1:]:
+ results %= data
+ tdSql.checkData(0,0,results)
+
+
+ # Arithmetic with elapsed for super table
+
+ operators = ["+" ,"-" , "*" ,"/" ,"%"]
+ querys_oper = ["count(*)","avg(q_int)", "sum(q_double)","stddev(q_float)", "elapsed(ts,10s)"]
+
+ for operator in operators:
+
+ query_datas=[]
+
+ sql_common= "select "
+
+ for index , query in enumerate(querys_oper):
+
+ query_data = tdSql.getResult("select %s from stable_1 group by tbname;"%query)
+
+ query_datas.append(query_data[0][0])
+ sql_common += " %s %s " %(query,operator)
+ sql_common=sql_common[:-2] + " from stable_1 group by tbname;"
+
+ tdSql.query(sql_common)
+ results= query_datas[0]
+ if operator == "+":
+ for data in query_datas[1:]:
+ results += data
+ tdSql.checkData(0,0,results)
+ tdSql.checkData(1,0,results)
+ tdSql.checkData(2,0,results)
+
+
+ results= query_datas[0]
+ if operator == "-":
+ for data in query_datas[1:]:
+ results -= data
+ tdSql.checkData(0,0,results)
+ tdSql.checkData(1,0,results)
+ tdSql.checkData(2,0,results)
+
+ results= query_datas[0]
+ if operator == "*":
+ for data in query_datas[1:]:
+ results *= data
+ tdSql.checkData(0,0,results)
+ tdSql.checkData(1,0,results)
+ tdSql.checkData(2,0,results)
+
+ results= query_datas[0]
+ if operator == "/":
+ for data in query_datas[1:]:
+ results /= data
+ tdSql.checkData(0,0,results)
+ tdSql.checkData(1,0,results)
+ tdSql.checkData(2,0,results)
+
+ results= query_datas[0]
+ if operator == "%":
+ for data in query_datas[1:]:
+ results %= data
+ tdSql.checkData(0,0,results)
+ tdSql.checkData(1,0,results)
+ tdSql.checkData(2,0,results)
+
+ def query_mix_select(self):
+
+ tdLog.info (" ====================================== elapsed mixup with select function =================================================")
+
+ querys = ["max(q_int)","min(q_int)" , "first(q_tinyint)", "first(*)","last(q_int)","last(*)","PERCENTILE(q_int,10)","APERCENTILE(q_int,10)","elapsed(ts,10s)"]
+
+
+ querys_mix = ["max(q_int)","min(q_int)" , "first(q_tinyint)", "first(q_int)","last(q_int)","PERCENTILE(q_int,10)","APERCENTILE(q_int,10)","elapsed(ts,10s)"]
+
+ tdSql.query("select max(q_int),min(q_int) , first(q_tinyint), first(q_int),last(q_int),PERCENTILE(q_int,10),APERCENTILE(q_int,10) ,elapsed(ts,10s) from sub_table1_1 ; ")
+
+ data = tdSql.getResult("select max(q_int),min(q_int) , first(q_tinyint), first(q_int),last(q_int),PERCENTILE(q_int,10),APERCENTILE(q_int,10) ,elapsed(ts,10s) from sub_table1_1 ; ")
+
+ for index , query in enumerate(querys_mix):
+ sql = "select %s from sub_table1_1 " %(query)
+ tdSql.query(sql)
+ tdSql.checkData(0,0,data[0][index])
+
+ tdSql.query("select max(q_int),min(q_int) , first(q_tinyint), first(q_int),last(q_int),APERCENTILE(q_int,10) ,elapsed(ts,10s) from stable_1 group by tbname ; ")
+
+ data = tdSql.getResult("select max(q_int),min(q_int) , first(q_tinyint), first(q_int),last(q_int),APERCENTILE(q_int,10) ,elapsed(ts,10s) from stable_1 group by tbname ; ")
+
+ querys_mix = ["max(q_int)","min(q_int)" , "first(q_tinyint)", "first(q_int)","last(q_int)","APERCENTILE(q_int,10)","elapsed(ts,10s)"]
+
+ for index , query in enumerate(querys_mix):
+ sql = "select %s from stable_1 group by tbname " %(query)
+ tdSql.query(sql)
+ tdSql.checkData(0,0,data[0][index])
+ tdSql.checkData(1,0,data[0][index])
+ tdSql.checkData(2,0,data[0][index])
+
+ operators = ["+" ,"-" , "*" ,"/" ,"%"]
+ querys_oper = querys_mix
+
+ for operator in operators:
+
+ query_datas=[]
+
+ sql_common= "select "
+
+ for index , query in enumerate(querys_oper):
+
+ query_data = tdSql.getResult("select %s from sub_table1_1;"%query)
+
+ query_datas.append(query_data[0][0])
+ sql_common += " %s %s " %(query,operator)
+ sql_common=sql_common[:-2] + " from sub_table1_1;"
+
+ tdSql.query(sql_common)
+ results= query_datas[0]
+ if operator == "+":
+ for data in query_datas[1:]:
+ results += data
+ tdSql.checkData(0,0,results)
+
+ results= query_datas[0]
+ if operator == "-":
+ for data in query_datas[1:]:
+ results -= data
+ tdSql.checkData(0,0,results)
+
+ results= query_datas[0]
+ if operator == "*":
+ for data in query_datas[1:]:
+ results *= data
+ tdSql.checkData(0,0,results)
+
+ results= query_datas[0]
+ if operator == "/":
+ for data in query_datas[1:]:
+ results /= data
+ tdSql.checkData(0,0,results)
+
+ results= query_datas[0]
+ if operator == "%":
+ for data in query_datas[1:]:
+ results %= data
+ tdSql.checkData(0,0,results)
+
+
+ # Arithmetic with elapsed for super table
+
+ operators = ["+" ,"-" , "*" ,"/" ,"%"]
+ querys_oper = querys_mix
+
+ for operator in operators:
+
+ query_datas=[]
+
+ sql_common= "select "
+
+ for index , query in enumerate(querys_oper):
+
+ query_data = tdSql.getResult("select %s from stable_1 group by tbname;"%query)
+
+ query_datas.append(query_data[0][0])
+ sql_common += " %s %s " %(query,operator)
+ sql_common=sql_common[:-2] + " from stable_1 group by tbname;"
+
+ tdSql.query(sql_common)
+ results= query_datas[0]
+ if operator == "+":
+ for data in query_datas[1:]:
+ results += data
+ tdSql.checkData(0,0,results)
+ tdSql.checkData(1,0,results)
+ tdSql.checkData(2,0,results)
+
+
+ results= query_datas[0]
+ if operator == "-":
+ for data in query_datas[1:]:
+ results -= data
+ tdSql.checkData(0,0,results)
+ tdSql.checkData(1,0,results)
+ tdSql.checkData(2,0,results)
+
+ results= query_datas[0]
+ if operator == "*":
+ for data in query_datas[1:]:
+ results *= data
+ tdSql.checkData(0,0,results)
+ tdSql.checkData(1,0,results)
+ tdSql.checkData(2,0,results)
+
+ results= query_datas[0]
+ if operator == "/":
+ for data in query_datas[1:]:
+ results /= data
+ tdSql.checkData(0,0,results)
+ tdSql.checkData(1,0,results)
+ tdSql.checkData(2,0,results)
+
+ results= query_datas[0]
+ if operator == "%":
+ for data in query_datas[1:]:
+ results %= data
+ tdSql.checkData(0,0,results)
+ tdSql.checkData(1,0,results)
+ tdSql.checkData(2,0,results)
+
+ def query_mix_compute(self):
+
+ tdLog.info (" ====================================== elapsed mixup with compute function =================================================")
+
+ querys = ["diff(q_int)","DERIVATIVE(q_int,1s,1)","spread(ts)","spread(q_tinyint)","ceil(q_float)","floor(q_float)","round(q_float)"]
+
+ for index , query in enumerate(querys):
+
+ sql1 = "select elapsed(ts,10s),%s from sub_table1_1 " %(query)
+ sql2 = "select elapsed(ts,10s),%s from stable_1 group by tbname" %(query)
+ if query in ["diff(q_int)","DERIVATIVE(q_int,1s,1)","ceil(q_float)","floor(q_float)","round(q_float)"]:
+ tdSql.error(sql1)
+ tdSql.error(sql2)
+ continue
+ tdSql.query(sql1)
+ tdSql.query(sql2)
+
+ # only support mixup with spread
+
+ sql = "select spread(ts)*10,spread(q_tinyint)-10,elapsed(ts,10s) from sub_table1_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" ;"
+ tdSql.execute(sql)
+
+ data = tdSql.getResult(sql)
+
+ sql = "select spread(ts)*10,spread(q_tinyint)-10,elapsed(ts,10s) from stable_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" ;"
+ tdSql.execute(sql)
+
+ querys_mix = ["spread(ts)","spread(q_tinyint)-10","elapsed(ts,10s)"]
+
+ for index , query in enumerate(querys_mix):
+ sql = "select %s from sub_table1_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" ; " %(query)
+ tdSql.query(sql)
+
+ operators = ["+" ,"-" , "*" ,"/" ,"%"]
+ querys_oper = querys_mix
+
+ for operator in operators:
+
+ sql_common= "select "
+
+ for index , query in enumerate(querys_oper):
+
+ sql_common += " %s %s " %(query,operator)
+ sql_common=sql_common[:-2] + " from stable_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" ;"
+
+ tdSql.query(sql_common)
+
+ for index , query in enumerate(querys_mix):
+ sql = "select %s from stable_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" ; " %(query)
+ tdSql.query(sql)
+
+ operators = ["+" ,"-" , "*" ,"/" ,"%"]
+ querys_oper = querys_mix
+
+ for operator in operators:
+
+ sql_common= "select "
+
+ for index , query in enumerate(querys_oper):
+
+ sql_common += " %s %s " %(query,operator)
+ sql_common=sql_common[:-2] + " from stable_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" ;"
+
+ tdSql.query(sql_common)
+
+ def query_mix_arithmetic(self):
+
+ tdLog.info (" ====================================== elapsed mixup with arithmetic =================================================")
+
+ tdSql.execute("select elapsed(ts,10s)+1 ,elapsed(ts,10s)-2,elapsed(ts,10s)*3,elapsed(ts,10s)/4,elapsed(ts,10s)%5 from sub_table1_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" ; ")
+ tdSql.execute("select elapsed(ts,10s)+1 ,elapsed(ts,10s)-2,elapsed(ts,10s)*3,elapsed(ts,10s)/4,elapsed(ts,10s)%5 from stable_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" ; ")
+
+ # queries = ["elapsed(ts,10s)+1" ,"elapsed(ts,10s)-2","elapsed(ts,10s)*3","elapsed(ts,10s)/4","elapsed(ts,10s)%5" ]
+
+ # for index ,query in enumerate(queries):
+ # sql = "select %s from sub_table1_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev) ;" % (query)
+ # data = tdSql.getResult(sql)
+ # tdSql.query("select elapsed(ts,10s)+1 ,elapsed(ts,10s)-2,elapsed(ts,10s)*3,elapsed(ts,10s)/4,elapsed(ts,10s)%5 from sub_table1_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev) ; ")
+ # tdSql.checkData(0,index+1,data[0][1])
+
+ def query_with_join(self):
+
+ tdLog.info (" ====================================== elapsed mixup with join =================================================")
+
+ tdSql.error("select elapsed(ts,10s) from stable_empty TABLE1 , stable_empty TABLE2 where TABLE1.ts =TABLE2.ts; ")
+ tdSql.error("select elapsed(ts,10s) from stable_empty TABLE1 , stable_empty TABLE2 where TABLE1.ts =TABLE2.ts group by tbname; ")
+
+ tdSql.execute("select elapsed(ts,10s) from sub_empty_1 TABLE1 , sub_empty_2 TABLE2 where TABLE1.ts =TABLE2.ts; ")
+ tdSql.error("select elapsed(ts,10s) from stable_1 TABLE1 , stable_2 TABLE2 where TABLE1.ts =TABLE2.ts and TABLE1.ind =TABLE2.ind; ")
+ tdSql.error("select elapsed(ts,10s) from stable_1 TABLE1 , stable_2 TABLE2 where TABLE1.ts =TABLE2.ts and TABLE1.ind =TABLE2.ind group by tbname,ind; ") # join not support group by
+
+ tdSql.error("select elapsed(ts,10s) from sub_empty_1 TABLE1 , stable_2 TABLE2 where TABLE1.ts =TABLE2.ts and TABLE1.ind =TABLE2.ind ; ")
+ tdSql.execute("select elapsed(ts,10s) from sub_empty_1 TABLE1 , sub_empty_2 TABLE2 where TABLE1.ts =TABLE2.ts ; ")
+
+ tdSql.query("select elapsed(ts,10s) from sub_table1_1 TABLE1 , sub_table1_2 TABLE2 where TABLE1.ts =TABLE2.ts ; ")
+ tdSql.checkData(0,0,9)
+
+ tdSql.query("select elapsed(ts,10s) from sub_empty_1 TABLE1 , sub_table1_2 TABLE2 where TABLE1.ts =TABLE2.ts ; ")
+ tdSql.checkRows(0)
+
+ tdSql.query("select elapsed(ts,10s) from sub_empty_1 TABLE1 , regular_empty TABLE2 where TABLE1.ts =TABLE2.ts ; ")
+ tdSql.checkRows(0)
+
+ tdSql.query("select elapsed(ts,10s) from sub_empty_1 TABLE1 , regular_table_1 TABLE2 where TABLE1.ts =TABLE2.ts ; ")
+ tdSql.checkRows(0)
+
+ tdSql.query("select elapsed(ts,10s) from sub_table1_3 TABLE1 , regular_table_1 TABLE2 where TABLE1.ts =TABLE2.ts ; ")
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,9)
+
+ tdSql.query("select elapsed(ts,10s) from regular_table_1 ; ")
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,9)
+
+ def query_with_union(self):
+
+ tdLog.info (" ====================================== elapsed mixup with union all =================================================")
+
+ # union all with empty
+
+ tdSql.query("select elapsed(ts,10s) from regular_table_1 union all select elapsed(ts,10s) from regular_table_2;")
+
+ tdSql.query("select elapsed(ts,10s) from regular_table_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev) union all \
+ select elapsed(ts,10s) from regular_table_2 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev);")
+ tdSql.checkRows(1200)
+ tdSql.checkData(0,1,0.1)
+ tdSql.checkData(500,1,0)
+
+ tdSql.query("select elapsed(ts,10s) from sub_empty_1 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev) union all \
+ select elapsed(ts,10s) from regular_table_2 where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev);")
+ tdSql.checkRows(600)
+ tdSql.checkData(0,1,0.1)
+ tdSql.checkData(500,0,0)
+
+ tdSql.query('select elapsed(ts,10s) from sub_empty_1 union all select elapsed(ts,10s) from sub_empty_2;')
+ tdSql.checkRows(0)
+
+ tdSql.query('select elapsed(ts,10s) from regular_table_1 union all select elapsed(ts,10s) from sub_empty_1;')
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,9)
+
+ tdSql.query('select elapsed(ts,10s) from sub_empty_1 union all select elapsed(ts,10s) from regular_table_1;')
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,9)
+
+ tdSql.query('select elapsed(ts,10s) from sub_empty_1 union all select elapsed(ts,10s) from sub_table1_1;')
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,9)
+
+ tdSql.query('select elapsed(ts,10s) from sub_table1_1 union all select elapsed(ts,10s) from sub_empty_1;')
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,9)
+
+ tdSql.query('select elapsed(ts,10s) from sub_empty_1 union all select elapsed(ts,10s) from regular_table_1;')
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,9)
+
+ tdSql.error('select elapsed(ts,10s) from sub_empty_1 union all select elapsed(ts,10s) from stable_sub_empty group by tbname;')
+
+ tdSql.error('select elapsed(ts,10s) from regular_table_1 union all select elapsed(ts,10s) from stable_sub_empty group by tbname;')
+
+ tdSql.query('select elapsed(ts,10s) from sub_empty_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(1s) fill(prev) union all select elapsed(ts,10s) from sub_empty_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(1s) fill(prev);')
+ tdSql.checkRows(0)
+
+ tdSql.error('select elapsed(ts,10s) from sub_empty_1 union all select elapsed(ts,10s) from stable_empty group by tbname;')
+
+ tdSql.error('select elapsed(ts,10s) from sub_empty_1 interval(1s) union all select elapsed(ts,10s) from stable_empty interval(1s) group by tbname;')
+
+ # tdSql.error('select elapsed(ts,10s) from sub_empty_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(1s) fill(prev) union all select elapsed(ts,10s) from stable_empty where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(1s) fill(prev) group by tbname;')
+
+ tdSql.query("select elapsed(ts,10s) from stable_empty group by tbname union all select elapsed(ts,10s) from stable_empty group by tbname ;")
+ tdSql.checkRows(0)
+
+ # case : TD-12229
+ tdSql.query("select elapsed(ts,10s) from stable_empty group by tbname union all select elapsed(ts,10s) from stable_1 group by tbname ;")
+ tdSql.checkRows(3)
+
+ tdSql.query("select elapsed(ts,10s) from stable_1 group by tbname union all select elapsed(ts,10s) from stable_1 group by tbname ;")
+ tdSql.checkRows(6)
+ tdSql.checkData(0,0,9)
+ tdSql.checkData(5,0,9)
+
+ tdSql.query("select elapsed(ts,10s) from stable_1 group by tbname union all select elapsed(ts,10s) from stable_2 group by tbname ;")
+ tdSql.checkRows(6)
+ tdSql.checkData(0,0,9)
+ tdSql.checkData(5,0,9)
+
+ tdSql.query('select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname union all\
+ select elapsed(ts,10s) from stable_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname ;')
+ tdSql.checkRows(360)
+ tdSql.checkData(0,1,1)
+ tdSql.checkData(50,1,0)
+
+ #case : TD-12229
+ tdSql.query('select elapsed(ts,10s) from stable_empty group by tbname union all select elapsed(ts,10s) from stable_2 group by tbname ;')
+ tdSql.checkRows(3)
+
+ tdSql.query('select elapsed(ts,10s) from stable_1 group by tbname union all select elapsed(ts,10s) from stable_empty group by tbname ;')
+ tdSql.checkRows(3)
+
+
+ tdSql.query('select elapsed(ts,10s) from stable_empty where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname union all\
+ select elapsed(ts,10s) from stable_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname ;')
+ tdSql.checkRows(180)
+
+ tdSql.query('select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname union all\
+ select elapsed(ts,10s) from stable_empty where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname ;')
+ tdSql.checkRows(180)
+
+ # union all with sub table and regular table
+
+ # sub_table with sub_table
+
+ tdSql.query('select elapsed(ts,10s) from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
+ select elapsed(ts,10s) from sub_table2_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
+ tdSql.checkRows(120)
+ tdSql.checkData(0,1,1)
+ tdSql.checkData(12,1,0)
+
+ tdSql.query('select elapsed(ts,10s) from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
+ select elapsed(ts,10s) from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
+ tdSql.checkRows(120)
+ tdSql.checkData(0,1,1)
+ tdSql.checkData(12,1,0)
+
+ tdSql.query('select elapsed(ts,10s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
+ select elapsed(ts,10s) from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
+ tdSql.checkRows(120)
+ tdSql.checkData(0,1,1)
+ tdSql.checkData(12,1,0)
+
+ tdSql.query('select elapsed(ts,10s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
+ select elapsed(ts,10s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
+ tdSql.checkRows(120)
+ tdSql.checkData(0,1,1)
+ tdSql.checkData(12,1,0)
+
+ tdSql.query('select elapsed(ts,10s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
+ select elapsed(ts,10s) from regular_table_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
+ tdSql.checkRows(120)
+ tdSql.checkData(0,1,1)
+ tdSql.checkData(12,1,0)
+
+ tdSql.query('select elapsed(ts,10s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
+ select elapsed(ts,10s) from regular_table_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
+ tdSql.checkRows(120)
+ tdSql.checkData(0,1,1)
+ tdSql.checkData(12,1,0)
+
+ tdSql.query('select elapsed(ts,10s) from sub_empty_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
+ select elapsed(ts,10s) from regular_table_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
+ tdSql.checkRows(60)
+ tdSql.checkData(0,1,1)
+ tdSql.checkData(12,1,0)
+
+ tdSql.query('select elapsed(ts,10s) from regular_table_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) union all\
+ select elapsed(ts,10s) from sub_empty_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
+ tdSql.checkRows(60)
+ tdSql.checkData(0,1,1)
+ tdSql.checkData(12,1,0)
+
+ # stable with stable
+
+ tdSql.query('select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname union all\
+ select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname;')
+ tdSql.checkRows(360)
+ tdSql.checkData(0,1,1)
+ tdSql.checkData(12,1,0)
+
+ tdSql.query('select elapsed(ts,10s) from regular_table_2 interval(10s) union all select elapsed(ts,10s) from sub_empty_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev);')
+ tdSql.checkRows(10)
+ tdSql.checkData(0,1,1)
+ tdSql.checkData(9,1,0)
+
+ tdSql.query('select elapsed(ts,10s) from regular_table_2 interval(10s) union all select elapsed(ts,10s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) ;')
+ tdSql.checkRows(70)
+ tdSql.checkData(0,1,1)
+ tdSql.checkData(9,1,0)
+
+ tdSql.query('select elapsed(ts,10s) from regular_table_2 interval(10s) order by ts desc union all select elapsed(ts,10s) from regular_table_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) order by ts asc;')
+ tdSql.checkRows(70)
+ tdSql.checkData(0,1,0)
+ tdSql.checkData(1,1,1)
+ tdSql.checkData(9,1,1)
+
+ tdSql.query('select elapsed(ts,10s) from stable_1 group by tbname, ind order by ts desc union all select elapsed(ts,10s) from stable_2 group by tbname, ind order by ts asc ;')
+ tdSql.checkRows(6)
+ tdSql.checkData(0,0,9)
+
+ tdSql.query('select elapsed(ts,10s) from stable_1 group by tbname, ind order by ts desc union all select elapsed(ts,10s) from stable_1 group by tbname, ind order by ts asc ;')
+ tdSql.checkRows(6)
+ tdSql.checkData(0,0,9)
+
+ tdSql.query('select elapsed(ts,10s) from stable_1 interval(10s) group by tbname,ind order by ts desc union all select elapsed(ts,10s) from stable_2 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname,ind order by ts asc ;')
+ tdSql.checkRows(210)
+ tdSql.checkData(0,1,0)
+ tdSql.checkData(1,1,1)
+ tdSql.checkData(9,1,1)
+
+ tdSql.query('select elapsed(ts,10s) from stable_2 interval(10s) group by tbname,ind order by ts desc union all select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname,ind order by ts asc ;')
+ tdSql.checkRows(210)
+ tdSql.checkData(0,1,0)
+ tdSql.checkData(1,1,1)
+ tdSql.checkData(9,1,1)
+
+ tdSql.query('select elapsed(ts,10s) from stable_1 interval(10s) group by tbname,ind order by ts desc union all select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(10s) fill(prev) group by tbname,ind order by ts asc ;')
+ tdSql.checkRows(210)
+ tdSql.checkData(0,1,0)
+ tdSql.checkData(1,1,1)
+ tdSql.checkData(9,1,1)
+
+ def query_nest(self):
+
+ tdLog.info (" ====================================== elapsed query for nest =================================================")
+
+ # ===============================================outer nest============================================
+
+ # regular table
+
+ # ts can't be used at outer query
+
+ tdSql.query("select elapsed(ts,10s) from (select ts from regular_table_1 );")
+
+ # case : TD-12164
+
+ tdSql.error("select elapsed(ts,10s) from (select qint ts from regular_table_1 );")
+ tdSql.error("select elapsed(tbname ,10s) from (select qint tbname from regular_table_1 );")
+ tdSql.error("select elapsed(tsc ,1s) from (select q_int tsc from regular_table_1) ;")
+ tdSql.error("select elapsed(tsv ,1s) from (select elapsed(ts,1s) tsv from regular_table_1);")
+ tdSql.error("select elapsed(ts ,1s) from (select elapsed(ts,1s) ts from regular_table_1);")
+ # # bug fix
+ # tdSql.error("select elapsed(tsc ,1s) from (select tscol tsc from regular_table_1) ;")
+
+ # case TD-12276
+ # tdSql.error("select elapsed(ts,10s) from (select ts,tbname from regular_table_1 order by ts asc );")
+
+ # tdSql.error("select elapsed(ts,10s) from (select ts,tbname from regular_table_1 order by ts desc );")
+
+ # tdSql.error("select elapsed(ts,10s) from (select ts ,max(q_int),tbname from regular_table_1 order by ts ) interval(1s);")
+
+ # tdSql.error("select elapsed(ts,10s) from (select ts ,q_int,tbname from regular_table_1 order by ts ) interval(1s);")
+
+ # sub table
+
+ tdSql.query("select elapsed(ts,10s) from (select ts from sub_table1_1 );")
+
+ # tdSql.error("select elapsed(ts,10s) from (select ts ,max(q_int),tbname from sub_table1_1 order by ts ) interval(1s);")
+
+ # tdSql.error("select elapsed(ts,10s) from (select ts ,q_int,tbname from sub_table1_1 order by ts ) interval(1s);")
+
+ tdSql.query("select elapsed(ts,10s) from (select ts ,tbname,top(q_int,3) from sub_table1_1 ) interval(10s);")
+
+ tdSql.query("select elapsed(ts,10s) from (select ts ,tbname,bottom(q_int,3) from sub_table1_1 ) interval(10s);")
+
+ tdSql.query("select elapsed(ts,10s) from (select ts ,tbname from sub_table1_1 ) interval(10s);")
+
+ tdSql.query("select elapsed(ts,10s) from (select ts ,tbname from sub_table1_1 ) interval(10s);")
+
+ # tdSql.error("select elapsed(ts,10s) from (select ts ,count(*),tbname from sub_table1_1 order by ts ) interval(1s);")
+
+ querys = ["count(*)","avg(q_int)", "sum(q_double)","stddev(q_float)","LEASTSQUARES(q_int,0,1)","elapsed(ts,10s)"]
+
+ for query in querys:
+ sql1 = "select elapsed(ts,10s) from (select %s from regular_table_1 order by ts ) interval(1s); " % query
+ sql2 = "select elapsed(ts,10s) from (select ts , tbname ,%s from regular_table_1 order by ts ) interval(1s); " % query
+ sql3 = "select elapsed(ts,10s) from (select ts , tbname ,%s from stable_1 group by tbname, ind order by ts ) interval(1s); " % query
+ sql4 = "select elapsed(ts,10s) from (select %s from sub_table2_1 order by ts ) interval(1s); " % query
+ sql5 = "select elapsed(ts,10s) from (select ts , tbname ,%s from sub_table2_1 order by ts ) interval(1s); " % query
+
+ tdSql.error(sql1)
+ tdSql.error(sql2)
+ tdSql.error(sql3)
+ tdSql.error(sql4)
+ tdSql.error(sql5)
+
+
+ # case TD-12164
+ tdSql.error( "select elapsed(ts00 ,1s) from (select elapsed(ts,1s) ts00 from regular_table_1) ; " )
+ tdSql.error( "select elapsed(ts ,1s) from (select elapsed(ts,1s) ts from regular_table_1) ; " )
+
+ tdSql.error( "select elapsed(ts00 ,1s) from (select elapsed(ts,1s) ts00 from stable_1 group by tbname ) ; " )
+ tdSql.error( "select elapsed(ts ,1s) from (select elapsed(ts,1s) ts from stable_1 group by tbname) ; " )
+
+
+ # stable
+
+ tdSql.error("select elapsed(ts,10s) from (select ts from stable_1 ) group by tbname ;")
+
+ tdSql.error("select elapsed(ts,10s) from (select ts ,max(q_int),tbname from stable_1 group by tbname order by ts ) interval(1s) group by tbname;")
+
+ tdSql.error("select elapsed(ts,10s) from (select ts ,q_int,tbname from stable_1 order by ts ) interval(1s) group by tbname;")
+
+ # mixup with aggregate
+
+ querys = ["max(q_int)","min(q_int)" , "first(q_tinyint)", "first(*)","last(q_int)","last(*)","top(q_double,1)",
+ "bottom(q_float,1)","PERCENTILE(q_int,10)","APERCENTILE(q_int,10)" ,"elapsed(ts,10s)"]
+
+ for index , query in enumerate(querys):
+
+ sql1 = "select elapsed(ts,10s) from (select %s from sub_table1_1) where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(10s) fill(prev) ; " %(query)
+ sql2 = "select elapsed(ts,10s) from (select %s from stable_1 ) where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(10s) fill(prev) group by tbname; " %(query)
+ sql3 = "select elapsed(ts,10s) from (select %s from stable_1 group by tbname) where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(10s) fill(prev) group by tbname; " %(query)
+
+ if query in ["interp(q_int)" ]:
+ # print(sql1 )
+ # print(sql2)
+ tdSql.query(sql1)
+ tdSql.error(sql2)
+ else:
+ tdSql.error(sql1)
+ tdSql.error(sql2)
+ tdSql.error(sql3)
+
+ tdSql.error("select elapsed(ts,10s) from (select ts,tbname from regular_table_1 order by ts ) where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev);")
+
+ tdSql.error("select elapsed(ts,10s) from (select ts ,max(q_int),tbname from regular_table_1 order by ts ) where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev);")
+
+ # ===============================================inner nest============================================
+
+ # sub table
+
+ tdSql.query("select data from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from sub_table1_1 ); ")
+ tdSql.checkData(0,0,9)
+
+ # tdSql.query("select data from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from sub_table1_1 \
+ # where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
+ # tdSql.checkRows(600)
+ # tdSql.checkData(0,0,0.1)
+
+ tdSql.query("select * from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 ); ")
+ tdSql.checkData(0,5,9)
+
+ # tdSql.query("select * from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
+ # where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
+ # tdSql.checkRows(600)
+ # tdSql.checkData(0,0,0.1)
+
+ tdSql.query("select max(data) from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 ); ")
+ tdSql.checkData(0,0,9)
+
+ # tdSql.query("select max(data) from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
+ # where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
+ # tdSql.checkRows(1)
+ # tdSql.checkData(0,0,0.1)
+
+ # tdSql.query("select max(data) from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from sub_empty_2 \
+ # where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
+ # tdSql.checkRows(0)
+
+ # tdSql.query("select max(data),min(data),avg(data) from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
+ # where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
+ # tdSql.checkRows(1)
+
+ # tdSql.query("select ceil(data),floor(data),round(data) from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
+ # where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
+ # tdSql.checkRows(600)
+
+ # tdSql.query("select spread(data) from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
+ # where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
+ # tdSql.checkRows(1)
+
+ # tdSql.query("select diff(data) from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
+ # where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
+ # tdSql.checkRows(599)
+
+ # tdSql.query("select DERIVATIVE(data ,1s ,1) from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
+ # where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
+ # tdSql.checkRows(598)
+
+ # tdSql.query("select ceil(data)from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
+ # where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
+ # tdSql.checkRows(600)
+
+ # tdSql.query("select floor(data)from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
+ # where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
+ # tdSql.checkRows(600)
+
+ # tdSql.query("select round(data)from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
+ # where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
+ # tdSql.checkRows(600)
+
+ # tdSql.query("select data*10+2 from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
+ # where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
+ # tdSql.checkRows(600)
+
+ # tdSql.query("select data*10+2 from (select count(*),avg(q_int) , sum(q_double),stddev(q_float),LEASTSQUARES(q_int,0,1), elapsed(ts,10s) data from regular_table_3 \
+ # where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" interval(1s) fill(prev)); ")
+ # tdSql.checkRows(600)
+
+ def query_session_windows(self):
+
+ # case TD-12344
+ # session not support stable
+ tdSql.error('select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" session(ts ,10s) group by tbname,ind order by ts asc ')
+
+ tdSql.query('select elapsed(ts,10s) from sub_table1_1 session(ts,1w) ; ')
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,9)
+ tdSql.query('select elapsed(ts,10s) from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" session(ts,1w) ; ')
+ tdSql.checkRows(1)
+ tdSql.checkData(0,0,9)
+
+ tdSql.error('select elapsed(ts,10s) from ( select * from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000") session(ts,1w) ; ')
+
+ tdSql.error('select elapsed(ts,10s) from ( select ts ,q_int from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000") session(ts,1w) ; ')
+
+ tdSql.error('select elapsed(ts,10s) from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(20s) fill (next) session(ts,1w) ; ')
+
+ tdSql.query('select elapsed(ts,10s) from sub_empty_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" session(ts,1w) ; ')
+ tdSql.checkRows(0)
+
+ # windows state
+ # not support stable
+
+ tdSql.error('select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" state_window(q_int) group by tbname,ind order by ts asc ')
+
+ tdSql.query('select elapsed(ts,10s) from sub_table1_1 state_window(q_int) ; ')
+ tdSql.checkRows(10)
+ tdSql.checkData(0,0,0)
+ tdSql.query('select elapsed(ts,10s) from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" state_window(q_int) ; ')
+ tdSql.checkRows(10)
+ tdSql.checkData(0,0,0)
+
+ # tdSql.error('select elapsed(ts,10s) from ( select * from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000") state_window(q_int) ; ')
+
+ # tdSql.error('select elapsed(ts,10s) from ( select ts ,q_int from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000") state_window(q_int) ; ')
+
+ # tdSql.error('select elapsed(ts,10s) from sub_table1_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" interval(20s) fill (next) state_window(q_int) ; ')
+
+ # tdSql.query('select elapsed(ts,10s) from sub_empty_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" state_window(q_int); ')
+ # tdSql.checkRows(0)
+
+
+ def continuous_query(self):
+ tdSql.error('create table elapsed_t as select elapsed(ts) from sub_table1_1 interval(1m) sliding(30s);')
+ tdSql.error('create table elapsed_tb as select elapsed(ts) from stable_1 interval(1m) sliding(30s) group by tbname;')
+ tdSql.error('create table elapsed_tc as select elapsed(ts) from stable_1 interval(10s) sliding(5s) interval(1m) sliding(30s) group by tbname;')
+
+ def query_precision(self):
+ def generate_data(precision="ms"):
+
+ tdSql.execute("create database if not exists db_%s precision '%s';" %(precision, precision))
+ tdSql.execute("use db_%s;" %precision)
+ tdSql.execute("create stable db_%s.st (ts timestamp , id int) tags(ind int);"%precision)
+ tdSql.execute("create table db_%s.tb1 using st tags(1);"%precision)
+ tdSql.execute("create table db_%s.tb2 using st tags(2);"%precision)
+
+ if precision == "ms":
+ start_ts = self.ts
+ step = 10000
+ elif precision == "us":
+ start_ts = self.ts*1000
+ step = 10000000
+ elif precision == "ns":
+ start_ts = self.ts*1000000
+ step = 10000000000
+ else:
+ pass
+
+ for i in range(10):
+
+ sql1 = "insert into db_%s.tb1 values (%d,%d)"%(precision ,start_ts+i*step,i)
+ sql2 = "insert into db_%s.tb1 values (%d,%d)"%(precision, start_ts+i*step,i)
+ tdSql.execute(sql1)
+ tdSql.execute(sql2)
+
+ time_units = ["10s","10a","10u","10b"]
+
+ precision_list = ["ms","us","ns"]
+ for pres in precision_list:
+ generate_data(pres)
+
+ for index,unit in enumerate(time_units):
+
+ if pres == "ms":
+ if unit in ["10u","10b"]:
+ tdSql.error("select elapsed(ts,%s) from db_%s.st group by tbname "%(unit,pres))
+ pass
+ else:
+ tdSql.query("select elapsed(ts,%s) from db_%s.st group by tbname "%(unit,pres))
+ elif pres == "us" and unit in ["10b"]:
+ if unit in ["10b"]:
+ tdSql.error("select elapsed(ts,%s) from db_%s.st group by tbname "%(unit,pres))
+ pass
+ else:
+ tdSql.query("select elapsed(ts,%s) from db_%s.st group by tbname "%(unit,pres))
+ else:
+
+ tdSql.query("select elapsed(ts,%s) from db_%s.st group by tbname "%(unit,pres))
+ basic_result = 9
+ tdSql.checkData(0,0,basic_result*pow(1000,index))
+
+ def run(self):
+ tdSql.prepare()
+ self.prepare_data()
+ self.abnormal_common_test()
+ self.abnormal_use_test()
+ self.query_filter()
+ # self.query_interval()
+ self.query_mix_common()
+ self.query_mix_Aggregate()
+ self.query_mix_select()
+ self.query_mix_compute()
+ self.query_mix_arithmetic()
+ # self.query_with_join()
+ # self.query_with_union()
+ self.query_nest()
+ self.query_session_windows()
+ self.continuous_query()
+ self.query_precision()
+
+ 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/function_diff.py b/tests/system-test/2-query/function_diff.py
new file mode 100644
index 0000000000000000000000000000000000000000..325bd2bc8ebd79f3e58daf6690492dc8ca329dda
--- /dev/null
+++ b/tests/system-test/2-query/function_diff.py
@@ -0,0 +1,432 @@
+###################################################################
+# Copyright (c) 2016 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+
+# -*- coding: utf-8 -*-
+
+import sys
+import subprocess
+import random
+import math
+import numpy as np
+import inspect
+import re
+
+from util.log import *
+from util.cases import *
+from util.sql import *
+from util.dnodes import *
+
+
+class TDTestCase:
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor())
+
+ def diff_query_form(self, col="c1", alias="", table_expr="t1", condition=""):
+
+ '''
+ diff function:
+ :param col: string, column name, required parameters;
+ :param alias: string, result column another name,or add other funtion;
+ :param table_expr: string or expression, data source(eg,table/stable name, result set), required parameters;
+ :param condition: expression;
+ :param args: other funtions,like: ', last(col)',or give result column another name, like 'c2'
+ :return: diff query statement,default: select diff(c1) from t1
+ '''
+
+ return f"select diff({col}) {alias} from {table_expr} {condition}"
+
+ def checkdiff(self,col="c1", alias="", table_expr="t1", condition="" ):
+ line = sys._getframe().f_back.f_lineno
+ pre_sql = self.diff_query_form(
+ col=col, table_expr=table_expr, condition=condition
+ ).replace("diff", "count")
+ tdSql.query(pre_sql)
+
+ if tdSql.queryRows == 0:
+ tdSql.query(self.diff_query_form(
+ col=col, alias=alias, table_expr=table_expr, condition=condition
+ ))
+ print(f"case in {line}: ", end='')
+ tdSql.checkRows(0)
+ return
+
+ if "order by tbname" in condition:
+ tdSql.error(self.diff_query_form(
+ col=col, alias=alias, table_expr=table_expr, condition=condition
+ ))
+ return
+
+ if "group" in condition:
+
+ tb_condition = condition.split("group by")[1].split(" ")[1]
+ tdSql.query(f"select distinct {tb_condition} from {table_expr}")
+ query_result = tdSql.queryResult
+ query_rows = tdSql.queryRows
+ clear_condition = re.sub('order by [0-9a-z]*|slimit [0-9]*|soffset [0-9]*', "", condition)
+
+ pre_row = 0
+ for i in range(query_rows):
+ group_name = query_result[i][0]
+ if "where" in clear_condition:
+ pre_condition = re.sub('group by [0-9a-z]*', f"{tb_condition}='{group_name}'", clear_condition)
+ else:
+ pre_condition = "where " + re.sub('group by [0-9a-z]*',f"{tb_condition}='{group_name}'", clear_condition)
+
+ tdSql.query(f"select {col} {alias} from {table_expr} {pre_condition}")
+ pre_data = np.array(tdSql.queryResult)[np.array(tdSql.queryResult) != None]
+ pre_diff = np.diff(pre_data)
+ # trans precision for data
+ tdSql.query(self.diff_query_form(
+ col=col, alias=alias, table_expr=table_expr, condition=condition
+ ))
+ for j in range(len(pre_diff)):
+ print(f"case in {line}:", end='')
+ if isinstance(pre_diff[j] , float) :
+ pass
+ else:
+ tdSql.checkData(pre_row+j, 1, pre_diff[j] )
+ pre_row += len(pre_diff)
+ return
+ elif "union" in condition:
+ union_sql_0 = self.diff_query_form(
+ col=col, alias=alias, table_expr=table_expr, condition=condition
+ ).split("union all")[0]
+
+ union_sql_1 = self.diff_query_form(
+ col=col, alias=alias, table_expr=table_expr, condition=condition
+ ).split("union all")[1]
+
+ tdSql.query(union_sql_0)
+ union_diff_0 = tdSql.queryResult
+ row_union_0 = tdSql.queryRows
+
+ tdSql.query(union_sql_1)
+ union_diff_1 = tdSql.queryResult
+
+ tdSql.query(self.diff_query_form(
+ col=col, alias=alias, table_expr=table_expr, condition=condition
+ ))
+ for i in range(tdSql.queryRows):
+ print(f"case in {line}: ", end='')
+ if i < row_union_0:
+ tdSql.checkData(i, 0, union_diff_0[i][0])
+ else:
+ tdSql.checkData(i, 0, union_diff_1[i-row_union_0][0])
+ return
+
+ else:
+ tdSql.query(f"select {col} from {table_expr} {re.sub('limit [0-9]*|offset [0-9]*','',condition)}")
+ offset_val = condition.split("offset")[1].split(" ")[1] if "offset" in condition else 0
+ pre_result = np.array(tdSql.queryResult)[np.array(tdSql.queryResult) != None]
+ pre_diff = np.diff(pre_result)[offset_val:]
+ tdSql.query(self.diff_query_form(
+ col=col, alias=alias, table_expr=table_expr, condition=condition
+ ))
+
+ for i in range(tdSql.queryRows):
+ print(f"case in {line}: ", end='')
+ if isinstance(pre_diff[i] , float ):
+ pass
+ else:
+ tdSql.checkData(i, 0, pre_diff[i])
+
+ pass
+
+ def diff_current_query(self) :
+
+ # table schema :ts timestamp, c1 int, c2 float, c3 timestamp, c4 binary(16), c5 double, c6 bool
+ # c7 bigint, c8 smallint, c9 tinyint, c10 nchar(16)
+
+ # case1~6: numeric col:int/bigint/tinyint/smallint/float/double
+ self.checkdiff()
+ case2 = {"col": "c2"}
+ self.checkdiff(**case2)
+ case3 = {"col": "c5"}
+ self.checkdiff(**case3)
+ case4 = {"col": "c7"}
+ self.checkdiff(**case4)
+ case5 = {"col": "c8"}
+ self.checkdiff(**case5)
+ case6 = {"col": "c9"}
+ self.checkdiff(**case6)
+
+ # case7~8: nested query
+ # case7 = {"table_expr": "(select c1 from stb1)"}
+ # self.checkdiff(**case7)
+ # case8 = {"table_expr": "(select diff(c1) c1 from stb1 group by tbname)"}
+ # self.checkdiff(**case8)
+
+ # case9~10: mix with tbname/ts/tag/col
+ # case9 = {"alias": ", tbname"}
+ # self.checkdiff(**case9)
+ # case10 = {"alias": ", _c0"}
+ # self.checkdiff(**case10)
+ # case11 = {"alias": ", st1"}
+ # self.checkdiff(**case11)
+ # case12 = {"alias": ", c1"}
+ # self.checkdiff(**case12)
+
+ # case13~15: with single condition
+ case13 = {"condition": "where c1 <= 10"}
+ self.checkdiff(**case13)
+ case14 = {"condition": "where c6 in (0, 1)"}
+ self.checkdiff(**case14)
+ case15 = {"condition": "where c1 between 1 and 10"}
+ self.checkdiff(**case15)
+
+ # case16: with multi-condition
+ case16 = {"condition": "where c6=1 or c6 =0"}
+ self.checkdiff(**case16)
+
+ # case17: only support normal table join
+ case17 = {
+ "col": "t1.c1",
+ "table_expr": "t1, t2",
+ "condition": "where t1.ts=t2.ts"
+ }
+ self.checkdiff(**case17)
+ # case18~19: with group by
+ # case18 = {
+ # "table_expr": "t1",
+ # "condition": "group by c6"
+ # }
+ # self.checkdiff(**case18)
+ # case19 = {
+ # "table_expr": "stb1",
+ # "condition": "partition by tbname" # partition by tbname
+ # }
+ # self.checkdiff(**case19)
+
+ # # case20~21: with order by
+ # case20 = {"condition": "order by ts"}
+ # self.checkdiff(**case20)
+
+ # # case22: with union
+ # case22 = {
+ # "condition": "union all select diff(c1) from t2"
+ # }
+ # self.checkdiff(**case22)
+
+ # case23: with limit/slimit
+ case23 = {
+ "condition": "limit 1"
+ }
+ self.checkdiff(**case23)
+ # case24 = {
+ # "table_expr": "stb1",
+ # "condition": "group by tbname slimit 1 soffset 1"
+ # }
+ # self.checkdiff(**case24)
+
+ pass
+
+ def diff_error_query(self) -> None :
+ # unusual test
+ #
+ # table schema :ts timestamp, c1 int, c2 float, c3 timestamp, c4 binary(16), c5 double, c6 bool
+ # c7 bigint, c8 smallint, c9 tinyint, c10 nchar(16)
+ #
+ # form test
+ tdSql.error(self.diff_query_form(col="")) # no col
+ tdSql.error("diff(c1) from stb1") # no select
+ tdSql.error("select diff from t1") # no diff condition
+ tdSql.error("select diff c1 from t1") # no brackets
+ tdSql.error("select diff(c1) t1") # no from
+ tdSql.error("select diff( c1 ) from ") # no table_expr
+ # tdSql.error(self.diff_query_form(col="st1")) # tag col
+ tdSql.query("select diff(st1) from t1 ")
+ # tdSql.error(self.diff_query_form(col=1)) # col is a value
+ tdSql.error(self.diff_query_form(col="'c1'")) # col is a string
+ tdSql.error(self.diff_query_form(col=None)) # col is NULL 1
+ tdSql.error(self.diff_query_form(col="NULL")) # col is NULL 2
+ tdSql.error(self.diff_query_form(col='""')) # col is ""
+ tdSql.error(self.diff_query_form(col='c%')) # col is spercial char 1
+ tdSql.error(self.diff_query_form(col='c_')) # col is spercial char 2
+ tdSql.error(self.diff_query_form(col='c.')) # col is spercial char 3
+ tdSql.error(self.diff_query_form(col='c3')) # timestamp col
+ tdSql.error(self.diff_query_form(col='ts')) # Primary key
+ tdSql.error(self.diff_query_form(col='avg(c1)')) # expr col
+ # tdSql.error(self.diff_query_form(col='c6')) # bool col
+ tdSql.query("select diff(c6) from t1")
+ tdSql.error(self.diff_query_form(col='c4')) # binary col
+ tdSql.error(self.diff_query_form(col='c10')) # nachr col
+ tdSql.error(self.diff_query_form(col='c10')) # not table_expr col
+ tdSql.error(self.diff_query_form(col='t1')) # tbname
+ tdSql.error(self.diff_query_form(col='stb1')) # stbname
+ tdSql.error(self.diff_query_form(col='db')) # datbasename
+ # tdSql.error(self.diff_query_form(col=True)) # col is BOOL 1
+ # tdSql.error(self.diff_query_form(col='True')) # col is BOOL 2
+ tdSql.error(self.diff_query_form(col='*')) # col is all col
+ tdSql.error("select diff[c1] from t1") # sql form error 1
+ tdSql.error("select diff{c1} from t1") # sql form error 2
+ tdSql.error(self.diff_query_form(col="[c1]")) # sql form error 3
+ # tdSql.error(self.diff_query_form(col="c1, c2")) # sql form error 3
+ # tdSql.error(self.diff_query_form(col="c1, 2")) # sql form error 3
+ tdSql.error(self.diff_query_form(alias=", count(c1)")) # mix with aggregate function 1
+ tdSql.error(self.diff_query_form(alias=", avg(c1)")) # mix with aggregate function 2
+ tdSql.error(self.diff_query_form(alias=", min(c1)")) # mix with select function 1
+ tdSql.error(self.diff_query_form(alias=", top(c1, 5)")) # mix with select function 2
+ tdSql.error(self.diff_query_form(alias=", spread(c1)")) # mix with calculation function 1
+ tdSql.error(self.diff_query_form(alias=", diff(c1)")) # mix with calculation function 2
+ # tdSql.error(self.diff_query_form(alias=" + 2")) # mix with arithmetic 1
+ tdSql.error(self.diff_query_form(alias=" + avg(c1)")) # mix with arithmetic 2
+ tdSql.error(self.diff_query_form(alias=", c2")) # mix with other 1
+ # tdSql.error(self.diff_query_form(table_expr="stb1")) # select stb directly
+ stb_join = {
+ "col": "stb1.c1",
+ "table_expr": "stb1, stb2",
+ "condition": "where stb1.ts=stb2.ts and stb1.st1=stb2.st2 order by stb1.ts"
+ }
+ tdSql.error(self.diff_query_form(**stb_join)) # stb join
+ interval_sql = {
+ "condition": "where ts>0 and ts < now interval(1h) fill(next)"
+ }
+ tdSql.error(self.diff_query_form(**interval_sql)) # interval
+ group_normal_col = {
+ "table_expr": "t1",
+ "condition": "group by c6"
+ }
+ tdSql.error(self.diff_query_form(**group_normal_col)) # group by normal col
+ slimit_soffset_sql = {
+ "table_expr": "stb1",
+ "condition": "group by tbname slimit 1 soffset 1"
+ }
+ # tdSql.error(self.diff_query_form(**slimit_soffset_sql))
+ order_by_tbname_sql = {
+ "table_expr": "stb1",
+ "condition": "group by tbname order by tbname"
+ }
+ tdSql.error(self.diff_query_form(**order_by_tbname_sql))
+
+ pass
+
+ def diff_test_data(self, tbnum:int, data_row:int, basetime:int) -> None :
+ for i in range(tbnum):
+ for j in range(data_row):
+ tdSql.execute(
+ f"insert into t{i} values ("
+ f"{basetime + (j+1)*10}, {random.randint(-200, -1)}, {random.uniform(200, -1)}, {basetime + random.randint(-200, -1)}, "
+ f"'binary_{j}', {random.uniform(-200, -1)}, {random.choice([0,1])}, {random.randint(-200,-1)}, "
+ f"{random.randint(-200, -1)}, {random.randint(-127, -1)}, 'nchar_{j}' )"
+ )
+
+ tdSql.execute(
+ f"insert into t{i} values ("
+ f"{basetime - (j+1) * 10}, {random.randint(1, 200)}, {random.uniform(1, 200)}, {basetime - random.randint(1, 200)}, "
+ f"'binary_{j}_1', {random.uniform(1, 200)}, {random.choice([0, 1])}, {random.randint(1,200)}, "
+ f"{random.randint(1,200)}, {random.randint(1,127)}, 'nchar_{j}_1' )"
+ )
+ tdSql.execute(
+ f"insert into tt{i} values ( {basetime-(j+1) * 10}, {random.randint(1, 200)} )"
+ )
+
+ pass
+
+ def diff_test_table(self,tbnum: int) -> None :
+ tdSql.execute("drop database if exists db")
+ tdSql.execute("create database if not exists db keep 3650")
+ tdSql.execute("use db")
+
+ tdSql.execute(
+ "create stable db.stb1 (\
+ ts timestamp, c1 int, c2 float, c3 timestamp, c4 binary(16), c5 double, c6 bool, \
+ c7 bigint, c8 smallint, c9 tinyint, c10 nchar(16)\
+ ) \
+ tags(st1 int)"
+ )
+ tdSql.execute(
+ "create stable db.stb2 (ts timestamp, c1 int) tags(st2 int)"
+ )
+ for i in range(tbnum):
+ tdSql.execute(f"create table t{i} using stb1 tags({i})")
+ tdSql.execute(f"create table tt{i} using stb2 tags({i})")
+
+ pass
+
+ def diff_test_run(self) :
+ tdLog.printNoPrefix("==========TD-10594==========")
+ tbnum = 10
+ nowtime = int(round(time.time() * 1000))
+ per_table_rows = 10
+ self.diff_test_table(tbnum)
+
+ tdLog.printNoPrefix("######## no data test:")
+ self.diff_current_query()
+ self.diff_error_query()
+
+ tdLog.printNoPrefix("######## insert only NULL test:")
+ for i in range(tbnum):
+ tdSql.execute(f"insert into t{i}(ts) values ({nowtime - 5})")
+ tdSql.execute(f"insert into t{i}(ts) values ({nowtime + 5})")
+ self.diff_current_query()
+ self.diff_error_query()
+
+ tdLog.printNoPrefix("######## insert data in the range near the max(bigint/double):")
+ self.diff_test_table(tbnum)
+ tdSql.execute(f"insert into t1(ts, c1,c2,c5,c7) values "
+ f"({nowtime - (per_table_rows + 1) * 10}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})")
+ tdSql.execute(f"insert into t1(ts, c1,c2,c5,c7) values "
+ f"({nowtime - (per_table_rows + 2) * 10}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})")
+ self.diff_current_query()
+ self.diff_error_query()
+
+ tdLog.printNoPrefix("######## insert data in the range near the min(bigint/double):")
+ self.diff_test_table(tbnum)
+ tdSql.execute(f"insert into t1(ts, c1,c2,c5,c7) values "
+ f"({nowtime - (per_table_rows + 1) * 10}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {1-2**63})")
+ tdSql.execute(f"insert into t1(ts, c1,c2,c5,c7) values "
+ f"({nowtime - (per_table_rows + 2) * 10}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {512-2**63})")
+ self.diff_current_query()
+ self.diff_error_query()
+
+ tdLog.printNoPrefix("######## insert data without NULL data test:")
+ self.diff_test_table(tbnum)
+ self.diff_test_data(tbnum, per_table_rows, nowtime)
+ self.diff_current_query()
+ self.diff_error_query()
+
+
+ tdLog.printNoPrefix("######## insert data mix with NULL test:")
+ for i in range(tbnum):
+ tdSql.execute(f"insert into t{i}(ts) values ({nowtime})")
+ tdSql.execute(f"insert into t{i}(ts) values ({nowtime-(per_table_rows+3)*10})")
+ tdSql.execute(f"insert into t{i}(ts) values ({nowtime+(per_table_rows+3)*10})")
+ self.diff_current_query()
+ self.diff_error_query()
+
+
+
+ tdLog.printNoPrefix("######## check after WAL test:")
+ tdSql.query("show dnodes")
+ index = tdSql.getData(0, 0)
+ tdDnodes.stop(index)
+ tdDnodes.start(index)
+ self.diff_current_query()
+ self.diff_error_query()
+
+ def run(self):
+ import traceback
+ try:
+ # run in develop branch
+ self.diff_test_run()
+ pass
+ except Exception as e:
+ traceback.print_exc()
+ raise e
+
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success("%s successfully executed" % __file__)
+
+tdCases.addWindows(__file__, TDTestCase())
+tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
diff --git a/tests/system-test/2-query/mavg.py b/tests/system-test/2-query/mavg.py
new file mode 100644
index 0000000000000000000000000000000000000000..c8cbd269f9ce2c3ae0e5bd6b0361f0eb4252b1a9
--- /dev/null
+++ b/tests/system-test/2-query/mavg.py
@@ -0,0 +1,677 @@
+###################################################################
+# Copyright (c) 2016 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+
+# -*- coding: utf-8 -*-
+
+import sys
+import subprocess
+import random
+import math
+import numpy as np
+import inspect
+import re
+import taos
+
+from util.log import *
+from util.cases import *
+from util.sql import *
+from util.dnodes import *
+
+
+class TDTestCase:
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor())
+
+ def mavg_query_form(self, sel="select", func="mavg(", col="c1", m_comm =",", k=1,r_comm=")", alias="", fr="from",table_expr="t1", condition=""):
+ '''
+ mavg function:
+
+ :param sel: string, must be "select", required parameters;
+ :param func: string, in this case must be "mavg(", otherwise return other function, required parameters;
+ :param col: string, column name, required parameters;
+ :param m_comm: string, comma between col and k , required parameters;
+ :param k: int/float,the width of the sliding window, [1,100], required parameters;
+ :param r_comm: string, must be ")", use with "(" in func, required parameters;
+ :param alias: string, result column another name,or add other funtion;
+ :param fr: string, must be "from", required parameters;
+ :param table_expr: string or expression, data source(eg,table/stable name, result set), required parameters;
+ :param condition: expression;
+ :return: mavg query statement,default: select mavg(c1, 1) from t1
+ '''
+
+ return f"{sel} {func} {col} {m_comm} {k} {r_comm} {alias} {fr} {table_expr} {condition}"
+
+ def checkmavg(self,sel="select", func="mavg(", col="c1", m_comm =",", k=1,r_comm=")", alias="", fr="from",table_expr="t1", condition=""):
+ # print(self.mavg_query_form(sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ # table_expr=table_expr, condition=condition))
+ line = sys._getframe().f_back.f_lineno
+
+ if not all([sel , func , col , m_comm , k , r_comm , fr , table_expr]):
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.mavg_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+
+ sql = "select * from t1"
+ collist = tdSql.getColNameList(sql)
+
+ if not isinstance(col, str):
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.mavg_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+
+ if len([x for x in col.split(",") if x.strip()]) != 1:
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.mavg_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+
+ col = col.replace(",", "").replace(" ", "")
+
+ if any([re.compile('^[a-zA-Z]{1}.*$').match(col) is None , not col.replace(".","").isalnum()]):
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.mavg_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+
+ # if all(["," in col , len(col.split(",")) != 2]):
+ # print(f"case in {line}: ", end='')
+ # return tdSql.error(self.mavg_query_form(
+ # sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ # table_expr=table_expr, condition=condition
+ # ))
+ #
+ # if ("," in col):
+ # if (not col.split(",")[0].strip()) ^ (not col.split(",")[1].strip()):
+ # col = col.strip().split(",")[0] if not col.split(",")[1].strip() else col.strip().split(",")[1]
+ # else:
+ # print(f"case in {line}: ", end='')
+ # return tdSql.error(self.mavg_query_form(
+ # sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ # table_expr=table_expr, condition=condition
+ # ))
+ # pass
+
+ if '.' in col:
+ if any([col.split(".")[0] not in table_expr, col.split(".")[1] not in collist]):
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.mavg_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+ pass
+
+ if "." not in col:
+ if col not in collist:
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.mavg_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+ pass
+
+ colname = col if "." not in col else col.split(".")[1]
+ col_index = collist.index(colname)
+ if any([tdSql.cursor.istype(col_index, "TIMESTAMP"), tdSql.cursor.istype(col_index, "BOOL")]):
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.mavg_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+
+ if any([tdSql.cursor.istype(col_index, "BINARY") , tdSql.cursor.istype(col_index,"NCHAR")]):
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.mavg_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+
+ if any( [func != "mavg(" , r_comm != ")" , fr != "from", sel != "select"]):
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.mavg_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+
+ if all(["(" not in table_expr, "stb" in table_expr, "group" not in condition.lower()]):
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.mavg_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+
+ if "order by tbname" in condition.lower():
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.mavg_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+
+ if all(["group" in condition.lower(), "tbname" not in condition.lower()]):
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.mavg_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+
+ alias_list = ["tbname", "_c0", "st", "ts"]
+ if all([alias, "," not in alias, not alias.isalnum()]):
+ # actually, column alias also support "_", but in this case,forbidden that。
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.mavg_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+
+ if all([alias, "," in alias]):
+ if all(parm != alias.lower().split(",")[1].strip() for parm in alias_list):
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.mavg_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+ pass
+
+ condition_exception = [ "~", "^", "insert", "distinct",
+ "count", "avg", "twa", "irate", "sum", "stddev", "leastquares",
+ "min", "max", "first", "last", "top", "bottom", "percentile",
+ "apercentile", "last_row", "interp", "diff", "derivative",
+ "spread", "ceil", "floor", "round", "interval", "fill", "slimit", "soffset"]
+ if "union" not in condition.lower():
+ if any(parm in condition.lower().strip() for parm in condition_exception):
+
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.mavg_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+ pass
+
+ if not any([isinstance(k, int) , isinstance(k, float)]) :
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.mavg_query_form(
+ col=col, k=k, alias=alias, table_expr=table_expr, condition=condition
+ ))
+
+ if not(1 <= k < 1001):
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.mavg_query_form(
+ col=col, k=k, alias=alias, table_expr=table_expr, condition=condition
+ ))
+
+ k = int(k // 1)
+ pre_sql = re.sub("mavg\([a-z0-9 .,]*\)", f"count({col})", self.mavg_query_form(
+ col=col, table_expr=table_expr, condition=condition
+ ))
+ tdSql.query(pre_sql)
+
+ if tdSql.queryRows == 0:
+ tdSql.query(self.mavg_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+ print(f"case in {line}: ", end='')
+ tdSql.checkRows(0)
+ return
+
+ if "group" in condition:
+ tb_condition = condition.split("group by")[1].split(" ")[1]
+ tdSql.query(f"select distinct {tb_condition} from {table_expr}")
+ query_result = tdSql.queryResult
+ query_rows = tdSql.queryRows
+ clear_condition = re.sub('order by [0-9a-z]*|slimit [0-9]*|soffset [0-9]*', "", condition)
+
+ pre_row = 0
+ for i in range(query_rows):
+ group_name = query_result[i][0]
+ if "where" in clear_condition:
+ pre_condition = re.sub('group by [0-9a-z]*', f"{tb_condition}='{group_name}'", clear_condition)
+ else:
+ pre_condition = "where " + re.sub('group by [0-9a-z]*',f"{tb_condition}='{group_name}'", clear_condition)
+
+ tdSql.query(f"select {col} {alias} from {table_expr} {pre_condition}")
+ pre_data = np.array(tdSql.queryResult)[np.array(tdSql.queryResult) != None]
+ pre_mavg = np.convolve(pre_data, np.ones(k), "valid")/k
+ tdSql.query(self.mavg_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+ for j in range(len(pre_mavg)):
+ print(f"case in {line}:", end='')
+ tdSql.checkData(pre_row+j, 0, pre_mavg[j])
+ pre_row += len(pre_mavg)
+ return
+ elif "union" in condition:
+ union_sql_0 = self.mavg_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ).split("union all")[0]
+
+ union_sql_1 = self.mavg_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ).split("union all")[1]
+
+ tdSql.query(union_sql_0)
+ union_mavg_0 = tdSql.queryResult
+ row_union_0 = tdSql.queryRows
+
+ tdSql.query(union_sql_1)
+ union_mavg_1 = tdSql.queryResult
+
+ tdSql.query(self.mavg_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+ for i in range(tdSql.queryRows):
+ print(f"case in {line}: ", end='')
+ if i < row_union_0:
+ tdSql.checkData(i, 0, union_mavg_0[i][0])
+ else:
+ tdSql.checkData(i, 0, union_mavg_1[i-row_union_0][0])
+ return
+
+ else:
+ tdSql.query(f"select {col} from {table_expr} {re.sub('limit [0-9]*|offset [0-9]*','',condition)}")
+ offset_val = condition.split("offset")[1].split(" ")[1] if "offset" in condition else 0
+ pre_result = np.array(tdSql.queryResult)[np.array(tdSql.queryResult) != None]
+ pre_mavg = pre_mavg = np.convolve(pre_result, np.ones(k), "valid")[offset_val:]/k
+ tdSql.query(self.mavg_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+ for i in range(tdSql.queryRows):
+ print(f"case in {line}: ", end='')
+ tdSql.checkData(i, 0, pre_mavg[i])
+
+ pass
+
+ def mavg_current_query(self) :
+
+ # table schema :ts timestamp, c1 int, c2 float, c3 timestamp, c4 binary(16), c5 double, c6 bool
+ # c7 bigint, c8 smallint, c9 tinyint, c10 nchar(16)
+
+ # case1~6: numeric col:int/bigint/tinyint/smallint/float/double
+ self.checkmavg()
+ case2 = {"col": "c2"}
+ self.checkmavg(**case2)
+ case3 = {"col": "c5"}
+ self.checkmavg(**case3)
+ case4 = {"col": "c7"}
+ self.checkmavg(**case4)
+ case5 = {"col": "c8"}
+ self.checkmavg(**case5)
+ case6 = {"col": "c9"}
+ self.checkmavg(**case6)
+
+ # # case7~8: nested query
+ # case7 = {"table_expr": "(select c1 from stb1)"}
+ # self.checkmavg(**case7)
+ # case8 = {"table_expr": "(select mavg(c1, 1) c1 from stb1 group by tbname)"}
+ # self.checkmavg(**case8)
+
+ # case9~10: mix with tbname/ts/tag/col
+ # case9 = {"alias": ", tbname"}
+ # self.checkmavg(**case9)
+ # case10 = {"alias": ", _c0"}
+ # self.checkmavg(**case10)
+ # case11 = {"alias": ", st1"}
+ # self.checkmavg(**case11)
+ # case12 = {"alias": ", c1"}
+ # self.checkmavg(**case12)
+
+ # case13~15: with single condition
+ case13 = {"condition": "where c1 <= 10"}
+ self.checkmavg(**case13)
+ case14 = {"condition": "where c6 in (0, 1)"}
+ self.checkmavg(**case14)
+ case15 = {"condition": "where c1 between 1 and 10"}
+ self.checkmavg(**case15)
+
+ # case16: with multi-condition
+ case16 = {"condition": "where c6=1 or c6 =0"}
+ self.checkmavg(**case16)
+
+ # case17: only support normal table join
+ case17 = {
+ "col": "t1.c1",
+ "table_expr": "t1, t2",
+ "condition": "where t1.ts=t2.ts"
+ }
+ self.checkmavg(**case17)
+ # # case18~19: with group by
+ # case19 = {
+ # "table_expr": "stb1",
+ # "condition": "partition by tbname"
+ # }
+ # self.checkmavg(**case19)
+
+ # case20~21: with order by
+ # case20 = {"condition": "order by ts"}
+ # self.checkmavg(**case20)
+ #case21 = {
+ # "table_expr": "stb1",
+ # "condition": "group by tbname order by tbname"
+ #}
+ #self.checkmavg(**case21)
+
+ # # case22: with union
+ # case22 = {
+ # "condition": "union all select mavg( c1 , 1 ) from t2"
+ # }
+ # self.checkmavg(**case22)
+
+ # case23: with limit/slimit
+ case23 = {
+ "condition": "limit 1"
+ }
+ self.checkmavg(**case23)
+
+ # case24: value k range[1, 100], can be int or float, k = floor(k)
+ case24 = {"k": 3}
+ self.checkmavg(**case24)
+ case25 = {"k": 2.999}
+ self.checkmavg(**case25)
+ case26 = {"k": 1000}
+ self.checkmavg(**case26)
+
+ pass
+
+ def mavg_error_query(self) -> None :
+ # unusual test
+
+ # form test
+ err1 = {"col": ""}
+ self.checkmavg(**err1) # no col
+ err2 = {"sel": ""}
+ self.checkmavg(**err2) # no select
+ err3 = {"func": "mavg", "col": "", "m_comm": "", "k": "", "r_comm": ""}
+ self.checkmavg(**err3) # no mavg condition: select mavg from
+ err4 = {"col": "", "m_comm": "", "k": ""}
+ self.checkmavg(**err4) # no mavg condition: select mavg() from
+ err5 = {"func": "mavg", "r_comm": ""}
+ self.checkmavg(**err5) # no brackets: select mavg col, k from
+ err6 = {"fr": ""}
+ self.checkmavg(**err6) # no from
+ err7 = {"k": ""}
+ self.checkmavg(**err7) # no k
+ err8 = {"table_expr": ""}
+ self.checkmavg(**err8) # no table_expr
+
+ # err9 = {"col": "st1"}
+ # self.checkmavg(**err9) # col: tag
+ err10 = {"col": 1}
+ self.checkmavg(**err10) # col: value
+ err11 = {"col": "NULL"}
+ self.checkmavg(**err11) # col: NULL
+ err12 = {"col": "%_"}
+ self.checkmavg(**err12) # col: %_
+ err13 = {"col": "c3"}
+ self.checkmavg(**err13) # col: timestamp col
+ err14 = {"col": "_c0"}
+ self.checkmavg(**err14) # col: Primary key
+ err15 = {"col": "avg(c1)"}
+ self.checkmavg(**err15) # expr col
+ err16 = {"col": "c4"}
+ self.checkmavg(**err16) # binary col
+ err17 = {"col": "c10"}
+ self.checkmavg(**err17) # nchar col
+ err18 = {"col": "c6"}
+ self.checkmavg(**err18) # bool col
+ err19 = {"col": "'c1'"}
+ self.checkmavg(**err19) # col: string
+ err20 = {"col": None}
+ self.checkmavg(**err20) # col: None
+ err21 = {"col": "''"}
+ self.checkmavg(**err21) # col: ''
+ err22 = {"col": "tt1.c1"}
+ self.checkmavg(**err22) # not table_expr col
+ err23 = {"col": "t1"}
+ self.checkmavg(**err23) # tbname
+ err24 = {"col": "stb1"}
+ self.checkmavg(**err24) # stbname
+ err25 = {"col": "db"}
+ self.checkmavg(**err25) # datbasename
+ err26 = {"col": "True"}
+ self.checkmavg(**err26) # col: BOOL 1
+ err27 = {"col": True}
+ self.checkmavg(**err27) # col: BOOL 2
+ err28 = {"col": "*"}
+ self.checkmavg(**err28) # col: all col
+ err29 = {"func": "mavg[", "r_comm": "]"}
+ self.checkmavg(**err29) # form: mavg[col, k]
+ err30 = {"func": "mavg{", "r_comm": "}"}
+ self.checkmavg(**err30) # form: mavg{col, k}
+ err31 = {"col": "[c1]"}
+ self.checkmavg(**err31) # form: mavg([col], k)
+ err32 = {"col": "c1, c2"}
+ self.checkmavg(**err32) # form: mavg(col, col2, k)
+ err33 = {"col": "c1, 2"}
+ self.checkmavg(**err33) # form: mavg(col, k1, k2)
+ err34 = {"alias": ", count(c1)"}
+ self.checkmavg(**err34) # mix with aggregate function 1
+ err35 = {"alias": ", avg(c1)"}
+ self.checkmavg(**err35) # mix with aggregate function 2
+ err36 = {"alias": ", min(c1)"}
+ self.checkmavg(**err36) # mix with select function 1
+ err37 = {"alias": ", top(c1, 5)"}
+ self.checkmavg(**err37) # mix with select function 2
+ err38 = {"alias": ", spread(c1)"}
+ self.checkmavg(**err38) # mix with calculation function 1
+ err39 = {"alias": ", diff(c1)"}
+ self.checkmavg(**err39) # mix with calculation function 2
+ # err40 = {"alias": "+ 2"}
+ # self.checkmavg(**err40) # mix with arithmetic 1
+ #tdSql.query(" select mavg( c1 , 1 ) + 2 from t1 ")
+ err41 = {"alias": "+ avg(c1)"}
+ self.checkmavg(**err41) # mix with arithmetic 2
+ err42 = {"alias": ", c1"}
+ self.checkmavg(**err42) # mix with other col
+ # err43 = {"table_expr": "stb1"}
+ # self.checkmavg(**err43) # select stb directly
+ err44 = {
+ "col": "stb1.c1",
+ "table_expr": "stb1, stb2",
+ "condition": "where stb1.ts=stb2.ts and stb1.st1=stb2.st2 order by stb1.ts"
+ }
+ self.checkmavg(**err44) # stb join
+ err45 = {
+ "condition": "where ts>0 and ts < now interval(1h) fill(next)"
+ }
+ self.checkmavg(**err45) # interval
+ err46 = {
+ "table_expr": "t1",
+ "condition": "group by c6"
+ }
+ self.checkmavg(**err46) # group by normal col
+ err47 = {
+ "table_expr": "stb1",
+ "condition": "group by tbname slimit 1 "
+ }
+ # self.checkmavg(**err47) # with slimit
+ err48 = {
+ "table_expr": "stb1",
+ "condition": "group by tbname slimit 1 soffset 1"
+ }
+ # self.checkmavg(**err48) # with soffset
+ err49 = {"k": "2021-01-01 00:00:00.000"}
+ self.checkmavg(**err49) # k: timestamp
+ err50 = {"k": False}
+ self.checkmavg(**err50) # k: False
+ err51 = {"k": "%"}
+ self.checkmavg(**err51) # k: special char
+ err52 = {"k": ""}
+ self.checkmavg(**err52) # k: ""
+ err53 = {"k": None}
+ self.checkmavg(**err53) # k: None
+ err54 = {"k": "NULL"}
+ self.checkmavg(**err54) # k: null
+ err55 = {"k": "binary(4)"}
+ self.checkmavg(**err55) # k: string
+ err56 = {"k": "c1"}
+ self.checkmavg(**err56) # k: sring,col name
+ err57 = {"col": "c1, 1, c2"}
+ self.checkmavg(**err57) # form: mavg(col1, k1, col2, k2)
+ err58 = {"col": "c1 cc1"}
+ self.checkmavg(**err58) # form: mavg(col newname, k)
+ err59 = {"k": "'1'"}
+ # self.checkmavg(**err59) # formL mavg(colm, "1")
+ err60 = {"k": "-1-(-2)"}
+ # self.checkmavg(**err60) # formL mavg(colm, -1-2)
+ err61 = {"k": 1001}
+ self.checkmavg(**err61) # k: right out of [1, 1000]
+ err62 = {"k": -1}
+ self.checkmavg(**err62) # k: negative number
+ err63 = {"k": 0}
+ self.checkmavg(**err63) # k: 0
+ err64 = {"k": 2**63-1}
+ self.checkmavg(**err64) # k: max(bigint)
+ err65 = {"k": 1-2**63}
+ # self.checkmavg(**err65) # k: min(bigint)
+ err66 = {"k": -2**63}
+ self.checkmavg(**err66) # k: NULL
+ err67 = {"k": 0.999999}
+ self.checkmavg(**err67) # k: left out of [1, 1000]
+ err68 = {
+ "table_expr": "stb1",
+ "condition": "group by tbname order by tbname" # order by tbname not supported
+ }
+ self.checkmavg(**err68)
+
+ pass
+
+ def mavg_test_data(self, tbnum:int, data_row:int, basetime:int) -> None :
+ for i in range(tbnum):
+ for j in range(data_row):
+ tdSql.execute(
+ f"insert into t{i} values ("
+ f"{basetime + (j+1)*10}, {random.randint(-200, -1)}, {random.uniform(200, -1)}, {basetime + random.randint(-200, -1)}, "
+ f"'binary_{j}', {random.uniform(-200, -1)}, {random.choice([0,1])}, {random.randint(-200,-1)}, "
+ f"{random.randint(-200, -1)}, {random.randint(-127, -1)}, 'nchar_{j}' )"
+ )
+
+ tdSql.execute(
+ f"insert into t{i} values ("
+ f"{basetime - (j+1) * 10}, {random.randint(1, 200)}, {random.uniform(1, 200)}, {basetime - random.randint(1, 200)}, "
+ f"'binary_{j}_1', {random.uniform(1, 200)}, {random.choice([0, 1])}, {random.randint(1,200)}, "
+ f"{random.randint(1,200)}, {random.randint(1,127)}, 'nchar_{j}_1' )"
+ )
+ tdSql.execute(
+ f"insert into tt{i} values ( {basetime-(j+1) * 10}, {random.randint(1, 200)} )"
+ )
+
+ pass
+
+ def mavg_test_table(self,tbnum: int) -> None :
+ tdSql.execute("drop database if exists db")
+ tdSql.execute("create database if not exists db keep 3650")
+ tdSql.execute("use db")
+
+ tdSql.execute(
+ "create stable db.stb1 (\
+ ts timestamp, c1 int, c2 float, c3 timestamp, c4 binary(16), c5 double, c6 bool, \
+ c7 bigint, c8 smallint, c9 tinyint, c10 nchar(16)\
+ ) \
+ tags(st1 int)"
+ )
+ tdSql.execute(
+ "create stable db.stb2 (ts timestamp, c1 int) tags(st2 int)"
+ )
+ for i in range(tbnum):
+ tdSql.execute(f"create table t{i} using stb1 tags({i})")
+ tdSql.execute(f"create table tt{i} using stb2 tags({i})")
+
+ pass
+
+ def mavg_test_run(self) :
+ tdLog.printNoPrefix("==========TD-10594==========")
+ tbnum = 10
+ nowtime = int(round(time.time() * 1000))
+ per_table_rows = 2
+ self.mavg_test_table(tbnum)
+
+ tdLog.printNoPrefix("######## no data test:")
+ self.mavg_current_query()
+ self.mavg_error_query()
+
+ tdLog.printNoPrefix("######## insert only NULL test:")
+ for i in range(tbnum):
+ tdSql.execute(f"insert into t{i}(ts) values ({nowtime - 5})")
+ tdSql.execute(f"insert into t{i}(ts) values ({nowtime + 5})")
+ self.mavg_current_query()
+ self.mavg_error_query()
+
+ tdLog.printNoPrefix("######## insert data in the range near the max(bigint/double):")
+ # self.mavg_test_table(tbnum)
+ # tdSql.execute(f"insert into t1(ts, c1,c2,c5,c7) values "
+ # f"({nowtime - (per_table_rows + 1) * 10}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})")
+ # tdSql.execute(f"insert into t1(ts, c1,c2,c5,c7) values "
+ # f"({nowtime - (per_table_rows + 2) * 10}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})")
+ # self.mavg_current_query()
+ # self.mavg_error_query()
+
+ tdLog.printNoPrefix("######## insert data in the range near the min(bigint/double):")
+ # self.mavg_test_table(tbnum)
+ # tdSql.execute(f"insert into t1(ts, c1,c2,c5,c7) values "
+ # f"({nowtime - (per_table_rows + 1) * 10}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {1-2**63})")
+ # tdSql.execute(f"insert into t1(ts, c1,c2,c5,c7) values "
+ # f"({nowtime - (per_table_rows + 2) * 10}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {512-2**63})")
+ # self.mavg_current_query()
+ # self.mavg_error_query()
+
+ tdLog.printNoPrefix("######## insert data without NULL data test:")
+ self.mavg_test_table(tbnum)
+ self.mavg_test_data(tbnum, per_table_rows, nowtime)
+ self.mavg_current_query()
+ self.mavg_error_query()
+
+
+ tdLog.printNoPrefix("######## insert data mix with NULL test:")
+ for i in range(tbnum):
+ tdSql.execute(f"insert into t{i}(ts) values ({nowtime})")
+ tdSql.execute(f"insert into t{i}(ts) values ({nowtime-(per_table_rows+3)*10})")
+ tdSql.execute(f"insert into t{i}(ts) values ({nowtime+(per_table_rows+3)*10})")
+ self.mavg_current_query()
+ self.mavg_error_query()
+
+
+
+ tdLog.printNoPrefix("######## check after WAL test:")
+ tdSql.query("show dnodes")
+ index = tdSql.getData(0, 0)
+ tdDnodes.stop(index)
+ tdDnodes.start(index)
+ self.mavg_current_query()
+ self.mavg_error_query()
+
+ def run(self):
+ import traceback
+ try:
+ # run in develop branch
+ self.mavg_test_run()
+ pass
+ except Exception as e:
+ traceback.print_exc()
+ raise e
+
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success("%s successfully executed" % __file__)
+
+tdCases.addWindows(__file__, TDTestCase())
+tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
diff --git a/tests/system-test/2-query/nestedQuery_str.py b/tests/system-test/2-query/nestedQuery_str.py
new file mode 100755
index 0000000000000000000000000000000000000000..8214c98c5cc8526874db5f40df22f8e587ea36f4
--- /dev/null
+++ b/tests/system-test/2-query/nestedQuery_str.py
@@ -0,0 +1,5753 @@
+###################################################################
+# Copyright (c) 2016 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+
+# -*- coding: utf-8 -*-
+
+import random
+import os
+import time
+import taos
+import subprocess
+from faker import Faker
+from util.log import tdLog
+from util.cases import tdCases
+from util.sql import tdSql
+from util.dnodes import tdDnodes
+from util.dnodes import *
+
+class TDTestCase:
+ updatecfgDict = {'maxSQLLength':1048576,'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 ,
+ "jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143,
+ "wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"fnDebugFlag":143}
+
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor(), logSql)
+
+ self.testcasePath = os.path.split(__file__)[0]
+ self.testcaseFilename = os.path.split(__file__)[-1]
+ os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename))
+
+ self.num = 10
+ self.fornum = 5
+
+ self.db_nest = "nest"
+ self.dropandcreateDB_random("%s" %self.db_nest, 1)
+
+ # regular column select
+ #q_select= ['ts' , '*' , 'q_int', 'q_bigint' , 'q_bigint' , 'q_smallint' , 'q_tinyint' , 'q_bool' , 'q_binary' , 'q_nchar' ,'q_float' , 'q_double' ,'q_ts ']
+ self.q_select= ['ts' , 'q_int', 'q_bigint' , 'q_bigint' , 'q_smallint' , 'q_tinyint' , 'q_bool' , 'q_binary' , 'q_nchar' ,'q_float' , 'q_double' ,'q_ts ', 'q_int_null ', 'q_bigint_null ' , 'q_bigint_null ' , 'q_smallint_null ' , 'q_tinyint_null ' , 'q_bool_null ' , 'q_binary_null ' , 'q_nchar_null ' ,'q_float_null ' , 'q_double_null ' ,'q_ts_null ']
+
+ # tag column select
+ #t_select= ['*' , 'loc' ,'t_int', 't_bigint' , 't_bigint' , 't_smallint' , 't_tinyint' , 't_bool' , 't_binary' , 't_nchar' ,'t_float' , 't_double' ,'t_ts ']
+ self.t_select= ['loc','t_int', 't_bigint' , 't_bigint' , 't_smallint' , 't_tinyint' , 't_bool' , 't_binary' , 't_nchar' ,'t_float' , 't_double' ,'t_ts ']
+
+ # regular and tag column select
+ self.qt_select= self.q_select + self.t_select
+
+ # distinct regular column select
+ self.dq_select= ['distinct q_int', 'distinct q_bigint' , 'distinct q_smallint' , 'distinct q_tinyint' ,
+ 'distinct q_bool' , 'distinct q_binary' , 'distinct q_nchar' ,'distinct q_float' , 'distinct q_double' ,'distinct q_ts ']
+
+ # distinct tag column select
+ self.dt_select= ['distinct loc', 'distinct t_int', 'distinct t_bigint' , 'distinct t_smallint' , 'distinct t_tinyint' ,
+ 'distinct t_bool' , 'distinct t_binary' , 'distinct t_nchar' ,'distinct t_float' , 'distinct t_double' ,'distinct t_ts ']
+
+ # distinct regular and tag column select
+ self.dqt_select= self.dq_select + self.dt_select
+
+ # special column select
+ self.s_r_select= ['_c0', '_rowts' , '_C0' ]
+ self.s_s_select= ['tbname' , '_rowts' , '_c0', '_C0' ]
+ self.unionall_or_union= [ ' union ' , ' union all ' ]
+
+ # regular column where
+ self.q_where = ['ts < now +1s','q_bigint >= -9223372036854775807 and q_bigint <= 9223372036854775807', 'q_int <= 2147483647 and q_int >= -2147483647',
+ 'q_smallint >= -32767 and q_smallint <= 32767','q_tinyint >= -127 and q_tinyint <= 127','q_float >= -1.7E308 and q_float <= 1.7E308',
+ 'q_double >= -1.7E308 and q_double <= 1.7E308', 'q_binary like \'binary%\' or q_binary = \'0\' ' , 'q_nchar like \'nchar%\' or q_nchar = \'0\' ' ,
+ 'q_bool = true or q_bool = false' , 'q_bool in (0 , 1)' , 'q_bool in ( true , false)' , 'q_bool = 0 or q_bool = 1',
+ 'q_bigint between -9223372036854775807 and 9223372036854775807',' q_int between -2147483647 and 2147483647','q_smallint between -32767 and 32767',
+ 'q_bigint not between 9223372036854775807 and -9223372036854775807','q_int not between 2147483647 and -2147483647','q_smallint not between 32767 and -32767',
+ 'q_tinyint between -127 and 127 ','q_float >= -3.4E38 ','q_float <= 3.4E38 ','q_double >= -1.7E308 ',
+ 'q_double <= 1.7E308 ','q_float between -3.4E38 and 3.4E38 ','q_double between -1.7E308 and 1.7E308 ' ,'q_float not between 3.4E38 and -3.4E38 ','q_double not between 1.7E308 and -1.7E308 ',
+ 'q_float is not null ' ,'q_double is not null ' ,'q_binary match \'binary\' ','q_binary nmatch \'binarynchar\' ','q_nchar match \'nchar\' ','q_nchar nmatch \'binarynchar\' ',
+ 'q_binary like \'binary%\' ','(q_binary like \'binary%\' or q_nchar = \'0\' or q_binary = \'binary_\' ) ','q_nchar like \'nchar%\' ','(q_nchar like \'nchar%\' or q_binary = \'0\' or q_nchar = \'nchar_\' ) ',]
+ #TD-6201 ,'q_bool between 0 and 1'
+
+ # regular column where for test union,join
+ self.q_u_where = ['t1.ts < now +1s' , 't2.ts < now +1s','t1.q_bigint >= -9223372036854775807 and t1.q_bigint <= 9223372036854775807 and t2.q_bigint >= -9223372036854775807 and t2.q_bigint <= 9223372036854775807',
+ 't1.q_int <= 2147483647 and t1.q_int >= -2147483647 and t2.q_int <= 2147483647 and t2.q_int >= -2147483647',
+ 't1.q_smallint >= -32767 and t1.q_smallint <= 32767 and t2.q_smallint >= -32767 and t2.q_smallint <= 32767',
+ 't1.q_tinyint >= -127 and t1.q_tinyint <= 127 and t2.q_tinyint >= -127 and t2.q_tinyint <= 127',
+ 't1.q_float >= - 1.7E308 and t1.q_float <= 1.7E308 and t2.q_float >= - 1.7E308 and t2.q_float <= 1.7E308',
+ 't1.q_double >= - 1.7E308 and t1.q_double <= 1.7E308 and t2.q_double >= - 1.7E308 and t2.q_double <= 1.7E308',
+ 't1.q_binary like \'binary%\' and t2.q_binary like \'binary%\' ' ,
+ 't1.q_nchar like \'nchar%\' and t2.q_nchar like \'nchar%\' ' ,
+ 't1.q_bool in (0 , 1) and t2.q_bool in (0 , 1)' , 't1.q_bool in ( true , false) and t2.q_bool in ( true , false)' ,
+ 't1.q_bigint between -9223372036854775807 and 9223372036854775807 and t2.q_bigint between -9223372036854775807 and 9223372036854775807',
+ 't1.q_int between -2147483647 and 2147483647 and t2.q_int between -2147483647 and 2147483647',
+ 't1.q_smallint between -32767 and 32767 and t2.q_smallint between -32767 and 32767',
+ 't1.q_tinyint between -127 and 127 and t2.q_tinyint between -127 and 127 ','t1.q_float between -1.7E308 and 1.7E308 and t2.q_float between -1.7E308 and 1.7E308',
+ 't1.q_double between -1.7E308 and 1.7E308 and t2.q_double between -1.7E308 and 1.7E308',
+ 't1.q_bigint not between 9223372036854775807 and -9223372036854775807 and t2.q_bigint not between 9223372036854775807 and -9223372036854775807',
+ 't1.q_int not between 2147483647 and -2147483647 and t2.q_int not between 2147483647 and -2147483647',
+ 't1.q_smallint not between 32767 and -32767 and t2.q_smallint not between 32767 and -32767',
+ 't1.q_tinyint not between 127 and -127 and t2.q_tinyint not between 127 and -127 ','t1.q_float not between -1.7E308 and -1.7E308 and t2.q_float not between 1.7E308 and -1.7E308',
+ 't1.q_double not between 1.7E308 and -1.7E308 and t2.q_double not between 1.7E308 and -1.7E308']
+ #TD-6201 ,'t1.q_bool between 0 and 1 or t2.q_bool between 0 and 1']
+ #'t1.q_bool = true and t1.q_bool = false and t2.q_bool = true and t2.q_bool = false' , 't1.q_bool = 0 and t1.q_bool = 1 and t2.q_bool = 0 and t2.q_bool = 1' ,
+
+ self.q_u_or_where = ['(t1.q_binary like \'binary%\' or t1.q_binary = \'0\' or t2.q_binary like \'binary%\' or t2.q_binary = \'0\' )' ,
+ '(t1.q_nchar like \'nchar%\' or t1.q_nchar = \'0\' or t2.q_nchar like \'nchar%\' or t2.q_nchar = \'0\' )' , '(t1.q_bool = true or t1.q_bool = false or t2.q_bool = true or t2.q_bool = false)' ,
+ '(t1.q_bool in (0 , 1) or t2.q_bool in (0 , 1))' , '(t1.q_bool in ( true , false) or t2.q_bool in ( true , false))' , '(t1.q_bool = 0 or t1.q_bool = 1 or t2.q_bool = 0 or t2.q_bool = 1)' ,
+ '(t1.q_bigint between -9223372036854775807 and 9223372036854775807 or t2.q_bigint between -9223372036854775807 and 9223372036854775807)',
+ '(t1.q_int between -2147483647 and 2147483647 or t2.q_int between -2147483647 and 2147483647)',
+ '(t1.q_smallint between -32767 and 32767 or t2.q_smallint between -32767 and 32767)',
+ '(t1.q_tinyint between -127 and 127 or t2.q_tinyint between -127 and 127 )','(t1.q_float between -1.7E308 and 1.7E308 or t2.q_float between -1.7E308 and 1.7E308)',
+ '(t1.q_double between -1.7E308 and 1.7E308 or t2.q_double between -1.7E308 and 1.7E308)']
+
+ # tag column where
+ self.t_where = ['ts < now +1s','t_bigint >= -9223372036854775807 and t_bigint <= 9223372036854775807','t_int <= 2147483647 and t_int >= -2147483647',
+ 't_smallint >= -32767 and t_smallint <= 32767','q_tinyint >= -127 and t_tinyint <= 127','t_float >= -1.7E308 and t_float <= 1.7E308',
+ 't_double >= -1.7E308 and t_double <= 1.7E308', 't_binary like \'binary%\' or t_binary = \'0\' ' , 't_nchar like \'nchar%\' or t_nchar = \'0\'' ,
+ 't_bool = true or t_bool = false' , 't_bool in (0 , 1)' , 't_bool in ( true , false)' , 't_bool = 0 or t_bool = 1',
+ 't_bigint between -9223372036854775807 and 9223372036854775807',' t_int between -2147483647 and 2147483647','t_smallint between -32767 and 32767',
+ 't_tinyint between -127 and 127 ','t_float between -1.7E308 and 1.7E308','t_double between -1.7E308 and 1.7E308',
+ 't_binary match \'binary\' ','t_binary nmatch \'binarynchar\' ','t_nchar match \'nchar\' ','t_nchar nmatch \'binarynchar\' ',
+ 't_binary like \'binary%\' ','t_nchar like \'nchar%\' ','(t_binary like \'binary%\' or t_nchar = \'0\' ) ','(t_nchar like \'nchar%\' or t_binary = \'0\' ) ',]
+ #TD-6201,'t_bool between 0 and 1'
+
+ # tag column where for test union,join | this is not support
+ self.t_u_where = ['t1.ts < now +1s' , 't2.ts < now +1s','t1.t_bigint >= -9223372036854775807 and t1.t_bigint <= 9223372036854775807 and t2.t_bigint >= -9223372036854775807 and t2.t_bigint <= 9223372036854775807',
+ 't1.t_int <= 2147483647 and t1.t_int >= -2147483647 and t2.t_int <= 2147483647 and t2.t_int >= -2147483647',
+ 't1.t_smallint >= -32767 and t1.t_smallint <= 32767 and t2.t_smallint >= -32767 and t2.t_smallint <= 32767',
+ 't1.t_tinyint >= -127 and t1.t_tinyint <= 127 and t2.t_tinyint >= -127 and t2.t_tinyint <= 127',
+ 't1.t_float >= -1.7E308 and t1.t_float <= 1.7E308 and t2.t_float >= -1.7E308 and t2.t_float <= 1.7E308',
+ 't1.t_double >= -1.7E308 and t1.t_double <= 1.7E308 and t2.t_double >= -1.7E308 and t2.t_double <= 1.7E308',
+ '(t1.t_binary like \'binary%\' or t1.t_binary = \'0\' or t2.t_binary like \'binary%\' or t2.t_binary = \'0\') ' ,
+ '(t1.t_nchar like \'nchar%\' or t1.t_nchar = \'0\' or t2.t_nchar like \'nchar%\' or t2.t_nchar = \'0\' )' , '(t1.t_bool = true or t1.t_bool = false or t2.t_bool = true or t2.t_bool = false)' ,
+ 't1.t_bool in (0 , 1) and t2.t_bool in (0 , 1)' , 't1.t_bool in ( true , false) and t2.t_bool in ( true , false)' , '(t1.t_bool = 0 or t1.t_bool = 1 or t2.t_bool = 0 or t2.t_bool = 1)',
+ 't1.t_bigint between -9223372036854775807 and 9223372036854775807 and t2.t_bigint between -9223372036854775807 and 9223372036854775807',
+ 't1.t_int between -2147483647 and 2147483647 and t2.t_int between -2147483647 and 2147483647',
+ 't1.t_smallint between -32767 and 32767 and t2.t_smallint between -32767 and 32767',
+ '(t1.t_tinyint between -127 and 127 and t2.t_tinyint between -127 and 127) ','t1.t_float between -1.7E308 and 1.7E308 and t2.t_float between -1.7E308 and 1.7E308',
+ '(t1.t_double between -1.7E308 and 1.7E308 and t2.t_double between -1.7E308 and 1.7E308)']
+ #TD-6201,'t1.t_bool between 0 and 1 or t2.q_bool between 0 and 1']
+
+ self.t_u_or_where = ['(t1.t_binary like \'binary%\' or t1.t_binary = \'0\' or t2.t_binary like \'binary%\' or t2.t_binary = \'0\' )' ,
+ '(t1.t_nchar like \'nchar%\' or t1.t_nchar = \'0\' or t2.t_nchar like \'nchar%\' or t2.t_nchar = \'0\' )' , '(t1.t_bool = true or t1.t_bool = false or t2.t_bool = true or t2.t_bool = false)' ,
+ '(t1.t_bool in (0 , 1) or t2.t_bool in (0 , 1))' , '(t1.t_bool in ( true , false) or t2.t_bool in ( true , false))' , '(t1.t_bool = 0 or t1.t_bool = 1 or t2.t_bool = 0 or t2.t_bool = 1)',
+ '(t1.t_bigint between -9223372036854775807 and 9223372036854775807 or t2.t_bigint between -9223372036854775807 and 9223372036854775807)',
+ '(t1.t_int between -2147483647 and 2147483647 or t2.t_int between -2147483647 and 2147483647)',
+ '(t1.t_smallint between -32767 and 32767 or t2.t_smallint between -32767 and 32767)',
+ '(t1.t_tinyint between -127 and 127 or t2.t_tinyint between -127 and 127 )','(t1.t_float between -1.7E308 and 1.7E308 or t2.t_float between -1.7E308 and 1.7E308)',
+ '(t1.t_double between -1.7E308 and 1.7E308 or t2.t_double between -1.7E308 and 1.7E308)']
+
+ # regular and tag column where
+ self.qt_where = self.q_where + self.t_where
+ self.qt_u_where = self.q_u_where + self.t_u_where
+ # now,qt_u_or_where is not support
+ self.qt_u_or_where = self.q_u_or_where + self.t_u_or_where
+
+ # tag column where for test super join | this is support , 't1.t_bool = t2.t_bool ' ???
+ self.t_join_where = ['t1.t_bigint = t2.t_bigint ', 't1.t_int = t2.t_int ', 't1.t_smallint = t2.t_smallint ', 't1.t_tinyint = t2.t_tinyint ',
+ 't1.t_float = t2.t_float ', 't1.t_double = t2.t_double ', 't1.t_binary = t2.t_binary ' , 't1.t_nchar = t2.t_nchar ' ]
+
+ # session && fill
+ self.session_where = ['session(ts,10a)' , 'session(ts,10s)', 'session(ts,10m)' , 'session(ts,10h)','session(ts,10d)' , 'session(ts,10w)']
+ self.session_u_where = ['session(t1.ts,10a)' , 'session(t1.ts,10s)', 'session(t1.ts,10m)' , 'session(t1.ts,10h)','session(t1.ts,10d)' , 'session(t1.ts,10w)',
+ 'session(t2.ts,10a)' , 'session(t2.ts,10s)', 'session(t2.ts,10m)' , 'session(t2.ts,10h)','session(t2.ts,10d)' , 'session(t2.ts,10w)']
+
+ self.fill_where = ['FILL(NONE)','FILL(PREV)','FILL(NULL)','FILL(LINEAR)','FILL(NEXT)','FILL(VALUE, 1.23)']
+
+ self.state_window = ['STATE_WINDOW(q_tinyint)','STATE_WINDOW(q_bigint)','STATE_WINDOW(q_int)','STATE_WINDOW(q_bool)','STATE_WINDOW(q_smallint)']
+ self.state_u_window = ['STATE_WINDOW(t1.q_tinyint)','STATE_WINDOW(t1.q_bigint)','STATE_WINDOW(t1.q_int)','STATE_WINDOW(t1.q_bool)','STATE_WINDOW(t1.q_smallint)',
+ 'STATE_WINDOW(t2.q_tinyint)','STATE_WINDOW(t2.q_bigint)','STATE_WINDOW(t2.q_int)','STATE_WINDOW(t2.q_bool)','STATE_WINDOW(t2.q_smallint)']
+
+ # order by where
+ self.order_where = ['order by ts' , 'order by ts asc']
+ self.order_u_where = ['order by t1.ts' , 'order by t1.ts asc' , 'order by t2.ts' , 'order by t2.ts asc']
+ self.order_desc_where = ['order by ts' , 'order by ts asc' , 'order by ts desc' ]
+ self.orders_desc_where = ['order by ts' , 'order by ts asc' , 'order by ts desc' , 'order by loc' , 'order by loc asc' , 'order by loc desc']
+
+ self.group_where = ['group by tbname , loc' , 'group by tbname', 'group by tbname, t_bigint', 'group by tbname,t_int', 'group by tbname, t_smallint', 'group by tbname,t_tinyint',
+ 'group by tbname,t_float', 'group by tbname,t_double' , 'group by tbname,t_binary', 'group by tbname,t_nchar', 'group by tbname,t_bool' ,'group by tbname ,loc ,t_bigint',
+ 'group by tbname,t_binary ,t_nchar ,t_bool' , 'group by tbname,t_int ,t_smallint ,t_tinyint' , 'group by tbname,t_float ,t_double ' ,
+ 'PARTITION BY tbname , loc' , 'PARTITION BY tbname', 'PARTITION BY tbname, t_bigint', 'PARTITION BY tbname,t_int', 'PARTITION BY tbname, t_smallint', 'PARTITION BY tbname,t_tinyint',
+ 'PARTITION BY tbname,t_float', 'PARTITION BY tbname,t_double' , 'PARTITION BY tbname,t_binary', 'PARTITION BY tbname,t_nchar', 'PARTITION BY tbname,t_bool' ,'PARTITION BY tbname ,loc ,t_bigint',
+ 'PARTITION BY tbname,t_binary ,t_nchar ,t_bool' , 'PARTITION BY tbname,t_int ,t_smallint ,t_tinyint' , 'PARTITION BY tbname,t_float ,t_double ']
+ self.group_where_j = ['group by t1.loc' , 'group by t1.t_bigint', 'group by t1.t_int', 'group by t1.t_smallint', 'group by t1.t_tinyint',
+ 'group by t1.t_float', 'group by t1.t_double' , 'group by t1.t_binary', 'group by t1.t_nchar', 'group by t1.t_bool' ,'group by t1.loc ,t1.t_bigint',
+ 'group by t1.t_binary ,t1.t_nchar ,t1.t_bool' , 'group by t1.t_int ,t1.t_smallint ,t1.t_tinyint' , 'group by t1.t_float ,t1.t_double ' ,
+ 'PARTITION BY t1.loc' , 'PARTITION by t1.t_bigint', 'PARTITION by t1.t_int', 'PARTITION by t1.t_smallint', 'PARTITION by t1.t_tinyint',
+ 'PARTITION by t1.t_float', 'PARTITION by t1.t_double' , 'PARTITION by t1.t_binary', 'PARTITION by t1.t_nchar', 'PARTITION by t1.t_bool' ,'PARTITION BY t1.loc ,t1.t_bigint',
+ 'PARTITION by t1.t_binary ,t1.t_nchar ,t1.t_bool' , 'PARTITION by t1.t_int ,t1.t_smallint ,t1.t_tinyint' , 'PARTITION by t1.t_float ,t1.t_double ',
+ 'group by t2.loc' , 'group by t2.t_bigint', 'group by t2.t_int', 'group by t2.t_smallint', 'group by t2.t_tinyint',
+ 'group by t2.t_float', 'group by t2.t_double' , 'group by t2.t_binary', 'group by t2.t_nchar', 'group by t2.t_bool' ,'group by t2.loc ,t2.t_bigint',
+ 'group by t2.t_binary ,t2.t_nchar ,t2.t_bool' , 'group by t2.t_int ,t2.t_smallint ,t2.t_tinyint' , 'group by t2.t_float ,t2.t_double ' ,
+ 'PARTITION BY t2.loc' , 'PARTITION by t2.t_bigint', 'PARTITION by t2.t_int', 'PARTITION by t2.t_smallint', 'PARTITION by t2.t_tinyint',
+ 'PARTITION by t2.t_float', 'PARTITION by t2.t_double' , 'PARTITION by t2.t_binary', 'PARTITION by t2.t_nchar', 'PARTITION by t2.t_bool' ,'PARTITION BY t2.loc ,t2.t_bigint',
+ 'PARTITION by t2.t_binary ,t2.t_nchar ,t2.t_bool' , 'PARTITION by t2.t_int ,t2.t_smallint ,t2.t_tinyint' , 'PARTITION by t2.t_float ,t2.t_double ']
+
+ self.partiton_where = ['PARTITION BY tbname , loc' , 'PARTITION BY tbname', 'PARTITION BY tbname, t_bigint', 'PARTITION BY tbname,t_int', 'PARTITION BY tbname, t_smallint', 'PARTITION BY tbname,t_tinyint',
+ 'PARTITION BY tbname,t_float', 'PARTITION BY tbname,t_double' , 'PARTITION BY tbname,t_binary', 'PARTITION BY tbname,t_nchar', 'PARTITION BY tbname,t_bool' ,'PARTITION BY tbname ,loc ,t_bigint',
+ 'PARTITION BY tbname,t_binary ,t_nchar ,t_bool' , 'PARTITION BY tbname,t_int ,t_smallint ,t_tinyint' , 'PARTITION BY tbname,t_float ,t_double ']
+ self.partiton_where_j = ['PARTITION BY t1.loc' , 'PARTITION by t1.t_bigint', 'PARTITION by t1.t_int', 'PARTITION by t1.t_smallint', 'PARTITION by t1.t_tinyint',
+ 'PARTITION by t1.t_float', 'PARTITION by t1.t_double' , 'PARTITION by t1.t_binary', 'PARTITION by t1.t_nchar', 'PARTITION by t1.t_bool' ,'PARTITION BY t1.loc ,t1.t_bigint',
+ 'PARTITION by t1.t_binary ,t1.t_nchar ,t1.t_bool' , 'PARTITION by t1.t_int ,t1.t_smallint ,t1.t_tinyint' , 'PARTITION by t1.t_float ,t1.t_double ',
+ 'PARTITION BY t2.loc' , 'PARTITION by t2.t_bigint', 'PARTITION by t2.t_int', 'PARTITION by t2.t_smallint', 'PARTITION by t2.t_tinyint',
+ 'PARTITION by t2.t_float', 'PARTITION by t2.t_double' , 'PARTITION by t2.t_binary', 'PARTITION by t2.t_nchar', 'PARTITION by t2.t_bool' ,'PARTITION BY t2.loc ,t2.t_bigint',
+ 'PARTITION by t2.t_binary ,t2.t_nchar ,t2.t_bool' , 'PARTITION by t2.t_int ,t2.t_smallint ,t2.t_tinyint' , 'PARTITION by t2.t_float ,t2.t_double ']
+
+
+ self.group_where_regular = ['group by tbname ' , 'group by tbname', 'group by tbname, q_bigint', 'group by tbname,q_int', 'group by tbname, q_smallint', 'group by tbname,q_tinyint',
+ 'group by tbname,q_float', 'group by tbname,q_double' , 'group by tbname,q_binary', 'group by tbname,q_nchar', 'group by tbname,q_bool' ,'group by tbname ,q_bigint',
+ 'group by tbname,q_binary ,q_nchar ,q_bool' , 'group by tbname,q_int ,q_smallint ,q_tinyint' , 'group by tbname,q_float ,q_double ' ,
+ 'PARTITION BY tbname ' , 'PARTITION BY tbname', 'PARTITION BY tbname, q_bigint', 'PARTITION BY tbname,q_int', 'PARTITION BY tbname, q_smallint', 'PARTITION BY tbname,q_tinyint',
+ 'PARTITION BY tbname,q_float', 'PARTITION BY tbname,q_double' , 'PARTITION BY tbname,q_binary', 'PARTITION BY tbname,q_nchar', 'PARTITION BY tbname,q_bool' ,'PARTITION BY tbname ,q_bigint',
+ 'PARTITION BY tbname,q_binary ,q_nchar ,q_bool' , 'PARTITION BY tbname,q_int ,q_smallint ,q_tinyint' , 'PARTITION BY tbname,q_float ,q_double ']
+ self.group_where_regular_j = ['group by t1.q_bigint', 'group by t1.q_int', 'group by t1.q_smallint', 'group by t1.q_tinyint',
+ 'group by t1.q_float', 'group by t1.q_double' , 'group by t1.q_binary', 'group by t1.q_nchar', 'group by t1.q_bool' ,'group by t1.q_bigint',
+ 'group by t1.q_binary ,t1.q_nchar ,t1.q_bool' , 'group by t1.q_int ,t1.q_smallint ,t1.q_tinyint' , 'group by t1.q_float ,t1.q_double ' ,
+ 'PARTITION by t1.q_bigint', 'PARTITION by t1.q_int', 'PARTITION by t1.q_smallint', 'PARTITION by t1.q_tinyint',
+ 'PARTITION by t1.q_float', 'PARTITION by t1.q_double' , 'PARTITION by t1.q_binary', 'PARTITION by t1.q_nchar', 'PARTITION by t1.q_bool' ,'PARTITION BY t1.q_bigint',
+ 'PARTITION by t1.q_binary ,t1.q_nchar ,t1.q_bool' , 'PARTITION by t1.q_int ,t1.q_smallint ,t1.q_tinyint' , 'PARTITION by t1.q_float ,t1.q_double ',
+ 'group by t2.q_bigint', 'group by t2.q_int', 'group by t2.q_smallint', 'group by t2.q_tinyint',
+ 'group by t2.q_float', 'group by t2.q_double' , 'group by t2.q_binary', 'group by t2.q_nchar', 'group by t2.q_bool' ,'group by t2.q_bigint',
+ 'group by t2.q_binary ,t2.q_nchar ,t2.q_bool' , 'group by t2.q_int ,t2.q_smallint ,t2.q_tinyint' , 'group by t2.q_float ,t2.q_double ' ,
+ 'PARTITION by t2.q_bigint', 'PARTITION by t2.q_int', 'PARTITION by t2.q_smallint', 'PARTITION by t2.q_tinyint',
+ 'PARTITION by t2.q_float', 'PARTITION by t2.q_double' , 'PARTITION by t2.q_binary', 'PARTITION by t2.q_nchar', 'PARTITION by t2.q_bool' ,'PARTITION BY t2.q_bigint',
+ 'PARTITION by t2.q_binary ,t2.q_nchar ,t2.q_bool' , 'PARTITION by t2.q_int ,t2.q_smallint ,t2.q_tinyint' , 'PARTITION by t2.q_float ,t2.q_double ']
+
+ self.partiton_where_regular = ['PARTITION BY tbname ' , 'PARTITION BY tbname', 'PARTITION BY tbname, q_bigint', 'PARTITION BY tbname,q_int', 'PARTITION BY tbname, q_smallint', 'PARTITION BY tbname,q_tinyint',
+ 'PARTITION BY tbname,q_float', 'PARTITION BY tbname,q_double' , 'PARTITION BY tbname,q_binary', 'PARTITION BY tbname,q_nchar', 'PARTITION BY tbname,q_bool' ,'PARTITION BY tbname ,q_bigint',
+ 'PARTITION BY tbname,q_binary ,q_nchar ,q_bool' , 'PARTITION BY tbname,q_int ,q_smallint ,q_tinyint' , 'PARTITION BY tbname,q_float ,q_double ']
+ self.partiton_where_regular_j = ['PARTITION by t1.q_bigint', 'PARTITION by t1.q_int', 'PARTITION by t1.q_smallint', 'PARTITION by t1.q_tinyint',
+ 'PARTITION by t1.q_float', 'PARTITION by t1.q_double' , 'PARTITION by t1.q_binary', 'PARTITION by t1.q_nchar', 'PARTITION by t1.q_bool' ,'PARTITION BY t1.q_bigint',
+ 'PARTITION by t1.q_binary ,t1.q_nchar ,t1.q_bool' , 'PARTITION by t1.q_int ,t1.q_smallint ,t1.q_tinyint' , 'PARTITION by t1.q_float ,t1.q_double ',
+ 'PARTITION by t2.q_bigint', 'PARTITION by t2.q_int', 'PARTITION by t2.q_smallint', 'PARTITION by t2.q_tinyint',
+ 'PARTITION by t2.q_float', 'PARTITION by t2.q_double' , 'PARTITION by t2.q_binary', 'PARTITION by t2.q_nchar', 'PARTITION by t2.q_bool' ,'PARTITION BY t2.q_bigint',
+ 'PARTITION by t2.q_binary ,t2.q_nchar ,t2.q_bool' , 'PARTITION by t2.q_int ,t2.q_smallint ,t2.q_tinyint' , 'PARTITION by t2.q_float ,t2.q_double ']
+
+ self.having_support = ['having count(q_int) > 0','having count(q_bigint) > 0','having count(q_smallint) > 0','having count(q_tinyint) > 0','having count(q_float) > 0','having count(q_double) > 0','having count(q_bool) > 0',
+ 'having avg(q_int) > 0','having avg(q_bigint) > 0','having avg(q_smallint) > 0','having avg(q_tinyint) > 0','having avg(q_float) > 0','having avg(q_double) > 0',
+ 'having sum(q_int) > 0','having sum(q_bigint) > 0','having sum(q_smallint) > 0','having sum(q_tinyint) > 0','having sum(q_float) > 0','having sum(q_double) > 0',
+ 'having STDDEV(q_int) > 0','having STDDEV(q_bigint) > 0','having STDDEV(q_smallint) > 0','having STDDEV(q_tinyint) > 0','having STDDEV(q_float) > 0','having STDDEV(q_double) > 0',
+ 'having TWA(q_int) > 0','having TWA(q_bigint) > 0','having TWA(q_smallint) > 0','having TWA(q_tinyint) > 0','having TWA(q_float) > 0','having TWA(q_double) > 0',
+ 'having IRATE(q_int) > 0','having IRATE(q_bigint) > 0','having IRATE(q_smallint) > 0','having IRATE(q_tinyint) > 0','having IRATE(q_float) > 0','having IRATE(q_double) > 0',
+ 'having MIN(q_int) > 0','having MIN(q_bigint) > 0','having MIN(q_smallint) > 0','having MIN(q_tinyint) > 0','having MIN(q_float) > 0','having MIN(q_double) > 0',
+ 'having MAX(q_int) > 0','having MAX(q_bigint) > 0','having MAX(q_smallint) > 0','having MAX(q_tinyint) > 0','having MAX(q_float) > 0','having MAX(q_double) > 0',
+ 'having FIRST(q_int) > 0','having FIRST(q_bigint) > 0','having FIRST(q_smallint) > 0','having FIRST(q_tinyint) > 0','having FIRST(q_float) > 0','having FIRST(q_double) > 0',
+ 'having LAST(q_int) > 0','having LAST(q_bigint) > 0','having LAST(q_smallint) > 0','having LAST(q_tinyint) > 0','having LAST(q_float) > 0','having LAST(q_double) > 0',
+ 'having APERCENTILE(q_int,10) > 0','having APERCENTILE(q_bigint,10) > 0','having APERCENTILE(q_smallint,10) > 0','having APERCENTILE(q_tinyint,10) > 0','having APERCENTILE(q_float,10) > 0','having APERCENTILE(q_double,10) > 0']
+ self.having_not_support = ['having TOP(q_int,10) > 0','having TOP(q_bigint,10) > 0','having TOP(q_smallint,10) > 0','having TOP(q_tinyint,10) > 0','having TOP(q_float,10) > 0','having TOP(q_double,10) > 0','having TOP(q_bool,10) > 0',
+ 'having BOTTOM(q_int,10) > 0','having BOTTOM(q_bigint,10) > 0','having BOTTOM(q_smallint,10) > 0','having BOTTOM(q_tinyint,10) > 0','having BOTTOM(q_float,10) > 0','having BOTTOM(q_double,10) > 0','having BOTTOM(q_bool,10) > 0',
+ 'having LEASTSQUARES(q_int) > 0','having LEASTSQUARES(q_bigint) > 0','having LEASTSQUARES(q_smallint) > 0','having LEASTSQUARES(q_tinyint) > 0','having LEASTSQUARES(q_float) > 0','having LEASTSQUARES(q_double) > 0','having LEASTSQUARES(q_bool) > 0',
+ 'having FIRST(q_bool) > 0','having IRATE(q_bool) > 0','having PERCENTILE(q_bool,10) > 0','having avg(q_bool) > 0','having LAST_ROW(q_bool) > 0','having sum(q_bool) > 0','having STDDEV(q_bool) > 0','having APERCENTILE(q_bool,10) > 0','having TWA(q_bool) > 0','having LAST(q_bool) > 0',
+ 'having PERCENTILE(q_int,10) > 0','having PERCENTILE(q_bigint,10) > 0','having PERCENTILE(q_smallint,10) > 0','having PERCENTILE(q_tinyint,10) > 0','having PERCENTILE(q_float,10) > 0','having PERCENTILE(q_double,10) > 0']
+ self.having_tagnot_support = ['having LAST_ROW(q_int) > 0','having LAST_ROW(q_bigint) > 0','having LAST_ROW(q_smallint) > 0','having LAST_ROW(q_tinyint) > 0','having LAST_ROW(q_float) > 0','having LAST_ROW(q_double) > 0']
+
+ self.having_support_j = ['having count(t1.q_int) > 0','having count(t1.q_bigint) > 0','having count(t1.q_smallint) > 0','having count(t1.q_tinyint) > 0','having count(t1.q_float) > 0','having count(t1.q_double) > 0','having count(t1.q_bool) > 0',
+ 'having avg(t1.q_int) > 0','having avg(t1.q_bigint) > 0','having avg(t1.q_smallint) > 0','having avg(t1.q_tinyint) > 0','having avg(t1.q_float) > 0','having avg(t1.q_double) > 0',
+ 'having sum(t1.q_int) > 0','having sum(t1.q_bigint) > 0','having sum(t1.q_smallint) > 0','having sum(t1.q_tinyint) > 0','having sum(t1.q_float) > 0','having sum(t1.q_double) > 0',
+ 'having STDDEV(t1.q_int) > 0','having STDDEV(t1.q_bigint) > 0','having STDDEV(t1.q_smallint) > 0','having STDDEV(t1.q_tinyint) > 0','having STDDEV(t1.q_float) > 0','having STDDEV(t1.q_double) > 0',
+ 'having TWA(t1.q_int) > 0','having TWA(t1.q_bigint) > 0','having TWA(t1.q_smallint) > 0','having TWA(t1.q_tinyint) > 0','having TWA(t1.q_float) > 0','having TWA(t1.q_double) > 0',
+ 'having IRATE(t1.q_int) > 0','having IRATE(t1.q_bigint) > 0','having IRATE(t1.q_smallint) > 0','having IRATE(t1.q_tinyint) > 0','having IRATE(t1.q_float) > 0','having IRATE(t1.q_double) > 0',
+ 'having MIN(t1.q_int) > 0','having MIN(t1.q_bigint) > 0','having MIN(t1.q_smallint) > 0','having MIN(t1.q_tinyint) > 0','having MIN(t1.q_float) > 0','having MIN(t1.q_double) > 0',
+ 'having MAX(t1.q_int) > 0','having MAX(t1.q_bigint) > 0','having MAX(t1.q_smallint) > 0','having MAX(t1.q_tinyint) > 0','having MAX(t1.q_float) > 0','having MAX(t1.q_double) > 0',
+ 'having FIRST(t1.q_int) > 0','having FIRST(t1.q_bigint) > 0','having FIRST(t1.q_smallint) > 0','having FIRST(t1.q_tinyint) > 0','having FIRST(t1.q_float) > 0','having FIRST(t1.q_double) > 0',
+ 'having LAST(t1.q_int) > 0','having LAST(t1.q_bigint) > 0','having LAST(t1.q_smallint) > 0','having LAST(t1.q_tinyint) > 0','having LAST(t1.q_float) > 0','having LAST(t1.q_double) > 0',
+ 'having APERCENTILE(t1.q_int,10) > 0','having APERCENTILE(t1.q_bigint,10) > 0','having APERCENTILE(t1.q_smallint,10) > 0','having APERCENTILE(t1.q_tinyint,10) > 0','having APERCENTILE(t1.q_float,10) > 0','having APERCENTILE(t1.q_double,10) > 0']
+
+ # limit offset where
+ self.limit_where = ['limit 1 offset 1' , 'limit 1' , 'limit 2 offset 1' , 'limit 2', 'limit 12 offset 1' , 'limit 20', 'limit 20 offset 10' , 'limit 200']
+ self.limit1_where = ['limit 1 offset 1' , 'limit 1' ]
+ self.limit_u_where = ['limit 100 offset 10' , 'limit 50' , 'limit 100' , 'limit 10' ]
+
+ # slimit soffset where
+ self.slimit_where = ['slimit 1 soffset 1' , 'slimit 1' , 'slimit 2 soffset 1' , 'slimit 2']
+ self.slimit1_where = ['slimit 2 soffset 1' , 'slimit 1' ]
+
+ # aggregate function include [all:count(*)\avg\sum\stddev ||regualr:twa\irate\leastsquares ||group by tbname:twa\irate\]
+ # select function include [all: min\max\first(*)\last(*)\top\bottom\apercentile\last_row(*)(not with interval)\interp(*)(FILL) ||regualr: percentile]
+ # calculation function include [all:spread\+-*/ ||regualr:diff\derivative ||group by tbname:diff\derivative\]
+ # **_ns_** express is not support stable, therefore, separated from regular tables
+ # calc_select_all calc_select_regular calc_select_in_ts calc_select_fill calc_select_not_interval
+ # calc_aggregate_all calc_aggregate_regular calc_aggregate_groupbytbname
+ # calc_calculate_all calc_calculate_regular calc_calculate_groupbytbname
+
+ # calc_select_all calc_select_regular calc_select_in_ts calc_select_fill calc_select_not_interval
+ # select function include [all: min\max\first(*)\last(*)\top\bottom\apercentile\last_row(*)(not with interval)\interp(*)(FILL) ||regualr: percentile]
+
+ self.calc_select_all = ['bottom(q_int,20)' , 'bottom(q_bigint,20)' , 'bottom(q_smallint,20)' , 'bottom(q_tinyint,20)' ,'bottom(q_float,20)' , 'bottom(q_double,20)' ,
+ 'top(q_int,20)' , 'top(q_bigint,20)' , 'top(q_smallint,20)' ,'top(q_tinyint,20)' ,'top(q_float,20)' ,'top(q_double,20)' ,
+ 'first(q_int)' , 'first(q_bigint)' , 'first(q_smallint)' , 'first(q_tinyint)' , 'first(q_float)' ,'first(q_double)' ,'first(q_binary)' ,'first(q_nchar)' ,'first(q_bool)' ,'first(q_ts)' ,
+ 'last(q_int)' , 'last(q_bigint)' , 'last(q_smallint)' , 'last(q_tinyint)' , 'last(q_float)' ,'last(q_double)' , 'last(q_binary)' ,'last(q_nchar)' ,'last(q_bool)' ,'last(q_ts)' ,
+ 'min(q_int)' , 'min(q_bigint)' , 'min(q_smallint)' , 'min(q_tinyint)' , 'min(q_float)' ,'min(q_double)' ,
+ 'max(q_int)' , 'max(q_bigint)' , 'max(q_smallint)' , 'max(q_tinyint)' ,'max(q_float)' ,'max(q_double)' ,
+ 'apercentile(q_int,20)' , 'apercentile(q_bigint,20)' ,'apercentile(q_smallint,20)' ,'apercentile(q_tinyint,20)' ,'apercentile(q_float,20)' ,'apercentile(q_double,20)' ,
+ 'last_row(q_int)' , 'last_row(q_bigint)' , 'last_row(q_smallint)' , 'last_row(q_tinyint)' , 'last_row(q_float)' ,
+ 'last_row(q_double)' , 'last_row(q_bool)' ,'last_row(q_binary)' ,'last_row(q_nchar)' ,'last_row(q_ts)']
+
+ self.calc_select_in_ts = ['bottom(q_int,20)' , 'bottom(q_bigint,20)' , 'bottom(q_smallint,20)' , 'bottom(q_tinyint,20)' ,'bottom(q_float,20)' , 'bottom(q_double,20)' ,
+ 'top(q_int,20)' , 'top(q_bigint,20)' , 'top(q_smallint,20)' ,'top(q_tinyint,20)' ,'top(q_float,20)' ,'top(q_double,20)' ,
+ 'first(q_int)' , 'first(q_bigint)' , 'first(q_smallint)' , 'first(q_tinyint)' , 'first(q_float)' ,'first(q_double)' ,'first(q_binary)' ,'first(q_nchar)' ,'first(q_bool)' ,'first(q_ts)' ,
+ 'last(q_int)' , 'last(q_bigint)' , 'last(q_smallint)' , 'last(q_tinyint)' , 'last(q_float)' ,'last(q_double)' , 'last(q_binary)' ,'last(q_nchar)' ,'last(q_bool)' ,'last(q_ts)' ]
+
+ self.calc_select_in = ['min(q_int)' , 'min(q_bigint)' , 'min(q_smallint)' , 'min(q_tinyint)' , 'min(q_float)' ,'min(q_double)' ,
+ 'max(q_int)' , 'max(q_bigint)' , 'max(q_smallint)' , 'max(q_tinyint)' ,'max(q_float)' ,'max(q_double)' ,
+ 'apercentile(q_int,20)' , 'apercentile(q_bigint,20)' ,'apercentile(q_smallint,20)' ,'apercentile(q_tinyint,20)' ,'apercentile(q_float,20)' ,'apercentile(q_double,20)' ,
+ 'last_row(q_int)' , 'last_row(q_bigint)' , 'last_row(q_smallint)' , 'last_row(q_tinyint)' , 'last_row(q_float)' ,
+ 'last_row(q_double)' , 'last_row(q_bool)' ,'last_row(q_binary)' ,'last_row(q_nchar)' ,'last_row(q_ts)']
+
+ self.calc_select_not_support_ts = ['first(q_int)' , 'first(q_bigint)' , 'first(q_smallint)' , 'first(q_tinyint)' , 'first(q_float)' ,'first(q_double)' ,'first(q_binary)' ,'first(q_nchar)' ,'first(q_bool)' ,'first(q_ts)' ,
+ 'last(q_int)' , 'last(q_bigint)' , 'last(q_smallint)' , 'last(q_tinyint)' , 'last(q_float)' ,'last(q_double)' , 'last(q_binary)' ,'last(q_nchar)' ,'last(q_bool)' ,'last(q_ts)' ,
+ 'last_row(q_int)' , 'last_row(q_bigint)' , 'last_row(q_smallint)' , 'last_row(q_tinyint)' , 'last_row(q_float)' ,
+ 'last_row(q_double)' , 'last_row(q_bool)' ,'last_row(q_binary)' ,'last_row(q_nchar)' ,'last_row(q_ts)',
+ 'apercentile(q_int,20)' , 'apercentile(q_bigint,20)' ,'apercentile(q_smallint,20)' ,'apercentile(q_tinyint,20)' ,'apercentile(q_float,20)' ,'apercentile(q_double,20)']
+
+ self.calc_select_support_ts = ['bottom(q_int,20)' , 'bottom(q_bigint,20)' , 'bottom(q_smallint,20)' , 'bottom(q_tinyint,20)' ,'bottom(q_float,20)' , 'bottom(q_double,20)' ,
+ 'top(q_int,20)' , 'top(q_bigint,20)' , 'top(q_smallint,20)' ,'top(q_tinyint,20)' ,'top(q_float,20)' ,'top(q_double,20)' ,
+ 'min(q_int)' , 'min(q_bigint)' , 'min(q_smallint)' , 'min(q_tinyint)' , 'min(q_float)' ,'min(q_double)' ,
+ 'max(q_int)' , 'max(q_bigint)' , 'max(q_smallint)' , 'max(q_tinyint)' ,'max(q_float)' ,'max(q_double)' ]
+
+ self.calc_select_regular = [ 'PERCENTILE(q_int,10)' ,'PERCENTILE(q_bigint,20)' , 'PERCENTILE(q_smallint,30)' ,'PERCENTILE(q_tinyint,40)' ,'PERCENTILE(q_float,50)' ,'PERCENTILE(q_double,60)']
+
+
+ self.calc_select_fill = ['INTERP(q_int)' ,'INTERP(q_bigint)' ,'INTERP(q_smallint)' ,'INTERP(q_tinyint)', 'INTERP(q_float)' ,'INTERP(q_double)']
+ self.interp_where = ['ts = now' , 'ts = \'2020-09-13 20:26:40.000\'' , 'ts = \'2020-09-13 20:26:40.009\'' ,'tbname in (\'table_1\') and ts = now' ,'tbname in (\'table_0\' ,\'table_1\',\'table_2\',\'table_3\',\'table_4\',\'table_5\') and ts = \'2020-09-13 20:26:40.000\'','tbname like \'table%\' and ts = \'2020-09-13 20:26:40.002\'']
+
+ #two table join
+ self.calc_select_in_ts_j = ['bottom(t1.q_int,20)' , 'bottom(t1.q_bigint,20)' , 'bottom(t1.q_smallint,20)' , 'bottom(t1.q_tinyint,20)' ,'bottom(t1.q_float,20)' , 'bottom(t1.q_double,20)' ,
+ 'top(t1.q_int,20)' , 'top(t1.q_bigint,20)' , 'top(t1.q_smallint,20)' ,'top(t1.q_tinyint,20)' ,'top(t1.q_float,20)' ,'top(t1.q_double,20)' ,
+ 'first(t1.q_int)' , 'first(t1.q_bigint)' , 'first(t1.q_smallint)' , 'first(t1.q_tinyint)' , 'first(t1.q_float)' ,'first(t1.q_double)' ,'first(t1.q_binary)' ,'first(t1.q_nchar)' ,'first(t1.q_bool)' ,'first(t1.q_ts)' ,
+ 'last(t1.q_int)' , 'last(t1.q_bigint)' , 'last(t1.q_smallint)' , 'last(t1.q_tinyint)' , 'last(t1.q_float)' ,'last(t1.q_double)' , 'last(t1.q_binary)' ,'last(t1.q_nchar)' ,'last(t1.q_bool)' ,'last(t1.q_ts)' ,
+ 'bottom(t2.q_int,20)' , 'bottom(t2.q_bigint,20)' , 'bottom(t2.q_smallint,20)' , 'bottom(t2.q_tinyint,20)' ,'bottom(t2.q_float,20)' , 'bottom(t2.q_double,20)' ,
+ 'top(t2.q_int,20)' , 'top(t2.q_bigint,20)' , 'top(t2.q_smallint,20)' ,'top(t2.q_tinyint,20)' ,'top(t2.q_float,20)' ,'top(t2.q_double,20)' ,
+ 'first(t2.q_int)' , 'first(t2.q_bigint)' , 'first(t2.q_smallint)' , 'first(t2.q_tinyint)' , 'first(t2.q_float)' ,'first(t2.q_double)' ,'first(t2.q_binary)' ,'first(t2.q_nchar)' ,'first(t2.q_bool)' ,'first(t2.q_ts)' ,
+ 'last(t2.q_int)' , 'last(t2.q_bigint)' , 'last(t2.q_smallint)' , 'last(t2.q_tinyint)' , 'last(t2.q_float)' ,'last(t2.q_double)' , 'last(t2.q_binary)' ,'last(t2.q_nchar)' ,'last(t2.q_bool)' ,'last(t2.q_ts)']
+
+ self.calc_select_in_support_ts_j = ['bottom(t1.q_int,20)' , 'bottom(t1.q_bigint,20)' , 'bottom(t1.q_smallint,20)' , 'bottom(t1.q_tinyint,20)' ,'bottom(t1.q_float,20)' , 'bottom(t1.q_double,20)' ,
+ 'top(t1.q_int,20)' , 'top(t1.q_bigint,20)' , 'top(t1.q_smallint,20)' ,'top(t1.q_tinyint,20)' ,'top(t1.q_float,20)' ,'top(t1.q_double,20)' ,
+ 'min(t1.q_int)' , 'min(t1.q_bigint)' , 'min(t1.q_smallint)' , 'min(t1.q_tinyint)' , 'min(t1.q_float)' ,'min(t1.q_double)' ,
+ 'max(t1.q_int)' , 'max(t1.q_bigint)' , 'max(t1.q_smallint)' , 'max(t1.q_tinyint)' ,'max(t1.q_float)' ,'max(t1.q_double)' ,
+ 'bottom(t2.q_int,20)' , 'bottom(t2.q_bigint,20)' , 'bottom(t2.q_smallint,20)' , 'bottom(t2.q_tinyint,20)' ,'bottom(t2.q_float,20)' , 'bottom(t2.q_double,20)' ,
+ 'top(t2.q_int,20)' , 'top(t2.q_bigint,20)' , 'top(t2.q_smallint,20)' ,'top(t2.q_tinyint,20)' ,'top(t2.q_float,20)' ,'top(t2.q_double,20)' ,
+ 'min(t2.q_int)' , 'min(t2.q_bigint)' , 'min(t2.q_smallint)' , 'min(t2.q_tinyint)' , 'min(t2.q_float)' ,'min(t2.q_double)' ,
+ 'max(t2.q_int)' , 'max(t2.q_bigint)' , 'max(t2.q_smallint)' , 'max(t2.q_tinyint)' ,'max(t2.q_float)' ,'max(t2.q_double)' ,
+ ]
+
+ self.calc_select_in_not_support_ts_j = ['apercentile(t1.q_int,20)' , 'apercentile(t1.q_bigint,20)' ,'apercentile(t1.q_smallint,20)' ,'apercentile(t1.q_tinyint,20)' ,'apercentile(t1.q_float,20)' ,'apercentile(t1.q_double,20)' ,
+ 'last_row(t1.q_int)' , 'last_row(t1.q_bigint)' , 'last_row(t1.q_smallint)' , 'last_row(t1.q_tinyint)' , 'last_row(t1.q_float)' ,
+ 'last_row(t1.q_double)' , 'last_row(t1.q_bool)' ,'last_row(t1.q_binary)' ,'last_row(t1.q_nchar)' ,'last_row(t1.q_ts)' ,
+ 'apercentile(t2.q_int,20)' , 'apercentile(t2.q_bigint,20)' ,'apercentile(t2.q_smallint,20)' ,'apercentile(t2.q_tinyint,20)' ,'apercentile(t2.q_float,20)' ,'apercentile(t2.q_double,20)' ,
+ 'last_row(t2.q_int)' , 'last_row(t2.q_bigint)' , 'last_row(t2.q_smallint)' , 'last_row(t2.q_tinyint)' , 'last_row(t2.q_float)' ,
+ 'last_row(t2.q_double)' , 'last_row(t2.q_bool)' ,'last_row(t2.q_binary)' ,'last_row(t2.q_nchar)' ,'last_row(t2.q_ts)']
+
+ self.calc_select_in_j = ['min(t1.q_int)' , 'min(t1.q_bigint)' , 'min(t1.q_smallint)' , 'min(t1.q_tinyint)' , 'min(t1.q_float)' ,'min(t1.q_double)' ,
+ 'max(t1.q_int)' , 'max(t1.q_bigint)' , 'max(t1.q_smallint)' , 'max(t1.q_tinyint)' ,'max(t1.q_float)' ,'max(t1.q_double)' ,
+ 'apercentile(t1.q_int,20)' , 'apercentile(t1.q_bigint,20)' ,'apercentile(t1.q_smallint,20)' ,'apercentile(t1.q_tinyint,20)' ,'apercentile(t1.q_float,20)' ,'apercentile(t1.q_double,20)' ,
+ 'last_row(t1.q_int)' , 'last_row(t1.q_bigint)' , 'last_row(t1.q_smallint)' , 'last_row(t1.q_tinyint)' , 'last_row(t1.q_float)' ,
+ 'last_row(t1.q_double)' , 'last_row(t1.q_bool)' ,'last_row(t1.q_binary)' ,'last_row(t1.q_nchar)' ,'last_row(t1.q_ts)' ,
+ 'min(t2.q_int)' , 'min(t2.q_bigint)' , 'min(t2.q_smallint)' , 'min(t2.q_tinyint)' , 'min(t2.q_float)' ,'min(t2.q_double)' ,
+ 'max(t2.q_int)' , 'max(t2.q_bigint)' , 'max(t2.q_smallint)' , 'max(t2.q_tinyint)' ,'max(t2.q_float)' ,'max(t2.q_double)' ,
+ 'apercentile(t2.q_int,20)' , 'apercentile(t2.q_bigint,20)' ,'apercentile(t2.q_smallint,20)' ,'apercentile(t2.q_tinyint,20)' ,'apercentile(t2.q_float,20)' ,'apercentile(t2.q_double,20)' ,
+ 'last_row(t2.q_int)' , 'last_row(t2.q_bigint)' , 'last_row(t2.q_smallint)' , 'last_row(t2.q_tinyint)' , 'last_row(t2.q_float)' ,
+ 'last_row(t2.q_double)' , 'last_row(t2.q_bool)' ,'last_row(t2.q_binary)' ,'last_row(t2.q_nchar)' ,'last_row(t2.q_ts)']
+ self.calc_select_all_j = self.calc_select_in_ts_j + self.calc_select_in_j
+
+ self.calc_select_regular_j = [ 'PERCENTILE(t1.q_int,10)' ,'PERCENTILE(t1.q_bigint,20)' , 'PERCENTILE(t1.q_smallint,30)' ,'PERCENTILE(t1.q_tinyint,40)' ,'PERCENTILE(t1.q_float,50)' ,'PERCENTILE(t1.q_double,60)' ,
+ 'PERCENTILE(t2.q_int,10)' ,'PERCENTILE(t2.q_bigint,20)' , 'PERCENTILE(t2.q_smallint,30)' ,'PERCENTILE(t2.q_tinyint,40)' ,'PERCENTILE(t2.q_float,50)' ,'PERCENTILE(t2.q_double,60)']
+
+
+ self.calc_select_fill_j = ['INTERP(t1.q_int)' ,'INTERP(t1.q_bigint)' ,'INTERP(t1.q_smallint)' ,'INTERP(t1.q_tinyint)', 'INTERP(t1.q_float)' ,'INTERP(t1.q_double)' ,
+ 'INTERP(t2.q_int)' ,'INTERP(t2.q_bigint)' ,'INTERP(t2.q_smallint)' ,'INTERP(t2.q_tinyint)', 'INTERP(t2.q_float)' ,'INTERP(t2.q_double)']
+ self.interp_where_j = ['t1.ts = now' , 't1.ts = \'2020-09-13 20:26:40.000\'' , 't1.ts = \'2020-09-13 20:26:40.009\'' ,'t2.ts = now' , 't2.ts = \'2020-09-13 20:26:40.000\'' , 't2.ts = \'2020-09-13 20:26:40.009\'' ,
+ 't1.tbname in (\'table_1\') and t1.ts = now' ,'t1.tbname in (\'table_0\' ,\'table_1\',\'table_2\',\'table_3\',\'table_4\',\'table_5\') and t1.ts = \'2020-09-13 20:26:40.000\'','t1.tbname like \'table%\' and t1.ts = \'2020-09-13 20:26:40.002\'',
+ 't2.tbname in (\'table_1\') and t2.ts = now' ,'t2.tbname in (\'table_0\' ,\'table_1\',\'table_2\',\'table_3\',\'table_4\',\'table_5\') and t2.ts = \'2020-09-13 20:26:40.000\'','t2.tbname like \'table%\' and t2.ts = \'2020-09-13 20:26:40.002\'']
+
+ # calc_aggregate_all calc_aggregate_regular calc_aggregate_groupbytbname APERCENTILE\PERCENTILE
+ # aggregate function include [all:count(*)\avg\sum\stddev ||regualr:twa\irate\leastsquares ||group by tbname:twa\irate\]
+ self.calc_aggregate_all = ['count(*)' , 'count(q_int)' ,'count(q_bigint)' , 'count(q_smallint)' ,'count(q_tinyint)' ,'count(q_float)' ,
+ 'count(q_double)' ,'count(q_binary)' ,'count(q_nchar)' ,'count(q_bool)' ,'count(q_ts)' ,
+ 'avg(q_int)' ,'avg(q_bigint)' , 'avg(q_smallint)' ,'avg(q_tinyint)' ,'avg(q_float)' ,'avg(q_double)' ,
+ 'sum(q_int)' ,'sum(q_bigint)' , 'sum(q_smallint)' ,'sum(q_tinyint)' ,'sum(q_float)' ,'sum(q_double)' ,
+ 'STDDEV(q_int)' ,'STDDEV(q_bigint)' , 'STDDEV(q_smallint)' ,'STDDEV(q_tinyint)' ,'STDDEV(q_float)' ,'STDDEV(q_double)',
+ 'APERCENTILE(q_int,10)' ,'APERCENTILE(q_bigint,20)' , 'APERCENTILE(q_smallint,30)' ,'APERCENTILE(q_tinyint,40)' ,'APERCENTILE(q_float,50)' ,'APERCENTILE(q_double,60)']
+
+ self.calc_aggregate_regular = ['twa(q_int)' ,'twa(q_bigint)' , 'twa(q_smallint)' ,'twa(q_tinyint)' ,'twa (q_float)' ,'twa(q_double)' ,
+ 'IRATE(q_int)' ,'IRATE(q_bigint)' , 'IRATE(q_smallint)' ,'IRATE(q_tinyint)' ,'IRATE (q_float)' ,'IRATE(q_double)' ,
+ 'LEASTSQUARES(q_int,15,3)' , 'LEASTSQUARES(q_bigint,10,1)' , 'LEASTSQUARES(q_smallint,20,3)' ,'LEASTSQUARES(q_tinyint,10,4)' ,'LEASTSQUARES(q_float,6,4)' ,'LEASTSQUARES(q_double,3,1)' ,
+ 'PERCENTILE(q_int,10)' ,'PERCENTILE(q_bigint,20)' , 'PERCENTILE(q_smallint,30)' ,'PERCENTILE(q_tinyint,40)' ,'PERCENTILE(q_float,50)' ,'PERCENTILE(q_double,60)']
+
+ self.calc_aggregate_groupbytbname = ['twa(q_int)' ,'twa(q_bigint)' , 'twa(q_smallint)' ,'twa(q_tinyint)' ,'twa (q_float)' ,'twa(q_double)' ,
+ 'IRATE(q_int)' ,'IRATE(q_bigint)' , 'IRATE(q_smallint)' ,'IRATE(q_tinyint)' ,'IRATE (q_float)' ,'IRATE(q_double)' ]
+
+ #two table join
+ self.calc_aggregate_all_j = ['count(t1.*)' , 'count(t1.q_int)' ,'count(t1.q_bigint)' , 'count(t1.q_smallint)' ,'count(t1.q_tinyint)' ,'count(t1.q_float)' ,
+ 'count(t1.q_double)' ,'count(t1.q_binary)' ,'count(t1.q_nchar)' ,'count(t1.q_bool)' ,'count(t1.q_ts)' ,
+ 'avg(t1.q_int)' ,'avg(t1.q_bigint)' , 'avg(t1.q_smallint)' ,'avg(t1.q_tinyint)' ,'avg(t1.q_float)' ,'avg(t1.q_double)' ,
+ 'sum(t1.q_int)' ,'sum(t1.q_bigint)' , 'sum(t1.q_smallint)' ,'sum(t1.q_tinyint)' ,'sum(t1.q_float)' ,'sum(t1.q_double)' ,
+ 'STDDEV(t1.q_int)' ,'STDDEV(t1.q_bigint)' , 'STDDEV(t1.q_smallint)' ,'STDDEV(t1.q_tinyint)' ,'STDDEV(t1.q_float)' ,'STDDEV(t1.q_double)',
+ 'APERCENTILE(t1.q_int,10)' ,'APERCENTILE(t1.q_bigint,20)' , 'APERCENTILE(t1.q_smallint,30)' ,'APERCENTILE(t1.q_tinyint,40)' ,'APERCENTILE(t1.q_float,50)' ,'APERCENTILE(t1.q_double,60)' ,
+ 'count(t2.*)' , 'count(t2.q_int)' ,'count(t2.q_bigint)' , 'count(t2.q_smallint)' ,'count(t2.q_tinyint)' ,'count(t2.q_float)' ,
+ 'count(t2.q_double)' ,'count(t2.q_binary)' ,'count(t2.q_nchar)' ,'count(t2.q_bool)' ,'count(t2.q_ts)' ,
+ 'avg(t2.q_int)' ,'avg(t2.q_bigint)' , 'avg(t2.q_smallint)' ,'avg(t2.q_tinyint)' ,'avg(t2.q_float)' ,'avg(t2.q_double)' ,
+ 'sum(t2.q_int)' ,'sum(t2.q_bigint)' , 'sum(t2.q_smallint)' ,'sum(t2.q_tinyint)' ,'sum(t2.q_float)' ,'sum(t2.q_double)' ,
+ 'STDDEV(t2.q_int)' ,'STDDEV(t2.q_bigint)' , 'STDDEV(t2.q_smallint)' ,'STDDEV(t2.q_tinyint)' ,'STDDEV(t2.q_float)' ,'STDDEV(t2.q_double)',
+ 'APERCENTILE(t2.q_int,10)' ,'APERCENTILE(t2.q_bigint,20)' , 'APERCENTILE(t2.q_smallint,30)' ,'APERCENTILE(t2.q_tinyint,40)' ,'APERCENTILE(t2.q_float,50)' ,'APERCENTILE(t2.q_double,60)']
+
+ self.calc_aggregate_regular_j = ['twa(t1.q_int)' ,'twa(t1.q_bigint)' , 'twa(t1.q_smallint)' ,'twa(t1.q_tinyint)' ,'twa (t1.q_float)' ,'twa(t1.q_double)' ,
+ 'IRATE(t1.q_int)' ,'IRATE(t1.q_bigint)' , 'IRATE(t1.q_smallint)' ,'IRATE(t1.q_tinyint)' ,'IRATE (t1.q_float)' ,'IRATE(t1.q_double)' ,
+ 'LEASTSQUARES(t1.q_int,15,3)' , 'LEASTSQUARES(t1.q_bigint,10,1)' , 'LEASTSQUARES(t1.q_smallint,20,3)' ,'LEASTSQUARES(t1.q_tinyint,10,4)' ,'LEASTSQUARES(t1.q_float,6,4)' ,'LEASTSQUARES(t1.q_double,3,1)' ,
+ 'PERCENTILE(t1.q_int,10)' ,'PERCENTILE(t1.q_bigint,20)' , 'PERCENTILE(t1.q_smallint,30)' ,'PERCENTILE(t1.q_tinyint,40)' ,'PERCENTILE(t1.q_float,50)' ,'PERCENTILE(t1.q_double,60)' ,
+ 'twa(t2.q_int)' ,'twa(t2.q_bigint)' , 'twa(t2.q_smallint)' ,'twa(t2.q_tinyint)' ,'twa (t2.q_float)' ,'twa(t2.q_double)' ,
+ 'IRATE(t2.q_int)' ,'IRATE(t2.q_bigint)' , 'IRATE(t2.q_smallint)' ,'IRATE(t2.q_tinyint)' ,'IRATE (t2.q_float)' ,'IRATE(t2.q_double)',
+ 'LEASTSQUARES(t2.q_int,15,3)' , 'LEASTSQUARES(t2.q_bigint,10,1)' , 'LEASTSQUARES(t2.q_smallint,20,3)' ,'LEASTSQUARES(t2.q_tinyint,10,4)' ,'LEASTSQUARES(t2.q_float,6,4)' ,'LEASTSQUARES(t2.q_double,3,1)' ,
+ 'PERCENTILE(t2.q_int,10)' ,'PERCENTILE(t2.q_bigint,20)' , 'PERCENTILE(t2.q_smallint,30)' ,'PERCENTILE(t2.q_tinyint,40)' ,'PERCENTILE(t2.q_float,50)' ,'PERCENTILE(t2.q_double,60)']
+
+ self.calc_aggregate_groupbytbname_j = ['twa(t1.q_int)' ,'twa(t1.q_bigint)' , 'twa(t1.q_smallint)' ,'twa(t1.q_tinyint)' ,'twa (t1.q_float)' ,'twa(t1.q_double)' ,
+ 'IRATE(t1.q_int)' ,'IRATE(t1.q_bigint)' , 'IRATE(t1.q_smallint)' ,'IRATE(t1.q_tinyint)' ,'IRATE (t1.q_float)' ,'IRATE(t1.q_double)' ,
+ 'twa(t2.q_int)' ,'twa(t2.q_bigint)' , 'twa(t2.q_smallint)' ,'twa(t2.q_tinyint)' ,'twa (t2.q_float)' ,'twa(t2.q_double)' ,
+ 'IRATE(t2.q_int)' ,'IRATE(t2.q_bigint)' , 'IRATE(t2.q_smallint)' ,'IRATE(t2.q_tinyint)' ,'IRATE (t2.q_float)' ,'IRATE(t2.q_double)' ]
+
+ # calc_calculate_all calc_calculate_regular calc_calculate_groupbytbname
+ # calculation function include [all:spread\+-*/ ||regualr:diff\derivative ||group by tbname:diff\derivative\]
+ self.calc_calculate_all = ['SPREAD(ts)' , 'SPREAD(q_ts)' , 'SPREAD(q_int)' ,'SPREAD(q_bigint)' , 'SPREAD(q_smallint)' ,'SPREAD(q_tinyint)' ,'SPREAD(q_float)' ,'SPREAD(q_double)' ,
+ '(SPREAD(q_int) + SPREAD(q_bigint))' , '(SPREAD(q_smallint) - SPREAD(q_float))', '(SPREAD(q_double) * SPREAD(q_tinyint))' , '(SPREAD(q_double) / SPREAD(q_float))']
+ self.calc_calculate_regular = ['DIFF(q_int)' ,'DIFF(q_bigint)' , 'DIFF(q_smallint)' ,'DIFF(q_tinyint)' ,'DIFF(q_float)' ,'DIFF(q_double)' ,
+ 'DIFF(q_int,0)' ,'DIFF(q_bigint,0)' , 'DIFF(q_smallint,0)' ,'DIFF(q_tinyint,0)' ,'DIFF(q_float,0)' ,'DIFF(q_double,0)' ,
+ 'DIFF(q_int,1)' ,'DIFF(q_bigint,1)' , 'DIFF(q_smallint,1)' ,'DIFF(q_tinyint,1)' ,'DIFF(q_float,1)' ,'DIFF(q_double,1)' ,
+ 'DERIVATIVE(q_int,15s,0)' , 'DERIVATIVE(q_bigint,10s,1)' , 'DERIVATIVE(q_smallint,20s,0)' ,'DERIVATIVE(q_tinyint,10s,1)' ,'DERIVATIVE(q_float,6s,0)' ,'DERIVATIVE(q_double,3s,1)' ]
+ self.calc_calculate_groupbytbname = self.calc_calculate_regular
+
+ #two table join
+ self.calc_calculate_all_j = ['SPREAD(t1.ts)' , 'SPREAD(t1.q_ts)' , 'SPREAD(t1.q_int)' ,'SPREAD(t1.q_bigint)' , 'SPREAD(t1.q_smallint)' ,'SPREAD(t1.q_tinyint)' ,'SPREAD(t1.q_float)' ,'SPREAD(t1.q_double)' ,
+ 'SPREAD(t2.ts)' , 'SPREAD(t2.q_ts)' , 'SPREAD(t2.q_int)' ,'SPREAD(t2.q_bigint)' , 'SPREAD(t2.q_smallint)' ,'SPREAD(t2.q_tinyint)' ,'SPREAD(t2.q_float)' ,'SPREAD(t2.q_double)' ,
+ '(SPREAD(t1.q_int) + SPREAD(t1.q_bigint))' , '(SPREAD(t1.q_tinyint) - SPREAD(t1.q_float))', '(SPREAD(t1.q_double) * SPREAD(t1.q_tinyint))' , '(SPREAD(t1.q_double) / SPREAD(t1.q_tinyint))',
+ '(SPREAD(t2.q_int) + SPREAD(t2.q_bigint))' , '(SPREAD(t2.q_smallint) - SPREAD(t2.q_float))', '(SPREAD(t2.q_double) * SPREAD(t2.q_tinyint))' , '(SPREAD(t2.q_double) / SPREAD(t2.q_tinyint))',
+ '(SPREAD(t1.q_int) + SPREAD(t1.q_smallint))' , '(SPREAD(t2.q_smallint) - SPREAD(t2.q_float))', '(SPREAD(t1.q_double) * SPREAD(t1.q_tinyint))' , '(SPREAD(t1.q_double) / SPREAD(t1.q_float))']
+ self.calc_calculate_regular_j = ['DIFF(t1.q_int)' ,'DIFF(t1.q_bigint)' , 'DIFF(t1.q_smallint)' ,'DIFF(t1.q_tinyint)' ,'DIFF(t1.q_float)' ,'DIFF(t1.q_double)' ,
+ 'DIFF(t1.q_int,0)' ,'DIFF(t1.q_bigint,0)' , 'DIFF(t1.q_smallint,0)' ,'DIFF(t1.q_tinyint,0)' ,'DIFF(t1.q_float,0)' ,'DIFF(t1.q_double,0)' ,
+ 'DIFF(t1.q_int,1)' ,'DIFF(t1.q_bigint,1)' , 'DIFF(t1.q_smallint,1)' ,'DIFF(t1.q_tinyint,1)' ,'DIFF(t1.q_float,1)' ,'DIFF(t1.q_double,1)' ,
+ 'DERIVATIVE(t1.q_int,15s,0)' , 'DERIVATIVE(t1.q_bigint,10s,1)' , 'DERIVATIVE(t1.q_smallint,20s,0)' ,'DERIVATIVE(t1.q_tinyint,10s,1)' ,'DERIVATIVE(t1.q_float,6s,0)' ,'DERIVATIVE(t1.q_double,3s,1)' ,
+ 'DIFF(t2.q_int)' ,'DIFF(t2.q_bigint)' , 'DIFF(t2.q_smallint)' ,'DIFF(t2.q_tinyint)' ,'DIFF(t2.q_float)' ,'DIFF(t2.q_double)' ,
+ 'DIFF(t2.q_int,0)' ,'DIFF(t2.q_bigint,0)' , 'DIFF(t2.q_smallint,0)' ,'DIFF(t2.q_tinyint,0)' ,'DIFF(t2.q_float,0)' ,'DIFF(t2.q_double,0)' ,
+ 'DIFF(t2.q_int,1)' ,'DIFF(t2.q_bigint,1)' , 'DIFF(t2.q_smallint,1)' ,'DIFF(t2.q_tinyint,1)' ,'DIFF(t2.q_float,1)' ,'DIFF(t2.q_double,1)' ,
+ 'DERIVATIVE(t2.q_int,15s,0)' , 'DERIVATIVE(t2.q_bigint,10s,1)' , 'DERIVATIVE(t2.q_smallint,20s,0)' ,'DERIVATIVE(t2.q_tinyint,10s,1)' ,'DERIVATIVE(t2.q_float,6s,0)' ,'DERIVATIVE(t2.q_double,3s,1)' ]
+ self.calc_calculate_groupbytbname_j = self.calc_calculate_regular_j
+
+ #inter && calc_aggregate_all\calc_aggregate_regular\calc_select_all
+ self.interval_sliding = ['interval(4w) sliding(1w) ','interval(1w) sliding(1d) ','interval(1d) sliding(1h) ' ,
+ 'interval(1h) sliding(1m) ','interval(1m) sliding(1s) ','interval(1s) sliding(10a) ',
+ 'interval(1y) ','interval(1n) ','interval(1w) ','interval(1d) ','interval(1h) ','interval(1m) ','interval(1s) ' ,'interval(10a)',
+ 'interval(1y,1n) ','interval(1n,1w) ','interval(1w,1d) ','interval(1d,1h) ','interval(1h,1m) ','interval(1m,1s) ','interval(1s,10a) ' ,'interval(100a,30a)']
+
+ self.conn1 = taos.connect(host="127.0.0.1", user="root", password="taosdata", config="/etc/taos/")
+ self.cur1 = self.conn1.cursor()
+ print(self.cur1)
+ self.cur1.execute("use %s ;" %self.db_nest)
+ sql = 'select * from stable_1 limit 5;'
+ self.cur1.execute(sql)
+
+
+ def data_matrix_equal(self, sql1,row1_s,row1_e,col1_s,col1_e, sql2,row2_s,row2_e,col2_s,col2_e):
+ # ----row1_start----col1_start----
+ # - - - - 是一个矩阵内的数据相等- - -
+ # - - - - - - - - - - - - - - - -
+ # ----row1_end------col1_end------
+ self.sql1 = sql1
+ list1 =[]
+ tdSql.query(sql1)
+ for i1 in range(row1_s-1,row1_e):
+ #print("iiii=%d"%i1)
+ for j1 in range(col1_s-1,col1_e):
+ #print("jjjj=%d"%j1)
+ #print("data=%s" %(tdSql.getData(i1,j1)))
+ list1.append(tdSql.getData(i1,j1))
+ print("=====list1-------list1---=%s" %set(list1))
+
+ tdSql.execute("reset query cache;")
+ self.sql2 = sql2
+ list2 =[]
+ tdSql.query(sql2)
+ for i2 in range(row2_s-1,row2_e):
+ #print("iiii222=%d"%i2)
+ for j2 in range(col2_s-1,col2_e):
+ #print("jjjj222=%d"%j2)
+ #print("data=%s" %(tdSql.getData(i2,j2)))
+ list2.append(tdSql.getData(i2,j2))
+ print("=====list2-------list2---=%s" %set(list2))
+
+ if (list1 == list2) and len(list2)>0:
+ # print(("=====matrix===sql1.list1:'%s',sql2.list2:'%s'") %(list1,list2))
+ tdLog.info(("===matrix===sql1:'%s' matrix_result = sql2:'%s' matrix_result") %(sql1,sql2))
+ elif (set(list2)).issubset(set(list1)):
+ # 解决不同子表排列结果乱序
+ # print(("=====list_issubset==matrix2in1-true===sql1.list1:'%s',sql2.list2:'%s'") %(list1,list2))
+ tdLog.info(("===matrix_issubset===sql1:'%s' matrix_set_result = sql2:'%s' matrix_set_result") %(sql1,sql2))
+ #elif abs(float(str(list1).replace("]","").replace("[","").replace("e+","")) - float(str(list2).replace("]","").replace("[","").replace("e+",""))) <= 0.0001:
+ elif abs(float(str(list1).replace("datetime.datetime","").replace("]","").replace("[","").replace("e+","").replace(", ","").replace("(","").replace(")","").replace("-","")) - float(str(list2).replace("datetime.datetime","").replace("]","").replace("[","").replace("e+","").replace(", ","").replace("(","").replace(")","").replace("-",""))) <= 0.0001:
+ print(("=====matrix_abs+e+===sql1.list1:'%s',sql2.list2:'%s'") %(list1,list2))
+ print(("=====matrix_abs+e+replace_after===sql1.list1:'%s',sql2.list2:'%s'") %(float(str(list1).replace("datetime.datetime","").replace("]","").replace("[","").replace("e+","").replace(", ","").replace("(","").replace(")","").replace("-","")),float(str(list2).replace("datetime.datetime","").replace("]","").replace("[","").replace("e+","").replace(", ","").replace("(","").replace(")","").replace("-",""))))
+ tdLog.info(("===matrix_abs+e+===sql1:'%s' matrix_result = sql2:'%s' matrix_result") %(sql1,sql2))
+ elif abs(float(str(list1).replace("datetime.datetime","").replace("]","").replace("[","").replace(", ","").replace("(","").replace(")","").replace("-","")) - float(str(list2).replace("datetime.datetime","").replace("]","").replace("[","").replace(", ","").replace("(","").replace(")","").replace("-",""))) <= 0.1:
+ #{datetime.datetime(2021, 8, 27, 1, 46, 40), -441.46841430664057}replace
+ print(("=====matrix_abs+replace===sql1.list1:'%s',sql2.list2:'%s'") %(list1,list2))
+ print(("=====matrix_abs+replace_after===sql1.list1:'%s',sql2.list2:'%s'") %(float(str(list1).replace("datetime.datetime","").replace("]","").replace("[","").replace(", ","").replace("(","").replace(")","").replace("-","")),float(str(list1).replace("datetime.datetime","").replace("]","").replace("[","").replace(", ","").replace("(","").replace(")","").replace("-",""))))
+ tdLog.info(("===matrix_abs+replace===sql1:'%s' matrix_result = sql2:'%s' matrix_result") %(sql1,sql2))
+ elif abs(float(str(list1).replace("datetime.datetime","").replace("]","").replace("[","").replace(", ","").replace("(","").replace(")","").replace("-","")) - float(str(list2).replace("datetime.datetime","").replace("]","").replace("[","").replace(", ","").replace("(","").replace(")","").replace("-",""))) <= 0.5:
+ print(("=====matrix_abs===sql1.list1:'%s',sql2.list2:'%s'") %(list1,list2))
+ print(("=====matrix_abs===sql1.list1:'%s',sql2.list2:'%s'") %(float(str(list1).replace("datetime.datetime","").replace("]","").replace("[","").replace(", ","").replace("(","").replace(")","").replace("-","")),float(str(list2).replace("datetime.datetime","").replace("]","").replace("[","").replace(", ","").replace("(","").replace(")","").replace("-",""))))
+ tdLog.info(("===matrix_abs======sql1:'%s' matrix_result = sql2:'%s' matrix_result") %(sql1,sql2))
+ else:
+ print(("=====matrix_error===sql1.list1:'%s',sql2.list2:'%s'") %(list1,list2))
+ tdLog.info(("sql1:'%s' matrix_result != sql2:'%s' matrix_result") %(sql1,sql2))
+ return tdSql.checkEqual(list1,list2)
+
+ def restartDnodes(self):
+ pass
+ # tdDnodes.stop(1)
+ # tdDnodes.start(1)
+
+ def dropandcreateDB_random(self,database,n):
+ ts = 1630000000000
+ num_random = 100
+ fake = Faker('zh_CN')
+ tdSql.execute('''drop database if exists %s ;''' %database)
+ tdSql.execute('''create database %s keep 36500;'''%database)
+ tdSql.execute('''use %s;'''%database)
+
+ tdSql.execute('''create stable stable_1 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
+ q_binary1 binary(100) , q_nchar1 nchar(100) ,q_binary2 binary(100) , q_nchar2 nchar(100) ,q_binary3 binary(100) , q_nchar3 nchar(100) ,q_binary4 binary(100) , q_nchar4 nchar(100) ,\
+ q_binary5 binary(100) , q_nchar5 nchar(100) ,q_binary6 binary(100) , q_nchar6 nchar(100) ,q_binary7 binary(100) , q_nchar7 nchar(100) ,q_binary8 binary(100) , q_nchar8 nchar(100) ,\
+ q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) \
+ tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);''')
+ tdSql.execute('''create stable stable_2 (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
+ q_binary1 binary(100) , q_nchar1 nchar(100) ,q_binary2 binary(100) , q_nchar2 nchar(100) ,q_binary3 binary(100) , q_nchar3 nchar(100) ,q_binary4 binary(100) , q_nchar4 nchar(100) ,\
+ q_binary5 binary(100) , q_nchar5 nchar(100) ,q_binary6 binary(100) , q_nchar6 nchar(100) ,q_binary7 binary(100) , q_nchar7 nchar(100) ,q_binary8 binary(100) , q_nchar8 nchar(100) ,\
+ q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) \
+ tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);''')
+
+ tdSql.execute('''create stable stable_null_data (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
+ q_binary1 binary(100) , q_nchar1 nchar(100) ,q_binary2 binary(100) , q_nchar2 nchar(100) ,q_binary3 binary(100) , q_nchar3 nchar(100) ,q_binary4 binary(100) , q_nchar4 nchar(100) ,\
+ q_binary5 binary(100) , q_nchar5 nchar(100) ,q_binary6 binary(100) , q_nchar6 nchar(100) ,q_binary7 binary(100) , q_nchar7 nchar(100) ,q_binary8 binary(100) , q_nchar8 nchar(100) ,\
+ q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) \
+ tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);''')
+
+ tdSql.execute('''create stable stable_null_childtable (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
+ q_binary1 binary(100) , q_nchar1 nchar(100) ,q_binary2 binary(100) , q_nchar2 nchar(100) ,q_binary3 binary(100) , q_nchar3 nchar(100) ,q_binary4 binary(100) , q_nchar4 nchar(100) ,\
+ q_binary5 binary(100) , q_nchar5 nchar(100) ,q_binary6 binary(100) , q_nchar6 nchar(100) ,q_binary7 binary(100) , q_nchar7 nchar(100) ,q_binary8 binary(100) , q_nchar8 nchar(100) ,\
+ q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) \
+ tags(loc nchar(100) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint, t_bool bool , t_binary binary(100) , t_nchar nchar(100) ,t_float float , t_double double , t_ts timestamp);''')
+
+ #tdSql.execute('''create table stable_1_1 using stable_1 tags('stable_1_1', '0' , '0' , '0' , '0' , 0 , 'binary1' , 'nchar1' , '0' , '0' ,'0') ;''')
+ tdSql.execute('''create table stable_1_1 using stable_1 tags('stable_1_1', '%d' , '%d', '%d' , '%d' , 0 , 'binary1.%s' , 'nchar1.%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_2 using stable_1 tags('stable_1_2', '2147483647' , '9223372036854775807' , '32767' , '127' , 1 , 'binary2' , 'nchar2' , '2' , '22' , \'1999-09-09 09:09:09.090\') ;''')
+ tdSql.execute('''create table stable_1_3 using stable_1 tags('stable_1_3', '-2147483647' , '-9223372036854775807' , '-32767' , '-127' , false , 'binary3' , 'nchar3nchar3' , '-3.3' , '-33.33' , \'2099-09-09 09:09:09.090\') ;''')
+ #tdSql.execute('''create table stable_1_4 using stable_1 tags('stable_1_4', '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0') ;''')
+ tdSql.execute('''create table stable_1_4 using stable_1 tags('stable_1_4', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%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_2_1 using stable_2 tags('stable_2_1' , '0' , '0' , '0' , '0' , 0 , 'binary21' , 'nchar21' , '0' , '0' ,'0') ;''')
+ # tdSql.execute('''create table stable_2_2 using stable_2 tags('stable_2_2' , '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0') ;''')
+
+ # tdSql.execute('''create table stable_null_data_1 using stable_null_data tags('stable_null_data_1', '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0') ;''')
+
+ tdSql.execute('''create table stable_2_1 using stable_2 tags('stable_2_1' , '0' , '0' , '0' , '0' , 0 , 'binary21' , 'nchar21' , '0' , '0' ,\'2099-09-09 09:09:09.090\') ;''')
+ tdSql.execute('''create table stable_2_2 using stable_2 tags('stable_2_2' , '%d' , '%d', '%d' , '%d' , 0 , 'binary2.%s' , 'nchar2.%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_null_data_1 using stable_null_data tags('stable_null_data_1', '%d' , '%d', '%d' , '%d' , 1 , 'binary1.%s' , 'nchar1.%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)))
+
+ #regular table
+ tdSql.execute('''create table regular_table_1 \
+ (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
+ q_binary1 binary(100) , q_nchar1 nchar(100) ,q_binary2 binary(100) , q_nchar2 nchar(100) ,q_binary3 binary(100) , q_nchar3 nchar(100) ,q_binary4 binary(100) , q_nchar4 nchar(100) ,\
+ q_binary5 binary(100) , q_nchar5 nchar(100) ,q_binary6 binary(100) , q_nchar6 nchar(100) ,q_binary7 binary(100) , q_nchar7 nchar(100) ,q_binary8 binary(100) , q_nchar8 nchar(100) ,\
+ q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;''')
+ tdSql.execute('''create table regular_table_2 \
+ (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
+ q_binary1 binary(100) , q_nchar1 nchar(100) ,q_binary2 binary(100) , q_nchar2 nchar(100) ,q_binary3 binary(100) , q_nchar3 nchar(100) ,q_binary4 binary(100) , q_nchar4 nchar(100) ,\
+ q_binary5 binary(100) , q_nchar5 nchar(100) ,q_binary6 binary(100) , q_nchar6 nchar(100) ,q_binary7 binary(100) , q_nchar7 nchar(100) ,q_binary8 binary(100) , q_nchar8 nchar(100) ,\
+ q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;''')
+ tdSql.execute('''create table regular_table_3 \
+ (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
+ q_binary1 binary(100) , q_nchar1 nchar(100) ,q_binary2 binary(100) , q_nchar2 nchar(100) ,q_binary3 binary(100) , q_nchar3 nchar(100) ,q_binary4 binary(100) , q_nchar4 nchar(100) ,\
+ q_binary5 binary(100) , q_nchar5 nchar(100) ,q_binary6 binary(100) , q_nchar6 nchar(100) ,q_binary7 binary(100) , q_nchar7 nchar(100) ,q_binary8 binary(100) , q_nchar8 nchar(100) ,\
+ q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;''')
+
+ tdSql.execute('''create table regular_table_null \
+ (ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint , q_float float , q_double double , q_bool bool , q_binary binary(100) , q_nchar nchar(100) , q_ts timestamp , \
+ q_binary1 binary(100) , q_nchar1 nchar(100) ,q_binary2 binary(100) , q_nchar2 nchar(100) ,q_binary3 binary(100) , q_nchar3 nchar(100) ,q_binary4 binary(100) , q_nchar4 nchar(100) ,\
+ q_binary5 binary(100) , q_nchar5 nchar(100) ,q_binary6 binary(100) , q_nchar6 nchar(100) ,q_binary7 binary(100) , q_nchar7 nchar(100) ,q_binary8 binary(100) , q_nchar8 nchar(100) ,\
+ q_int_null int , q_bigint_null bigint , q_smallint_null smallint , q_tinyint_null tinyint, q_float_null float , q_double_null double , q_bool_null bool , q_binary_null binary(20) , q_nchar_null nchar(20) , q_ts_null timestamp) ;''')
+
+
+ for i in range(num_random*n):
+ tdSql.execute('''insert into stable_1_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double , q_bool , q_binary , q_nchar, q_ts,\
+ q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8) \
+ values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s', \
+ 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
+ % (ts + i*1000, 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.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , ts + i , fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() ,
+ fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address()))
+ tdSql.execute('''insert into regular_table_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts,\
+ q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8) \
+ values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s', \
+ 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
+ % (ts + i*1000, 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.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , ts + i, fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() ,
+ fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address()))
+
+ tdSql.execute('''insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts,\
+ q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8)\
+ values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s', \
+ 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
+ % (ts + i*1000, fake.random_int(min=0, max=2147483647, step=1),
+ fake.random_int(min=0, max=9223372036854775807, step=1),
+ fake.random_int(min=0, max=32767, step=1) , fake.random_int(min=0, max=127, step=1) ,
+ fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , ts + i, fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() ,
+ fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address()))
+ tdSql.execute('''insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts,\
+ q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8) \
+ values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s', \
+ 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
+ % (ts + i*1000, fake.random_int(min=0, max=2147483647, step=1),
+ fake.random_int(min=0, max=9223372036854775807, step=1),
+ fake.random_int(min=0, max=32767, step=1) , fake.random_int(min=0, max=127, step=1) ,
+ fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , ts + i, fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() ,
+ fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address()))
+
+ tdSql.execute('''insert into stable_1_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts,\
+ q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8) \
+ values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s', \
+ 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
+ % (ts + i*1000 +1, fake.random_int(min=-2147483647, max=0, step=1),
+ fake.random_int(min=-9223372036854775807, max=0, step=1),
+ fake.random_int(min=-32767, max=0, step=1) , fake.random_int(min=-127, max=0, step=1) ,
+ fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , ts + i +1, fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() ,
+ fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address()))
+ tdSql.execute('''insert into regular_table_2 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts,\
+ q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8) \
+ values(%d, %d, %d, %d, %d, %f, %f, 1, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s', \
+ 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
+ % (ts + i*1000 +1, fake.random_int(min=-2147483647, max=0, step=1),
+ fake.random_int(min=-9223372036854775807, max=0, step=1),
+ fake.random_int(min=-32767, max=0, step=1) , fake.random_int(min=-127, max=0, step=1) ,
+ fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , ts + i +1, fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() ,
+ fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address()))
+
+ tdSql.execute('''insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts,\
+ q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8) \
+ values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s', \
+ 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
+ % (ts + i*1000, fake.random_int(min=-0, max=2147483647, step=1),
+ fake.random_int(min=-0, max=9223372036854775807, step=1),
+ fake.random_int(min=-0, max=32767, step=1) , fake.random_int(min=-0, max=127, step=1) ,
+ fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , ts + i, fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() ,
+ fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address()))
+
+ tdSql.execute('''insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts,\
+ q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8) \
+ values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s', \
+ 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
+ % (ts + i*1000 +1, fake.random_int(min=-0, max=2147483647, step=1),
+ fake.random_int(min=-0, max=9223372036854775807, step=1),
+ fake.random_int(min=-0, max=32767, step=1) , fake.random_int(min=-0, max=127, step=1) ,
+ fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , ts + i, fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() ,
+ fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address()))
+
+ tdSql.execute('''insert into stable_2_1 (ts , q_int , q_bigint , q_smallint , q_tinyint , q_float , q_double, q_bool , q_binary , q_nchar, q_ts,\
+ q_binary1 , q_nchar1 , q_binary2 , q_nchar2 , q_binary3 , q_nchar3 , q_binary4 , q_nchar4 , q_binary5 , q_nchar5 , q_binary6 , q_nchar6 , q_binary7 , q_nchar7, q_binary8 , q_nchar8) \
+ values(%d, %d, %d, %d, %d, %f, %f, 0, 'binary.%s', 'nchar.%s', %d, 'binary1.%s', 'nchar1.%s', 'binary2.%s', 'nchar2.%s', 'binary3.%s', 'nchar3.%s', \
+ 'binary4.%s', 'nchar4.%s', 'binary5.%s', 'nchar5.%s', 'binary6.%s', 'nchar6.%s', 'binary7.%s', 'nchar7.%s', 'binary8.%s', 'nchar8.%s') ;'''
+ % (ts + i*1000 +10, fake.random_int(min=-0, max=2147483647, step=1),
+ fake.random_int(min=-0, max=9223372036854775807, step=1),
+ fake.random_int(min=-0, max=32767, step=1) , fake.random_int(min=-0, max=127, step=1) ,
+ fake.pyfloat() , fake.pyfloat() , fake.pystr() , fake.address() , ts + i, fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() ,
+ fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address() , fake.pystr() , fake.address()))
+
+ tdSql.query("select count(*) from stable_1;")
+ tdSql.checkData(0,0,3*num_random*n)
+ tdSql.query("select count(*) from regular_table_1;")
+ tdSql.checkData(0,0,num_random*n)
+
+ def math_nest(self,mathlist):
+
+ print("==========%s===start=============" %mathlist)
+ os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename))
+
+ self.dropandcreateDB_random("%s" %self.db_nest, 1)
+
+ if (mathlist == ['ABS','SQRT']) or (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['FLOOR','CEIL','ROUND']) \
+ or (mathlist == ['CSUM']) or (mathlist == ['']):
+ math_functions = mathlist
+ fun_fix_column = ['(q_bigint)','(q_smallint)','(q_tinyint)','(q_int)','(q_float)','(q_double)','(q_bigint_null)','(q_smallint_null)','(q_tinyint_null)','(q_int_null)','(q_float_null)','(q_double_null)']
+ fun_column_1 = random.sample(math_functions,1)+random.sample(fun_fix_column,1)
+ math_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","")
+ fun_column_2 = random.sample(math_functions,1)+random.sample(fun_fix_column,1)
+ math_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ fun_fix_column_j = ['(t1.q_bigint)','(t1.q_smallint)','(t1.q_tinyint)','(t1.q_int)','(t1.q_float)','(t1.q_double)','(t1.q_bigint_null)','(t1.q_smallint_null)','(t1.q_tinyint_null)','(t1.q_int_null)','(t1.q_float_null)','(t1.q_double_null)',
+ '(t2.q_bigint)','(t2.q_smallint)','(t2.q_tinyint)','(t2.q_int)','(t2.q_float)','(t2.q_double)','(t2.q_bigint_null)','(t2.q_smallint_null)','(t2.q_tinyint_null)','(t2.q_int_null)','(t2.q_float_null)','(t2.q_double_null)']
+ fun_column_join_1 = random.sample(math_functions,1)+random.sample(fun_fix_column_j,1)
+ math_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","")
+ fun_column_join_2 = random.sample(math_functions,1)+random.sample(fun_fix_column_j,1)
+ math_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ elif (mathlist == ['UNIQUE']) or (mathlist == ['HYPERLOGLOG']):
+ math_functions = mathlist
+ fun_fix_column = ['(q_bigint)','(q_smallint)','(q_tinyint)','(q_int)','(q_float)','(q_double)','(q_binary)','(q_nchar)','(q_bool)','(q_ts)',
+ '(q_bigint_null)','(q_smallint_null)','(q_tinyint_null)','(q_int_null)','(q_float_null)','(q_double_null)','(q_binary_null)','(q_nchar_null)','(q_bool_null)','(q_ts_null)']
+ fun_column_1 = random.sample(math_functions,1)+random.sample(fun_fix_column,1)
+ math_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","")
+ fun_column_2 = random.sample(math_functions,1)+random.sample(fun_fix_column,1)
+ math_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ fun_fix_column_j = ['(t1.q_bigint)','(t1.q_smallint)','(t1.q_tinyint)','(t1.q_int)','(t1.q_float)','(t1.q_double)','(t1.q_bigint_null)','(t1.q_smallint_null)','(t1.q_tinyint_null)','(t1.q_int_null)','(t1.q_float_null)','(t1.q_double_null)',
+ '(t2.q_bigint)','(t2.q_smallint)','(t2.q_tinyint)','(t2.q_int)','(t2.q_float)','(t2.q_double)','(t2.q_bigint_null)','(t2.q_smallint_null)','(t2.q_tinyint_null)','(t2.q_int_null)','(t2.q_float_null)','(t2.q_double_null)']
+ fun_column_join_1 = random.sample(math_functions,1)+random.sample(fun_fix_column_j,1)
+ math_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","")
+ fun_column_join_2 = random.sample(math_functions,1)+random.sample(fun_fix_column_j,1)
+ math_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ elif (mathlist == ['POW','LOG']) or (mathlist == ['MAVG']) or (mathlist == ['SAMPLE']) or (mathlist == ['TAIL']):
+ math_functions = mathlist
+ num = random.randint(0, 1000)
+ fun_fix_column = ['(q_bigint,num)','(q_smallint,num)','(q_tinyint,num)','(q_int,num)','(q_float,num)','(q_double,num)',
+ '(q_bigint_null,num)','(q_smallint_null,num)','(q_tinyint_null,num)','(q_int_null,num)','(q_float_null,num)','(q_double_null,num)']
+ fun_column_1 = random.sample(math_functions,1)+random.sample(fun_fix_column,1)
+ math_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",str(num))
+ fun_column_2 = random.sample(math_functions,1)+random.sample(fun_fix_column,1)
+ math_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",str(num))
+
+ fun_fix_column_j = ['(t1.q_bigint,num)','(t1.q_smallint,num)','(t1.q_tinyint,num)','(t1.q_int,num)','(t1.q_float,num)','(t1.q_double,num)',
+ '(t1.q_bigint_null,num)','(t1.q_smallint_null,num)','(t1.q_tinyint_null,num)','(t1.q_int_null,num)','(t1.q_float_null,num)','(t1.q_double_null,num)',
+ '(t2.q_bigint,num)','(t2.q_smallint,num)','(t2.q_tinyint,num)','(t2.q_int,num)','(t2.q_float,num)','(t2.q_double,num)',
+ '(t2.q_bigint_null,num)','(t2.q_smallint_null,num)','(t2.q_tinyint_null,num)','(t2.q_int_null,num)','(t2.q_float_null,num)','(t2.q_double_null,num)']
+ fun_column_join_1 = random.sample(math_functions,1)+random.sample(fun_fix_column_j,1)
+ math_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",str(num))
+ fun_column_join_2 = random.sample(math_functions,1)+random.sample(fun_fix_column_j,1)
+ math_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",str(num))
+
+ tdSql.query("select 1-1 as math_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \
+ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) :
+ sql = "select ts , floor(asct1) from ( select "
+ sql += "%s as asct1, " % math_fun_1
+ sql += "%s as asct2, " % math_fun_2
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(100)
+ self.cur1.execute(sql)
+ elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) \
+ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']):
+ sql = "select floor(asct1) from ( select "
+ sql += "%s as asct1 " % math_fun_1
+ # sql += "%s as asct2, " % math_fun_2
+ # sql += "%s, " % random.choice(self.s_s_select)
+ # sql += "%s, " % random.choice(self.q_select)
+ sql += " from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ #sql += "%s " % random.choice(self.order_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ #tdSql.checkRows(100)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 1-2 as math_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \
+ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) :
+ sql = "select ts , abs(asct1) from ( select "
+ sql += "%s as asct1, " % math_fun_1
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s )" % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.unionall_or_union)
+ sql += "select ts , asct2 from ( select "
+ sql += "%s as asct2, " % math_fun_2
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ #sql += "%s " % random.choice(having_support)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15437 tdSql.query(sql)
+ #TD-15437 self.cur1.execute(sql)
+ elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) \
+ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']):
+ sql = "select abs(asct1) from ( select "
+ sql += "%s as asct1 " % math_fun_1
+ # sql += "%s, " % random.choice(self.s_s_select)
+ # sql += "%s, " % random.choice(self.q_select)
+ sql += "from regular_table_1 where "
+ sql += "%s )" % random.choice(self.q_where)
+ #sql += "%s )" % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.unionall_or_union)
+ sql += "select floor(asct2) from ( select "
+ sql += "%s as asct2 " % math_fun_2
+ # sql += "%s, " % random.choice(self.s_s_select)
+ # sql += "%s, " % random.choice(self.q_select)
+ sql += " from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ #sql += "%s " % random.choice(having_support)
+ #sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15473 tdSql.query(sql)
+ #TD-15473 self.cur1.execute(sql)
+
+ tdSql.query("select 1-3 as math_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \
+ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) :
+ sql = "select ts , min(asct1) from ( select "
+ sql += "%s as asct1, ts ," % math_fun_1
+ sql += "%s as asct2, " % math_fun_2
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s select " % random.choice(self.unionall_or_union)
+ sql += "%s as asct2, ts ," % math_fun_2
+ sql += "%s as asct1, " % math_fun_1
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15473 tdSql.query(sql)
+ #self.cur1.execute(sql)
+ elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) \
+ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']):
+ sql = "select ts , min(asct1) from ( select "
+ sql += "%s as asct1, ts ," % math_fun_1
+ sql += "%s as asct2, " % math_fun_2
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s select " % random.choice(self.unionall_or_union)
+ sql += "%s as asct2, ts ," % math_fun_2
+ sql += "%s as asct1, " % math_fun_1
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15473 tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 1-4 as math_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \
+ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) :
+ sql = "select ts , asct1 from ( select t1.ts as ts,"
+ sql += "%s, " % math_fun_join_1
+ sql += "%s as asct1, " % math_fun_join_2
+ sql += "%s, " % math_fun_join_1
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "and %s " % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(100)
+ self.cur1.execute(sql)
+ elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM'])\
+ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']):
+ sql = "select count(asct1) from ( select "
+ sql += "%s as asct1 " % math_fun_join_2
+ sql += "from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "and %s " % random.choice(self.q_u_or_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 1-5 as math_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \
+ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) :
+ sql = "select ts ,"
+ sql += "%s, " % math_fun_1
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s " % math_fun_2
+ sql += " from ( select * from regular_table_1 ) where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += " ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(100)
+ self.cur1.execute(sql)
+ elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM'])\
+ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']):
+ sql = "select "
+ # sql += "%s, " % math_fun_1
+ # sql += "%s, " % random.choice(self.q_select)
+ # sql += "%s, " % random.choice(self.q_select)
+ sql += "%s " % math_fun_2
+ sql += " from ( select * from regular_table_1 ) where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += " ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15973 tdSql.query(sql)
+ #TD-15973 self.cur1.execute(sql)
+
+ tdSql.query("select 1-6 as math_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \
+ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) :
+ sql = "select ts , max(asct1) from ( select t1.ts as ts,"
+ sql += "%s, " % math_fun_join_1
+ sql += "%s as asct1, " % math_fun_join_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "%s, " % math_fun_join_1
+ sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "and %s )" % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+ elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) \
+ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']):
+ sql = "select max(asct1) from ( select "
+ #sql += "%s, " % math_fun_join_1
+ sql += "%s as asct1 " % math_fun_join_2
+ # sql += "t1.%s, " % random.choice(self.q_select)
+ # sql += "t2.%s, " % random.choice(self.q_select)
+ # sql += "%s, " % math_fun_join_1
+ sql += "from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "and %s )" % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 1-7 as math_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \
+ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) :
+ sql = "select ts , abs(asct1) from ( select "
+ sql += "%s as asct1, ts ," % math_fun_1
+ sql += "%s as asct2, " % math_fun_2
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.t_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # tdSql.checkRows(300)
+ # self.cur1.execute(sql)# TD-16039
+ elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE']) or (mathlist == ['TAIL']) or (mathlist == ['CSUM'])\
+ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']):
+ sql = "select abs(asct1) from ( select "
+ sql += "%s as asct1 " % math_fun_1
+ sql += "from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql)# TD-16039
+
+ tdSql.query("select 1-8 as math_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \
+ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) :
+ sql = "select ts,floor(asct1) "
+ sql += "from ( select "
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s as asct1, ts ," % math_fun_1
+ sql += "%s as asct2, " % math_fun_2
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.t_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #tdSql.query(sql)
+ # tdSql.checkRows(300)
+ # self.cur1.execute(sql)# TD-16039
+ elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM'])\
+ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']):
+ sql = "select floor(asct1) "
+ sql += "from ( select "
+ sql += "%s as asct1 " % math_fun_1
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql)# TD-16039
+
+ tdSql.query("select 1-9 as math_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \
+ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) :
+ sql = "select ts , max(asct1) from ( select t1.ts as ts,"
+ sql += "%s, " % math_fun_join_1
+ sql += "%s as asct1, " % math_fun_join_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += "and %s " % random.choice(self.t_u_where)
+ sql += "and %s " % random.choice(self.t_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql)# TD-16039
+ elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM'])\
+ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']):
+ sql = "select max(asct1) from ( select "
+ sql += "%s as asct1 " % math_fun_join_2
+ # sql += "t1.%s, " % random.choice(self.q_select)
+ # sql += "t1.%s, " % random.choice(self.q_select)
+ # sql += "t2.%s, " % random.choice(self.q_select)
+ # sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += "and %s " % random.choice(self.t_u_where)
+ sql += "and %s " % random.choice(self.t_u_or_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)# TD-16039
+ # self.cur1.execute(sql)
+
+ self.restartDnodes()
+ tdSql.query("select 1-10 as math_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \
+ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) :
+ sql = "select ts , min(asct1) from ( select "
+ sql += "%s as asct1, ts ," % math_fun_1
+ sql += "%s as asct2, " % math_fun_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") %s " % random.choice(self.unionall_or_union)
+ sql += "select ts , max(asct2) from ( select "
+ sql += "%s as asct1, ts ," % math_fun_1
+ sql += "%s as asct2, " % math_fun_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15437 tdSql.query(sql)
+ #TD-15437 self.cur1.execute(sql)
+ elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) \
+ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']):
+ sql = "select min(asct1) from ( select "
+ sql += "%s as asct1 " % math_fun_1
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += ") %s " % random.choice(self.unionall_or_union)
+ sql += "select max(asct2) from ( select "
+ sql += "%s as asct2 " % math_fun_2
+ sql += "from stable_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15437 tdSql.query(sql)
+ #TD-15437 self.cur1.execute(sql)
+
+ #3 inter union not support
+ tdSql.query("select 1-11 as math_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \
+ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) :
+ sql = "select ts , min(asct1), max(asct2) from ( select "
+ sql += "%s as asct1, ts ," % math_fun_1
+ sql += "%s as asct2, " % math_fun_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ #sql += "%s " % random.choice(limit1_where)
+ sql += " %s " % random.choice(self.unionall_or_union)
+ sql += " select "
+ sql += "%s as asct1, ts ," % math_fun_1
+ sql += "%s as asct2, " % math_fun_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15837 tdSql.query(sql)
+ # self.cur1.execute(sql)
+ elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) \
+ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']):
+ sql = "select min(asct1) from ( select "
+ sql += "%s as asct1 " % math_fun_1
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += " %s " % random.choice(self.unionall_or_union)
+ sql += " select "
+ sql += "%s as asct2 " % math_fun_2
+ sql += " from stable_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15837 tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 1-12 as math_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \
+ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) :
+ sql = "select ts , max(asct1) from ( select t1.ts as ts,"
+ sql += "%s, " % math_fun_join_1
+ sql += "%s as asct1, " % math_fun_join_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_u_where)
+ sql += "and %s " % random.choice(self.t_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql)# TD-16039
+ elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM'])\
+ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']):
+ sql = "select max(asct1) from ( select "
+ sql += "%s as asct1 " % math_fun_join_2
+ sql += " from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_u_where)
+ sql += "and %s " % random.choice(self.t_u_or_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql)# TD-16039
+
+ tdSql.query("select 1-13 as math_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \
+ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) :
+ sql = "select ts ,"
+ sql += "%s, " % math_fun_1
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s " % math_fun_2
+ sql += "%s " % random.choice(self.t_select)
+ sql += " from ( select * from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # tdSql.checkRows(300)
+ # self.cur1.execute(sql) # TD-16039
+ elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) \
+ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']):
+ sql = "select "
+ sql += "%s " % math_fun_2
+ sql += "%s " % random.choice(self.t_select)
+ sql += " from ( select * from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD15973 tdSql.query(sql)
+ #TD15973 self.cur1.execute(sql)
+
+ tdSql.query("select 1-14 as math_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \
+ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) :
+ sql = "select avg(asct1),count(asct2) from ( select "
+ sql += "%s as asct1, " % math_fun_1
+ sql += "%s as asct2" % math_fun_2
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.partiton_where)
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] )
+ sql += " ) ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql) # TD-16039
+ elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM'])\
+ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']):
+ sql = "select avg(asct1) from ( select "
+ sql += "%s as asct1 " % math_fun_1
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.partiton_where)
+ sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] )
+ sql += " ) ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql) # TD-16039
+
+ tdSql.query("select 1-15 as math_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (mathlist == ['SIN','COS','TAN','ASIN','ACOS','ATAN']) or (mathlist == ['ABS','SQRT']) \
+ or (mathlist == ['POW','LOG']) or (mathlist == ['FLOOR','CEIL','ROUND']) :
+ sql = "select ts , max(asct1) from ( select t1.ts as ts,"
+ sql += "%s, " % math_fun_join_1
+ sql += "%s as asct1, " % math_fun_join_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.%s " % random.choice(self.q_select)
+ sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += " and %s " % random.choice(self.qt_u_or_where)
+ sql += "%s " % random.choice(self.partiton_where_j)
+ sql += "%s " % random.choice(self.slimit1_where)
+ sql += ") "
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s ;" % random.choice(self.limit_u_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql) # TD-16039
+ elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE']) or (mathlist == ['TAIL']) or (mathlist == ['CSUM'])\
+ or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']):
+ sql = "select max(asct1) from ( select "
+ sql += "%s as asct1 " % math_fun_join_2
+ sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += " and %s " % random.choice(self.qt_u_or_where)
+ sql += "%s " % random.choice(self.partiton_where_j)
+ sql += "%s " % random.choice(self.slimit1_where)
+ sql += ") "
+ sql += "%s ;" % random.choice(self.limit_u_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql) # TD-16039
+
+ #taos -f sql
+ startTime_taos_f = time.time()
+ print("taos -f %s sql start!" %mathlist)
+ taos_cmd1 = "taos -f %s/%s.sql" % (self.testcasePath,self.testcaseFilename)
+ _ = subprocess.check_output(taos_cmd1, shell=True).decode("utf-8")
+ print("taos -f %s sql over!" %mathlist)
+ endTime_taos_f = time.time()
+ print("taos_f total time %ds" % (endTime_taos_f - startTime_taos_f))
+
+ print("=========%s====over=============" %mathlist)
+
+
+ def str_nest(self,strlist):
+
+ print("==========%s===start=============" %strlist)
+ os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename))
+
+ self.dropandcreateDB_random("%s" %self.db_nest, 1)
+
+ if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['LENGTH','CHAR_LENGTH']) \
+ or (strlist == ['']):
+ str_functions = strlist
+ fun_fix_column = ['(q_nchar)','(q_binary)','(q_nchar_null)','(q_binary_null)']
+ fun_column_1 = random.sample(str_functions,1)+random.sample(fun_fix_column,1)
+ str_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","")
+ fun_column_2 = random.sample(str_functions,1)+random.sample(fun_fix_column,1)
+ str_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ fun_fix_column_j = ['(t1.q_nchar)','(t1.q_binary)','(t1.q_nchar_null)','(t1.q_binary_null)',
+ '(t2.q_nchar)','(t2.q_binary)','(t2.q_nchar_null)','(t2.q_binary_null)']
+ fun_column_join_1 = random.sample(str_functions,1)+random.sample(fun_fix_column_j,1)
+ str_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","")
+ fun_column_join_2 = random.sample(str_functions,1)+random.sample(fun_fix_column_j,1)
+ str_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ fun_fix_column_s = ['(q_nchar)','(q_binary)','(q_nchar_null)','(q_binary_null)','(loc)','(tbname)']
+ fun_column_s_1 = random.sample(str_functions,1)+random.sample(fun_fix_column_s,1)
+ str_fun_s_1 = str(fun_column_s_1).replace("[","").replace("]","").replace("'","").replace(", ","")
+ fun_column_s_2 = random.sample(str_functions,1)+random.sample(fun_fix_column_s,1)
+ str_fun_s_2 = str(fun_column_s_2).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ fun_fix_column_s_j = ['(t1.q_nchar)','(t1.q_binary)','(t1.q_nchar_null)','(t1.q_binary_null)','(t1.loc)','(t1.tbname)',
+ '(t2.q_nchar)','(t2.q_binary)','(t2.q_nchar_null)','(t2.q_binary_null)','(t2.loc)','(t2.tbname)']
+ fun_column_join_s_1 = random.sample(str_functions,1)+random.sample(fun_fix_column_j,1)
+ str_fun_join_s_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","")
+ fun_column_join_s_2 = random.sample(str_functions,1)+random.sample(fun_fix_column_j,1)
+ str_fun_join_s_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ elif (strlist == ['SUBSTR']) :
+ str_functions = strlist
+ pos = random.randint(1, 20)
+ sub_len = random.randint(1, 10)
+ fun_fix_column = ['(q_nchar,pos)','(q_binary,pos)','(q_nchar_null,pos)','(q_binary_null,pos)',
+ '(q_nchar,pos,sub_len)','(q_binary,pos,sub_len)','(q_nchar_null,pos,sub_len)','(q_binary_null,pos,sub_len)',]
+ fun_column_1 = random.sample(str_functions,1)+random.sample(fun_fix_column,1)
+ str_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len))
+ fun_column_2 = random.sample(str_functions,1)+random.sample(fun_fix_column,1)
+ str_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len))
+
+ fun_fix_column_j = ['(t1.q_nchar,pos)','(t1.q_binary,pos)','(t1.q_nchar_null,pos)','(t1.q_binary_null,pos)',
+ '(t1.q_nchar,pos,sub_len)','(t1.q_binary,pos,sub_len)','(t1.q_nchar_null,pos,sub_len)','(t1.q_binary_null,pos,sub_len)',
+ '(t2.q_nchar,pos)','(t2.q_binary,pos)','(t2.q_nchar_null,pos)','(t2.q_binary_null,pos)',
+ '(t2.q_nchar,pos,sub_len)','(t2.q_binary,pos,sub_len)','(t2.q_nchar_null,pos,sub_len)','(t2.q_binary_null,pos,sub_len)']
+ fun_column_join_1 = random.sample(str_functions,1)+random.sample(fun_fix_column_j,1)
+ str_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len))
+ fun_column_join_2 = random.sample(str_functions,1)+random.sample(fun_fix_column_j,1)
+ str_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len))
+
+ fun_fix_column_s = ['(q_nchar,pos)','(q_binary,pos)','(q_nchar_null,pos)','(q_binary_null,pos)','(loc,pos)',
+ '(q_nchar,pos,sub_len)','(q_binary,pos,sub_len)','(q_nchar_null,pos,sub_len)','(q_binary_null,pos,sub_len)','(loc,pos,sub_len)',]
+ fun_column_s_1 = random.sample(str_functions,1)+random.sample(fun_fix_column_s,1)
+ str_fun_s_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len))
+ fun_column_s_2 = random.sample(str_functions,1)+random.sample(fun_fix_column_s,1)
+ str_fun_s_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len))
+
+ fun_fix_column_s_j = ['(t1.q_nchar,pos)','(t1.q_binary,pos)','(t1.q_nchar_null,pos)','(t1.q_binary_null,pos)','(t1.loc,pos)',
+ '(t1.q_nchar,pos,sub_len)','(t1.q_binary,pos,sub_len)','(t1.q_nchar_null,pos,sub_len)','(t1.q_binary_null,pos,sub_len)','(t1.loc,pos,sub_len)',
+ '(t2.q_nchar,pos)','(t2.q_binary,pos)','(t2.q_nchar_null,pos)','(t2.q_binary_null,pos)','(t2.loc,pos)',
+ '(t2.q_nchar,pos,sub_len)','(t2.q_binary,pos,sub_len)','(t2.q_nchar_null,pos,sub_len)','(t2.q_binary_null,pos,sub_len)','(t2.loc,pos,sub_len)']
+ fun_column_join_s_1 = random.sample(str_functions,1)+random.sample(fun_fix_column_s_j,1)
+ str_fun_join_s_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len))
+ fun_column_join_s_2 = random.sample(str_functions,1)+random.sample(fun_fix_column_s_j,1)
+ str_fun_join_s_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("pos",str(pos)).replace("sub_len",str(sub_len))
+
+ elif (strlist == ['CONCAT']) :
+ str_functions = strlist
+ i = random.randint(2,8)
+ fun_fix_column = ['q_nchar','q_nchar1','q_nchar2','q_nchar3','q_nchar4','q_nchar5','q_nchar6','q_nchar7','q_nchar8','q_nchar_null',
+ 'q_binary','q_binary1','q_binary2','q_binary3','q_binary4','q_binary5','q_binary6','q_binary7','q_binary8','q_binary_null']
+
+ column1 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","")
+ fun_column_1 = str(random.sample(str_functions,1))+'('+column1+')'
+ str_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","")
+
+ column2 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","")
+ fun_column_2 = str(random.sample(str_functions,1))+'('+column2+')'
+ str_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","")
+
+ fun_fix_column_j = ['(t1.q_nchar)','(t1.q_nchar1)','(t1.q_nchar2)','(t1.q_nchar3)','(t1.q_nchar4)','(t1.q_nchar5)','(t1.q_nchar6)','(t1.q_nchar7)','(t1.q_nchar8)','(t1.q_nchar_null)',
+ '(t2.q_nchar)','(t2.q_nchar1)','(t2.q_nchar2)','(t2.q_nchar3)','(t2.q_nchar4)','(t2.q_nchar5)','(t2.q_nchar6)','(t2.q_nchar7)','(t2.q_nchar8)','(t2.q_nchar_null)',
+ '(t1.q_binary)','(t1.q_binary1)','(t1.q_binary2)','(t1.q_binary3)','(t1.q_binary4)','(t1.q_binary5)','(t1.q_binary6)','(t1.q_binary7)','(t1.q_binary8)','(t1.q_binary_null)',
+ '(t2.q_binary)','(t2.q_binary1)','(t2.q_binary2)','(t2.q_binary3)','(t2.q_binary4)','(t2.q_binary5)','(t2.q_binary6)','(t2.q_binary7)','(t2.q_binary8)','(t2.q_binary_null)']
+
+ column_j1 = str(random.sample(fun_fix_column_j,i)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_1 = str(random.sample(str_functions,1))+'('+column_j1+')'
+ str_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","")
+
+ column_j2 = str(random.sample(fun_fix_column_j,i)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_2 = str(random.sample(str_functions,1))+'('+column_j2+')'
+ str_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","")
+
+ fun_fix_column_s = ['q_nchar','q_nchar1','q_nchar2','q_nchar3','q_nchar4','q_nchar5','q_nchar6','q_nchar7','q_nchar8','loc','q_nchar_null',
+ 'q_binary','q_binary1','q_binary2','q_binary3','q_binary4','q_binary5','q_binary6','q_binary7','q_binary8','q_binary_null']
+
+ column_s1 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","")
+ fun_column_s_1 = str(random.sample(str_functions,1))+'('+column_s1+')'
+ str_fun_s_1 = str(fun_column_s_1).replace("[","").replace("]","").replace("'","")
+
+ column_s2 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","")
+ fun_column_s_2 = str(random.sample(str_functions,1))+'('+column_s2+')'
+ str_fun_s_2 = str(fun_column_s_2).replace("[","").replace("]","").replace("'","")
+
+ fun_fix_column_s_j = ['(t1.q_nchar)','(t1.q_nchar1)','(t1.q_nchar2)','(t1.q_nchar3)','(t1.q_nchar4)','(t1.q_nchar5)','(t1.q_nchar6)','(t1.q_nchar7)','(t1.q_nchar8)','(t1.q_nchar_null)','(t1.loc)',
+ '(t2.q_nchar)','(t2.q_nchar1)','(t2.q_nchar2)','(t2.q_nchar3)','(t2.q_nchar4)','(t2.q_nchar5)','(t2.q_nchar6)','(t2.q_nchar7)','(t2.q_nchar8)','(t2.q_nchar_null)','(t2.loc)',
+ '(t1.q_binary)','(t1.q_binary1)','(t1.q_binary2)','(t1.q_binary3)','(t1.q_binary4)','(t1.q_binary5)','(t1.q_binary6)','(t1.q_binary7)','(t1.q_binary8)','(t1.q_binary_null)',
+ '(t2.q_binary)','(t2.q_binary1)','(t2.q_binary2)','(t2.q_binary3)','(t2.q_binary4)','(t2.q_binary5)','(t2.q_binary6)','(t2.q_binary7)','(t2.q_binary8)','(t2.q_binary_null)']
+
+ column_j_s1 = str(random.sample(fun_fix_column_s_j,i)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_s_1 = str(random.sample(str_functions,1))+'('+column_j_s1+')'
+ str_fun_join_s_1 = str(fun_column_join_s_1).replace("[","").replace("]","").replace("'","")
+
+ column_j_s2 = str(random.sample(fun_fix_column_s_j,i)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_s_2 = str(random.sample(str_functions,1))+'('+column_j_s2+')'
+ str_fun_join_s_2 = str(fun_column_join_s_2).replace("[","").replace("]","").replace("'","")
+
+ elif (strlist == ['CONCAT_WS']):
+ str_functions = strlist
+ i = random.randint(2,8)
+ fun_fix_column = ['q_nchar','q_nchar1','q_nchar2','q_nchar3','q_nchar4','q_nchar5','q_nchar6','q_nchar7','q_nchar8','q_nchar_null',
+ 'q_binary','q_binary1','q_binary2','q_binary3','q_binary4','q_binary5','q_binary6','q_binary7','q_binary8','q_binary_null']
+
+ separators = ['',' ','abc','123','!','@','#','$','%','^','&','*','(',')','-','_','+','=','{',
+ '[','}',']','|',';',':',',','.','<','>','?','/','~','`','taos','涛思']
+ separator = str(random.sample(separators,i)).replace("[","").replace("]","")
+
+ column1 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","")
+ fun_column_1 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column1+')'
+ str_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","")
+
+ column2 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","")
+ fun_column_2 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column2+')'
+ str_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","")
+
+ fun_fix_column_j = ['(t1.q_nchar)','(t1.q_nchar1)','(t1.q_nchar2)','(t1.q_nchar3)','(t1.q_nchar4)','(t1.q_nchar5)','(t1.q_nchar6)','(t1.q_nchar7)','(t1.q_nchar8)','(t1.q_nchar_null)',
+ '(t2.q_nchar)','(t2.q_nchar1)','(t2.q_nchar2)','(t2.q_nchar3)','(t2.q_nchar4)','(t2.q_nchar5)','(t2.q_nchar6)','(t2.q_nchar7)','(t2.q_nchar8)','(t2.q_nchar_null)',
+ '(t1.q_binary)','(t1.q_binary1)','(t1.q_binary2)','(t1.q_binary3)','(t1.q_binary4)','(t1.q_binary5)','(t1.q_binary6)','(t1.q_binary7)','(t1.q_binary8)','(t1.q_binary_null)',
+ '(t2.q_binary)','(t2.q_binary1)','(t2.q_binary2)','(t2.q_binary3)','(t2.q_binary4)','(t2.q_binary5)','(t2.q_binary6)','(t2.q_binary7)','(t2.q_binary8)','(t2.q_binary_null)']
+
+ column_j1 = str(random.sample(fun_fix_column_j,i)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_1 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column_j1+')'
+ str_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","")
+
+ column_j2 = str(random.sample(fun_fix_column_j,i)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_2 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column_j2+')'
+ str_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","")
+
+ fun_fix_column_s = ['q_nchar','q_nchar1','q_nchar2','q_nchar3','q_nchar4','q_nchar5','q_nchar6','q_nchar7','q_nchar8','loc','q_nchar_null',
+ 'q_binary','q_binary1','q_binary2','q_binary3','q_binary4','q_binary5','q_binary6','q_binary7','q_binary8','q_binary_null']
+
+ column_s1 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","")
+ fun_column_s_1 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column_s1+')'
+ str_fun_s_1 = str(fun_column_s_1).replace("[","").replace("]","").replace("'","")
+
+ column_s2 = str(random.sample(fun_fix_column,i)).replace("[","").replace("]","").replace("'","")
+ fun_column_s_2 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column_s2+')'
+ str_fun_s_2 = str(fun_column_s_2).replace("[","").replace("]","").replace("'","")
+
+ fun_fix_column_s_j = ['(t1.q_nchar)','(t1.q_nchar1)','(t1.q_nchar2)','(t1.q_nchar3)','(t1.q_nchar4)','(t1.q_nchar5)','(t1.q_nchar6)','(t1.q_nchar7)','(t1.q_nchar8)','(t1.q_nchar_null)','(t1.loc)',
+ '(t2.q_nchar)','(t2.q_nchar1)','(t2.q_nchar2)','(t2.q_nchar3)','(t2.q_nchar4)','(t2.q_nchar5)','(t2.q_nchar6)','(t2.q_nchar7)','(t2.q_nchar8)','(t2.q_nchar_null)','(t2.loc)',
+ '(t1.q_binary)','(t1.q_binary1)','(t1.q_binary2)','(t1.q_binary3)','(t1.q_binary4)','(t1.q_binary5)','(t1.q_binary6)','(t1.q_binary7)','(t1.q_binary8)','(t1.q_binary_null)',
+ '(t2.q_binary)','(t2.q_binary1)','(t2.q_binary2)','(t2.q_binary3)','(t2.q_binary4)','(t2.q_binary5)','(t2.q_binary6)','(t2.q_binary7)','(t2.q_binary8)','(t2.q_binary_null)']
+
+ column_j_s1 = str(random.sample(fun_fix_column_s_j,i)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_s_1 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column_j_s1+')'
+ str_fun_join_s_1 = str(fun_column_join_s_1).replace("[","").replace("]","").replace("'","")
+
+ column_j_s2 = str(random.sample(fun_fix_column_s_j,i)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_s_2 = str(random.sample(str_functions,1))+'('+'\"'+separator+'\",'+column_j_s2+')'
+ str_fun_join_s_2 = str(fun_column_join_s_2).replace("[","").replace("]","").replace("'","")
+
+
+ tdSql.query("select 1-1 as str_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']) :
+ sql = "select ts , LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select "
+ sql += "%s as asct1, " % str_fun_1
+ sql += "%s as asct2, " % str_fun_2
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(100)
+ self.cur1.execute(sql)
+ elif (strlist == ['LENGTH','CHAR_LENGTH']):
+ sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select "
+ sql += "%s as asct1, " % str_fun_1
+ sql += "%s as asct2, " % str_fun_2
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 1-2 as str_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']) :
+ sql = "select ts , LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select "
+ sql += "%s as asct1, " % str_fun_1
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s )" % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.unionall_or_union)
+ sql += "select ts , asct2 from ( select "
+ sql += "%s as asct2, " % str_fun_2
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ #sql += "%s " % random.choice(having_support)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15437 tdSql.query(sql)
+ #TD-15437 self.cur1.execute(sql)
+ elif (strlist == ['LENGTH','CHAR_LENGTH']):
+ sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select "
+ sql += "%s as asct1, " % str_fun_1
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s )" % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.unionall_or_union)
+ sql += "select ts , asct2 from ( select "
+ sql += "%s as asct2, " % str_fun_2
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ #sql += "%s " % random.choice(having_support)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15437 tdSql.query(sql)
+ #TD-15437 self.cur1.execute(sql)
+
+ tdSql.query("select 1-3 as str_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']):
+ sql = "select ts , LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select "
+ sql += "%s as asct1, ts ," % str_fun_1
+ sql += "%s as asct2, " % str_fun_2
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s select " % random.choice(self.unionall_or_union)
+ sql += "%s as asct2, ts ," % str_fun_2
+ sql += "%s as asct1, " % str_fun_1
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15473 tdSql.query(sql)
+ #self.cur1.execute(sql)
+ elif (strlist == ['LENGTH','CHAR_LENGTH']):
+ sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select "
+ sql += "%s as asct1, ts ," % str_fun_1
+ sql += "%s as asct2, " % str_fun_2
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s select " % random.choice(self.unionall_or_union)
+ sql += "%s as asct2, ts ," % str_fun_2
+ sql += "%s as asct1, " % str_fun_1
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15473 tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 1-4 as str_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']):
+ sql = "select ts , LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select t1.ts as ts,"
+ sql += "%s as asct2, " % str_fun_join_1
+ sql += "%s as asct1, " % str_fun_join_2
+ sql += "%s, " % str_fun_join_1
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "and %s " % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(100)
+ self.cur1.execute(sql)
+ elif (strlist == ['LENGTH','CHAR_LENGTH']):
+ sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select t1.ts as ts,"
+ sql += "%s as asct2, " % str_fun_join_1
+ sql += "%s as asct1, " % str_fun_join_2
+ sql += "%s, " % str_fun_join_1
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "and %s " % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 1-5 as str_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']):
+ sql = "select ts ,"
+ sql += "%s, " % str_fun_1
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s " % str_fun_2
+ sql += " from ( select * from regular_table_1 ) where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += " ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(100)
+ self.cur1.execute(sql)
+ elif (strlist == ['LENGTH','CHAR_LENGTH']):
+ sql = "select ts ,"
+ sql += "%s, " % str_fun_1
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s " % str_fun_2
+ sql += " from ( select * from regular_table_1 ) where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += " ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(100)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 1-6 as str_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']):
+ sql = "select ts , LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select t1.ts as ts,"
+ sql += "%s as asct2, " % str_fun_join_1
+ sql += "%s as asct1, " % str_fun_join_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "%s, " % str_fun_join_1
+ sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "and %s )" % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+ elif (strlist == ['LENGTH','CHAR_LENGTH']):
+ sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select t1.ts as ts,"
+ sql += "%s as asct2, " % str_fun_join_1
+ sql += "%s as asct1, " % str_fun_join_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "%s, " % str_fun_join_1
+ sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "and %s )" % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 1-7 as str_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']):
+ sql = "select ts , LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select "
+ sql += "%s as asct1, ts ," % str_fun_s_1
+ sql += "%s as asct2, " % str_fun_s_2
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.t_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # tdSql.checkRows(300)
+ # self.cur1.execute(sql)# TD-16039
+ elif (strlist == ['LENGTH','CHAR_LENGTH']):
+ sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select "
+ sql += "%s as asct1, ts ," % str_fun_s_1
+ sql += "%s as asct2, " % str_fun_s_2
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.t_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql)# TD-16039
+
+ tdSql.query("select 1-8 as str_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']):
+ sql = "select ts, LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) "
+ sql += "from ( select "
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s as asct1, ts ," % str_fun_s_1
+ sql += "%s as asct2, " % str_fun_s_2
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.t_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # tdSql.checkRows(300)
+ # self.cur1.execute(sql)# TD-16039
+ elif (strlist == ['LENGTH','CHAR_LENGTH']):
+ sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) "
+ sql += "from ( select "
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s as asct1, ts ," % str_fun_s_1
+ sql += "%s as asct2, " % str_fun_s_2
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.t_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql)# TD-16039
+
+ tdSql.query("select 1-9 as str_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']):
+ sql = "select ts , LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select t1.ts as ts,"
+ sql += "%s as asct2, " % str_fun_join_s_1
+ sql += "%s as asct1, " % str_fun_join_s_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += "and %s " % random.choice(self.t_u_where)
+ sql += "and %s " % random.choice(self.t_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql) # TD-16039
+ elif (strlist == ['LENGTH','CHAR_LENGTH']):
+ sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select t1.ts as ts,"
+ sql += "%s as asct2, " % str_fun_join_s_1
+ sql += "%s as asct1, " % str_fun_join_s_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += "and %s " % random.choice(self.t_u_where)
+ sql += "and %s " % random.choice(self.t_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql)# TD-16039
+
+ self.restartDnodes()
+ tdSql.query("select 1-10 as str_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']):
+ sql = "select ts , LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select "
+ sql += "%s as asct1, ts ," % str_fun_s_1
+ sql += "%s as asct2, " % str_fun_s_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") %s " % random.choice(self.unionall_or_union)
+ sql += "select ts , max(asct2) from ( select "
+ sql += "%s as asct1, ts ," % str_fun_1
+ sql += "%s as asct2, " % str_fun_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15437 tdSql.query(sql)
+ #TD-15437 self.cur1.execute(sql)
+ elif (strlist == ['LENGTH','CHAR_LENGTH']):
+ sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select "
+ sql += "%s as asct1, ts ," % str_fun_s_1
+ sql += "%s as asct2, " % str_fun_s_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") %s " % random.choice(self.unionall_or_union)
+ sql += "select ts , max(asct2) from ( select "
+ sql += "%s as asct1, ts ," % str_fun_1
+ sql += "%s as asct2, " % str_fun_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15437 tdSql.query(sql)
+ #TD-15437 self.cur1.execute(sql)
+
+ #3 inter union not support
+ tdSql.query("select 1-11 as str_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']):
+ sql = "select ts , LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select "
+ sql += "%s as asct1, ts ," % str_fun_s_1
+ sql += "%s as asct2, " % str_fun_s_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ #sql += "%s " % random.choice(limit1_where)
+ sql += " %s " % random.choice(self.unionall_or_union)
+ sql += " select "
+ sql += "%s as asct1, ts ," % str_fun_1
+ sql += "%s as asct2, " % str_fun_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15837 tdSql.query(sql)
+ # self.cur1.execute(sql)
+ elif (strlist == ['LENGTH','CHAR_LENGTH']):
+ sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select "
+ sql += "%s as asct1, ts ," % str_fun_s_1
+ sql += "%s as asct2, " % str_fun_s_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ #sql += "%s " % random.choice(limit1_where)
+ sql += " %s " % random.choice(self.unionall_or_union)
+ sql += " select "
+ sql += "%s as asct1, ts ," % str_fun_1
+ sql += "%s as asct2, " % str_fun_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15837 tdSql.query(sql)
+ # self.cur1.execute(sql)
+
+ tdSql.query("select 1-12 as str_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']):
+ sql = "select ts , LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select t1.ts as ts,"
+ sql += "%s as asct2, " % str_fun_join_s_1
+ sql += "%s as asct1, " % str_fun_join_s_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_u_where)
+ sql += "and %s " % random.choice(self.t_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql)# TD-16039
+ elif (strlist == ['LENGTH','CHAR_LENGTH']):
+ sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select t1.ts as ts,"
+ sql += "%s as asct2, " % str_fun_join_s_1
+ sql += "%s as asct1, " % str_fun_join_s_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_u_where)
+ sql += "and %s " % random.choice(self.t_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql)# TD-16039
+
+ tdSql.query("select 1-13 as str_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']):
+ sql = "select ts ,"
+ sql += "%s, " % str_fun_1
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % str_fun_2
+ sql += "%s " % random.choice(self.t_select)
+ sql += " from ( select * from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # tdSql.checkRows(300)
+ # self.cur1.execute(sql) # TD-16039
+ elif (strlist == ['LENGTH','CHAR_LENGTH']):
+ sql = "select ts ,"
+ sql += "%s, " % str_fun_1
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % str_fun_2
+ sql += "%s " % random.choice(self.t_select)
+ sql += " from ( select * from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # tdSql.checkRows(300)
+ # self.cur1.execute(sql)# TD-16039
+
+ tdSql.query("select 1-14 as str_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']):
+ sql = "select LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select "
+ sql += "%s as asct1, " % str_fun_s_1
+ sql += "%s as asct2" % str_fun_s_2
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.partiton_where)
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] )
+ sql += " ) ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql) # TD-16039
+ elif (strlist == ['LENGTH','CHAR_LENGTH']):
+ sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select "
+ sql += "%s as asct1, " % str_fun_s_1
+ sql += "%s as asct2" % str_fun_s_2
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.partiton_where)
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] )
+ sql += " ) ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql) # TD-16039
+
+ tdSql.query("select 1-15 as str_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (strlist == ['LTRIM','RTRIM','LOWER','UPPER']) or (strlist == ['SUBSTR']) or (strlist == ['CONCAT']) or (strlist == ['CONCAT_WS']):
+ sql = "select ts , LTRIM(asct1), LOWER(asct1), RTRIM(asct2), UPPER(asct2) from ( select t1.ts as ts,"
+ sql += "%s as asct2, " % str_fun_join_s_1
+ sql += "%s as asct1, " % str_fun_join_s_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.%s " % random.choice(self.q_select)
+ sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += " and %s " % random.choice(self.qt_u_or_where)
+ sql += "%s " % random.choice(self.partiton_where_j)
+ sql += "%s " % random.choice(self.slimit1_where)
+ sql += ") "
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s ;" % random.choice(self.limit_u_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15955 tdSql.query(sql)
+ #TD-15955 self.cur1.execute(sql)
+ elif (strlist == ['LENGTH','CHAR_LENGTH']):
+ sql = "select sum(asct1), min(asct1), max(asct2), avg(asct2) from ( select t1.ts as ts,"
+ sql += "%s as asct2, " % str_fun_join_s_1
+ sql += "%s as asct1, " % str_fun_join_s_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.%s " % random.choice(self.q_select)
+ sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += " and %s " % random.choice(self.qt_u_or_where)
+ sql += "%s " % random.choice(self.partiton_where_j)
+ sql += "%s " % random.choice(self.slimit1_where)
+ sql += ") "
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s ;" % random.choice(self.limit_u_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15955 tdSql.query(sql)
+ #TD-15955 self.cur1.execute(sql)
+
+ #taos -f sql
+ startTime_taos_f = time.time()
+ print("taos -f %s sql start!" %strlist)
+ taos_cmd1 = "taos -f %s/%s.sql" % (self.testcasePath,self.testcaseFilename)
+ _ = subprocess.check_output(taos_cmd1, shell=True).decode("utf-8")
+ print("taos -f %s sql over!" %strlist)
+ endTime_taos_f = time.time()
+ print("taos_f total time %ds" % (endTime_taos_f - startTime_taos_f))
+
+ print("=========%s====over=============" %strlist)
+
+ def time_nest(self,timelist):
+
+ print("==========%s===start=============" %timelist)
+ os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename))
+
+ self.dropandcreateDB_random("%s" %self.db_nest, 1)
+
+ if (timelist == ['NOW','TODAY']) or (timelist == ['TIMEZONE']):
+ time_functions = timelist
+ fun_fix_column = ['()']
+ fun_column_1 = random.sample(time_functions,1)+random.sample(fun_fix_column,1)
+ time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","")
+ fun_column_2 = random.sample(time_functions,1)+random.sample(fun_fix_column,1)
+ time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ fun_fix_column_j = ['()']
+ fun_column_join_1 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1)
+ time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","")
+ fun_column_join_2 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1)
+ time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ elif (timelist == ['TIMETRUNCATE']):
+ time_functions = timelist
+
+ t = time.time()
+ t_to_s = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(t))
+ fun_fix_column = ['q_ts','ts','_c0','_C0','_rowts','1600000000000','1600000000000000','1600000000000000000',
+ '%d' %t, '%d000' %t, '%d000000' %t,'t_to_s']
+
+ timeunits = ['1u' , '1a' ,'1s', '1m' ,'1h', '1d']
+ timeunit = str(random.sample(timeunits,1)).replace("[","").replace("]","").replace("'","")
+
+ column_1 = ['(%s,timeutil)'%(random.sample(fun_fix_column,1))]
+ fun_column_1 = random.sample(time_functions,1)+random.sample(column_1,1)
+ time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'")
+ time_fun_1 = str(time_fun_1).replace("timeutil","%s" %timeunit).replace("t_to_s","%s" %t_to_s)
+
+ column_2 = ['(%s,timeutil)'%(random.sample(fun_fix_column,1))]
+ fun_column_2 = random.sample(time_functions,1)+random.sample(column_2,1)
+ time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'")
+ time_fun_2 = str(time_fun_2).replace("timeutil","%s" %timeunit).replace("t_to_s","%s" %t_to_s)
+
+
+ fun_fix_column_j = ['(t1.q_ts)','(t1.ts)', '(t2.q_ts)','(t2.ts)','(1600000000000)','(1600000000000000)','(1600000000000000000)',
+ '(%d)' %t, '(%d000)' %t, '(%d000000)' %t,'t_to_s']
+
+ column_j1 = ['(%s,timeutil)'%(random.sample(fun_fix_column_j,1))]
+ fun_column_join_1 = random.sample(time_functions,1)+random.sample(column_j1,1)
+ time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'")
+ time_fun_join_1 = str(time_fun_join_1).replace("timeutil","%s" %timeunit).replace("t_to_s","%s" %t_to_s)
+
+ column_j2 = ['(%s,timeutil)'%(random.sample(fun_fix_column_j,1))]
+ fun_column_join_2 = random.sample(time_functions,1)+random.sample(column_j2,1)
+ time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("\"","").replace("t_to_s","'t_to_s'")
+ time_fun_join_2 = str(time_fun_join_2).replace("timeutil","%s" %timeunit).replace("t_to_s","%s" %t_to_s)
+
+ elif (timelist == ['TO_ISO8601']):
+ time_functions = timelist
+
+ t = time.time()
+ fun_fix_column = ['(now())','(ts)','(q_ts)','(_rowts)','(_c0)','(_C0)',
+ '(1600000000000)','(1600000000000000)','(1600000000000000000)',
+ '(%d)' %t, '(%d000)' %t, '(%d000000)' %t]
+
+ fun_column_1 = random.sample(time_functions,1)+random.sample(fun_fix_column,1)
+ time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ fun_column_2 = random.sample(time_functions,1)+random.sample(fun_fix_column,1)
+ time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ fun_fix_column_j = ['(t1.q_ts)','(t1.ts)', '(t2.q_ts)','(t2.ts)','(1600000000000)','(1600000000000000)','(1600000000000000000)','(now())',
+ '(%d)' %t, '(%d000)' %t, '(%d000000)' %t]
+
+ fun_column_join_1 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1)
+ time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ fun_column_join_2 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1)
+ time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ elif (timelist == ['TO_UNIXTIMESTAMP']):
+ time_functions = timelist
+
+ t = time.time()
+ t_to_s = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(t))
+ fun_fix_column = ['(q_nchar)','(q_nchar1)','(q_nchar2)','(q_nchar3)','(q_nchar4)','(q_nchar_null)','(q_binary)','(q_binary5)','(q_binary6)','(q_binary7)','(q_binary8)','(q_binary_null)','(t_to_s)']
+
+ fun_column_1 = random.sample(time_functions,1)+random.sample(fun_fix_column,1)
+ time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("t_to_s","'t_to_s'")
+ time_fun_1 = str(time_fun_1).replace("t_to_s","%s" %t_to_s)
+
+ fun_column_2 = random.sample(time_functions,1)+random.sample(fun_fix_column,1)
+ time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("t_to_s","'t_to_s'")
+ time_fun_2 = str(time_fun_2).replace("t_to_s","%s" %t_to_s)
+
+ fun_fix_column_j = ['(t1.q_nchar)','(t1.q_binary)', '(t2.q_nchar)','(t2.q_binary)','(t_to_s)']
+
+ fun_column_join_1 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1)
+ time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("t_to_s","'t_to_s'")
+ time_fun_join_1 = str(time_fun_join_1).replace("t_to_s","%s" %t_to_s)
+
+ fun_column_join_2 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1)
+ time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("t_to_s","'t_to_s'")
+ time_fun_join_2 = str(time_fun_join_2).replace("t_to_s","%s" %t_to_s)
+
+ elif (timelist == ['TIMEDIFF']):
+ time_functions = timelist
+
+ t = time.time()
+ t_to_s = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(t))
+ fun_fix_column = ['(q_nchar)','(q_nchar1)','(q_nchar2)','(q_nchar3)','(q_nchar4)','(q_nchar_null)','(q_binary)','(q_binary5)','(q_binary6)','(q_binary7)','(q_binary8)','(q_binary_null)','(t_to_s)']
+
+ fun_column_1 = random.sample(time_functions,1)+random.sample(fun_fix_column,1)
+ time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("t_to_s","'t_to_s'")
+ time_fun_1 = str(time_fun_1).replace("t_to_s","%s" %t_to_s)
+
+ fun_column_2 = random.sample(time_functions,1)+random.sample(fun_fix_column,1)
+ time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("t_to_s","'t_to_s'")
+ time_fun_2 = str(time_fun_2).replace("t_to_s","%s" %t_to_s)
+
+ fun_fix_column_j = ['(t1.q_nchar)','(t1.q_binary)', '(t2.q_nchar)','(t2.q_binary)','(t_to_s)']
+
+ fun_column_join_1 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1)
+ time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("t_to_s","'t_to_s'")
+ time_fun_join_1 = str(time_fun_join_1).replace("t_to_s","%s" %t_to_s)
+
+ fun_column_join_2 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1)
+ time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("t_to_s","'t_to_s'")
+ time_fun_join_2 = str(time_fun_join_2).replace("t_to_s","%s" %t_to_s)
+
+ elif (timelist == ['ELAPSED']):
+ time_functions = timelist
+
+ fun_fix_column = ['(ts)','(q_ts)','(_c0)','(_C0)','(_rowts)','(ts,time_unit)','(_c0,time_unit)','(_C0,time_unit)','(_rowts,time_unit)']
+
+ time_units = ['nums','numm','numh','numd','numa']
+ time_unit = str(random.sample(time_units,1)).replace("[","").replace("]","").replace("'","")
+ time_num1 = random.randint(0, 1000)
+ time_unit1 = time_unit.replace("num","%d" %time_num1)
+ time_num2 = random.randint(0, 1000)
+ time_unit2 = time_unit.replace("num","%d" %time_num2)
+
+ fun_column_1 = random.sample(time_functions,1)+random.sample(fun_fix_column,1)
+ time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("time_unit","%s" %time_unit1)
+
+ fun_column_2 = random.sample(time_functions,1)+random.sample(fun_fix_column,1)
+ time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("time_unit","%s" %time_unit2)
+
+
+ fun_fix_column_j = ['(t1.ts)','(t1.q_ts)', '(t2.ts)','(t2.q_ts)','(t1.ts,time_unit)','(t1.q_ts,time_unit)','(t2.ts,time_unit)','(t2.q_ts,time_unit)']
+
+ fun_column_join_1 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1)
+ time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("time_unit","%s" %time_unit1)
+
+ fun_column_join_2 = random.sample(time_functions,1)+random.sample(fun_fix_column_j,1)
+ time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("time_unit","%s" %time_unit2)
+
+
+ elif (timelist == ['CAST']) :
+ str_functions = timelist
+ #下面的4个是全的,这个只是1个
+ i = random.randint(1,4)
+ if i ==1:
+ print('===========cast_1===========')
+ fun_fix_column = ['q_bool','q_bool_null','q_bigint','q_bigint_null','q_smallint','q_smallint_null',
+ 'q_tinyint','q_tinyint_null','q_int','q_int_null','q_float','q_float_null','q_double','q_double_null']
+ type_names = ['BIGINT','BINARY(100)','TIMESTAMP','NCHAR(100)','BIGINT UNSIGNED']
+
+ type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')'
+ time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","")
+
+ type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')'
+ time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","")
+
+ fun_fix_column_j = ['t1.q_bool','t1.q_bool_null','t1.q_bigint','t1.q_bigint_null','t1.q_smallint','t1.q_smallint_null',
+ 't1.q_tinyint','t1.q_tinyint_null','t1.q_int','t1.q_int_null','t1.q_float','t1.q_float_null','t1.q_double','t1.q_double_null',
+ 't2.q_bool','t2.q_bool_null','t2.q_bigint','t2.q_bigint_null','t2.q_smallint','t2.q_smallint_null',
+ 't2.q_tinyint','t2.q_tinyint_null','t2.q_int','t2.q_int_null','t2.q_float','t2.q_float_null','t2.q_double','t2.q_double_null']
+
+ type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')'
+ time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","")
+
+ type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')'
+ time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","")
+
+ elif i==2:
+ print('===========cast_2===========')
+ fun_fix_column = ['q_binary','q_binary_null','q_binary1','q_binary2','q_binary3','q_binary4']
+ type_names = ['BIGINT','BINARY(100)','NCHAR(100)','BIGINT UNSIGNED']
+
+ type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')'
+ time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","")
+
+ type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')'
+ time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","")
+
+ fun_fix_column_j = ['t1.q_binary','t1.q_binary_null','t1.q_binary1','t1.q_binary2','t1.q_binary3','t1.q_smallint_null','t1.q_binary4',
+ 't2.q_binary','t2.q_binary_null','t2.q_bigint','t2.q_binary1','t2.q_binary2','t2.q_binary3','t2.q_binary4']
+
+ type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')'
+ time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","")
+
+ type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')'
+ time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","")
+
+ elif i==3:
+ print('===========cast_3===========')
+ fun_fix_column = ['q_nchar','q_nchar_null','q_nchar5','q_nchar6','q_nchar7','q_nchar8']
+ type_names = ['BIGINT','NCHAR(100)','BIGINT UNSIGNED']
+
+ type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')'
+ time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","")
+
+ type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')'
+ time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","")
+
+ fun_fix_column_j = ['t1.q_nchar','t1.q_nchar_null','t1.q_nchar5','t1.q_nchar6','t1.q_nchar7','t1.q_nchar8',
+ 't2.q_nchar','t2.q_nchar_null','t2.q_nchar5','t2.q_nchar6','t2.q_nchar7','t2.q_nchar8']
+
+ type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')'
+ time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","")
+
+ type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')'
+ time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","")
+
+ elif i==4:
+ print('===========cast_4===========')
+ fun_fix_column = ['q_ts','q_ts_null','_C0','_c0','ts','_rowts']
+ type_names = ['BIGINT','TIMESTAMP','BIGINT UNSIGNED']
+
+ type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')'
+ time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","")
+
+ type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')'
+ time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","")
+
+ fun_fix_column_j = ['t1.q_ts','t1.q_ts_null','t1.ts','t2.q_ts','t2.q_ts_null','t2.ts']
+
+ type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')'
+ time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","")
+
+ type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')'
+ time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","")
+
+ elif (timelist == ['CAST_1']) :
+ str_functions = timelist
+
+ print('===========cast_1===========')
+ fun_fix_column = ['q_bool','q_bool_null','q_bigint','q_bigint_null','q_smallint','q_smallint_null',
+ 'q_tinyint','q_tinyint_null','q_int','q_int_null','q_float','q_float_null','q_double','q_double_null']
+ type_names = ['BIGINT','BINARY(100)','TIMESTAMP','NCHAR(100)','BIGINT UNSIGNED']
+
+ type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')'
+ time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace("_1","")
+
+ type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')'
+ time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace("_1","")
+
+ fun_fix_column_j = ['t1.q_bool','t1.q_bool_null','t1.q_bigint','t1.q_bigint_null','t1.q_smallint','t1.q_smallint_null',
+ 't1.q_tinyint','t1.q_tinyint_null','t1.q_int','t1.q_int_null','t1.q_float','t1.q_float_null','t1.q_double','t1.q_double_null',
+ 't2.q_bool','t2.q_bool_null','t2.q_bigint','t2.q_bigint_null','t2.q_smallint','t2.q_smallint_null',
+ 't2.q_tinyint','t2.q_tinyint_null','t2.q_int','t2.q_int_null','t2.q_float','t2.q_float_null','t2.q_double','t2.q_double_null']
+
+ type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')'
+ time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace("_1","")
+
+ type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')'
+ time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace("_1","")
+
+ elif (timelist == ['CAST_2']) :
+ str_functions = timelist
+ print('===========cast_2===========')
+ fun_fix_column = ['q_binary','q_binary_null','q_binary1','q_binary2','q_binary3','q_binary4']
+ type_names = ['BIGINT','BINARY(100)','NCHAR(100)','BIGINT UNSIGNED']
+
+ type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')'
+ time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace("_2","")
+
+ type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')'
+ time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace("_2","")
+
+ fun_fix_column_j = ['t1.q_binary','t1.q_binary_null','t1.q_binary1','t1.q_binary2','t1.q_binary3','t1.q_smallint_null','t1.q_binary4',
+ 't2.q_binary','t2.q_binary_null','t2.q_bigint','t2.q_binary1','t2.q_binary2','t2.q_binary3','t2.q_binary4']
+
+ type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')'
+ time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace("_2","")
+
+ type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')'
+ time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace("_2","")
+
+ elif (timelist == ['CAST_3']) :
+ str_functions = timelist
+ print('===========cast_3===========')
+ fun_fix_column = ['q_nchar','q_nchar_null','q_nchar5','q_nchar6','q_nchar7','q_nchar8']
+ type_names = ['BIGINT','NCHAR(100)','BIGINT UNSIGNED']
+
+ type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')'
+ time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace("_3","")
+
+ type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')'
+ time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace("_3","")
+
+ fun_fix_column_j = ['t1.q_nchar','t1.q_nchar_null','t1.q_nchar5','t1.q_nchar6','t1.q_nchar7','t1.q_nchar8',
+ 't2.q_nchar','t2.q_nchar_null','t2.q_nchar5','t2.q_nchar6','t2.q_nchar7','t2.q_nchar8']
+
+ type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')'
+ time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace("_3","")
+
+ type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')'
+ time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace("_3","")
+
+ elif (timelist == ['CAST_4']) :
+ str_functions = timelist
+ print('===========cast_4===========')
+ fun_fix_column = ['q_ts','q_ts_null','_C0','_c0','ts','_rowts']
+ type_names = ['BIGINT','TIMESTAMP','BIGINT UNSIGNED']
+
+ type_name1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name1+')'
+ time_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace("_4","")
+
+ type_name2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column,1))+' AS '+type_name2+')'
+ time_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace("_4","")
+
+ fun_fix_column_j = ['t1.q_ts','t1.q_ts_null','t1.ts','t2.q_ts','t2.q_ts_null','t2.ts']
+
+ type_name_j1 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_1 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j1+')'
+ time_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace("_4","")
+
+ type_name_j2 = str(random.sample(type_names,1)).replace("[","").replace("]","").replace("'","")
+ fun_column_join_2 = str(random.sample(str_functions,1))+'('+str(random.sample(fun_fix_column_j,1))+' AS '+type_name_j2+')'
+ time_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace("_4","")
+
+ tdSql.query("select 1-1 as time_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\
+ or (timelist == ['TO_UNIXTIMESTAMP']):
+ sql = "select ts , timediff(asct1,now) from ( select "
+ sql += "%s as asct1, " % time_fun_1
+ sql += "%s as asct2, " % time_fun_2
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(100)
+ self.cur1.execute(sql)
+ elif (timelist == ['TIMEZONE']) \
+ or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']):
+ sql = "select ts , asct1,now(),today(),timezone() from ( select "
+ sql += "%s as asct1, " % time_fun_1
+ sql += "%s as asct2, " % time_fun_2
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(100)
+ self.cur1.execute(sql)
+ elif (timelist == ['ELAPSED']) :
+ sql = "select max(asct1),now(),today(),timezone() from ( select "
+ sql += "%s as asct1, " % time_fun_1
+ sql += "%s as asct2 " % time_fun_2
+ sql += "from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 1-2 as time_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\
+ or (timelist == ['TO_UNIXTIMESTAMP']):
+ sql = "select ts , timediff(asct1,now),now(),today(),timezone() from ( select "
+ sql += "%s as asct1, " % time_fun_1
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s )" % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.unionall_or_union)
+ sql += "select ts , timediff(asct2,now),now(),today(),timezone() from ( select "
+ sql += "%s as asct2, " % time_fun_2
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ #sql += "%s " % random.choice(having_support)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15437 tdSql.query(sql)
+ #TD-15437 self.cur1.execute(sql)
+ elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']):
+ sql = "select ts , (asct1),now(),today(),timezone() from ( select "
+ sql += "%s as asct1, " % time_fun_1
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s )" % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.unionall_or_union)
+ sql += "select ts , asct2,now(),today(),timezone() from ( select "
+ sql += "%s as asct2, " % time_fun_2
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15437 tdSql.query(sql)
+ #TD-15437 self.cur1.execute(sql)
+ elif (timelist == ['ELAPSED']) :
+ sql = "select min(asct1),now(),today(),timezone() from ( select "
+ sql += "%s as asct1 " % time_fun_1
+ sql += " from regular_table_1 where "
+ sql += "%s )" % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.unionall_or_union)
+ sql += "select avg(asct2),now(),today(),timezone() from ( select "
+ sql += "%s as asct2 " % time_fun_2
+ sql += " from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 1-3 as time_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\
+ or (timelist == ['TO_UNIXTIMESTAMP']):
+ sql = "select ts , timediff(asct1,now) from ( select "
+ sql += "%s as asct1, ts ," % time_fun_1
+ sql += "%s as asct2, " % time_fun_2
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s select " % random.choice(self.unionall_or_union)
+ sql += "%s as asct2, ts ," % time_fun_2
+ sql += "%s as asct1, " % time_fun_1
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15473 tdSql.query(sql)
+ #self.cur1.execute(sql)
+ elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']):
+ sql = "select ts , (asct1),now(),today(),timezone() from ( select "
+ sql += "%s as asct1, ts ," % time_fun_1
+ sql += "%s as asct2, " % time_fun_2
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s select " % random.choice(self.unionall_or_union)
+ sql += "%s as asct2, ts ," % time_fun_2
+ sql += "%s as asct1, " % time_fun_1
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15473 tdSql.query(sql)
+ #self.cur1.execute(sql)
+ elif (timelist == ['ELAPSED']) :
+ sql = "select abs(asct1),now(),today(),timezone() from ( select "
+ sql += "%s as asct1," % time_fun_1
+ sql += "%s as asct2 " % time_fun_2
+ sql += "from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s select " % random.choice(self.unionall_or_union)
+ sql += "%s as asct2," % time_fun_2
+ sql += "%s as asct1 " % time_fun_1
+ sql += "from regular_table_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 1-4 as time_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\
+ or (timelist == ['TO_UNIXTIMESTAMP']):
+ sql = "select ts , timediff(asct1,now) from ( select t1.ts as ts,"
+ sql += "%s, " % time_fun_join_1
+ sql += "%s as asct1, " % time_fun_join_2
+ sql += "%s, " % time_fun_join_1
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "and %s " % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(100)
+ self.cur1.execute(sql)
+ elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']):
+ sql = "select ts , (asct1) from ( select t1.ts as ts,"
+ sql += "%s, " % time_fun_join_1
+ sql += "%s as asct1, " % time_fun_join_2
+ sql += "%s, " % time_fun_join_1
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "and %s " % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(100)
+ self.cur1.execute(sql)
+ elif (timelist == ['ELAPSED']) :
+ sql = "select floor(asct1) from ( select "
+ sql += "%s, " % time_fun_join_1
+ sql += "%s as asct1, " % time_fun_join_2
+ sql += "%s " % time_fun_join_1
+ sql += " from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "and %s " % random.choice(self.q_u_or_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 1-5 as time_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (timelist == ['ELAPSED']) :
+ sql = "select now(),today(),timezone(), "
+ sql += "%s, " % time_fun_1
+ sql += "%s " % time_fun_2
+ sql += " from ( select * from regular_table_1 ) where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += " ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+ else:
+ sql = "select ts ,now(),today(),timezone(), "
+ sql += "%s, " % time_fun_1
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s " % time_fun_2
+ sql += " from ( select * from regular_table_1 ) where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += " ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(100)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 1-6 as time_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\
+ or (timelist == ['TO_UNIXTIMESTAMP']):
+ sql = "select ts , timediff(asct1,now) from ( select t1.ts as ts,"
+ sql += "%s, " % time_fun_join_1
+ sql += "%s as asct1, " % time_fun_join_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "%s, " % time_fun_join_1
+ sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "and %s )" % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+ elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']):
+ sql = "select ts , (asct1) from ( select t1.ts as ts,"
+ sql += "%s, " % time_fun_join_1
+ sql += "%s as asct1, " % time_fun_join_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "%s, " % time_fun_join_1
+ sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "and %s )" % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+ elif (timelist == ['ELAPSED']) :
+ sql = "select (asct1)*111 from ( select "
+ sql += "%s, " % time_fun_join_1
+ sql += "%s as asct1, " % time_fun_join_2
+ sql += "%s " % time_fun_join_1
+ sql += " from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "and %s )" % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 1-7 as time_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\
+ or (timelist == ['TO_UNIXTIMESTAMP']):
+ sql = "select ts , timediff(asct1,now) from ( select "
+ sql += "%s as asct1, ts ," % time_fun_1
+ sql += "%s as asct2, " % time_fun_2
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.t_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql) # TD-16039
+ # tdSql.checkRows(300)
+ # self.cur1.execute(sql)
+ elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']):
+ sql = "select ts , (asct1),now(),today(),timezone() from ( select "
+ sql += "%s as asct1, ts ," % time_fun_1
+ sql += "%s as asct2, " % time_fun_2
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.t_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql) # TD-16039
+ # tdSql.checkRows(300)
+ # self.cur1.execute(sql)
+ elif (timelist == ['ELAPSED']) :
+ sql = "select (asct1)/asct2 ,now(),today(),timezone() from ( select "
+ sql += "%s as asct1, " % time_fun_1
+ sql += "%s as asct2 " % time_fun_2
+ sql += "from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql) #同时出现core:TD-16095和TD-16042
+ # self.cur1.execute(sql)
+
+ tdSql.query("select 1-8 as time_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\
+ or (timelist == ['TO_UNIXTIMESTAMP']):
+ sql = "select ts , timediff(asct1,now) "
+ sql += "from ( select "
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s as asct1, ts ," % time_fun_1
+ sql += "%s as asct2, " % time_fun_2
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.t_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql) # TD-16039
+ # tdSql.checkRows(300)
+ # self.cur1.execute(sql)
+ elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']):
+ sql = "select ts , (asct1),now(),today(),timezone() "
+ sql += "from ( select "
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s as asct1, ts ," % time_fun_1
+ sql += "%s as asct2, " % time_fun_2
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.t_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql) # TD-16039
+ # tdSql.checkRows(300)
+ # self.cur1.execute(sql)
+ elif (timelist == ['ELAPSED']) :
+ sql = "select floor(abs(asct1)),now(),today(),timezone() "
+ sql += "from ( select "
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s as asct1, " % time_fun_1
+ sql += "%s as asct2, " % time_fun_2
+ sql += "from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql) # TD-16039
+ # self.cur1.execute(sql)
+
+ tdSql.query("select 1-9 as time_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\
+ or (timelist == ['TO_UNIXTIMESTAMP']):
+ sql = "select ts , timediff(asct1,now) from ( select t1.ts as ts,"
+ sql += "%s, " % time_fun_join_1
+ sql += "%s as asct1, " % time_fun_join_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += "and %s " % random.choice(self.t_u_where)
+ sql += "and %s " % random.choice(self.t_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql) TD-16039
+ # self.cur1.execute(sql) TD-16039
+ elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']):
+ sql = "select ts , asct1 from ( select t1.ts as ts,"
+ sql += "%s, " % time_fun_join_1
+ sql += "%s as asct1, " % time_fun_join_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += "and %s " % random.choice(self.t_u_where)
+ sql += "and %s " % random.choice(self.t_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql) # TD-16039
+ elif (timelist == ['ELAPSED']) :
+ sql = "select min(asct1*110) from ( select "
+ sql += "%s, " % time_fun_join_1
+ sql += "%s as asct1 " % time_fun_join_2
+ sql += "from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += "and %s " % random.choice(self.t_u_where)
+ sql += "and %s " % random.choice(self.t_u_or_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql) # TD-16039
+
+ self.restartDnodes()
+ tdSql.query("select 1-10 as time_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\
+ or (timelist == ['TO_UNIXTIMESTAMP']):
+ sql = "select ts , timediff(asct1,now) from ( select "
+ sql += "%s as asct1, ts ," % time_fun_1
+ sql += "%s as asct2, " % time_fun_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") %s " % random.choice(self.unionall_or_union)
+ sql += "select ts , max(asct2) from ( select "
+ sql += "%s as asct1, ts ," % time_fun_1
+ sql += "%s as asct2, " % time_fun_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15437 tdSql.query(sql)
+ #TD-15437 self.cur1.execute(sql)
+ elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']):
+ sql = "select ts , (asct1),now(),today(),timezone() from ( select "
+ sql += "%s as asct1, ts ," % time_fun_1
+ sql += "%s as asct2, " % time_fun_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") %s " % random.choice(self.unionall_or_union)
+ sql += "select ts , max(asct2),now(),today(),timezone() from ( select "
+ sql += "%s as asct1, ts ," % time_fun_1
+ sql += "%s as asct2, " % time_fun_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15437 tdSql.query(sql)
+ #TD-15437 self.cur1.execute(sql)
+ elif (timelist == ['ELAPSED']) :
+ sql = "select abs(asct1),now(),today(),timezone() from ( select "
+ sql += "%s as asct1 ," % time_fun_1
+ sql += "%s as asct2 " % time_fun_2
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += ") %s " % random.choice(self.unionall_or_union)
+ sql += "select max(asct2),now(),today(),timezone() from ( select "
+ sql += "%s as asct1 ," % time_fun_1
+ sql += "%s as asct2 " % time_fun_2
+ sql += "from stable_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ #TD-15437 self.cur1.execute(sql)
+
+ #3 inter union not support
+ tdSql.query("select 1-11 as time_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\
+ or (timelist == ['TO_UNIXTIMESTAMP']):
+ sql = "select ts , timediff(asct1,now), timediff(now,asct2) from ( select "
+ sql += "%s as asct1, ts ," % time_fun_1
+ sql += "%s as asct2, " % time_fun_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += " %s " % random.choice(self.unionall_or_union)
+ sql += " select "
+ sql += "%s as asct1, ts ," % time_fun_1
+ sql += "%s as asct2, " % time_fun_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)#TD-15473
+ # self.cur1.execute(sql)#TD-15473
+ elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']):
+ sql = "select ts , (asct1,now()),(now(),asct2) from ( select "
+ sql += "%s as asct1, ts ," % time_fun_1
+ sql += "%s as asct2, " % time_fun_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += " %s " % random.choice(self.unionall_or_union)
+ sql += " select "
+ sql += "%s as asct1, ts ," % time_fun_1
+ sql += "%s as asct2, " % time_fun_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)#TD-15473
+ # self.cur1.execute(sql)#TD-15473
+ elif (timelist == ['ELAPSED']) :
+ sql = "select asct1+asct2,now(),today(),timezone() from ( select "
+ sql += "%s as asct1, " % time_fun_1
+ sql += "%s as asct2 " % time_fun_2
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += " %s " % random.choice(self.unionall_or_union)
+ sql += " select "
+ sql += "%s as asct1 ," % time_fun_1
+ sql += "%s as asct2 " % time_fun_2
+ sql += " from stable_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)#TD-15473
+ self.cur1.execute(sql)#TD-15473
+
+ tdSql.query("select 1-12 as time_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\
+ or (timelist == ['TO_UNIXTIMESTAMP']):
+ sql = "select ts , timediff(asct1,now) from ( select t1.ts as ts,"
+ sql += "%s, " % time_fun_join_1
+ sql += "%s as asct1, " % time_fun_join_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_u_where)
+ sql += "and %s " % random.choice(self.t_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql)# TD-16039
+ elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']):
+ sql = "select ts , asct1,now() from ( select t1.ts as ts,"
+ sql += "%s, " % time_fun_join_1
+ sql += "%s as asct1, " % time_fun_join_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_u_where)
+ sql += "and %s " % random.choice(self.t_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql)# TD-16039
+ elif (timelist == ['ELAPSED']) :
+ sql = "select min(floor(asct1)),now() from ( select "
+ sql += "%s, " % time_fun_join_1
+ sql += "%s as asct1 " % time_fun_join_2
+ sql += " from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_u_where)
+ sql += "and %s " % random.choice(self.t_u_or_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql)# TD-16039
+
+ tdSql.query("select 1-13 as time_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\
+ or (timelist == ['TO_UNIXTIMESTAMP']):
+ sql = "select ts , timediff(%s,now)," % time_fun_2
+ sql += "%s as asct1, " % time_fun_1
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s " % time_fun_2
+ sql += "%s " % random.choice(self.t_select)
+ sql += " from ( select * from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # tdSql.checkRows(300)
+ # self.cur1.execute(sql) # TD-16039
+ elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']):
+ sql = "select ts ,now(),today(),timezone(), "
+ sql += "%s as asct1, " % time_fun_1
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s " % time_fun_2
+ sql += "%s " % random.choice(self.t_select)
+ sql += " from ( select * from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # tdSql.checkRows(300)
+ # self.cur1.execute(sql) # TD-16039
+ elif (timelist == ['ELAPSED']) :
+ sql = "select now(),today(),timezone(), "
+ sql += "%s as asct1, " % time_fun_1
+ sql += "%s " % time_fun_2
+ sql += " from ( select * from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql) # TD-16039
+
+ tdSql.query("select 1-14 as time_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\
+ or (timelist == ['TO_UNIXTIMESTAMP']):
+ sql = "select ts , timediff(asct1,now),timediff(now,asct2) from ( select ts ts ,"
+ sql += "%s as asct1, " % time_fun_1
+ sql += "%s as asct2" % time_fun_2
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.partiton_where)
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] )
+ sql += " ) ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql) # TD-16039
+ elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']):
+ sql = "select ts , (asct1),now(),(now()),asct2 from ( select ts ts ,"
+ sql += "%s as asct1, " % time_fun_1
+ sql += "%s as asct2" % time_fun_2
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.partiton_where)
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] )
+ sql += " ) ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql) # TD-16039
+ elif (timelist == ['ELAPSED']) :
+ sql = "select ts , (asct1)*asct2,now(),(now()) from ( select "
+ sql += "%s as asct1, " % time_fun_1
+ sql += "%s as asct2" % time_fun_2
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.partiton_where)
+ sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] )
+ sql += " ) ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql) # TD-16039
+
+ tdSql.query("select 1-15 as time_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ if (timelist == ['NOW','TODAY']) or (timelist == ['TIMETRUNCATE']) or (timelist == ['TO_ISO8601'])\
+ or (timelist == ['TO_UNIXTIMESTAMP']):
+ sql = "select ts , timediff(asct1,now),timediff(now,asct2) from ( select t1.ts as ts,"
+ sql += "%s as asct2, " % time_fun_join_1
+ sql += "%s as asct1, " % time_fun_join_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.%s " % random.choice(self.q_select)
+ sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += " and %s " % random.choice(self.qt_u_or_where)
+ sql += "%s " % random.choice(self.partiton_where_j)
+ sql += "%s " % random.choice(self.slimit1_where)
+ sql += ") "
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s ;" % random.choice(self.limit_u_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql) # TD-16039
+ elif (timelist == ['TIMEZONE']) or (timelist == ['CAST']) or (timelist == ['CAST_1']) or (timelist == ['CAST_2']) or (timelist == ['CAST_3']) or (timelist == ['CAST_4']):
+ sql = "select ts , asct1,(now()),(now()),asct2 ,now(),today(),timezone() from ( select t1.ts as ts,"
+ sql += "%s as asct2, " % time_fun_join_1
+ sql += "%s as asct1, " % time_fun_join_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.%s " % random.choice(self.q_select)
+ sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += " and %s " % random.choice(self.qt_u_or_where)
+ sql += "%s " % random.choice(self.partiton_where_j)
+ sql += "%s " % random.choice(self.slimit1_where)
+ sql += ") "
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s ;" % random.choice(self.limit_u_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ # self.cur1.execute(sql) # TD-16039
+ elif (timelist == ['ELAPSED']) :
+ sql = "select asct1,(now()),(now()),asct2 ,now(),today(),timezone() from ( select "
+ sql += "%s as asct2, " % time_fun_join_1
+ sql += "%s as asct1 " % time_fun_join_2
+ sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += " and %s " % random.choice(self.qt_u_or_where)
+ sql += "%s " % random.choice(self.partiton_where_j)
+ sql += "%s " % random.choice(self.slimit1_where)
+ sql += ") "
+ sql += "%s ;" % random.choice(self.limit_u_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql) # TD-16039
+
+ #taos -f sql
+ startTime_taos_f = time.time()
+ print("taos -f %s sql start!" %timelist)
+ taos_cmd1 = "taos -f %s/%s.sql" % (self.testcasePath,self.testcaseFilename)
+ _ = subprocess.check_output(taos_cmd1, shell=True).decode("utf-8")
+ print("taos -f %s sql over!" %timelist)
+ endTime_taos_f = time.time()
+ print("taos_f total time %ds" % (endTime_taos_f - startTime_taos_f))
+
+ print("=========%s====over=============" %timelist)
+
+ def base_nest(self,baselist):
+
+ print("==========%s===start=============" %baselist)
+ os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename))
+
+ self.dropandcreateDB_random("%s" %self.db_nest, 1)
+
+ if (baselist == ['A']) or (baselist == ['S']) or (baselist == ['F']) \
+ or (baselist == ['C']):
+ base_functions = baselist
+ fun_fix_column = ['(q_bigint)','(q_smallint)','(q_tinyint)','(q_int)','(q_float)','(q_double)','(q_bigint_null)','(q_smallint_null)','(q_tinyint_null)','(q_int_null)','(q_float_null)','(q_double_null)']
+ fun_column_1 = random.sample(base_functions,1)+random.sample(fun_fix_column,1)
+ base_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","")
+ fun_column_2 = random.sample(base_functions,1)+random.sample(fun_fix_column,1)
+ base_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ fun_fix_column_j = ['(t1.q_bigint)','(t1.q_smallint)','(t1.q_tinyint)','(t1.q_int)','(t1.q_float)','(t1.q_double)','(t1.q_bigint_null)','(t1.q_smallint_null)','(t1.q_tinyint_null)','(t1.q_int_null)','(t1.q_float_null)','(t1.q_double_null)',
+ '(t2.q_bigint)','(t2.q_smallint)','(t2.q_tinyint)','(t2.q_int)','(t2.q_float)','(t2.q_double)','(t2.q_bigint_null)','(t2.q_smallint_null)','(t2.q_tinyint_null)','(t2.q_int_null)','(t2.q_float_null)','(t2.q_double_null)']
+ fun_column_join_1 = random.sample(base_functions,1)+random.sample(fun_fix_column_j,1)
+ base_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","")
+ fun_column_join_2 = random.sample(base_functions,1)+random.sample(fun_fix_column_j,1)
+ base_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","")
+
+ elif (baselist == ['P']) or (baselist == ['M']) or (baselist == ['S'])or (baselist == ['T']):
+ base_functions = baselist
+ num = random.randint(0, 1000)
+ fun_fix_column = ['(q_bigint,num)','(q_smallint,num)','(q_tinyint,num)','(q_int,num)','(q_float,num)','(q_double,num)',
+ '(q_bigint_null,num)','(q_smallint_null,num)','(q_tinyint_null,num)','(q_int_null,num)','(q_float_null,num)','(q_double_null,num)']
+ fun_column_1 = random.sample(base_functions,1)+random.sample(fun_fix_column,1)
+ base_fun_1 = str(fun_column_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",base(num))
+ fun_column_2 = random.sample(base_functions,1)+random.sample(fun_fix_column,1)
+ base_fun_2 = str(fun_column_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",base(num))
+
+ fun_fix_column_j = ['(t1.q_bigint,num)','(t1.q_smallint,num)','(t1.q_tinyint,num)','(t1.q_int,num)','(t1.q_float,num)','(t1.q_double,num)',
+ '(t1.q_bigint_null,num)','(t1.q_smallint_null,num)','(t1.q_tinyint_null,num)','(t1.q_int_null,num)','(t1.q_float_null,num)','(t1.q_double_null,num)',
+ '(t2.q_bigint,num)','(t2.q_smallint,num)','(t2.q_tinyint,num)','(t2.q_int,num)','(t2.q_float,num)','(t2.q_double,num)',
+ '(t2.q_bigint_null,num)','(t2.q_smallint_null,num)','(t2.q_tinyint_null,num)','(t2.q_int_null,num)','(t2.q_float_null,num)','(t2.q_double_null,num)']
+ fun_column_join_1 = random.sample(base_functions,1)+random.sample(fun_fix_column_j,1)
+ base_fun_join_1 = str(fun_column_join_1).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",base(num))
+ fun_column_join_2 = random.sample(base_functions,1)+random.sample(fun_fix_column_j,1)
+ base_fun_join_2 = str(fun_column_join_2).replace("[","").replace("]","").replace("'","").replace(", ","").replace("num",base(num))
+
+ tdSql.query("select 1-1 as base_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ sql = "select ts , floor(asct1) from ( select "
+ sql += "%s as asct1, " % base_fun_1
+ sql += "%s as asct2, " % base_fun_2
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(100)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 1-2 as base_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ sql = "select ts , abs(asct1) from ( select "
+ sql += "%s as asct1, " % base_fun_1
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s )" % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.unionall_or_union)
+ sql += "select ts , asct2 from ( select "
+ sql += "%s as asct2, " % base_fun_2
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ #sql += "%s " % random.choice(having_support)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15437 tdSql.query(sql)
+ #TD-15437 self.cur1.execute(sql)
+
+ tdSql.query("select 1-3 as base_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ sql = "select ts , min(asct1) from ( select "
+ sql += "%s as asct1, ts ," % base_fun_1
+ sql += "%s as asct2, " % base_fun_2
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s select " % random.choice(self.unionall_or_union)
+ sql += "%s as asct2, ts ," % base_fun_2
+ sql += "%s as asct1, " % base_fun_1
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15473 tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 1-4 as base_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ sql = "select ts , asct1 from ( select t1.ts as ts,"
+ sql += "%s, " % base_fun_join_1
+ sql += "%s as asct1, " % base_fun_join_2
+ sql += "%s, " % base_fun_join_1
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "and %s " % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(100)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 1-5 as base_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ sql = "select ts ,"
+ sql += "%s, " % base_fun_1
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s " % base_fun_2
+ sql += " from ( select * from regular_table_1 ) where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += " ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(100)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 1-6 as base_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ sql = "select ts , max(asct1) from ( select t1.ts as ts,"
+ sql += "%s, " % base_fun_join_1
+ sql += "%s as asct1, " % base_fun_join_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "%s, " % base_fun_join_1
+ sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "and %s )" % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 1-7 as base_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ sql = "select ts , abs(asct1) from ( select "
+ sql += "%s as asct1, ts ," % base_fun_1
+ sql += "%s as asct2, " % base_fun_2
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.t_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(300)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 1-8 as base_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ sql = "select ts,floor(asct1) "
+ sql += "from ( select "
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s as asct1, ts ," % base_fun_1
+ sql += "%s as asct2, " % base_fun_2
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.t_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(300)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 1-9 as base_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ sql = "select ts , max(asct1) from ( select t1.ts as ts,"
+ sql += "%s, " % base_fun_join_1
+ sql += "%s as asct1, " % base_fun_join_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += "and %s " % random.choice(self.t_u_where)
+ sql += "and %s " % random.choice(self.t_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ self.restartDnodes()
+ tdSql.query("select 1-10 as base_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ sql = "select ts , min(asct1) from ( select "
+ sql += "%s as asct1, ts ," % base_fun_1
+ sql += "%s as asct2, " % base_fun_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") %s " % random.choice(self.unionall_or_union)
+ sql += "select ts , max(asct2) from ( select "
+ sql += "%s as asct1, ts ," % base_fun_1
+ sql += "%s as asct2, " % base_fun_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15437 tdSql.query(sql)
+ #TD-15437 self.cur1.execute(sql)
+
+ #3 inter union not support
+ tdSql.query("select 1-11 as base_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ sql = "select ts , min(asct1), max(asct2) from ( select "
+ sql += "%s as asct1, ts ," % base_fun_1
+ sql += "%s as asct2, " % base_fun_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ #sql += "%s " % random.choice(limit1_where)
+ sql += " %s " % random.choice(self.unionall_or_union)
+ sql += " select "
+ sql += "%s as asct1, ts ," % base_fun_1
+ sql += "%s as asct2, " % base_fun_2
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15837 tdSql.query(sql)
+ # self.cur1.execute(sql)
+
+ tdSql.query("select 1-12 as base_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ sql = "select ts , max(asct1) from ( select t1.ts as ts,"
+ sql += "%s, " % base_fun_join_1
+ sql += "%s as asct1, " % base_fun_join_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_u_where)
+ sql += "and %s " % random.choice(self.t_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 1-13 as base_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ sql = "select ts ,"
+ sql += "%s, " % base_fun_1
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s " % base_fun_2
+ sql += "%s " % random.choice(self.t_select)
+ sql += " from ( select * from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(300)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 1-14 as base_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ sql = "select avg(asct1),count(asct2) from ( select "
+ sql += "%s as asct1, " % base_fun_1
+ sql += "%s as asct2" % base_fun_2
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.partiton_where)
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] )
+ sql += " ) ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 1-15 as base_nest from stable_1 limit 1;")
+ for i in range(self.fornum):
+ sql = "select ts , max(asct1) from ( select t1.ts as ts,"
+ sql += "%s, " % base_fun_join_1
+ sql += "%s as asct1, " % base_fun_join_2
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.%s " % random.choice(self.q_select)
+ sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += " and %s " % random.choice(self.qt_u_or_where)
+ sql += "%s " % random.choice(self.partiton_where_j)
+ sql += "%s " % random.choice(self.slimit1_where)
+ sql += ") "
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s ;" % random.choice(self.limit_u_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ #taos -f sql
+ startTime_taos_f = time.time()
+ print("taos -f %s sql start!" %baselist)
+ taos_cmd1 = "taos -f %s/%s.sql" % (self.testcasePath,self.testcaseFilename)
+ _ = subprocess.check_output(taos_cmd1, shell=True).decode("utf-8")
+ print("taos -f %s sql over!" %baselist)
+ endTime_taos_f = time.time()
+ print("taos_f total time %ds" % (endTime_taos_f - startTime_taos_f))
+
+ print("=========%s====over=============" %baselist)
+
+ def function_before_26(self):
+
+ print('=====================2.6 old function start ===========')
+ os.system("rm -rf %s/%s.sql" % (self.testcasePath,self.testcaseFilename))
+
+ self.dropandcreateDB_random("%s" %self.db_nest, 1)
+
+ #1 select * from (select column form regular_table where <\>\in\and\or order by)
+ tdSql.query("select 1-1 from stable_1;")
+ for i in range(self.fornum):
+ #sql = "select ts , * from ( select " ===暂时不支持select * ,用下面这一行
+ sql = "select ts from ( select "
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(100)
+ self.cur1.execute(sql)
+
+ #1 outer union not support
+ #self.dropandcreateDB_random("%s" %db, 1)
+ tdSql.query("select 1-2 from stable_1;")
+ for i in range(self.fornum):
+ #sql = "select ts , * from ( select "
+ sql = "select ts from ( select "
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") union "
+ #sql += "select ts , * from ( select "
+ sql += "select ts from ( select "
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(100)
+ self.cur1.execute(sql)
+
+ #self.dropandcreateDB_random("%s" %db, 1)
+ tdSql.query("select 1-2 from stable_1;")
+ for i in range(self.fornum):
+ #sql = "select ts , * from ( select "
+ sql = "select ts from ( select "
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") union all "
+ #sql += "select ts , * from ( select "
+ sql += "select ts from ( select "
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(200)
+ self.cur1.execute(sql)
+
+ #1 inter union not support
+ tdSql.query("select 1-3 from stable_1;")
+ for i in range(self.fornum):
+ #sql = "select ts , * from ( select "
+ sql = "select ts from ( select "
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += ""
+ sql += " union select "
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15607 tdSql.query(sql)
+ #tdSql.checkRows(200)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 1-3 from stable_1;")
+ for i in range(self.fornum):
+ #sql = "select ts , * from ( select "
+ sql = "select ts from ( select "
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += " union all select "
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15607 tdSql.query(sql)
+ # tdSql.checkRows(300)
+ #self.cur1.execute(sql)
+
+ #join:select * from (select column form regular_table1,regular_table2 where t1.ts=t2.ts and <\>\in\and\or order by)
+ #self.dropandcreateDB_random("%s" %db, 1)
+ tdSql.query("select 1-4 from stable_1;")
+ for i in range(self.fornum):
+ #sql = "select ts , * from ( select t1.ts ,"
+ sql = "select * from ( select t1.ts ,"
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "and %s " % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(100)
+ self.cur1.execute(sql)
+
+
+ #2 select column from (select * form regular_table ) where <\>\in\and\or order by
+ #self.dropandcreateDB_random("%s" %db, 1)
+ tdSql.query("select 2-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select ts ,"
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s " % random.choice(self.q_select)
+ sql += " from ( select * from regular_table_1 ) where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += " ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(100)
+ self.cur1.execute(sql)
+
+ #join: select column from (select column form regular_table1,regular_table2 )where t1.ts=t2.ts and <\>\in\and\or order by
+ #cross join not supported yet
+ tdSql.query("select 2-2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select ts , * from ( select t1.ts ,"
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from regular_table_1 t1 , regular_table_2 t2 ) where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ #sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.error(sql)
+
+ #3 select * from (select column\tag form stable where <\>\in\and\or order by )
+ #self.dropandcreateDB_random("%s" %db, 1)
+ tdSql.query("select 3-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.t_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(300)
+ self.cur1.execute(sql)
+ tdSql.query("select 3-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select ts, "
+ sql += "%s " % random.choice(self.s_r_select)
+ sql += "from ( select "
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.t_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(300)
+ self.cur1.execute(sql)
+
+ # select ts,* from (select column\tag form stable1,stable2 where t1.ts = t2.ts and <\>\in\and\or order by )
+ #self.dropandcreateDB_random("%s" %db, 1)
+ tdSql.query("select 3-2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select ts , * from ( select t1.ts , "
+ sql += "t1.%s, " % random.choice(self.s_s_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.s_s_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # TD-15609 tdSql.query(sql)
+ # tdSql.checkRows(100)
+ #self.cur1.execute(sql)
+
+ #3 outer union not support
+ self.restartDnodes()
+ tdSql.query("select 3-3 from stable_1;")
+ for i in range(self.fornum):
+ #sql = "select ts , * from ( select "
+ sql = "select ts from ( select "
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") union "
+ sql += "select ts from ( select "
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(300)
+ self.cur1.execute(sql)
+ for i in range(self.fornum):
+ #sql = "select ts , * from ( select "
+ sql = "select ts from ( select "
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") union all "
+ sql += "select ts from ( select "
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(600)
+ self.cur1.execute(sql)
+
+ #3 inter union not support
+ tdSql.query("select 3-4 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select ts , * from ( select "
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += " %s " % random.choice(self.unionall_or_union)
+ sql += " select "
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from stable_2 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ")"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15837 tdSql.query(sql)
+ # self.cur1.execute(sql)
+
+ #join:select * from (select column form stable1,stable2 where t1.ts=t2.ts and <\>\in\and\or order by)
+ tdSql.query("select 3-5 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select t1.ts ,"
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_u_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # TD-15609 tdSql.query(sql)
+ # tdSql.checkRows(100)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 3-6 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select t1.ts ,"
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t1.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.%s, " % random.choice(self.q_select)
+ sql += "t2.ts from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += ");"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # TD-15609 同上 tdSql.query(sql)
+ # tdSql.checkRows(100)
+ #self.cur1.execute(sql)
+
+ #4 select column from (select * form stable where <\>\in\and\or order by )
+ #self.dropandcreateDB_random("%s" %db, 1)
+ tdSql.query("select 4-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select ts , "
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "%s " % random.choice(self.t_select)
+ sql += " from ( select * from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(300)
+ self.cur1.execute(sql)
+
+ #5 select distinct column\tag from (select * form stable where <\>\in\and\or order by limit offset )
+ tdSql.query("select 5-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select "
+ sql += "%s " % random.choice(self.dqt_select)
+ sql += " from ( select * from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15500 tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ #5-1 select distinct column\tag from (select calc form stable where <\>\in\and\or order by limit offset )
+ tdSql.query("select 5-2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select distinct c5_1 "
+ sql += " from ( select "
+ sql += "%s " % random.choice(self.calc_select_in_ts)
+ sql += " as c5_1 from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ #sql += "%s " % random.choice(order_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ #tdSql.checkRows(1)有的函数还没有提交,会不返回结果,先忽略
+ self.cur1.execute(sql)
+
+ #6-error select * from (select distinct(tag) form stable where <\>\in\and\or order by limit )
+ tdSql.query("select 6-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s " % random.choice(self.dt_select)
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.error(sql)
+ tdSql.query("select 6-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s " % random.choice(self.dt_select)
+ sql += " from stable_1 where "
+ sql += "%s ) ;" % random.choice(self.qt_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ #7-error select * from (select distinct(tag) form stable where <\>\in\and\or order by limit )
+ tdSql.query("select 7-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s " % random.choice(self.dq_select)
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s " % random.choice([self.limit_where[0] , self.limit_where[1]] )
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.error(sql) #distinct 和 order by 不能混合使用
+ tdSql.query("select 7-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s " % random.choice(self.dq_select)
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ #sql += "%s " % random.choice(order_desc_where)
+ sql += "%s " % random.choice([self.limit_where[0] , self.limit_where[1]] )
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(1)
+ self.cur1.execute(sql)
+
+ #calc_select,TWA/Diff/Derivative/Irate are not allowed to apply to super table directly
+ #8 select * from (select ts,calc form ragular_table where <\>\in\and\or order by )
+
+ # dcDB = self.dropandcreateDB_random("%s" %db, 1)
+ tdSql.query("select 8-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select ts ,"
+ sql += "%s " % random.choice(self.calc_select_support_ts)
+ sql += "from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql) # 聚合函数不在可以和ts一起使用了 DB error: Not a single-group group function
+ self.cur1.execute(sql)
+ tdSql.query("select 8-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s " % random.choice(self.calc_select_not_support_ts)
+ sql += "from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15651 tdSql.query(sql) # 聚合函数不在可以和ts一起使用了 DB error: Not a single-group group function
+ #self.cur1.execute(sql)
+
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s " % random.choice(self.calc_select_in_ts)
+ sql += "from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ #sql += "%s " % random.choice(order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 8-2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select t1.ts, "
+ sql += "%s " % random.choice(self.calc_select_in_support_ts_j)
+ sql += "from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)# 聚合函数不在可以和ts一起使用了 DB error: Not a single-group group function
+ self.cur1.execute(sql)
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s " % random.choice(self.calc_select_in_not_support_ts_j)
+ sql += "from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15651 tdSql.query(sql)
+ ##top返回结果有问题 tdSql.checkRows(1)
+ #self.cur1.execute(sql)
+
+ #9 select * from (select ts,calc form stable where <\>\in\and\or order by )
+ # self.dropandcreateDB_random("%s" %db, 1)
+ tdSql.query("select 9-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s " % random.choice(self.calc_select_not_support_ts)
+ sql += "from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15651 tdSql.query(sql)
+ # self.cur1.execute(sql)
+ tdSql.query("select 9-2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select ts ,"
+ sql += "%s " % random.choice(self.calc_select_support_ts)
+ sql += "from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 9-3 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s " % random.choice(self.calc_select_in_not_support_ts_j)
+ sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += " and %s " % random.choice(self.qt_u_or_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15651 tdSql.query(sql)
+ #self.cur1.execute(sql)
+ tdSql.query("select 9-4 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select t1.ts,"
+ sql += "%s " % random.choice(self.calc_select_in_support_ts_j)
+ sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += " and %s " % random.choice(self.qt_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ #10 select calc from (select * form regualr_table where <\>\in\and\or order by )
+ tdSql.query("select 10-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select "
+ sql += "%s " % random.choice(self.calc_select_in_ts)
+ sql += "as calc10_1 from ( select * from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(1)
+ self.cur1.execute(sql)
+
+ #10-1 select calc from (select * form regualr_table where <\>\in\and\or order by )
+ # rsDn = self.restartDnodes()
+ # self.dropandcreateDB_random("%s" %db, 1)
+ # rsDn = self.restartDnodes()
+ tdSql.query("select 10-2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select "
+ sql += "%s " % random.choice(self.calc_select_all)
+ sql += "as calc10_2 from ( select * from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15651 tdSql.query(sql)
+ # tdSql.checkRows(1)
+ #self.cur1.execute(sql)
+
+ #10-2 select calc from (select * form regualr_tables where <\>\in\and\or order by )
+ tdSql.query("select 10-3 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select "
+ sql += "%s as calc10_3 " % random.choice(self.calc_select_all)
+ sql += " from ( select * from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += " and %s " % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ sql += "%s ;" % random.choice(self.limit1_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15651 tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 10-4 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select "
+ sql += "%s as calc10_4 " % random.choice(self.calc_select_all)
+ sql += " from ( select * from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_or_where)
+ sql += " and %s " % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ sql += "%s ;" % random.choice(self.limit_u_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15651 tdSql.query(sql)
+ # tdSql.checkRows(1)
+ #self.cur1.execute(sql)
+
+ #11 select calc from (select * form stable where <\>\in\and\or order by limit )
+ tdSql.query("select 11-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select "
+ sql += "%s " % random.choice(self.calc_select_in_ts)
+ sql += "as calc11_1 from ( select * from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ tdSql.checkRows(1)
+ self.cur1.execute(sql)
+
+ #11-1 select calc from (select * form stable where <\>\in\and\or order by limit )
+ tdSql.query("select 11-2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select "
+ sql += "%s " % random.choice(self.calc_select_all)
+ sql += "as calc11_1 from ( select * from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15651 tdSql.query(sql)
+ #self.cur1.execute(sql)
+ #不好计算结果 tdSql.checkRows(1)
+
+ #11-2 select calc from (select * form stables where <\>\in\and\or order by limit )
+ tdSql.query("select 11-3 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select "
+ sql += "%s " % random.choice(self.calc_select_all)
+ sql += "as calc11_1 from ( select * from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ sql += "%s ;" % random.choice(self.limit_u_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15651 tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 11-4 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select "
+ sql += "%s " % random.choice(self.calc_select_all)
+ sql += "as calc11_1 from ( select * from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.qt_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ sql += "%s ;" % random.choice(self.limit_u_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdLog.info(len(sql))
+ #TD-15651 tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ #12 select calc-diff from (select * form regualr_table where <\>\in\and\or order by limit )
+ ##self.dropandcreateDB_random("%s" %db, 1)
+ tdSql.query("select 12-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select "
+ sql += "%s " % random.choice(self.calc_calculate_regular)
+ sql += " from ( select * from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] )
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ ##目前derivative不支持 tdSql.query(sql)
+ # tdSql.checkRows(1)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 12-2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select "
+ sql += "%s " % random.choice(self.calc_calculate_regular)
+ sql += " from ( select * from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] )
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #目前derivative不支持 tdSql.query(sql)
+ # tdSql.checkRows(1)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 12-2.2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select "
+ sql += "%s " % random.choice(self.calc_calculate_regular)
+ sql += " from ( select * from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] )
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #目前derivative不支持 tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ #12-1 select calc-diff from (select * form stable where <\>\in\and\or order by limit )
+ tdSql.query("select 12-3 from stable_1;")
+ self.restartDnodes()
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s " % random.choice(self.calc_calculate_regular)
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.group_where)
+ sql += ") "
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] )
+ sql += " ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #目前derivative不支持 tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 12-4 from stable_1;")
+ #join query does not support group by
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s " % random.choice(self.calc_calculate_regular_j)
+ sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += "%s " % random.choice(self.group_where_j)
+ sql += ") "
+ #sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] )
+ sql += " ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #tdSql.query(sql) 目前de函数不支持,另外看看需要不需要将group by和pari by分开
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 12-5 from stable_1;")
+ #join query does not support group by
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s " % random.choice(self.calc_calculate_regular_j)
+ sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.qt_u_or_where)
+ sql += "%s " % random.choice(self.group_where_j)
+ sql += ") "
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] )
+ sql += " ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #derivative not support tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+
+ #13 select calc-diff as diffns from (select * form stable where <\>\in\and\or order by limit )
+ tdSql.query("select 13-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select "
+ sql += "%s " % random.choice(self.calc_calculate_regular)
+ sql += " as calc13_1 from ( select * from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.orders_desc_where)
+ sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] )
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #derivative not support tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ #14 select * from (select calc_aggregate_alls as agg from stable where <\>\in\and\or group by order by slimit soffset )
+ # TD-5955 select * from ( select count (q_double) from stable_1 where t_bool = true or t_bool = false group by loc order by ts asc slimit 1 ) ;
+ tdSql.query("select 14-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s as calc14_1, " % random.choice(self.calc_aggregate_all)
+ sql += "%s as calc14_2, " % random.choice(self.calc_aggregate_all)
+ sql += "%s " % random.choice(self.calc_aggregate_all)
+ sql += " as calc14_3 from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.group_where)
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s " % random.choice(self.slimit1_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15678 tdSql.query(sql)
+ # tdSql.checkRows(1)
+ #self.cur1.execute(sql)
+
+ # error group by in out query
+ tdSql.query("select 14-2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s as calc14_1, " % random.choice(self.calc_aggregate_all)
+ sql += "%s as calc14_2, " % random.choice(self.calc_aggregate_all)
+ sql += "%s " % random.choice(self.calc_aggregate_all)
+ sql += " as calc14_3 from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.group_where)
+ sql += "%s " % random.choice(self.having_support)
+ sql += "%s " % random.choice(self.orders_desc_where)
+ sql += "%s " % random.choice(self.slimit1_where)
+ sql += ") "
+ sql += "%s " % random.choice(self.group_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15678 tdSql.query(sql)
+ # tdSql.checkRows(1)
+ #self.cur1.execute(sql)
+
+ #14-2 select * from (select calc_aggregate_all_js as agg from stables where <\>\in\and\or group by order by slimit soffset )
+ tdSql.query("select 14-3 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s as calc14_1, " % random.choice(self.calc_aggregate_all_j)
+ sql += "%s as calc14_2, " % random.choice(self.calc_aggregate_all_j)
+ sql += "%s " % random.choice(self.calc_aggregate_all_j)
+ sql += " as calc14_3 from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += "%s " % random.choice(self.partiton_where_j)
+ sql += "%s " % random.choice(self.slimit1_where)
+ sql += ") "
+ sql += "%s ;" % random.choice(self.limit_u_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 14-4 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s as calc14_1, " % random.choice(self.calc_aggregate_all_j)
+ sql += "%s as calc14_2, " % random.choice(self.calc_aggregate_all_j)
+ sql += "%s " % random.choice(self.calc_aggregate_all_j)
+ sql += " as calc14_3 from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.qt_u_or_where)
+ sql += "%s " % random.choice(self.partiton_where_j)
+ sql += "%s " % random.choice(self.slimit1_where)
+ sql += ") "
+ sql += "%s ;" % random.choice(self.limit_u_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ #15 select * from (select calc_aggregate_regulars as agg from regular_table where <\>\in\and\or order by slimit soffset )
+ tdSql.query("select 15-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_regular)
+ sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_regular)
+ sql += "%s " % random.choice(self.calc_aggregate_regular)
+ sql += " as calc15_3 from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.group_where_regular)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #tdSql.query(sql) #Invalid function name: twa'
+ # tdSql.checkRows(1)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 15-2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_regular_j)
+ sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_regular_j)
+ sql += "%s " % random.choice(self.calc_aggregate_regular_j)
+ sql += " as calc15_3 from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "%s " % random.choice(self.group_where_regular_j)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ sql += "%s ;" % random.choice(self.limit_u_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #tdSql.query(sql) #Invalid function name: twa'
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 15-2.2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_regular_j)
+ sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_regular_j)
+ sql += "%s " % random.choice(self.calc_aggregate_regular_j)
+ sql += " as calc15_3 from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.group_where_regular_j)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ sql += "%s ;" % random.choice(self.limit_u_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #tdSql.query(sql) #Invalid function name: twa'
+ #self.cur1.execute(sql)
+
+ self.restartDnodes()
+ tdSql.query("select 15-3 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_groupbytbname)
+ sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_groupbytbname)
+ sql += "%s " % random.choice(self.calc_aggregate_groupbytbname)
+ sql += " as calc15_3 from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.group_where)
+ sql += "%s " % random.choice(self.having_support)
+ sql += "%s " % random.choice(self.order_desc_where)
+ sql += ") "
+ sql += "order by calc15_1 "
+ sql += "%s " % random.choice(self.limit_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #tdSql.query(sql) #Invalid function name: twa',可能还的去掉order by
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 15-4 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_groupbytbname_j)
+ sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_groupbytbname_j)
+ sql += "%s " % random.choice(self.calc_aggregate_groupbytbname_j)
+ sql += " as calc15_3 from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += "%s " % random.choice(self.group_where_j)
+ sql += "%s " % random.choice(self.having_support_j)
+ #sql += "%s " % random.choice(orders_desc_where)
+ sql += ") "
+ sql += "order by calc15_1 "
+ sql += "%s " % random.choice(self.limit_u_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #tdSql.query(sql) #'Invalid function name: irate'
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 15-4.2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_groupbytbname_j)
+ sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_groupbytbname_j)
+ sql += "%s " % random.choice(self.calc_aggregate_groupbytbname_j)
+ sql += " as calc15_3 from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.qt_u_or_where)
+ sql += "%s " % random.choice(self.group_where_j)
+ sql += "%s " % random.choice(self.having_support_j)
+ sql += "%s " % random.choice(self.orders_desc_where)
+ sql += ") "
+ sql += "order by calc15_1 "
+ sql += "%s " % random.choice(self.limit_u_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15678 #tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 15-5 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_groupbytbname)
+ sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_groupbytbname)
+ sql += "%s " % random.choice(self.calc_aggregate_groupbytbname)
+ sql += " as calc15_3 from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.group_where)
+ sql += ") "
+ sql += "order by calc15_1 "
+ sql += "%s " % random.choice(self.limit_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #tdSql.query(sql) #'Invalid function name: irate'
+ #self.cur1.execute(sql)
+
+ #16 select * from (select calc_aggregate_regulars as agg from regular_table where <\>\in\and\or order by limit offset )
+ #self.dropandcreateDB_random("%s" %db, 1)
+ tdSql.query("select 16-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s as calc16_0 , " % random.choice(self.calc_calculate_all)
+ sql += "%s as calc16_1 , " % random.choice(self.calc_aggregate_all)
+ sql += "%s as calc16_2 " % random.choice(self.calc_select_in)
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.group_where)
+ #sql += "%s " % random.choice(having_support)having和 partition不能混合使用
+ sql += ") "
+ sql += "order by calc16_0 "
+ sql += "%s " % random.choice(self.limit1_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #TD-15651 tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 16-2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s as calc16_0 " % random.choice(self.calc_calculate_all_j)
+ sql += ", %s as calc16_1 " % random.choice(self.calc_aggregate_all_j)
+ #sql += ", %s as calc16_2 " % random.choice(self.calc_select_in_j)
+ sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += ") "
+ sql += "order by calc16_0 "
+ sql += "%s " % random.choice(self.limit1_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 16-2.2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s as calc16_0 " % random.choice(self.calc_calculate_all_j)
+ sql += ", %s as calc16_1 " % random.choice(self.calc_aggregate_all_j)
+ sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.qt_u_or_where)
+ sql += ") "
+ sql += "order by calc16_0 "
+ sql += "%s " % random.choice(self.limit1_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 16-3 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s as calc16_1 " % random.choice(self.calc_calculate_regular)
+ sql += " from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "limit 2 ) "
+ sql += "%s " % random.choice(self.limit1_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #tdSql.query(sql)#Invalid function name: derivative'
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 16-4 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s as calc16_1 " % random.choice(self.calc_calculate_regular_j)
+ sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "limit 2 ) "
+ sql += "%s " % random.choice(self.limit1_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #tdSql.query(sql)#Invalid function name: derivative'
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 16-4.2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s as calc16_1 " % random.choice(self.calc_calculate_regular_j)
+ sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_or_where)
+ sql += "limit 2 ) "
+ sql += "%s " % random.choice(self.limit1_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #tdSql.query(sql)#Invalid function name: derivative'
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 16-5 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s as calc16_1 , " % random.choice(self.calc_calculate_all)
+ sql += "%s as calc16_1 , " % random.choice(self.calc_calculate_regular)
+ sql += "%s as calc16_2 " % random.choice(self.calc_select_all)
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.group_where)
+ #sql += "%s " % random.choice(having_support)
+ sql += ") "
+ sql += "order by calc16_1 "
+ sql += "%s " % random.choice(self.limit1_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ # tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 16-6 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s as calc16_1 " % random.choice(self.calc_calculate_groupbytbname)
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.group_where)
+ sql += "limit 2 ) "
+ sql += "%s " % random.choice(self.limit1_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #Invalid function name: derivative' tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 16-7 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s as calc16_1 " % random.choice(self.calc_calculate_groupbytbname_j)
+ sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += "limit 2 ) "
+ sql += "%s " % random.choice(self.limit1_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #Invalid function name: derivative' tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 16-8 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s as calc16_1 " % random.choice(self.calc_calculate_groupbytbname_j)
+ sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.qt_u_or_where)
+ sql += "limit 2 ) "
+ sql += "%s " % random.choice(self.limit1_where)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #Invalid function name: derivative' tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ #17 select apercentile from (select calc_aggregate_alls form regualr_table or stable where <\>\in\and\or interval_sliding group by having order by limit offset )interval_sliding
+ #self.dropandcreateDB_random("%s" %db, 1)
+ tdSql.query("select 17-1 from stable_1;")
+ for i in range(self.fornum):
+ #this is having_support , but tag-select cannot mix with last_row,other select can
+ sql = "select apercentile(cal17_0, %d)/10 ,apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal17_0 , " % random.choice(self.calc_calculate_all)
+ sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all)
+ sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all)
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.partiton_where)
+ sql += "%s " % random.choice(self.interval_sliding)
+ #sql += "%s " % random.choice(having_support)
+ #sql += "%s " % random.choice(order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") "
+ #sql += "%s " % random.choice(interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 17-2 from stable_1;")
+ for i in range(self.fornum):
+ #this is having_support , but tag-select cannot mix with last_row,other select can
+ sql = "select apercentile(cal17_0, %d)/10 ,apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal17_0 , " % random.choice(self.calc_calculate_all_j)
+ sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j)
+ sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j)
+ sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += "%s " % random.choice(self.interval_sliding)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ #sql += "%s " % random.choice(interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 17-2.2 from stable_1;")
+ for i in range(self.fornum):
+ #this is having_support , but tag-select cannot mix with last_row,other select can
+ sql = "select apercentile(cal17_0, %d)/10 ,apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal17_0 , " % random.choice(self.calc_calculate_all_j)
+ sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j)
+ sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j)
+ sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.qt_u_or_where)
+ sql += "%s " % random.choice(self.interval_sliding)
+ #sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ #sql += "%s " % random.choice(self.interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ self.restartDnodes()
+ tdSql.query("select 17-3 from stable_1;")
+ for i in range(self.fornum):
+ #this is having_tagnot_support , because tag-select cannot mix with last_row...
+ sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all)
+ sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all)
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.partiton_where)
+ sql += "%s " % random.choice(self.interval_sliding)
+ #sql += "%s " % random.choice(self.having_tagnot_support)
+ #sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") "
+ #sql += "%s " % random.choice(self.interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 17-4 from stable_1;")
+ for i in range(self.fornum):
+ #this is having_tagnot_support , because tag-select cannot mix with last_row...
+ sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j)
+ sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j)
+ sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += "%s " % random.choice(self.interval_sliding)
+ #sql += "%s " % random.choice(order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ #sql += "%s " % random.choice(interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 17-4.2 from stable_1;")
+ for i in range(self.fornum):
+ #this is having_tagnot_support , because tag-select cannot mix with last_row...
+ sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j)
+ sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j)
+ sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.qt_u_or_where)
+ sql += "%s " % random.choice(self.interval_sliding)
+ #sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ #sql += "%s " % random.choice(self.interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 17-5 from stable_1;")
+ for i in range(self.fornum):
+ #having_not_support
+ sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all)
+ sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all)
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.partiton_where)
+ sql += "%s " % random.choice(self.interval_sliding)
+ # sql += "%s " % random.choice(self.having_not_support)
+ # sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") "
+ #sql += "%s " % random.choice(self.interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 17-6 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all)
+ sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all)
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.interval_sliding)
+ #sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") "
+ #sql += "%s " % random.choice(interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 17-7 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j)
+ sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j)
+ sql += " from stable_1_1 t1, stable_1_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "%s " % random.choice(self.interval_sliding)
+ #sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") "
+ #sql += "%s " % random.choice(interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 17-7.2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j)
+ sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j)
+ sql += " from stable_1_1 t1, stable_1_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.interval_sliding)
+ #sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") "
+ #sql += "%s " % random.choice(interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ self.restartDnodes()
+ tdSql.query("select 17-8 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all)
+ sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all)
+ sql += " from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.interval_sliding)
+ #sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") "
+ #sql += "%s " % random.choice(interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 17-9 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j)
+ sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j)
+ sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "%s " % random.choice(self.interval_sliding)
+ #sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ #sql += "%s " % random.choice(interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 17-10 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal17_1, %d)/1000 ,apercentile(cal17_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal17_1 ," % random.choice(self.calc_aggregate_all_j)
+ sql += "%s as cal17_2 " % random.choice(self.calc_aggregate_all_j)
+ sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.interval_sliding)
+ #sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ #sql += "%s " % random.choice(interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ #18 select apercentile from (select calc_aggregate_alls form regualr_table or stable where <\>\in\and\or session order by limit )interval_sliding
+ tdSql.query("select 18-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all)
+ sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all)
+ sql += " from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.session_where)
+ #sql += "%s " % random.choice(self.fill_where)
+ #sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") "
+ #sql += "%s " % random.choice(interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 18-2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j)
+ sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j)
+ sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "%s " % random.choice(self.session_u_where)
+ #sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ #sql += "%s " % random.choice(interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 18-2.2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j)
+ sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j)
+ sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.session_u_where)
+ #sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ #sql += "%s " % random.choice(self.interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ self.restartDnodes()
+ tdSql.query("select 18-3 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all)
+ sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all)
+ sql += " from stable_1_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.session_where)
+ #sql += "%s " % random.choice(self.fill_where)
+ #sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") "
+ #sql += "%s " % random.choice(self.interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 18-4 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j)
+ sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j)
+ sql += " from stable_1_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "%s " % random.choice(self.session_u_where)
+ #sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ #sql += "%s " % random.choice(self.interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 18-4.2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j)
+ sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j)
+ sql += " from stable_1_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.session_u_where)
+ #sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ #sql += "%s " % random.choice(self.interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 18-5 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all)
+ sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all)
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.session_where)
+ #sql += "%s " % random.choice(self.fill_where)
+ #sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") "
+ #sql += "%s " % random.choice(interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 18-6 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j)
+ sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j)
+ sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.t_join_where)
+ sql += "%s " % random.choice(self.session_u_where)
+ #sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ #sql += "%s " % random.choice(self.interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 18-7 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j)
+ sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j)
+ sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.qt_u_or_where)
+ sql += "%s " % random.choice(self.session_u_where)
+ #sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ #sql += "%s " % random.choice(self.interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ #19 select apercentile from (select calc_aggregate_alls form regualr_table or stable where <\>\in\and\or session order by limit )interval_sliding
+ #self.dropandcreateDB_random("%s" %db, 1)
+ tdSql.query("select 19-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all)
+ sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all)
+ sql += " from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.state_window)
+ #sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") "
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 19-2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j)
+ sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j)
+ sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ sql += "%s " % random.choice(self.state_u_window)
+ #sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 19-2.2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j)
+ sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j)
+ sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_or_where)
+ sql += "%s " % random.choice(self.state_u_window)
+ #sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 19-3 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all)
+ sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all)
+ sql += " from stable_1_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.state_window)
+ #sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") "
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 19-4 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j)
+ sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j)
+ sql += " from stable_1_1 t1, stable_1_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ #sql += "%s " % random.choice(self.state_window)
+ #sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 19-4.2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j)
+ sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j)
+ sql += " from stable_1_1 t1, stable_1_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_or_where)
+ #sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 19-5 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all)
+ sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all)
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += "%s " % random.choice(self.state_window)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit1_where)
+ sql += ") "
+ sql += "%s " % random.choice(self.interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.error(sql) #'STATE_WINDOW not support for super table query'
+
+ tdSql.query("select 19-6 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j)
+ sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j)
+ sql += " from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.q_u_where)
+ #sql += "%s " % random.choice(self.state_window)
+ #sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ #sql += "%s " % random.choice(self.interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ tdSql.query("select 19-7 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select apercentile(cal19_1, %d)/1000 ,apercentile(cal19_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
+ sql += "%s as cal19_1 ," % random.choice(self.calc_aggregate_all_j)
+ sql += "%s as cal19_2 " % random.choice(self.calc_aggregate_all_j)
+ sql += " from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s " % random.choice(self.qt_u_or_where)
+ #sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ #sql += "%s " % random.choice(self.interval_sliding)
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ #20 select * from (select calc_select_fills form regualr_table or stable where <\>\in\and\or fill_where group by order by limit offset )
+ #self.dropandcreateDB_random("%s" %db, 1)
+ tdSql.query("select 20-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s , " % random.choice(self.calc_select_fill)
+ sql += "%s ," % random.choice(self.calc_select_fill)
+ sql += "%s " % random.choice(self.calc_select_fill)
+ sql += " from stable_1 where "
+ sql += "%s " % random.choice(self.interp_where)
+ sql += "%s " % random.choice(self.fill_where)
+ sql += "%s " % random.choice(self.group_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit_where)
+ sql += ") "
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #interp不支持 tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ rsDn = self.restartDnodes()
+ tdSql.query("select 20-2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s , " % random.choice(self.calc_select_fill_j)
+ sql += "%s ," % random.choice(self.calc_select_fill_j)
+ sql += "%s " % random.choice(self.calc_select_fill_j)
+ sql += " from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s and " % random.choice(self.t_join_where)
+ sql += "%s " % random.choice(self.interp_where_j)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #interp不支持 tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 20-2.2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s , " % random.choice(self.calc_select_fill_j)
+ sql += "%s ," % random.choice(self.calc_select_fill_j)
+ sql += "%s " % random.choice(self.calc_select_fill_j)
+ sql += " from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
+ sql += "%s and " % random.choice(self.qt_u_or_where)
+ sql += "%s " % random.choice(self.interp_where_j)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #interp不支持 tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 20-3 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s , " % random.choice(self.calc_select_fill)
+ sql += "%s ," % random.choice(self.calc_select_fill)
+ sql += "%s " % random.choice(self.calc_select_fill)
+ sql += " from stable_1 where "
+ sql += "%s " % self.interp_where[2]
+ sql += "%s " % random.choice(self.fill_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit_where)
+ sql += ") "
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #interp不支持 tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 20-4 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s , " % random.choice(self.calc_select_fill_j)
+ sql += "%s ," % random.choice(self.calc_select_fill_j)
+ sql += "%s " % random.choice(self.calc_select_fill_j)
+ sql += " from stable_1 t1, table_1 t2 where t1.ts = t2.ts and "
+ #sql += "%s and " % random.choice(self.t_join_where)
+ sql += "%s " % self.interp_where_j[random.randint(0,5)]
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #interp不支持 tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 20-4.2 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s , " % random.choice(self.calc_select_fill_j)
+ sql += "%s ," % random.choice(self.calc_select_fill_j)
+ sql += "%s " % random.choice(self.calc_select_fill_j)
+ sql += " from stable_1 t1, stable_1_1 t2 where t1.ts = t2.ts and "
+ sql += "%s and " % random.choice(self.qt_u_or_where)
+ sql += "%s " % self.interp_where_j[random.randint(0,5)]
+ sql += "%s " % random.choice(self.fill_where)
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ ##interp不支持 tdSql.error(sql)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 20-5 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s , " % random.choice(self.calc_select_fill)
+ sql += "%s ," % random.choice(self.calc_select_fill)
+ sql += "%s " % random.choice(self.calc_select_fill)
+ sql += " from regular_table_1 where "
+ sql += "%s " % self.interp_where[1]
+ sql += "%s " % random.choice(self.fill_where)
+ sql += "%s " % random.choice(self.order_where)
+ sql += "%s " % random.choice(self.limit_where)
+ sql += ") "
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ ##interp不支持 tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ tdSql.query("select 20-6 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s , " % random.choice(self.calc_select_fill_j)
+ sql += "%s ," % random.choice(self.calc_select_fill_j)
+ sql += "%s " % random.choice(self.calc_select_fill_j)
+ sql += " from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
+ #sql += "%s " % random.choice(self.interp_where_j)
+ sql += "%s " % self.interp_where_j[random.randint(0,5)]
+ sql += "%s " % random.choice(self.order_u_where)
+ sql += "%s " % random.choice(self.limit_u_where)
+ sql += ") "
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ ##interp不支持 tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ #1 select * from (select * from (select * form regular_table where <\>\in\and\or order by limit ))
+ tdSql.query("select 1-1 from stable_1;")
+ for i in range(self.fornum):
+ # sql_start = "select * from ( "
+ # sql_end = ")"
+ for_num = random.randint(1, 15);
+ sql = "select * from (" * for_num
+ sql += "select * from ( select * from ( select "
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += ")) "
+ sql += ")" * for_num
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ sql2 = "select * from ( select * from ( select "
+ sql2 += "%s, " % random.choice(self.s_r_select)
+ sql2 += "%s, " % random.choice(self.q_select)
+ sql2 += "ts from regular_table_1 where "
+ sql2 += "%s " % random.choice(self.q_where)
+ sql2 += ")) "
+ tdLog.info(sql2)
+ tdLog.info(len(sql2))
+ tdSql.query(sql2)
+ self.cur1.execute(sql2)
+
+ self.data_matrix_equal('%s' %sql ,1,10,1,1,'%s' %sql2 ,1,10,1,1)
+ self.data_matrix_equal('%s' %sql ,1,10,1,1,'%s' %sql ,1,10,3,3)
+ self.data_matrix_equal('%s' %sql ,1,10,3,3,'%s' %sql2 ,1,10,3,3)
+
+ for i in range(self.fornum):
+ for_num = random.randint(1, 15);
+ sql = "select ts from (" * for_num
+ sql += "select * from ( select * from ( select "
+ sql += "%s, " % random.choice(self.s_r_select)
+ sql += "%s, " % random.choice(self.q_select)
+ sql += "ts from regular_table_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += ")) "
+ sql += ")" * for_num
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ sql2 = "select * from ( select * from ( select "
+ sql2 += "%s, " % random.choice(self.s_r_select)
+ sql2 += "%s, " % random.choice(self.q_select)
+ sql2 += "ts from regular_table_1 where "
+ sql2 += "%s " % random.choice(self.q_where)
+ sql2 += ")) "
+ tdLog.info(sql2)
+ tdLog.info(len(sql2))
+ tdSql.query(sql2)
+ self.cur1.execute(sql2)
+
+ self.data_matrix_equal('%s' %sql ,1,10,1,1,'%s' %sql2 ,1,10,1,1)
+
+ #2 select * from (select * from (select * form stable where <\>\in\and\or order by limit ))
+ tdSql.query("select 2-1 from stable_1;")
+ for i in range(self.fornum):
+ for_num = random.randint(1, 15);
+ sql = "select * from (" * for_num
+ sql += "select * from ( select * from ( select "
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.qt_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += ")) "
+ sql += ")" * for_num
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ sql2 = "select * from ( select * from ( select "
+ sql2 += "%s, " % random.choice(self.s_s_select)
+ sql2 += "%s, " % random.choice(self.qt_select)
+ sql2 += "ts from stable_1 where "
+ sql2 += "%s " % random.choice(self.q_where)
+ sql2 += ")) "
+ tdLog.info(sql2)
+ tdLog.info(len(sql2))
+ tdSql.query(sql2)
+ self.cur1.execute(sql2)
+
+ self.data_matrix_equal('%s' %sql ,1,10,3,3,'%s' %sql2 ,1,10,3,3)
+
+ for i in range(self.fornum):
+ for_num = random.randint(1, 15);
+ sql = "select ts from (" * for_num
+ sql += "select * from ( select * from ( select "
+ sql += "%s, " % random.choice(self.s_s_select)
+ sql += "%s, " % random.choice(self.qt_select)
+ sql += "ts from stable_1 where "
+ sql += "%s " % random.choice(self.q_where)
+ sql += ")) "
+ sql += ")" * for_num
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ sql2 = "select ts from ( select * from ( select "
+ sql2 += "%s, " % random.choice(self.s_s_select)
+ sql2 += "%s, " % random.choice(self.qt_select)
+ sql2 += "ts from stable_1 where "
+ sql2 += "%s " % random.choice(self.q_where)
+ sql2 += ")) "
+ tdLog.info(sql2)
+ tdLog.info(len(sql2))
+ tdSql.query(sql2)
+ self.cur1.execute(sql2)
+
+ self.data_matrix_equal('%s' %sql ,1,10,1,1,'%s' %sql2 ,1,10,1,1)
+
+ #3 select ts ,calc from (select * form stable where <\>\in\and\or order by limit )
+ #self.dropandcreateDB_random("%s" %db, 1)
+ tdSql.query("select 3-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select "
+ sql += "%s " % random.choice(self.calc_calculate_regular)
+ sql += " from ( select * from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.orders_desc_where)
+ sql += "%s " % random.choice(self.limit_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ #'Invalid function name: derivative' tdSql.query(sql)
+ #self.cur1.execute(sql)
+
+ #4 select * from (select calc form stable where <\>\in\and\or order by limit )
+ tdSql.query("select 4-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select "
+ sql += "%s " % random.choice(self.calc_select_in_ts)
+ sql += "from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ #sql += "%s " % random.choice(self.order_desc_where)
+ sql += "%s " % random.choice(self.limit_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.query(sql)
+ self.cur1.execute(sql)
+
+ #5 select ts ,tbname from (select * form stable where <\>\in\and\or order by limit )
+ tdSql.query("select 5-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select ts , tbname , "
+ sql += "%s ," % random.choice(self.calc_calculate_regular)
+ sql += "%s ," % random.choice(self.dqt_select)
+ sql += "%s " % random.choice(self.qt_select)
+ sql += " from ( select * from stable_1 where "
+ sql += "%s " % random.choice(self.qt_where)
+ sql += "%s " % random.choice(self.orders_desc_where)
+ sql += "%s " % random.choice(self.limit_where)
+ sql += ") ;"
+ tdLog.info(sql)
+ tdLog.info(len(sql))
+ tdSql.error(sql)
+
+ #special sql
+ tdSql.query("select 6-1 from stable_1;")
+ for i in range(self.fornum):
+ sql = "select * from ( select _block_dist() from stable_1);"
+ # tdSql.query(sql)
+ # tdSql.checkRows(1)
+ sql = "select _block_dist() from (select * from stable_1);"
+ tdSql.error(sql)
+ sql = "select * from (select database());"
+ tdSql.error(sql)
+ sql = "select * from (select client_version());"
+ tdSql.error(sql)
+ sql = "select * from (select client_version() as version);"
+ tdSql.error(sql)
+ sql = "select * from (select server_version());"
+ tdSql.error(sql)
+ sql = "select * from (select server_version() as version);"
+ tdSql.error(sql)
+ sql = "select * from (select server_status());"
+ tdSql.error(sql)
+ sql = "select * from (select server_status() as status);"
+ tdSql.error(sql)
+
+ #taos -f sql
+ startTime_taos_f = time.time()
+ print("taos -f sql start!")
+ taos_cmd1 = "taos -f %s/%s.sql" % (self.testcasePath,self.testcaseFilename)
+ _ = subprocess.check_output(taos_cmd1, shell=True).decode("utf-8")
+ print("taos -f sql over!")
+ endTime_taos_f = time.time()
+ print("taos_f total time %ds" % (endTime_taos_f - startTime_taos_f))
+
+ print('=====================2.6 old function end ===========')
+
+
+
+ def run(self):
+ tdSql.prepare()
+
+ startTime = time.time()
+
+ #
+
+
+ #self.math_nest(['TAIL']) #TD-16009
+ # self.math_nest(['HYPERLOGLOG']) #TD-16038
+ # self.math_nest(['UNIQUE'])
+
+
+
+ # #
+ #self.function_before_26() #TD-16031
+
+ # self.math_nest(['ABS','SQRT']) #TD-16042
+ # self.math_nest(['SIN','COS','TAN','ASIN','ACOS','ATAN'])
+ # self.math_nest(['POW','LOG']) #TD-16039
+ # self.math_nest(['FLOOR','CEIL','ROUND'])
+ # #self.math_nest(['SAMPLE']) #TD-16017
+ # #self.math_nest(['CSUM']) #TD-15936 crash
+ # self.math_nest(['MAVG'])
+
+ self.str_nest(['LTRIM','RTRIM','LOWER','UPPER'])
+ self.str_nest(['LENGTH','CHAR_LENGTH'])
+ self.str_nest(['SUBSTR']) #TD-16042
+ self.str_nest(['CONCAT']) #TD-16002 偶尔
+ self.str_nest(['CONCAT_WS']) #TD-16002 偶尔
+ # self.time_nest(['CAST']) #TD-16017偶尔,放到time里起来弄
+ self.time_nest(['CAST_1'])
+ self.time_nest(['CAST_2'])
+ self.time_nest(['CAST_3'])
+ self.time_nest(['CAST_4'])
+
+
+
+ # self.time_nest(['NOW','TODAY']) #
+ # self.time_nest(['TIMEZONE']) #
+ # self.time_nest(['TIMETRUNCATE']) #TD-16039
+ # self.time_nest(['TO_ISO8601'])
+ # self.time_nest(['TO_UNIXTIMESTAMP'])#core多
+ # self.time_nest(['ELAPSED'])
+
+
+ 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/percentile.py b/tests/system-test/2-query/percentile.py
index 2122197ad2cfbe2996266840b4fcd615627179b9..8df9bcb9ce4df065a151d33116f1331298ee35fd 100644
--- a/tests/system-test/2-query/percentile.py
+++ b/tests/system-test/2-query/percentile.py
@@ -11,6 +11,7 @@
# -*- coding: utf-8 -*-
+from platform import java_ver
from util.log import *
from util.cases import *
from util.sql import *
@@ -41,147 +42,21 @@ class TDTestCase:
# percentile verifacation
tdSql.error("select percentile(ts ,20) from test")
- tdSql.error("select apercentile(ts ,20) from test")
tdSql.error("select percentile(col7 ,20) from test")
- tdSql.error("select apercentile(col7 ,20) from test")
tdSql.error("select percentile(col8 ,20) from test")
- tdSql.error("select apercentile(col8 ,20) from test")
- tdSql.error("select percentile(col9 ,20) from test")
- tdSql.error("select apercentile(col9 ,20) from test")
-
- tdSql.query("select percentile(col1, 0) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 0))
- tdSql.query("select apercentile(col1, 0) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
- tdSql.query("select percentile(col1, 50) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 50))
- tdSql.query("select apercentile(col1, 50) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
- tdSql.query("select percentile(col1, 100) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 100))
- tdSql.query("select apercentile(col1, 100) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
-
- tdSql.query("select percentile(col2, 0) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 0))
- tdSql.query("select apercentile(col2, 0) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
- tdSql.query("select percentile(col2, 50) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 50))
- tdSql.query("select apercentile(col2, 50) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
- tdSql.query("select percentile(col2, 100) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 100))
- tdSql.query("select apercentile(col2, 100) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
-
- tdSql.query("select percentile(col3, 0) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 0))
- tdSql.query("select apercentile(col3, 0) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
- tdSql.query("select percentile(col3, 50) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 50))
- tdSql.query("select apercentile(col3, 50) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
- tdSql.query("select percentile(col3, 100) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 100))
- tdSql.query("select apercentile(col3, 100) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
-
- tdSql.query("select percentile(col4, 0) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 0))
- tdSql.query("select apercentile(col4, 0) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
- tdSql.query("select percentile(col4, 50) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 50))
- tdSql.query("select apercentile(col4, 50) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
- tdSql.query("select percentile(col4, 100) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 100))
- tdSql.query("select apercentile(col4, 100) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
-
- tdSql.query("select percentile(col11, 0) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 0))
- tdSql.query("select apercentile(col11, 0) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
- tdSql.query("select percentile(col11, 50) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 50))
- tdSql.query("select apercentile(col11, 50) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
- tdSql.query("select percentile(col11, 100) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 100))
- tdSql.query("select apercentile(col11, 100) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
-
- tdSql.query("select percentile(col12, 0) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 0))
- tdSql.query("select apercentile(col12, 0) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
- tdSql.query("select percentile(col12, 50) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 50))
- tdSql.query("select apercentile(col12, 50) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
- tdSql.query("select percentile(col12, 100) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 100))
- tdSql.query("select apercentile(col12, 100) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
-
- tdSql.query("select percentile(col13, 0) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 0))
- tdSql.query("select apercentile(col13, 0) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
- tdSql.query("select percentile(col13, 50) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 50))
- tdSql.query("select apercentile(col13, 50) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
- tdSql.query("select percentile(col13, 100) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 100))
- tdSql.query("select apercentile(col13, 100) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
-
- tdSql.query("select percentile(col14, 0) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 0))
- tdSql.query("select apercentile(col14, 0) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
- tdSql.query("select percentile(col14, 50) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 50))
- tdSql.query("select apercentile(col14, 50) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
- tdSql.query("select percentile(col14, 100) from test")
- tdSql.checkData(0, 0, np.percentile(intData, 100))
- tdSql.query("select apercentile(col14, 100) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
-
- tdSql.query("select percentile(col5, 0) from test")
- print("query result: %s" % tdSql.getData(0, 0))
- print("array result: %s" % np.percentile(floatData, 0))
- tdSql.query("select apercentile(col5, 0) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
- tdSql.query("select percentile(col5, 50) from test")
- print("query result: %s" % tdSql.getData(0, 0))
- print("array result: %s" % np.percentile(floatData, 50))
- tdSql.query("select apercentile(col5, 50) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
- tdSql.query("select percentile(col5, 100) from test")
- print("query result: %s" % tdSql.getData(0, 0))
- print("array result: %s" % np.percentile(floatData, 100))
- tdSql.query("select apercentile(col5, 100) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
-
- tdSql.query("select percentile(col6, 0) from test")
- tdSql.checkData(0, 0, np.percentile(floatData, 0))
- tdSql.query("select apercentile(col6, 0) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
- tdSql.query("select percentile(col6, 50) from test")
- tdSql.checkData(0, 0, np.percentile(floatData, 50))
- tdSql.query("select apercentile(col6, 50) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
- tdSql.query("select percentile(col6, 100) from test")
- tdSql.checkData(0, 0, np.percentile(floatData, 100))
- tdSql.query("select apercentile(col6, 100) from test")
- print("apercentile result: %s" % tdSql.getData(0, 0))
-
+ tdSql.error("select percentile(col9 ,20) from test")
+ column_list = [1,2,3,4,11,12,13,14]
+ percent_list = [0,50,100]
+ for i in column_list:
+ for j in percent_list:
+ tdSql.query(f"select percentile(col{i}, {j}) from test")
+ tdSql.checkData(0, 0, np.percentile(intData, j))
+
+ for i in [5,6]:
+ for j in percent_list:
+ tdSql.query(f"select percentile(col{i}, {j}) from test")
+ tdSql.checkData(0, 0, np.percentile(floatData, j))
+
tdSql.execute("create table meters (ts timestamp, voltage int) tags(loc nchar(20))")
tdSql.execute("create table t0 using meters tags('beijing')")
tdSql.execute("create table t1 using meters tags('shanghai')")
@@ -189,9 +64,8 @@ class TDTestCase:
tdSql.execute("insert into t0 values(%d, %d)" % (self.ts + i, i + 1))
tdSql.execute("insert into t1 values(%d, %d)" % (self.ts + i, i + 1))
- tdSql.error("select percentile(voltage, 20) from meters")
- tdSql.query("select apercentile(voltage, 20) from meters")
- print("apercentile result: %s" % tdSql.getData(0, 0))
+ # tdSql.error("select percentile(voltage, 20) from meters")
+
tdSql.execute("create table st(ts timestamp, k int)")
diff --git a/tests/system-test/2-query/sample.py b/tests/system-test/2-query/sample.py
new file mode 100644
index 0000000000000000000000000000000000000000..94e06347d2923fc60d99768c667b927dde5dfd83
--- /dev/null
+++ b/tests/system-test/2-query/sample.py
@@ -0,0 +1,863 @@
+###################################################################
+# 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 pstats import Stats
+import sys
+import subprocess
+import random
+import math
+import numpy as np
+import inspect
+import re
+import taos
+
+from util.log import *
+from util.cases import *
+from util.sql import *
+from util.dnodes import *
+
+
+class TDTestCase:
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor())
+
+ def sample_query_form(self, sel="select", func="sample(", col="c1", m_comm =",", k=1,r_comm=")", alias="", fr="from",table_expr="t1", condition=""):
+ '''
+ sample function:
+
+ :param sel: string, must be "select", required parameters;
+ :param func: string, in this case must be "sample(", otherwise return other function, required parameters;
+ :param col: string, column name, required parameters;
+ :param m_comm: string, comma between col and k , required parameters;
+ :param k: int/float,the width of the sliding window, [1,100], required parameters;
+ :param r_comm: string, must be ")", use with "(" in func, required parameters;
+ :param alias: string, result column another name,or add other funtion;
+ :param fr: string, must be "from", required parameters;
+ :param table_expr: string or expression, data source(eg,table/stable name, result set), required parameters;
+ :param condition: expression;
+ :return: sample query statement,default: select sample(c1, 1) from t1
+ '''
+
+ return f"{sel} {func} {col} {m_comm} {k} {r_comm} {alias} {fr} {table_expr} {condition}"
+
+ def checksample(self,sel="select", func="sample(", col="c1", m_comm =",", k=1,r_comm=")", alias="", fr="from",table_expr="t1", condition=""):
+ # print(self.sample_query_form(sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ # table_expr=table_expr, condition=condition))
+ line = sys._getframe().f_back.f_lineno
+
+ if not all([sel , func , col , m_comm , k , r_comm , fr , table_expr]):
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.sample_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+
+
+ sql = "select * from t1"
+ collist = tdSql.getColNameList(sql)
+
+ if not isinstance(col, str):
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.sample_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+
+ if len([x for x in col.split(",") if x.strip()]) != 1:
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.sample_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+
+ col = col.replace(",", "").replace(" ","")
+
+ if any([re.compile('^[a-zA-Z]{1}.*$').match(col) is None , not col.replace(".","").isalnum()]):
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.sample_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+
+ if '.' in col:
+ if any([col.split(".")[0] not in table_expr, col.split(".")[1] not in collist]):
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.sample_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+ pass
+
+ if "." not in col:
+ if col not in collist:
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.sample_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+ pass
+
+ # colname = col if "." not in col else col.split(".")[1]
+ # col_index = collist.index(colname)
+ # if any([tdSql.cursor.istype(col_index, "TIMESTAMP"), tdSql.cursor.istype(col_index, "BOOL")]):
+ # print(f"case in {line}: ", end='')
+ # return tdSql.error(self.sample_query_form(
+ # sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ # table_expr=table_expr, condition=condition
+ # ))
+ #
+ # if any([tdSql.cursor.istype(col_index, "BINARY") , tdSql.cursor.istype(col_index,"NCHAR")]):
+ # print(f"case in {line}: ", end='')
+ # return tdSql.error(self.sample_query_form(
+ # sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ # table_expr=table_expr, condition=condition
+ # ))
+
+ if any( [func != "sample(" , r_comm != ")" , fr != "from", sel != "select"]):
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.sample_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+
+ if all(["(" not in table_expr, "stb" in table_expr, "group" not in condition.lower()]):
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.sample_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+
+ if all(["group" in condition.lower(), "tbname" not in condition.lower()]):
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.sample_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+
+ alias_list = ["tbname", "_c0", "st", "ts"]
+ if all([alias, "," not in alias]):
+ if any([ not alias.isalnum(), re.compile('^[a-zA-Z]{1}.*$').match(col) is None ]):
+ # actually, column alias also support "_", but in this case,forbidden that。
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.sample_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+
+ if all([alias, "," in alias]):
+ if all(parm != alias.lower().split(",")[1].strip() for parm in alias_list):
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.sample_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+ pass
+
+ condition_exception = [ "-", "+", "/", "*", "~", "^", "insert", "distinct",
+ "count", "avg", "twa", "irate", "sum", "stddev", "leastquares",
+ "min", "max", "first", "last", "top", "bottom", "percentile",
+ "apercentile", "last_row", "interp", "diff", "derivative",
+ "spread", "ceil", "floor", "round", "interval", "fill", "slimit", "soffset"]
+ if "union" not in condition.lower():
+ if any(parm in condition.lower().strip() for parm in condition_exception):
+
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.sample_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+ pass
+
+ if not any([isinstance(k, int) , isinstance(k, float)]) :
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.sample_query_form(
+ col=col, k=k, alias=alias, table_expr=table_expr, condition=condition
+ ))
+
+ if not(1 <= k < 1001):
+ print(f"case in {line}: ", end='')
+ return tdSql.error(self.sample_query_form(
+ col=col, k=k, alias=alias, table_expr=table_expr, condition=condition
+ ))
+
+ k = int(k // 1)
+ pre_sql = re.sub("sample\([a-z0-9 .,]*\)", f"count({col})", self.sample_query_form(
+ col=col, table_expr=table_expr, condition=condition
+ ))
+ tdSql.query(pre_sql)
+ if tdSql.queryRows == 0:
+ tdSql.query(self.sample_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+ print(f"case in {line}: ", end='')
+ tdSql.checkRows(0)
+ return
+
+ tdSql.query(self.sample_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+
+ sample_result = tdSql.queryResult
+ sample_len = tdSql.queryRows
+
+ if "group" in condition:
+ tb_condition = condition.split("group by")[1].split(" ")[1]
+ tdSql.query(f"select distinct {tb_condition} from {table_expr}")
+ query_result = tdSql.queryResult
+ query_rows = tdSql.queryRows
+ clear_condition = re.sub('order by [0-9a-z]*|slimit [0-9]*|soffset [0-9]*', "", condition)
+
+ pre_row = 0
+ for i in range(query_rows):
+ group_name = query_result[i][0]
+ if "where" in clear_condition:
+ pre_condition = re.sub('group by [0-9a-z]*', f"and {tb_condition}='{group_name}' and {col} is not null", clear_condition)
+ else:
+ pre_condition = "where " + re.sub('group by [0-9a-z]*',f"{tb_condition}='{group_name}' and {col} is not null", clear_condition)
+
+ tdSql.query(f"select ts, {col} {alias} from {table_expr} {pre_condition}")
+ # pre_data = np.array(tdSql.queryResult)[np.array(tdSql.queryResult) != None]
+ # pre_sample = np.convolve(pre_data, np.ones(k), "valid")/k
+ pre_sample = tdSql.queryResult
+ pre_len = tdSql.queryRows
+ step = pre_len if pre_len < k else k
+ # tdSql.query(self.sample_query_form(
+ # sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ # table_expr=table_expr, condition=condition
+ # ))
+ for i in range(step):
+ if sample_result[pre_row:pre_row+step][i] not in pre_sample:
+ tdLog.exit(f"case in {line} is failed: sample data is not in {group_name}")
+ else:
+ tdLog.info(f"case in {line} is success: sample data is in {group_name}")
+
+ # for j in range(len(pre_sample)):
+ # print(f"case in {line}:", end='')
+ # tdSql.checkData(pre_row+j, 1, pre_sample[j])
+ pre_row += step
+ return
+ elif "union" in condition:
+ union_sql_0 = self.sample_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ).split("union all")[0]
+
+ union_sql_1 = self.sample_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ).split("union all")[1]
+
+ tdSql.query(union_sql_0)
+ # union_sample_0 = tdSql.queryResult
+ row_union_0 = tdSql.queryRows
+
+ tdSql.query(union_sql_1)
+ # union_sample_1 = tdSql.queryResult
+ row_union_1 = tdSql.queryRows
+
+ tdSql.query(self.sample_query_form(
+ sel=sel, func=func, col=col, m_comm=m_comm, k=k, r_comm=r_comm, alias=alias, fr=fr,
+ table_expr=table_expr, condition=condition
+ ))
+ # for i in range(tdSql.queryRows):
+ # print(f"case in {line}: ", end='')
+ # if i < row_union_0:
+ # tdSql.checkData(i, 1, union_sample_0[i][1])
+ # else:
+ # tdSql.checkData(i, 1, union_sample_1[i-row_union_0][1])
+ if row_union_0 + row_union_1 != sample_len:
+ tdLog.exit(f"case in {line} is failed: sample data is not in ")
+ else:
+ tdLog.info(f"case in {line} is success: sample data is in ")
+ return
+
+ else:
+ if "where" in condition:
+ condition = re.sub('where', f"where {col} is not null and ", condition)
+ else:
+ condition = f"where {col} is not null" + condition
+ print(f"select ts, {col} {alias} from {table_expr} {re.sub('limit [0-9]*|offset [0-9]*','',condition)}")
+ tdSql.query(f"select ts, {col} {alias} from {table_expr} {re.sub('limit [0-9]*|offset [0-9]*','',condition)}")
+ # offset_val = condition.split("offset")[1].split(" ")[1] if "offset" in condition else 0
+ pre_sample = tdSql.queryResult
+ # pre_len = tdSql.queryRows
+ # for i in range(sample_len):
+ # if sample_result[pre_row:pre_row + step][i] not in pre_sample:
+ # tdLog.exit(f"case in {line} is failed: sample data is not in {group_name}")
+ # else:
+ # tdLog.info(f"case in {line} is success: sample data is in {group_name}")
+
+ pass
+
+ def sample_current_query(self) :
+
+ # table schema :ts timestamp, c1 int, c2 float, c3 timestamp, c4 binary(16), c5 double, c6 bool
+ # c7 bigint, c8 smallint, c9 tinyint, c10 nchar(16)
+
+ # case1~6: numeric col:int/bigint/tinyint/smallint/float/double
+ self.checksample()
+ case2 = {"col": "c2"}
+ self.checksample(**case2)
+ case3 = {"col": "c5"}
+ self.checksample(**case3)
+ case4 = {"col": "c7"}
+ self.checksample(**case4)
+ case5 = {"col": "c8"}
+ self.checksample(**case5)
+ case6 = {"col": "c9"}
+ self.checksample(**case6)
+
+ # # case7~8: nested query
+ # case7 = {"table_expr": "(select c1 from stb1)"}
+ # self.checksample(**case7)
+ # case8 = {"table_expr": "(select sample(c1, 1) c1 from stb1 group by tbname)"}
+ # self.checksample(**case8)
+
+ # case9~10: mix with tbname/ts/tag/col
+ # case9 = {"alias": ", tbname"}
+ # self.checksample(**case9)
+ # case10 = {"alias": ", _c0"}
+ # self.checksample(**case10)
+ case11 = {"alias": ", st1"}
+ self.checksample(**case11)
+ case12 = {"alias": ", c1"}
+ self.checksample(**case12)
+
+ # case13~15: with single condition
+ case13 = {"condition": "where c1 <= 10"}
+ self.checksample(**case13)
+ case14 = {"condition": "where c6 in (0, 1)"}
+ self.checksample(**case14)
+ case15 = {"condition": "where c1 between 1 and 10"}
+ self.checksample(**case15)
+
+ # case16: with multi-condition
+ case16 = {"condition": "where c6=1 or c6 =0"}
+ self.checksample(**case16)
+
+ # # case17: only support normal table join
+ # case17 = {
+ # "col": "t1.c1",
+ # "table_expr": "t1, t2",
+ # "condition": "where t1.ts=t2.ts"
+ # }
+ # self.checksample(**case17)
+ # # case18~19: with group by
+ # case19 = {
+ # "table_expr": "stb1",
+ # "condition": "partition by tbname"
+ # }
+ # self.checksample(**case19)
+
+ # # case20~21: with order by
+ # case20 = {"condition": "order by ts"}
+ # self.checksample(**case20)
+ # case21 = {
+ # "table_expr": "stb1",
+ # "condition": "partition by tbname order by tbname"
+ # }
+ # self.checksample(**case21)
+
+ # case22: with union
+ case22 = {
+ "condition": "union all select sample( c1 , 1 ) from t2"
+ }
+ self.checksample(**case22)
+
+ # case23: with limit/slimit
+ case23 = {
+ "condition": "limit 1"
+ }
+ self.checksample(**case23)
+
+ # case24: value k range[1, 100], can be int or float, k = floor(k)
+ case24 = {"k": 3}
+ self.checksample(**case24)
+ case25 = {"k": 2.999}
+ self.checksample(**case25)
+ case26 = {"k": 1000}
+ self.checksample(**case26)
+ case27 = {
+ "table_expr": "stb1",
+ "condition": "group by tbname slimit 1 "
+ }
+ self.checksample(**case27) # with slimit
+ case28 = {
+ "table_expr": "stb1",
+ "condition": "group by tbname slimit 1 soffset 1"
+ }
+ self.checksample(**case28) # with soffset
+
+ pass
+
+ def sample_error_query(self) -> None :
+ # unusual test
+
+ # form test
+ err1 = {"col": ""}
+ self.checksample(**err1) # no col
+ err2 = {"sel": ""}
+ self.checksample(**err2) # no select
+ err3 = {"func": "sample", "col": "", "m_comm": "", "k": "", "r_comm": ""}
+ self.checksample(**err3) # no sample condition: select sample from
+ err4 = {"col": "", "m_comm": "", "k": ""}
+ self.checksample(**err4) # no sample condition: select sample() from
+ err5 = {"func": "sample", "r_comm": ""}
+ self.checksample(**err5) # no brackets: select sample col, k from
+ err6 = {"fr": ""}
+ self.checksample(**err6) # no from
+ err7 = {"k": ""}
+ self.checksample(**err7) # no k
+ err8 = {"table_expr": ""}
+ self.checksample(**err8) # no table_expr
+
+ # err9 = {"col": "st1"}
+ # self.checksample(**err9) # col: tag
+ tdSql.query(" select sample(st1 ,1) from t1 ")
+ err10 = {"col": 1}
+ self.checksample(**err10) # col: value
+ err11 = {"col": "NULL"}
+ self.checksample(**err11) # col: NULL
+ err12 = {"col": "%_"}
+ self.checksample(**err12) # col: %_
+ err13 = {"col": "c3"}
+ self.checksample(**err13) # col: timestamp col
+ err14 = {"col": "_c0"}
+ # self.checksample(**err14) # col: Primary key
+ err15 = {"col": "avg(c1)"}
+ # self.checksample(**err15) # expr col
+ err16 = {"col": "c4"}
+ self.checksample(**err16) # binary col
+ err17 = {"col": "c10"}
+ self.checksample(**err17) # nchar col
+ err18 = {"col": "c6"}
+ self.checksample(**err18) # bool col
+ err19 = {"col": "'c1'"}
+ self.checksample(**err19) # col: string
+ err20 = {"col": None}
+ self.checksample(**err20) # col: None
+ err21 = {"col": "''"}
+ self.checksample(**err21) # col: ''
+ err22 = {"col": "tt1.c1"}
+ self.checksample(**err22) # not table_expr col
+ err23 = {"col": "t1"}
+ self.checksample(**err23) # tbname
+ err24 = {"col": "stb1"}
+ self.checksample(**err24) # stbname
+ err25 = {"col": "db"}
+ self.checksample(**err25) # datbasename
+ err26 = {"col": "True"}
+ self.checksample(**err26) # col: BOOL 1
+ err27 = {"col": True}
+ self.checksample(**err27) # col: BOOL 2
+ err28 = {"col": "*"}
+ self.checksample(**err28) # col: all col
+ err29 = {"func": "sample[", "r_comm": "]"}
+ self.checksample(**err29) # form: sample[col, k]
+ err30 = {"func": "sample{", "r_comm": "}"}
+ self.checksample(**err30) # form: sample{col, k}
+ err31 = {"col": "[c1]"}
+ self.checksample(**err31) # form: sample([col], k)
+ err32 = {"col": "c1, c2"}
+ self.checksample(**err32) # form: sample(col, col2, k)
+ err33 = {"col": "c1, 2"}
+ self.checksample(**err33) # form: sample(col, k1, k2)
+ err34 = {"alias": ", count(c1)"}
+ self.checksample(**err34) # mix with aggregate function 1
+ err35 = {"alias": ", avg(c1)"}
+ self.checksample(**err35) # mix with aggregate function 2
+ err36 = {"alias": ", min(c1)"}
+ self.checksample(**err36) # mix with select function 1
+ err37 = {"alias": ", top(c1, 5)"}
+ self.checksample(**err37) # mix with select function 2
+ err38 = {"alias": ", spread(c1)"}
+ self.checksample(**err38) # mix with calculation function 1
+ err39 = {"alias": ", diff(c1)"}
+ self.checksample(**err39) # mix with calculation function 2
+ # err40 = {"alias": "+ 2"}
+ # self.checksample(**err40) # mix with arithmetic 1
+ # tdSql.query(" select sample(c1 , 1) + 2 from t1 ")
+ err41 = {"alias": "+ avg(c1)"}
+ self.checksample(**err41) # mix with arithmetic 2
+ err42 = {"alias": ", c1"}
+ self.checksample(**err42) # mix with other col
+ # err43 = {"table_expr": "stb1"}
+ # self.checksample(**err43) # select stb directly
+ err44 = {
+ "col": "stb1.c1",
+ "table_expr": "stb1, stb2",
+ "condition": "where stb1.ts=stb2.ts and stb1.st1=stb2.st2 order by stb1.ts"
+ }
+ self.checksample(**err44) # stb join
+ err45 = {
+ "condition": "where ts>0 and ts < now interval(1h) fill(next)"
+ }
+ self.checksample(**err45) # interval
+ err46 = {
+ "table_expr": "t1",
+ "condition": "group by c6"
+ }
+ # self.checksample(**err46) # group by normal col
+
+ err49 = {"k": "2021-01-01 00:00:00.000"}
+ self.checksample(**err49) # k: timestamp
+ err50 = {"k": False}
+ self.checksample(**err50) # k: False
+ err51 = {"k": "%"}
+ self.checksample(**err51) # k: special char
+ err52 = {"k": ""}
+ self.checksample(**err52) # k: ""
+ err53 = {"k": None}
+ self.checksample(**err53) # k: None
+ err54 = {"k": "NULL"}
+ self.checksample(**err54) # k: null
+ err55 = {"k": "binary(4)"}
+ self.checksample(**err55) # k: string
+ err56 = {"k": "c1"}
+ self.checksample(**err56) # k: sring,col name
+ err57 = {"col": "c1, 1, c2"}
+ self.checksample(**err57) # form: sample(col1, k1, col2, k2)
+ err58 = {"col": "c1 cc1"}
+ self.checksample(**err58) # form: sample(col newname, k)
+ err59 = {"k": "'1'"}
+ # self.checksample(**err59) # formL sample(colm, "1")
+ err60 = {"k": "-1-(-2)"}
+ # self.checksample(**err60) # formL sample(colm, -1-2)
+ err61 = {"k": 1001}
+ self.checksample(**err61) # k: right out of [1, 1000]
+ err62 = {"k": -1}
+ self.checksample(**err62) # k: negative number
+ err63 = {"k": 0}
+ self.checksample(**err63) # k: 0
+ err64 = {"k": 2**63-1}
+ self.checksample(**err64) # k: max(bigint)
+ err65 = {"k": 1-2**63}
+ # self.checksample(**err65) # k: min(bigint)
+ err66 = {"k": -2**63}
+ self.checksample(**err66) # k: NULL
+ err67 = {"k": 0.999999}
+ self.checksample(**err67) # k: left out of [1, 1000]
+
+ pass
+
+ def sample_test_data(self, tbnum:int, data_row:int, basetime:int) -> None :
+ for i in range(tbnum):
+ for j in range(data_row):
+ tdSql.execute(
+ f"insert into t{i} values ("
+ f"{basetime + (j+1)*10}, {random.randint(-200, -1)}, {random.uniform(200, -1)}, {basetime + random.randint(-200, -1)}, "
+ f"'binary_{j}', {random.uniform(-200, -1)}, {random.choice([0,1])}, {random.randint(-200,-1)}, "
+ f"{random.randint(-200, -1)}, {random.randint(-127, -1)}, 'nchar_{j}' )"
+ )
+
+ tdSql.execute(
+ f"insert into t{i} values ("
+ f"{basetime - (j+1) * 10}, {random.randint(1, 200)}, {random.uniform(1, 200)}, {basetime - random.randint(1, 200)}, "
+ f"'binary_{j}_1', {random.uniform(1, 200)}, {random.choice([0, 1])}, {random.randint(1,200)}, "
+ f"{random.randint(1,200)}, {random.randint(1,127)}, 'nchar_{j}_1' )"
+ )
+ tdSql.execute(
+ f"insert into tt{i} values ( {basetime-(j+1) * 10}, {random.randint(1, 200)} )"
+ )
+
+ pass
+
+ def sample_test_table(self,tbnum: int) -> None :
+ tdSql.execute("drop database if exists db")
+ tdSql.execute("create database if not exists db keep 3650")
+ tdSql.execute("use db")
+
+ tdSql.execute(
+ "create stable db.stb1 (\
+ ts timestamp, c1 int, c2 float, c3 timestamp, c4 binary(16), c5 double, c6 bool, \
+ c7 bigint, c8 smallint, c9 tinyint, c10 nchar(16)\
+ ) \
+ tags(st1 int)"
+ )
+ tdSql.execute(
+ "create stable db.stb2 (ts timestamp, c1 int) tags(st2 int)"
+ )
+ for i in range(tbnum):
+ tdSql.execute(f"create table t{i} using stb1 tags({i})")
+ tdSql.execute(f"create table tt{i} using stb2 tags({i})")
+
+ pass
+
+
+ def check_sample(self , sample_query , origin_query ):
+
+ tdSql.query(origin_query)
+
+ origin_datas = tdSql.queryResult
+
+ tdSql.query(sample_query)
+
+ sample_datas = tdSql.queryResult
+ status = True
+ for ind , sample_data in enumerate(sample_datas):
+ if sample_data not in origin_datas:
+ status = False
+
+ if status:
+ tdLog.info(" sample data is in datas groups ,successed sql is : %s" % sample_query )
+ else:
+ tdLog.exit(" sample data is not in datas groups ,failed sql is : %s" % sample_query )
+
+
+ def basic_sample_query(self):
+ tdSql.execute(" drop database if exists db ")
+ tdSql.execute(" create database if not exists db days 300 ")
+ tdSql.execute(" use db ")
+ tdSql.execute(
+ '''create table stb1
+ (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp)
+ tags (t1 int)
+ '''
+ )
+
+ tdSql.execute(
+ '''
+ create table t1
+ (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp)
+ '''
+ )
+ for i in range(4):
+ tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )')
+
+ for i in range(9):
+ tdSql.execute(
+ f"insert into ct1 values ( now()-{i*10}s, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )"
+ )
+ tdSql.execute(
+ f"insert into ct4 values ( now()-{i*90}d, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )"
+ )
+ tdSql.execute("insert into ct1 values (now()-45s, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar0', now()+8a )")
+ tdSql.execute("insert into ct1 values (now()+10s, 9, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )")
+ tdSql.execute("insert into ct1 values (now()+15s, 9, -99999, -999, -99, -9.99, NULL, 1, 'binary9', 'nchar9', now()+9a )")
+ tdSql.execute("insert into ct1 values (now()+20s, 9, -99999, -999, NULL, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )")
+
+ tdSql.execute("insert into ct4 values (now()-810d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ")
+ tdSql.execute("insert into ct4 values (now()-400d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ")
+ tdSql.execute("insert into ct4 values (now()+90d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ")
+
+ tdSql.execute(
+ f'''insert into t1 values
+ ( '2020-04-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
+ ( '2020-10-21 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now()+1a )
+ ( '2020-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now()+2a )
+ ( '2021-01-01 01:01:06.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now()+3a )
+ ( '2021-05-07 01:01:10.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now()+4a )
+ ( '2021-07-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
+ ( '2021-09-30 01:01:16.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now()+5a )
+ ( '2022-02-01 01:01:20.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now()+6a )
+ ( '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" )
+ ( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
+ '''
+ )
+
+ # basic query for sample
+
+ # params test for all
+ tdSql.error(" select sample(c1,c1) from t1 ")
+ tdSql.error(" select sample(c1,now) from t1 ")
+ tdSql.error(" select sample(c1,tbname) from t1 ")
+ tdSql.error(" select sample(c1,ts) from t1 ")
+ tdSql.error(" select sample(c1,false) from t1 ")
+ tdSql.error(" select sample(123,1) from t1 ")
+
+ tdSql.query(" select sample(c1,2) from t1 ")
+ tdSql.checkRows(2)
+ tdSql.query(" select sample(c1,10) from t1 ")
+ tdSql.checkRows(9)
+ tdSql.query(" select sample(c8,10) from t1 ")
+ tdSql.checkRows(9)
+ tdSql.query(" select sample(c1,999) from t1 ")
+ tdSql.checkRows(9)
+ tdSql.query(" select sample(c1,1000) from t1 ")
+ tdSql.checkRows(9)
+ tdSql.query(" select sample(c8,1000) from t1 ")
+ tdSql.checkRows(9)
+ tdSql.error(" select sample(c1,-1) from t1 ")
+
+ # bug need fix
+ # tdSql.query("select sample(c1 ,2) , 123 from stb1;")
+
+ # all type support
+ tdSql.query(" select sample(c1 , 20 ) from ct4 ")
+ tdSql.checkRows(9)
+
+ tdSql.query(" select sample(c2 , 20 ) from ct4 ")
+ tdSql.checkRows(9)
+
+ tdSql.query(" select sample(c3 , 20 ) from ct4 ")
+ tdSql.checkRows(9)
+
+ tdSql.query(" select sample(c4 , 20 ) from ct4 ")
+ tdSql.checkRows(9)
+
+ tdSql.query(" select sample(c5 , 20 ) from ct4 ")
+ tdSql.checkRows(9)
+
+ tdSql.query(" select sample(c6 , 20 ) from ct4 ")
+ tdSql.checkRows(9)
+
+ tdSql.query(" select sample(c7 , 20 ) from ct4 ")
+ tdSql.checkRows(9)
+
+ tdSql.query(" select sample(c8 , 20 ) from ct4 ")
+ tdSql.checkRows(9)
+
+ tdSql.query(" select sample(c9 , 20 ) from ct4 ")
+ tdSql.checkRows(9)
+
+ tdSql.query(" select sample(c10 , 20 ) from ct4 ")
+ tdSql.checkRows(9)
+
+ tdSql.query(" select sample(t1 , 20 ) from ct1 ")
+ tdSql.checkRows(13)
+ # filter data
+
+ tdSql.query(" select sample(c1, 20 ) from t1 where c1 is null ")
+ tdSql.checkRows(0)
+
+ tdSql.query(" select sample(c1, 20 ) from t1 where c1 =6 ")
+ tdSql.checkRows(1)
+
+ tdSql.query(" select sample(c1, 20 ) from t1 where c1 > 6 ")
+ tdSql.checkRows(3)
+
+ self.check_sample("select sample(c1, 20 ) from t1 where c1 > 6" , "select c1 from t1 where c1 > 6")
+
+ tdSql.query(" select sample( c1 , 1 ) from t1 where c1 in (0, 1,2) ")
+ tdSql.checkRows(1)
+
+ tdSql.query("select sample( c1 ,3 ) from t1 where c1 between 1 and 10 ")
+ tdSql.checkRows(3)
+
+ self.check_sample("select sample( c1 ,3 ) from t1 where c1 between 1 and 10" ,"select c1 from t1 where c1 between 1 and 10")
+
+ # join
+
+ tdSql.query("select sample( ct4.c1 , 1 ) from ct1, ct4 where ct4.ts=ct1.ts")
+
+ # partition by tbname
+
+ tdSql.query("select sample(c1,2) from stb1 partition by tbname")
+ tdSql.checkRows(4)
+
+ self.check_sample("select sample(c1,2) from stb1 partition by tbname" , "select c1 from stb1 partition by tbname")
+
+ # nest query
+ # tdSql.query("select sample(c1,2) from (select c1 from t1); ")
+ # tdSql.checkRows(2)
+
+ # union all
+ tdSql.query("select sample(c1,2) from t1 union all select sample(c1,3) from t1")
+ tdSql.checkRows(5)
+
+ # fill interval
+
+ # not support mix with other function
+ tdSql.error("select top(c1,2) , sample(c1,2) from ct1")
+ tdSql.error("select max(c1) , sample(c1,2) from ct1")
+ tdSql.error("select c1 , sample(c1,2) from ct1")
+
+ # bug for mix with scalar
+ # tdSql.error("select 123 , sample(c1,100) from ct1")
+ # tdSql.error("select sample(c1,100)+2 from ct1")
+ # tdSql.error("select abs(sample(c1,100)) from ct1")
+
+ def sample_test_run(self) :
+ tdLog.printNoPrefix("==========TD-10594==========")
+ tbnum = 10
+ nowtime = int(round(time.time() * 1000))
+ per_table_rows = 10
+ self.sample_test_table(tbnum)
+
+ tdLog.printNoPrefix("######## no data test:")
+ self.sample_current_query()
+ self.sample_error_query()
+
+ tdLog.printNoPrefix("######## insert only NULL test:")
+ for i in range(tbnum):
+ tdSql.execute(f"insert into t{i}(ts) values ({nowtime - 5})")
+ tdSql.execute(f"insert into t{i}(ts) values ({nowtime + 5})")
+ self.sample_current_query()
+ self.sample_error_query()
+
+ tdLog.printNoPrefix("######## insert data in the range near the max(bigint/double):")
+ # self.sample_test_table(tbnum)
+ # tdSql.execute(f"insert into t1(ts, c1,c2,c5,c7) values "
+ # f"({nowtime - (per_table_rows + 1) * 10}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})")
+ # tdSql.execute(f"insert into t1(ts, c1,c2,c5,c7) values "
+ # f"({nowtime - (per_table_rows + 2) * 10}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})")
+ # self.sample_current_query()
+ # self.sample_error_query()
+
+ tdLog.printNoPrefix("######## insert data in the range near the min(bigint/double):")
+ # self.sample_test_table(tbnum)
+ # tdSql.execute(f"insert into t1(ts, c1,c2,c5,c7) values "
+ # f"({nowtime - (per_table_rows + 1) * 10}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {1-2**63})")
+ # tdSql.execute(f"insert into t1(ts, c1,c2,c5,c7) values "
+ # f"({nowtime - (per_table_rows + 2) * 10}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {512-2**63})")
+ # self.sample_current_query()
+ # self.sample_error_query()
+
+ tdLog.printNoPrefix("######## insert data without NULL data test:")
+ self.sample_test_table(tbnum)
+ self.sample_test_data(tbnum, per_table_rows, nowtime)
+ self.sample_current_query()
+ self.sample_error_query()
+
+
+ tdLog.printNoPrefix("######## insert data mix with NULL test:")
+ for i in range(tbnum):
+ tdSql.execute(f"insert into t{i}(ts) values ({nowtime})")
+ tdSql.execute(f"insert into t{i}(ts) values ({nowtime-(per_table_rows+3)*10})")
+ tdSql.execute(f"insert into t{i}(ts) values ({nowtime+(per_table_rows+3)*10})")
+ self.sample_current_query()
+ self.sample_error_query()
+
+
+
+ tdLog.printNoPrefix("######## check after WAL test:")
+ tdSql.query("show dnodes")
+ index = tdSql.getData(0, 0)
+ tdDnodes.stop(index)
+ tdDnodes.start(index)
+ self.sample_current_query()
+ self.sample_error_query()
+
+ self.basic_sample_query()
+
+ def run(self):
+ import traceback
+ try:
+ # run in develop branch
+ self.sample_test_run()
+ pass
+ except Exception as e:
+ traceback.print_exc()
+ raise e
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success("%s successfully executed" % __file__)
+
+tdCases.addWindows(__file__, TDTestCase())
+tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
diff --git a/tests/system-test/2-query/stateduration.py b/tests/system-test/2-query/stateduration.py
new file mode 100644
index 0000000000000000000000000000000000000000..fa71009ef210e6a14c5abe04fbfe0f0b95c6598a
--- /dev/null
+++ b/tests/system-test/2-query/stateduration.py
@@ -0,0 +1,265 @@
+###################################################################
+# Copyright (c) 2016 by TAOS Technologies, Inc.
+# All rights reserved.
+#
+# This file is proprietary and confidential to TAOS Technologies.
+# No part of this file may be reproduced, stored, transmitted,
+# disclosed or used in any form or by any means other than as
+# expressly provided by the written permission from Jianhui Tao
+#
+###################################################################
+
+# -*- coding: utf-8 -*-
+
+from util.log import *
+from util.cases import *
+from util.sql import *
+
+class TDTestCase:
+ def init(self, conn, logSql):
+ tdLog.debug("start to execute %s" % __file__)
+ tdSql.init(conn.cursor())
+ self.ts = 1537146000000
+ self.param_list = ['LT','lt','Lt','lT','GT','gt','Gt','gT','LE','le','Le','lE','GE','ge','Ge','gE','NE','ne','Ne','nE','EQ','eq','Eq','eQ']
+ self.row_num = 10
+ def run(self):
+ tdSql.prepare()
+ # timestamp = 1ms , time_unit = 1s
+ tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
+ col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned)''')
+ for i in range(self.row_num):
+ tdSql.execute("insert into test values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
+ % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
+ integer_list = [1,2,3,4,11,12,13,14]
+ float_list = [5,6]
+
+ for i in integer_list:
+ for j in self.param_list:
+ tdSql.query(f"select stateduration(col{i},'{j}',5) from test")
+ tdSql.checkRows(10)
+ if j in ['LT' ,'lt','Lt','lT']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (0,), (0,), (0,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ elif j in ['GT','gt', 'Gt','gT']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (0,), (0,), (0,), (0,), (0,)])
+ elif j in ['LE','le','Le','lE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (0,), (0,), (0,), (0,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ elif j in [ 'GE','ge','Ge','gE']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (0,), (0,), (0,), (0,), (0,)])
+ elif j in ['NE','ne','Ne','nE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (0,), (0,), (0,), (-1,), (0,), (0,), (0,), (0,), (0,)])
+ elif j in ['EQ','eq','Eq','eQ']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ for i in float_list:
+ for j in self.param_list:
+ tdSql.query(f"select stateduration(col{i},'{j}',5) from test")
+ tdSql.checkRows(10)
+ if j in ['LT','lt','Lt','lT','LE','le','Le','lE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (0,), (0,), (0,), (0,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ elif j in ['GE','ge','Ge','gE','GT','gt','Gt','gT']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (0,), (0,), (0,), (0,), (0,)])
+ elif j in ['NE','ne','Ne','nE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (0,), (0,), (0,), (0,), (0,), (0,), (0,), (0,), (0,)])
+ elif j in ['EQ','eq','Eq','eQ']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+
+ error_column_list = ['ts','col7','col8','col9','a',1]
+ for i in error_column_list:
+ for j in self.param_list:
+ tdSql.error(f"select stateduration({i},{j},5) from test")
+
+ error_param_list = ['a',1]
+ for i in error_param_list:
+ tdSql.error(f"select stateduration(col1,{i},5) from test")
+
+ # timestamp = 1s, time_unit =1s
+ tdSql.execute('''create table test1(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
+ col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned)''')
+ for i in range(self.row_num):
+ tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
+ % (self.ts + i*1000, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
+
+ for i in integer_list:
+ for j in self.param_list:
+ tdSql.query(f"select stateduration(col{i},'{j}',5) from test1")
+ tdSql.checkRows(10)
+ # print(tdSql.queryResult)
+ if j in ['LT' ,'lt','Lt','lT']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ elif j in ['GT','gt', 'Gt','gT']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (0,), (1,), (2,), (3,), (4,)])
+ elif j in ['LE','le','Le','lE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (4,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ elif j in [ 'GE','ge','Ge','gE']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (1,), (2,), (3,), (4,), (5,)])
+ elif j in ['NE','ne','Ne','nE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (-1,), (0,), (1,), (2,), (3,), (4,)])
+ elif j in ['EQ','eq','Eq','eQ']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ for i in float_list:
+ for j in self.param_list:
+ tdSql.query(f"select stateduration(col{i},'{j}',5) from test1")
+ tdSql.checkRows(10)
+ print(tdSql.queryResult)
+ if j in ['LT','lt','Lt','lT','LE','le','Le','lE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (4,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ elif j in ['GE','ge','Ge','gE','GT','gt','Gt','gT']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (0,), (1,), (2,), (3,), (4,)])
+ elif j in ['NE','ne','Ne','nE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,)])
+ elif j in ['EQ','eq','Eq','eQ']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+
+
+ # timestamp = 1m, time_unit =1m
+ tdSql.execute('''create table test2(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
+ col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned)''')
+ for i in range(self.row_num):
+ tdSql.execute("insert into test2 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
+ % (self.ts + i*1000*60, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
+
+ for i in integer_list:
+ for j in self.param_list:
+ tdSql.query(f"select stateduration(col{i},'{j}',5,1m) from test2")
+ tdSql.checkRows(10)
+ # print(tdSql.queryResult)
+ if j in ['LT' ,'lt','Lt','lT']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ elif j in ['GT','gt', 'Gt','gT']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (0,), (1,), (2,), (3,), (4,)])
+ elif j in ['LE','le','Le','lE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (4,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ elif j in [ 'GE','ge','Ge','gE']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (1,), (2,), (3,), (4,), (5,)])
+ elif j in ['NE','ne','Ne','nE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (-1,), (0,), (1,), (2,), (3,), (4,)])
+ elif j in ['EQ','eq','Eq','eQ']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ for i in float_list:
+ for j in self.param_list:
+ tdSql.query(f"select stateduration(col{i},'{j}',5,1m) from test2")
+ tdSql.checkRows(10)
+ print(tdSql.queryResult)
+ if j in ['LT','lt','Lt','lT','LE','le','Le','lE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (4,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ elif j in ['GE','ge','Ge','gE','GT','gt','Gt','gT']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (0,), (1,), (2,), (3,), (4,)])
+ elif j in ['NE','ne','Ne','nE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,)])
+ elif j in ['EQ','eq','Eq','eQ']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+
+ # timestamp = 1h, time_unit =1h
+ tdSql.execute('''create table test3(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
+ col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned)''')
+ for i in range(self.row_num):
+ tdSql.execute("insert into test3 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
+ % (self.ts + i*1000*60*60, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
+
+ for i in integer_list:
+ for j in self.param_list:
+ tdSql.query(f"select stateduration(col{i},'{j}',5,1h) from test3")
+ tdSql.checkRows(10)
+ # print(tdSql.queryResult)
+ if j in ['LT' ,'lt','Lt','lT']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ elif j in ['GT','gt', 'Gt','gT']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (0,), (1,), (2,), (3,), (4,)])
+ elif j in ['LE','le','Le','lE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (4,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ elif j in [ 'GE','ge','Ge','gE']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (1,), (2,), (3,), (4,), (5,)])
+ elif j in ['NE','ne','Ne','nE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (-1,), (0,), (1,), (2,), (3,), (4,)])
+ elif j in ['EQ','eq','Eq','eQ']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ for i in float_list:
+ for j in self.param_list:
+ tdSql.query(f"select stateduration(col{i},'{j}',5,1h) from test3")
+ tdSql.checkRows(10)
+ print(tdSql.queryResult)
+ if j in ['LT','lt','Lt','lT','LE','le','Le','lE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (4,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ elif j in ['GE','ge','Ge','gE','GT','gt','Gt','gT']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (0,), (1,), (2,), (3,), (4,)])
+ elif j in ['NE','ne','Ne','nE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,)])
+ elif j in ['EQ','eq','Eq','eQ']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+
+ # timestamp = 1h,time_unit =1m
+ for i in integer_list:
+ for j in self.param_list:
+ tdSql.query(f"select stateduration(col{i},'{j}',5,1m) from test3")
+ tdSql.checkRows(10)
+ # print(tdSql.queryResult)
+ if j in ['LT' ,'lt','Lt','lT']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (60,), (120,), (180,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ elif j in ['GT','gt', 'Gt','gT']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (0,), (60,), (120,), (180,), (240,)])
+ elif j in ['LE','le','Le','lE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (60,), (120,), (180,), (240,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ elif j in [ 'GE','ge','Ge','gE']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (60,), (120,), (180,), (240,), (300,)])
+ elif j in ['NE','ne','Ne','nE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (60,), (120,), (180,), (-1,), (0,), (60,), (120,), (180,), (240,)])
+ elif j in ['EQ','eq','Eq','eQ']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ for i in float_list:
+ for j in self.param_list:
+ tdSql.query(f"select stateduration(col{i},'{j}',5,1m) from test3")
+ tdSql.checkRows(10)
+ print(tdSql.queryResult)
+ if j in ['LT','lt','Lt','lT','LE','le','Le','lE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (60,), (120,), (180,), (240,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ elif j in ['GE','ge','Ge','gE','GT','gt','Gt','gT']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (0,), (60,), (120,), (180,), (240,)])
+ elif j in ['NE','ne','Ne','nE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (60,), (120,), (180,), (240,), (300,), (360,), (420,), (480,), (540,)])
+ elif j in ['EQ','eq','Eq','eQ']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+
+ # for stb
+ tdSql.execute('''create table stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
+ col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(t0 int)''')
+ tdSql.execute('create table stb_1 using stb tags(1)')
+ for i in range(self.row_num):
+ tdSql.execute("insert into stb_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
+ % (self.ts + i*1000*60*60, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
+
+ for i in integer_list:
+ for j in self.param_list:
+ tdSql.query(f"select stateduration(col{i},'{j}',5,1h) from stb")
+ tdSql.checkRows(10)
+ # print(tdSql.queryResult)
+ if j in ['LT' ,'lt','Lt','lT']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ elif j in ['GT','gt', 'Gt','gT']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (0,), (1,), (2,), (3,), (4,)])
+ elif j in ['LE','le','Le','lE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (4,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ elif j in [ 'GE','ge','Ge','gE']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (1,), (2,), (3,), (4,), (5,)])
+ elif j in ['NE','ne','Ne','nE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (-1,), (0,), (1,), (2,), (3,), (4,)])
+ elif j in ['EQ','eq','Eq','eQ']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ for i in float_list:
+ for j in self.param_list:
+ tdSql.query(f"select stateduration(col{i},'{j}',5,1h) from stb")
+ tdSql.checkRows(10)
+ print(tdSql.queryResult)
+ if j in ['LT','lt','Lt','lT','LE','le','Le','lE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (4,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+ elif j in ['GE','ge','Ge','gE','GT','gt','Gt','gT']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (0,), (1,), (2,), (3,), (4,)])
+ elif j in ['NE','ne','Ne','nE']:
+ tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,)])
+ elif j in ['EQ','eq','Eq','eQ']:
+ tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,)])
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success("%s successfully executed" % __file__)
+
+tdCases.addWindows(__file__, TDTestCase())
+tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
diff --git a/tests/system-test/2-query/top.py b/tests/system-test/2-query/top.py
index 12e81fa1900ffe2633520359f0051a21434611b6..fbbbb2c99acc2cce1b0cb53a0dafd7f18ec01011 100644
--- a/tests/system-test/2-query/top.py
+++ b/tests/system-test/2-query/top.py
@@ -89,14 +89,15 @@ class TDTestCase:
tdSql.checkEqual(tdSql.queryResult,[(9,),(10,)])
tdSql.query("select ts,top(col1, 2),ts from test1")
tdSql.checkRows(2)
-
+ tdSql.query("select top(col14, 100) from test")
+ tdSql.checkRows(10)
tdSql.query("select ts,top(col1, 2),ts from test group by tbname")
tdSql.checkRows(2)
tdSql.query('select top(col2,1) from test interval(1y) order by col2')
tdSql.checkData(0,0,10)
- tdSql.error('select * from test where bottom(col2,1)=1')
-
+ tdSql.error("select * from test where bottom(col2,1)=1")
+ tdSql.error("select top(col14, 0) from test;")
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
diff --git a/tests/system-test/2-query/unique.py b/tests/system-test/2-query/unique.py
new file mode 100644
index 0000000000000000000000000000000000000000..227efa6f9ceda24df73830bd46838fd657b67d48
--- /dev/null
+++ b/tests/system-test/2-query/unique.py
@@ -0,0 +1,457 @@
+from math import floor
+from random import randint, random
+from numpy import equal
+import taos
+import sys
+import datetime
+import inspect
+
+from util.log import *
+from util.sql import *
+from util.cases import *
+
+class TDTestCase:
+ updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 ,
+ "jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143,
+ "wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"fnDebugFlag":143}
+
+ def init(self, conn, logSql):
+ tdLog.debug(f"start to excute {__file__}")
+ tdSql.init(conn.cursor())
+
+ def prepare_datas(self):
+ tdSql.execute(
+ '''create table stb1
+ (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp)
+ tags (t1 int)
+ '''
+ )
+
+ tdSql.execute(
+ '''
+ create table t1
+ (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp)
+ '''
+ )
+ for i in range(4):
+ tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )')
+
+ for i in range(9):
+ tdSql.execute(
+ f"insert into ct1 values ( now()-{i*10}s, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )"
+ )
+ tdSql.execute(
+ f"insert into ct4 values ( now()-{i*90}d, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )"
+ )
+ tdSql.execute("insert into ct1 values (now()-45s, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar0', now()+8a )")
+ tdSql.execute("insert into ct1 values (now()+10s, 9, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )")
+ tdSql.execute("insert into ct1 values (now()+15s, 9, -99999, -999, -99, -9.99, NULL, 1, 'binary9', 'nchar9', now()+9a )")
+ tdSql.execute("insert into ct1 values (now()+20s, 9, -99999, -999, NULL, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )")
+
+ tdSql.execute("insert into ct4 values (now()-810d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ")
+ tdSql.execute("insert into ct4 values (now()-400d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ")
+ tdSql.execute("insert into ct4 values (now()+90d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ")
+
+ tdSql.execute(
+ f'''insert into t1 values
+ ( '2020-04-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
+ ( '2020-10-21 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now()+1a )
+ ( '2020-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now()+2a )
+ ( '2021-01-01 01:01:06.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now()+3a )
+ ( '2021-05-07 01:01:10.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now()+4a )
+ ( '2021-07-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
+ ( '2021-09-30 01:01:16.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now()+5a )
+ ( '2022-02-01 01:01:20.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now()+6a )
+ ( '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" )
+ ( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )
+ '''
+ )
+
+ def test_errors(self):
+ error_sql_lists = [
+ "select unique from t1",
+ "select unique(123--123)==1 from t1",
+ "select unique(123,123) from t1",
+ "select unique(c1,ts) from t1",
+ "select unique(c1,c1,ts) from t1",
+ "select unique(c1) as 'd1' from t1",
+ "select unique(c1 ,c2 ) from t1",
+ "select unique(c1 ,NULL) from t1",
+ "select unique(,) from t1;",
+ "select unique(floor(c1) ab from t1)",
+ "select unique(c1) as int from t1",
+ "select unique('c1') from t1",
+ "select unique(NULL) from t1",
+ "select unique('') from t1",
+ "select unique(c%) from t1",
+ "select unique(t1) from t1",
+ "select unique(True) from t1",
+ "select unique(c1) , count(c1) from t1",
+ "select unique(c1) , avg(c1) from t1",
+ "select unique(c1) , min(c1) from t1",
+ "select unique(c1) , spread(c1) from t1",
+ "select unique(c1) , diff(c1) from t1",
+ "select unique(c1) , abs(c1) from t1",
+ "select unique(c1) , c1 from t1",
+ "select unique from stb1 partition by tbname",
+ "select unique(123--123)==1 from stb1 partition by tbname",
+ "select unique(123) from stb1 partition by tbname",
+ "select unique(c1,ts) from stb1 partition by tbname",
+ "select unique(c1,c1,ts) from stb1 partition by tbname",
+ "select unique(c1) as 'd1' from stb1 partition by tbname",
+ "select unique(c1 ,c2 ) from stb1 partition by tbname",
+ "select unique(c1 ,NULL) from stb1 partition by tbname",
+ "select unique(,) from stb1 partition by tbname;",
+ "select unique(floor(c1) ab from stb1 partition by tbname)",
+ "select unique(c1) as int from stb1 partition by tbname",
+ "select unique('c1') from stb1 partition by tbname",
+ "select unique(NULL) from stb1 partition by tbname",
+ "select unique('') from stb1 partition by tbname",
+ "select unique(c%) from stb1 partition by tbname",
+ #"select unique(t1) from stb1 partition by tbname",
+ "select unique(True) from stb1 partition by tbname",
+ "select unique(c1) , count(c1) from stb1 partition by tbname",
+ "select unique(c1) , avg(c1) from stb1 partition by tbname",
+ "select unique(c1) , min(c1) from stb1 partition by tbname",
+ "select unique(c1) , spread(c1) from stb1 partition by tbname",
+ "select unique(c1) , diff(c1) from stb1 partition by tbname",
+ "select unique(c1) , abs(c1) from stb1 partition by tbname",
+ "select unique(c1) , c1 from stb1 partition by tbname"
+
+ ]
+ for error_sql in error_sql_lists:
+ tdSql.error(error_sql)
+ pass
+
+ def support_types(self):
+ other_no_value_types = [
+ "select unique(ts) from t1" ,
+ "select unique(c7) from t1",
+ "select unique(c8) from t1",
+ "select unique(c9) from t1",
+ "select unique(ts) from ct1" ,
+ "select unique(c7) from ct1",
+ "select unique(c8) from ct1",
+ "select unique(c9) from ct1",
+ "select unique(ts) from ct3" ,
+ "select unique(c7) from ct3",
+ "select unique(c8) from ct3",
+ "select unique(c9) from ct3",
+ "select unique(ts) from ct4" ,
+ "select unique(c7) from ct4",
+ "select unique(c8) from ct4",
+ "select unique(c9) from ct4",
+ "select unique(ts) from stb1 partition by tbname" ,
+ "select unique(c7) from stb1 partition by tbname",
+ "select unique(c8) from stb1 partition by tbname",
+ "select unique(c9) from stb1 partition by tbname"
+ ]
+
+ for type_sql in other_no_value_types:
+ tdSql.query(type_sql)
+ tdLog.info("support type ok , sql is : %s"%type_sql)
+
+ type_sql_lists = [
+ "select unique(c1) from t1",
+ "select unique(c2) from t1",
+ "select unique(c3) from t1",
+ "select unique(c4) from t1",
+ "select unique(c5) from t1",
+ "select unique(c6) from t1",
+
+ "select unique(c1) from ct1",
+ "select unique(c2) from ct1",
+ "select unique(c3) from ct1",
+ "select unique(c4) from ct1",
+ "select unique(c5) from ct1",
+ "select unique(c6) from ct1",
+
+ "select unique(c1) from ct3",
+ "select unique(c2) from ct3",
+ "select unique(c3) from ct3",
+ "select unique(c4) from ct3",
+ "select unique(c5) from ct3",
+ "select unique(c6) from ct3",
+
+ "select unique(c1) from stb1 partition by tbname",
+ "select unique(c2) from stb1 partition by tbname",
+ "select unique(c3) from stb1 partition by tbname",
+ "select unique(c4) from stb1 partition by tbname",
+ "select unique(c5) from stb1 partition by tbname",
+ "select unique(c6) from stb1 partition by tbname",
+
+ "select unique(c6) as alisb from stb1 partition by tbname",
+ "select unique(c6) alisb from stb1 partition by tbname",
+ ]
+
+ for type_sql in type_sql_lists:
+ tdSql.query(type_sql)
+
+ def check_unique_table(self , unique_sql):
+ # unique_sql = "select unique(c1) from ct1"
+ origin_sql = unique_sql.replace("unique(","").replace(")","")
+ tdSql.query(unique_sql)
+ unique_result = tdSql.queryResult
+
+ unique_datas = []
+ for elem in unique_result:
+ unique_datas.append(elem[0])
+
+
+ tdSql.query(origin_sql)
+ origin_result = tdSql.queryResult
+ origin_datas = []
+ for elem in origin_result:
+ origin_datas.append(elem[0])
+
+ pre_unique = []
+ for elem in origin_datas:
+ if elem in pre_unique:
+ continue
+ else:
+ pre_unique.append(elem)
+
+ if pre_unique == unique_datas:
+ tdLog.info(" unique query check pass , unique sql is: %s" %unique_sql)
+ else:
+ tdLog.exit(" unique query check fail , unique sql is: %s " %unique_sql)
+
+ def basic_unique_function(self):
+
+ # basic query
+ tdSql.query("select c1 from ct3")
+ tdSql.checkRows(0)
+ tdSql.query("select c1 from t1")
+ tdSql.checkRows(12)
+ tdSql.query("select c1 from stb1")
+ tdSql.checkRows(25)
+
+ # used for empty table , ct3 is empty
+ tdSql.query("select unique(c1) from ct3")
+ tdSql.checkRows(0)
+ tdSql.query("select unique(c2) from ct3")
+ tdSql.checkRows(0)
+ tdSql.query("select unique(c3) from ct3")
+ tdSql.checkRows(0)
+ tdSql.query("select unique(c4) from ct3")
+ tdSql.checkRows(0)
+ tdSql.query("select unique(c5) from ct3")
+ tdSql.checkRows(0)
+ tdSql.query("select unique(c6) from ct3")
+
+ # will support _rowts mix with
+ # tdSql.query("select unique(c6),_rowts from ct3")
+
+ # auto check for t1 table
+ # used for regular table
+ tdSql.query("select unique(c1) from t1")
+
+ tdSql.query("desc t1")
+ col_lists_rows = tdSql.queryResult
+ col_lists = []
+ for col_name in col_lists_rows:
+ col_lists.append(col_name[0])
+
+ for col in col_lists:
+ self.check_unique_table(f"select unique({col}) from t1")
+
+ # unique with super tags
+
+ tdSql.query("select unique(c1) from ct1")
+ tdSql.checkRows(10)
+
+ tdSql.query("select unique(c1) from ct4")
+ tdSql.checkRows(10)
+
+ tdSql.error("select unique(c1),tbname from ct1")
+ tdSql.error("select unique(c1),t1 from ct1")
+
+ # unique with common col
+ tdSql.error("select unique(c1) ,ts from ct1")
+ tdSql.error("select unique(c1) ,c1 from ct1")
+
+ # unique with scalar function
+ tdSql.error("select unique(c1) ,abs(c1) from ct1")
+ tdSql.error("select unique(c1) , unique(c2) from ct1")
+ tdSql.error("select unique(c1) , abs(c2)+2 from ct1")
+
+
+ # unique with aggregate function
+ tdSql.error("select unique(c1) ,sum(c1) from ct1")
+ tdSql.error("select unique(c1) ,max(c1) from ct1")
+ tdSql.error("select unique(c1) ,csum(c1) from ct1")
+ tdSql.error("select unique(c1) ,count(c1) from ct1")
+
+ # unique with filter where
+ tdSql.query("select unique(c1) from ct4 where c1 is null")
+ tdSql.checkData(0, 0, None)
+
+ tdSql.query("select unique(c1) from ct4 where c1 >2 ")
+ tdSql.checkData(0, 0, 8)
+ tdSql.checkData(1, 0, 7)
+ tdSql.checkData(2, 0, 6)
+ tdSql.checkData(5, 0, 3)
+
+ tdSql.query("select unique(c1) from ct4 where c2 between 0 and 99999")
+ tdSql.checkData(0, 0, 8)
+ tdSql.checkData(1, 0, 7)
+ tdSql.checkData(2, 0, 6)
+ tdSql.checkData(3, 0, 5)
+ tdSql.checkData(4, 0, 4)
+ tdSql.checkData(5, 0, 3)
+ tdSql.checkData(6, 0, 2)
+ tdSql.checkData(7, 0, 1)
+ tdSql.checkData(8, 0, 0)
+
+ # unique with union all
+ tdSql.query("select unique(c1) from ct4 union all select c1 from ct1")
+ tdSql.checkRows(23)
+ tdSql.query("select unique(c1) from ct4 union all select distinct(c1) from ct4")
+ tdSql.checkRows(20)
+ tdSql.query("select unique(c2) from ct4 union all select abs(c2)/2 from ct4")
+ tdSql.checkRows(22)
+
+ # unique with join
+ # prepare join datas with same ts
+
+ tdSql.execute(" use db ")
+ tdSql.execute(" create stable st1 (ts timestamp , num int) tags(ind int)")
+ tdSql.execute(" create table tb1 using st1 tags(1)")
+ tdSql.execute(" create table tb2 using st1 tags(2)")
+
+ tdSql.execute(" create stable st2 (ts timestamp , num int) tags(ind int)")
+ tdSql.execute(" create table ttb1 using st2 tags(1)")
+ tdSql.execute(" create table ttb2 using st2 tags(2)")
+
+ start_ts = 1622369635000 # 2021-05-30 18:13:55
+
+ for i in range(10):
+ ts_value = start_ts+i*1000
+ tdSql.execute(f" insert into tb1 values({ts_value} , {i})")
+ tdSql.execute(f" insert into tb2 values({ts_value} , {i})")
+
+ tdSql.execute(f" insert into ttb1 values({ts_value} , {i})")
+ tdSql.execute(f" insert into ttb2 values({ts_value} , {i})")
+
+ tdSql.query("select unique(tb2.num) from tb1, tb2 where tb1.ts=tb2.ts ")
+ tdSql.checkRows(10)
+ tdSql.checkData(0,0,0)
+ tdSql.checkData(1,0,1)
+ tdSql.checkData(2,0,2)
+ tdSql.checkData(9,0,9)
+
+ tdSql.query("select unique(tb2.num) from tb1, tb2 where tb1.ts=tb2.ts union all select unique(tb1.num) from tb1, tb2 where tb1.ts=tb2.ts ")
+ tdSql.checkRows(20)
+ tdSql.checkData(0,0,0)
+ tdSql.checkData(1,0,1)
+ tdSql.checkData(2,0,2)
+ tdSql.checkData(9,0,9)
+
+ # nest query
+ # tdSql.query("select unique(c1) from (select c1 from ct1)")
+ tdSql.query("select c1 from (select unique(c1) c1 from ct4)")
+ tdSql.checkRows(10)
+ tdSql.checkData(0, 0, None)
+ tdSql.checkData(1, 0, 8)
+ tdSql.checkData(9, 0, 0)
+
+ tdSql.query("select sum(c1) from (select unique(c1) c1 from ct1)")
+ tdSql.checkRows(1)
+ tdSql.checkData(0, 0, 45)
+
+ tdSql.query("select sum(c1) from (select distinct(c1) c1 from ct1) union all select sum(c1) from (select unique(c1) c1 from ct1)")
+ tdSql.checkRows(2)
+ tdSql.checkData(0, 0, 45)
+ tdSql.checkData(1, 0, 45)
+
+ tdSql.query("select 1-abs(c1) from (select unique(c1) c1 from ct4)")
+ tdSql.checkRows(10)
+ tdSql.checkData(0, 0, None)
+ tdSql.checkData(1, 0, -7.000000000)
+
+
+ # bug for stable
+ #partition by tbname
+ # tdSql.query(" select unique(c1) from stb1 partition by tbname ")
+ # tdSql.checkRows(21)
+
+ # tdSql.query(" select unique(c1) from stb1 partition by tbname ")
+ # tdSql.checkRows(21)
+
+ # group by
+ tdSql.error("select unique(c1) from ct1 group by c1")
+ tdSql.error("select unique(c1) from ct1 group by tbname")
+
+ # super table
+
+
+
+
+ def check_boundary_values(self):
+
+ tdSql.execute("drop database if exists bound_test")
+ tdSql.execute("create database if not exists bound_test")
+ tdSql.execute("use bound_test")
+ tdSql.execute(
+ "create table stb_bound (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(32),c9 nchar(32), c10 timestamp) tags (t1 int);"
+ )
+ tdSql.execute(f'create table sub1_bound using stb_bound tags ( 1 )')
+ tdSql.execute(
+ f"insert into sub1_bound values ( now()-1s, 2147483647, 9223372036854775807, 32767, 127, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
+ )
+ tdSql.execute(
+ f"insert into sub1_bound values ( now(), 2147483646, 9223372036854775806, 32766, 126, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
+ )
+
+ tdSql.execute(
+ f"insert into sub1_bound values ( now(), -2147483646, -9223372036854775806, -32766, -126, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
+ )
+
+ tdSql.execute(
+ f"insert into sub1_bound values ( now(), 2147483643, 9223372036854775803, 32763, 123, 3.39E+38, 1.69e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
+ )
+
+ tdSql.execute(
+ f"insert into sub1_bound values ( now(), -2147483643, -9223372036854775803, -32763, -123, -3.39E+38, -1.69e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
+ )
+
+ tdSql.error(
+ f"insert into sub1_bound values ( now()+1s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )"
+ )
+
+ tdSql.query("select unique(c2) from sub1_bound")
+ tdSql.checkRows(5)
+ tdSql.checkData(0,0,9223372036854775807)
+
+ def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
+ tdSql.prepare()
+
+ tdLog.printNoPrefix("==========step1:create table ==============")
+
+ self.prepare_datas()
+
+ tdLog.printNoPrefix("==========step2:test errors ==============")
+
+ self.test_errors()
+
+ tdLog.printNoPrefix("==========step3:support types ============")
+
+ self.support_types()
+
+ tdLog.printNoPrefix("==========step4: floor basic query ============")
+
+ self.basic_unique_function()
+
+ tdLog.printNoPrefix("==========step5: floor boundary query ============")
+
+ self.check_boundary_values()
+
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success(f"{__file__} successfully executed")
+
+tdCases.addLinux(__file__, TDTestCase())
+tdCases.addWindows(__file__, TDTestCase())
diff --git a/tests/system-test/7-tmq/subscribeDb1.py b/tests/system-test/7-tmq/subscribeDb1.py
index 56db157ab849f609eb22debde6936d2de406ee06..b86364b9c3ce4fd3750cba8a3cd96ee744473b11 100644
--- a/tests/system-test/7-tmq/subscribeDb1.py
+++ b/tests/system-test/7-tmq/subscribeDb1.py
@@ -382,6 +382,7 @@ class TDTestCase:
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt))
tdLog.exit("tmq consume rows error!")
+ time.sleep(15)
tdSql.query("drop topic %s"%topicName1)
tdLog.printNoPrefix("======== test case 10 end ...... ")
@@ -453,6 +454,7 @@ class TDTestCase:
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt))
tdLog.exit("tmq consume rows error!")
+ time.sleep(15)
tdSql.query("drop topic %s"%topicName1)
tdLog.printNoPrefix("======== test case 11 end ...... ")
diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh
old mode 100755
new mode 100644
index 37c7f18177d27a7b56f4d6219b0151f973cd8cbb..a3770b381cab021ced958d12face0352ffc51067
--- a/tests/system-test/fulltest.sh
+++ b/tests/system-test/fulltest.sh
@@ -14,6 +14,9 @@ python3 ./test.py -f 0-others/udf_restart_taosd.py
python3 ./test.py -f 0-others/user_control.py
python3 ./test.py -f 0-others/fsync.py
+python3 ./test.py -f 1-insert/opentsdb_telnet_line_taosc_insert.py
+python3 ./test.py -f 1-insert/test_stmt_muti_insert_query.py
+
python3 ./test.py -f 2-query/between.py
python3 ./test.py -f 2-query/distinct.py
python3 ./test.py -f 2-query/varchar.py
@@ -53,8 +56,8 @@ python3 ./test.py -f 2-query/Timediff.py
python3 ./test.py -f 2-query/top.py
python3 ./test.py -f 2-query/bottom.py
-
-
+python3 ./test.py -f 2-query/percentile.py
+python3 ./test.py -f 2-query/apercentile.py
python3 ./test.py -f 2-query/abs.py
python3 ./test.py -f 2-query/ceil.py
python3 ./test.py -f 2-query/floor.py
@@ -70,6 +73,18 @@ python3 ./test.py -f 2-query/arccos.py
python3 ./test.py -f 2-query/arctan.py
python3 ./test.py -f 2-query/query_cols_tags_and_or.py
# python3 ./test.py -f 2-query/nestedQuery.py
+# TD-15983 subquery output duplicate name column.
+# Please Xiangyang Guo modify the following script
+# python3 ./test.py -f 2-query/nestedQuery_str.py
+python3 ./test.py -f 2-query/avg.py
+python3 ./test.py -f 2-query/elapsed.py
+python3 ./test.py -f 2-query/csum.py
+python3 ./test.py -f 2-query/mavg.py
+python3 ./test.py -f 2-query/diff.py
+python3 ./test.py -f 2-query/sample.py
+python3 ./test.py -f 2-query/function_diff.py
+python3 ./test.py -f 2-query/unique.py
+python3 ./test.py -f 2-query/stateduration.py
python3 ./test.py -f 7-tmq/basic5.py
python3 ./test.py -f 7-tmq/subscribeDb.py
@@ -81,4 +96,3 @@ python3 ./test.py -f 7-tmq/subscribeStb1.py
python3 ./test.py -f 7-tmq/subscribeStb2.py
python3 ./test.py -f 7-tmq/subscribeStb3.py
python3 ./test.py -f 7-tmq/subscribeStb4.py
-python3 ./test.py -f 7-tmq/subscribeStb2.py
diff --git a/tests/system-test/insert.json b/tests/system-test/insert.json
deleted file mode 100644
index 5dea9eabfef35de733e70c7a7ac251b53f5c3563..0000000000000000000000000000000000000000
--- a/tests/system-test/insert.json
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "filetype": "insert",
- "cfgdir": "/etc/taos",
- "host": "127.0.0.1",
- "port": 6030,
- "user": "root",
- "password": "taosdata",
- "thread_count": 16,
- "create_table_thread_count": 1,
- "result_file": "./insert_res.txt",
- "confirm_parameter_prompt": "no",
- "insert_interval": 0,
- "interlace_rows": 0,
- "num_of_records_per_req": 10000,
- "prepared_rand": 10000,
- "chinese": "no",
- "databases": [
- {
- "dbinfo": {
- "name": "db",
- "drop": "yes",
- "vgroups":4,
- "replica": 1,
- "precision": "ms"
- },
- "super_tables": [
- {
- "name": "stb",
- "child_table_exists": "no",
- "childtable_count": 1000,
- "childtable_prefix": "stb_",
- "escape_character": "no",
- "auto_create_table": "no",
- "batch_create_tbl_num": 10,
- "data_source": "rand",
- "insert_mode": "taosc",
- "non_stop_mode": "no",
- "line_protocol": "line",
- "insert_rows": 100000,
- "interlace_rows": 0,
- "insert_interval": 0,
- "disorder_ratio": 0,
- "timestamp_step": 1,
- "start_timestamp": "2020-10-01 00:00:00.000",
- "use_sample_ts": "no",
- "tags_file": "",
- "columns": [
- {
- "type": "FLOAT",
- "name": "current",
- "count": 4,
- "max": 12,
- "min": 8
- },
- { "type": "INT", "name": "voltage", "max": 225, "min": 215 },
- { "type": "FLOAT", "name": "phase", "max": 1, "min": 0 }
- ],
- "tags": [
- {
- "type": "TINYINT",
- "name": "groupid",
- "max": 10,
- "min": 1
- },
- {
- "name": "location",
- "type": "BINARY",
- "len": 16,
- "values": ["beijing", "shanghai"]
- }
- ]
- }
- ]
- }
- ]
-}
diff --git a/tests/system-test/test.py b/tests/system-test/test.py
index 6fd7237b339dc1d2eeeee1d1f5965ec77d03b53d..a11085708c42ec63672129d37636e30fb9140598 100644
--- a/tests/system-test/test.py
+++ b/tests/system-test/test.py
@@ -37,6 +37,7 @@ if __name__ == "__main__":
masterIp = ""
testCluster = False
valgrind = 0
+ killValgrind = 1
logSql = True
stop = 0
restart = False
@@ -45,8 +46,8 @@ if __name__ == "__main__":
windows = 1
updateCfgDict = {}
execCmd = ""
- opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scghrd:e:', [
- 'file=', 'path=', 'master', 'logSql', 'stop', 'cluster', 'valgrind', 'help', 'restart', 'updateCfgDict', 'execCmd'])
+ opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scghrd:k:e:', [
+ 'file=', 'path=', 'master', 'logSql', 'stop', 'cluster', 'valgrind', 'help', 'restart', 'updateCfgDict', 'killv', 'execCmd'])
for key, value in opts:
if key in ['-h', '--help']:
tdLog.printNoPrefix(
@@ -60,6 +61,7 @@ if __name__ == "__main__":
tdLog.printNoPrefix('-g valgrind Test Flag')
tdLog.printNoPrefix('-r taosd restart test')
tdLog.printNoPrefix('-d update cfg dict, base64 json str')
+ tdLog.printNoPrefix('-k not kill valgrind processer')
tdLog.printNoPrefix('-e eval str to run')
sys.exit(0)
@@ -100,6 +102,9 @@ if __name__ == "__main__":
print('updateCfgDict convert fail.')
sys.exit(0)
+ if key in ['-k', '--killValgrind']:
+ killValgrind = 0
+
if key in ['-e', '--execCmd']:
try:
execCmd = base64.b64decode(value.encode()).decode()
@@ -145,7 +150,11 @@ if __name__ == "__main__":
if masterIp == "":
host = '127.0.0.1'
else:
- host = masterIp
+ try:
+ config = eval(masterIp)
+ host = config["host"]
+ except Exception as r:
+ host = masterIp
tdLog.info("Procedures for tdengine deployed in %s" % (host))
if windows:
@@ -185,6 +194,7 @@ if __name__ == "__main__":
else:
tdCases.runAllWindows(conn)
else:
+ tdDnodes.setKillValgrind(killValgrind)
tdDnodes.init(deployPath, masterIp)
tdDnodes.setTestCluster(testCluster)
tdDnodes.setValgrind(valgrind)
diff --git a/tests/test/c/CMakeLists.txt b/tests/test/c/CMakeLists.txt
index 964f9fee4abbdc244b83f50390c2b660be6b476c..505c290f2a7b45cdba530fcfbad3e42adefdea90 100644
--- a/tests/test/c/CMakeLists.txt
+++ b/tests/test/c/CMakeLists.txt
@@ -23,20 +23,18 @@ target_link_libraries(
PUBLIC os
)
-if(NOT TD_WINDOWS)
- add_executable(sdbDump sdbDump.c)
- target_link_libraries(
- sdbDump
- PUBLIC dnode
- PUBLIC mnode
- PUBLIC sdb
- PUBLIC os
- )
- target_include_directories(
- sdbDump
- PUBLIC "${TD_SOURCE_DIR}/include/dnode/mnode"
- PRIVATE "${TD_SOURCE_DIR}/source/dnode/mnode/impl/inc"
- PRIVATE "${TD_SOURCE_DIR}/source/dnode/mnode/sdb/inc"
- PRIVATE "${TD_SOURCE_DIR}/source/dnode/mgmt/node_mgmt/inc"
- )
-ENDIF ()
\ No newline at end of file
+add_executable(sdbDump sdbDump.c)
+target_link_libraries(
+ sdbDump
+ PUBLIC dnode
+ PUBLIC mnode
+ PUBLIC sdb
+ PUBLIC os
+)
+target_include_directories(
+ sdbDump
+ PUBLIC "${TD_SOURCE_DIR}/include/dnode/mnode"
+ PRIVATE "${TD_SOURCE_DIR}/source/dnode/mnode/impl/inc"
+ PRIVATE "${TD_SOURCE_DIR}/source/dnode/mnode/sdb/inc"
+ PRIVATE "${TD_SOURCE_DIR}/source/dnode/mgmt/node_mgmt/inc"
+)
\ No newline at end of file
diff --git a/tests/test/c/sdbDump.c b/tests/test/c/sdbDump.c
index 31da855164555ab155b0f4758a817f5f6d08b183..b2f66a7e76337ce6bc51905107dc8aa500f08c2a 100644
--- a/tests/test/c/sdbDump.c
+++ b/tests/test/c/sdbDump.c
@@ -21,12 +21,12 @@
#include "tjson.h"
#define TMP_DNODE_DIR TD_TMP_DIR_PATH "dumpsdb"
-#define TMP_MNODE_DIR TD_TMP_DIR_PATH "dumpsdb/mnode"
-#define TMP_SDB_DATA_DIR TD_TMP_DIR_PATH "dumpsdb/mnode/data"
-#define TMP_SDB_SYNC_DIR TD_TMP_DIR_PATH "dumpsdb/mnode/sync"
-#define TMP_SDB_DATA_FILE TD_TMP_DIR_PATH "dumpsdb/mnode/data/sdb.data"
-#define TMP_SDB_RAFT_CFG_FILE TD_TMP_DIR_PATH "dumpsdb/mnode/sync/raft_config.json"
-#define TMP_SDB_RAFT_STORE_FILE TD_TMP_DIR_PATH "dumpsdb/mnode/sync/raft_store.json"
+#define TMP_MNODE_DIR TD_TMP_DIR_PATH "dumpsdb" TD_DIRSEP "mnode"
+#define TMP_SDB_DATA_DIR TD_TMP_DIR_PATH "dumpsdb" TD_DIRSEP "mnode" TD_DIRSEP "data"
+#define TMP_SDB_SYNC_DIR TD_TMP_DIR_PATH "dumpsdb" TD_DIRSEP "mnode" TD_DIRSEP "sync"
+#define TMP_SDB_DATA_FILE TD_TMP_DIR_PATH "dumpsdb" TD_DIRSEP "mnode" TD_DIRSEP "data" TD_DIRSEP "sdb.data"
+#define TMP_SDB_RAFT_CFG_FILE TD_TMP_DIR_PATH "dumpsdb" TD_DIRSEP "mnode" TD_DIRSEP "sync" TD_DIRSEP "raft_config.json"
+#define TMP_SDB_RAFT_STORE_FILE TD_TMP_DIR_PATH "dumpsdb" TD_DIRSEP "mnode" TD_DIRSEP "sync" TD_DIRSEP "raft_store.json"
void reportStartup(const char *name, const char *desc) {}
@@ -411,13 +411,23 @@ int32_t parseArgs(int32_t argc, char *argv[]) {
char dataFile[PATH_MAX] = {0};
char raftCfgFile[PATH_MAX] = {0};
char raftStoreFile[PATH_MAX] = {0};
- snprintf(dataFile, PATH_MAX, "%s/mnode/data/sdb.data", tsDataDir);
- snprintf(raftCfgFile, PATH_MAX, "%s/mnode/sync/raft_config.json", tsDataDir);
- snprintf(raftStoreFile, PATH_MAX, "%s/mnode/sync/raft_store.json", tsDataDir);
+ snprintf(dataFile, PATH_MAX, "%s" TD_DIRSEP "mnode" TD_DIRSEP "data" TD_DIRSEP "sdb.data", tsDataDir);
+ snprintf(raftCfgFile, PATH_MAX, "%s" TD_DIRSEP "mnode" TD_DIRSEP "sync" TD_DIRSEP "raft_config.json", tsDataDir);
+ snprintf(raftStoreFile, PATH_MAX, "%s" TD_DIRSEP "mnode" TD_DIRSEP "sync" TD_DIRSEP "raft_store.json", tsDataDir);
char cmd[PATH_MAX * 2] = {0};
snprintf(cmd, sizeof(cmd), "rm -rf %s", TMP_DNODE_DIR);
system(cmd);
+#ifdef WINDOWS
+ taosMulMkDir(TMP_SDB_DATA_DIR);
+ taosMulMkDir(TMP_SDB_SYNC_DIR);
+ snprintf(cmd, sizeof(cmd), "cp %s %s 2>nul", dataFile, TMP_SDB_DATA_FILE);
+ system(cmd);
+ snprintf(cmd, sizeof(cmd), "cp %s %s 2>nul", raftCfgFile, TMP_SDB_RAFT_CFG_FILE);
+ system(cmd);
+ snprintf(cmd, sizeof(cmd), "cp %s %s 2>nul", raftStoreFile, TMP_SDB_RAFT_STORE_FILE);
+ system(cmd);
+#else
snprintf(cmd, sizeof(cmd), "mkdir -p %s", TMP_SDB_DATA_DIR);
system(cmd);
snprintf(cmd, sizeof(cmd), "mkdir -p %s", TMP_SDB_SYNC_DIR);
@@ -428,6 +438,7 @@ int32_t parseArgs(int32_t argc, char *argv[]) {
system(cmd);
snprintf(cmd, sizeof(cmd), "cp %s %s 2>/dev/null", raftStoreFile, TMP_SDB_RAFT_STORE_FILE);
system(cmd);
+#endif
strcpy(tsDataDir, TMP_DNODE_DIR);
return 0;