Merge branch 'develop' of github.com:taosdata/TDengine into devx
This commit is contained in:
commit
d382c50b4d
10
README-CN.md
10
README-CN.md
|
@ -23,7 +23,7 @@ TDengine是涛思数据专为物联网、车联网、工业互联网、IT运维
|
||||||
|
|
||||||
TDengine是一个高效的存储、查询、分析时序大数据的平台,专为物联网、车联网、工业互联网、运维监测等优化而设计。您可以像使用关系型数据库MySQL一样来使用它,但建议您在使用前仔细阅读一遍下面的文档,特别是 [数据模型](https://www.taosdata.com/cn/documentation/architecture) 与 [数据建模](https://www.taosdata.com/cn/documentation/model)。除本文档之外,欢迎 [下载产品白皮书](https://www.taosdata.com/downloads/TDengine%20White%20Paper.pdf)。
|
TDengine是一个高效的存储、查询、分析时序大数据的平台,专为物联网、车联网、工业互联网、运维监测等优化而设计。您可以像使用关系型数据库MySQL一样来使用它,但建议您在使用前仔细阅读一遍下面的文档,特别是 [数据模型](https://www.taosdata.com/cn/documentation/architecture) 与 [数据建模](https://www.taosdata.com/cn/documentation/model)。除本文档之外,欢迎 [下载产品白皮书](https://www.taosdata.com/downloads/TDengine%20White%20Paper.pdf)。
|
||||||
|
|
||||||
# 生成
|
# 构建
|
||||||
|
|
||||||
TDengine目前2.0版服务器仅能在Linux系统上安装和运行,后续会支持Windows、macOS等系统。客户端可以在Windows或Linux上安装和运行。任何OS的应用也可以选择RESTful接口连接服务器taosd。CPU支持X64/ARM64/MIPS64/Alpha64,后续会支持ARM32、RISC-V等CPU架构。用户可根据需求选择通过[源码](https://www.taosdata.com/cn/getting-started/#通过源码安装)或者[安装包](https://www.taosdata.com/cn/getting-started/#通过安装包安装)来安装。本快速指南仅适用于通过源码安装。
|
TDengine目前2.0版服务器仅能在Linux系统上安装和运行,后续会支持Windows、macOS等系统。客户端可以在Windows或Linux上安装和运行。任何OS的应用也可以选择RESTful接口连接服务器taosd。CPU支持X64/ARM64/MIPS64/Alpha64,后续会支持ARM32、RISC-V等CPU架构。用户可根据需求选择通过[源码](https://www.taosdata.com/cn/getting-started/#通过源码安装)或者[安装包](https://www.taosdata.com/cn/getting-started/#通过安装包安装)来安装。本快速指南仅适用于通过源码安装。
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ Go 连接器和 Grafana 插件在其他独立仓库,如果安装它们的话
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
```
|
```
|
||||||
|
|
||||||
## 生成 TDengine
|
## 构建 TDengine
|
||||||
|
|
||||||
### Linux 系统
|
### Linux 系统
|
||||||
|
|
||||||
|
@ -116,6 +116,12 @@ mkdir debug && cd debug
|
||||||
cmake .. && cmake --build .
|
cmake .. && cmake --build .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
您可以选择使用 Jemalloc 作为内存分配器,替代默认的 glibc:
|
||||||
|
```bash
|
||||||
|
apt install autoconf
|
||||||
|
cmake .. -DJEMALLOC_ENABLED=true
|
||||||
|
```
|
||||||
|
|
||||||
在X86-64、X86、arm64、arm32 和 mips64 平台上,TDengine 生成脚本可以自动检测机器架构。也可以手动配置 CPUTYPE 参数来指定 CPU 类型,如 aarch64 或 aarch32 等。
|
在X86-64、X86、arm64、arm32 和 mips64 平台上,TDengine 生成脚本可以自动检测机器架构。也可以手动配置 CPUTYPE 参数来指定 CPU 类型,如 aarch64 或 aarch32 等。
|
||||||
|
|
||||||
aarch64:
|
aarch64:
|
||||||
|
|
|
@ -110,6 +110,12 @@ mkdir debug && cd debug
|
||||||
cmake .. && cmake --build .
|
cmake .. && cmake --build .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can use Jemalloc as memory allocator instead of glibc:
|
||||||
|
```
|
||||||
|
apt install autoconf
|
||||||
|
cmake .. -DJEMALLOC_ENABLED=true
|
||||||
|
```
|
||||||
|
|
||||||
TDengine build script can detect the host machine's architecture on X86-64, X86, arm64, arm32 and mips64 platform.
|
TDengine build script can detect the host machine's architecture on X86-64, X86, arm64, arm32 and mips64 platform.
|
||||||
You can also specify CPUTYPE option like aarch64 or aarch32 too if the detection result is not correct:
|
You can also specify CPUTYPE option like aarch64 or aarch32 too if the detection result is not correct:
|
||||||
|
|
||||||
|
|
|
@ -427,12 +427,15 @@ TDengine提供时间驱动的实时流式计算API。可以每隔一指定的时
|
||||||
* res:查询结果集,注意结果集中可能没有记录
|
* res:查询结果集,注意结果集中可能没有记录
|
||||||
* param:调用 `taos_subscribe`时客户程序提供的附加参数
|
* param:调用 `taos_subscribe`时客户程序提供的附加参数
|
||||||
* code:错误码
|
* code:错误码
|
||||||
|
|
||||||
**注意**:在这个回调函数里不可以做耗时过长的处理,尤其是对于返回的结果集中数据较多的情况,否则有可能导致客户端阻塞等异常状态。如果必须进行复杂计算,则建议在另外的线程中进行处理。
|
**注意**:在这个回调函数里不可以做耗时过长的处理,尤其是对于返回的结果集中数据较多的情况,否则有可能导致客户端阻塞等异常状态。如果必须进行复杂计算,则建议在另外的线程中进行处理。
|
||||||
|
|
||||||
* `TAOS_RES *taos_consume(TAOS_SUB *tsub)`
|
* `TAOS_RES *taos_consume(TAOS_SUB *tsub)`
|
||||||
|
|
||||||
同步模式下,该函数用来获取订阅的结果。 用户应用程序将其置于一个循环之中。 如两次调用`taos_consume`的间隔小于订阅的轮询周期,API将会阻塞,直到时间间隔超过此周期。 如果数据库有新记录到达,该API将返回该最新的记录,否则返回一个没有记录的空结果集。 如果返回值为 `NULL`,说明系统出错。 异步模式下,用户程序不应调用此API。
|
同步模式下,该函数用来获取订阅的结果。 用户应用程序将其置于一个循环之中。 如两次调用`taos_consume`的间隔小于订阅的轮询周期,API将会阻塞,直到时间间隔超过此周期。 如果数据库有新记录到达,该API将返回该最新的记录,否则返回一个没有记录的空结果集。 如果返回值为 `NULL`,说明系统出错。 异步模式下,用户程序不应调用此API。
|
||||||
|
|
||||||
|
**注意**:在调用 `taos_consume()` 之后,用户应用应确保尽快调用 `taos_fetch_row()` 或 `taos_fetch_block()` 来处理订阅结果,否则服务端会持续缓存查询结果数据等待客户端读取,极端情况下会导致服务端内存消耗殆尽,影响服务稳定性。
|
||||||
|
|
||||||
* `void taos_unsubscribe(TAOS_SUB *tsub, int keepProgress)`
|
* `void taos_unsubscribe(TAOS_SUB *tsub, int keepProgress)`
|
||||||
|
|
||||||
取消订阅。 如参数 `keepProgress` 不为0,API会保留订阅的进度信息,后续调用 `taos_subscribe` 时可以基于此进度继续;否则将删除进度信息,后续只能重新开始读取数据。
|
取消订阅。 如参数 `keepProgress` 不为0,API会保留订阅的进度信息,后续调用 `taos_subscribe` 时可以基于此进度继续;否则将删除进度信息,后续只能重新开始读取数据。
|
||||||
|
|
|
@ -854,7 +854,23 @@ TDengine支持针对数据的聚合查询。提供支持的聚合和选择函数
|
||||||
|
|
||||||
应用字段:不能应用在timestamp、binary、nchar、bool类型字段。
|
应用字段:不能应用在timestamp、binary、nchar、bool类型字段。
|
||||||
|
|
||||||
适用于:**表**。
|
适用于:**表、(超级表)**。
|
||||||
|
|
||||||
|
说明:从 2.1.3.0 版本开始,TWA 函数可以在由 GROUP BY 划分出单独时间线的情况下用于超级表(也即 GROUP BY tbname)。
|
||||||
|
|
||||||
|
- **IRATE**
|
||||||
|
```mysql
|
||||||
|
SELECT IRATE(field_name) FROM tb_name WHERE clause;
|
||||||
|
```
|
||||||
|
功能说明:计算瞬时增长率。使用时间区间中最后两个样本数据来计算瞬时增长速率;如果这两个值呈递减关系,那么只取最后一个数用于计算,而不是使用二者差值。
|
||||||
|
|
||||||
|
返回结果数据类型:双精度浮点数Double。
|
||||||
|
|
||||||
|
应用字段:不能应用在timestamp、binary、nchar、bool类型字段。
|
||||||
|
|
||||||
|
适用于:**表、(超级表)**。
|
||||||
|
|
||||||
|
说明:(从 2.1.3.0 版本开始新增此函数)IRATE 可以在由 GROUP BY 划分出单独时间线的情况下用于超级表(也即 GROUP BY tbname)。
|
||||||
|
|
||||||
- **SUM**
|
- **SUM**
|
||||||
```mysql
|
```mysql
|
||||||
|
@ -1203,13 +1219,14 @@ TDengine支持针对数据的聚合查询。提供支持的聚合和选择函数
|
||||||
```
|
```
|
||||||
|
|
||||||
### 计算函数
|
### 计算函数
|
||||||
|
|
||||||
- **DIFF**
|
- **DIFF**
|
||||||
```mysql
|
```mysql
|
||||||
SELECT DIFF(field_name) FROM tb_name [WHERE clause];
|
SELECT DIFF(field_name) FROM tb_name [WHERE clause];
|
||||||
```
|
```
|
||||||
功能说明:统计表中某列的值与前一行对应值的差。
|
功能说明:统计表中某列的值与前一行对应值的差。
|
||||||
|
|
||||||
返回结果数据类型: 同应用字段。
|
返回结果数据类型:同应用字段。
|
||||||
|
|
||||||
应用字段:不能应用在timestamp、binary、nchar、bool类型字段。
|
应用字段:不能应用在timestamp、binary、nchar、bool类型字段。
|
||||||
|
|
||||||
|
@ -1227,13 +1244,27 @@ TDengine支持针对数据的聚合查询。提供支持的聚合和选择函数
|
||||||
Query OK, 2 row(s) in set (0.001162s)
|
Query OK, 2 row(s) in set (0.001162s)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- **DERIVATIVE**
|
||||||
|
```mysql
|
||||||
|
SELECT DERIVATIVE(field_name, time_interval, ignore_negative) FROM tb_name [WHERE clause];
|
||||||
|
```
|
||||||
|
功能说明:统计表中某列数值的单位变化率。其中单位时间区间的长度可以通过 time_interval 参数指定,最小可以是 1 秒(1s);ignore_negative 参数的值可以是 0 或 1,为 1 时表示忽略负值。
|
||||||
|
|
||||||
|
返回结果数据类型:双精度浮点数。
|
||||||
|
|
||||||
|
应用字段:不能应用在 timestamp、binary、nchar、bool 类型字段。
|
||||||
|
|
||||||
|
适用于:**表、(超级表)**。
|
||||||
|
|
||||||
|
说明:(从 2.1.3.0 版本开始新增此函数)输出结果行数是范围内总行数减一,第一行没有结果输出。DERIVATIVE 函数可以在由 GROUP BY 划分出单独时间线的情况下用于超级表(也即 GROUP BY tbname)。
|
||||||
|
|
||||||
- **SPREAD**
|
- **SPREAD**
|
||||||
```mysql
|
```mysql
|
||||||
SELECT SPREAD(field_name) FROM { tb_name | stb_name } [WHERE clause];
|
SELECT SPREAD(field_name) FROM { tb_name | stb_name } [WHERE clause];
|
||||||
```
|
```
|
||||||
功能说明:统计表/超级表中某列的最大值和最小值之差。
|
功能说明:统计表/超级表中某列的最大值和最小值之差。
|
||||||
|
|
||||||
返回结果数据类型: 双精度浮点数。
|
返回结果数据类型:双精度浮点数。
|
||||||
|
|
||||||
应用字段:不能应用在binary、nchar、bool类型字段。
|
应用字段:不能应用在binary、nchar、bool类型字段。
|
||||||
|
|
||||||
|
|
|
@ -289,6 +289,11 @@ static FORCE_INLINE TKEY dataColsTKeyFirst(SDataCols *pCols) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static FORCE_INLINE TSKEY dataColsKeyAtRow(SDataCols *pCols, int row) {
|
||||||
|
ASSERT(row < pCols->numOfRows);
|
||||||
|
return dataColsKeyAt(pCols, row);
|
||||||
|
}
|
||||||
|
|
||||||
static FORCE_INLINE TSKEY dataColsKeyFirst(SDataCols *pCols) {
|
static FORCE_INLINE TSKEY dataColsKeyFirst(SDataCols *pCols) {
|
||||||
if (pCols->numOfRows) {
|
if (pCols->numOfRows) {
|
||||||
return dataColsKeyAt(pCols, 0);
|
return dataColsKeyAt(pCols, 0);
|
||||||
|
|
|
@ -452,7 +452,7 @@ int tdMergeDataCols(SDataCols *target, SDataCols *source, int rowsToMerge, int *
|
||||||
|
|
||||||
SDataCols *pTarget = NULL;
|
SDataCols *pTarget = NULL;
|
||||||
|
|
||||||
if ((target->numOfRows == 0) || (dataColsKeyLast(target) < dataColsKeyFirst(source))) { // No overlap
|
if ((target->numOfRows == 0) || (dataColsKeyLast(target) < dataColsKeyAtRow(source, *pOffset))) { // No overlap
|
||||||
ASSERT(target->numOfRows + rowsToMerge <= target->maxPoints);
|
ASSERT(target->numOfRows + rowsToMerge <= target->maxPoints);
|
||||||
for (int i = 0; i < rowsToMerge; i++) {
|
for (int i = 0; i < rowsToMerge; i++) {
|
||||||
for (int j = 0; j < source->numOfCols; j++) {
|
for (int j = 0; j < source->numOfCols; j++) {
|
||||||
|
|
|
@ -982,9 +982,9 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
|
||||||
arguments->len_of_binary = atoi(argv[++i]);
|
arguments->len_of_binary = atoi(argv[++i]);
|
||||||
} else if (strcmp(argv[i], "-m") == 0) {
|
} else if (strcmp(argv[i], "-m") == 0) {
|
||||||
if ((argc == i+1) ||
|
if ((argc == i+1) ||
|
||||||
(!isStringNumber(argv[i+1]))) {
|
(isStringNumber(argv[i+1]))) {
|
||||||
printHelp();
|
printHelp();
|
||||||
errorPrint("%s", "\n\t-m need a number following!\n");
|
errorPrint("%s", "\n\t-m need a letter-initial string following!\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
arguments->tb_prefix = argv[++i];
|
arguments->tb_prefix = argv[++i];
|
||||||
|
|
|
@ -18,7 +18,6 @@ from util.log import *
|
||||||
from util.cases import *
|
from util.cases import *
|
||||||
from util.sql import *
|
from util.sql import *
|
||||||
|
|
||||||
|
|
||||||
class TDTestCase:
|
class TDTestCase:
|
||||||
def init(self, conn, logSql):
|
def init(self, conn, logSql):
|
||||||
tdLog.debug("start to execute %s" % __file__)
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
|
@ -27,6 +26,7 @@ class TDTestCase:
|
||||||
def run(self):
|
def run(self):
|
||||||
tdSql.prepare()
|
tdSql.prepare()
|
||||||
# test case for https://jira.taosdata.com:18080/browse/TD-4568
|
# test case for https://jira.taosdata.com:18080/browse/TD-4568
|
||||||
|
# test case for https://jira.taosdata.com:18080/browse/TD-4824
|
||||||
|
|
||||||
tdLog.info("=============== step1,check bool and tinyint data type")
|
tdLog.info("=============== step1,check bool and tinyint data type")
|
||||||
|
|
||||||
|
@ -137,8 +137,28 @@ class TDTestCase:
|
||||||
tdSql.checkData(0,1,'True')
|
tdSql.checkData(0,1,'True')
|
||||||
tdSql.checkData(0,2,'0')
|
tdSql.checkData(0,2,'0')
|
||||||
|
|
||||||
|
tdLog.info("=============== step1.3,multiple column and multiple tag check in function")
|
||||||
|
cmd1 = '''select * from in_stable_1
|
||||||
|
where in_bool in (true,false) and in_tinyint in (0,127,-127)
|
||||||
|
and tin_bool in (true,false) and tin_tinyint in (0,127,-127)
|
||||||
|
order by ts desc ;'''
|
||||||
|
tdLog.info(cmd1)
|
||||||
|
tdSql.query(cmd1)
|
||||||
|
tdSql.checkData(0,1,'True')
|
||||||
|
tdSql.checkData(0,2,'0')
|
||||||
|
tdSql.checkData(0,3,'False')
|
||||||
|
tdSql.checkData(0,4,'0')
|
||||||
|
tdSql.checkData(1,1,'False')
|
||||||
|
tdSql.checkData(1,2,'127')
|
||||||
|
tdSql.checkData(1,3,'False')
|
||||||
|
tdSql.checkData(1,4,'-127')
|
||||||
|
tdSql.checkData(2,1,'True')
|
||||||
|
tdSql.checkData(2,2,'-127')
|
||||||
|
tdSql.checkData(2,3,'True')
|
||||||
|
tdSql.checkData(2,4,'127')
|
||||||
|
|
||||||
tdLog.info("=============== step1.3,drop normal table && create table")
|
|
||||||
|
tdLog.info("=============== step1.4,drop normal table && create table")
|
||||||
cmd1 = 'drop table if exists normal_in_bool_tinyint_1 ;'
|
cmd1 = 'drop table if exists normal_in_bool_tinyint_1 ;'
|
||||||
cmd2 = 'create table normal_in_bool_tinyint_1 (ts timestamp,in_bool bool,in_tinyint tinyint) ; '
|
cmd2 = 'create table normal_in_bool_tinyint_1 (ts timestamp,in_bool bool,in_tinyint tinyint) ; '
|
||||||
tdLog.info(cmd1)
|
tdLog.info(cmd1)
|
||||||
|
@ -147,7 +167,7 @@ class TDTestCase:
|
||||||
tdSql.execute(cmd2)
|
tdSql.execute(cmd2)
|
||||||
|
|
||||||
|
|
||||||
tdLog.info("=============== step1.4,insert normal table right data and check in function")
|
tdLog.info("=============== step1.5,insert normal table right data and check in function")
|
||||||
cmd1 = 'insert into normal_in_bool_tinyint_1 values(now,\'true\',\'-127\') ;'
|
cmd1 = 'insert into normal_in_bool_tinyint_1 values(now,\'true\',\'-127\') ;'
|
||||||
tdLog.info(cmd1)
|
tdLog.info(cmd1)
|
||||||
tdSql.execute(cmd1)
|
tdSql.execute(cmd1)
|
||||||
|
@ -175,6 +195,17 @@ class TDTestCase:
|
||||||
tdSql.checkData(0,1,'True')
|
tdSql.checkData(0,1,'True')
|
||||||
tdSql.checkData(0,2,'0')
|
tdSql.checkData(0,2,'0')
|
||||||
|
|
||||||
|
cmd4 = '''select * from normal_in_bool_tinyint_1
|
||||||
|
where in_bool in (true,false) and in_tinyint in (0,127,-127)
|
||||||
|
order by ts desc ;'''
|
||||||
|
tdLog.info(cmd4)
|
||||||
|
tdSql.query(cmd4)
|
||||||
|
tdSql.checkData(0,1,'True')
|
||||||
|
tdSql.checkData(0,2,'0')
|
||||||
|
tdSql.checkData(1,1,'False')
|
||||||
|
tdSql.checkData(1,2,'127')
|
||||||
|
tdSql.checkData(2,1,'True')
|
||||||
|
tdSql.checkData(2,2,'-127')
|
||||||
|
|
||||||
|
|
||||||
tdLog.info("=============== step2,check int、smallint and bigint data type")
|
tdLog.info("=============== step2,check int、smallint and bigint data type")
|
||||||
|
@ -378,10 +409,39 @@ class TDTestCase:
|
||||||
tdSql.query('select * from in_int_smallint_bigint_3 where in_big in (-9223372036854775807) order by ts desc')
|
tdSql.query('select * from in_int_smallint_bigint_3 where in_big in (-9223372036854775807) order by ts desc')
|
||||||
tdSql.checkData(0,1,'0')
|
tdSql.checkData(0,1,'0')
|
||||||
tdSql.checkData(0,2,'32767')
|
tdSql.checkData(0,2,'32767')
|
||||||
tdSql.checkData(0,3,'-9223372036854775807')
|
tdSql.checkData(0,3,'-9223372036854775807')
|
||||||
|
|
||||||
|
|
||||||
tdLog.info("=============== step2.3,drop normal table && create table")
|
tdLog.info("=============== step2.3,multiple column and multiple tag check in function")
|
||||||
|
cmd1 = '''select * from in_stable_2
|
||||||
|
where in_int in (0,2147483647,-2147483647) and in_small in (0,32767,-32767)
|
||||||
|
and in_big in (0,9223372036854775807,-9223372036854775807)
|
||||||
|
and tin_int in (0,2147483647,-2147483647) and tin_small in (0,32767,-32767)
|
||||||
|
and tin_big in (0,9223372036854775807,-9223372036854775807)
|
||||||
|
order by ts desc ;'''
|
||||||
|
tdLog.info(cmd1)
|
||||||
|
tdSql.query(cmd1)
|
||||||
|
tdSql.checkData(0,1,'0')
|
||||||
|
tdSql.checkData(0,2,'32767')
|
||||||
|
tdSql.checkData(0,3,'-9223372036854775807')
|
||||||
|
tdSql.checkData(0,4,'0')
|
||||||
|
tdSql.checkData(0,5,'32767')
|
||||||
|
tdSql.checkData(0,6,'-9223372036854775807')
|
||||||
|
tdSql.checkData(1,1,'-2147483647')
|
||||||
|
tdSql.checkData(1,2,'0')
|
||||||
|
tdSql.checkData(1,3,'9223372036854775807')
|
||||||
|
tdSql.checkData(1,4,'-2147483647')
|
||||||
|
tdSql.checkData(1,5,'0')
|
||||||
|
tdSql.checkData(1,6,'9223372036854775807')
|
||||||
|
tdSql.checkData(2,1,'2147483647')
|
||||||
|
tdSql.checkData(2,2,'-32767')
|
||||||
|
tdSql.checkData(2,3,'0')
|
||||||
|
tdSql.checkData(2,4,'2147483647')
|
||||||
|
tdSql.checkData(2,5,'-32767')
|
||||||
|
tdSql.checkData(2,6,'0')
|
||||||
|
|
||||||
|
|
||||||
|
tdLog.info("=============== step2.4,drop normal table && create table")
|
||||||
cmd1 = 'drop table if exists normal_int_smallint_bigint_1 ;'
|
cmd1 = 'drop table if exists normal_int_smallint_bigint_1 ;'
|
||||||
cmd2 = 'create table normal_int_smallint_bigint_1 (ts timestamp,in_int int,in_small smallint , in_big bigint) ; '
|
cmd2 = 'create table normal_int_smallint_bigint_1 (ts timestamp,in_int int,in_small smallint , in_big bigint) ; '
|
||||||
tdLog.info(cmd1)
|
tdLog.info(cmd1)
|
||||||
|
@ -390,7 +450,7 @@ class TDTestCase:
|
||||||
tdSql.execute(cmd2)
|
tdSql.execute(cmd2)
|
||||||
|
|
||||||
|
|
||||||
tdLog.info("=============== step2.4,insert normal table right data and check in function")
|
tdLog.info("=============== step2.5,insert normal table right data and check in function")
|
||||||
cmd1 = 'insert into normal_int_smallint_bigint_1 values(now,\'2147483647\',\'-32767\',\'0\') ;'
|
cmd1 = 'insert into normal_int_smallint_bigint_1 values(now,\'2147483647\',\'-32767\',\'0\') ;'
|
||||||
tdLog.info(cmd1)
|
tdLog.info(cmd1)
|
||||||
tdSql.execute(cmd1)
|
tdSql.execute(cmd1)
|
||||||
|
@ -437,7 +497,23 @@ class TDTestCase:
|
||||||
tdSql.query('select * from normal_int_smallint_bigint_1 where in_big in (-9223372036854775807) order by ts desc')
|
tdSql.query('select * from normal_int_smallint_bigint_1 where in_big in (-9223372036854775807) order by ts desc')
|
||||||
tdSql.checkData(0,1,'0')
|
tdSql.checkData(0,1,'0')
|
||||||
tdSql.checkData(0,2,'32767')
|
tdSql.checkData(0,2,'32767')
|
||||||
tdSql.checkData(0,3,'-9223372036854775807')
|
tdSql.checkData(0,3,'-9223372036854775807')
|
||||||
|
|
||||||
|
cmd4 = '''select * from normal_int_smallint_bigint_1
|
||||||
|
where in_int in (0,2147483647,-2147483647) and in_small in (0,32767,-32767)
|
||||||
|
and in_big in (0,9223372036854775807,-9223372036854775807)
|
||||||
|
order by ts desc ;'''
|
||||||
|
tdLog.info(cmd4)
|
||||||
|
tdSql.query(cmd4)
|
||||||
|
tdSql.checkData(0,1,'0')
|
||||||
|
tdSql.checkData(0,2,'32767')
|
||||||
|
tdSql.checkData(0,3,'-9223372036854775807')
|
||||||
|
tdSql.checkData(1,1,'-2147483647')
|
||||||
|
tdSql.checkData(1,2,'0')
|
||||||
|
tdSql.checkData(1,3,'9223372036854775807')
|
||||||
|
tdSql.checkData(2,1,'2147483647')
|
||||||
|
tdSql.checkData(2,2,'-32767')
|
||||||
|
tdSql.checkData(2,3,'0')
|
||||||
|
|
||||||
|
|
||||||
tdLog.info("=============== step3,check binary and nchar data type")
|
tdLog.info("=============== step3,check binary and nchar data type")
|
||||||
|
@ -560,7 +636,30 @@ class TDTestCase:
|
||||||
tdSql.checkData(0,2,'北京涛思数据科技有限公司')
|
tdSql.checkData(0,2,'北京涛思数据科技有限公司')
|
||||||
|
|
||||||
|
|
||||||
tdLog.info("=============== step3.3,drop normal table && create table")
|
tdLog.info("=============== step3.3,multiple column and multiple tag check in function")
|
||||||
|
cmd1 = '''select * from in_stable_3
|
||||||
|
where in_binary in (\'0\',\'TDengine\',\'TAOS\')
|
||||||
|
and in_nchar in (\'0\',\'北京涛思数据科技有限公司\',\'涛思数据TAOSdata\')
|
||||||
|
and tin_binary in (\'0\',\'TDengine\',\'taosdataTDengine\')
|
||||||
|
and tin_nchar in (\'0\',\'北京涛思数据科技有限公司\',\'北京涛思数据科技有限公司TDengine\')
|
||||||
|
order by ts desc ;'''
|
||||||
|
tdLog.info(cmd1)
|
||||||
|
tdSql.query(cmd1)
|
||||||
|
tdSql.checkData(0,1,'TDengine')
|
||||||
|
tdSql.checkData(0,2,'北京涛思数据科技有限公司')
|
||||||
|
tdSql.checkData(0,3,'taosdataTDengine')
|
||||||
|
tdSql.checkData(0,4,'北京涛思数据科技有限公司TDengine')
|
||||||
|
tdSql.checkData(1,1,'TAOS')
|
||||||
|
tdSql.checkData(1,2,'涛思数据TAOSdata')
|
||||||
|
tdSql.checkData(1,3,'TDengine')
|
||||||
|
tdSql.checkData(1,4,'北京涛思数据科技有限公司')
|
||||||
|
tdSql.checkData(2,1,'0')
|
||||||
|
tdSql.checkData(2,2,'0')
|
||||||
|
tdSql.checkData(2,3,'0')
|
||||||
|
tdSql.checkData(2,4,'0')
|
||||||
|
|
||||||
|
|
||||||
|
tdLog.info("=============== step3.4,drop normal table && create table")
|
||||||
cmd1 = 'drop table if exists normal_in_binary_nchar_1 ;'
|
cmd1 = 'drop table if exists normal_in_binary_nchar_1 ;'
|
||||||
cmd2 = 'create table normal_in_binary_nchar_1 (ts timestamp,in_binary binary(8),in_nchar nchar(12)) ; '
|
cmd2 = 'create table normal_in_binary_nchar_1 (ts timestamp,in_binary binary(8),in_nchar nchar(12)) ; '
|
||||||
tdLog.info(cmd1)
|
tdLog.info(cmd1)
|
||||||
|
@ -569,7 +668,7 @@ class TDTestCase:
|
||||||
tdSql.execute(cmd2)
|
tdSql.execute(cmd2)
|
||||||
|
|
||||||
|
|
||||||
tdLog.info("=============== step3.4,insert normal table right data and check in function")
|
tdLog.info("=============== step3.5,insert normal table right data and check in function")
|
||||||
cmd1 = 'insert into normal_in_binary_nchar_1 values(now,\'0\',\'0\') ;'
|
cmd1 = 'insert into normal_in_binary_nchar_1 values(now,\'0\',\'0\') ;'
|
||||||
tdLog.info(cmd1)
|
tdLog.info(cmd1)
|
||||||
tdSql.execute(cmd1)
|
tdSql.execute(cmd1)
|
||||||
|
@ -598,124 +697,413 @@ class TDTestCase:
|
||||||
tdSql.checkData(0,2,'北京涛思数据科技有限公司')
|
tdSql.checkData(0,2,'北京涛思数据科技有限公司')
|
||||||
tdSql.query('select * from normal_in_binary_nchar_1 where in_nchar in (\'北京涛思数据科技有限公司\') order by ts desc')
|
tdSql.query('select * from normal_in_binary_nchar_1 where in_nchar in (\'北京涛思数据科技有限公司\') order by ts desc')
|
||||||
tdSql.checkData(0,1,'TDengine')
|
tdSql.checkData(0,1,'TDengine')
|
||||||
tdSql.checkData(0,2,'北京涛思数据科技有限公司')
|
tdSql.checkData(0,2,'北京涛思数据科技有限公司')
|
||||||
|
|
||||||
tdLog.info("=============== step4,check float and double data type,not support")
|
cmd4 = '''select * from normal_in_binary_nchar_1
|
||||||
|
where in_binary in (\'0\',\'TDengine\',\'TAOS\')
|
||||||
|
and in_nchar in (\'0\',\'北京涛思数据科技有限公司\',\'涛思数据TAOSdata\')
|
||||||
|
order by ts desc ;'''
|
||||||
|
tdLog.info(cmd4)
|
||||||
|
tdSql.query(cmd4)
|
||||||
|
tdSql.checkData(0,1,'TDengine')
|
||||||
|
tdSql.checkData(0,2,'北京涛思数据科技有限公司')
|
||||||
|
tdSql.checkData(1,1,'TAOS')
|
||||||
|
tdSql.checkData(1,2,'涛思数据TAOSdata')
|
||||||
|
tdSql.checkData(2,1,'0')
|
||||||
|
tdSql.checkData(2,2,'0')
|
||||||
|
|
||||||
|
|
||||||
|
tdLog.info("=============== step4,check float and double data type")
|
||||||
|
|
||||||
tdLog.info("=============== step4.1,drop table && create table")
|
tdLog.info("=============== step4.1,drop table && create table")
|
||||||
cmd1 = 'drop table if exists in_float_double_1 ;'
|
cmd1 = 'drop table if exists in_ts_float_double_1 ;'
|
||||||
|
cmd2 = 'drop table if exists in_ts_float_double_2 ;'
|
||||||
|
cmd3 = 'drop table if exists in_ts_float_double_3 ;'
|
||||||
cmd10 = 'drop table if exists in_stable_4 ;'
|
cmd10 = 'drop table if exists in_stable_4 ;'
|
||||||
cmd11 = 'create stable in_stable_4(ts timestamp,in_float float,in_double double) tags (tin_float float,tin_double double) ;'
|
cmd11 = 'create stable in_stable_4(ts timestamp,in_ts timestamp,in_float float,in_double double) tags (tin_ts timestamp,tin_float float,tin_double double) ;'
|
||||||
cmd12 = 'create table in_float_double_1 using in_stable_4 tags(\'666\',\'88888\') ; '
|
cmd12 = 'create table in_ts_float_double_1 using in_stable_4 tags(\'0\',\'0\',\'0\') ; '
|
||||||
|
cmd13 = 'create table in_ts_float_double_2 using in_stable_4 tags(\'2020-01-01 08:00:00.001\',\'666\',\'-88888\') ; '
|
||||||
|
cmd14 = 'create table in_ts_float_double_3 using in_stable_4 tags(\'2021-01-01 08:00:00.001\',\'-888.00000\',\'66666.000000000\') ; '
|
||||||
tdLog.info(cmd1)
|
tdLog.info(cmd1)
|
||||||
tdSql.execute(cmd1)
|
tdSql.execute(cmd1)
|
||||||
|
tdLog.info(cmd2)
|
||||||
|
tdSql.execute(cmd2)
|
||||||
|
tdLog.info(cmd3)
|
||||||
|
tdSql.execute(cmd3)
|
||||||
tdLog.info(cmd10)
|
tdLog.info(cmd10)
|
||||||
tdSql.execute(cmd10)
|
tdSql.execute(cmd10)
|
||||||
tdLog.info(cmd11)
|
tdLog.info(cmd11)
|
||||||
tdSql.execute(cmd11)
|
tdSql.execute(cmd11)
|
||||||
tdLog.info(cmd12)
|
tdLog.info(cmd12)
|
||||||
tdSql.execute(cmd12)
|
tdSql.execute(cmd12)
|
||||||
|
tdLog.info(cmd13)
|
||||||
|
tdSql.execute(cmd13)
|
||||||
|
tdLog.info(cmd14)
|
||||||
|
tdSql.execute(cmd14)
|
||||||
|
|
||||||
tdLog.info("=============== step4.2,insert stable right data and check in function")
|
tdLog.info("=============== step4.2,insert stable right data and check in function")
|
||||||
cmd1 = 'insert into in_float_double_1 values(now,\'888\',\'66666\') ;'
|
cmd1 = 'insert into in_ts_float_double_1 values(now,\'0\',\'0\',\'0\') ;'
|
||||||
tdLog.info(cmd1)
|
tdLog.info(cmd1)
|
||||||
tdSql.execute(cmd1)
|
tdSql.execute(cmd1)
|
||||||
|
|
||||||
|
tdSql.query('select * from in_stable_4 where in_ts in (\'0\') order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(0,2,0.00000)
|
||||||
|
tdSql.checkData(0,3,0.000000000)
|
||||||
|
tdSql.checkData(0,4,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(0,5,0.00000)
|
||||||
|
tdSql.checkData(0,6,0.000000000)
|
||||||
|
tdSql.query('select * from in_stable_4 where in_ts in (\'1970-01-01 08:00:00.000\') order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(0,2,0.00000)
|
||||||
|
tdSql.checkData(0,3,0.000000000)
|
||||||
|
tdSql.checkData(0,4,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(0,5,0.00000)
|
||||||
|
tdSql.checkData(0,6,0.000000000)
|
||||||
|
tdSql.query('select * from in_stable_4 where in_float in (0.00000) order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(0,2,0.00000)
|
||||||
|
tdSql.checkData(0,3,0.000000000)
|
||||||
|
tdSql.checkData(0,4,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(0,5,0.00000)
|
||||||
|
tdSql.checkData(0,6,0.000000000)
|
||||||
|
tdSql.query('select * from in_stable_4 where in_double in (0.000000000) order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(0,2,0.00000)
|
||||||
|
tdSql.checkData(0,3,0.000000000)
|
||||||
|
tdSql.checkData(0,4,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(0,5,0.00000)
|
||||||
|
tdSql.checkData(0,6,0.000000000)
|
||||||
|
|
||||||
|
tdSql.query('select * from in_stable_4 where tin_ts in (\'0\') order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(0,2,0.00000)
|
||||||
|
tdSql.checkData(0,3,0.000000000)
|
||||||
|
tdSql.checkData(0,4,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(0,5,0.00000)
|
||||||
|
tdSql.checkData(0,6,0.000000000)
|
||||||
|
tdSql.query('select * from in_stable_4 where tin_ts in (\'1970-01-01 08:00:00.000\') order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(0,2,0.00000)
|
||||||
|
tdSql.checkData(0,3,0.000000000)
|
||||||
|
tdSql.checkData(0,4,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(0,5,0.00000)
|
||||||
|
tdSql.checkData(0,6,0.000000000)
|
||||||
|
tdSql.query('select * from in_stable_4 where tin_float in (0.00000) order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(0,2,0.00000)
|
||||||
|
tdSql.checkData(0,3,0.000000000)
|
||||||
|
tdSql.checkData(0,4,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(0,5,0.00000)
|
||||||
|
tdSql.checkData(0,6,0.000000000)
|
||||||
|
tdSql.query('select * from in_stable_4 where tin_double in (0.000000000) order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(0,2,0.00000)
|
||||||
|
tdSql.checkData(0,3,0.000000000)
|
||||||
|
tdSql.checkData(0,4,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(0,5,0.00000)
|
||||||
|
tdSql.checkData(0,6,0.000000000)
|
||||||
|
|
||||||
|
tdSql.query('select * from in_ts_float_double_1 where in_ts in (\'0\') order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(0,2,0.00000)
|
||||||
|
tdSql.checkData(0,3,0.000000000)
|
||||||
|
tdSql.query('select * from in_ts_float_double_1 where in_ts in (\'1970-01-01 08:00:00.000\') order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(0,2,0.00000)
|
||||||
|
tdSql.checkData(0,3,0.000000000)
|
||||||
|
tdSql.query('select * from in_ts_float_double_1 where in_float in (0.00000) order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(0,2,0.00000)
|
||||||
|
tdSql.checkData(0,3,0.000000000)
|
||||||
|
tdSql.query('select * from in_ts_float_double_1 where in_double in (0.000000000) order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(0,2,0.00000)
|
||||||
|
tdSql.checkData(0,3,0.000000000)
|
||||||
|
|
||||||
cmd2 = 'select * from in_stable_4 where in_float in (\'888\');'
|
cmd2 = 'insert into in_ts_float_double_2 values(now,\'2020-01-01 08:00:00.001\',\'666\',\'-88888\') ;'
|
||||||
tdLog.info(cmd2)
|
tdLog.info(cmd2)
|
||||||
tdSql.error(cmd2)
|
tdSql.execute(cmd2)
|
||||||
try:
|
|
||||||
tdSql.execute(cmd2)
|
tdSql.query('select * from in_stable_4 where in_ts in (\'2020-01-01 08:00:00.001\') order by ts desc')
|
||||||
tdLog.exit("invalid operation: not supported filter condition")
|
tdSql.checkData(0,1,'2020-01-01 08:00:00.001000')
|
||||||
except Exception as e:
|
tdSql.checkData(0,2,666.00000)
|
||||||
tdLog.info(repr(e))
|
tdSql.checkData(0,3,-88888.000000000)
|
||||||
tdLog.info("invalid operation: not supported filter condition")
|
tdSql.checkData(0,4,'2020-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,5,666.00000)
|
||||||
|
tdSql.checkData(0,6,-88888.000000000)
|
||||||
|
tdSql.query('select * from in_stable_4 where in_ts in (\'1577836800001\') order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2020-01-01 08:00:00.001000')
|
||||||
|
tdSql.checkData(0,2,666.00000)
|
||||||
|
tdSql.checkData(0,3,-88888.000000000)
|
||||||
|
tdSql.checkData(0,4,'2020-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,5,666.00000)
|
||||||
|
tdSql.checkData(0,6,-88888.000000000)
|
||||||
|
tdSql.query('select * from in_stable_4 where in_float in (666.00000) order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2020-01-01 08:00:00.001000')
|
||||||
|
tdSql.checkData(0,2,666.00000)
|
||||||
|
tdSql.checkData(0,3,-88888.000000000)
|
||||||
|
tdSql.checkData(0,4,'2020-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,5,666.00000)
|
||||||
|
tdSql.checkData(0,6,-88888.000000000)
|
||||||
|
tdSql.query('select * from in_stable_4 where in_double in (-88888.000000000) order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2020-01-01 08:00:00.001000')
|
||||||
|
tdSql.checkData(0,2,666.00000)
|
||||||
|
tdSql.checkData(0,3,-88888.000000000)
|
||||||
|
tdSql.checkData(0,4,'2020-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,5,666.00000)
|
||||||
|
tdSql.checkData(0,6,-88888.000000000)
|
||||||
|
|
||||||
|
tdSql.query('select * from in_stable_4 where tin_ts in (\'2020-01-01 08:00:00.001000\') order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2020-01-01 08:00:00.001000')
|
||||||
|
tdSql.checkData(0,2,666.00000)
|
||||||
|
tdSql.checkData(0,3,-88888.000000000)
|
||||||
|
tdSql.checkData(0,4,'2020-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,5,666.00000)
|
||||||
|
tdSql.checkData(0,6,-88888.000000000)
|
||||||
|
tdSql.query('select * from in_stable_4 where tin_ts in (\'1577836800001\') order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2020-01-01 08:00:00.001000')
|
||||||
|
tdSql.checkData(0,2,666.00000)
|
||||||
|
tdSql.checkData(0,3,-88888.000000000)
|
||||||
|
tdSql.checkData(0,4,'2020-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,5,666.00000)
|
||||||
|
tdSql.checkData(0,6,-88888.000000000)
|
||||||
|
tdSql.query('select * from in_stable_4 where tin_float in (666.00000) order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2020-01-01 08:00:00.001000')
|
||||||
|
tdSql.checkData(0,2,666.00000)
|
||||||
|
tdSql.checkData(0,3,-88888.000000000)
|
||||||
|
tdSql.checkData(0,4,'2020-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,5,666.00000)
|
||||||
|
tdSql.checkData(0,6,-88888.000000000)
|
||||||
|
tdSql.query('select * from in_stable_4 where tin_double in (-88888.000000000) order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2020-01-01 08:00:00.001000')
|
||||||
|
tdSql.checkData(0,2,666.00000)
|
||||||
|
tdSql.checkData(0,3,-88888.000000000)
|
||||||
|
tdSql.checkData(0,4,'2020-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,5,666.00000)
|
||||||
|
tdSql.checkData(0,6,-88888.000000000)
|
||||||
|
|
||||||
|
tdSql.query('select * from in_ts_float_double_2 where in_ts in (\'1577836800001\') order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2020-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,2,666.00000)
|
||||||
|
tdSql.checkData(0,3,-88888.000000000)
|
||||||
|
tdSql.query('select * from in_ts_float_double_2 where in_ts in (\'2020-01-01 08:00:00.001\') order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2020-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,2,666.00000)
|
||||||
|
tdSql.checkData(0,3,-88888.000000000)
|
||||||
|
tdSql.query('select * from in_ts_float_double_2 where in_float in (666.00000) order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2020-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,2,666.00000)
|
||||||
|
tdSql.checkData(0,3,-88888.000000000)
|
||||||
|
tdSql.query('select * from in_ts_float_double_2 where in_double in (-88888.000000000) order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2020-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,2,666.00000)
|
||||||
|
tdSql.checkData(0,3,-88888.000000000)
|
||||||
|
|
||||||
cmd3 = 'select * from in_stable_4 where in_double in (\'66666\');'
|
cmd3 = 'insert into in_ts_float_double_3 values(now,\'2021-01-01 08:00:00.001\',\'-888.00000\',\'66666.000000000\') ;'
|
||||||
tdLog.info(cmd3)
|
tdLog.info(cmd3)
|
||||||
tdSql.error(cmd3)
|
tdSql.execute(cmd3)
|
||||||
try:
|
|
||||||
tdSql.execute(cmd3)
|
|
||||||
tdLog.exit("invalid operation: not supported filter condition")
|
|
||||||
except Exception as e:
|
|
||||||
tdLog.info(repr(e))
|
|
||||||
tdLog.info("invalid operation: not supported filter condition")
|
|
||||||
|
|
||||||
cmd4 = 'select * from in_stable_4 where tin_float in (\'666\');'
|
tdSql.query('select * from in_stable_4 where in_ts in (\'2021-01-01 08:00:00.001\') order by ts desc')
|
||||||
tdLog.info(cmd4)
|
tdSql.checkData(0,1,'2021-01-01 08:00:00.001000')
|
||||||
tdSql.error(cmd4)
|
tdSql.checkData(0,2,-888.00000)
|
||||||
try:
|
tdSql.checkData(0,3,66666.000000000)
|
||||||
tdSql.execute(cmd4)
|
tdSql.checkData(0,4,'2021-01-01 08:00:00.001')
|
||||||
tdLog.exit("invalid operation: not supported filter condition")
|
tdSql.checkData(0,5,-888.00000)
|
||||||
except Exception as e:
|
tdSql.checkData(0,6,66666.000000000)
|
||||||
tdLog.info(repr(e))
|
tdSql.query('select * from in_stable_4 where in_ts in (\'1609459200001\') order by ts desc')
|
||||||
tdLog.info("invalid operation: not supported filter condition")
|
tdSql.checkData(0,1,'2021-01-01 08:00:00.001000')
|
||||||
|
tdSql.checkData(0,2,-888.00000)
|
||||||
|
tdSql.checkData(0,3,66666.000000000)
|
||||||
|
tdSql.checkData(0,4,'2021-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,5,-888.00000)
|
||||||
|
tdSql.checkData(0,6,66666.000000000)
|
||||||
|
tdSql.query('select * from in_stable_4 where in_float in (-888.00000) order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2021-01-01 08:00:00.001000')
|
||||||
|
tdSql.checkData(0,2,-888.00000)
|
||||||
|
tdSql.checkData(0,3,66666.000000000)
|
||||||
|
tdSql.checkData(0,4,'2021-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,5,-888.00000)
|
||||||
|
tdSql.checkData(0,6,66666.000000000)
|
||||||
|
tdSql.query('select * from in_stable_4 where in_double in (66666.000000000) order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2021-01-01 08:00:00.001000')
|
||||||
|
tdSql.checkData(0,2,-888.00000)
|
||||||
|
tdSql.checkData(0,3,66666.000000000)
|
||||||
|
tdSql.checkData(0,4,'2021-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,5,-888.00000)
|
||||||
|
tdSql.checkData(0,6,66666.000000000)
|
||||||
|
|
||||||
|
tdSql.query('select * from in_stable_4 where tin_ts in (\'2021-01-01 08:00:00.001000\') order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2021-01-01 08:00:00.001000')
|
||||||
|
tdSql.checkData(0,2,-888.00000)
|
||||||
|
tdSql.checkData(0,3,66666.000000000)
|
||||||
|
tdSql.checkData(0,4,'2021-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,5,-888.00000)
|
||||||
|
tdSql.checkData(0,6,66666.000000000)
|
||||||
|
tdSql.query('select * from in_stable_4 where tin_ts in (\'1609459200001\') order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2021-01-01 08:00:00.001000')
|
||||||
|
tdSql.checkData(0,2,-888.00000)
|
||||||
|
tdSql.checkData(0,3,66666.000000000)
|
||||||
|
tdSql.checkData(0,4,'2021-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,5,-888.00000)
|
||||||
|
tdSql.checkData(0,6,66666.000000000)
|
||||||
|
tdSql.query('select * from in_stable_4 where tin_float in (-888.00000) order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2021-01-01 08:00:00.001000')
|
||||||
|
tdSql.checkData(0,2,-888.00000)
|
||||||
|
tdSql.checkData(0,3,66666.000000000)
|
||||||
|
tdSql.checkData(0,4,'2021-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,5,-888.00000)
|
||||||
|
tdSql.checkData(0,6,66666.000000000)
|
||||||
|
tdSql.query('select * from in_stable_4 where tin_double in (66666.000000000) order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2021-01-01 08:00:00.001000')
|
||||||
|
tdSql.checkData(0,2,-888.00000)
|
||||||
|
tdSql.checkData(0,3,66666.000000000)
|
||||||
|
tdSql.checkData(0,4,'2021-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,5,-888.00000)
|
||||||
|
tdSql.checkData(0,6,66666.000000000)
|
||||||
|
|
||||||
|
tdSql.query('select * from in_ts_float_double_3 where in_ts in (\'1609459200001\') order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2021-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,2,-888.00000)
|
||||||
|
tdSql.checkData(0,3,66666.000000000)
|
||||||
|
tdSql.query('select * from in_ts_float_double_3 where in_ts in (\'2021-01-01 08:00:00.001\') order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2021-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,2,-888.00000)
|
||||||
|
tdSql.checkData(0,3,66666.000000000)
|
||||||
|
tdSql.query('select * from in_ts_float_double_3 where in_float in (-888.00000) order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2021-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,2,-888.00000)
|
||||||
|
tdSql.checkData(0,3,66666.000000000)
|
||||||
|
tdSql.query('select * from in_ts_float_double_3 where in_double in (66666.000000000) order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2021-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,2,-888.00000)
|
||||||
|
tdSql.checkData(0,3,66666.000000000)
|
||||||
|
|
||||||
|
|
||||||
|
tdLog.info("=============== step4.3,multiple column and multiple tag check in function")
|
||||||
|
cmd1 = '''select * from in_stable_4
|
||||||
|
where in_ts in (\'1609459200001\',\'2021-01-01 08:00:00.001\',\'1577836800001\',\'2020-01-01 08:00:00.001000\',\'0\',\'1970-01-01 08:00:00.000\')
|
||||||
|
and in_float in (0.00000,666.00000,-888.00000)
|
||||||
|
and in_double in (0.000000000,66666.000000000,-88888.000000000)
|
||||||
|
and tin_ts in (\'1609459200001\',\'2021-01-01 08:00:00.001\',\'1577836800001\',\'2020-01-01 08:00:00.001000\',\'0\',\'1970-01-01 08:00:00.000\')
|
||||||
|
and tin_float in (0.00000,666.00000,-888.00000)
|
||||||
|
and tin_double in (0.000000000,66666.000000000,-88888.000000000)
|
||||||
|
order by ts desc ;'''
|
||||||
|
tdLog.info(cmd1)
|
||||||
|
tdSql.query(cmd1)
|
||||||
|
tdSql.checkData(0,1,'2021-01-01 08:00:00.001000')
|
||||||
|
tdSql.checkData(0,2,-888.00000)
|
||||||
|
tdSql.checkData(0,3,66666.000000000)
|
||||||
|
tdSql.checkData(0,4,'2021-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,5,-888.00000)
|
||||||
|
tdSql.checkData(0,6,66666.000000000)
|
||||||
|
tdSql.checkData(1,1,'2020-01-01 08:00:00.001000')
|
||||||
|
tdSql.checkData(1,2,666.00000)
|
||||||
|
tdSql.checkData(1,3,-88888.000000000)
|
||||||
|
tdSql.checkData(1,4,'2020-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(1,5,666.00000)
|
||||||
|
tdSql.checkData(1,6,-88888.000000000)
|
||||||
|
tdSql.checkData(2,1,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(2,2,0.00000)
|
||||||
|
tdSql.checkData(2,3,0.000000000)
|
||||||
|
tdSql.checkData(2,4,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(2,5,0.00000)
|
||||||
|
tdSql.checkData(2,6,0.000000000)
|
||||||
|
|
||||||
|
|
||||||
cmd5 = 'select * from in_stable_4 where tin_double in (\'88888\');'
|
|
||||||
tdLog.info(cmd5)
|
|
||||||
tdSql.error(cmd5)
|
|
||||||
try:
|
|
||||||
tdSql.execute(cmd5)
|
|
||||||
tdLog.exit("invalid operation: not supported filter condition")
|
|
||||||
except Exception as e:
|
|
||||||
tdLog.info(repr(e))
|
|
||||||
tdLog.info("invalid operation: not supported filter condition")
|
|
||||||
|
|
||||||
cmd6 = 'select * from in_float_double_1 where in_float in (\'888\');'
|
|
||||||
tdLog.info(cmd6)
|
|
||||||
tdSql.error(cmd6)
|
|
||||||
try:
|
|
||||||
tdSql.execute(cmd6)
|
|
||||||
tdLog.exit("invalid operation: not supported filter condition")
|
|
||||||
except Exception as e:
|
|
||||||
tdLog.info(repr(e))
|
|
||||||
tdLog.info("invalid operation: not supported filter condition")
|
|
||||||
|
|
||||||
cmd7 = 'select * from in_float_double_1 where in_double in (\'66666\');'
|
|
||||||
tdLog.info(cmd7)
|
|
||||||
tdSql.error(cmd7)
|
|
||||||
try:
|
|
||||||
tdSql.execute(cmd7)
|
|
||||||
tdLog.exit("invalid operation: not supported filter condition")
|
|
||||||
except Exception as e:
|
|
||||||
tdLog.info(repr(e))
|
|
||||||
tdLog.info("invalid operation: not supported filter condition")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tdLog.info("=============== step4.3,drop normal table && create table")
|
tdLog.info("=============== step4.4,drop normal table && create table")
|
||||||
cmd1 = 'drop table if exists normal_in_float_double_1 ;'
|
cmd1 = 'drop table if exists normal_in_ts_float_double_1 ;'
|
||||||
cmd2 = 'create table normal_in_float_double_1 (ts timestamp,in_float float,in_double double) ; '
|
cmd2 = 'create table normal_in_ts_float_double_1 (ts timestamp,in_ts timestamp,in_float float,in_double double) ; '
|
||||||
tdLog.info(cmd1)
|
tdLog.info(cmd1)
|
||||||
tdSql.execute(cmd1)
|
tdSql.execute(cmd1)
|
||||||
tdLog.info(cmd2)
|
tdLog.info(cmd2)
|
||||||
tdSql.execute(cmd2)
|
tdSql.execute(cmd2)
|
||||||
|
|
||||||
|
|
||||||
tdLog.info("=============== step4.4,insert normal table right data and check in function")
|
tdLog.info("=============== step4.5,insert normal table right data and check in function")
|
||||||
cmd1 = 'insert into normal_in_float_double_1 values(now,\'888\',\'666666\') ;'
|
cmd1 = 'insert into normal_in_ts_float_double_1 values(now,\'0\',\'0\',\'0\') ;'
|
||||||
tdLog.info(cmd1)
|
tdLog.info(cmd1)
|
||||||
tdSql.execute(cmd1)
|
tdSql.execute(cmd1)
|
||||||
|
|
||||||
cmd2 = 'select * from normal_in_float_double_1 where in_float in (\'888\');'
|
tdSql.query('select * from normal_in_ts_float_double_1 where in_ts in (\'0\') order by ts desc')
|
||||||
#tdLog.info(cmd2)
|
tdSql.checkData(0,1,'1970-01-01 08:00:00.000')
|
||||||
#tdSql.error(cmd2)
|
tdSql.checkData(0,2,0.00000)
|
||||||
#try:
|
tdSql.checkData(0,3,0.000000000)
|
||||||
# tdSql.execute(cmd2)
|
tdSql.query('select * from normal_in_ts_float_double_1 where in_ts in (\'1970-01-01 08:00:00.000\') order by ts desc')
|
||||||
# tdLog.exit("invalid operation: not supported filter condition")
|
tdSql.checkData(0,1,'1970-01-01 08:00:00.000')
|
||||||
#except Exception as e:
|
tdSql.checkData(0,2,0.00000)
|
||||||
# tdLog.info(repr(e))
|
tdSql.checkData(0,3,0.000000000)
|
||||||
# tdLog.info("invalid operation: not supported filter condition")
|
tdSql.query('select * from normal_in_ts_float_double_1 where in_float in (0.00000) order by ts desc')
|
||||||
#
|
tdSql.checkData(0,1,'1970-01-01 08:00:00.000')
|
||||||
#cmd3 = 'select * from normal_in_float_double_1 where in_double in (\'66666\');'
|
tdSql.checkData(0,2,0.00000)
|
||||||
#tdLog.info(cmd3)
|
tdSql.checkData(0,3,0.000000000)
|
||||||
#tdSql.error(cmd3)
|
tdSql.query('select * from normal_in_ts_float_double_1 where in_double in (0.000000000) order by ts desc')
|
||||||
#try:
|
tdSql.checkData(0,1,'1970-01-01 08:00:00.000')
|
||||||
# tdSql.execute(cmd3)
|
tdSql.checkData(0,2,0.00000)
|
||||||
# tdLog.exit("invalid operation: not supported filter condition")
|
tdSql.checkData(0,3,0.000000000)
|
||||||
#except Exception as e:
|
|
||||||
# tdLog.info(repr(e))
|
cmd2 = 'insert into normal_in_ts_float_double_1 values(now,\'2020-01-01 08:00:00.001\',\'666\',\'-88888\') ;'
|
||||||
# tdLog.info("invalid operation: not supported filter condition")
|
tdLog.info(cmd2)
|
||||||
|
tdSql.execute(cmd2)
|
||||||
|
|
||||||
|
tdSql.query('select * from normal_in_ts_float_double_1 where in_ts in (\'1577836800001\') order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2020-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,2,666.00000)
|
||||||
|
tdSql.checkData(0,3,-88888.000000000)
|
||||||
|
tdSql.query('select * from normal_in_ts_float_double_1 where in_ts in (\'2020-01-01 08:00:00.001\') order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2020-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,2,666.00000)
|
||||||
|
tdSql.checkData(0,3,-88888.000000000)
|
||||||
|
tdSql.query('select * from normal_in_ts_float_double_1 where in_float in (666.00000) order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2020-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,2,666.00000)
|
||||||
|
tdSql.checkData(0,3,-88888.000000000)
|
||||||
|
tdSql.query('select * from normal_in_ts_float_double_1 where in_double in (-88888.000000000) order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2020-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,2,666.00000)
|
||||||
|
tdSql.checkData(0,3,-88888.000000000)
|
||||||
|
|
||||||
|
cmd3 = 'insert into normal_in_ts_float_double_1 values(now,\'2021-01-01 08:00:00.001\',\'-888.00000\',\'66666.000000000\') ;'
|
||||||
|
tdLog.info(cmd3)
|
||||||
|
tdSql.execute(cmd3)
|
||||||
|
|
||||||
|
tdSql.query('select * from normal_in_ts_float_double_1 where in_ts in (\'1609459200001\') order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2021-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,2,-888.00000)
|
||||||
|
tdSql.checkData(0,3,66666.000000000)
|
||||||
|
tdSql.query('select * from normal_in_ts_float_double_1 where in_ts in (\'2021-01-01 08:00:00.001\') order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2021-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,2,-888.00000)
|
||||||
|
tdSql.checkData(0,3,66666.000000000)
|
||||||
|
tdSql.query('select * from normal_in_ts_float_double_1 where in_float in (-888.00000) order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2021-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,2,-888.00000)
|
||||||
|
tdSql.checkData(0,3,66666.000000000)
|
||||||
|
tdSql.query('select * from normal_in_ts_float_double_1 where in_double in (66666.000000000) order by ts desc')
|
||||||
|
tdSql.checkData(0,1,'2021-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,2,-888.00000)
|
||||||
|
tdSql.checkData(0,3,66666.000000000)
|
||||||
|
|
||||||
|
cmd4 = '''select * from normal_in_ts_float_double_1
|
||||||
|
where in_ts in (\'1609459200001\',\'2021-01-01 08:00:00.001\',\'1577836800001\',\'2020-01-01 08:00:00.001000\',\'0\',\'1970-01-01 08:00:00.000\')
|
||||||
|
and in_double in (0.000000000,66666.000000000,-88888.000000000)
|
||||||
|
and in_float in (0.00000,666.00000,-888.00000)
|
||||||
|
order by ts desc ;'''
|
||||||
|
tdLog.info(cmd4)
|
||||||
|
tdSql.query(cmd4)
|
||||||
|
tdSql.checkData(0,1,'2021-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(0,2,-888.00000)
|
||||||
|
tdSql.checkData(0,3,66666.000000000)
|
||||||
|
tdSql.checkData(1,1,'2020-01-01 08:00:00.001')
|
||||||
|
tdSql.checkData(1,2,666.00000)
|
||||||
|
tdSql.checkData(1,3,-88888.000000000)
|
||||||
|
tdSql.checkData(2,1,'1970-01-01 08:00:00.000')
|
||||||
|
tdSql.checkData(2,2,0.00000)
|
||||||
|
tdSql.checkData(2,3,0.000000000)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
|
|
|
@ -45,7 +45,9 @@ class TDTestCase:
|
||||||
for i in range(100):
|
for i in range(100):
|
||||||
sql += "(%d, %d, 'nchar%d')" % (currts + i, i % 100, i % 100)
|
sql += "(%d, %d, 'nchar%d')" % (currts + i, i % 100, i % 100)
|
||||||
tdSql.execute(sql)
|
tdSql.execute(sql)
|
||||||
|
|
||||||
|
|
||||||
|
os.system("rm /tmp/*.sql")
|
||||||
os.system("taosdump --databases db -o /tmp")
|
os.system("taosdump --databases db -o /tmp")
|
||||||
|
|
||||||
tdSql.execute("drop database db")
|
tdSql.execute("drop database db")
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
###################################################################
|
||||||
|
# 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
|
||||||
|
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 = 1601481600000
|
||||||
|
self.numberOfTables = 1
|
||||||
|
self.numberOfRecords = 15000
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
|
||||||
|
tdSql.execute("create table st(ts timestamp, c1 timestamp, c2 int, c3 bigint, c4 float, c5 double, c6 binary(8), c7 smallint, c8 tinyint, c9 bool, c10 nchar(8)) tags(t1 int)")
|
||||||
|
tdSql.execute("create table t1 using st tags(0)")
|
||||||
|
currts = self.ts
|
||||||
|
finish = 0
|
||||||
|
while(finish < self.numberOfRecords):
|
||||||
|
sql = "insert into t1 values"
|
||||||
|
for i in range(finish, self.numberOfRecords):
|
||||||
|
sql += "(%d, 1019774612, 29931, 1442173978, 165092.468750, 1128.643179, 'MOCq1pTu', 18405, 82, 0, 'g0A6S0Fu')" % (currts + i)
|
||||||
|
finish = i + 1
|
||||||
|
if (1048576 - len(sql)) < 16384:
|
||||||
|
break
|
||||||
|
tdSql.execute(sql)
|
||||||
|
|
||||||
|
os.system("rm /tmp/*.sql")
|
||||||
|
os.system("taosdump --databases db -o /tmp -B 32766 -L 1048576")
|
||||||
|
|
||||||
|
tdSql.execute("drop database db")
|
||||||
|
tdSql.query("show databases")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
|
os.system("taosdump -i /tmp")
|
||||||
|
|
||||||
|
tdSql.query("show databases")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 'db')
|
||||||
|
|
||||||
|
tdSql.execute("use db")
|
||||||
|
tdSql.query("show stables")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.checkData(0, 0, 'st')
|
||||||
|
|
||||||
|
tdSql.query("select count(*) from t1")
|
||||||
|
tdSql.checkData(0, 0, self.numberOfRecords)
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
Loading…
Reference in New Issue